qlogicagent 0.3.0 → 0.5.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 (119) hide show
  1. package/README.md +402 -45
  2. package/package.json +2 -2
  3. package/dist/agent.js +0 -1
  4. package/dist/cli.js +0 -9
  5. package/dist/contracts.js +0 -1
  6. package/dist/index.js +0 -5
  7. package/dist/orchestration.js +0 -118
  8. package/dist/types/agent/agent.d.ts +0 -43
  9. package/dist/types/agent/tool-loop.d.ts +0 -64
  10. package/dist/types/agent/types.d.ts +0 -175
  11. package/dist/types/cli/main.d.ts +0 -11
  12. package/dist/types/cli/stdio-server.d.ts +0 -45
  13. package/dist/types/config/config.d.ts +0 -17
  14. package/dist/types/contracts/hooks.d.ts +0 -120
  15. package/dist/types/contracts/index.d.ts +0 -10
  16. package/dist/types/contracts/planner.d.ts +0 -35
  17. package/dist/types/contracts/skill-candidate.d.ts +0 -63
  18. package/dist/types/contracts/todo.d.ts +0 -14
  19. package/dist/types/index.d.ts +0 -13
  20. package/dist/types/llm/builtin-providers.d.ts +0 -10
  21. package/dist/types/llm/index.d.ts +0 -15
  22. package/dist/types/llm/llm-client.d.ts +0 -43
  23. package/dist/types/llm/model-catalog.d.ts +0 -53
  24. package/dist/types/llm/provider-def.d.ts +0 -59
  25. package/dist/types/llm/provider-registry.d.ts +0 -54
  26. package/dist/types/llm/transport.d.ts +0 -62
  27. package/dist/types/llm/transports/anthropic-messages.d.ts +0 -31
  28. package/dist/types/llm/transports/openai-chat.d.ts +0 -36
  29. package/dist/types/orchestration/agent-registry.d.ts +0 -41
  30. package/dist/types/orchestration/approval-aware-tool-plan.d.ts +0 -32
  31. package/dist/types/orchestration/context-compression.d.ts +0 -220
  32. package/dist/types/orchestration/conversation-repair.d.ts +0 -61
  33. package/dist/types/orchestration/curator-scheduler.d.ts +0 -119
  34. package/dist/types/orchestration/embedded-failover-policy.d.ts +0 -110
  35. package/dist/types/orchestration/error-classification.d.ts +0 -12
  36. package/dist/types/orchestration/failover-classification.d.ts +0 -8
  37. package/dist/types/orchestration/failover-error.d.ts +0 -33
  38. package/dist/types/orchestration/fork-subagent.d.ts +0 -100
  39. package/dist/types/orchestration/index.d.ts +0 -120
  40. package/dist/types/orchestration/memory-flush-policy.d.ts +0 -57
  41. package/dist/types/orchestration/memory-provider.d.ts +0 -14
  42. package/dist/types/orchestration/parallel-tool-calls.d.ts +0 -41
  43. package/dist/types/orchestration/prompt-cache-strategy.d.ts +0 -126
  44. package/dist/types/orchestration/reactive-compact.d.ts +0 -73
  45. package/dist/types/orchestration/retry-loop.d.ts +0 -22
  46. package/dist/types/orchestration/skill-candidate.d.ts +0 -52
  47. package/dist/types/orchestration/skill-consolidation.d.ts +0 -123
  48. package/dist/types/orchestration/skill-improvement.d.ts +0 -59
  49. package/dist/types/orchestration/skill-similarity.d.ts +0 -98
  50. package/dist/types/orchestration/streaming-tool-executor.d.ts +0 -73
  51. package/dist/types/orchestration/team-orchestration.d.ts +0 -195
  52. package/dist/types/orchestration/team-tool-loop-wiring.d.ts +0 -92
  53. package/dist/types/orchestration/tool-choice-policy.d.ts +0 -54
  54. package/dist/types/orchestration/tool-loop-state.d.ts +0 -50
  55. package/dist/types/orchestration/tool-schema.d.ts +0 -39
  56. package/dist/types/orchestration/transcript-repair.d.ts +0 -42
  57. package/dist/types/orchestration/turn-loop-guard.d.ts +0 -86
  58. package/dist/types/orchestration/web-browser-policy.d.ts +0 -17
  59. package/dist/types/runtime/context-compression.d.ts +0 -61
  60. package/dist/types/runtime/hook-registry.d.ts +0 -12
  61. package/dist/types/runtime/memory-hooks.d.ts +0 -23
  62. package/dist/types/runtime/tool-eligibility.d.ts +0 -59
  63. package/dist/types/skills/index.d.ts +0 -108
  64. package/dist/types/skills/memory-extractor.d.ts +0 -64
  65. package/dist/types/skills/memory-query-tool.d.ts +0 -43
  66. package/dist/types/skills/memory-store.d.ts +0 -66
  67. package/dist/types/skills/memory-tool.d.ts +0 -67
  68. package/dist/types/skills/portable-tool.d.ts +0 -71
  69. package/dist/types/skills/qmemory-adapter.d.ts +0 -52
  70. package/dist/types/skills/skill-frontmatter.d.ts +0 -19
  71. package/dist/types/skills/skill-guard.d.ts +0 -23
  72. package/dist/types/skills/skill-loader.d.ts +0 -16
  73. package/dist/types/skills/skill-source.d.ts +0 -119
  74. package/dist/types/skills/skill-types.d.ts +0 -199
  75. package/dist/types/skills/think-tool.d.ts +0 -16
  76. package/dist/types/skills/todo-tool.d.ts +0 -63
  77. package/dist/types/skills/tools/agent-tool.d.ts +0 -91
  78. package/dist/types/skills/tools/apply-patch-tool.d.ts +0 -29
  79. package/dist/types/skills/tools/ask-user-tool.d.ts +0 -80
  80. package/dist/types/skills/tools/brief-tool.d.ts +0 -74
  81. package/dist/types/skills/tools/browser-tool.d.ts +0 -114
  82. package/dist/types/skills/tools/checkpoint-tool.d.ts +0 -66
  83. package/dist/types/skills/tools/config-tool.d.ts +0 -63
  84. package/dist/types/skills/tools/cron-tool.d.ts +0 -116
  85. package/dist/types/skills/tools/edit-tool.d.ts +0 -43
  86. package/dist/types/skills/tools/exec-tool.d.ts +0 -102
  87. package/dist/types/skills/tools/image-generate-tool.d.ts +0 -62
  88. package/dist/types/skills/tools/instructions-tool.d.ts +0 -103
  89. package/dist/types/skills/tools/lsp-tool.d.ts +0 -153
  90. package/dist/types/skills/tools/mcp-client-types.d.ts +0 -269
  91. package/dist/types/skills/tools/mcp-tool.d.ts +0 -249
  92. package/dist/types/skills/tools/memory-tool.d.ts +0 -74
  93. package/dist/types/skills/tools/monitor-tool.d.ts +0 -113
  94. package/dist/types/skills/tools/music-generate-tool.d.ts +0 -55
  95. package/dist/types/skills/tools/notify-tool.d.ts +0 -53
  96. package/dist/types/skills/tools/patch-tool.d.ts +0 -45
  97. package/dist/types/skills/tools/pdf-tool.d.ts +0 -66
  98. package/dist/types/skills/tools/plan-mode-tool.d.ts +0 -59
  99. package/dist/types/skills/tools/read-tool.d.ts +0 -51
  100. package/dist/types/skills/tools/repl-tool.d.ts +0 -70
  101. package/dist/types/skills/tools/search-tool.d.ts +0 -112
  102. package/dist/types/skills/tools/send-message-tool.d.ts +0 -51
  103. package/dist/types/skills/tools/skill-list-tool.d.ts +0 -33
  104. package/dist/types/skills/tools/skill-manage-tool.d.ts +0 -73
  105. package/dist/types/skills/tools/skill-view-tool.d.ts +0 -37
  106. package/dist/types/skills/tools/sleep-tool.d.ts +0 -49
  107. package/dist/types/skills/tools/structured-output-tool.d.ts +0 -116
  108. package/dist/types/skills/tools/task-tool.d.ts +0 -104
  109. package/dist/types/skills/tools/team-tool.d.ts +0 -89
  110. package/dist/types/skills/tools/tool-search-tool.d.ts +0 -51
  111. package/dist/types/skills/tools/tts-tool.d.ts +0 -38
  112. package/dist/types/skills/tools/video-edit-tool.d.ts +0 -69
  113. package/dist/types/skills/tools/video-generate-tool.d.ts +0 -62
  114. package/dist/types/skills/tools/video-merge-tool.d.ts +0 -105
  115. package/dist/types/skills/tools/video-upscale-tool.d.ts +0 -45
  116. package/dist/types/skills/tools/web-fetch-tool.d.ts +0 -78
  117. package/dist/types/skills/tools/web-search-tool.d.ts +0 -57
  118. package/dist/types/skills/tools/worktree-tool.d.ts +0 -69
  119. package/dist/types/skills/tools/write-tool.d.ts +0 -45
@@ -1,113 +0,0 @@
1
- import type { PortableTool } from "../portable-tool.js";
2
- export declare const MONITOR_TOOL_NAME: "monitor";
3
- /** The kind of event source the agent can monitor. */
4
- export type MonitorSource = "process" | "file" | "task" | "custom";
5
- export type MonitorAction = "start" | "stop" | "list";
6
- export interface MonitorToolParams {
7
- action: MonitorAction;
8
- /** Required for start/stop — identifies the monitor instance. */
9
- monitorId?: string;
10
- /** Required for start — what kind of event source to watch. */
11
- source?: MonitorSource;
12
- /** Required for start — selector for the target (pid, path, taskId, custom key). */
13
- target?: string;
14
- /** Optional for start — conditions that should trigger wake-up. */
15
- conditions?: MonitorCondition[];
16
- /** Optional for start — max time to monitor in seconds before auto-stop. */
17
- timeoutSeconds?: number;
18
- }
19
- export interface MonitorCondition {
20
- /** What to check: exit code, stdout pattern, file modification, task status. */
21
- type: "exit" | "output_match" | "file_changed" | "task_status";
22
- /** Pattern or value to match (regex for output_match, status name for task_status). */
23
- value?: string;
24
- }
25
- export declare const MONITOR_TOOL_SCHEMA: {
26
- readonly type: "object";
27
- readonly properties: {
28
- readonly action: {
29
- readonly type: "string";
30
- readonly enum: readonly ["start", "stop", "list"];
31
- readonly description: "Action to perform: start a new monitor, stop an existing one, or list active monitors.";
32
- };
33
- readonly monitorId: {
34
- readonly type: "string";
35
- readonly description: "Identifier for the monitor instance. Required for start/stop.";
36
- };
37
- readonly source: {
38
- readonly type: "string";
39
- readonly enum: readonly ["process", "file", "task", "custom"];
40
- readonly description: "Type of event source to watch.";
41
- };
42
- readonly target: {
43
- readonly type: "string";
44
- readonly description: string;
45
- };
46
- readonly conditions: {
47
- readonly type: "array";
48
- readonly items: {
49
- readonly type: "object";
50
- readonly properties: {
51
- readonly type: {
52
- readonly type: "string";
53
- readonly enum: readonly ["exit", "output_match", "file_changed", "task_status"];
54
- };
55
- readonly value: {
56
- readonly type: "string";
57
- };
58
- };
59
- readonly required: readonly ["type"];
60
- };
61
- readonly description: "Conditions that trigger a wake-up notification.";
62
- };
63
- readonly timeoutSeconds: {
64
- readonly type: "number";
65
- readonly description: "Auto-stop after this many seconds (default: 3600).";
66
- readonly minimum: 1;
67
- readonly maximum: 86400;
68
- };
69
- };
70
- readonly required: readonly ["action"];
71
- };
72
- /** Info about an active monitor. */
73
- export interface MonitorInfo {
74
- monitorId: string;
75
- source: MonitorSource;
76
- target: string;
77
- conditions: MonitorCondition[];
78
- startedAt: number;
79
- timeoutSeconds: number;
80
- /** Events received so far. */
81
- eventCount: number;
82
- }
83
- /** Result of monitor operations. */
84
- export interface MonitorResult {
85
- action: MonitorAction;
86
- success: boolean;
87
- monitorId?: string;
88
- monitors?: MonitorInfo[];
89
- error?: string;
90
- }
91
- /**
92
- * Runtime dependencies injected by the host.
93
- *
94
- * The host is responsible for:
95
- * 1. Actually watching the event source (polling, inotify, process hooks, etc.)
96
- * 2. Delivering notifications back to the agent loop (via tick or wake-up)
97
- * 3. Cleaning up monitors when they time out or are stopped.
98
- */
99
- export interface MonitorToolDeps {
100
- /** Start monitoring a target. Returns the created monitor info. */
101
- startMonitor(params: {
102
- monitorId: string;
103
- source: MonitorSource;
104
- target: string;
105
- conditions: MonitorCondition[];
106
- timeoutSeconds: number;
107
- }): Promise<MonitorResult>;
108
- /** Stop an active monitor. */
109
- stopMonitor(monitorId: string): Promise<MonitorResult>;
110
- /** List all active monitors for this session. */
111
- listMonitors(): Promise<MonitorInfo[]>;
112
- }
113
- export declare function createMonitorTool(deps: MonitorToolDeps): PortableTool<MonitorToolParams>;
@@ -1,55 +0,0 @@
1
- import type { PortableTool } from "../portable-tool.js";
2
- export declare const MUSIC_GENERATE_TOOL_NAME: "music_generate";
3
- export interface MusicGenerateToolParams {
4
- prompt: string;
5
- purpose?: string;
6
- style?: string;
7
- lyrics?: string;
8
- duration?: number;
9
- }
10
- export declare const MUSIC_GENERATE_TOOL_SCHEMA: {
11
- readonly type: "object";
12
- readonly properties: {
13
- readonly prompt: {
14
- readonly type: "string";
15
- readonly description: string;
16
- };
17
- readonly purpose: {
18
- readonly type: "string";
19
- readonly description: "Intended use: 'background-music', 'ringtone', 'short-video-bgm', 'full-song', 'notification-sound', etc.";
20
- };
21
- readonly style: {
22
- readonly type: "string";
23
- readonly description: "Musical style/genre: 'lo-fi', 'pop', 'rock', 'jazz', 'classical', 'electronic', 'ambient', etc.";
24
- };
25
- readonly lyrics: {
26
- readonly type: "string";
27
- readonly description: "Optional lyrics for vocal music. Structure with [verse], [chorus], [bridge] tags if desired.";
28
- };
29
- readonly duration: {
30
- readonly type: "number";
31
- readonly description: "Duration in seconds (5-300). Infer from purpose: ringtone 15-30s, BGM 30-60s, full song 120-180s.";
32
- };
33
- };
34
- readonly required: readonly ["prompt"];
35
- };
36
- export interface MusicGenerateResult {
37
- mediaUrls: string[];
38
- model?: string;
39
- durationMs?: number;
40
- }
41
- /** Deps injected by the host runtime for music generation. */
42
- export interface MusicGenerateToolDeps {
43
- /**
44
- * Generate music via the configured backend.
45
- * The host handles model selection, failover, and storage.
46
- */
47
- generateMusic(params: {
48
- prompt: string;
49
- purpose?: string;
50
- style?: string;
51
- lyrics?: string;
52
- duration?: number;
53
- }): Promise<MusicGenerateResult>;
54
- }
55
- export declare function createMusicGenerateTool(deps: MusicGenerateToolDeps): PortableTool<MusicGenerateToolParams>;
@@ -1,53 +0,0 @@
1
- import type { PortableTool } from "../portable-tool.js";
2
- export declare const NOTIFY_TOOL_NAME: "notify";
3
- export interface NotifyToolParams {
4
- /** Notification message */
5
- message: string;
6
- /** Optional title/subject */
7
- title?: string;
8
- /** Priority level */
9
- priority?: "low" | "normal" | "high";
10
- /** Target channel override (default: user's primary channel) */
11
- channel?: string;
12
- }
13
- export declare const NOTIFY_TOOL_SCHEMA: {
14
- readonly type: "object";
15
- readonly properties: {
16
- readonly message: {
17
- readonly type: "string";
18
- readonly description: "Notification content to send to the user.";
19
- };
20
- readonly title: {
21
- readonly type: "string";
22
- readonly description: "Optional notification title/subject line.";
23
- };
24
- readonly priority: {
25
- readonly type: "string";
26
- readonly enum: readonly ["low", "normal", "high"];
27
- readonly description: "Notification priority (default: normal). High may trigger sound/vibration.";
28
- };
29
- readonly channel: {
30
- readonly type: "string";
31
- readonly description: "Target delivery channel (e.g. 'wechat', 'feishu', 'discord'). Default: user's primary.";
32
- };
33
- };
34
- readonly required: readonly ["message"];
35
- };
36
- export interface NotifyResult {
37
- delivered: boolean;
38
- channel: string;
39
- error?: string;
40
- }
41
- /**
42
- * Host-provided notification delivery backend.
43
- */
44
- export interface NotifyToolDeps {
45
- /** Send notification to user. Host routes to correct platform. */
46
- sendNotification(params: {
47
- message: string;
48
- title?: string;
49
- priority?: string;
50
- channel?: string;
51
- }): Promise<NotifyResult>;
52
- }
53
- export declare function createNotifyTool(deps: NotifyToolDeps): PortableTool<NotifyToolParams>;
@@ -1,45 +0,0 @@
1
- import type { PortableTool } from "../portable-tool.js";
2
- export declare const PATCH_TOOL_NAME: "patch";
3
- export interface PatchToolParams {
4
- /** V4A unified diff or simple find-replace */
5
- input: string;
6
- /** When true, replace all occurrences in each file (default: false) */
7
- replaceAll?: boolean;
8
- }
9
- export declare const PATCH_TOOL_SCHEMA: {
10
- readonly type: "object";
11
- readonly properties: {
12
- readonly input: {
13
- readonly type: "string";
14
- readonly description: string;
15
- };
16
- readonly replaceAll: {
17
- readonly type: "boolean";
18
- readonly description: "Replace all occurrences instead of first only (default: false).";
19
- };
20
- };
21
- readonly required: readonly ["input"];
22
- };
23
- export interface PatchResult {
24
- filesModified: string[];
25
- filesAdded: string[];
26
- filesDeleted: string[];
27
- strategies: Record<string, string>;
28
- errors: string[];
29
- }
30
- export interface PatchToolDeps {
31
- readFile(path: string): Promise<string>;
32
- writeFile(path: string, content: string): Promise<void>;
33
- deleteFile(path: string): Promise<void>;
34
- fileExists(path: string): Promise<boolean>;
35
- resolvePath(input: string): string;
36
- }
37
- export type MatchStrategy = "exact" | "line_trimmed" | "whitespace_normalized" | "indentation_flexible" | "escape_normalized" | "trimmed_boundary" | "unicode_normalized" | "block_anchor" | "context_aware";
38
- interface MatchResult {
39
- start: number;
40
- end: number;
41
- strategy: MatchStrategy;
42
- }
43
- declare function fuzzyFind(content: string, search: string, replaceAll: boolean): MatchResult[];
44
- export declare function createPatchTool(deps: PatchToolDeps): PortableTool<PatchToolParams>;
45
- export { fuzzyFind, type MatchResult };
@@ -1,66 +0,0 @@
1
- import type { PortableTool } from "../portable-tool.js";
2
- export declare const PDF_TOOL_NAME: "pdf";
3
- export interface PdfToolParams {
4
- prompt?: string;
5
- pdf?: string;
6
- pdfs?: string[];
7
- pages?: string;
8
- }
9
- export declare const PDF_TOOL_SCHEMA: {
10
- readonly type: "object";
11
- readonly properties: {
12
- readonly prompt: {
13
- readonly type: "string";
14
- readonly description: "Describe what to analyze or extract from the PDF(s).";
15
- };
16
- readonly pdf: {
17
- readonly type: "string";
18
- readonly description: "Single PDF path or URL.";
19
- };
20
- readonly pdfs: {
21
- readonly type: "array";
22
- readonly items: {
23
- readonly type: "string";
24
- };
25
- readonly description: "Multiple PDF paths or URLs (up to 10).";
26
- };
27
- readonly pages: {
28
- readonly type: "string";
29
- readonly description: "Page range to process, e.g. \"1-5\", \"1,3,5-7\". Defaults to all pages.";
30
- };
31
- };
32
- readonly required: readonly [];
33
- };
34
- /** Deps injected by the host runtime for PDF analysis. */
35
- export interface PdfToolDeps {
36
- /**
37
- * Extract text and/or page images from a PDF.
38
- * The host decides how to load (local FS, HTTP, etc.).
39
- */
40
- extractPdf(source: string, options?: {
41
- pages?: string;
42
- }): Promise<{
43
- text: string;
44
- pageImages?: Array<{
45
- page: number;
46
- base64: string;
47
- mimeType: string;
48
- }>;
49
- }>;
50
- /**
51
- * Optional: analyze extracted content via LLM.
52
- * If not provided, the tool returns raw extracted text.
53
- */
54
- analyzePdfContent?(prompt: string, content: {
55
- text: string;
56
- images?: Array<{
57
- base64: string;
58
- mimeType: string;
59
- }>;
60
- }): Promise<{
61
- text: string;
62
- model?: string;
63
- provider?: string;
64
- }>;
65
- }
66
- export declare function createPdfTool(deps: PdfToolDeps): PortableTool<PdfToolParams>;
@@ -1,59 +0,0 @@
1
- import type { PortableTool } from "../portable-tool.js";
2
- export declare const PLAN_MODE_TOOL_NAME: "plan_mode";
3
- export type PlanModeAction = "enter" | "exit";
4
- export interface PlanModeToolParams {
5
- /** Action: enter or exit plan mode */
6
- action: PlanModeAction;
7
- /** Plan text (for exit — the finalized plan to present for approval) */
8
- plan?: string;
9
- /** File path where plan was saved (optional) */
10
- planFilePath?: string;
11
- }
12
- export declare const PLAN_MODE_TOOL_SCHEMA: {
13
- readonly type: "object";
14
- readonly properties: {
15
- readonly action: {
16
- readonly type: "string";
17
- readonly enum: readonly ["enter", "exit"];
18
- readonly description: string;
19
- };
20
- readonly plan: {
21
- readonly type: "string";
22
- readonly description: string;
23
- };
24
- readonly planFilePath: {
25
- readonly type: "string";
26
- readonly description: "Optional file path where the plan was saved for reference.";
27
- };
28
- };
29
- readonly required: readonly ["action"];
30
- };
31
- /** Tools allowed during plan mode (read-only + reasoning) */
32
- export declare const PLAN_MODE_ALLOWED_TOOLS: readonly string[];
33
- export interface PlanModeState {
34
- active: boolean;
35
- enteredAt?: string;
36
- plan?: string;
37
- planFilePath?: string;
38
- }
39
- export interface PlanModeResult {
40
- success: boolean;
41
- state: PlanModeState;
42
- allowedTools?: readonly string[];
43
- error?: string;
44
- }
45
- /**
46
- * Host-provided plan mode backend.
47
- * The host is responsible for filtering tool availability based on mode state.
48
- */
49
- export interface PlanModeToolDeps {
50
- /** Get current plan mode state */
51
- getState(): PlanModeState;
52
- /** Enter plan mode — host should restrict tool availability */
53
- enterPlanMode(): Promise<PlanModeResult>;
54
- /** Exit plan mode — host restores full tool availability */
55
- exitPlanMode(plan?: string, planFilePath?: string): Promise<PlanModeResult>;
56
- /** Check if in agent/sub-agent context (plan mode not allowed in sub-agents) */
57
- isAgentContext?(): boolean;
58
- }
59
- export declare function createPlanModeTool(deps: PlanModeToolDeps): PortableTool<PlanModeToolParams>;
@@ -1,51 +0,0 @@
1
- import type { PortableTool } from "../portable-tool.js";
2
- export declare const READ_TOOL_NAME: "read";
3
- export interface ReadToolParams {
4
- path: string;
5
- offset?: number;
6
- limit?: number;
7
- }
8
- export declare const READ_TOOL_SCHEMA: {
9
- readonly type: "object";
10
- readonly properties: {
11
- readonly path: {
12
- readonly type: "string";
13
- readonly description: "Absolute path to the file to read.";
14
- };
15
- readonly offset: {
16
- readonly type: "number";
17
- readonly description: "Line number to start reading from (1-indexed). Default: 1.";
18
- };
19
- readonly limit: {
20
- readonly type: "number";
21
- readonly description: "Maximum number of lines to read. Default/max: 2000.";
22
- };
23
- };
24
- readonly required: readonly ["path"];
25
- };
26
- export type ReadResultType = "text" | "image" | "binary_rejected";
27
- /** Deps injected by the host runtime for file reading. */
28
- export interface ReadToolDeps {
29
- /** Read file content. Return string for text, base64 for images, or rejection. */
30
- readFile(path: string): Promise<{
31
- type: "text";
32
- text: string;
33
- } | {
34
- type: "image";
35
- base64: string;
36
- mimeType: string;
37
- } | {
38
- type: "binary";
39
- mimeType: string;
40
- }>;
41
- /** Resolve a relative path to absolute. */
42
- resolvePath(input: string): string;
43
- /**
44
- * Validate read access for the given path.
45
- * Returns null if allowed, or an error message if blocked.
46
- * Blocks device paths (/dev/zero, /dev/random, etc.) and
47
- * paths outside the allowed workspace.
48
- */
49
- validatePath?(path: string): string | null;
50
- }
51
- export declare function createReadTool(deps: ReadToolDeps): PortableTool<ReadToolParams>;
@@ -1,70 +0,0 @@
1
- import type { PortableTool } from "../portable-tool.js";
2
- export declare const REPL_TOOL_NAME: "repl";
3
- export interface ReplToolParams {
4
- /** JavaScript code to execute in the persistent VM context */
5
- code: string;
6
- }
7
- export declare const REPL_TOOL_SCHEMA: {
8
- readonly type: "object";
9
- readonly properties: {
10
- readonly code: {
11
- readonly type: "string";
12
- readonly description: string;
13
- };
14
- };
15
- readonly required: readonly ["code"];
16
- };
17
- export interface ReplExecResult {
18
- output: string;
19
- error?: string;
20
- duration: number;
21
- }
22
- /** Primitive operations injected into the VM context. */
23
- export interface ReplPrimitives {
24
- readFile(path: string): Promise<string>;
25
- writeFile(path: string, content: string): Promise<void>;
26
- editFile(path: string, edits: Array<{
27
- oldText: string;
28
- newText: string;
29
- }>): Promise<string>;
30
- exec(command: string): Promise<{
31
- stdout: string;
32
- stderr: string;
33
- exitCode: number;
34
- }>;
35
- glob(pattern: string): Promise<string[]>;
36
- grep(pattern: string, path?: string): Promise<Array<{
37
- file: string;
38
- line: number;
39
- text: string;
40
- }>>;
41
- }
42
- /**
43
- * Host-provided REPL execution backend.
44
- */
45
- export interface ReplToolDeps {
46
- /**
47
- * Execute JavaScript code within a persistent VM context.
48
- * The VM is pre-initialized with the primitive functions above.
49
- * Each tool invocation reuses the same VM (preserving variable state).
50
- */
51
- executeInVm(code: string): Promise<ReplExecResult>;
52
- /**
53
- * Reset the VM context (clear state). Optional hook called on errors.
54
- */
55
- resetVm?(): void;
56
- /**
57
- * The host-provided primitives injected into the VM.
58
- * When provided, the tool validates that the host has set up all required primitives.
59
- */
60
- primitives?: ReplPrimitives;
61
- /**
62
- * Permission check for individual primitive operations.
63
- * Called before each primitive executes inside the VM.
64
- * Returns null if allowed, or an error message if denied.
65
- */
66
- checkPermission?(operation: string, args: unknown[]): Promise<string | null>;
67
- }
68
- /** Tool names that should be hidden from direct LLM access when REPL is active. */
69
- export declare const REPL_HIDES_TOOLS: readonly string[];
70
- export declare function createReplTool(deps: ReplToolDeps): PortableTool<ReplToolParams>;
@@ -1,112 +0,0 @@
1
- import type { PortableTool } from "../portable-tool.js";
2
- export declare const SEARCH_TOOL_NAME: "search";
3
- export type SearchMode = "filename" | "content" | "both";
4
- export interface SearchToolParams {
5
- mode: SearchMode;
6
- pattern: string;
7
- path?: string;
8
- fileGlob?: string;
9
- contextLines?: number;
10
- caseInsensitive?: boolean;
11
- headLimit?: number;
12
- offset?: number;
13
- }
14
- export declare const SEARCH_TOOL_SCHEMA: {
15
- readonly type: "object";
16
- readonly properties: {
17
- readonly mode: {
18
- readonly type: "string";
19
- readonly enum: readonly ["filename", "content", "both"];
20
- readonly description: string;
21
- };
22
- readonly pattern: {
23
- readonly type: "string";
24
- readonly description: string;
25
- };
26
- readonly path: {
27
- readonly type: "string";
28
- readonly description: "Directory to search in. Defaults to workdir/cwd if omitted.";
29
- };
30
- readonly fileGlob: {
31
- readonly type: "string";
32
- readonly description: string;
33
- };
34
- readonly contextLines: {
35
- readonly type: "number";
36
- readonly description: string;
37
- };
38
- readonly caseInsensitive: {
39
- readonly type: "boolean";
40
- readonly description: "Case insensitive search (content/both modes). Default: false.";
41
- };
42
- readonly headLimit: {
43
- readonly type: "number";
44
- readonly description: string;
45
- };
46
- readonly offset: {
47
- readonly type: "number";
48
- readonly description: "Skip first N results before applying headLimit. Default: 0.";
49
- };
50
- };
51
- readonly required: readonly ["mode", "pattern"];
52
- };
53
- export interface SearchFileResult {
54
- path: string;
55
- }
56
- export interface SearchContentResult {
57
- path: string;
58
- line: number;
59
- text: string;
60
- contextBefore?: string[];
61
- contextAfter?: string[];
62
- }
63
- export interface SearchOutput {
64
- mode: SearchMode;
65
- totalMatches: number;
66
- truncated: boolean;
67
- fileResults?: SearchFileResult[];
68
- contentResults?: SearchContentResult[];
69
- }
70
- /** Host-provided search backend. */
71
- export interface SearchToolDeps {
72
- /**
73
- * Find files matching a glob pattern.
74
- * Returns array of relative file paths.
75
- * The host SHOULD auto-exclude VCS directories (.git, .svn, .hg, .bzr)
76
- * unless the user explicitly includes them.
77
- */
78
- glob(pattern: string, options: {
79
- cwd: string;
80
- limit: number;
81
- }): Promise<{
82
- files: string[];
83
- truncated: boolean;
84
- }>;
85
- /**
86
- * Search file contents using regex.
87
- * The implementation may use ripgrep, native grep, or a custom engine.
88
- * Returns match records.
89
- * The host SHOULD auto-exclude VCS directories (.git, .svn, .hg, .bzr)
90
- * and enforce --max-columns 500 to avoid minified file noise.
91
- */
92
- grep(pattern: string, options: {
93
- cwd: string;
94
- fileGlob?: string;
95
- caseInsensitive?: boolean;
96
- contextLines?: number;
97
- headLimit?: number;
98
- offset?: number;
99
- }): Promise<{
100
- matches: Array<{
101
- path: string;
102
- line: number;
103
- text: string;
104
- contextBefore?: string[];
105
- contextAfter?: string[];
106
- }>;
107
- truncated: boolean;
108
- }>;
109
- /** Resolve relative path to absolute. If omitted, cwd is used. */
110
- resolvePath?(input: string): string;
111
- }
112
- export declare function createSearchTool(deps: SearchToolDeps): PortableTool<SearchToolParams>;
@@ -1,51 +0,0 @@
1
- import type { PortableTool } from "../portable-tool.js";
2
- export declare const SEND_MESSAGE_TOOL_NAME: "send_message";
3
- export interface SendMessageToolParams {
4
- /** Target agent name or '*' for broadcast */
5
- to: string;
6
- /** Message content */
7
- message: string;
8
- /** Optional short summary for routing/display */
9
- summary?: string;
10
- }
11
- export declare const SEND_MESSAGE_TOOL_SCHEMA: {
12
- readonly type: "object";
13
- readonly properties: {
14
- readonly to: {
15
- readonly type: "string";
16
- readonly description: string;
17
- };
18
- readonly message: {
19
- readonly type: "string";
20
- readonly description: "Message content to send to the target agent.";
21
- };
22
- readonly summary: {
23
- readonly type: "string";
24
- readonly description: "Optional short summary (for logging/routing).";
25
- };
26
- };
27
- readonly required: readonly ["to", "message"];
28
- };
29
- export interface SendMessageResult {
30
- success: boolean;
31
- recipients?: string[];
32
- error?: string;
33
- }
34
- /**
35
- * Host-provided message routing backend.
36
- * Messages are delivered asynchronously via mailbox pattern.
37
- */
38
- export interface SendMessageToolDeps {
39
- /** Send message to target agent(s). Returns delivery status. */
40
- sendMessage(params: {
41
- to: string;
42
- message: string;
43
- summary?: string;
44
- senderId: string;
45
- }): Promise<SendMessageResult>;
46
- /** Get the current agent's ID */
47
- getSenderId(): string;
48
- /** List available teammates */
49
- listTeammates?(): string[];
50
- }
51
- export declare function createSendMessageTool(deps: SendMessageToolDeps): PortableTool<SendMessageToolParams>;