qlogicagent 0.2.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -45
- package/package.json +56 -42
- package/dist/agent/agent.d.ts +0 -43
- package/dist/agent/agent.js +0 -113
- package/dist/agent/tool-loop.d.ts +0 -64
- package/dist/agent/tool-loop.js +0 -575
- package/dist/agent/types.d.ts +0 -175
- package/dist/agent/types.js +0 -14
- package/dist/cli/main.d.ts +0 -11
- package/dist/cli/main.js +0 -23
- package/dist/cli/stdio-server.d.ts +0 -45
- package/dist/cli/stdio-server.js +0 -463
- package/dist/config/config.d.ts +0 -17
- package/dist/config/config.js +0 -21
- package/dist/contracts/hooks.d.ts +0 -120
- package/dist/contracts/hooks.js +0 -7
- package/dist/contracts/index.d.ts +0 -10
- package/dist/contracts/index.js +0 -10
- package/dist/contracts/planner.d.ts +0 -35
- package/dist/contracts/planner.js +0 -2
- package/dist/contracts/skill-candidate.d.ts +0 -63
- package/dist/contracts/skill-candidate.js +0 -195
- package/dist/contracts/todo.d.ts +0 -14
- package/dist/contracts/todo.js +0 -9
- package/dist/index.d.ts +0 -13
- package/dist/index.js +0 -15
- package/dist/llm/builtin-providers.d.ts +0 -10
- package/dist/llm/builtin-providers.js +0 -531
- package/dist/llm/index.d.ts +0 -15
- package/dist/llm/index.js +0 -14
- package/dist/llm/llm-client.d.ts +0 -43
- package/dist/llm/llm-client.js +0 -67
- package/dist/llm/model-catalog.d.ts +0 -53
- package/dist/llm/model-catalog.js +0 -191
- package/dist/llm/provider-def.d.ts +0 -59
- package/dist/llm/provider-def.js +0 -12
- package/dist/llm/provider-registry.d.ts +0 -54
- package/dist/llm/provider-registry.js +0 -147
- package/dist/llm/transport.d.ts +0 -62
- package/dist/llm/transport.js +0 -27
- package/dist/llm/transports/anthropic-messages.d.ts +0 -31
- package/dist/llm/transports/anthropic-messages.js +0 -293
- package/dist/llm/transports/openai-chat.d.ts +0 -36
- package/dist/llm/transports/openai-chat.js +0 -165
- package/dist/orchestration/agent-registry.d.ts +0 -41
- package/dist/orchestration/agent-registry.js +0 -116
- package/dist/orchestration/approval-aware-tool-plan.d.ts +0 -32
- package/dist/orchestration/approval-aware-tool-plan.js +0 -87
- package/dist/orchestration/context-compression.d.ts +0 -220
- package/dist/orchestration/context-compression.js +0 -583
- package/dist/orchestration/conversation-repair.d.ts +0 -61
- package/dist/orchestration/conversation-repair.js +0 -429
- package/dist/orchestration/curator-scheduler.d.ts +0 -119
- package/dist/orchestration/curator-scheduler.js +0 -135
- package/dist/orchestration/embedded-failover-policy.d.ts +0 -110
- package/dist/orchestration/embedded-failover-policy.js +0 -168
- package/dist/orchestration/error-classification.d.ts +0 -12
- package/dist/orchestration/error-classification.js +0 -77
- package/dist/orchestration/failover-classification.d.ts +0 -8
- package/dist/orchestration/failover-classification.js +0 -381
- package/dist/orchestration/failover-error.d.ts +0 -33
- package/dist/orchestration/failover-error.js +0 -198
- package/dist/orchestration/fork-subagent.d.ts +0 -100
- package/dist/orchestration/fork-subagent.js +0 -98
- package/dist/orchestration/index.d.ts +0 -120
- package/dist/orchestration/index.js +0 -267
- package/dist/orchestration/memory-flush-policy.d.ts +0 -57
- package/dist/orchestration/memory-flush-policy.js +0 -85
- package/dist/orchestration/memory-provider.d.ts +0 -14
- package/dist/orchestration/memory-provider.js +0 -2
- package/dist/orchestration/parallel-tool-calls.d.ts +0 -41
- package/dist/orchestration/parallel-tool-calls.js +0 -59
- package/dist/orchestration/prompt-cache-strategy.d.ts +0 -126
- package/dist/orchestration/prompt-cache-strategy.js +0 -228
- package/dist/orchestration/reactive-compact.d.ts +0 -73
- package/dist/orchestration/reactive-compact.js +0 -78
- package/dist/orchestration/retry-loop.d.ts +0 -22
- package/dist/orchestration/retry-loop.js +0 -24
- package/dist/orchestration/skill-candidate.d.ts +0 -52
- package/dist/orchestration/skill-candidate.js +0 -141
- package/dist/orchestration/skill-consolidation.d.ts +0 -123
- package/dist/orchestration/skill-consolidation.js +0 -220
- package/dist/orchestration/skill-improvement.d.ts +0 -59
- package/dist/orchestration/skill-improvement.js +0 -66
- package/dist/orchestration/skill-similarity.d.ts +0 -98
- package/dist/orchestration/skill-similarity.js +0 -131
- package/dist/orchestration/streaming-tool-executor.d.ts +0 -73
- package/dist/orchestration/streaming-tool-executor.js +0 -96
- package/dist/orchestration/team-orchestration.d.ts +0 -195
- package/dist/orchestration/team-orchestration.js +0 -369
- package/dist/orchestration/team-tool-loop-wiring.d.ts +0 -92
- package/dist/orchestration/team-tool-loop-wiring.js +0 -147
- package/dist/orchestration/tool-choice-policy.d.ts +0 -54
- package/dist/orchestration/tool-choice-policy.js +0 -164
- package/dist/orchestration/tool-loop-state.d.ts +0 -50
- package/dist/orchestration/tool-loop-state.js +0 -133
- package/dist/orchestration/tool-schema.d.ts +0 -39
- package/dist/orchestration/tool-schema.js +0 -297
- package/dist/orchestration/transcript-repair.d.ts +0 -42
- package/dist/orchestration/transcript-repair.js +0 -426
- package/dist/orchestration/turn-loop-guard.d.ts +0 -86
- package/dist/orchestration/turn-loop-guard.js +0 -92
- package/dist/orchestration/web-browser-policy.d.ts +0 -17
- package/dist/orchestration/web-browser-policy.js +0 -39
- package/dist/runtime/context-compression.d.ts +0 -61
- package/dist/runtime/context-compression.js +0 -274
- package/dist/runtime/hook-registry.d.ts +0 -12
- package/dist/runtime/hook-registry.js +0 -53
- package/dist/runtime/memory-hooks.d.ts +0 -23
- package/dist/runtime/memory-hooks.js +0 -65
- package/dist/runtime/tool-eligibility.d.ts +0 -59
- package/dist/runtime/tool-eligibility.js +0 -111
- package/dist/skills/index.d.ts +0 -108
- package/dist/skills/index.js +0 -82
- package/dist/skills/memory-extractor.d.ts +0 -64
- package/dist/skills/memory-extractor.js +0 -173
- package/dist/skills/memory-query-tool.d.ts +0 -43
- package/dist/skills/memory-query-tool.js +0 -127
- package/dist/skills/memory-store.d.ts +0 -66
- package/dist/skills/memory-store.js +0 -228
- package/dist/skills/memory-tool.d.ts +0 -67
- package/dist/skills/memory-tool.js +0 -192
- package/dist/skills/portable-tool.d.ts +0 -71
- package/dist/skills/portable-tool.js +0 -14
- package/dist/skills/qmemory-adapter.d.ts +0 -52
- package/dist/skills/qmemory-adapter.js +0 -165
- package/dist/skills/skill-frontmatter.d.ts +0 -19
- package/dist/skills/skill-frontmatter.js +0 -344
- package/dist/skills/skill-guard.d.ts +0 -23
- package/dist/skills/skill-guard.js +0 -229
- package/dist/skills/skill-loader.d.ts +0 -16
- package/dist/skills/skill-loader.js +0 -303
- package/dist/skills/skill-source.d.ts +0 -119
- package/dist/skills/skill-source.js +0 -126
- package/dist/skills/skill-types.d.ts +0 -199
- package/dist/skills/skill-types.js +0 -6
- package/dist/skills/think-tool.d.ts +0 -16
- package/dist/skills/think-tool.js +0 -59
- package/dist/skills/todo-tool.d.ts +0 -63
- package/dist/skills/todo-tool.js +0 -114
- package/dist/skills/tools/agent-tool.d.ts +0 -91
- package/dist/skills/tools/agent-tool.js +0 -142
- package/dist/skills/tools/apply-patch-tool.d.ts +0 -29
- package/dist/skills/tools/apply-patch-tool.js +0 -184
- package/dist/skills/tools/ask-user-tool.d.ts +0 -80
- package/dist/skills/tools/ask-user-tool.js +0 -121
- package/dist/skills/tools/brief-tool.d.ts +0 -74
- package/dist/skills/tools/brief-tool.js +0 -95
- package/dist/skills/tools/browser-tool.d.ts +0 -114
- package/dist/skills/tools/browser-tool.js +0 -155
- package/dist/skills/tools/checkpoint-tool.d.ts +0 -66
- package/dist/skills/tools/checkpoint-tool.js +0 -102
- package/dist/skills/tools/config-tool.d.ts +0 -63
- package/dist/skills/tools/config-tool.js +0 -143
- package/dist/skills/tools/cron-tool.d.ts +0 -116
- package/dist/skills/tools/cron-tool.js +0 -175
- package/dist/skills/tools/edit-tool.d.ts +0 -43
- package/dist/skills/tools/edit-tool.js +0 -70
- package/dist/skills/tools/exec-tool.d.ts +0 -102
- package/dist/skills/tools/exec-tool.js +0 -133
- package/dist/skills/tools/image-generate-tool.d.ts +0 -62
- package/dist/skills/tools/image-generate-tool.js +0 -67
- package/dist/skills/tools/instructions-tool.d.ts +0 -103
- package/dist/skills/tools/instructions-tool.js +0 -187
- package/dist/skills/tools/lsp-tool.d.ts +0 -153
- package/dist/skills/tools/lsp-tool.js +0 -227
- package/dist/skills/tools/mcp-client-types.d.ts +0 -269
- package/dist/skills/tools/mcp-client-types.js +0 -53
- package/dist/skills/tools/mcp-tool.d.ts +0 -249
- package/dist/skills/tools/mcp-tool.js +0 -503
- package/dist/skills/tools/memory-tool.d.ts +0 -74
- package/dist/skills/tools/memory-tool.js +0 -88
- package/dist/skills/tools/monitor-tool.d.ts +0 -113
- package/dist/skills/tools/monitor-tool.js +0 -131
- package/dist/skills/tools/music-generate-tool.d.ts +0 -55
- package/dist/skills/tools/music-generate-tool.js +0 -62
- package/dist/skills/tools/notify-tool.d.ts +0 -53
- package/dist/skills/tools/notify-tool.js +0 -62
- package/dist/skills/tools/patch-tool.d.ts +0 -45
- package/dist/skills/tools/patch-tool.js +0 -505
- package/dist/skills/tools/pdf-tool.d.ts +0 -66
- package/dist/skills/tools/pdf-tool.js +0 -88
- package/dist/skills/tools/plan-mode-tool.d.ts +0 -59
- package/dist/skills/tools/plan-mode-tool.js +0 -122
- package/dist/skills/tools/read-tool.d.ts +0 -51
- package/dist/skills/tools/read-tool.js +0 -84
- package/dist/skills/tools/repl-tool.d.ts +0 -70
- package/dist/skills/tools/repl-tool.js +0 -69
- package/dist/skills/tools/search-tool.d.ts +0 -112
- package/dist/skills/tools/search-tool.js +0 -225
- package/dist/skills/tools/send-message-tool.d.ts +0 -51
- package/dist/skills/tools/send-message-tool.js +0 -76
- package/dist/skills/tools/skill-list-tool.d.ts +0 -33
- package/dist/skills/tools/skill-list-tool.js +0 -54
- package/dist/skills/tools/skill-manage-tool.d.ts +0 -73
- package/dist/skills/tools/skill-manage-tool.js +0 -153
- package/dist/skills/tools/skill-view-tool.d.ts +0 -37
- package/dist/skills/tools/skill-view-tool.js +0 -72
- package/dist/skills/tools/sleep-tool.d.ts +0 -49
- package/dist/skills/tools/sleep-tool.js +0 -81
- package/dist/skills/tools/structured-output-tool.d.ts +0 -116
- package/dist/skills/tools/structured-output-tool.js +0 -176
- package/dist/skills/tools/task-tool.d.ts +0 -104
- package/dist/skills/tools/task-tool.js +0 -161
- package/dist/skills/tools/team-tool.d.ts +0 -89
- package/dist/skills/tools/team-tool.js +0 -105
- package/dist/skills/tools/tool-search-tool.d.ts +0 -51
- package/dist/skills/tools/tool-search-tool.js +0 -110
- package/dist/skills/tools/tts-tool.d.ts +0 -38
- package/dist/skills/tools/tts-tool.js +0 -45
- package/dist/skills/tools/video-edit-tool.d.ts +0 -69
- package/dist/skills/tools/video-edit-tool.js +0 -74
- package/dist/skills/tools/video-generate-tool.d.ts +0 -62
- package/dist/skills/tools/video-generate-tool.js +0 -66
- package/dist/skills/tools/video-merge-tool.d.ts +0 -105
- package/dist/skills/tools/video-merge-tool.js +0 -92
- package/dist/skills/tools/video-upscale-tool.d.ts +0 -45
- package/dist/skills/tools/video-upscale-tool.js +0 -52
- package/dist/skills/tools/web-fetch-tool.d.ts +0 -78
- package/dist/skills/tools/web-fetch-tool.js +0 -92
- package/dist/skills/tools/web-search-tool.d.ts +0 -57
- package/dist/skills/tools/web-search-tool.js +0 -86
- package/dist/skills/tools/worktree-tool.d.ts +0 -69
- package/dist/skills/tools/worktree-tool.js +0 -147
- package/dist/skills/tools/write-tool.d.ts +0 -45
- package/dist/skills/tools/write-tool.js +0 -81
|
@@ -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,131 +0,0 @@
|
|
|
1
|
-
// ============================================================
|
|
2
|
-
// Monitor Tool — event-driven wake-up / watch mechanism.
|
|
3
|
-
// Reference: CC proactive mode MonitorTool (feature-gated)
|
|
4
|
-
// Category: autonomous / proactive mode
|
|
5
|
-
// ============================================================
|
|
6
|
-
export const MONITOR_TOOL_NAME = "monitor";
|
|
7
|
-
export const MONITOR_TOOL_SCHEMA = {
|
|
8
|
-
type: "object",
|
|
9
|
-
properties: {
|
|
10
|
-
action: {
|
|
11
|
-
type: "string",
|
|
12
|
-
enum: ["start", "stop", "list"],
|
|
13
|
-
description: "Action to perform: start a new monitor, stop an existing one, or list active monitors.",
|
|
14
|
-
},
|
|
15
|
-
monitorId: {
|
|
16
|
-
type: "string",
|
|
17
|
-
description: "Identifier for the monitor instance. Required for start/stop.",
|
|
18
|
-
},
|
|
19
|
-
source: {
|
|
20
|
-
type: "string",
|
|
21
|
-
enum: ["process", "file", "task", "custom"],
|
|
22
|
-
description: "Type of event source to watch.",
|
|
23
|
-
},
|
|
24
|
-
target: {
|
|
25
|
-
type: "string",
|
|
26
|
-
description: "Selector for the monitored target. For process: PID or background job id. " +
|
|
27
|
-
"For file: glob pattern. For task: task ID. For custom: host-defined key.",
|
|
28
|
-
},
|
|
29
|
-
conditions: {
|
|
30
|
-
type: "array",
|
|
31
|
-
items: {
|
|
32
|
-
type: "object",
|
|
33
|
-
properties: {
|
|
34
|
-
type: {
|
|
35
|
-
type: "string",
|
|
36
|
-
enum: ["exit", "output_match", "file_changed", "task_status"],
|
|
37
|
-
},
|
|
38
|
-
value: { type: "string" },
|
|
39
|
-
},
|
|
40
|
-
required: ["type"],
|
|
41
|
-
},
|
|
42
|
-
description: "Conditions that trigger a wake-up notification.",
|
|
43
|
-
},
|
|
44
|
-
timeoutSeconds: {
|
|
45
|
-
type: "number",
|
|
46
|
-
description: "Auto-stop after this many seconds (default: 3600).",
|
|
47
|
-
minimum: 1,
|
|
48
|
-
maximum: 86400,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
required: ["action"],
|
|
52
|
-
};
|
|
53
|
-
export function createMonitorTool(deps) {
|
|
54
|
-
return {
|
|
55
|
-
name: MONITOR_TOOL_NAME,
|
|
56
|
-
label: "Monitor",
|
|
57
|
-
shouldDefer: true,
|
|
58
|
-
description: [
|
|
59
|
-
"Set up event-driven monitoring to wake up when something happens.",
|
|
60
|
-
"",
|
|
61
|
-
"Use this to watch for:",
|
|
62
|
-
"• Background process completion or specific output patterns",
|
|
63
|
-
"• File system changes (new file, modification)",
|
|
64
|
-
"• Async task state transitions (pending → completed/failed)",
|
|
65
|
-
"• Custom host-defined events",
|
|
66
|
-
"",
|
|
67
|
-
"When a monitored condition triggers, you'll receive a notification in your next tick.",
|
|
68
|
-
"This is more efficient than polling with Sleep — you only wake up when there's work to do.",
|
|
69
|
-
"",
|
|
70
|
-
"Actions:",
|
|
71
|
-
"• start — register a new monitor (requires monitorId, source, target)",
|
|
72
|
-
"• stop — deregister an active monitor",
|
|
73
|
-
"• list — show all active monitors and their event counts",
|
|
74
|
-
].join("\n"),
|
|
75
|
-
parameters: MONITOR_TOOL_SCHEMA,
|
|
76
|
-
execute: async (_toolCallId, params) => {
|
|
77
|
-
const { action } = params;
|
|
78
|
-
if (action === "list") {
|
|
79
|
-
const monitors = await deps.listMonitors();
|
|
80
|
-
if (monitors.length === 0) {
|
|
81
|
-
return {
|
|
82
|
-
content: [{ type: "text", text: "No active monitors." }],
|
|
83
|
-
details: { action, monitors: [] },
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
const lines = monitors.map((m) => `• ${m.monitorId} [${m.source}] → ${m.target} (events: ${m.eventCount}, timeout: ${m.timeoutSeconds}s)`);
|
|
87
|
-
return {
|
|
88
|
-
content: [{ type: "text", text: `Active monitors:\n${lines.join("\n")}` }],
|
|
89
|
-
details: { action, monitors },
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
if (!params.monitorId) {
|
|
93
|
-
return {
|
|
94
|
-
content: [{ type: "text", text: "Error: monitorId is required for start/stop." }],
|
|
95
|
-
details: { action, success: false, error: "missing_monitor_id" },
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
if (action === "stop") {
|
|
99
|
-
const result = await deps.stopMonitor(params.monitorId);
|
|
100
|
-
const text = result.success
|
|
101
|
-
? `Monitor "${params.monitorId}" stopped.`
|
|
102
|
-
: `Failed to stop monitor "${params.monitorId}": ${result.error ?? "not found"}`;
|
|
103
|
-
return {
|
|
104
|
-
content: [{ type: "text", text }],
|
|
105
|
-
details: { ...result },
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
// action === "start"
|
|
109
|
-
if (!params.source || !params.target) {
|
|
110
|
-
return {
|
|
111
|
-
content: [{ type: "text", text: "Error: source and target are required to start a monitor." }],
|
|
112
|
-
details: { action, success: false, error: "missing_source_or_target" },
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
const result = await deps.startMonitor({
|
|
116
|
-
monitorId: params.monitorId,
|
|
117
|
-
source: params.source,
|
|
118
|
-
target: params.target,
|
|
119
|
-
conditions: params.conditions ?? [],
|
|
120
|
-
timeoutSeconds: params.timeoutSeconds ?? 3600,
|
|
121
|
-
});
|
|
122
|
-
const text = result.success
|
|
123
|
-
? `Monitor "${params.monitorId}" started: watching ${params.source} "${params.target}".`
|
|
124
|
-
: `Failed to start monitor: ${result.error ?? "unknown"}`;
|
|
125
|
-
return {
|
|
126
|
-
content: [{ type: "text", text }],
|
|
127
|
-
details: { ...result },
|
|
128
|
-
};
|
|
129
|
-
},
|
|
130
|
-
};
|
|
131
|
-
}
|
|
@@ -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,62 +0,0 @@
|
|
|
1
|
-
// ============================================================
|
|
2
|
-
// Music Generate Tool — text-to-music via backend adapter.
|
|
3
|
-
// Category: media
|
|
4
|
-
// ============================================================
|
|
5
|
-
export const MUSIC_GENERATE_TOOL_NAME = "music_generate";
|
|
6
|
-
export const MUSIC_GENERATE_TOOL_SCHEMA = {
|
|
7
|
-
type: "object",
|
|
8
|
-
properties: {
|
|
9
|
-
prompt: {
|
|
10
|
-
type: "string",
|
|
11
|
-
description: "Music generation prompt. MUST be in English. " +
|
|
12
|
-
"Include genre, mood, tempo, instruments, and atmosphere details.",
|
|
13
|
-
},
|
|
14
|
-
purpose: {
|
|
15
|
-
type: "string",
|
|
16
|
-
description: "Intended use: 'background-music', 'ringtone', 'short-video-bgm', 'full-song', 'notification-sound', etc.",
|
|
17
|
-
},
|
|
18
|
-
style: {
|
|
19
|
-
type: "string",
|
|
20
|
-
description: "Musical style/genre: 'lo-fi', 'pop', 'rock', 'jazz', 'classical', 'electronic', 'ambient', etc.",
|
|
21
|
-
},
|
|
22
|
-
lyrics: {
|
|
23
|
-
type: "string",
|
|
24
|
-
description: "Optional lyrics for vocal music. Structure with [verse], [chorus], [bridge] tags if desired.",
|
|
25
|
-
},
|
|
26
|
-
duration: {
|
|
27
|
-
type: "number",
|
|
28
|
-
description: "Duration in seconds (5-300). Infer from purpose: ringtone 15-30s, BGM 30-60s, full song 120-180s.",
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
required: ["prompt"],
|
|
32
|
-
};
|
|
33
|
-
export function createMusicGenerateTool(deps) {
|
|
34
|
-
return {
|
|
35
|
-
name: MUSIC_GENERATE_TOOL_NAME,
|
|
36
|
-
label: "Music Generate",
|
|
37
|
-
description: "Generate music, songs, or melodies from text descriptions. " +
|
|
38
|
-
"Prompt MUST be in English. Supports lyrics for vocal songs. " +
|
|
39
|
-
"DO NOT use for spoken-word audio or TTS — use tts tool instead.",
|
|
40
|
-
parameters: MUSIC_GENERATE_TOOL_SCHEMA,
|
|
41
|
-
execute: async (_toolCallId, params) => {
|
|
42
|
-
const result = await deps.generateMusic({
|
|
43
|
-
prompt: params.prompt,
|
|
44
|
-
purpose: params.purpose,
|
|
45
|
-
style: params.style,
|
|
46
|
-
lyrics: params.lyrics,
|
|
47
|
-
duration: params.duration,
|
|
48
|
-
});
|
|
49
|
-
const count = result.mediaUrls.length;
|
|
50
|
-
const text = `Generated ${count} audio track${count > 1 ? "s" : ""}${result.model ? ` (model: ${result.model})` : ""}`;
|
|
51
|
-
return {
|
|
52
|
-
content: [{ type: "text", text }],
|
|
53
|
-
details: {
|
|
54
|
-
type: "music_generate",
|
|
55
|
-
model: result.model,
|
|
56
|
-
durationMs: result.durationMs,
|
|
57
|
-
mediaUrls: result.mediaUrls,
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
}
|
|
@@ -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,62 +0,0 @@
|
|
|
1
|
-
// ============================================================
|
|
2
|
-
// Notify Tool — push notifications to user across platforms.
|
|
3
|
-
// Reference: hermes-agent-main/tools/send_message_tool.py
|
|
4
|
-
// Category: interaction
|
|
5
|
-
// ============================================================
|
|
6
|
-
export const NOTIFY_TOOL_NAME = "notify";
|
|
7
|
-
export const NOTIFY_TOOL_SCHEMA = {
|
|
8
|
-
type: "object",
|
|
9
|
-
properties: {
|
|
10
|
-
message: {
|
|
11
|
-
type: "string",
|
|
12
|
-
description: "Notification content to send to the user.",
|
|
13
|
-
},
|
|
14
|
-
title: {
|
|
15
|
-
type: "string",
|
|
16
|
-
description: "Optional notification title/subject line.",
|
|
17
|
-
},
|
|
18
|
-
priority: {
|
|
19
|
-
type: "string",
|
|
20
|
-
enum: ["low", "normal", "high"],
|
|
21
|
-
description: "Notification priority (default: normal). High may trigger sound/vibration.",
|
|
22
|
-
},
|
|
23
|
-
channel: {
|
|
24
|
-
type: "string",
|
|
25
|
-
description: "Target delivery channel (e.g. 'wechat', 'feishu', 'discord'). Default: user's primary.",
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
required: ["message"],
|
|
29
|
-
};
|
|
30
|
-
export function createNotifyTool(deps) {
|
|
31
|
-
return {
|
|
32
|
-
name: NOTIFY_TOOL_NAME,
|
|
33
|
-
label: "Notify",
|
|
34
|
-
description: "Send a notification to the user. Used for alerting about completed long-running tasks, " +
|
|
35
|
-
"important updates, or requesting attention. Supports multiple channels (WeChat, Feishu, Discord, etc).",
|
|
36
|
-
parameters: NOTIFY_TOOL_SCHEMA,
|
|
37
|
-
execute: async (_toolCallId, params) => {
|
|
38
|
-
if (!params.message || params.message.trim().length === 0) {
|
|
39
|
-
return {
|
|
40
|
-
content: [{ type: "text", text: "Error: message is required." }],
|
|
41
|
-
details: { type: "notify", error: "empty_message" },
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
const result = await deps.sendNotification({
|
|
45
|
-
message: params.message.trim(),
|
|
46
|
-
title: params.title,
|
|
47
|
-
priority: params.priority || "normal",
|
|
48
|
-
channel: params.channel,
|
|
49
|
-
});
|
|
50
|
-
if (!result.delivered) {
|
|
51
|
-
return {
|
|
52
|
-
content: [{ type: "text", text: `Notification failed: ${result.error || "delivery error"}` }],
|
|
53
|
-
details: { type: "notify", delivered: false, error: result.error },
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
content: [{ type: "text", text: `Notification sent via ${result.channel}.` }],
|
|
58
|
-
details: { type: "notify", delivered: true, channel: result.channel },
|
|
59
|
-
};
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
}
|
|
@@ -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 };
|