@pellux/goodvibes-agent 1.1.7 → 1.2.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/CHANGELOG.md +170 -0
- package/README.md +46 -30
- package/dist/package/{ast-grep-napi.linux-x64-gnu-mkk8xwww.node → ast-grep-napi.linux-x64-gnu-swtppvy9.node} +0 -0
- package/dist/package/{ast-grep-napi.linux-x64-musl-ryqtgdv6.node → ast-grep-napi.linux-x64-musl-ttfcdtap.node} +0 -0
- package/dist/package/main.js +132577 -91483
- package/docs/README.md +14 -7
- package/docs/channels-remote-and-api.md +8 -5
- package/docs/connected-host.md +14 -12
- package/docs/getting-started.md +56 -30
- package/docs/knowledge-artifacts-and-multimodal.md +7 -5
- package/docs/project-planning.md +2 -2
- package/docs/providers-and-routing.md +11 -3
- package/docs/tools-and-commands.md +114 -45
- package/docs/voice-and-live-tts.md +3 -1
- package/package.json +3 -2
- package/release/release-notes.md +130 -5
- package/release/release-readiness.json +120 -90
- package/src/agent/assistant-cockpit.ts +247 -0
- package/src/agent/autonomy-schedule-format.ts +96 -0
- package/src/agent/autonomy-schedule.ts +514 -0
- package/src/agent/channel-delivery-receipts.ts +292 -0
- package/src/agent/competitive-feature-inventory.ts +296 -0
- package/src/agent/document-registry-types.ts +106 -0
- package/src/agent/document-registry.ts +734 -0
- package/src/agent/harness-control.ts +2 -2
- package/src/agent/memory-prompt.ts +2 -2
- package/src/agent/operator-actions.ts +50 -6
- package/src/agent/persona-registry.ts +8 -0
- package/src/agent/project-context-files.ts +273 -0
- package/src/agent/prompt-context-receipts.ts +502 -0
- package/src/agent/reminder-schedule-format.ts +16 -2
- package/src/agent/research-run-registry.ts +582 -0
- package/src/agent/research-source-registry.ts +441 -0
- package/src/agent/routine-registry.ts +19 -3
- package/src/agent/routine-schedule-format.ts +27 -2
- package/src/agent/runtime-profile-starters.ts +7 -0
- package/src/agent/runtime-profile.ts +106 -4
- package/src/agent/schedule-edit-format.ts +129 -0
- package/src/agent/schedule-edit.ts +496 -0
- package/src/agent/schedule-next-routes.ts +42 -0
- package/src/agent/setup-wizard-checkpoint.ts +140 -0
- package/src/agent/setup-wizard.ts +447 -0
- package/src/agent/skill-registry-types.ts +102 -0
- package/src/agent/skill-registry.ts +81 -107
- package/src/agent/vibe-confirmation-routes.ts +62 -0
- package/src/agent/vibe-file.ts +285 -0
- package/src/cli/agent-knowledge-command.ts +45 -2
- package/src/cli/help.ts +3 -0
- package/src/cli/profiles-command.ts +25 -11
- package/src/config/agent-settings-policy.ts +1 -18
- package/src/input/agent-workspace-activation.ts +53 -0
- package/src/input/agent-workspace-artifact-browser-editor.ts +494 -0
- package/src/input/agent-workspace-artifact-metadata.ts +17 -0
- package/src/input/agent-workspace-basic-command-editors.ts +5 -1
- package/src/input/agent-workspace-categories.ts +153 -155
- package/src/input/agent-workspace-channel-triage.ts +481 -0
- package/src/input/agent-workspace-channels.ts +263 -0
- package/src/input/agent-workspace-command-editor.ts +152 -0
- package/src/input/agent-workspace-context-snapshot.ts +349 -0
- package/src/input/agent-workspace-delegation-editor-submission.ts +8 -0
- package/src/input/agent-workspace-document-editor.ts +502 -0
- package/src/input/agent-workspace-document-ops-editor.ts +523 -0
- package/src/input/agent-workspace-host-category.ts +1 -1
- package/src/input/agent-workspace-local-library-snapshot.ts +167 -0
- package/src/input/agent-workspace-model-compare-editor.ts +376 -0
- package/src/input/agent-workspace-model-compare-prompt-submission.ts +552 -0
- package/src/input/agent-workspace-model-compare-types.ts +82 -0
- package/src/input/agent-workspace-model-compare-utils.ts +35 -0
- package/src/input/agent-workspace-onboarding-categories.ts +141 -0
- package/src/input/agent-workspace-operations-command-editor-submission.ts +53 -0
- package/src/input/agent-workspace-operations-command-editors.ts +22 -0
- package/src/input/agent-workspace-research-report-editor.ts +212 -0
- package/src/input/agent-workspace-research-run-editor.ts +144 -0
- package/src/input/agent-workspace-research-source-editor.ts +167 -0
- package/src/input/agent-workspace-review-packet-snapshot.ts +593 -0
- package/src/input/agent-workspace-review-packet-utils.ts +265 -0
- package/src/input/agent-workspace-settings.ts +262 -30
- package/src/input/agent-workspace-setup-checkpoint-action.ts +127 -0
- package/src/input/agent-workspace-setup-snapshot.ts +198 -0
- package/src/input/agent-workspace-setup.ts +34 -1
- package/src/input/agent-workspace-snapshot.ts +162 -147
- package/src/input/agent-workspace-types.ts +287 -2
- package/src/input/agent-workspace.ts +18 -0
- package/src/input/command-registry.ts +9 -2
- package/src/input/commands/agent-runtime-profile-runtime.ts +28 -13
- package/src/input/commands/channels-runtime.ts +102 -114
- package/src/input/commands/delegation-runtime.ts +87 -24
- package/src/input/commands/knowledge-browser-flags.ts +12 -0
- package/src/input/commands/knowledge.ts +28 -14
- package/src/input/commands/operator-actions-runtime.ts +6 -3
- package/src/input/commands/schedule-runtime.ts +71 -14
- package/src/input/commands/session-content.ts +2 -2
- package/src/input/commands/shell-core.ts +2 -0
- package/src/input/commands/vibe-runtime.ts +140 -0
- package/src/input/commands.ts +2 -0
- package/src/input/connected-host-routes.ts +123 -0
- package/src/input/settings-modal-types.ts +14 -0
- package/src/main.ts +15 -15
- package/src/panels/qr-panel.ts +2 -2
- package/src/renderer/agent-workspace-context-lines.ts +686 -0
- package/src/renderer/agent-workspace.ts +30 -419
- package/src/renderer/settings-modal-helpers.ts +12 -0
- package/src/renderer/settings-modal.ts +12 -0
- package/src/runtime/bootstrap-command-context.ts +11 -1
- package/src/runtime/bootstrap-command-parts.ts +14 -3
- package/src/runtime/bootstrap-core.ts +39 -1
- package/src/runtime/bootstrap-shell.ts +6 -0
- package/src/runtime/bootstrap.ts +113 -30
- package/src/runtime/connected-host-auth.ts +3 -2
- package/src/runtime/execution-ledger.ts +231 -0
- package/src/runtime/services.ts +88 -10
- package/src/runtime/tool-permission-safety.ts +199 -5
- package/src/shell/session-continuity-hints.ts +39 -0
- package/src/tools/agent-artifacts-tool.ts +606 -0
- package/src/tools/agent-audit-tool.ts +155 -0
- package/src/tools/agent-autonomy-schedule-tool.ts +238 -0
- package/src/tools/agent-autonomy-tool.ts +140 -0
- package/src/tools/agent-channel-send-tool.ts +24 -2
- package/src/tools/agent-channels-tool.ts +140 -0
- package/src/tools/agent-computer-tool.ts +168 -0
- package/src/tools/agent-context-policy.ts +137 -7
- package/src/tools/agent-context-tool.ts +143 -0
- package/src/tools/agent-delegation-tool.ts +128 -0
- package/src/tools/agent-device-tool.ts +240 -0
- package/src/tools/agent-documents-tool.ts +684 -0
- package/src/tools/agent-execution-tool.ts +230 -0
- package/src/tools/agent-harness-agent-orchestration.ts +703 -0
- package/src/tools/agent-harness-autonomy-intake.ts +785 -0
- package/src/tools/agent-harness-autonomy-live-records.ts +588 -0
- package/src/tools/agent-harness-autonomy-queue-types.ts +88 -0
- package/src/tools/agent-harness-autonomy-queue.ts +560 -0
- package/src/tools/agent-harness-background-processes-types.ts +35 -0
- package/src/tools/agent-harness-background-processes.ts +794 -0
- package/src/tools/agent-harness-browser-cockpit-route.ts +219 -0
- package/src/tools/agent-harness-browser-control.ts +338 -0
- package/src/tools/agent-harness-channel-metadata.ts +168 -10
- package/src/tools/agent-harness-cli-command-policy.ts +110 -0
- package/src/tools/agent-harness-command-catalog.ts +4 -2
- package/src/tools/agent-harness-command-runner.ts +42 -0
- package/src/tools/agent-harness-connected-host-status.ts +7 -4
- package/src/tools/agent-harness-delegation-posture.ts +234 -19
- package/src/tools/agent-harness-document-ops-reviewer-readiness.ts +234 -0
- package/src/tools/agent-harness-document-ops-types.ts +72 -0
- package/src/tools/agent-harness-document-ops.ts +671 -0
- package/src/tools/agent-harness-execution-history.ts +489 -0
- package/src/tools/agent-harness-execution-posture.ts +382 -0
- package/src/tools/agent-harness-file-recovery.ts +135 -0
- package/src/tools/agent-harness-keybinding-metadata.ts +16 -12
- package/src/tools/agent-harness-learning-curator-common.ts +102 -0
- package/src/tools/agent-harness-learning-curator-consolidation.ts +295 -0
- package/src/tools/agent-harness-learning-curator-proposals.ts +606 -0
- package/src/tools/agent-harness-learning-curator-types.ts +151 -0
- package/src/tools/agent-harness-learning-curator.ts +417 -0
- package/src/tools/agent-harness-local-model-benchmarks.ts +199 -0
- package/src/tools/agent-harness-local-model-cookbook.ts +238 -0
- package/src/tools/agent-harness-local-model-endpoints.ts +673 -0
- package/src/tools/agent-harness-media-posture.ts +208 -2
- package/src/tools/agent-harness-memory-posture.ts +556 -0
- package/src/tools/agent-harness-metadata.ts +100 -168
- package/src/tools/agent-harness-mode-catalog.ts +84 -33
- package/src/tools/agent-harness-model-catalog.ts +162 -0
- package/src/tools/agent-harness-model-provider-health.ts +186 -0
- package/src/tools/agent-harness-model-readiness.ts +406 -0
- package/src/tools/agent-harness-model-routing-types.ts +266 -0
- package/src/tools/agent-harness-model-routing-utils.ts +30 -0
- package/src/tools/agent-harness-model-routing.ts +137 -190
- package/src/tools/agent-harness-operator-methods.ts +115 -133
- package/src/tools/agent-harness-pairing-posture.ts +431 -18
- package/src/tools/agent-harness-personal-ops-discovery.ts +533 -0
- package/src/tools/agent-harness-personal-ops-intake.ts +385 -0
- package/src/tools/agent-harness-personal-ops-lanes.ts +204 -0
- package/src/tools/agent-harness-personal-ops-records.ts +732 -0
- package/src/tools/agent-harness-personal-ops-runner.ts +637 -0
- package/src/tools/agent-harness-personal-ops-types.ts +222 -0
- package/src/tools/agent-harness-personal-ops.ts +606 -0
- package/src/tools/agent-harness-project-context.ts +144 -0
- package/src/tools/agent-harness-prompt-context.ts +589 -0
- package/src/tools/agent-harness-provider-account-metadata.ts +2 -2
- package/src/tools/agent-harness-release-evidence.ts +9 -7
- package/src/tools/agent-harness-release-readiness.ts +9 -7
- package/src/tools/agent-harness-research-briefing.ts +427 -0
- package/src/tools/agent-harness-research-queue.ts +250 -0
- package/src/tools/agent-harness-research-runs.ts +295 -0
- package/src/tools/agent-harness-research-workflow.ts +322 -0
- package/src/tools/agent-harness-security-posture.ts +2 -2
- package/src/tools/agent-harness-service-posture.ts +9 -9
- package/src/tools/agent-harness-session-metadata.ts +3 -3
- package/src/tools/agent-harness-setup-connected-host.ts +501 -0
- package/src/tools/agent-harness-setup-describe.ts +557 -0
- package/src/tools/agent-harness-setup-handoffs.ts +502 -0
- package/src/tools/agent-harness-setup-model-helpers.ts +101 -0
- package/src/tools/agent-harness-setup-plan.ts +253 -0
- package/src/tools/agent-harness-setup-posture-types.ts +218 -0
- package/src/tools/agent-harness-setup-posture-utils.ts +173 -0
- package/src/tools/agent-harness-setup-posture.ts +449 -221
- package/src/tools/agent-harness-setup-smoke.ts +508 -0
- package/src/tools/agent-harness-sudo-posture.ts +114 -0
- package/src/tools/agent-harness-tool-schema.ts +120 -7
- package/src/tools/agent-harness-tool-types.ts +78 -0
- package/src/tools/agent-harness-tool-utils.ts +43 -0
- package/src/tools/agent-harness-tool.ts +311 -370
- package/src/tools/agent-harness-ui-surface-metadata.ts +76 -69
- package/src/tools/agent-harness-ui-surface-types.ts +46 -0
- package/src/tools/agent-harness-vibe-health.ts +105 -0
- package/src/tools/agent-harness-workspace-action-runner.ts +149 -0
- package/src/tools/agent-harness-workspace-actions.ts +114 -8
- package/src/tools/agent-harness-workspace-editor-execution.ts +214 -0
- package/src/tools/agent-harness-workspace-editor-runner.ts +755 -0
- package/src/tools/agent-host-tool.ts +159 -0
- package/src/tools/agent-knowledge-ingest-tool.ts +34 -1
- package/src/tools/agent-learning-consolidation-core.ts +327 -0
- package/src/tools/agent-learning-consolidation-tool.ts +758 -0
- package/src/tools/agent-memory-tool.ts +214 -0
- package/src/tools/agent-model-compare-export.ts +315 -0
- package/src/tools/agent-model-compare-handoff.ts +592 -0
- package/src/tools/agent-model-compare-judgment.ts +633 -0
- package/src/tools/agent-model-compare-run.ts +722 -0
- package/src/tools/agent-model-compare-tool.ts +698 -0
- package/src/tools/agent-model-compare-types.ts +191 -0
- package/src/tools/agent-model-compare-utils.ts +93 -0
- package/src/tools/agent-models-tool.ts +208 -0
- package/src/tools/agent-operator-action-tool.ts +1 -1
- package/src/tools/agent-operator-method-tool.ts +643 -0
- package/src/tools/agent-personal-ops-tool.ts +197 -0
- package/src/tools/agent-policy-explanation.ts +415 -0
- package/src/tools/agent-research-report-tool.ts +608 -0
- package/src/tools/agent-research-runs-tool.ts +434 -0
- package/src/tools/agent-research-sources-tool.ts +443 -0
- package/src/tools/agent-research-tool.ts +687 -0
- package/src/tools/agent-review-packet-presets-core.ts +757 -0
- package/src/tools/agent-review-packet-presets-tool.ts +466 -0
- package/src/tools/agent-review-packet-share-tool.ts +305 -0
- package/src/tools/agent-route-planner-candidates-setup.ts +411 -0
- package/src/tools/agent-route-planner-candidates-surfaces.ts +432 -0
- package/src/tools/agent-route-planner-candidates-work.ts +251 -0
- package/src/tools/agent-route-planner-helpers.ts +667 -0
- package/src/tools/agent-route-planner.ts +185 -0
- package/src/tools/agent-route-tool.ts +105 -0
- package/src/tools/agent-schedule-edit-tool.ts +210 -0
- package/src/tools/agent-schedule-tool.ts +282 -0
- package/src/tools/agent-security-tool.ts +145 -0
- package/src/tools/agent-sessions-tool.ts +122 -0
- package/src/tools/agent-settings-import-tool.ts +104 -0
- package/src/tools/agent-settings-tool.ts +176 -0
- package/src/tools/agent-setup-tool.ts +226 -0
- package/src/tools/agent-support-tool.ts +122 -0
- package/src/tools/agent-terminal-process-tools.ts +167 -0
- package/src/tools/agent-tool-policy-guard-types.ts +77 -0
- package/src/tools/agent-tool-policy-guard.ts +106 -85
- package/src/tools/agent-vibe-tool.ts +297 -0
- package/src/tools/agent-work-plan-tool.ts +265 -6
- package/src/tools/agent-workspace-tool.ts +305 -0
- package/src/tools/artifact-archive.ts +169 -0
- package/src/tools/tool-definition-compaction.ts +36 -0
- package/src/version.ts +1 -1
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import type { Tool } from '@pellux/goodvibes-sdk/platform/types';
|
|
2
|
+
import type { ToolRegistry } from '@pellux/goodvibes-sdk/platform/tools';
|
|
3
|
+
import type { CommandContext, CommandRegistry } from '../input/command-registry.ts';
|
|
4
|
+
import { createAgentHarnessTool } from './agent-harness-tool.ts';
|
|
5
|
+
|
|
6
|
+
type AgentAuditAction = 'readiness' | 'item' | 'evidence' | 'artifact';
|
|
7
|
+
|
|
8
|
+
interface AgentAuditToolArgs {
|
|
9
|
+
readonly action?: unknown;
|
|
10
|
+
readonly mode?: unknown;
|
|
11
|
+
readonly id?: unknown;
|
|
12
|
+
readonly itemId?: unknown;
|
|
13
|
+
readonly artifactId?: unknown;
|
|
14
|
+
readonly target?: unknown;
|
|
15
|
+
readonly query?: unknown;
|
|
16
|
+
readonly includeParameters?: unknown;
|
|
17
|
+
readonly limit?: unknown;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface AgentAuditToolDeps {
|
|
21
|
+
readonly commandRegistry: CommandRegistry;
|
|
22
|
+
readonly commandContext: CommandContext;
|
|
23
|
+
readonly toolRegistry: ToolRegistry;
|
|
24
|
+
readonly harnessTool?: Tool;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function error(message: string): { readonly success: false; readonly error: string } {
|
|
28
|
+
return { success: false, error: message };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function readString(value: unknown): string {
|
|
32
|
+
return typeof value === 'string' ? value.trim() : '';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function normalizeAuditAction(value: unknown): AgentAuditAction | null {
|
|
36
|
+
const action = readString(value).toLowerCase().replace(/-/g, '_');
|
|
37
|
+
if (!action) return null;
|
|
38
|
+
if (['readiness', 'status', 'summary', 'inventory', 'gate', 'gates', 'release_readiness'].includes(action)) return 'readiness';
|
|
39
|
+
if (['item', 'readiness_item', 'release_readiness_item'].includes(action)) return 'item';
|
|
40
|
+
if (['evidence', 'artifacts', 'release_evidence', 'ledger', 'verification'].includes(action)) return 'evidence';
|
|
41
|
+
if (['artifact', 'evidence_artifact', 'release_evidence_artifact'].includes(action)) return 'artifact';
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function evidenceLikeText(args: AgentAuditToolArgs): boolean {
|
|
46
|
+
const text = `${readString(args.query)}\n${readString(args.target)}`.toLowerCase();
|
|
47
|
+
return /\b(evidence|artifact|ledger|verification|live[-\s]?verification|release notes|performance snapshot)\b/.test(text);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function readAction(args: AgentAuditToolArgs): AgentAuditAction | null {
|
|
51
|
+
const explicit = normalizeAuditAction(args.action) ?? normalizeAuditAction(args.mode);
|
|
52
|
+
if (explicit) return explicit;
|
|
53
|
+
if (readString(args.artifactId)) return 'artifact';
|
|
54
|
+
if (readString(args.itemId)) return 'item';
|
|
55
|
+
if (evidenceLikeText(args)) return 'evidence';
|
|
56
|
+
return 'readiness';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function compactArgs(entries: Record<string, unknown>): Record<string, unknown> {
|
|
60
|
+
return Object.fromEntries(Object.entries(entries).filter(([, value]) => value !== undefined && value !== ''));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function readinessArgs(args: AgentAuditToolArgs): Record<string, unknown> {
|
|
64
|
+
return compactArgs({
|
|
65
|
+
mode: 'release_readiness',
|
|
66
|
+
query: args.query ?? args.target,
|
|
67
|
+
includeParameters: args.includeParameters,
|
|
68
|
+
limit: args.limit,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function itemArgs(args: AgentAuditToolArgs): Record<string, unknown> {
|
|
73
|
+
const itemId = readString(args.itemId) || readString(args.id);
|
|
74
|
+
return compactArgs({
|
|
75
|
+
mode: 'release_readiness_item',
|
|
76
|
+
itemId,
|
|
77
|
+
target: itemId ? undefined : args.target,
|
|
78
|
+
query: itemId ? undefined : args.query,
|
|
79
|
+
includeParameters: args.includeParameters,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function evidenceArgs(args: AgentAuditToolArgs): Record<string, unknown> {
|
|
84
|
+
return compactArgs({
|
|
85
|
+
mode: 'release_evidence',
|
|
86
|
+
query: args.query ?? args.target,
|
|
87
|
+
includeParameters: args.includeParameters,
|
|
88
|
+
limit: args.limit,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function artifactArgs(args: AgentAuditToolArgs): Record<string, unknown> {
|
|
93
|
+
const artifactId = readString(args.artifactId) || readString(args.id);
|
|
94
|
+
return compactArgs({
|
|
95
|
+
mode: 'release_evidence_artifact',
|
|
96
|
+
artifactId,
|
|
97
|
+
target: artifactId ? undefined : args.target,
|
|
98
|
+
query: artifactId ? undefined : args.query,
|
|
99
|
+
includeParameters: args.includeParameters,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function createAgentAuditTool(deps: AgentAuditToolDeps): Tool {
|
|
104
|
+
const harnessTool = deps.harnessTool ?? createAgentHarnessTool({
|
|
105
|
+
commandRegistry: deps.commandRegistry,
|
|
106
|
+
commandContext: deps.commandContext,
|
|
107
|
+
toolRegistry: deps.toolRegistry,
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
return {
|
|
111
|
+
definition: {
|
|
112
|
+
name: 'audit',
|
|
113
|
+
description: 'Read release readiness and packaged release evidence.',
|
|
114
|
+
parameters: {
|
|
115
|
+
type: 'object',
|
|
116
|
+
properties: {
|
|
117
|
+
action: {
|
|
118
|
+
type: 'string',
|
|
119
|
+
enum: ['readiness', 'item', 'evidence', 'artifact'],
|
|
120
|
+
description: 'Read release inventory, one item, evidence list, or one artifact.',
|
|
121
|
+
},
|
|
122
|
+
mode: { type: 'string', description: 'Alias for action.' },
|
|
123
|
+
id: { type: 'string', description: 'Alias for itemId or artifactId depending on action.' },
|
|
124
|
+
itemId: { type: 'string', description: 'Release readiness item id.' },
|
|
125
|
+
artifactId: { type: 'string', description: 'Release evidence artifact id.' },
|
|
126
|
+
target: { type: 'string', description: 'Lookup target or search text.' },
|
|
127
|
+
query: { type: 'string', description: 'Search text.' },
|
|
128
|
+
includeParameters: { type: 'boolean', description: 'Include detailed release artifact or item content.' },
|
|
129
|
+
limit: { type: 'number', description: 'Maximum rows returned.' },
|
|
130
|
+
},
|
|
131
|
+
additionalProperties: false,
|
|
132
|
+
},
|
|
133
|
+
sideEffects: [],
|
|
134
|
+
concurrency: 'parallel',
|
|
135
|
+
},
|
|
136
|
+
execute: async (rawArgs: unknown) => {
|
|
137
|
+
const args = (rawArgs && typeof rawArgs === 'object' && !Array.isArray(rawArgs) ? rawArgs : {}) as AgentAuditToolArgs;
|
|
138
|
+
const action = readAction(args);
|
|
139
|
+
if (!action) return error('Unknown audit action. Use action:"readiness", "item", "evidence", or "artifact".');
|
|
140
|
+
if (action === 'readiness') return harnessTool.execute(readinessArgs(args));
|
|
141
|
+
if (action === 'item') return harnessTool.execute(itemArgs(args));
|
|
142
|
+
if (action === 'evidence') return harnessTool.execute(evidenceArgs(args));
|
|
143
|
+
if (action === 'artifact') return harnessTool.execute(artifactArgs(args));
|
|
144
|
+
return error('Unknown audit action. Use action:"readiness", "item", "evidence", or "artifact".');
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function registerAgentAuditTool(
|
|
150
|
+
registry: ToolRegistry,
|
|
151
|
+
commandRegistry: CommandRegistry,
|
|
152
|
+
commandContext: CommandContext,
|
|
153
|
+
): void {
|
|
154
|
+
if (!registry.has('audit')) registry.register(createAgentAuditTool({ commandRegistry, commandContext, toolRegistry: registry }));
|
|
155
|
+
}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import type { Tool } from '@pellux/goodvibes-sdk/platform/types';
|
|
2
|
+
import type { ToolRegistry } from '@pellux/goodvibes-sdk/platform/tools';
|
|
3
|
+
import type { ShellPathService } from '@/runtime/index.ts';
|
|
4
|
+
import {
|
|
5
|
+
buildAutonomySchedulePreview,
|
|
6
|
+
createAutonomySchedule,
|
|
7
|
+
parseAutonomyScheduleArgs,
|
|
8
|
+
resolveAutonomyConnectedHostConnection,
|
|
9
|
+
type AutonomyScheduleResult,
|
|
10
|
+
} from '../agent/autonomy-schedule.ts';
|
|
11
|
+
import {
|
|
12
|
+
formatAutonomyScheduleFailure,
|
|
13
|
+
formatAutonomySchedulePreview,
|
|
14
|
+
formatAutonomyScheduleSuccess,
|
|
15
|
+
} from '../agent/autonomy-schedule-format.ts';
|
|
16
|
+
import type { AgentConnectedHostConfigReader } from '../agent/routine-schedule-promotion.ts';
|
|
17
|
+
|
|
18
|
+
type AutonomyScheduleKind = 'at' | 'every' | 'cron';
|
|
19
|
+
|
|
20
|
+
export interface AgentAutonomyScheduleToolArgs {
|
|
21
|
+
readonly task?: unknown;
|
|
22
|
+
readonly successCriteria?: unknown;
|
|
23
|
+
readonly scheduleKind?: unknown;
|
|
24
|
+
readonly scheduleValue?: unknown;
|
|
25
|
+
readonly timezone?: unknown;
|
|
26
|
+
readonly name?: unknown;
|
|
27
|
+
readonly provider?: unknown;
|
|
28
|
+
readonly model?: unknown;
|
|
29
|
+
readonly deliveryChannel?: unknown;
|
|
30
|
+
readonly deliveryRoute?: unknown;
|
|
31
|
+
readonly deliveryWebhook?: unknown;
|
|
32
|
+
readonly deliveryLink?: unknown;
|
|
33
|
+
readonly disabled?: unknown;
|
|
34
|
+
readonly confirm?: unknown;
|
|
35
|
+
readonly explicitUserRequest?: unknown;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const SCHEDULE_KINDS: readonly AutonomyScheduleKind[] = ['at', 'every', 'cron'];
|
|
39
|
+
|
|
40
|
+
function isScheduleKind(value: unknown): value is AutonomyScheduleKind {
|
|
41
|
+
return typeof value === 'string' && SCHEDULE_KINDS.includes(value as AutonomyScheduleKind);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function readString(value: unknown): string {
|
|
45
|
+
return typeof value === 'string' ? value.trim() : '';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function readOptionalString(value: unknown): string | null {
|
|
49
|
+
const text = readString(value);
|
|
50
|
+
return text ? text : null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function readBoolean(value: unknown): boolean {
|
|
54
|
+
return value === true || value === 'true' || value === 'yes';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function addOptionalArg(args: string[], flag: string, value: unknown): void {
|
|
58
|
+
const text = readOptionalString(value);
|
|
59
|
+
if (!text) return;
|
|
60
|
+
args.push(flag, text);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function scheduleFlag(kind: AutonomyScheduleKind): string {
|
|
64
|
+
if (kind === 'cron') return '--cron';
|
|
65
|
+
if (kind === 'every') return '--every';
|
|
66
|
+
return '--at';
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function buildAutonomyScheduleArgs(rawArgs: AgentAutonomyScheduleToolArgs): readonly string[] {
|
|
70
|
+
const task = readOptionalString(rawArgs.task);
|
|
71
|
+
const successCriteria = readOptionalString(rawArgs.successCriteria);
|
|
72
|
+
const explicitUserRequest = readOptionalString(rawArgs.explicitUserRequest);
|
|
73
|
+
const scheduleValue = readOptionalString(rawArgs.scheduleValue);
|
|
74
|
+
if (!task) throw new Error('task is required.');
|
|
75
|
+
if (!successCriteria) throw new Error('successCriteria is required.');
|
|
76
|
+
if (!explicitUserRequest) throw new Error('explicitUserRequest is required.');
|
|
77
|
+
if (!isScheduleKind(rawArgs.scheduleKind)) throw new Error('scheduleKind must be one of: at, every, cron.');
|
|
78
|
+
if (!scheduleValue) throw new Error('scheduleValue is required.');
|
|
79
|
+
|
|
80
|
+
const args = [
|
|
81
|
+
scheduleFlag(rawArgs.scheduleKind),
|
|
82
|
+
scheduleValue,
|
|
83
|
+
'--task',
|
|
84
|
+
task,
|
|
85
|
+
'--success-criteria',
|
|
86
|
+
successCriteria,
|
|
87
|
+
'--explicit-user-request',
|
|
88
|
+
explicitUserRequest,
|
|
89
|
+
];
|
|
90
|
+
addOptionalArg(args, '--timezone', rawArgs.timezone);
|
|
91
|
+
addOptionalArg(args, '--name', rawArgs.name);
|
|
92
|
+
addOptionalArg(args, '--provider', rawArgs.provider);
|
|
93
|
+
addOptionalArg(args, '--model', rawArgs.model);
|
|
94
|
+
addOptionalArg(args, '--delivery-channel', rawArgs.deliveryChannel);
|
|
95
|
+
addOptionalArg(args, '--delivery-route', rawArgs.deliveryRoute);
|
|
96
|
+
addOptionalArg(args, '--delivery-webhook', rawArgs.deliveryWebhook);
|
|
97
|
+
addOptionalArg(args, '--delivery-link', rawArgs.deliveryLink);
|
|
98
|
+
if (readBoolean(rawArgs.disabled)) args.push('--disabled');
|
|
99
|
+
if (readBoolean(rawArgs.confirm)) args.push('--yes');
|
|
100
|
+
return args;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function outputForResult(result: AutonomyScheduleResult): { readonly success: boolean; readonly output?: string; readonly error?: string } {
|
|
104
|
+
if (result.ok) {
|
|
105
|
+
return {
|
|
106
|
+
success: true,
|
|
107
|
+
output: formatAutonomyScheduleSuccess(result),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
success: false,
|
|
112
|
+
error: formatAutonomyScheduleFailure(result),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function confirmationError(preview: ReturnType<typeof buildAutonomySchedulePreview>): string {
|
|
117
|
+
return [
|
|
118
|
+
formatAutonomySchedulePreview(preview),
|
|
119
|
+
'',
|
|
120
|
+
'Model tool confirmation required. Call this tool with confirm:true only when the user explicitly asked GoodVibes Agent to create this autonomous schedule.',
|
|
121
|
+
'Do not create autonomous schedules from vague suggestions, brainstorming, inferred follow-up work, or tasks without success criteria.',
|
|
122
|
+
].join('\n');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export function createAgentAutonomyScheduleTool(
|
|
126
|
+
shellPaths: ShellPathService,
|
|
127
|
+
configManager: AgentConnectedHostConfigReader,
|
|
128
|
+
): Tool {
|
|
129
|
+
return {
|
|
130
|
+
definition: {
|
|
131
|
+
name: 'agent_autonomy_schedule',
|
|
132
|
+
description: 'Schedule one confirmed visible autonomous Agent task.',
|
|
133
|
+
parameters: {
|
|
134
|
+
type: 'object',
|
|
135
|
+
properties: {
|
|
136
|
+
task: {
|
|
137
|
+
type: 'string',
|
|
138
|
+
description: 'Exact autonomous task the schedule should run.',
|
|
139
|
+
},
|
|
140
|
+
successCriteria: {
|
|
141
|
+
type: 'string',
|
|
142
|
+
description: 'What a successful scheduled run must report or produce.',
|
|
143
|
+
},
|
|
144
|
+
scheduleKind: {
|
|
145
|
+
type: 'string',
|
|
146
|
+
enum: [...SCHEDULE_KINDS],
|
|
147
|
+
description: 'Schedule kind: at, every, or cron.',
|
|
148
|
+
},
|
|
149
|
+
scheduleValue: {
|
|
150
|
+
type: 'string',
|
|
151
|
+
description: 'ISO timestamp, interval, or cron expression matching scheduleKind.',
|
|
152
|
+
},
|
|
153
|
+
timezone: {
|
|
154
|
+
type: 'string',
|
|
155
|
+
description: 'Optional IANA timezone for cron/at schedules.',
|
|
156
|
+
},
|
|
157
|
+
name: {
|
|
158
|
+
type: 'string',
|
|
159
|
+
description: 'Optional connected schedule display name.',
|
|
160
|
+
},
|
|
161
|
+
provider: {
|
|
162
|
+
type: 'string',
|
|
163
|
+
description: 'Optional provider row id for scheduled execution.',
|
|
164
|
+
},
|
|
165
|
+
model: {
|
|
166
|
+
type: 'string',
|
|
167
|
+
description: 'Optional model id for scheduled execution.',
|
|
168
|
+
},
|
|
169
|
+
deliveryChannel: {
|
|
170
|
+
type: 'string',
|
|
171
|
+
description: 'Optional delivery channel target.',
|
|
172
|
+
},
|
|
173
|
+
deliveryRoute: {
|
|
174
|
+
type: 'string',
|
|
175
|
+
description: 'Optional connected route target: routeId:label.',
|
|
176
|
+
},
|
|
177
|
+
deliveryWebhook: {
|
|
178
|
+
type: 'string',
|
|
179
|
+
description: 'Optional http(s) webhook target.',
|
|
180
|
+
},
|
|
181
|
+
deliveryLink: {
|
|
182
|
+
type: 'string',
|
|
183
|
+
description: 'Optional link delivery target.',
|
|
184
|
+
},
|
|
185
|
+
disabled: {
|
|
186
|
+
type: 'boolean',
|
|
187
|
+
description: 'Create the schedule disabled.',
|
|
188
|
+
},
|
|
189
|
+
confirm: {
|
|
190
|
+
type: 'boolean',
|
|
191
|
+
description: 'Required true only when user requested this schedule.',
|
|
192
|
+
},
|
|
193
|
+
explicitUserRequest: {
|
|
194
|
+
type: 'string',
|
|
195
|
+
description: 'User request authorizing this schedule.',
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
required: ['task', 'successCriteria', 'scheduleKind', 'scheduleValue', 'confirm', 'explicitUserRequest'],
|
|
199
|
+
additionalProperties: false,
|
|
200
|
+
},
|
|
201
|
+
sideEffects: ['network', 'state'],
|
|
202
|
+
},
|
|
203
|
+
execute: async (rawArgs: unknown) => {
|
|
204
|
+
try {
|
|
205
|
+
const args = rawArgs as AgentAutonomyScheduleToolArgs;
|
|
206
|
+
const parsed = parseAutonomyScheduleArgs(buildAutonomyScheduleArgs(args));
|
|
207
|
+
if (parsed.errors.length > 0) {
|
|
208
|
+
return {
|
|
209
|
+
success: false,
|
|
210
|
+
error: parsed.errors.join('\n'),
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
const preview = buildAutonomySchedulePreview(parsed);
|
|
214
|
+
if (!parsed.yes) {
|
|
215
|
+
return {
|
|
216
|
+
success: false,
|
|
217
|
+
error: confirmationError(preview),
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
const connection = resolveAutonomyConnectedHostConnection(configManager, shellPaths.homeDirectory);
|
|
221
|
+
return outputForResult(await createAutonomySchedule(connection, preview));
|
|
222
|
+
} catch (error) {
|
|
223
|
+
return {
|
|
224
|
+
success: false,
|
|
225
|
+
error: error instanceof Error ? error.message : String(error),
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export function registerAgentAutonomyScheduleTool(
|
|
233
|
+
registry: ToolRegistry,
|
|
234
|
+
shellPaths: ShellPathService,
|
|
235
|
+
configManager: AgentConnectedHostConfigReader,
|
|
236
|
+
): void {
|
|
237
|
+
registry.register(createAgentAutonomyScheduleTool(shellPaths, configManager));
|
|
238
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type { Tool } from '@pellux/goodvibes-sdk/platform/types';
|
|
2
|
+
import type { ToolRegistry } from '@pellux/goodvibes-sdk/platform/tools';
|
|
3
|
+
import type { CommandContext, CommandRegistry } from '../input/command-registry.ts';
|
|
4
|
+
import { createAgentHarnessTool } from './agent-harness-tool.ts';
|
|
5
|
+
|
|
6
|
+
type AgentAutonomyAction = 'intake' | 'queue' | 'item' | 'status';
|
|
7
|
+
|
|
8
|
+
interface AgentAutonomyToolArgs {
|
|
9
|
+
readonly action?: unknown;
|
|
10
|
+
readonly mode?: unknown;
|
|
11
|
+
readonly id?: unknown;
|
|
12
|
+
readonly queueItemId?: unknown;
|
|
13
|
+
readonly target?: unknown;
|
|
14
|
+
readonly query?: unknown;
|
|
15
|
+
readonly includeParameters?: unknown;
|
|
16
|
+
readonly limit?: unknown;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface AgentAutonomyToolDeps {
|
|
20
|
+
readonly commandRegistry: CommandRegistry;
|
|
21
|
+
readonly commandContext: CommandContext;
|
|
22
|
+
readonly toolRegistry: ToolRegistry;
|
|
23
|
+
readonly harnessTool?: Tool;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function error(message: string): { readonly success: false; readonly error: string } {
|
|
27
|
+
return { success: false, error: message };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function readString(value: unknown): string {
|
|
31
|
+
return typeof value === 'string' ? value.trim() : '';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function normalizeAutonomyAction(value: unknown): AgentAutonomyAction | null {
|
|
35
|
+
const action = readString(value).toLowerCase().replace(/-/g, '_');
|
|
36
|
+
if (!action) return null;
|
|
37
|
+
if (action === 'intake' || action === 'request' || action === 'route' || action === 'plan' || action === 'triage' || action === 'autonomy_intake') return 'intake';
|
|
38
|
+
if (action === 'queue' || action === 'list' || action === 'work' || action === 'ongoing' || action === 'autonomy_queue') return 'queue';
|
|
39
|
+
if (action === 'item' || action === 'card' || action === 'show' || action === 'inspect' || action === 'autonomy_queue_item') return 'item';
|
|
40
|
+
if (action === 'status' || action === 'summary' || action === 'overview') return 'status';
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function readAction(args: AgentAutonomyToolArgs): AgentAutonomyAction {
|
|
45
|
+
const explicit = normalizeAutonomyAction(args.action) ?? normalizeAutonomyAction(args.mode);
|
|
46
|
+
if (explicit) return explicit;
|
|
47
|
+
if (readString(args.queueItemId) || readString(args.id)) return 'item';
|
|
48
|
+
if (readString(args.query) || readString(args.target)) return 'intake';
|
|
49
|
+
return 'queue';
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function compactArgs(entries: Record<string, unknown>): Record<string, unknown> {
|
|
53
|
+
return Object.fromEntries(Object.entries(entries).filter(([, value]) => value !== undefined && value !== ''));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function queueItemId(args: AgentAutonomyToolArgs): string {
|
|
57
|
+
return readString(args.queueItemId) || readString(args.id);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function intakeArgs(args: AgentAutonomyToolArgs): Record<string, unknown> {
|
|
61
|
+
return compactArgs({
|
|
62
|
+
mode: 'autonomy_intake',
|
|
63
|
+
query: args.query,
|
|
64
|
+
target: args.target,
|
|
65
|
+
includeParameters: args.includeParameters,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function queueArgs(args: AgentAutonomyToolArgs): Record<string, unknown> {
|
|
70
|
+
return compactArgs({
|
|
71
|
+
mode: 'autonomy_queue',
|
|
72
|
+
query: args.query ?? args.target,
|
|
73
|
+
limit: args.limit,
|
|
74
|
+
includeParameters: args.includeParameters,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function itemArgs(args: AgentAutonomyToolArgs): Record<string, unknown> {
|
|
79
|
+
const itemId = queueItemId(args);
|
|
80
|
+
return compactArgs({
|
|
81
|
+
mode: 'autonomy_queue_item',
|
|
82
|
+
queueItemId: itemId,
|
|
83
|
+
target: itemId ? undefined : args.target,
|
|
84
|
+
query: itemId ? undefined : args.query,
|
|
85
|
+
includeParameters: args.includeParameters,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function createAgentAutonomyTool(deps: AgentAutonomyToolDeps): Tool {
|
|
90
|
+
const harnessTool = deps.harnessTool ?? createAgentHarnessTool({
|
|
91
|
+
commandRegistry: deps.commandRegistry,
|
|
92
|
+
commandContext: deps.commandContext,
|
|
93
|
+
toolRegistry: deps.toolRegistry,
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
definition: {
|
|
98
|
+
name: 'autonomy',
|
|
99
|
+
description: 'Route ongoing work and inspect visible autonomy.',
|
|
100
|
+
parameters: {
|
|
101
|
+
type: 'object',
|
|
102
|
+
properties: {
|
|
103
|
+
action: {
|
|
104
|
+
type: 'string',
|
|
105
|
+
enum: ['intake', 'queue', 'item', 'status'],
|
|
106
|
+
description: 'Read-only autonomy intake, queue, item, or status view.',
|
|
107
|
+
},
|
|
108
|
+
mode: { type: 'string', description: 'Alias for action.' },
|
|
109
|
+
id: { type: 'string', description: 'Alias for queueItemId.' },
|
|
110
|
+
queueItemId: { type: 'string', description: 'Autonomy queue card id.' },
|
|
111
|
+
target: { type: 'string', description: 'Lookup target or ongoing-work request.' },
|
|
112
|
+
query: { type: 'string', description: 'Ongoing-work request or queue search text.' },
|
|
113
|
+
includeParameters: { type: 'boolean', description: 'Include detailed routes, schemas, live records, and control evidence.' },
|
|
114
|
+
limit: { type: 'number', description: 'Maximum queue rows returned.' },
|
|
115
|
+
},
|
|
116
|
+
additionalProperties: false,
|
|
117
|
+
},
|
|
118
|
+
sideEffects: [],
|
|
119
|
+
concurrency: 'parallel',
|
|
120
|
+
},
|
|
121
|
+
execute: async (rawArgs: unknown) => {
|
|
122
|
+
const args = (rawArgs && typeof rawArgs === 'object' && !Array.isArray(rawArgs) ? rawArgs : {}) as AgentAutonomyToolArgs;
|
|
123
|
+
const action = readAction(args);
|
|
124
|
+
|
|
125
|
+
if (action === 'intake') return harnessTool.execute(intakeArgs(args));
|
|
126
|
+
if (action === 'queue' || action === 'status') return harnessTool.execute(queueArgs(args));
|
|
127
|
+
if (action === 'item') return harnessTool.execute(itemArgs(args));
|
|
128
|
+
|
|
129
|
+
return error('Unknown autonomy action. Use action:"intake" for ongoing work or action:"queue" for visible autonomous work.');
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function registerAgentAutonomyTool(
|
|
135
|
+
registry: ToolRegistry,
|
|
136
|
+
commandRegistry: CommandRegistry,
|
|
137
|
+
commandContext: CommandContext,
|
|
138
|
+
): void {
|
|
139
|
+
if (!registry.has('autonomy')) registry.register(createAgentAutonomyTool({ commandRegistry, commandContext, toolRegistry: registry }));
|
|
140
|
+
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { ChannelDeliveryRouter } from '@pellux/goodvibes-sdk/platform/channels';
|
|
2
2
|
import type { Tool } from '@pellux/goodvibes-sdk/platform/types';
|
|
3
3
|
import type { ToolRegistry } from '@pellux/goodvibes-sdk/platform/tools';
|
|
4
|
+
import type { ShellPathService } from '@/runtime/index.ts';
|
|
4
5
|
import {
|
|
5
6
|
buildAgentChannelDeliveryPreview,
|
|
6
7
|
deliverAgentChannelMessage,
|
|
7
8
|
formatAgentChannelDeliveryPreview,
|
|
8
9
|
formatAgentChannelDeliveryResult,
|
|
9
10
|
} from '../agent/channel-delivery.ts';
|
|
11
|
+
import { recordAgentChannelDeliveryReceipt } from '../agent/channel-delivery-receipts.ts';
|
|
10
12
|
|
|
11
13
|
export interface AgentChannelSendToolArgs {
|
|
12
14
|
readonly message?: unknown;
|
|
@@ -19,6 +21,10 @@ export interface AgentChannelSendToolArgs {
|
|
|
19
21
|
readonly explicitUserRequest?: unknown;
|
|
20
22
|
}
|
|
21
23
|
|
|
24
|
+
export interface AgentChannelSendToolOptions {
|
|
25
|
+
readonly shellPaths?: Pick<ShellPathService, 'resolveUserPath'>;
|
|
26
|
+
}
|
|
27
|
+
|
|
22
28
|
function readString(value: unknown): string | undefined {
|
|
23
29
|
return typeof value === 'string' && value.trim() ? value.trim() : undefined;
|
|
24
30
|
}
|
|
@@ -37,6 +43,7 @@ function output(text: string): { readonly success: true; readonly output: string
|
|
|
37
43
|
|
|
38
44
|
export function createAgentChannelSendTool(
|
|
39
45
|
channelDeliveryRouter: Pick<ChannelDeliveryRouter, 'deliver' | 'listStrategies'>,
|
|
46
|
+
options: AgentChannelSendToolOptions = {},
|
|
40
47
|
): Tool {
|
|
41
48
|
return {
|
|
42
49
|
definition: {
|
|
@@ -111,7 +118,21 @@ export function createAgentChannelSendTool(
|
|
|
111
118
|
].join('\n'));
|
|
112
119
|
}
|
|
113
120
|
try {
|
|
114
|
-
|
|
121
|
+
const result = await deliverAgentChannelMessage(channelDeliveryRouter, input);
|
|
122
|
+
const lines = [formatAgentChannelDeliveryResult(result)];
|
|
123
|
+
if (options.shellPaths) {
|
|
124
|
+
try {
|
|
125
|
+
const receipt = recordAgentChannelDeliveryReceipt(options.shellPaths, {
|
|
126
|
+
source: 'model-tool',
|
|
127
|
+
deliveryInput: input,
|
|
128
|
+
result,
|
|
129
|
+
});
|
|
130
|
+
lines.push(` receipt ${receipt.id}`);
|
|
131
|
+
} catch (receiptError) {
|
|
132
|
+
lines.push(` receipt unavailable ${receiptError instanceof Error ? receiptError.message : String(receiptError)}`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return output(lines.join('\n'));
|
|
115
136
|
} catch (error) {
|
|
116
137
|
return failure(error instanceof Error ? error.message : String(error));
|
|
117
138
|
}
|
|
@@ -122,6 +143,7 @@ export function createAgentChannelSendTool(
|
|
|
122
143
|
export function registerAgentChannelSendTool(
|
|
123
144
|
registry: ToolRegistry,
|
|
124
145
|
channelDeliveryRouter: Pick<ChannelDeliveryRouter, 'deliver' | 'listStrategies'>,
|
|
146
|
+
options: AgentChannelSendToolOptions = {},
|
|
125
147
|
): void {
|
|
126
|
-
registry.register(createAgentChannelSendTool(channelDeliveryRouter));
|
|
148
|
+
registry.register(createAgentChannelSendTool(channelDeliveryRouter, options));
|
|
127
149
|
}
|