qlogicagent 0.5.2 → 0.6.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.
Files changed (167) hide show
  1. package/README.md +403 -402
  2. package/dist/agent.js +18 -0
  3. package/dist/cli.js +384 -0
  4. package/dist/contracts.js +1 -0
  5. package/dist/index.js +383 -0
  6. package/dist/orchestration.js +34 -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-access.d.ts +30 -0
  10. package/dist/types/agent/tool-loop.d.ts +94 -0
  11. package/dist/types/agent/types.d.ts +238 -0
  12. package/dist/types/cli/main.d.ts +11 -0
  13. package/dist/types/cli/stdio-server.d.ts +78 -0
  14. package/dist/types/cli/tool-bootstrap.d.ts +40 -0
  15. package/dist/types/cli/transport.d.ts +40 -0
  16. package/dist/types/config/config.d.ts +17 -0
  17. package/dist/types/contracts/hooks.d.ts +175 -0
  18. package/dist/types/contracts/index.d.ts +9 -0
  19. package/dist/types/contracts/planner.d.ts +35 -0
  20. package/dist/types/contracts/todo.d.ts +23 -0
  21. package/dist/types/index.d.ts +16 -0
  22. package/dist/types/llm/builtin-providers.d.ts +10 -0
  23. package/dist/types/llm/debug-transport.d.ts +12 -0
  24. package/dist/types/llm/index.d.ts +16 -0
  25. package/dist/types/llm/llm-client.d.ts +43 -0
  26. package/dist/types/llm/model-catalog.d.ts +53 -0
  27. package/dist/types/llm/provider-def.d.ts +59 -0
  28. package/dist/types/llm/provider-registry.d.ts +54 -0
  29. package/dist/types/llm/transport.d.ts +62 -0
  30. package/dist/types/llm/transports/anthropic-messages.d.ts +31 -0
  31. package/dist/types/llm/transports/openai-chat.d.ts +36 -0
  32. package/dist/types/orchestration/context/context-collapse.d.ts +58 -0
  33. package/dist/types/orchestration/context/context-compression.d.ts +301 -0
  34. package/dist/types/orchestration/context/reactive-compact.d.ts +73 -0
  35. package/dist/types/orchestration/context/turn-loop-guard.d.ts +86 -0
  36. package/dist/types/orchestration/error-handling/error-classification.d.ts +12 -0
  37. package/dist/types/orchestration/error-handling/failover-classification.d.ts +8 -0
  38. package/dist/types/orchestration/error-handling/failover-error.d.ts +33 -0
  39. package/dist/types/orchestration/error-handling/retry-loop.d.ts +69 -0
  40. package/dist/types/orchestration/index.d.ts +15 -0
  41. package/dist/types/orchestration/skill-improvement.d.ts +59 -0
  42. package/dist/types/orchestration/subagent/agent-registry.d.ts +46 -0
  43. package/dist/types/orchestration/subagent/fork-subagent.d.ts +98 -0
  44. package/dist/types/orchestration/subagent/task-types.d.ts +142 -0
  45. package/dist/types/orchestration/tool-loop/conversation-repair.d.ts +61 -0
  46. package/dist/types/orchestration/tool-loop/tool-choice-policy.d.ts +54 -0
  47. package/dist/types/orchestration/tool-loop/tool-loop-state.d.ts +50 -0
  48. package/dist/types/orchestration/tool-loop/tool-schema.d.ts +39 -0
  49. package/dist/types/runtime/execution/dream-agent.d.ts +199 -0
  50. package/dist/types/runtime/execution/forked-agent.d.ts +109 -0
  51. package/dist/types/runtime/execution/index.d.ts +6 -0
  52. package/dist/types/runtime/execution/progress-tracker.d.ts +78 -0
  53. package/dist/types/runtime/execution/remote-agent.d.ts +63 -0
  54. package/dist/types/runtime/execution/streaming-tool-executor.d.ts +100 -0
  55. package/dist/types/runtime/execution/tool-eligibility.d.ts +59 -0
  56. package/dist/types/runtime/execution/tool-result-storage.d.ts +87 -0
  57. package/dist/types/runtime/hooks/context-compression.d.ts +61 -0
  58. package/dist/types/runtime/hooks/hook-registry.d.ts +12 -0
  59. package/dist/types/runtime/hooks/index.d.ts +3 -0
  60. package/dist/types/runtime/hooks/memory-hooks.d.ts +49 -0
  61. package/dist/types/runtime/index.d.ts +5 -0
  62. package/dist/types/runtime/infra/agent-paths.d.ts +57 -0
  63. package/dist/types/runtime/infra/checkpoint-backend.d.ts +8 -0
  64. package/dist/types/runtime/infra/cleanup-registry.d.ts +23 -0
  65. package/dist/types/runtime/infra/disk-storage.d.ts +36 -0
  66. package/dist/types/runtime/infra/file-watcher.d.ts +72 -0
  67. package/dist/types/runtime/infra/index.d.ts +8 -0
  68. package/dist/types/runtime/infra/secure-storage.d.ts +81 -0
  69. package/dist/types/runtime/infra/task-runtime.d.ts +108 -0
  70. package/dist/types/runtime/infra/token-budget.d.ts +92 -0
  71. package/dist/types/runtime/infra/worktree-backend.d.ts +85 -0
  72. package/dist/types/runtime/prompt/environment-context.d.ts +23 -0
  73. package/dist/types/runtime/prompt/index.d.ts +3 -0
  74. package/dist/types/runtime/prompt/instruction-loader.d.ts +64 -0
  75. package/dist/types/runtime/prompt/system-prompt-sections.d.ts +63 -0
  76. package/dist/types/runtime/session/index.d.ts +2 -0
  77. package/dist/types/runtime/session/session-memory.d.ts +90 -0
  78. package/dist/types/runtime/session/session-persistence.d.ts +94 -0
  79. package/dist/types/runtime/session/session-state.d.ts +117 -0
  80. package/dist/types/skills/index.d.ts +119 -0
  81. package/dist/types/skills/mcp/index.d.ts +3 -0
  82. package/dist/types/skills/mcp/mcp-http-client.d.ts +66 -0
  83. package/dist/types/skills/mcp/mcp-manager.d.ts +83 -0
  84. package/dist/types/skills/mcp/mcp-stdio-client.d.ts +84 -0
  85. package/dist/types/skills/memory/memory-extractor.d.ts +64 -0
  86. package/dist/types/skills/memory/memory-store.d.ts +86 -0
  87. package/dist/types/skills/memory/memory-tool.d.ts +87 -0
  88. package/dist/types/skills/memory/qmemory-adapter.d.ts +42 -0
  89. package/dist/types/skills/permissions/bash-classifier.d.ts +30 -0
  90. package/dist/types/skills/permissions/classifier-cache.d.ts +51 -0
  91. package/dist/types/skills/permissions/denial-tracking.d.ts +42 -0
  92. package/dist/types/skills/permissions/hook-runner.d.ts +85 -0
  93. package/dist/types/skills/permissions/index.d.ts +12 -0
  94. package/dist/types/skills/permissions/permission-classifier.d.ts +41 -0
  95. package/dist/types/skills/permissions/rule-engine.d.ts +41 -0
  96. package/dist/types/skills/permissions/settings-watcher.d.ts +46 -0
  97. package/dist/types/skills/permissions/types.d.ts +113 -0
  98. package/dist/types/skills/plugins/index.d.ts +2 -0
  99. package/dist/types/skills/plugins/plugin-api.d.ts +38 -0
  100. package/dist/types/skills/plugins/plugin-loader.d.ts +42 -0
  101. package/dist/types/skills/plugins/plugin-marketplace.d.ts +61 -0
  102. package/dist/types/skills/portable-tool.d.ts +104 -0
  103. package/dist/types/skills/skill-system/skill-frontmatter.d.ts +19 -0
  104. package/dist/types/skills/skill-system/skill-guard.d.ts +23 -0
  105. package/dist/types/skills/skill-system/skill-loader.d.ts +16 -0
  106. package/dist/types/skills/skill-system/skill-source.d.ts +119 -0
  107. package/dist/types/skills/skill-system/skill-types.d.ts +199 -0
  108. package/dist/types/skills/think-tool.d.ts +16 -0
  109. package/dist/types/skills/todo-tool.d.ts +72 -0
  110. package/dist/types/skills/tools/agent-tool.d.ts +91 -0
  111. package/dist/types/skills/tools/apply-patch-tool.d.ts +29 -0
  112. package/dist/types/skills/tools/ask-user-tool.d.ts +80 -0
  113. package/dist/types/skills/tools/brief-tool.d.ts +74 -0
  114. package/dist/types/skills/tools/browser-tool.d.ts +114 -0
  115. package/dist/types/skills/tools/checkpoint-tool.d.ts +66 -0
  116. package/dist/types/skills/tools/config-tool.d.ts +63 -0
  117. package/dist/types/skills/tools/cron-tool.d.ts +116 -0
  118. package/dist/types/skills/tools/edit-tool.d.ts +43 -0
  119. package/dist/types/skills/tools/exec-tool.d.ts +97 -0
  120. package/dist/types/skills/tools/image-generate-tool.d.ts +62 -0
  121. package/dist/types/skills/tools/instructions-tool.d.ts +65 -0
  122. package/dist/types/skills/tools/lsp-tool.d.ts +153 -0
  123. package/dist/types/skills/tools/mcp-client-types.d.ts +269 -0
  124. package/dist/types/skills/tools/mcp-resource-tools.d.ts +14 -0
  125. package/dist/types/skills/tools/mcp-tool.d.ts +249 -0
  126. package/dist/types/skills/tools/monitor-tool.d.ts +113 -0
  127. package/dist/types/skills/tools/music-generate-tool.d.ts +55 -0
  128. package/dist/types/skills/tools/notebook-edit-tool.d.ts +15 -0
  129. package/dist/types/skills/tools/notify-tool.d.ts +53 -0
  130. package/dist/types/skills/tools/patch-tool.d.ts +45 -0
  131. package/dist/types/skills/tools/plan-mode-tool.d.ts +98 -0
  132. package/dist/types/skills/tools/read-tool.d.ts +51 -0
  133. package/dist/types/skills/tools/repl-tool.d.ts +70 -0
  134. package/dist/types/skills/tools/search-tool.d.ts +112 -0
  135. package/dist/types/skills/tools/send-message-tool.d.ts +51 -0
  136. package/dist/types/skills/tools/shell/bash-provider.d.ts +26 -0
  137. package/dist/types/skills/tools/shell/command-classification.d.ts +44 -0
  138. package/dist/types/skills/tools/shell/command-semantics.d.ts +14 -0
  139. package/dist/types/skills/tools/shell/destructive-command-warning.d.ts +10 -0
  140. package/dist/types/skills/tools/shell/exec-permissions.d.ts +52 -0
  141. package/dist/types/skills/tools/shell/index.d.ts +17 -0
  142. package/dist/types/skills/tools/shell/powershell-provider.d.ts +15 -0
  143. package/dist/types/skills/tools/shell/shell-command.d.ts +54 -0
  144. package/dist/types/skills/tools/shell/shell-exec.d.ts +33 -0
  145. package/dist/types/skills/tools/shell/shell-provider.d.ts +85 -0
  146. package/dist/types/skills/tools/shell/task-output.d.ts +45 -0
  147. package/dist/types/skills/tools/skill-invoke-tool.d.ts +46 -0
  148. package/dist/types/skills/tools/skill-list-tool.d.ts +33 -0
  149. package/dist/types/skills/tools/skill-manage-tool.d.ts +73 -0
  150. package/dist/types/skills/tools/skill-view-tool.d.ts +37 -0
  151. package/dist/types/skills/tools/sleep-tool.d.ts +49 -0
  152. package/dist/types/skills/tools/structured-output-tool.d.ts +116 -0
  153. package/dist/types/skills/tools/task-tool.d.ts +104 -0
  154. package/dist/types/skills/tools/team-tool.d.ts +89 -0
  155. package/dist/types/skills/tools/tool-search-tool.d.ts +51 -0
  156. package/dist/types/skills/tools/tts-tool.d.ts +38 -0
  157. package/dist/types/skills/tools/video-edit-tool.d.ts +69 -0
  158. package/dist/types/skills/tools/video-generate-tool.d.ts +62 -0
  159. package/dist/types/skills/tools/video-merge-tool.d.ts +105 -0
  160. package/dist/types/skills/tools/video-upscale-tool.d.ts +45 -0
  161. package/dist/types/skills/tools/web-fetch-tool.d.ts +78 -0
  162. package/dist/types/skills/tools/web-search-tool.d.ts +57 -0
  163. package/dist/types/skills/tools/workflow-tool.d.ts +44 -0
  164. package/dist/types/skills/tools/worktree-tool.d.ts +69 -0
  165. package/dist/types/skills/tools/write-tool.d.ts +45 -0
  166. package/dist/types/skills/tools.d.ts +65 -0
  167. package/package.json +4 -3
@@ -0,0 +1,116 @@
1
+ import type { PortableTool } from "../portable-tool.js";
2
+ export declare const CRON_TOOL_NAME: "cron";
3
+ export type CronAction = "create" | "list" | "get" | "update" | "delete" | "pause" | "resume" | "trigger";
4
+ export interface CronToolParams {
5
+ action: CronAction;
6
+ /** Job ID (required for get/update/delete/pause/resume/trigger) */
7
+ jobId?: string;
8
+ /** Task prompt to execute on schedule */
9
+ prompt?: string;
10
+ /** Cron expression or shorthand ('5m', '1h', '0 9 * * *') */
11
+ schedule?: string;
12
+ /** Human-readable job name */
13
+ name?: string;
14
+ /** Repeat count (null = infinite) */
15
+ repeat?: number | null;
16
+ /** Allowed tools for the scheduled task */
17
+ allowedTools?: string[];
18
+ /** Whether the job is enabled */
19
+ enabled?: boolean;
20
+ }
21
+ export declare const CRON_TOOL_SCHEMA: {
22
+ readonly type: "object";
23
+ readonly properties: {
24
+ readonly action: {
25
+ readonly type: "string";
26
+ readonly enum: readonly ["create", "list", "get", "update", "delete", "pause", "resume", "trigger"];
27
+ readonly description: "CRUD action: create/list/get/update/delete/pause/resume/trigger.";
28
+ };
29
+ readonly jobId: {
30
+ readonly type: "string";
31
+ readonly description: "Job ID. Required for get/update/delete/pause/resume/trigger.";
32
+ };
33
+ readonly prompt: {
34
+ readonly type: "string";
35
+ readonly description: "Task prompt to execute on schedule. Required for create.";
36
+ };
37
+ readonly schedule: {
38
+ readonly type: "string";
39
+ readonly description: string;
40
+ };
41
+ readonly name: {
42
+ readonly type: "string";
43
+ readonly description: "Human-readable job name.";
44
+ };
45
+ readonly repeat: {
46
+ readonly type: "number";
47
+ readonly description: "Number of times to repeat (null = infinite). Default: null.";
48
+ };
49
+ readonly allowedTools: {
50
+ readonly type: "array";
51
+ readonly items: {
52
+ readonly type: "string";
53
+ };
54
+ readonly description: "Tools the scheduled task is allowed to use.";
55
+ };
56
+ readonly enabled: {
57
+ readonly type: "boolean";
58
+ readonly description: "Whether the job is enabled (for update).";
59
+ };
60
+ };
61
+ readonly required: readonly ["action"];
62
+ };
63
+ export interface CronJob {
64
+ id: string;
65
+ name: string;
66
+ prompt: string;
67
+ schedule: string;
68
+ scheduleDisplay: string;
69
+ state: "scheduled" | "paused";
70
+ enabled: boolean;
71
+ repeat: {
72
+ times: number | null;
73
+ completed: number;
74
+ };
75
+ nextRunAt?: string;
76
+ lastRunAt?: string;
77
+ lastStatus?: "success" | "error" | null;
78
+ allowedTools?: string[];
79
+ }
80
+ export interface CronResult {
81
+ success: boolean;
82
+ job?: CronJob;
83
+ jobs?: CronJob[];
84
+ error?: string;
85
+ }
86
+ /**
87
+ * Host-provided cron scheduler backend.
88
+ * Jobs are persisted locally and survive restarts.
89
+ */
90
+ export interface CronToolDeps {
91
+ createJob(params: {
92
+ prompt: string;
93
+ schedule: string;
94
+ name?: string;
95
+ repeat?: number | null;
96
+ allowedTools?: string[];
97
+ }): Promise<CronResult>;
98
+ listJobs(): Promise<CronResult>;
99
+ getJob(jobId: string): Promise<CronResult>;
100
+ updateJob(jobId: string, updates: Partial<{
101
+ prompt: string;
102
+ schedule: string;
103
+ name: string;
104
+ enabled: boolean;
105
+ repeat: number | null;
106
+ allowedTools: string[];
107
+ }>): Promise<CronResult>;
108
+ deleteJob(jobId: string): Promise<CronResult>;
109
+ pauseJob(jobId: string): Promise<CronResult>;
110
+ resumeJob(jobId: string): Promise<CronResult>;
111
+ triggerJob(jobId: string): Promise<CronResult>;
112
+ /** Validate cron schedule expression. Returns error or null. */
113
+ validateSchedule?(schedule: string): string | null;
114
+ }
115
+ export declare const MAX_CRON_JOBS = 50;
116
+ export declare function createCronTool(deps: CronToolDeps): PortableTool<CronToolParams>;
@@ -0,0 +1,43 @@
1
+ import type { PortableTool } from "../portable-tool.js";
2
+ export declare const EDIT_TOOL_NAME: "edit";
3
+ export interface EditToolParams {
4
+ path: string;
5
+ oldText: string;
6
+ newText: string;
7
+ }
8
+ export declare const EDIT_TOOL_SCHEMA: {
9
+ readonly type: "object";
10
+ readonly properties: {
11
+ readonly path: {
12
+ readonly type: "string";
13
+ readonly description: "Path to the file to edit (relative or absolute).";
14
+ };
15
+ readonly oldText: {
16
+ readonly type: "string";
17
+ readonly description: "Exact text to find and replace (must match exactly, including whitespace).";
18
+ };
19
+ readonly newText: {
20
+ readonly type: "string";
21
+ readonly description: "New text to replace the old text with.";
22
+ };
23
+ };
24
+ readonly required: readonly ["path", "oldText", "newText"];
25
+ };
26
+ /** Deps injected by the host runtime for file editing. */
27
+ export interface EditToolDeps {
28
+ /** Read file content as text. */
29
+ readFile(path: string): Promise<string>;
30
+ /** Write content back. */
31
+ writeFile(path: string, content: string): Promise<void>;
32
+ /** Resolve a relative path to absolute. */
33
+ resolvePath(input: string): string;
34
+ /**
35
+ * Check for concurrent modification before writing.
36
+ * The host tracks when each file was last read vs last modified on disk.
37
+ * Returns null if safe to write, or a descriptive warning if the file
38
+ * has been modified since last read (by user, another tool, or external process).
39
+ * If not provided, no concurrent modification check is performed.
40
+ */
41
+ checkConcurrentModification?(path: string): string | null;
42
+ }
43
+ export declare function createEditTool(deps: EditToolDeps): PortableTool<EditToolParams>;
@@ -0,0 +1,97 @@
1
+ import type { PortableTool } from "../portable-tool.js";
2
+ import type { CommandClassification } from "./shell/command-classification.js";
3
+ export declare const EXEC_TOOL_NAME: "exec";
4
+ export interface ExecToolParams {
5
+ command: string;
6
+ description?: string;
7
+ workdir?: string;
8
+ timeout?: number;
9
+ /** Explicit background request (cc: run_in_background). */
10
+ background?: boolean;
11
+ }
12
+ export declare const EXEC_TOOL_SCHEMA: {
13
+ readonly type: "object";
14
+ readonly properties: {
15
+ readonly command: {
16
+ readonly type: "string";
17
+ readonly description: "Shell command to execute. On Windows uses PowerShell, on Unix uses bash.";
18
+ };
19
+ readonly description: {
20
+ readonly type: "string";
21
+ readonly description: string;
22
+ };
23
+ readonly workdir: {
24
+ readonly type: "string";
25
+ readonly description: "Working directory for the command.";
26
+ };
27
+ readonly timeout: {
28
+ readonly type: "number";
29
+ readonly description: string;
30
+ };
31
+ readonly background: {
32
+ readonly type: "boolean";
33
+ readonly description: string;
34
+ };
35
+ };
36
+ readonly required: readonly ["command"];
37
+ };
38
+ export interface ExecToolOutput {
39
+ stdout: string;
40
+ stderr: string;
41
+ exitCode: number;
42
+ interrupted: boolean;
43
+ rawOutputPath?: string;
44
+ backgroundTaskId?: string;
45
+ assistantAutoBackgrounded?: boolean;
46
+ returnCodeInterpretation?: string;
47
+ noOutputExpected?: boolean;
48
+ persistedOutputPath?: string;
49
+ persistedOutputSize?: number;
50
+ classification?: CommandClassification;
51
+ }
52
+ export interface ExecProgress {
53
+ type: "exec_progress";
54
+ output: string;
55
+ fullOutput: string;
56
+ elapsedTimeSeconds: number;
57
+ totalLines: number;
58
+ totalBytes: number;
59
+ taskId?: string;
60
+ }
61
+ /**
62
+ * Minimal host dependency — ONLY for permission checking.
63
+ * The tool owns everything else (spawn, lifecycle, output).
64
+ *
65
+ * This replaces the old ExecToolDeps which required the host to
66
+ * implement the entire exec() pipeline. Now the tool owns the
67
+ * process directly (cc architecture).
68
+ */
69
+ export interface ExecToolHost {
70
+ /**
71
+ * Validate a command before execution.
72
+ * Returns null/undefined if allowed, or an error message if blocked.
73
+ */
74
+ validateCommand?(command: string): Promise<string | null | undefined>;
75
+ /**
76
+ * Interpret a non-zero exit code.
77
+ * E.g. 127 → "command not found", 137 → "killed by SIGKILL".
78
+ */
79
+ interpretExitCode?(exitCode: number, stderr: string): string | undefined;
80
+ /**
81
+ * Called during foreground execution with incremental progress.
82
+ * The host can forward these to the UI for real-time output display.
83
+ */
84
+ onProgress?(progress: ExecProgress): void;
85
+ }
86
+ /**
87
+ * Auto-background trigger threshold (assistant mode).
88
+ * cc: ASSISTANT_BLOCKING_BUDGET_MS = 15_000
89
+ */
90
+ export declare const ASSISTANT_BLOCKING_BUDGET_MS = 15000;
91
+ /**
92
+ * Create the exec tool with direct process ownership (cc architecture).
93
+ *
94
+ * @param host Minimal host interface — only permission checking.
95
+ * Pass `{}` for unrestricted mode (tests only).
96
+ */
97
+ export declare function createExecTool(host?: ExecToolHost): PortableTool<ExecToolParams>;
@@ -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,65 @@
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_TOOL_NAME: "instructions";
25
+ export type InstructionsAction = "list" | "read" | "write" | "edit" | "delete";
26
+ export interface InstructionsToolParams {
27
+ action: InstructionsAction;
28
+ project_id: string;
29
+ filename?: string;
30
+ content?: string;
31
+ old_text?: string;
32
+ new_text?: string;
33
+ }
34
+ export declare const INSTRUCTIONS_TOOL_SCHEMA: {
35
+ readonly type: "object";
36
+ readonly properties: {
37
+ readonly action: {
38
+ readonly type: "string";
39
+ readonly enum: readonly ["list", "read", "write", "edit", "delete"];
40
+ readonly description: "Operation: list all files, read a file, write (create/overwrite), edit (partial replace), or delete a file.";
41
+ };
42
+ readonly project_id: {
43
+ readonly type: "string";
44
+ readonly description: "Project ID. Use \"default\" for the default project.";
45
+ };
46
+ readonly filename: {
47
+ readonly type: "string";
48
+ readonly description: "Instruction file name ending in .md (e.g. \"code-style.md\"). Required for read/write/delete. Sub-paths like \"testing/unit-test.md\" are supported.";
49
+ };
50
+ readonly content: {
51
+ readonly type: "string";
52
+ readonly description: "Markdown content for the instruction file. Required for write action.";
53
+ };
54
+ readonly old_text: {
55
+ readonly type: "string";
56
+ readonly description: "Required for edit action: the exact existing text to find and replace (must appear exactly once).";
57
+ };
58
+ readonly new_text: {
59
+ readonly type: "string";
60
+ readonly description: "Required for edit action: the replacement text.";
61
+ };
62
+ };
63
+ readonly required: readonly ["action", "project_id"];
64
+ };
65
+ export declare function createInstructionsTool(deps: InstructionsToolDeps): PortableTool<InstructionsToolParams>;
@@ -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>;