@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,167 @@
|
|
|
1
|
+
import type { MemoryRecord } from '@pellux/goodvibes-sdk/platform/state';
|
|
2
|
+
import type { AgentNoteRecord } from '../agent/note-registry.ts';
|
|
3
|
+
import type { AgentPersonaRecord } from '../agent/persona-registry.ts';
|
|
4
|
+
import { formatAgentRecordOrigin } from '../agent/record-labels.ts';
|
|
5
|
+
import { evaluateAgentRoutineReadiness, type AgentRoutineRecord } from '../agent/routine-registry.ts';
|
|
6
|
+
import { AgentResearchRunRegistry, researchRunLogTail } from '../agent/research-run-registry.ts';
|
|
7
|
+
import { RoutineScheduleReceiptStore } from '../agent/routine-schedule-receipts.ts';
|
|
8
|
+
import { evaluateAgentSkillBundleReadiness, evaluateAgentSkillReadiness, formatAgentSkillRequirement, type AgentSkillBundleRecord, type AgentSkillRecord } from '../agent/skill-registry.ts';
|
|
9
|
+
import type { listAgentRuntimeProfiles, listAgentRuntimeProfileTemplates } from '../agent/runtime-profile.ts';
|
|
10
|
+
import type { AgentWorkspaceLocalLibraryItem, AgentWorkspaceResearchRunSummary, AgentWorkspaceRoutineScheduleReceiptSummary, AgentWorkspaceRuntimeProfileItem, AgentWorkspaceRuntimeStarterTemplateItem } from './agent-workspace-types.ts';
|
|
11
|
+
|
|
12
|
+
export function summarizePersonaItem(persona: AgentPersonaRecord, activePersonaId: string | null): AgentWorkspaceLocalLibraryItem {
|
|
13
|
+
return {
|
|
14
|
+
id: persona.id,
|
|
15
|
+
name: persona.name,
|
|
16
|
+
description: persona.description,
|
|
17
|
+
reviewState: persona.reviewState,
|
|
18
|
+
source: formatAgentRecordOrigin(persona.source, persona.provenance),
|
|
19
|
+
tags: persona.tags,
|
|
20
|
+
triggers: persona.triggers,
|
|
21
|
+
active: persona.id === activePersonaId,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function summarizeSkillItem(skill: AgentSkillRecord): AgentWorkspaceLocalLibraryItem {
|
|
26
|
+
const readiness = evaluateAgentSkillReadiness(skill);
|
|
27
|
+
return {
|
|
28
|
+
id: skill.id,
|
|
29
|
+
name: skill.name,
|
|
30
|
+
description: skill.description,
|
|
31
|
+
reviewState: skill.reviewState,
|
|
32
|
+
source: formatAgentRecordOrigin(skill.source, skill.provenance),
|
|
33
|
+
tags: skill.tags,
|
|
34
|
+
triggers: skill.triggers,
|
|
35
|
+
enabled: skill.enabled,
|
|
36
|
+
requirementCount: skill.requirements.length,
|
|
37
|
+
missingRequirementCount: readiness.missing.length,
|
|
38
|
+
missingRequirements: readiness.missing.map(formatAgentSkillRequirement),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function summarizeSkillBundleItem(bundle: AgentSkillBundleRecord, skills: readonly AgentSkillRecord[]): AgentWorkspaceLocalLibraryItem {
|
|
43
|
+
const readiness = evaluateAgentSkillBundleReadiness(bundle, skills);
|
|
44
|
+
const missing = [
|
|
45
|
+
...readiness.missingRequirements.map(formatAgentSkillRequirement),
|
|
46
|
+
...readiness.missingSkillIds.map((skillId) => `skill:${skillId}`),
|
|
47
|
+
];
|
|
48
|
+
return {
|
|
49
|
+
id: bundle.id,
|
|
50
|
+
name: bundle.name,
|
|
51
|
+
description: `${bundle.description} Skills: ${bundle.skillIds.join(', ')}`,
|
|
52
|
+
reviewState: bundle.reviewState,
|
|
53
|
+
source: formatAgentRecordOrigin(bundle.source, bundle.provenance),
|
|
54
|
+
tags: bundle.skillIds,
|
|
55
|
+
triggers: [],
|
|
56
|
+
enabled: bundle.enabled,
|
|
57
|
+
requirementCount: readiness.includedSkills.reduce((total, skill) => total + skill.requirements.length, 0) + readiness.missingSkillIds.length,
|
|
58
|
+
missingRequirementCount: missing.length,
|
|
59
|
+
missingRequirements: missing,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function summarizeRoutineItem(routine: AgentRoutineRecord): AgentWorkspaceLocalLibraryItem {
|
|
64
|
+
const readiness = evaluateAgentRoutineReadiness(routine);
|
|
65
|
+
return {
|
|
66
|
+
id: routine.id,
|
|
67
|
+
name: routine.name,
|
|
68
|
+
description: routine.description,
|
|
69
|
+
reviewState: routine.reviewState,
|
|
70
|
+
source: formatAgentRecordOrigin(routine.source, routine.provenance),
|
|
71
|
+
tags: routine.tags,
|
|
72
|
+
triggers: routine.triggers,
|
|
73
|
+
enabled: routine.enabled,
|
|
74
|
+
requirementCount: routine.requirements.length,
|
|
75
|
+
missingRequirementCount: readiness.missing.length,
|
|
76
|
+
missingRequirements: readiness.missing.map(formatAgentSkillRequirement),
|
|
77
|
+
startCount: routine.startCount,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function summarizeRoutineScheduleReceipt(
|
|
82
|
+
receipt: ReturnType<RoutineScheduleReceiptStore['snapshot']>['receipts'][number],
|
|
83
|
+
): AgentWorkspaceRoutineScheduleReceiptSummary {
|
|
84
|
+
return {
|
|
85
|
+
id: receipt.id,
|
|
86
|
+
status: receipt.status,
|
|
87
|
+
routineId: receipt.routineId,
|
|
88
|
+
routineName: receipt.routineName,
|
|
89
|
+
scheduleName: receipt.scheduleName,
|
|
90
|
+
scheduleKind: receipt.scheduleKind,
|
|
91
|
+
scheduleValue: receipt.scheduleValue,
|
|
92
|
+
createdAt: receipt.createdAt,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function summarizeResearchRunItem(
|
|
97
|
+
run: ReturnType<AgentResearchRunRegistry['snapshot']>['runs'][number],
|
|
98
|
+
): AgentWorkspaceResearchRunSummary {
|
|
99
|
+
return {
|
|
100
|
+
id: run.id,
|
|
101
|
+
title: run.title,
|
|
102
|
+
status: run.status,
|
|
103
|
+
phase: run.phase,
|
|
104
|
+
progress: run.progress,
|
|
105
|
+
sourceIds: run.sourceIds,
|
|
106
|
+
nextSteps: run.nextSteps,
|
|
107
|
+
checkpointCount: run.checkpoints.length,
|
|
108
|
+
logTail: researchRunLogTail(run, 4),
|
|
109
|
+
updatedAt: run.updatedAt,
|
|
110
|
+
...(run.note ? { note: run.note } : {}),
|
|
111
|
+
...(run.reportArtifactId ? { reportArtifactId: run.reportArtifactId } : {}),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export function summarizeMemoryItem(record: MemoryRecord): AgentWorkspaceLocalLibraryItem {
|
|
116
|
+
const detail = record.detail?.trim();
|
|
117
|
+
return {
|
|
118
|
+
id: record.id,
|
|
119
|
+
name: record.summary,
|
|
120
|
+
description: detail && detail.length > 0 ? detail : `${record.scope}/${record.cls}`,
|
|
121
|
+
reviewState: record.reviewState,
|
|
122
|
+
source: 'Agent memory',
|
|
123
|
+
tags: record.tags,
|
|
124
|
+
triggers: [],
|
|
125
|
+
scope: record.scope,
|
|
126
|
+
cls: record.cls,
|
|
127
|
+
confidence: record.confidence,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function summarizeNoteItem(note: AgentNoteRecord): AgentWorkspaceLocalLibraryItem {
|
|
132
|
+
const preview = note.body.replace(/\s+/g, ' ').trim();
|
|
133
|
+
const description = note.sourceUrl
|
|
134
|
+
? `${preview.slice(0, 160)}${preview.length > 160 ? '...' : ''} Origin URL ${note.sourceUrl}`
|
|
135
|
+
: preview;
|
|
136
|
+
return {
|
|
137
|
+
id: note.id,
|
|
138
|
+
name: note.title,
|
|
139
|
+
description,
|
|
140
|
+
reviewState: note.reviewState,
|
|
141
|
+
source: formatAgentRecordOrigin(note.source, note.provenance),
|
|
142
|
+
tags: note.tags,
|
|
143
|
+
triggers: [],
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export function summarizeRuntimeProfile(profile: ReturnType<typeof listAgentRuntimeProfiles>[number]): AgentWorkspaceRuntimeProfileItem {
|
|
148
|
+
return {
|
|
149
|
+
id: profile.id,
|
|
150
|
+
homeDirectory: profile.homeDirectory,
|
|
151
|
+
createdAt: profile.createdAt,
|
|
152
|
+
starterTemplateId: profile.starterTemplateId,
|
|
153
|
+
starterTemplateName: profile.starterTemplateName,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export function summarizeStarterTemplate(template: ReturnType<typeof listAgentRuntimeProfileTemplates>[number]): AgentWorkspaceRuntimeStarterTemplateItem {
|
|
158
|
+
return {
|
|
159
|
+
id: template.id,
|
|
160
|
+
name: template.name,
|
|
161
|
+
description: template.description,
|
|
162
|
+
personaName: template.personaName,
|
|
163
|
+
skillNames: template.skillNames,
|
|
164
|
+
routineNames: template.routineNames,
|
|
165
|
+
source: template.source,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import type { AgentWorkspaceLocalEditor, AgentWorkspaceRecentReviewerHandoffArtifact, AgentWorkspaceReviewPacketDefaults } from './agent-workspace-types.ts';
|
|
2
|
+
import type { AgentModelCompareAnalyticsWorkspaceToolArgs, AgentModelCompareApplyWorkspaceToolArgs, AgentModelCompareExportWorkspaceToolArgs, AgentModelCompareHandoffDiffWorkspaceToolArgs, AgentModelCompareJudgmentWorkspaceToolArgs, AgentModelCompareReviewWorkspaceToolArgs, AgentModelCompareRouteDecisionWorkspaceToolArgs, AgentModelCompareWorkspaceToolArgs, AgentWorkspaceFieldReader } from './agent-workspace-model-compare-types.ts';
|
|
3
|
+
import { compareExportMode, compareReviewMode, isAffirmative, readList, readPositiveInteger } from './agent-workspace-model-compare-utils.ts';
|
|
4
|
+
|
|
5
|
+
export type { AgentModelCompareAnalyticsWorkspaceToolArgs, AgentModelCompareApplyWorkspaceToolArgs, AgentModelCompareExportWorkspaceToolArgs, AgentModelCompareHandoffDiffWorkspaceToolArgs, AgentModelCompareJudgmentWorkspaceToolArgs, AgentModelCompareReviewWorkspaceToolArgs, AgentModelCompareRouteDecisionWorkspaceToolArgs, AgentModelCompareWorkspaceToolArgs, AgentWorkspaceFieldReader } from './agent-workspace-model-compare-types.ts';
|
|
6
|
+
export { buildAgentModelCompareAnalyticsPromptSubmission, buildAgentModelCompareApplyPromptSubmission, buildAgentModelCompareExportPromptSubmission, buildAgentModelCompareHandoffDiffPromptSubmission, buildAgentModelCompareJudgmentPromptSubmission, buildAgentModelComparePromptSubmission, buildAgentModelCompareReviewPromptSubmission, buildAgentModelCompareRouteDecisionPromptSubmission } from './agent-workspace-model-compare-prompt-submission.ts';
|
|
7
|
+
|
|
8
|
+
export function createAgentModelCompareEditor(): AgentWorkspaceLocalEditor {
|
|
9
|
+
return {
|
|
10
|
+
kind: 'model-compare',
|
|
11
|
+
mode: 'create',
|
|
12
|
+
title: 'Run Blind Model Compare',
|
|
13
|
+
selectedFieldIndex: 0,
|
|
14
|
+
message: 'Run one prompt against two to four selectable models and save a local JSON review artifact. Leave models blank to auto-select candidates. Type yes on the final field to confirm.',
|
|
15
|
+
fields: [
|
|
16
|
+
{ id: 'prompt', label: 'Prompt', value: '', required: true, multiline: true, hint: 'Exact prompt sent identically to every candidate model. Ctrl-J inserts a new line.' },
|
|
17
|
+
{ id: 'artifactId', label: 'Source artifact', value: '', required: false, multiline: false, hint: 'Optional saved text artifact id to include identically in the candidate prompt.' },
|
|
18
|
+
{ id: 'modelRefs', label: 'Models', value: '', required: false, multiline: true, hint: 'Optional registry keys or model ids, separated by commas or new lines. Blank auto-selects.' },
|
|
19
|
+
{ id: 'candidateCount', label: 'Auto count', value: '2', required: false, multiline: false, hint: 'Used only when Models is blank. 2 to 4.' },
|
|
20
|
+
{ id: 'rubric', label: 'Rubric', value: '', required: false, multiline: true, hint: 'Optional judging rubric shown with blinded results.' },
|
|
21
|
+
{ id: 'systemPrompt', label: 'System prompt', value: '', required: false, multiline: true, hint: 'Optional system prompt sent identically to every candidate.' },
|
|
22
|
+
{ id: 'maxTokens', label: 'Max tokens', value: '2048', required: false, multiline: false, hint: 'Per-candidate output cap. Defaults to 2048.' },
|
|
23
|
+
{ id: 'benchmarkKind', label: 'Benchmark tag', value: '', required: false, multiline: false, hint: 'Optional benchmark tag for filtered analytics.' },
|
|
24
|
+
{ id: 'taskType', label: 'Task type', value: '', required: false, multiline: false, hint: 'Optional tag such as writing, research, code-review, or benchmark.' },
|
|
25
|
+
{ id: 'documentId', label: 'Document id', value: '', required: false, multiline: false, hint: 'Optional document id tag. Source document exports can fill this automatically.' },
|
|
26
|
+
{ id: 'reveal', label: 'Reveal now', value: 'no', required: false, multiline: false, hint: 'yes/no. Blank or no keeps model identities hidden until reveal.' },
|
|
27
|
+
{ id: 'confirm', label: 'Confirm', value: '', required: true, multiline: false, hint: 'Type yes to run a token-spending model comparison and save the local review artifact.' },
|
|
28
|
+
],
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function createAgentLocalModelBenchmarkEditor(): AgentWorkspaceLocalEditor {
|
|
33
|
+
return {
|
|
34
|
+
kind: 'local-model-benchmark',
|
|
35
|
+
mode: 'create',
|
|
36
|
+
title: 'Run Local Model Benchmark',
|
|
37
|
+
selectedFieldIndex: 0,
|
|
38
|
+
message: 'Run the local-route benchmark with the first-class blind comparison tool and save a tagged local review artifact. Enter a local model route plus a baseline route, then type yes on the final field.',
|
|
39
|
+
fields: [
|
|
40
|
+
{
|
|
41
|
+
id: 'prompt',
|
|
42
|
+
label: 'Prompt',
|
|
43
|
+
value: [
|
|
44
|
+
'Benchmark this local route on one practical task:',
|
|
45
|
+
'1. summarize the current project goal in five bullets,',
|
|
46
|
+
'2. identify one likely setup risk,',
|
|
47
|
+
'3. propose one next action with a command or route.',
|
|
48
|
+
].join(' '),
|
|
49
|
+
required: true,
|
|
50
|
+
multiline: true,
|
|
51
|
+
hint: 'Exact benchmark prompt sent identically to every candidate model. Ctrl-J inserts a new line.',
|
|
52
|
+
},
|
|
53
|
+
{ id: 'artifactId', label: 'Source artifact', value: '', required: false, multiline: false, hint: 'Optional saved text artifact id to include identically in the benchmark prompt.' },
|
|
54
|
+
{ id: 'modelRefs', label: 'Models', value: '', required: false, multiline: true, hint: 'Recommended: local route first, then current/baseline route. Registry keys or model ids, separated by commas or new lines.' },
|
|
55
|
+
{ id: 'candidateCount', label: 'Auto count', value: '2', required: false, multiline: false, hint: 'Used only when Models is blank. 2 to 4.' },
|
|
56
|
+
{ id: 'rubric', label: 'Rubric', value: 'Prefer fast first useful output, correct project context, concrete setup-risk identification, and one actionable next route or command.', required: false, multiline: true, hint: 'Judging rubric shown with blinded benchmark results.' },
|
|
57
|
+
{ id: 'systemPrompt', label: 'System prompt', value: '', required: false, multiline: true, hint: 'Optional system prompt sent identically to every candidate.' },
|
|
58
|
+
{ id: 'maxTokens', label: 'Max tokens', value: '1024', required: false, multiline: false, hint: 'Per-candidate output cap. Defaults to 1024 for this benchmark.' },
|
|
59
|
+
{ id: 'benchmarkKind', label: 'Benchmark tag', value: 'local-model-route', required: false, multiline: false, hint: 'Keeps the saved comparison visible in local model benchmark history.' },
|
|
60
|
+
{ id: 'taskType', label: 'Task type', value: 'local-model-route', required: false, multiline: false, hint: 'Tags the saved judgment trend for filtered analytics.' },
|
|
61
|
+
{ id: 'reveal', label: 'Reveal now', value: 'no', required: false, multiline: false, hint: 'yes/no. Blank or no keeps model identities hidden until reveal.' },
|
|
62
|
+
{ id: 'confirm', label: 'Confirm', value: '', required: true, multiline: false, hint: 'Type yes to spend model tokens and save the local benchmark artifact.' },
|
|
63
|
+
],
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function createAgentModelCompareReviewEditor(): AgentWorkspaceLocalEditor {
|
|
68
|
+
return {
|
|
69
|
+
kind: 'model-compare-review',
|
|
70
|
+
mode: 'create',
|
|
71
|
+
title: 'Review Saved Compare',
|
|
72
|
+
selectedFieldIndex: 0,
|
|
73
|
+
message: 'Review saved blind comparison artifacts, render related evidence side by side, or compare two reviewer handoffs. Leave ids blank to list recent saved comparisons or handoffs.',
|
|
74
|
+
fields: [
|
|
75
|
+
{ id: 'view', label: 'View', value: 'review', required: false, multiline: false, hint: 'review, sideBySide, or handoffDiff. Diff compares two saved reviewer handoff artifacts.' },
|
|
76
|
+
{ id: 'artifactId', label: 'Artifact id', value: '', required: false, multiline: false, hint: 'Saved artifact id such as artifact-123. Blank lists recent saved comparisons.' },
|
|
77
|
+
{ id: 'comparisonId', label: 'Comparison id', value: '', required: false, multiline: false, hint: 'Comparison id such as cmp_... if known. Artifact id is usually easier.' },
|
|
78
|
+
{ id: 'leftArtifactId', label: 'Left handoff', value: '', required: false, multiline: false, hint: 'For handoffDiff: first saved reviewer handoff artifact id. Artifact id can also fill this.' },
|
|
79
|
+
{ id: 'rightArtifactId', label: 'Right handoff', value: '', required: false, multiline: false, hint: 'For handoffDiff: second saved reviewer handoff artifact id.' },
|
|
80
|
+
{ id: 'relatedArtifactIds', label: 'Related artifacts', value: '', required: false, multiline: true, hint: 'For sideBySide: document export, archive, or artifact ids, separated by commas or new lines.' },
|
|
81
|
+
{ id: 'previewBytes', label: 'Preview bytes', value: '2000', required: false, multiline: false, hint: 'For sideBySide: max bytes per related artifact preview, 200 to 10000.' },
|
|
82
|
+
{ id: 'reveal', label: 'Reveal', value: 'no', required: false, multiline: false, hint: 'yes/no. No keeps identities hidden and renders the blind review board.' },
|
|
83
|
+
],
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function createAgentModelCompareHandoffDiffEditor(
|
|
88
|
+
recentHandoffs: readonly AgentWorkspaceRecentReviewerHandoffArtifact[] = [],
|
|
89
|
+
): AgentWorkspaceLocalEditor {
|
|
90
|
+
const right = recentHandoffs.length >= 2 ? recentHandoffs[0] : undefined;
|
|
91
|
+
const left = recentHandoffs.length >= 2 ? recentHandoffs[1] : undefined;
|
|
92
|
+
const recentHint = recentHandoffs.length >= 2
|
|
93
|
+
? ` Prefilled with the two newest handoffs: ${left?.id ?? ''} -> ${right?.id ?? ''}.`
|
|
94
|
+
: ' Leave both ids blank to list recent saved handoffs.';
|
|
95
|
+
return {
|
|
96
|
+
kind: 'model-compare-handoff-diff',
|
|
97
|
+
mode: 'create',
|
|
98
|
+
title: 'Diff Reviewer Handoffs',
|
|
99
|
+
selectedFieldIndex: 0,
|
|
100
|
+
message: `Compare two saved reviewer handoff artifacts in the workspace split view. Use Section jump to focus the diff on all, metadata, policy, related, or comparison evidence.${recentHint}`,
|
|
101
|
+
fields: [
|
|
102
|
+
{ id: 'leftArtifactId', label: 'Left handoff', value: left?.id ?? '', required: false, multiline: false, hint: left ? `Older handoff ${left.handoffId}; source ${left.sourceArtifactId}; related ${left.relatedArtifactCount}. Clear both ids to list saved handoffs.` : 'First saved reviewer handoff artifact id. Leave both handoff fields blank to list recent saved handoffs.' },
|
|
103
|
+
{ id: 'rightArtifactId', label: 'Right handoff', value: right?.id ?? '', required: false, multiline: false, hint: right ? `Newer handoff ${right.handoffId}; source ${right.sourceArtifactId}; related ${right.relatedArtifactCount}. Clear both ids to list saved handoffs.` : 'Second saved reviewer handoff artifact id. Leave both handoff fields blank to list recent saved handoffs.' },
|
|
104
|
+
{ id: 'sectionId', label: 'Section jump', value: 'all', required: false, multiline: false, hint: 'all, metadata, policy, related, or comparison. Related focuses changed document/artifact evidence.' },
|
|
105
|
+
],
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function createAgentModelCompareJudgmentEditor(): AgentWorkspaceLocalEditor {
|
|
110
|
+
return {
|
|
111
|
+
kind: 'model-compare-judge',
|
|
112
|
+
mode: 'create',
|
|
113
|
+
title: 'Save Compare Judgment',
|
|
114
|
+
selectedFieldIndex: 0,
|
|
115
|
+
message: 'Save the winning candidate and reasons as a local judgment artifact. This does not change the selected model.',
|
|
116
|
+
fields: [
|
|
117
|
+
{ id: 'artifactId', label: 'Artifact id', value: '', required: false, multiline: false, hint: 'Saved comparison artifact id such as artifact-123.' },
|
|
118
|
+
{ id: 'comparisonId', label: 'Comparison id', value: '', required: false, multiline: false, hint: 'Comparison id such as cmp_... if known.' },
|
|
119
|
+
{ id: 'winnerBlindId', label: 'Winner', value: '', required: true, multiline: false, hint: 'Candidate label, such as A or Candidate B.' },
|
|
120
|
+
{ id: 'reasons', label: 'Reasons', value: '', required: true, multiline: true, hint: 'Why this candidate won. Ctrl-J inserts a new line.' },
|
|
121
|
+
{ id: 'notes', label: 'Notes', value: '', required: false, multiline: true, hint: 'Optional risks, follow-ups, or rubric notes.' },
|
|
122
|
+
{ id: 'reveal', label: 'Reveal in judgment', value: 'no', required: false, multiline: false, hint: 'yes/no. Yes includes model identity for later route update.' },
|
|
123
|
+
{ id: 'confirm', label: 'Confirm', value: '', required: true, multiline: false, hint: 'Type yes to save this judgment artifact.' },
|
|
124
|
+
],
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function packetSourceArtifactId(defaults: AgentWorkspaceReviewPacketDefaults | null): string {
|
|
129
|
+
return defaults?.revealedJudgmentArtifactId
|
|
130
|
+
?? defaults?.judgmentArtifactId
|
|
131
|
+
?? defaults?.comparisonArtifactId
|
|
132
|
+
?? '';
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function createAgentModelCompareApplyEditor(defaults: AgentWorkspaceReviewPacketDefaults | null = null): AgentWorkspaceLocalEditor {
|
|
136
|
+
const artifactId = defaults?.revealedJudgmentArtifactId ?? '';
|
|
137
|
+
const artifactHint = defaults?.summary
|
|
138
|
+
? `Default from latest revealed packet judgment. Packet default: ${defaults.summary}. Clear it to choose another saved judgment.`
|
|
139
|
+
: 'Saved revealed judgment artifact id such as artifact-123.';
|
|
140
|
+
return {
|
|
141
|
+
kind: 'model-compare-apply',
|
|
142
|
+
mode: 'create',
|
|
143
|
+
title: 'Apply Compare Winner',
|
|
144
|
+
selectedFieldIndex: 0,
|
|
145
|
+
message: artifactId
|
|
146
|
+
? 'Apply a revealed saved judgment artifact to the main Agent model route.'
|
|
147
|
+
: 'Apply a revealed saved judgment artifact to the main Agent model route. This changes provider.model after confirmation.',
|
|
148
|
+
fields: [
|
|
149
|
+
{ id: 'artifactId', label: 'Judgment artifact id', value: artifactId, required: true, multiline: false, hint: artifactId ? artifactHint : 'Saved revealed judgment artifact id such as artifact-123.' },
|
|
150
|
+
{ id: 'confirm', label: 'Confirm', value: '', required: true, multiline: false, hint: 'Type yes to change the selected Agent model.' },
|
|
151
|
+
],
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export function createAgentModelCompareRouteDecisionEditor(defaults: AgentWorkspaceReviewPacketDefaults | null = null): AgentWorkspaceLocalEditor {
|
|
156
|
+
const artifactId = defaults?.revealedJudgmentArtifactId ?? '';
|
|
157
|
+
const artifactHint = defaults?.summary
|
|
158
|
+
? `Default from latest revealed packet judgment. Packet default: ${defaults.summary}.`
|
|
159
|
+
: 'Saved revealed judgment artifact id such as artifact-123.';
|
|
160
|
+
return {
|
|
161
|
+
kind: 'model-compare-route-decision',
|
|
162
|
+
mode: 'create',
|
|
163
|
+
title: 'Record Route Decision',
|
|
164
|
+
selectedFieldIndex: 0,
|
|
165
|
+
message: artifactId
|
|
166
|
+
? 'Record that the current Agent model route should stay unchanged for this revealed judgment.'
|
|
167
|
+
: 'Record that the current Agent model route should stay unchanged for a revealed saved judgment.',
|
|
168
|
+
fields: [
|
|
169
|
+
{ id: 'artifactId', label: 'Judgment artifact id', value: artifactId, required: true, multiline: false, hint: artifactHint },
|
|
170
|
+
{ id: 'decision', label: 'Decision', value: 'left-unchanged', required: true, multiline: false, hint: 'left-unchanged. Use Apply Compare Winner for route updates.' },
|
|
171
|
+
{ id: 'confirm', label: 'Confirm', value: '', required: true, multiline: false, hint: 'Type yes to save the route-decision receipt without changing the selected model.' },
|
|
172
|
+
],
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export function createAgentModelCompareExportEditor(defaults: AgentWorkspaceReviewPacketDefaults | null = null): AgentWorkspaceLocalEditor {
|
|
177
|
+
const defaultKind = defaults?.handoffArtifactId
|
|
178
|
+
? 'archive'
|
|
179
|
+
: defaults?.relatedArtifactIds.length
|
|
180
|
+
? 'handoff'
|
|
181
|
+
: 'report';
|
|
182
|
+
const artifactId = defaultKind === 'archive'
|
|
183
|
+
? defaults?.handoffArtifactId ?? ''
|
|
184
|
+
: packetSourceArtifactId(defaults);
|
|
185
|
+
const relatedArtifactIds = defaultKind === 'handoff' ? (defaults?.relatedArtifactIds ?? []).join('\n') : '';
|
|
186
|
+
return {
|
|
187
|
+
kind: 'model-compare-export',
|
|
188
|
+
mode: 'create',
|
|
189
|
+
title: 'Export Compare Report/Handoff',
|
|
190
|
+
selectedFieldIndex: 0,
|
|
191
|
+
message: artifactId
|
|
192
|
+
? 'Export a saved comparison or judgment as a markdown report, create a reviewer handoff with related document/artifact ids, or archive a saved handoff as one ZIP artifact.'
|
|
193
|
+
: 'Export a saved comparison or judgment as a markdown report, create a reviewer handoff with related document/artifact ids, or archive a saved handoff as one ZIP artifact. This does not change the selected model.',
|
|
194
|
+
fields: [
|
|
195
|
+
{ id: 'reportKind', label: 'Kind', value: defaultKind, required: false, multiline: false, hint: defaults?.handoffArtifactId ? `Default archive uses the latest reviewer handoff. Packet default: ${defaults.summary}. Change to report or handoff to use comparison/judgment artifacts.` : defaults?.relatedArtifactIds.length ? `Default handoff carries latest related packet evidence. Packet default: ${defaults.summary}. Change to report for markdown only.` : 'report, handoff, or archive. Archive expects a saved handoff artifact id and creates one ZIP artifact.' },
|
|
196
|
+
{ id: 'artifactId', label: 'Artifact id', value: artifactId, required: true, multiline: false, hint: artifactId ? `Default from latest packet comparison, judgment, or reviewer handoff. Packet default: ${defaults?.summary ?? artifactId}. Clear it to choose another saved artifact.` : 'Saved comparison/judgment artifact for report or handoff; saved handoff artifact for archive.' },
|
|
197
|
+
{ id: 'relatedArtifactIds', label: 'Related artifacts', value: relatedArtifactIds, required: false, multiline: true, hint: relatedArtifactIds ? `Default related evidence from latest document export, attachments, source artifacts, or handoff metadata. Packet default: ${defaults?.summary ?? relatedArtifactIds}.` : 'For handoff: document export, archive, or artifact ids, separated by commas or new lines.' },
|
|
198
|
+
{ id: 'reveal', label: 'Reveal in export', value: defaultKind === 'handoff' ? 'yes' : 'no', required: false, multiline: false, hint: 'yes/no. For comparison artifacts, yes includes model identities. Judgment artifacts use their saved reveal state.' },
|
|
199
|
+
{ id: 'confirm', label: 'Confirm', value: '', required: true, multiline: false, hint: 'Type yes to create the local report, handoff, or ZIP archive artifact.' },
|
|
200
|
+
],
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export function createAgentModelCompareAnalyticsEditor(): AgentWorkspaceLocalEditor {
|
|
205
|
+
return {
|
|
206
|
+
kind: 'model-compare-analytics',
|
|
207
|
+
mode: 'create',
|
|
208
|
+
title: 'Compare Analytics/Synthesis',
|
|
209
|
+
selectedFieldIndex: 0,
|
|
210
|
+
message: 'Summarize or synthesize saved blind comparison judgments by winner, model, blind slot, themes, task type, document id, benchmark tag, and recent reasons. This is read-only.',
|
|
211
|
+
fields: [
|
|
212
|
+
{ id: 'view', label: 'View', value: 'analytics', required: false, multiline: false, hint: 'analytics or synthesis. Synthesis groups saved judgment themes across sessions.' },
|
|
213
|
+
{ id: 'limit', label: 'Judgment limit', value: '20', required: false, multiline: false, hint: 'Maximum saved judgment artifacts to inspect. Defaults to 20.' },
|
|
214
|
+
{ id: 'benchmarkKind', label: 'Benchmark tag', value: '', required: false, multiline: false, hint: 'Optional filter, such as local-model-route.' },
|
|
215
|
+
{ id: 'taskType', label: 'Task type', value: '', required: false, multiline: false, hint: 'Optional filter, such as writing, research, code-review, or local-model-route.' },
|
|
216
|
+
{ id: 'documentId', label: 'Document id', value: '', required: false, multiline: false, hint: 'Optional filter for judgments tied to one Agent document id.' },
|
|
217
|
+
{ id: 'includeReasons', label: 'Include reasons', value: 'yes', required: false, multiline: false, hint: 'yes/no. Yes includes short reason and note excerpts in the recent-judgments list.' },
|
|
218
|
+
],
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export function buildAgentModelCompareToolArgs(
|
|
223
|
+
readField: AgentWorkspaceFieldReader,
|
|
224
|
+
explicitUserRequest: string,
|
|
225
|
+
): AgentModelCompareWorkspaceToolArgs {
|
|
226
|
+
const prompt = readField('prompt').trim();
|
|
227
|
+
const artifactId = readField('artifactId').trim();
|
|
228
|
+
const modelRefs = readList(readField('modelRefs'));
|
|
229
|
+
const candidateCount = readPositiveInteger(readField('candidateCount'));
|
|
230
|
+
const rubric = readField('rubric').trim();
|
|
231
|
+
const systemPrompt = readField('systemPrompt').trim();
|
|
232
|
+
const maxTokens = readPositiveInteger(readField('maxTokens'));
|
|
233
|
+
const benchmarkKind = readField('benchmarkKind').trim();
|
|
234
|
+
const taskType = readField('taskType').trim();
|
|
235
|
+
const documentId = readField('documentId').trim();
|
|
236
|
+
const reveal = isAffirmative(readField('reveal'));
|
|
237
|
+
|
|
238
|
+
return {
|
|
239
|
+
mode: 'run',
|
|
240
|
+
prompt,
|
|
241
|
+
...(artifactId ? { artifactId } : {}),
|
|
242
|
+
...(modelRefs.length > 0 ? { modelRefs } : {}),
|
|
243
|
+
...(candidateCount !== null ? { candidateCount } : {}),
|
|
244
|
+
...(rubric ? { rubric } : {}),
|
|
245
|
+
...(systemPrompt ? { systemPrompt } : {}),
|
|
246
|
+
...(maxTokens !== null ? { maxTokens } : {}),
|
|
247
|
+
...(benchmarkKind ? { benchmarkKind } : {}),
|
|
248
|
+
...(taskType ? { taskType } : {}),
|
|
249
|
+
...(documentId ? { documentId } : {}),
|
|
250
|
+
reveal,
|
|
251
|
+
confirm: true,
|
|
252
|
+
explicitUserRequest,
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export function buildAgentModelCompareReviewToolArgs(
|
|
257
|
+
readField: AgentWorkspaceFieldReader,
|
|
258
|
+
): AgentModelCompareReviewWorkspaceToolArgs {
|
|
259
|
+
const mode = compareReviewMode(readField('view'));
|
|
260
|
+
const artifactId = readField('artifactId').trim();
|
|
261
|
+
const comparisonId = readField('comparisonId').trim();
|
|
262
|
+
const leftArtifactId = readField('leftArtifactId').trim() || artifactId;
|
|
263
|
+
const rightArtifactId = readField('rightArtifactId').trim();
|
|
264
|
+
const relatedArtifactIds = readList(readField('relatedArtifactIds'));
|
|
265
|
+
const previewBytes = readPositiveInteger(readField('previewBytes'));
|
|
266
|
+
const reveal = isAffirmative(readField('reveal'));
|
|
267
|
+
if (mode === 'handoffDiff') {
|
|
268
|
+
const sectionId = readField('sectionId').trim();
|
|
269
|
+
return {
|
|
270
|
+
mode,
|
|
271
|
+
...(leftArtifactId ? { leftArtifactId } : {}),
|
|
272
|
+
...(rightArtifactId ? { rightArtifactId } : {}),
|
|
273
|
+
...(sectionId && sectionId.toLowerCase() !== 'all' ? { sectionId } : {}),
|
|
274
|
+
...(previewBytes !== null ? { previewBytes } : {}),
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
return {
|
|
278
|
+
mode,
|
|
279
|
+
...(artifactId ? { artifactId } : {}),
|
|
280
|
+
...(comparisonId ? { comparisonId } : {}),
|
|
281
|
+
...(relatedArtifactIds.length > 0 ? { relatedArtifactIds } : {}),
|
|
282
|
+
...(previewBytes !== null ? { previewBytes } : {}),
|
|
283
|
+
reveal,
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export function buildAgentModelCompareHandoffDiffToolArgs(
|
|
288
|
+
readField: AgentWorkspaceFieldReader,
|
|
289
|
+
): AgentModelCompareHandoffDiffWorkspaceToolArgs {
|
|
290
|
+
const sectionId = readField('sectionId').trim();
|
|
291
|
+
return {
|
|
292
|
+
mode: 'handoffDiff',
|
|
293
|
+
...(readField('leftArtifactId').trim() ? { leftArtifactId: readField('leftArtifactId').trim() } : {}),
|
|
294
|
+
...(readField('rightArtifactId').trim() ? { rightArtifactId: readField('rightArtifactId').trim() } : {}),
|
|
295
|
+
...(sectionId && sectionId.toLowerCase() !== 'all' ? { sectionId } : {}),
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export function buildAgentModelCompareJudgmentToolArgs(
|
|
300
|
+
readField: AgentWorkspaceFieldReader,
|
|
301
|
+
explicitUserRequest: string,
|
|
302
|
+
): AgentModelCompareJudgmentWorkspaceToolArgs {
|
|
303
|
+
const artifactId = readField('artifactId').trim();
|
|
304
|
+
const comparisonId = readField('comparisonId').trim();
|
|
305
|
+
const notes = readField('notes').trim();
|
|
306
|
+
return {
|
|
307
|
+
mode: 'judge',
|
|
308
|
+
...(artifactId ? { artifactId } : {}),
|
|
309
|
+
...(comparisonId ? { comparisonId } : {}),
|
|
310
|
+
winnerBlindId: readField('winnerBlindId').trim(),
|
|
311
|
+
reasons: readField('reasons').trim(),
|
|
312
|
+
...(notes ? { notes } : {}),
|
|
313
|
+
reveal: isAffirmative(readField('reveal')),
|
|
314
|
+
confirm: true,
|
|
315
|
+
explicitUserRequest,
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export function buildAgentModelCompareApplyToolArgs(
|
|
320
|
+
readField: AgentWorkspaceFieldReader,
|
|
321
|
+
explicitUserRequest: string,
|
|
322
|
+
): AgentModelCompareApplyWorkspaceToolArgs {
|
|
323
|
+
return {
|
|
324
|
+
mode: 'apply',
|
|
325
|
+
artifactId: readField('artifactId').trim(),
|
|
326
|
+
confirm: true,
|
|
327
|
+
explicitUserRequest,
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export function buildAgentModelCompareRouteDecisionToolArgs(
|
|
332
|
+
readField: AgentWorkspaceFieldReader,
|
|
333
|
+
explicitUserRequest: string,
|
|
334
|
+
): AgentModelCompareRouteDecisionWorkspaceToolArgs {
|
|
335
|
+
return {
|
|
336
|
+
mode: 'routeDecision',
|
|
337
|
+
artifactId: readField('artifactId').trim(),
|
|
338
|
+
decision: 'left-unchanged',
|
|
339
|
+
confirm: true,
|
|
340
|
+
explicitUserRequest,
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export function buildAgentModelCompareExportToolArgs(
|
|
345
|
+
readField: AgentWorkspaceFieldReader,
|
|
346
|
+
explicitUserRequest: string,
|
|
347
|
+
): AgentModelCompareExportWorkspaceToolArgs {
|
|
348
|
+
const mode = compareExportMode(readField('reportKind'));
|
|
349
|
+
const relatedArtifactIds = readList(readField('relatedArtifactIds'));
|
|
350
|
+
return {
|
|
351
|
+
mode,
|
|
352
|
+
artifactId: readField('artifactId').trim(),
|
|
353
|
+
...(relatedArtifactIds.length > 0 ? { relatedArtifactIds } : {}),
|
|
354
|
+
reveal: isAffirmative(readField('reveal')),
|
|
355
|
+
confirm: true,
|
|
356
|
+
explicitUserRequest,
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
export function buildAgentModelCompareAnalyticsToolArgs(
|
|
361
|
+
readField: AgentWorkspaceFieldReader,
|
|
362
|
+
): AgentModelCompareAnalyticsWorkspaceToolArgs {
|
|
363
|
+
const view = readField('view').trim().toLowerCase();
|
|
364
|
+
const limit = readPositiveInteger(readField('limit'));
|
|
365
|
+
const benchmarkKind = readField('benchmarkKind').trim();
|
|
366
|
+
const taskType = readField('taskType').trim();
|
|
367
|
+
const documentId = readField('documentId').trim();
|
|
368
|
+
return {
|
|
369
|
+
mode: view === 'synthesis' ? 'synthesis' : 'analytics',
|
|
370
|
+
...(limit !== null ? { limit } : {}),
|
|
371
|
+
...(benchmarkKind ? { benchmarkKind } : {}),
|
|
372
|
+
...(taskType ? { taskType } : {}),
|
|
373
|
+
...(documentId ? { documentId } : {}),
|
|
374
|
+
includeReasons: isAffirmative(readField('includeReasons')),
|
|
375
|
+
};
|
|
376
|
+
}
|