@pellux/goodvibes-agent 1.1.7 → 1.3.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 +329 -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 +138903 -91477
- 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 +58 -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 +116 -45
- package/docs/voice-and-live-tts.md +3 -1
- package/package.json +3 -2
- package/release/release-notes.md +142 -5
- package/release/release-readiness.json +124 -94
- 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 +294 -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-artifact-receipts.ts +366 -0
- package/src/agent/setup-wizard-checkpoint.ts +140 -0
- package/src/agent/setup-wizard.ts +683 -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 +313 -30
- package/src/input/agent-workspace-setup-checkpoint-action.ts +127 -0
- package/src/input/agent-workspace-setup-snapshot.ts +217 -0
- package/src/input/agent-workspace-setup.ts +61 -1
- package/src/input/agent-workspace-snapshot.ts +184 -149
- package/src/input/agent-workspace-types.ts +287 -2
- package/src/input/agent-workspace.ts +23 -1
- 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/input/setup-wizard-live-receipts.ts +76 -0
- package/src/main.ts +15 -15
- package/src/panels/qr-panel.ts +2 -2
- package/src/renderer/agent-workspace-context-lines.ts +701 -0
- package/src/renderer/agent-workspace.ts +68 -421
- 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-policy.ts +75 -0
- package/src/tools/agent-harness-agent-orchestration.ts +791 -0
- package/src/tools/agent-harness-autonomy-intake.ts +785 -0
- package/src/tools/agent-harness-autonomy-live-records.ts +742 -0
- package/src/tools/agent-harness-autonomy-queue-types.ts +88 -0
- package/src/tools/agent-harness-autonomy-queue.ts +571 -0
- package/src/tools/agent-harness-autonomy-watcher-read-models.ts +509 -0
- package/src/tools/agent-harness-background-processes-types.ts +35 -0
- package/src/tools/agent-harness-background-processes.ts +798 -0
- package/src/tools/agent-harness-browser-cockpit-route.ts +373 -0
- package/src/tools/agent-harness-browser-control.ts +346 -0
- package/src/tools/agent-harness-browser-pwa-read-models.ts +622 -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-device-live-read-models.ts +366 -0
- 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 +385 -0
- package/src/tools/agent-harness-file-recovery.ts +135 -0
- package/src/tools/agent-harness-interactive-runtime-records.ts +421 -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 +269 -0
- package/src/tools/agent-harness-local-model-cookbook.ts +238 -0
- package/src/tools/agent-harness-local-model-endpoints.ts +788 -0
- package/src/tools/agent-harness-local-model-smoke.ts +277 -0
- package/src/tools/agent-harness-local-model-url.ts +78 -0
- package/src/tools/agent-harness-media-posture.ts +223 -2
- package/src/tools/agent-harness-memory-external-providers.ts +796 -0
- package/src/tools/agent-harness-memory-posture.ts +672 -0
- package/src/tools/agent-harness-memory-provider-certification.ts +219 -0
- package/src/tools/agent-harness-memory-refinement.ts +340 -0
- package/src/tools/agent-harness-metadata.ts +100 -168
- package/src/tools/agent-harness-mode-catalog.ts +86 -33
- package/src/tools/agent-harness-model-catalog.ts +162 -0
- package/src/tools/agent-harness-model-provider-health.ts +283 -0
- package/src/tools/agent-harness-model-readiness.ts +432 -0
- package/src/tools/agent-harness-model-routing-types.ts +327 -0
- package/src/tools/agent-harness-model-routing-utils.ts +30 -0
- package/src/tools/agent-harness-model-routing.ts +165 -193
- package/src/tools/agent-harness-operator-methods.ts +115 -133
- package/src/tools/agent-harness-pairing-posture.ts +452 -18
- package/src/tools/agent-harness-personal-ops-certification.ts +116 -0
- 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 +270 -0
- package/src/tools/agent-harness-personal-ops-operations.ts +225 -0
- package/src/tools/agent-harness-personal-ops-provider-records.ts +358 -0
- package/src/tools/agent-harness-personal-ops-provider-task-records.ts +321 -0
- package/src/tools/agent-harness-personal-ops-records.ts +684 -0
- package/src/tools/agent-harness-personal-ops-runner.ts +637 -0
- package/src/tools/agent-harness-personal-ops-types.ts +240 -0
- package/src/tools/agent-harness-personal-ops.ts +613 -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-remote-read-models.ts +541 -0
- package/src/tools/agent-harness-research-briefing.ts +446 -0
- package/src/tools/agent-harness-research-live-read-models.ts +500 -0
- package/src/tools/agent-harness-research-queue.ts +250 -0
- package/src/tools/agent-harness-research-runs.ts +307 -0
- package/src/tools/agent-harness-research-workflow.ts +395 -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 +102 -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 +533 -0
- package/src/tools/agent-harness-sudo-posture.ts +114 -0
- package/src/tools/agent-harness-tool-schema.ts +142 -7
- package/src/tools/agent-harness-tool-types.ts +83 -0
- package/src/tools/agent-harness-tool-utils.ts +43 -0
- package/src/tools/agent-harness-tool.ts +319 -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 +253 -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 +735 -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-runner.ts +367 -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 +515 -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,305 @@
|
|
|
1
|
+
import type { ArtifactDescriptor, ArtifactRecord, ArtifactStore } from '@pellux/goodvibes-sdk/platform/artifacts';
|
|
2
|
+
import type { ChannelDeliveryRouter } from '@pellux/goodvibes-sdk/platform/channels';
|
|
3
|
+
import type { Tool } from '@pellux/goodvibes-sdk/platform/types';
|
|
4
|
+
import type { ToolRegistry } from '@pellux/goodvibes-sdk/platform/tools';
|
|
5
|
+
import {
|
|
6
|
+
buildAgentChannelDeliveryPreview,
|
|
7
|
+
deliverAgentChannelMessage,
|
|
8
|
+
formatAgentChannelDeliveryPreview,
|
|
9
|
+
formatAgentChannelDeliveryResult,
|
|
10
|
+
} from '../agent/channel-delivery.ts';
|
|
11
|
+
|
|
12
|
+
export interface AgentReviewPacketShareToolArgs {
|
|
13
|
+
readonly archiveArtifactId?: unknown;
|
|
14
|
+
readonly message?: unknown;
|
|
15
|
+
readonly title?: unknown;
|
|
16
|
+
readonly channel?: unknown;
|
|
17
|
+
readonly route?: unknown;
|
|
18
|
+
readonly webhook?: unknown;
|
|
19
|
+
readonly link?: unknown;
|
|
20
|
+
readonly confirm?: unknown;
|
|
21
|
+
readonly explicitUserRequest?: unknown;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type AgentReviewPacketShareArtifactStore = Pick<ArtifactStore, 'get' | 'list' | 'readContent'>;
|
|
25
|
+
type AgentReviewPacketShareChannelRouter = Pick<ChannelDeliveryRouter, 'deliver' | 'listStrategies'>;
|
|
26
|
+
type AgentReviewPacketShareArtifact = ArtifactDescriptor | ArtifactRecord;
|
|
27
|
+
|
|
28
|
+
interface ReviewPacketArchiveSummary {
|
|
29
|
+
readonly artifactId: string;
|
|
30
|
+
readonly filename: string;
|
|
31
|
+
readonly mimeType: string;
|
|
32
|
+
readonly sizeBytes: number;
|
|
33
|
+
readonly comparisonId: string;
|
|
34
|
+
readonly handoffArtifactId: string;
|
|
35
|
+
readonly handoffId: string;
|
|
36
|
+
readonly sourceArtifactId: string;
|
|
37
|
+
readonly sourceKind: string;
|
|
38
|
+
readonly relatedArtifactIds: readonly string[];
|
|
39
|
+
readonly routeDecisionArtifactIds: readonly string[];
|
|
40
|
+
readonly includedArtifactIds: readonly string[];
|
|
41
|
+
readonly artifactCount: number;
|
|
42
|
+
readonly archiveBytes: number;
|
|
43
|
+
readonly revealIncludedInHandoff: boolean;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function readString(value: unknown): string | undefined {
|
|
47
|
+
return typeof value === 'string' && value.trim() ? value.trim() : undefined;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function readBoolean(value: unknown): boolean {
|
|
51
|
+
return value === true || value === 'true' || value === 'yes';
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function readNumber(value: unknown): number | undefined {
|
|
55
|
+
if (typeof value === 'number' && Number.isFinite(value)) return value;
|
|
56
|
+
if (typeof value === 'string' && value.trim()) {
|
|
57
|
+
const parsed = Number(value);
|
|
58
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
59
|
+
}
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function readStringArray(value: unknown): readonly string[] {
|
|
64
|
+
if (Array.isArray(value)) {
|
|
65
|
+
return value.map((entry) => readString(entry)).filter((entry): entry is string => Boolean(entry));
|
|
66
|
+
}
|
|
67
|
+
const scalar = readString(value);
|
|
68
|
+
if (!scalar) return [];
|
|
69
|
+
return scalar.split(/[,\n]/).map((entry) => entry.trim()).filter(Boolean);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function failure(error: string): { readonly success: false; readonly error: string } {
|
|
73
|
+
return { success: false, error };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function output(text: string): { readonly success: true; readonly output: string } {
|
|
77
|
+
return { success: true, output: text };
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async function loadArchiveArtifact(
|
|
81
|
+
artifactStore: AgentReviewPacketShareArtifactStore | undefined,
|
|
82
|
+
artifactId: string,
|
|
83
|
+
): Promise<AgentReviewPacketShareArtifact> {
|
|
84
|
+
if (!artifactStore?.get && !artifactStore?.list && !artifactStore?.readContent) {
|
|
85
|
+
throw new Error('Review packet share is unavailable because this runtime cannot inspect artifacts.');
|
|
86
|
+
}
|
|
87
|
+
const direct = artifactStore.get?.(artifactId);
|
|
88
|
+
if (direct) return direct;
|
|
89
|
+
const listed = artifactStore.list?.(200).find((artifact) => artifact.id === artifactId);
|
|
90
|
+
if (listed) return listed;
|
|
91
|
+
if (artifactStore.readContent) return (await artifactStore.readContent(artifactId)).record;
|
|
92
|
+
throw new Error(`Unknown review packet archive artifact: ${artifactId}`);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function summarizeArchiveArtifact(artifact: AgentReviewPacketShareArtifact): ReviewPacketArchiveSummary {
|
|
96
|
+
const metadata = artifact.metadata ?? {};
|
|
97
|
+
const purpose = readString(metadata.purpose);
|
|
98
|
+
if (purpose !== 'agent-model-compare-handoff-archive') {
|
|
99
|
+
throw new Error('Review packet share requires a saved reviewer handoff archive artifact.');
|
|
100
|
+
}
|
|
101
|
+
const comparisonId = readString(metadata.comparisonId);
|
|
102
|
+
const handoffArtifactId = readString(metadata.handoffArtifactId);
|
|
103
|
+
const sourceArtifactId = readString(metadata.sourceArtifactId);
|
|
104
|
+
if (!comparisonId || !handoffArtifactId || !sourceArtifactId) {
|
|
105
|
+
throw new Error('Review packet archive metadata is missing comparison, handoff, or source ids.');
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
artifactId: artifact.id,
|
|
109
|
+
filename: artifact.filename ?? `${artifact.id}.zip`,
|
|
110
|
+
mimeType: artifact.mimeType,
|
|
111
|
+
sizeBytes: artifact.sizeBytes,
|
|
112
|
+
comparisonId,
|
|
113
|
+
handoffArtifactId,
|
|
114
|
+
handoffId: readString(metadata.handoffId) ?? '(unknown)',
|
|
115
|
+
sourceArtifactId,
|
|
116
|
+
sourceKind: readString(metadata.sourceKind) ?? 'unknown',
|
|
117
|
+
relatedArtifactIds: readStringArray(metadata.relatedArtifactIds),
|
|
118
|
+
routeDecisionArtifactIds: readStringArray(metadata.routeDecisionArtifactIds),
|
|
119
|
+
includedArtifactIds: readStringArray(metadata.includedArtifactIds),
|
|
120
|
+
artifactCount: readNumber(metadata.artifactCount) ?? readStringArray(metadata.includedArtifactIds).length,
|
|
121
|
+
archiveBytes: readNumber(metadata.archiveBytes) ?? artifact.sizeBytes,
|
|
122
|
+
revealIncludedInHandoff: metadata.revealIncludedInHandoff === true,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function formatIdList(ids: readonly string[], max = 6): string {
|
|
127
|
+
if (ids.length === 0) return '(none)';
|
|
128
|
+
const visible = ids.slice(0, max).join(', ');
|
|
129
|
+
return ids.length > max ? `${visible}, +${ids.length - max} more` : visible;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function archiveExportRoute(summary: ReviewPacketArchiveSummary): string {
|
|
133
|
+
return `agent_artifacts mode:"export" artifactId:"${summary.artifactId}" destinationPath:"exports/${summary.filename}" confirm:true explicitUserRequest:"..."`;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function buildPacketEvidenceLines(summary: ReviewPacketArchiveSummary): readonly string[] {
|
|
137
|
+
return [
|
|
138
|
+
`Archive: ${summary.artifactId} (${summary.filename}, ${summary.archiveBytes} bytes)`,
|
|
139
|
+
`Comparison: ${summary.comparisonId}`,
|
|
140
|
+
`Handoff: ${summary.handoffArtifactId} (${summary.handoffId})`,
|
|
141
|
+
`Source: ${summary.sourceArtifactId} (${summary.sourceKind})`,
|
|
142
|
+
`Included artifacts: ${summary.artifactCount} (${formatIdList(summary.includedArtifactIds)})`,
|
|
143
|
+
`Related artifacts: ${formatIdList(summary.relatedArtifactIds)}`,
|
|
144
|
+
`Route-decision receipts: ${formatIdList(summary.routeDecisionArtifactIds)}`,
|
|
145
|
+
`Reveal: ${summary.revealIncludedInHandoff ? 'included in handoff when available' : 'not included in handoff'}`,
|
|
146
|
+
`Export route: ${archiveExportRoute(summary)}`,
|
|
147
|
+
];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function buildShareMessage(summary: ReviewPacketArchiveSummary, customMessage: string | undefined): string {
|
|
151
|
+
return [
|
|
152
|
+
customMessage ?? 'GoodVibes Agent reviewer packet is ready.',
|
|
153
|
+
'',
|
|
154
|
+
'Reviewer packet evidence:',
|
|
155
|
+
...buildPacketEvidenceLines(summary),
|
|
156
|
+
].join('\n');
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function formatSharePreview(input: {
|
|
160
|
+
readonly summary: ReviewPacketArchiveSummary;
|
|
161
|
+
readonly message: string;
|
|
162
|
+
readonly title: string;
|
|
163
|
+
readonly args: AgentReviewPacketShareToolArgs;
|
|
164
|
+
readonly router: AgentReviewPacketShareChannelRouter;
|
|
165
|
+
}): string {
|
|
166
|
+
const preview = buildAgentChannelDeliveryPreview({
|
|
167
|
+
message: input.message,
|
|
168
|
+
title: input.title,
|
|
169
|
+
...(readString(input.args.channel) ? { channel: readString(input.args.channel) } : {}),
|
|
170
|
+
...(readString(input.args.route) ? { route: readString(input.args.route) } : {}),
|
|
171
|
+
...(readString(input.args.webhook) ? { webhook: readString(input.args.webhook) } : {}),
|
|
172
|
+
...(readString(input.args.link) ? { link: readString(input.args.link) } : {}),
|
|
173
|
+
});
|
|
174
|
+
return [
|
|
175
|
+
'Agent review packet share preview',
|
|
176
|
+
` archive ${input.summary.artifactId} ${input.summary.filename}`,
|
|
177
|
+
` comparison ${input.summary.comparisonId}`,
|
|
178
|
+
` included artifacts ${input.summary.artifactCount}`,
|
|
179
|
+
` related artifacts ${formatIdList(input.summary.relatedArtifactIds)}`,
|
|
180
|
+
` route-decision receipts ${formatIdList(input.summary.routeDecisionArtifactIds)}`,
|
|
181
|
+
` export route ${archiveExportRoute(input.summary)}`,
|
|
182
|
+
'',
|
|
183
|
+
formatAgentChannelDeliveryPreview(preview, input.router.listStrategies().length),
|
|
184
|
+
'',
|
|
185
|
+
'policy sends a plain-text archive reference only; ZIP bytes stay in the Agent artifact store until an explicit export route is run',
|
|
186
|
+
].join('\n');
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function formatShareResult(input: {
|
|
190
|
+
readonly summary: ReviewPacketArchiveSummary;
|
|
191
|
+
readonly delivery: Awaited<ReturnType<typeof deliverAgentChannelMessage>>;
|
|
192
|
+
}): string {
|
|
193
|
+
return [
|
|
194
|
+
'Agent review packet shared',
|
|
195
|
+
`archive ${input.summary.artifactId} ${input.summary.filename}`,
|
|
196
|
+
`comparison ${input.summary.comparisonId}`,
|
|
197
|
+
`included artifacts ${input.summary.artifactCount}`,
|
|
198
|
+
`export ${archiveExportRoute(input.summary)}`,
|
|
199
|
+
'',
|
|
200
|
+
formatAgentChannelDeliveryResult(input.delivery),
|
|
201
|
+
'policy delivered only a plain-text archive reference; original artifact bytes remain local',
|
|
202
|
+
].join('\n');
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export function createAgentReviewPacketShareTool(
|
|
206
|
+
artifactStore: AgentReviewPacketShareArtifactStore | undefined,
|
|
207
|
+
channelDeliveryRouter: AgentReviewPacketShareChannelRouter,
|
|
208
|
+
): Tool {
|
|
209
|
+
return {
|
|
210
|
+
definition: {
|
|
211
|
+
name: 'agent_review_packet_share',
|
|
212
|
+
description: 'Share one confirmed reviewer archive reference.',
|
|
213
|
+
parameters: {
|
|
214
|
+
type: 'object',
|
|
215
|
+
properties: {
|
|
216
|
+
archiveArtifactId: {
|
|
217
|
+
type: 'string',
|
|
218
|
+
description: 'Saved handoff archive artifact id.',
|
|
219
|
+
},
|
|
220
|
+
message: {
|
|
221
|
+
type: 'string',
|
|
222
|
+
description: 'Optional note prepended to packet evidence.',
|
|
223
|
+
},
|
|
224
|
+
title: {
|
|
225
|
+
type: 'string',
|
|
226
|
+
description: 'Optional delivery title.',
|
|
227
|
+
},
|
|
228
|
+
channel: {
|
|
229
|
+
type: 'string',
|
|
230
|
+
description: 'Optional channel target. Use exactly one target field.',
|
|
231
|
+
},
|
|
232
|
+
route: {
|
|
233
|
+
type: 'string',
|
|
234
|
+
description: 'Optional route id or route:label. Use one target.',
|
|
235
|
+
},
|
|
236
|
+
webhook: {
|
|
237
|
+
type: 'string',
|
|
238
|
+
description: 'Optional http(s) webhook URL. Use one target.',
|
|
239
|
+
},
|
|
240
|
+
link: {
|
|
241
|
+
type: 'string',
|
|
242
|
+
description: 'Optional link delivery target. Use one target.',
|
|
243
|
+
},
|
|
244
|
+
confirm: {
|
|
245
|
+
type: 'boolean',
|
|
246
|
+
description: 'Required true for confirmed delivery.',
|
|
247
|
+
},
|
|
248
|
+
explicitUserRequest: {
|
|
249
|
+
type: 'string',
|
|
250
|
+
description: 'User request authorizing this delivery.',
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
required: ['archiveArtifactId', 'confirm', 'explicitUserRequest'],
|
|
254
|
+
additionalProperties: false,
|
|
255
|
+
},
|
|
256
|
+
sideEffects: ['network'],
|
|
257
|
+
},
|
|
258
|
+
execute: async (rawArgs: Record<string, unknown>) => {
|
|
259
|
+
const args = rawArgs as AgentReviewPacketShareToolArgs;
|
|
260
|
+
const explicitUserRequest = readString(args.explicitUserRequest);
|
|
261
|
+
if (!explicitUserRequest) {
|
|
262
|
+
return failure('explicitUserRequest is required so review packet delivery stays tied to a direct user request.');
|
|
263
|
+
}
|
|
264
|
+
const artifactId = readString(args.archiveArtifactId);
|
|
265
|
+
if (!artifactId) return failure('archiveArtifactId is required.');
|
|
266
|
+
let summary: ReviewPacketArchiveSummary;
|
|
267
|
+
try {
|
|
268
|
+
summary = summarizeArchiveArtifact(await loadArchiveArtifact(artifactStore, artifactId));
|
|
269
|
+
} catch (error) {
|
|
270
|
+
return failure(error instanceof Error ? error.message : String(error));
|
|
271
|
+
}
|
|
272
|
+
const title = readString(args.title) ?? 'GoodVibes Agent review packet';
|
|
273
|
+
const message = buildShareMessage(summary, readString(args.message));
|
|
274
|
+
try {
|
|
275
|
+
const preview = formatSharePreview({ summary, message, title, args, router: channelDeliveryRouter });
|
|
276
|
+
if (!readBoolean(args.confirm)) {
|
|
277
|
+
return failure([
|
|
278
|
+
preview,
|
|
279
|
+
'',
|
|
280
|
+
'Model tool confirmation required. Call this tool with confirm:true only when the user explicitly asked GoodVibes Agent to share this reviewer packet.',
|
|
281
|
+
].join('\n'));
|
|
282
|
+
}
|
|
283
|
+
const delivery = await deliverAgentChannelMessage(channelDeliveryRouter, {
|
|
284
|
+
message,
|
|
285
|
+
title,
|
|
286
|
+
...(readString(args.channel) ? { channel: readString(args.channel) } : {}),
|
|
287
|
+
...(readString(args.route) ? { route: readString(args.route) } : {}),
|
|
288
|
+
...(readString(args.webhook) ? { webhook: readString(args.webhook) } : {}),
|
|
289
|
+
...(readString(args.link) ? { link: readString(args.link) } : {}),
|
|
290
|
+
});
|
|
291
|
+
return output(formatShareResult({ summary, delivery }));
|
|
292
|
+
} catch (error) {
|
|
293
|
+
return failure(error instanceof Error ? error.message : String(error));
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export function registerAgentReviewPacketShareTool(
|
|
300
|
+
registry: ToolRegistry,
|
|
301
|
+
artifactStore: AgentReviewPacketShareArtifactStore | undefined,
|
|
302
|
+
channelDeliveryRouter: AgentReviewPacketShareChannelRouter,
|
|
303
|
+
): void {
|
|
304
|
+
registry.register(createAgentReviewPacketShareTool(artifactStore, channelDeliveryRouter));
|
|
305
|
+
}
|