qlogicagent 0.5.2 → 0.5.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.
Files changed (173) hide show
  1. package/README.md +402 -402
  2. package/dist/agent.js +18 -0
  3. package/dist/cli.js +360 -0
  4. package/dist/contracts.js +1 -0
  5. package/dist/index.js +22 -0
  6. package/dist/orchestration.js +125 -0
  7. package/dist/types/agent/agent.d.ts +43 -0
  8. package/dist/types/agent/constants.d.ts +47 -0
  9. package/dist/types/agent/tool-loop.d.ts +96 -0
  10. package/dist/types/agent/types.d.ts +250 -0
  11. package/dist/types/cli/main.d.ts +11 -0
  12. package/dist/types/cli/stdio-server.d.ts +56 -0
  13. package/dist/types/cli/tool-bootstrap.d.ts +21 -0
  14. package/dist/types/config/config.d.ts +17 -0
  15. package/dist/types/contracts/hooks.d.ts +175 -0
  16. package/dist/types/contracts/index.d.ts +10 -0
  17. package/dist/types/contracts/planner.d.ts +35 -0
  18. package/dist/types/contracts/skill-candidate.d.ts +63 -0
  19. package/dist/types/contracts/todo.d.ts +14 -0
  20. package/dist/types/index.d.ts +13 -0
  21. package/dist/types/llm/builtin-providers.d.ts +10 -0
  22. package/dist/types/llm/debug-transport.d.ts +12 -0
  23. package/dist/types/llm/index.d.ts +16 -0
  24. package/dist/types/llm/llm-client.d.ts +43 -0
  25. package/dist/types/llm/model-catalog.d.ts +53 -0
  26. package/dist/types/llm/provider-def.d.ts +59 -0
  27. package/dist/types/llm/provider-registry.d.ts +54 -0
  28. package/dist/types/llm/transport.d.ts +62 -0
  29. package/dist/types/llm/transports/anthropic-messages.d.ts +31 -0
  30. package/dist/types/llm/transports/openai-chat.d.ts +36 -0
  31. package/dist/types/orchestration/agent-registry.d.ts +46 -0
  32. package/dist/types/orchestration/context-collapse.d.ts +58 -0
  33. package/dist/types/orchestration/context-compression.d.ts +301 -0
  34. package/dist/types/orchestration/conversation-repair.d.ts +61 -0
  35. package/dist/types/orchestration/curator-scheduler.d.ts +119 -0
  36. package/dist/types/orchestration/error-classification.d.ts +12 -0
  37. package/dist/types/orchestration/failover-classification.d.ts +8 -0
  38. package/dist/types/orchestration/failover-error.d.ts +33 -0
  39. package/dist/types/orchestration/fork-subagent.d.ts +100 -0
  40. package/dist/types/orchestration/index.d.ts +113 -0
  41. package/dist/types/orchestration/memory-provider.d.ts +14 -0
  42. package/dist/types/orchestration/reactive-compact.d.ts +73 -0
  43. package/dist/types/orchestration/retry-loop.d.ts +69 -0
  44. package/dist/types/orchestration/skill-candidate.d.ts +52 -0
  45. package/dist/types/orchestration/skill-consolidation.d.ts +123 -0
  46. package/dist/types/orchestration/skill-improvement.d.ts +59 -0
  47. package/dist/types/orchestration/skill-similarity.d.ts +98 -0
  48. package/dist/types/orchestration/task-types.d.ts +142 -0
  49. package/dist/types/orchestration/team-orchestration.d.ts +195 -0
  50. package/dist/types/orchestration/team-tool-loop-wiring.d.ts +92 -0
  51. package/dist/types/orchestration/tool-choice-policy.d.ts +54 -0
  52. package/dist/types/orchestration/tool-loop-state.d.ts +50 -0
  53. package/dist/types/orchestration/tool-schema.d.ts +39 -0
  54. package/dist/types/orchestration/turn-loop-guard.d.ts +86 -0
  55. package/dist/types/runtime/execution/dream-agent.d.ts +199 -0
  56. package/dist/types/runtime/execution/forked-agent.d.ts +111 -0
  57. package/dist/types/runtime/execution/index.d.ts +6 -0
  58. package/dist/types/runtime/execution/progress-tracker.d.ts +78 -0
  59. package/dist/types/runtime/execution/remote-agent.d.ts +63 -0
  60. package/dist/types/runtime/execution/streaming-tool-executor.d.ts +100 -0
  61. package/dist/types/runtime/execution/tool-eligibility.d.ts +59 -0
  62. package/dist/types/runtime/execution/tool-result-storage.d.ts +87 -0
  63. package/dist/types/runtime/hooks/context-compression.d.ts +61 -0
  64. package/dist/types/runtime/hooks/hook-registry.d.ts +12 -0
  65. package/dist/types/runtime/hooks/index.d.ts +3 -0
  66. package/dist/types/runtime/hooks/memory-hooks.d.ts +49 -0
  67. package/dist/types/runtime/index.d.ts +5 -0
  68. package/dist/types/runtime/infra/cleanup-registry.d.ts +23 -0
  69. package/dist/types/runtime/infra/file-watcher.d.ts +72 -0
  70. package/dist/types/runtime/infra/index.d.ts +6 -0
  71. package/dist/types/runtime/infra/secure-storage.d.ts +81 -0
  72. package/dist/types/runtime/infra/task-runtime.d.ts +108 -0
  73. package/dist/types/runtime/infra/token-budget.d.ts +92 -0
  74. package/dist/types/runtime/infra/worktree-backend.d.ts +85 -0
  75. package/dist/types/runtime/prompt/environment-context.d.ts +23 -0
  76. package/dist/types/runtime/prompt/index.d.ts +3 -0
  77. package/dist/types/runtime/prompt/instruction-loader.d.ts +64 -0
  78. package/dist/types/runtime/prompt/system-prompt-sections.d.ts +63 -0
  79. package/dist/types/runtime/session/index.d.ts +2 -0
  80. package/dist/types/runtime/session/session-memory.d.ts +91 -0
  81. package/dist/types/runtime/session/session-persistence.d.ts +94 -0
  82. package/dist/types/runtime/session/session-state.d.ts +117 -0
  83. package/dist/types/skills/index.d.ts +125 -0
  84. package/dist/types/skills/mcp/index.d.ts +3 -0
  85. package/dist/types/skills/mcp/mcp-http-client.d.ts +66 -0
  86. package/dist/types/skills/mcp/mcp-manager.d.ts +84 -0
  87. package/dist/types/skills/mcp/mcp-stdio-client.d.ts +84 -0
  88. package/dist/types/skills/memory-extractor.d.ts +64 -0
  89. package/dist/types/skills/memory-query-tool.d.ts +43 -0
  90. package/dist/types/skills/memory-store.d.ts +66 -0
  91. package/dist/types/skills/memory-tool.d.ts +67 -0
  92. package/dist/types/skills/permissions/bash-classifier.d.ts +30 -0
  93. package/dist/types/skills/permissions/classifier-cache.d.ts +51 -0
  94. package/dist/types/skills/permissions/denial-tracking.d.ts +42 -0
  95. package/dist/types/skills/permissions/hook-runner.d.ts +85 -0
  96. package/dist/types/skills/permissions/index.d.ts +12 -0
  97. package/dist/types/skills/permissions/permission-classifier.d.ts +41 -0
  98. package/dist/types/skills/permissions/rule-engine.d.ts +41 -0
  99. package/dist/types/skills/permissions/settings-watcher.d.ts +46 -0
  100. package/dist/types/skills/permissions/types.d.ts +113 -0
  101. package/dist/types/skills/plugins/index.d.ts +2 -0
  102. package/dist/types/skills/plugins/plugin-api.d.ts +38 -0
  103. package/dist/types/skills/plugins/plugin-loader.d.ts +45 -0
  104. package/dist/types/skills/plugins/plugin-marketplace.d.ts +61 -0
  105. package/dist/types/skills/portable-tool.d.ts +71 -0
  106. package/dist/types/skills/qmemory-adapter.d.ts +42 -0
  107. package/dist/types/skills/skill-frontmatter.d.ts +19 -0
  108. package/dist/types/skills/skill-guard.d.ts +23 -0
  109. package/dist/types/skills/skill-loader.d.ts +16 -0
  110. package/dist/types/skills/skill-source.d.ts +119 -0
  111. package/dist/types/skills/skill-types.d.ts +199 -0
  112. package/dist/types/skills/think-tool.d.ts +16 -0
  113. package/dist/types/skills/todo-tool.d.ts +63 -0
  114. package/dist/types/skills/tool-registry.d.ts +29 -0
  115. package/dist/types/skills/tools/agent-tool.d.ts +91 -0
  116. package/dist/types/skills/tools/apply-patch-tool.d.ts +29 -0
  117. package/dist/types/skills/tools/ask-user-tool.d.ts +80 -0
  118. package/dist/types/skills/tools/brief-tool.d.ts +74 -0
  119. package/dist/types/skills/tools/browser-tool.d.ts +114 -0
  120. package/dist/types/skills/tools/checkpoint-tool.d.ts +66 -0
  121. package/dist/types/skills/tools/config-tool.d.ts +63 -0
  122. package/dist/types/skills/tools/cron-tool.d.ts +116 -0
  123. package/dist/types/skills/tools/edit-tool.d.ts +43 -0
  124. package/dist/types/skills/tools/exec-tool.d.ts +97 -0
  125. package/dist/types/skills/tools/image-generate-tool.d.ts +62 -0
  126. package/dist/types/skills/tools/instructions-tool.d.ts +103 -0
  127. package/dist/types/skills/tools/lsp-tool.d.ts +153 -0
  128. package/dist/types/skills/tools/mcp-client-types.d.ts +269 -0
  129. package/dist/types/skills/tools/mcp-resource-tools.d.ts +14 -0
  130. package/dist/types/skills/tools/mcp-tool.d.ts +249 -0
  131. package/dist/types/skills/tools/memory-tool.d.ts +74 -0
  132. package/dist/types/skills/tools/monitor-tool.d.ts +113 -0
  133. package/dist/types/skills/tools/music-generate-tool.d.ts +55 -0
  134. package/dist/types/skills/tools/notebook-edit-tool.d.ts +15 -0
  135. package/dist/types/skills/tools/notify-tool.d.ts +53 -0
  136. package/dist/types/skills/tools/patch-tool.d.ts +45 -0
  137. package/dist/types/skills/tools/pdf-tool.d.ts +66 -0
  138. package/dist/types/skills/tools/plan-mode-tool.d.ts +98 -0
  139. package/dist/types/skills/tools/read-tool.d.ts +51 -0
  140. package/dist/types/skills/tools/repl-tool.d.ts +70 -0
  141. package/dist/types/skills/tools/search-tool.d.ts +112 -0
  142. package/dist/types/skills/tools/send-message-tool.d.ts +51 -0
  143. package/dist/types/skills/tools/shell/bash-provider.d.ts +26 -0
  144. package/dist/types/skills/tools/shell/command-classification.d.ts +44 -0
  145. package/dist/types/skills/tools/shell/command-semantics.d.ts +14 -0
  146. package/dist/types/skills/tools/shell/destructive-command-warning.d.ts +10 -0
  147. package/dist/types/skills/tools/shell/exec-permissions.d.ts +52 -0
  148. package/dist/types/skills/tools/shell/index.d.ts +17 -0
  149. package/dist/types/skills/tools/shell/powershell-provider.d.ts +15 -0
  150. package/dist/types/skills/tools/shell/shell-command.d.ts +54 -0
  151. package/dist/types/skills/tools/shell/shell-exec.d.ts +33 -0
  152. package/dist/types/skills/tools/shell/shell-provider.d.ts +85 -0
  153. package/dist/types/skills/tools/shell/task-output.d.ts +45 -0
  154. package/dist/types/skills/tools/skill-invoke-tool.d.ts +46 -0
  155. package/dist/types/skills/tools/skill-list-tool.d.ts +33 -0
  156. package/dist/types/skills/tools/skill-manage-tool.d.ts +73 -0
  157. package/dist/types/skills/tools/skill-view-tool.d.ts +37 -0
  158. package/dist/types/skills/tools/sleep-tool.d.ts +49 -0
  159. package/dist/types/skills/tools/structured-output-tool.d.ts +116 -0
  160. package/dist/types/skills/tools/task-tool.d.ts +104 -0
  161. package/dist/types/skills/tools/team-tool.d.ts +89 -0
  162. package/dist/types/skills/tools/tool-search-tool.d.ts +51 -0
  163. package/dist/types/skills/tools/tts-tool.d.ts +38 -0
  164. package/dist/types/skills/tools/video-edit-tool.d.ts +69 -0
  165. package/dist/types/skills/tools/video-generate-tool.d.ts +62 -0
  166. package/dist/types/skills/tools/video-merge-tool.d.ts +105 -0
  167. package/dist/types/skills/tools/video-upscale-tool.d.ts +45 -0
  168. package/dist/types/skills/tools/web-fetch-tool.d.ts +78 -0
  169. package/dist/types/skills/tools/web-search-tool.d.ts +57 -0
  170. package/dist/types/skills/tools/workflow-tool.d.ts +44 -0
  171. package/dist/types/skills/tools/worktree-tool.d.ts +69 -0
  172. package/dist/types/skills/tools/write-tool.d.ts +45 -0
  173. package/package.json +3 -2
@@ -0,0 +1,62 @@
1
+ import type { PortableTool } from "../portable-tool.js";
2
+ export declare const IMAGE_GENERATE_TOOL_NAME: "image_generate";
3
+ export interface ImageGenerateToolParams {
4
+ prompt: string;
5
+ purpose?: string;
6
+ style?: string;
7
+ size?: string;
8
+ image_url?: string;
9
+ n?: number;
10
+ }
11
+ export declare const IMAGE_GENERATE_TOOL_SCHEMA: {
12
+ readonly type: "object";
13
+ readonly properties: {
14
+ readonly prompt: {
15
+ readonly type: "string";
16
+ readonly description: "Image generation prompt. Enrich vague requests with style, lighting, composition, color, mood details.";
17
+ };
18
+ readonly purpose: {
19
+ readonly type: "string";
20
+ readonly description: "Intended use: 'social-media', 'short-video-cover', 'phone-wallpaper', 'avatar', 'poster', etc.";
21
+ };
22
+ readonly style: {
23
+ readonly type: "string";
24
+ readonly description: "Visual art style: 'photorealistic', 'anime', 'watercolor', 'oil-painting', '3d-render', etc.";
25
+ };
26
+ readonly size: {
27
+ readonly type: "string";
28
+ readonly description: "Dimensions: e.g. '1024x1792' (portrait), '1792x1024' (landscape), '1024x1024' (square). Default: '1024x1024'.";
29
+ };
30
+ readonly image_url: {
31
+ readonly type: "string";
32
+ readonly description: "Reference image URL for image-to-image generation (img2img). Character reference sheet or style transfer.";
33
+ };
34
+ readonly n: {
35
+ readonly type: "number";
36
+ readonly description: "Number of images to generate (1-4). Default: 1.";
37
+ };
38
+ };
39
+ readonly required: readonly ["prompt"];
40
+ };
41
+ export interface ImageGenerateResult {
42
+ mediaUrls: string[];
43
+ model?: string;
44
+ size?: string;
45
+ durationMs?: number;
46
+ }
47
+ /** Deps injected by the host runtime for image generation. */
48
+ export interface ImageGenerateToolDeps {
49
+ /**
50
+ * Generate images via the configured backend (relay, direct API, etc.).
51
+ * The host handles model selection, failover, watermark, and storage.
52
+ */
53
+ generateImage(params: {
54
+ prompt: string;
55
+ purpose?: string;
56
+ style?: string;
57
+ size?: string;
58
+ imageUrl?: string;
59
+ n?: number;
60
+ }): Promise<ImageGenerateResult>;
61
+ }
62
+ export declare function createImageGenerateTool(deps: ImageGenerateToolDeps): PortableTool<ImageGenerateToolParams>;
@@ -0,0 +1,103 @@
1
+ import type { PortableTool } from "../portable-tool.js";
2
+ /** A single instruction file entry. */
3
+ export interface InstructionFileInfo {
4
+ filename: string;
5
+ path: string;
6
+ size: number;
7
+ updatedAt: string;
8
+ }
9
+ /** Full instruction file (with content). */
10
+ export interface InstructionFileContent extends InstructionFileInfo {
11
+ content: string;
12
+ }
13
+ /** Deps injected by the host runtime for instructions CRUD. */
14
+ export interface InstructionsToolDeps {
15
+ /** List all instruction files for a project (recursive). */
16
+ list(projectId: string): InstructionFileInfo[];
17
+ /** Read a single instruction file. Returns null if not found. */
18
+ read(projectId: string, filename: string): InstructionFileContent | null;
19
+ /** Write (create or overwrite) an instruction file. */
20
+ write(projectId: string, filename: string, content: string): InstructionFileContent;
21
+ /** Remove an instruction file. Returns true if deleted. */
22
+ remove(projectId: string, filename: string): boolean;
23
+ }
24
+ export declare const INSTRUCTIONS_LIST_TOOL_NAME: "instructions_list";
25
+ export interface InstructionsListParams {
26
+ project_id: string;
27
+ }
28
+ export declare const INSTRUCTIONS_LIST_SCHEMA: {
29
+ readonly type: "object";
30
+ readonly properties: {
31
+ readonly project_id: {
32
+ readonly type: "string";
33
+ readonly description: "Project ID to list instructions for. Use \"default\" for the default project.";
34
+ };
35
+ };
36
+ readonly required: readonly ["project_id"];
37
+ };
38
+ export declare function createInstructionsListTool(deps: InstructionsToolDeps): PortableTool<InstructionsListParams>;
39
+ export declare const INSTRUCTIONS_READ_TOOL_NAME: "instructions_read";
40
+ export interface InstructionsReadParams {
41
+ project_id: string;
42
+ filename: string;
43
+ }
44
+ export declare const INSTRUCTIONS_READ_SCHEMA: {
45
+ readonly type: "object";
46
+ readonly properties: {
47
+ readonly project_id: {
48
+ readonly type: "string";
49
+ readonly description: "Project ID. Use \"default\" for the default project.";
50
+ };
51
+ readonly filename: {
52
+ readonly type: "string";
53
+ readonly description: "Instruction file name (e.g. \"code-style.md\"). Supports sub-paths like \"testing/unit-test.md\".";
54
+ };
55
+ };
56
+ readonly required: readonly ["project_id", "filename"];
57
+ };
58
+ export declare function createInstructionsReadTool(deps: InstructionsToolDeps): PortableTool<InstructionsReadParams>;
59
+ export declare const INSTRUCTIONS_WRITE_TOOL_NAME: "instructions_write";
60
+ export interface InstructionsWriteParams {
61
+ project_id: string;
62
+ filename: string;
63
+ content: string;
64
+ }
65
+ export declare const INSTRUCTIONS_WRITE_SCHEMA: {
66
+ readonly type: "object";
67
+ readonly properties: {
68
+ readonly project_id: {
69
+ readonly type: "string";
70
+ readonly description: "Project ID. Use \"default\" for the default project.";
71
+ };
72
+ readonly filename: {
73
+ readonly type: "string";
74
+ readonly description: "Instruction file name ending in .md (e.g. \"code-style.md\"). Sub-paths like \"testing/unit-test.md\" are supported.";
75
+ };
76
+ readonly content: {
77
+ readonly type: "string";
78
+ readonly description: "Markdown content for the instruction file.";
79
+ };
80
+ };
81
+ readonly required: readonly ["project_id", "filename", "content"];
82
+ };
83
+ export declare function createInstructionsWriteTool(deps: InstructionsToolDeps): PortableTool<InstructionsWriteParams>;
84
+ export declare const INSTRUCTIONS_DELETE_TOOL_NAME: "instructions_delete";
85
+ export interface InstructionsDeleteParams {
86
+ project_id: string;
87
+ filename: string;
88
+ }
89
+ export declare const INSTRUCTIONS_DELETE_SCHEMA: {
90
+ readonly type: "object";
91
+ readonly properties: {
92
+ readonly project_id: {
93
+ readonly type: "string";
94
+ readonly description: "Project ID. Use \"default\" for the default project.";
95
+ };
96
+ readonly filename: {
97
+ readonly type: "string";
98
+ readonly description: "Instruction file name to delete (e.g. \"code-style.md\").";
99
+ };
100
+ };
101
+ readonly required: readonly ["project_id", "filename"];
102
+ };
103
+ export declare function createInstructionsDeleteTool(deps: InstructionsToolDeps): PortableTool<InstructionsDeleteParams>;
@@ -0,0 +1,153 @@
1
+ import type { PortableTool } from "../portable-tool.js";
2
+ export declare const LSP_TOOL_NAME: "lsp";
3
+ export type LspOperation = "goToDefinition" | "findReferences" | "hover" | "documentSymbol" | "diagnostics" | "completion" | "signatureHelp" | "rename" | "codeAction";
4
+ export interface LspToolParams {
5
+ /** LSP operation to perform */
6
+ operation: LspOperation;
7
+ /** File path (absolute or relative to workspace root) */
8
+ filePath: string;
9
+ /** Line number (1-indexed) */
10
+ line?: number;
11
+ /** Character position (1-indexed) */
12
+ character?: number;
13
+ /** New name (for rename operation) */
14
+ newName?: string;
15
+ /** Include context lines around results */
16
+ includeContext?: boolean;
17
+ }
18
+ export declare const LSP_TOOL_SCHEMA: {
19
+ readonly type: "object";
20
+ readonly properties: {
21
+ readonly operation: {
22
+ readonly type: "string";
23
+ readonly enum: readonly ["goToDefinition", "findReferences", "hover", "documentSymbol", "diagnostics", "completion", "signatureHelp", "rename", "codeAction"];
24
+ readonly description: string;
25
+ };
26
+ readonly filePath: {
27
+ readonly type: "string";
28
+ readonly description: "File path. Absolute or relative to workspace root.";
29
+ };
30
+ readonly line: {
31
+ readonly type: "number";
32
+ readonly description: "Line number (1-indexed). Required for positional operations.";
33
+ };
34
+ readonly character: {
35
+ readonly type: "number";
36
+ readonly description: "Character position (1-indexed). Required for positional operations.";
37
+ };
38
+ readonly newName: {
39
+ readonly type: "string";
40
+ readonly description: "New name for rename operation.";
41
+ };
42
+ readonly includeContext: {
43
+ readonly type: "boolean";
44
+ readonly description: "Include surrounding code context in results (default: true).";
45
+ };
46
+ };
47
+ readonly required: readonly ["operation", "filePath"];
48
+ };
49
+ export interface LspLocation {
50
+ filePath: string;
51
+ line: number;
52
+ character: number;
53
+ endLine?: number;
54
+ endCharacter?: number;
55
+ context?: string;
56
+ }
57
+ export interface LspSymbol {
58
+ name: string;
59
+ kind: string;
60
+ range: {
61
+ startLine: number;
62
+ endLine: number;
63
+ };
64
+ children?: LspSymbol[];
65
+ }
66
+ export interface LspDiagnostic {
67
+ message: string;
68
+ severity: "error" | "warning" | "info" | "hint";
69
+ line: number;
70
+ character: number;
71
+ source?: string;
72
+ code?: string | number;
73
+ }
74
+ export interface LspHoverInfo {
75
+ contents: string;
76
+ range?: {
77
+ startLine: number;
78
+ startCharacter: number;
79
+ endLine: number;
80
+ endCharacter: number;
81
+ };
82
+ }
83
+ export interface LspCompletion {
84
+ label: string;
85
+ kind: string;
86
+ detail?: string;
87
+ insertText?: string;
88
+ }
89
+ export interface LspRenameEdit {
90
+ filePath: string;
91
+ edits: Array<{
92
+ line: number;
93
+ character: number;
94
+ endLine: number;
95
+ endCharacter: number;
96
+ newText: string;
97
+ }>;
98
+ }
99
+ export interface LspCodeAction {
100
+ title: string;
101
+ kind?: string;
102
+ isPreferred?: boolean;
103
+ }
104
+ export type LspResult = {
105
+ type: "locations";
106
+ locations: LspLocation[];
107
+ } | {
108
+ type: "symbols";
109
+ symbols: LspSymbol[];
110
+ } | {
111
+ type: "diagnostics";
112
+ diagnostics: LspDiagnostic[];
113
+ } | {
114
+ type: "hover";
115
+ hover: LspHoverInfo | null;
116
+ } | {
117
+ type: "completions";
118
+ completions: LspCompletion[];
119
+ } | {
120
+ type: "rename";
121
+ edits: LspRenameEdit[];
122
+ } | {
123
+ type: "codeActions";
124
+ actions: LspCodeAction[];
125
+ } | {
126
+ type: "signatureHelp";
127
+ signatures: string[];
128
+ };
129
+ /**
130
+ * Host-provided LSP backend.
131
+ * The host manages language server lifecycle and connections.
132
+ */
133
+ export interface LspToolDeps {
134
+ /** Execute an LSP operation. Host dispatches to appropriate language server. */
135
+ executeOperation(params: {
136
+ operation: LspOperation;
137
+ filePath: string;
138
+ line?: number;
139
+ character?: number;
140
+ newName?: string;
141
+ includeContext?: boolean;
142
+ }): Promise<LspResult>;
143
+ /** Check if file exists and get its size */
144
+ statFile?(filePath: string): Promise<{
145
+ exists: boolean;
146
+ size: number;
147
+ } | null>;
148
+ /** Resolve relative path to absolute */
149
+ resolvePath(filePath: string): string;
150
+ /** List supported language IDs (e.g. ['typescript', 'python', 'rust']) */
151
+ supportedLanguages?(): string[];
152
+ }
153
+ export declare function createLspTool(deps: LspToolDeps): PortableTool<LspToolParams>;
@@ -0,0 +1,269 @@
1
+ /** Supported MCP transport types */
2
+ export type McpTransportType = "stdio" | "sse" | "http" | "ws" | "in-process";
3
+ /** Stdio transport configuration */
4
+ export interface McpStdioConfig {
5
+ type: "stdio";
6
+ command: string;
7
+ args?: string[];
8
+ env?: Record<string, string>;
9
+ cwd?: string;
10
+ }
11
+ /** SSE transport configuration */
12
+ export interface McpSseConfig {
13
+ type: "sse";
14
+ url: string;
15
+ headers?: Record<string, string>;
16
+ /** OAuth config for auth-required SSE servers */
17
+ oauth?: McpOAuthConfig;
18
+ }
19
+ /** Streamable HTTP transport configuration (MCP 2025-03-26) */
20
+ export interface McpHttpConfig {
21
+ type: "http";
22
+ url: string;
23
+ headers?: Record<string, string>;
24
+ /** OAuth config for auth-required HTTP servers */
25
+ oauth?: McpOAuthConfig;
26
+ }
27
+ /** WebSocket transport configuration */
28
+ export interface McpWsConfig {
29
+ type: "ws";
30
+ url: string;
31
+ headers?: Record<string, string>;
32
+ }
33
+ /** In-process transport (bundled MCP servers) */
34
+ export interface McpInProcessConfig {
35
+ type: "in-process";
36
+ /** Module identifier to load */
37
+ moduleId: string;
38
+ /** Init args passed to the in-process server */
39
+ initArgs?: Record<string, unknown>;
40
+ }
41
+ /** Union of all transport configurations */
42
+ export type McpServerConfig = McpStdioConfig | McpSseConfig | McpHttpConfig | McpWsConfig | McpInProcessConfig;
43
+ /** OAuth configuration for remote MCP servers */
44
+ export interface McpOAuthConfig {
45
+ /** Client ID (or URL-based client_id per CIMD/SEP-991) */
46
+ clientId?: string;
47
+ /** Client secret (optional, for confidential clients) */
48
+ clientSecret?: string;
49
+ /** Override authorization endpoint (otherwise discovered via RFC 8414) */
50
+ authorizationEndpoint?: string;
51
+ /** Override token endpoint */
52
+ tokenEndpoint?: string;
53
+ /** Requested scopes */
54
+ scopes?: string[];
55
+ /** Fixed callback port (otherwise picks random available port) */
56
+ callbackPort?: number;
57
+ /** Audience for token exchange (RFC 8693) */
58
+ audience?: string;
59
+ }
60
+ /** OAuth token set */
61
+ export interface McpOAuthTokens {
62
+ accessToken: string;
63
+ tokenType: string;
64
+ refreshToken?: string;
65
+ expiresAt?: number;
66
+ scope?: string;
67
+ }
68
+ /** Authentication state of a server */
69
+ export type McpAuthState = {
70
+ status: "authenticated";
71
+ tokens: McpOAuthTokens;
72
+ } | {
73
+ status: "needs-auth";
74
+ authUrl?: string;
75
+ message?: string;
76
+ } | {
77
+ status: "refreshing";
78
+ } | {
79
+ status: "step-up-required";
80
+ scope: string;
81
+ authUrl?: string;
82
+ } | {
83
+ status: "not-applicable";
84
+ };
85
+ /** Server connection status */
86
+ export type McpConnectionStatus = "connected" | "connecting" | "disconnected" | "failed" | "needs-auth" | "disabled";
87
+ /** Server capabilities (as reported by initialize) */
88
+ export interface McpServerCapabilities {
89
+ tools?: {
90
+ listChanged?: boolean;
91
+ };
92
+ resources?: {
93
+ subscribe?: boolean;
94
+ listChanged?: boolean;
95
+ };
96
+ prompts?: {
97
+ listChanged?: boolean;
98
+ };
99
+ logging?: Record<string, unknown>;
100
+ experimental?: Record<string, unknown>;
101
+ }
102
+ /** Full server connection state */
103
+ export interface McpServerState {
104
+ name: string;
105
+ config: McpServerConfig;
106
+ status: McpConnectionStatus;
107
+ capabilities?: McpServerCapabilities;
108
+ serverVersion?: string;
109
+ serverInstructions?: string;
110
+ error?: string;
111
+ /** Timestamp of last successful connection */
112
+ connectedAt?: number;
113
+ /** Number of reconnect attempts since last disconnect */
114
+ reconnectAttempts?: number;
115
+ }
116
+ /**
117
+ * An MCP tool definition as reported by tools/list.
118
+ * The host converts these into PortableTool entries for the LLM.
119
+ */
120
+ export interface McpExternalTool {
121
+ /** Tool name on the MCP server (original) */
122
+ name: string;
123
+ /** Tool description */
124
+ description?: string;
125
+ /** JSON Schema for input parameters */
126
+ inputSchema?: Record<string, unknown>;
127
+ /** Annotations from the server (readOnlyHint, destructiveHint, etc.) */
128
+ annotations?: McpToolAnnotations;
129
+ }
130
+ /** Tool behavior annotations (MCP 2025-03-26 spec) */
131
+ export interface McpToolAnnotations {
132
+ /** Hints that the tool performs only reads */
133
+ readOnlyHint?: boolean;
134
+ /** Hints that the tool may be destructive */
135
+ destructiveHint?: boolean;
136
+ /** Hints that the tool is idempotent */
137
+ idempotentHint?: boolean;
138
+ /** Hints about concurrency safety */
139
+ openWorldHint?: boolean;
140
+ /** Human-readable title for UI display */
141
+ title?: string;
142
+ }
143
+ /**
144
+ * Prefixed tool name format: mcp__{normalizedServer}__{normalizedTool}
145
+ * This ensures no collisions with built-in tools.
146
+ */
147
+ export interface McpToolIdentifier {
148
+ serverName: string;
149
+ toolName: string;
150
+ /** Full prefixed name: mcp__{server}__{tool} */
151
+ prefixedName: string;
152
+ }
153
+ /**
154
+ * Notification payload when a server's tool list changes.
155
+ * The host should re-fetch tools/list and hot-swap the tool set.
156
+ */
157
+ export interface McpToolsChangedEvent {
158
+ serverName: string;
159
+ /** Previous tool names (for diff-based cleanup) */
160
+ previousTools: string[];
161
+ /** Updated tool list */
162
+ currentTools: McpExternalTool[];
163
+ }
164
+ /** MCP Resource definition */
165
+ export interface McpResourceDefinition {
166
+ uri: string;
167
+ name: string;
168
+ mimeType?: string;
169
+ description?: string;
170
+ /** Size in bytes (if known) */
171
+ size?: number;
172
+ }
173
+ /** Resource template (parameterized URI) */
174
+ export interface McpResourceTemplate {
175
+ uriTemplate: string;
176
+ name: string;
177
+ mimeType?: string;
178
+ description?: string;
179
+ }
180
+ /** Content of a read resource */
181
+ export interface McpResourceContentItem {
182
+ uri: string;
183
+ mimeType?: string;
184
+ /** Text content (mutually exclusive with blob) */
185
+ text?: string;
186
+ /** Base64-encoded binary (mutually exclusive with text) */
187
+ blob?: string;
188
+ }
189
+ /** Persisted resource content (after binary blob handling) */
190
+ export interface McpPersistedResourceContent {
191
+ uri: string;
192
+ mimeType?: string;
193
+ text?: string;
194
+ /** Path where binary was saved to disk */
195
+ blobSavedTo?: string;
196
+ /** Size of persisted binary in bytes */
197
+ blobSize?: number;
198
+ }
199
+ /** MCP Prompt definition from prompts/list */
200
+ export interface McpPromptDefinition {
201
+ name: string;
202
+ description?: string;
203
+ arguments?: McpPromptArgument[];
204
+ }
205
+ /** Argument for an MCP prompt */
206
+ export interface McpPromptArgument {
207
+ name: string;
208
+ description?: string;
209
+ required?: boolean;
210
+ }
211
+ /** Result of prompts/get — prompt content messages */
212
+ export interface McpPromptMessage {
213
+ role: "user" | "assistant";
214
+ content: McpPromptContent;
215
+ }
216
+ export type McpPromptContent = {
217
+ type: "text";
218
+ text: string;
219
+ } | {
220
+ type: "image";
221
+ data: string;
222
+ mimeType: string;
223
+ } | {
224
+ type: "resource";
225
+ resource: {
226
+ uri: string;
227
+ text?: string;
228
+ blob?: string;
229
+ mimeType?: string;
230
+ };
231
+ };
232
+ /** MCP Elicitation request (server asks user for input) */
233
+ export interface McpElicitRequest {
234
+ message: string;
235
+ requestedSchema?: Record<string, unknown>;
236
+ }
237
+ /** Elicitation response */
238
+ export interface McpElicitResult {
239
+ action: "accept" | "deny" | "cancel";
240
+ content?: Record<string, unknown>;
241
+ }
242
+ export type McpLogLevel = "debug" | "info" | "warning" | "error" | "critical";
243
+ export interface McpLogEntry {
244
+ serverName: string;
245
+ level: McpLogLevel;
246
+ logger?: string;
247
+ data: unknown;
248
+ timestamp: number;
249
+ }
250
+ export declare const MCP_CONNECTION_TIMEOUT_MS = 30000;
251
+ export declare const MCP_REQUEST_TIMEOUT_MS = 60000;
252
+ export declare const MCP_TOOL_CALL_TIMEOUT_MS = 100000;
253
+ export declare const MCP_MAX_RECONNECT_ATTEMPTS = 5;
254
+ export declare const MCP_RECONNECT_BASE_DELAY_MS = 1000;
255
+ export declare const MCP_RECONNECT_MAX_DELAY_MS = 30000;
256
+ export declare const MCP_MAX_DESCRIPTION_LENGTH = 2048;
257
+ export declare const MCP_AUTH_CACHE_TTL_MS: number;
258
+ export declare const MCP_BATCH_SIZE_LOCAL = 3;
259
+ export declare const MCP_BATCH_SIZE_REMOTE = 20;
260
+ /** Normalize a name for use in the prefixed tool name format */
261
+ export declare function normalizeNameForMcp(name: string): string;
262
+ /** Build a prefixed tool name: mcp__{server}__{tool} */
263
+ export declare function buildMcpToolName(serverName: string, toolName: string): string;
264
+ /** Get the prefix for a server (for batch removal) */
265
+ export declare function getMcpServerPrefix(serverName: string): string;
266
+ /** Parse a prefixed tool name back into server + tool */
267
+ export declare function parseMcpToolName(prefixedName: string): McpToolIdentifier | null;
268
+ /** Check if a tool name is an MCP-injected tool */
269
+ export declare function isMcpToolName(name: string): boolean;
@@ -0,0 +1,14 @@
1
+ import type { PortableTool } from "../portable-tool.js";
2
+ import type { McpManager } from "../mcp/mcp-manager.js";
3
+ export interface ListMcpResourcesParams {
4
+ /** Filter by MCP server name (optional — omit to list from all servers) */
5
+ server?: string;
6
+ }
7
+ export declare function createListMcpResourcesTool(getMcpManager: () => McpManager | null): PortableTool<ListMcpResourcesParams>;
8
+ export interface ReadMcpResourceParams {
9
+ /** MCP server name */
10
+ server: string;
11
+ /** Resource URI to read */
12
+ uri: string;
13
+ }
14
+ export declare function createReadMcpResourceTool(getMcpManager: () => McpManager | null): PortableTool<ReadMcpResourceParams>;