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,80 @@
1
+ import type { PortableTool } from "../portable-tool.js";
2
+ export declare const ASK_USER_TOOL_NAME: "ask_user";
3
+ export interface AskUserOption {
4
+ label: string;
5
+ description?: string;
6
+ }
7
+ export interface AskUserQuestion {
8
+ question: string;
9
+ header: string;
10
+ options?: AskUserOption[];
11
+ multiSelect?: boolean;
12
+ }
13
+ export interface AskUserToolParams {
14
+ questions: AskUserQuestion[];
15
+ }
16
+ export declare const ASK_USER_TOOL_SCHEMA: {
17
+ readonly type: "object";
18
+ readonly properties: {
19
+ readonly questions: {
20
+ readonly type: "array";
21
+ readonly minItems: 1;
22
+ readonly maxItems: 4;
23
+ readonly description: "1-4 clarifying questions to ask the user.";
24
+ readonly items: {
25
+ readonly type: "object";
26
+ readonly properties: {
27
+ readonly question: {
28
+ readonly type: "string";
29
+ readonly description: "The question text. Should end with '?'.";
30
+ };
31
+ readonly header: {
32
+ readonly type: "string";
33
+ readonly description: "Short identifier/tag for this question (max 50 chars).";
34
+ };
35
+ readonly options: {
36
+ readonly type: "array";
37
+ readonly description: "2-4 options for the user to choose from. Omit for free text.";
38
+ readonly items: {
39
+ readonly type: "object";
40
+ readonly properties: {
41
+ readonly label: {
42
+ readonly type: "string";
43
+ readonly description: "Display label (1-5 words).";
44
+ };
45
+ readonly description: {
46
+ readonly type: "string";
47
+ readonly description: "Brief explanation of this option.";
48
+ };
49
+ };
50
+ readonly required: readonly ["label"];
51
+ };
52
+ };
53
+ readonly multiSelect: {
54
+ readonly type: "boolean";
55
+ readonly description: "Allow selecting multiple options (default: false).";
56
+ };
57
+ };
58
+ readonly required: readonly ["question", "header"];
59
+ };
60
+ };
61
+ };
62
+ readonly required: readonly ["questions"];
63
+ };
64
+ export interface AskUserAnswer {
65
+ question: string;
66
+ answer: string;
67
+ }
68
+ /**
69
+ * Host-provided user interaction backend.
70
+ * The host renders the questions in the UI and collects answers.
71
+ */
72
+ export interface AskUserToolDeps {
73
+ /**
74
+ * Present questions to the user and collect answers.
75
+ * Returns a map of question text → answer text.
76
+ * If the user declines, returns null.
77
+ */
78
+ askUser(questions: AskUserQuestion[]): Promise<Record<string, string> | null>;
79
+ }
80
+ export declare function createAskUserTool(deps: AskUserToolDeps): PortableTool<AskUserToolParams>;
@@ -0,0 +1,74 @@
1
+ import type { PortableTool } from "../portable-tool.js";
2
+ export declare const BRIEF_TOOL_NAME: "send_user_message";
3
+ export type BriefMessageStatus = "normal" | "proactive";
4
+ export interface BriefAttachment {
5
+ /** Absolute or workspace-relative path */
6
+ path: string;
7
+ /** Size in bytes (filled by host) */
8
+ size?: number;
9
+ /** Whether the file is an image */
10
+ isImage?: boolean;
11
+ /** Upload UUID (host may upload for web preview) */
12
+ fileUuid?: string;
13
+ }
14
+ export interface BriefToolParams {
15
+ /** Markdown-formatted message to display to the user */
16
+ message: string;
17
+ /** File attachments to include with the message */
18
+ attachments?: string[];
19
+ /** Message status — 'proactive' for unsolicited updates */
20
+ status?: BriefMessageStatus;
21
+ }
22
+ export declare const BRIEF_TOOL_SCHEMA: {
23
+ readonly type: "object";
24
+ readonly properties: {
25
+ readonly message: {
26
+ readonly type: "string";
27
+ readonly description: string;
28
+ readonly minLength: 1;
29
+ };
30
+ readonly attachments: {
31
+ readonly type: "array";
32
+ readonly description: "Optional file paths to attach (images, documents, etc.).";
33
+ readonly items: {
34
+ readonly type: "string";
35
+ };
36
+ readonly maxItems: 10;
37
+ };
38
+ readonly status: {
39
+ readonly type: "string";
40
+ readonly enum: readonly ["normal", "proactive"];
41
+ readonly description: string;
42
+ };
43
+ };
44
+ readonly required: readonly ["message"];
45
+ };
46
+ export interface BriefDeliveryResult {
47
+ delivered: boolean;
48
+ attachments?: BriefAttachment[];
49
+ sentAt?: string;
50
+ error?: string;
51
+ }
52
+ /**
53
+ * Host-provided message delivery backend.
54
+ */
55
+ export interface BriefToolDeps {
56
+ /** Deliver the message to the user's UI */
57
+ deliverMessage(params: {
58
+ message: string;
59
+ attachments?: string[];
60
+ status: BriefMessageStatus;
61
+ }): Promise<BriefDeliveryResult>;
62
+ /** Validate and resolve attachment paths. Returns resolved attachments or error. */
63
+ resolveAttachments?(paths: string[]): Promise<BriefAttachment[] | {
64
+ error: string;
65
+ }>;
66
+ }
67
+ /** Check if brief mode is active (host determines this) */
68
+ export interface BriefModeConfig {
69
+ /** Whether the agent is in brief/chat mode */
70
+ isBriefMode: boolean;
71
+ /** Whether the user opted in via UI/CLI */
72
+ userOptIn?: boolean;
73
+ }
74
+ export declare function createBriefTool(deps: BriefToolDeps): PortableTool<BriefToolParams>;
@@ -0,0 +1,114 @@
1
+ import type { PortableTool } from "../portable-tool.js";
2
+ export declare const BROWSER_TOOL_NAME: "browser";
3
+ export type BrowserAction = "navigate" | "click" | "type" | "scroll" | "snapshot" | "screenshot" | "console" | "cdp";
4
+ export interface BrowserToolParams {
5
+ /** Browser action to perform */
6
+ action: BrowserAction;
7
+ /** URL for navigate action */
8
+ url?: string;
9
+ /** Element reference (e.g. "@e5") for click/type actions */
10
+ ref?: string;
11
+ /** Text to type */
12
+ text?: string;
13
+ /** Scroll direction */
14
+ direction?: "up" | "down" | "left" | "right";
15
+ /** CDP method name for raw cdp action */
16
+ method?: string;
17
+ /** CDP params object */
18
+ params?: Record<string, unknown>;
19
+ /** JavaScript expression for console eval */
20
+ expression?: string;
21
+ /** Whether to include full accessibility tree */
22
+ full?: boolean;
23
+ }
24
+ export declare const BROWSER_TOOL_SCHEMA: {
25
+ readonly type: "object";
26
+ readonly properties: {
27
+ readonly action: {
28
+ readonly type: "string";
29
+ readonly enum: readonly ["navigate", "click", "type", "scroll", "snapshot", "screenshot", "console", "cdp"];
30
+ readonly description: string;
31
+ };
32
+ readonly url: {
33
+ readonly type: "string";
34
+ readonly description: "URL to navigate to. Required for 'navigate' action.";
35
+ };
36
+ readonly ref: {
37
+ readonly type: "string";
38
+ readonly description: "Element reference like \"@e5\" from a previous snapshot. Required for click/type.";
39
+ };
40
+ readonly text: {
41
+ readonly type: "string";
42
+ readonly description: "Text to type into the referenced element. Required for 'type' action.";
43
+ };
44
+ readonly direction: {
45
+ readonly type: "string";
46
+ readonly enum: readonly ["up", "down", "left", "right"];
47
+ readonly description: "Scroll direction. Required for 'scroll' action.";
48
+ };
49
+ readonly method: {
50
+ readonly type: "string";
51
+ readonly description: "CDP method name (e.g. 'Page.reload'). Required for 'cdp' action.";
52
+ };
53
+ readonly params: {
54
+ readonly type: "object";
55
+ readonly description: "Parameters for the CDP method. Optional for 'cdp' action.";
56
+ };
57
+ readonly expression: {
58
+ readonly type: "string";
59
+ readonly description: "JavaScript expression to evaluate. Used with 'console' action.";
60
+ };
61
+ readonly full: {
62
+ readonly type: "boolean";
63
+ readonly description: "Include full accessibility tree (default: compact). Used with 'snapshot'.";
64
+ };
65
+ };
66
+ readonly required: readonly ["action"];
67
+ };
68
+ export interface BrowserSnapshot {
69
+ elements: Array<{
70
+ ref: string;
71
+ role: string;
72
+ name: string;
73
+ text?: string;
74
+ }>;
75
+ url: string;
76
+ title: string;
77
+ }
78
+ export interface BrowserScreenshot {
79
+ base64: string;
80
+ mimeType: string;
81
+ width: number;
82
+ height: number;
83
+ }
84
+ /**
85
+ * Host-provided browser automation backend.
86
+ * The host manages Chrome/Chromium lifecycle and CDP connections.
87
+ */
88
+ export interface BrowserToolDeps {
89
+ navigate(url: string): Promise<{
90
+ snapshot: BrowserSnapshot;
91
+ }>;
92
+ click(ref: string): Promise<{
93
+ success: boolean;
94
+ error?: string;
95
+ }>;
96
+ type(ref: string, text: string): Promise<{
97
+ success: boolean;
98
+ error?: string;
99
+ }>;
100
+ scroll(direction: "up" | "down" | "left" | "right"): Promise<{
101
+ success: boolean;
102
+ }>;
103
+ snapshot(full?: boolean): Promise<BrowserSnapshot>;
104
+ screenshot(): Promise<BrowserScreenshot>;
105
+ consoleEval(expression?: string): Promise<{
106
+ result?: string;
107
+ messages?: string[];
108
+ errors?: string[];
109
+ }>;
110
+ cdp(method: string, params?: Record<string, unknown>): Promise<Record<string, unknown>>;
111
+ /** Validate URL safety (SSRF prevention). Returns error message if blocked, null if safe. */
112
+ validateUrl(url: string): string | null;
113
+ }
114
+ export declare function createBrowserTool(deps: BrowserToolDeps): PortableTool<BrowserToolParams>;
@@ -0,0 +1,66 @@
1
+ import type { PortableTool } from "../portable-tool.js";
2
+ export declare const CHECKPOINT_TOOL_NAME: "checkpoint";
3
+ export type CheckpointAction = "create" | "list" | "restore" | "diff";
4
+ export interface CheckpointToolParams {
5
+ action: CheckpointAction;
6
+ /** Checkpoint ID (for restore/diff) */
7
+ checkpointId?: string;
8
+ /** Optional message for create */
9
+ message?: string;
10
+ /** File paths to restore (partial restore). If empty, restores all. */
11
+ paths?: string[];
12
+ }
13
+ export declare const CHECKPOINT_TOOL_SCHEMA: {
14
+ readonly type: "object";
15
+ readonly properties: {
16
+ readonly action: {
17
+ readonly type: "string";
18
+ readonly enum: readonly ["create", "list", "restore", "diff"];
19
+ readonly description: string;
20
+ };
21
+ readonly checkpointId: {
22
+ readonly type: "string";
23
+ readonly description: "Checkpoint ID. Required for restore and diff.";
24
+ };
25
+ readonly message: {
26
+ readonly type: "string";
27
+ readonly description: "Optional descriptive message for the checkpoint.";
28
+ };
29
+ readonly paths: {
30
+ readonly type: "array";
31
+ readonly items: {
32
+ readonly type: "string";
33
+ };
34
+ readonly description: "File paths to restore (partial restore). Omit to restore everything.";
35
+ };
36
+ };
37
+ readonly required: readonly ["action"];
38
+ };
39
+ export interface Checkpoint {
40
+ id: string;
41
+ message: string;
42
+ timestamp: string;
43
+ fileCount: number;
44
+ }
45
+ export interface CheckpointResult {
46
+ success: boolean;
47
+ checkpoint?: Checkpoint;
48
+ checkpoints?: Checkpoint[];
49
+ diff?: string;
50
+ error?: string;
51
+ }
52
+ /**
53
+ * Host-provided checkpoint backend.
54
+ * Uses shadow git repos (isolated from user project) for snapshots.
55
+ */
56
+ export interface CheckpointToolDeps {
57
+ /** Create a snapshot of the current workspace state */
58
+ createCheckpoint(message?: string): Promise<CheckpointResult>;
59
+ /** List all available checkpoints */
60
+ listCheckpoints(): Promise<CheckpointResult>;
61
+ /** Restore workspace to a checkpoint state (optionally partial) */
62
+ restoreCheckpoint(checkpointId: string, paths?: string[]): Promise<CheckpointResult>;
63
+ /** Show diff between current state and a checkpoint */
64
+ diffCheckpoint(checkpointId: string): Promise<CheckpointResult>;
65
+ }
66
+ export declare function createCheckpointTool(deps: CheckpointToolDeps): PortableTool<CheckpointToolParams>;
@@ -0,0 +1,63 @@
1
+ import type { PortableTool } from "../portable-tool.js";
2
+ export declare const CONFIG_TOOL_NAME: "config";
3
+ export type ConfigAction = "get" | "set" | "list" | "reset";
4
+ export interface ConfigToolParams {
5
+ /** Config action */
6
+ action: ConfigAction;
7
+ /** Setting key path (e.g. "model", "language", "theme") */
8
+ key?: string;
9
+ /** Value to set (for 'set' action) */
10
+ value?: string | boolean | number;
11
+ }
12
+ export declare const CONFIG_TOOL_SCHEMA: {
13
+ readonly type: "object";
14
+ readonly properties: {
15
+ readonly action: {
16
+ readonly type: "string";
17
+ readonly enum: readonly ["get", "set", "list", "reset"];
18
+ readonly description: string;
19
+ };
20
+ readonly key: {
21
+ readonly type: "string";
22
+ readonly description: string;
23
+ };
24
+ readonly value: {
25
+ readonly description: "Value to set. Type depends on the setting. Required for 'set' action.";
26
+ };
27
+ };
28
+ readonly required: readonly ["action"];
29
+ };
30
+ export interface ConfigSetting {
31
+ key: string;
32
+ value: unknown;
33
+ type: "string" | "boolean" | "number" | "enum";
34
+ description: string;
35
+ options?: string[];
36
+ readOnly?: boolean;
37
+ }
38
+ export interface ConfigResult {
39
+ success: boolean;
40
+ setting?: ConfigSetting;
41
+ settings?: ConfigSetting[];
42
+ previousValue?: unknown;
43
+ error?: string;
44
+ }
45
+ /** Keys that cannot be modified by LLM (security-critical) */
46
+ export declare const CONFIG_READONLY_KEYS: readonly string[];
47
+ /**
48
+ * Host-provided config backend.
49
+ * Manages persistent agent settings with safety guardrails.
50
+ */
51
+ export interface ConfigToolDeps {
52
+ /** Get a single config value */
53
+ getConfig(key: string): Promise<ConfigResult>;
54
+ /** Set a config value (respects readonly/whitelist) */
55
+ setConfig(key: string, value: unknown): Promise<ConfigResult>;
56
+ /** List all available config settings */
57
+ listConfig(): Promise<ConfigResult>;
58
+ /** Reset a setting to default */
59
+ resetConfig(key: string): Promise<ConfigResult>;
60
+ /** Check if a key is supported/valid */
61
+ isValidKey?(key: string): boolean;
62
+ }
63
+ export declare function createConfigTool(deps: ConfigToolDeps): PortableTool<ConfigToolParams>;
@@ -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>;