@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,253 @@
|
|
|
1
|
+
import type { CommandContext } from '../input/command-registry.ts';
|
|
2
|
+
import type { CliServicePosture } from '../cli/service-posture.ts';
|
|
3
|
+
import type { OnboardingStep1CapabilityItem } from '../runtime/onboarding/index.ts';
|
|
4
|
+
import { previewAgentWorkspaceTuiSettingsImport } from '../input/agent-workspace-settings.ts';
|
|
5
|
+
import { browserControlPosture } from './agent-harness-browser-control.ts';
|
|
6
|
+
import { localModelCookbook } from './agent-harness-model-routing.ts';
|
|
7
|
+
import { sudoExecutionPosture } from './agent-harness-sudo-posture.ts';
|
|
8
|
+
import { agentHarnessVibeHealth } from './agent-harness-vibe-health.ts';
|
|
9
|
+
import { capabilityById, collectSnapshot, setupPlanStatusForCapability, setupProviderSignalIds } from './agent-harness-setup-posture-utils.ts';
|
|
10
|
+
import { browserControlSignals, localModelSetupNextAction, localModelSetupReadiness, localModelSetupSignals, localModelSetupStatus, settingsImportChangeCount, settingsImportSignals } from './agent-harness-setup-model-helpers.ts';
|
|
11
|
+
import { connectedHostAuthNextAction, connectedHostAuthPosture, connectedHostAuthSignals, connectedHostAuthStatus, connectedHostBootstrapPlan, connectedHostRepairCards, connectedHostServiceProbe, hostSetupStatus, serviceProbeSignal, setupServiceLifecycleDecision } from './agent-harness-setup-connected-host.ts';
|
|
12
|
+
import { installSmokePlan, installSmokeSignals, setupCompletionMarkerExists } from './agent-harness-setup-smoke.ts';
|
|
13
|
+
import type { SetupPlanItem } from './agent-harness-setup-posture-types.ts';
|
|
14
|
+
|
|
15
|
+
export function buildSetupPlan(
|
|
16
|
+
context: CommandContext,
|
|
17
|
+
snapshot: Awaited<ReturnType<typeof collectSnapshot>>,
|
|
18
|
+
capabilities: readonly OnboardingStep1CapabilityItem[],
|
|
19
|
+
servicePosture: CliServicePosture | null,
|
|
20
|
+
): readonly SetupPlanItem[] {
|
|
21
|
+
const providerAccess = capabilityById(capabilities, 'provider-access');
|
|
22
|
+
const agentKnowledge = capabilityById(capabilities, 'agent-knowledge');
|
|
23
|
+
const localBehavior = capabilityById(capabilities, 'local-behavior');
|
|
24
|
+
const communicationChannels = capabilityById(capabilities, 'communication-channels');
|
|
25
|
+
const automationReview = capabilityById(capabilities, 'automation-review');
|
|
26
|
+
const tuiDelegation = capabilityById(capabilities, 'tui-delegation');
|
|
27
|
+
const setupMarkerDone = setupCompletionMarkerExists(context);
|
|
28
|
+
const browserControl = browserControlPosture(context);
|
|
29
|
+
const settingsImport = previewAgentWorkspaceTuiSettingsImport(context);
|
|
30
|
+
const settingsImportChanges = settingsImportChangeCount(settingsImport);
|
|
31
|
+
const localModels = localModelCookbook(context, true);
|
|
32
|
+
const localModelReadiness = localModelSetupReadiness(localModels);
|
|
33
|
+
const serviceProbe = connectedHostServiceProbe(servicePosture);
|
|
34
|
+
const authPosture = connectedHostAuthPosture(context, snapshot);
|
|
35
|
+
const smokePlan = installSmokePlan(providerAccess, serviceProbe, authPosture);
|
|
36
|
+
const vibeHealth = agentHarnessVibeHealth(context);
|
|
37
|
+
const sudoPosture = sudoExecutionPosture(context);
|
|
38
|
+
|
|
39
|
+
const plan: SetupPlanItem[] = [
|
|
40
|
+
{
|
|
41
|
+
id: 'connected-host-readiness',
|
|
42
|
+
label: 'Connected host readiness',
|
|
43
|
+
status: hostSetupStatus(snapshot, serviceProbe),
|
|
44
|
+
priority: 10,
|
|
45
|
+
blocksAutonomy: true,
|
|
46
|
+
reason: 'Daemon-backed automation, Agent Knowledge, channels, and companion routes need a reachable compatible GoodVibes host.',
|
|
47
|
+
nextAction: 'Run connected-host status, then start, update, or repair the owning GoodVibes host if the live check reports a gap.',
|
|
48
|
+
userRoute: 'Agent Workspace -> Home -> Host compatibility',
|
|
49
|
+
modelRoute: 'host action:"status"',
|
|
50
|
+
relatedSetupItemId: 'operator-terminal',
|
|
51
|
+
signals: [
|
|
52
|
+
serviceProbeSignal(serviceProbe),
|
|
53
|
+
...serviceProbe.issues.slice(0, 3),
|
|
54
|
+
...snapshot.collectionIssues.filter((issue) => issue.area === 'host').map((issue) => issue.message),
|
|
55
|
+
],
|
|
56
|
+
repairCards: connectedHostRepairCards(snapshot, serviceProbe),
|
|
57
|
+
serviceLifecycleDecision: setupServiceLifecycleDecision(snapshot, serviceProbe),
|
|
58
|
+
bootstrapPlan: connectedHostBootstrapPlan(snapshot, serviceProbe),
|
|
59
|
+
serviceProbe,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: 'connected-host-auth',
|
|
63
|
+
label: 'Connected-host auth',
|
|
64
|
+
status: connectedHostAuthStatus(authPosture),
|
|
65
|
+
priority: 12,
|
|
66
|
+
blocksAutonomy: true,
|
|
67
|
+
reason: 'Protected daemon routes, approvals, schedules, channels, and Agent Knowledge writes need a usable connected-host operator token from the canonical GoodVibes host token store.',
|
|
68
|
+
nextAction: connectedHostAuthNextAction(authPosture),
|
|
69
|
+
userRoute: 'Agent Workspace -> Host -> Connected-host auth owner; /auth review',
|
|
70
|
+
modelRoute: authPosture.operatorToken.usable
|
|
71
|
+
? 'host action:"status" includeParameters:true'
|
|
72
|
+
: authPosture.routes.provisionTokenRoute,
|
|
73
|
+
relatedSetupItemId: 'operator-terminal',
|
|
74
|
+
signals: connectedHostAuthSignals(authPosture),
|
|
75
|
+
authPosture,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: 'goodvibes-settings-import',
|
|
79
|
+
label: 'GoodVibes settings import',
|
|
80
|
+
status: settingsImport?.summary.parseErrors ? 'check' : settingsImportChanges > 0 ? 'recommended' : 'optional',
|
|
81
|
+
priority: 15,
|
|
82
|
+
blocksAutonomy: false,
|
|
83
|
+
reason: 'Existing shared GoodVibes settings can seed Agent provider, subscription, behavior, permission, UI, TTS, channel, helper, tool, release, and automation state.',
|
|
84
|
+
nextAction: settingsImportChanges > 0
|
|
85
|
+
? 'Preview the import, explain the changed setting and subscription counts, then apply only after the user confirms the import.'
|
|
86
|
+
: 'Use this when reusing settings from GoodVibes TUI or another published GoodVibes platform store; the preview shows whether anything importable is present.',
|
|
87
|
+
userRoute: 'Agent Workspace -> Start -> Import GoodVibes settings',
|
|
88
|
+
modelRoute: 'import_goodvibes_settings action:"preview"',
|
|
89
|
+
signals: settingsImportSignals(settingsImport),
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: 'provider-access',
|
|
93
|
+
label: 'Provider and model access',
|
|
94
|
+
status: setupPlanStatusForCapability(providerAccess, 'blocked'),
|
|
95
|
+
priority: 20,
|
|
96
|
+
blocksAutonomy: true,
|
|
97
|
+
reason: providerAccess.detail,
|
|
98
|
+
nextAction: providerAccess.selected ? 'Review the current model route and provider accounts.' : 'Choose a provider/model route or store a provider credential before relying on assistant turns.',
|
|
99
|
+
userRoute: 'Agent Workspace -> Start -> Choose main model',
|
|
100
|
+
modelRoute: 'models action:"status|providers"',
|
|
101
|
+
relatedSetupItemId: providerAccess.id,
|
|
102
|
+
signals: setupProviderSignalIds(snapshot),
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: 'install-smoke',
|
|
106
|
+
label: 'Install smoke',
|
|
107
|
+
status: smokePlan.status === 'ready-to-run' ? 'recommended' : 'blocked',
|
|
108
|
+
priority: 22,
|
|
109
|
+
blocksAutonomy: false,
|
|
110
|
+
reason: 'A fresh install should be provable from package binary to reachable host, usable auth, selected model route, reviewed setup posture, and one successful assistant turn.',
|
|
111
|
+
nextAction: smokePlan.status === 'ready-to-run'
|
|
112
|
+
? 'Run the confirmed setup smoke route, then complete the user-visible package/status and first-turn checks.'
|
|
113
|
+
: 'Resolve connected-host, connected-host auth, and provider/model blockers, then rerun the confirmed setup smoke route.',
|
|
114
|
+
userRoute: 'Agent Workspace -> Start -> Install smoke',
|
|
115
|
+
modelRoute: 'setup action:"smoke" setupItemId:"install-smoke"',
|
|
116
|
+
signals: installSmokeSignals(smokePlan),
|
|
117
|
+
installSmokePlan: smokePlan,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: 'local-model-readiness',
|
|
121
|
+
label: 'Local model readiness',
|
|
122
|
+
status: localModelSetupStatus(localModels),
|
|
123
|
+
priority: 25,
|
|
124
|
+
blocksAutonomy: false,
|
|
125
|
+
reason: 'A local route gives the assistant a private/offline fallback and can reduce cost, but it should be set up through visible server, refresh, and benchmark steps.',
|
|
126
|
+
nextAction: localModelSetupNextAction(localModels),
|
|
127
|
+
userRoute: 'Agent Workspace -> Start -> Local model cookbook',
|
|
128
|
+
modelRoute: 'models action:"local"',
|
|
129
|
+
signals: localModelSetupSignals(localModels),
|
|
130
|
+
localModelReadiness,
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
id: 'agent-knowledge',
|
|
134
|
+
label: 'Agent Knowledge readiness',
|
|
135
|
+
status: 'recommended',
|
|
136
|
+
priority: 30,
|
|
137
|
+
blocksAutonomy: false,
|
|
138
|
+
reason: agentKnowledge.detail,
|
|
139
|
+
nextAction: 'Inspect isolated Agent Knowledge status before source-backed memory or research ingest.',
|
|
140
|
+
userRoute: 'Agent Workspace -> Knowledge',
|
|
141
|
+
modelRoute: 'host action:"status" or agent_knowledge',
|
|
142
|
+
relatedSetupItemId: agentKnowledge.id,
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
id: 'vibe-personality',
|
|
146
|
+
label: 'VIBE.md personality',
|
|
147
|
+
status: vibeHealth.status,
|
|
148
|
+
priority: 35,
|
|
149
|
+
blocksAutonomy: false,
|
|
150
|
+
reason: 'VIBE.md is the user-friendly personality file for how GoodVibes Agent should feel, but blocked or truncated files should be visible before they shape a session.',
|
|
151
|
+
nextAction: vibeHealth.nextAction,
|
|
152
|
+
userRoute: vibeHealth.userRoute,
|
|
153
|
+
modelRoute: vibeHealth.modelRoute,
|
|
154
|
+
signals: vibeHealth.signals,
|
|
155
|
+
vibeHealth,
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
id: 'local-behavior',
|
|
159
|
+
label: 'Local memory, skills, and routines',
|
|
160
|
+
status: setupPlanStatusForCapability(localBehavior, 'recommended'),
|
|
161
|
+
priority: 40,
|
|
162
|
+
blocksAutonomy: false,
|
|
163
|
+
reason: localBehavior.detail,
|
|
164
|
+
nextAction: localBehavior.selected ? 'Review imported or customized local behavior.' : 'Import discovered behavior files or create the first persona, skill, or routine.',
|
|
165
|
+
userRoute: 'Agent Workspace -> Local Context',
|
|
166
|
+
modelRoute: 'memory action:"curator" or agent_harness mode:"workspace_actions" categoryId:"onboarding-context"',
|
|
167
|
+
relatedSetupItemId: localBehavior.id,
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
id: 'communication-channels',
|
|
171
|
+
label: 'Communication channels',
|
|
172
|
+
status: setupPlanStatusForCapability(communicationChannels, 'optional'),
|
|
173
|
+
priority: 50,
|
|
174
|
+
blocksAutonomy: false,
|
|
175
|
+
reason: communicationChannels.detail,
|
|
176
|
+
nextAction: communicationChannels.selected ? 'Review channel readiness and delivery safety.' : 'Enable only the channels where the assistant should be reachable.',
|
|
177
|
+
userRoute: 'Agent Workspace -> Channels',
|
|
178
|
+
modelRoute: 'channels action:"status"',
|
|
179
|
+
relatedSetupItemId: communicationChannels.id,
|
|
180
|
+
signals: snapshot.surfaces.configuredEnabledKinds,
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
id: 'automation-review',
|
|
184
|
+
label: 'Automation review',
|
|
185
|
+
status: setupPlanStatusForCapability(automationReview, 'recommended'),
|
|
186
|
+
priority: 60,
|
|
187
|
+
blocksAutonomy: false,
|
|
188
|
+
reason: automationReview.detail,
|
|
189
|
+
nextAction: 'Review schedules, approvals, routine promotion, and visible autonomy queue controls before ongoing background work.',
|
|
190
|
+
userRoute: 'Agent Workspace -> Personal Ops -> Autonomy queue',
|
|
191
|
+
modelRoute: 'autonomy action:"queue"',
|
|
192
|
+
relatedSetupItemId: automationReview.id,
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
id: 'browser-desktop-control',
|
|
196
|
+
label: 'Browser and desktop control',
|
|
197
|
+
status: browserControl.status === 'ready' ? 'ready' : browserControl.status === 'attention' ? 'check' : 'recommended',
|
|
198
|
+
priority: 65,
|
|
199
|
+
blocksAutonomy: false,
|
|
200
|
+
reason: browserControl.configured
|
|
201
|
+
? 'A trusted browser, desktop, computer-use, screenshot, or screen-recording route is configured.'
|
|
202
|
+
: browserControl.status === 'attention'
|
|
203
|
+
? 'A browser or desktop connector is present but needs trust, connection, or schema review before use.'
|
|
204
|
+
: 'Live browser navigation, UI testing, screenshots, screen recording, and desktop or device actions need a trusted MCP server or first-class tool before the Agent can perform them.',
|
|
205
|
+
nextAction: browserControl.configured
|
|
206
|
+
? 'Inspect the browser/desktop execution route before using live UI automation.'
|
|
207
|
+
: browserControl.status === 'attention'
|
|
208
|
+
? 'Review the matching MCP server trust, connection, and schema freshness before using live UI automation.'
|
|
209
|
+
: 'Configure and review a trusted browser or desktop MCP server, then inspect the execution route before offering live UI automation.',
|
|
210
|
+
userRoute: 'Agent Workspace -> Tools & MCP',
|
|
211
|
+
modelRoute: browserControl.recommendedRoute,
|
|
212
|
+
signals: browserControlSignals(browserControl),
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
id: 'sudo-execution-posture',
|
|
216
|
+
label: 'Sudo execution posture',
|
|
217
|
+
status: sudoPosture.setupStatus,
|
|
218
|
+
priority: 66,
|
|
219
|
+
blocksAutonomy: false,
|
|
220
|
+
reason: 'Privilege escalation must stay explicit, visible, and user-supervised; background sudo prompts, stdin password writes, and raw password display are blocked until the SDK/daemon publishes safe mediation.',
|
|
221
|
+
nextAction: sudoPosture.nextAction,
|
|
222
|
+
userRoute: 'Agent Workspace -> Computer Use -> Sudo posture',
|
|
223
|
+
modelRoute: sudoPosture.setupRoute,
|
|
224
|
+
signals: sudoPosture.signals,
|
|
225
|
+
sudoPosture,
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
id: 'build-delegation',
|
|
229
|
+
label: 'Build delegation boundary',
|
|
230
|
+
status: setupPlanStatusForCapability(tuiDelegation, 'optional'),
|
|
231
|
+
priority: 70,
|
|
232
|
+
blocksAutonomy: false,
|
|
233
|
+
reason: tuiDelegation.detail,
|
|
234
|
+
nextAction: 'Use delegation for explicit build, fix, review, isolation, or parallelism work rather than as a setup prerequisite.',
|
|
235
|
+
userRoute: 'Agent Workspace -> Home -> Connected host',
|
|
236
|
+
modelRoute: 'delegation action:"status"',
|
|
237
|
+
relatedSetupItemId: tuiDelegation.id,
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
id: 'finish-onboarding',
|
|
241
|
+
label: 'Finish onboarding state',
|
|
242
|
+
status: setupMarkerDone ? 'ready' : 'recommended',
|
|
243
|
+
priority: 80,
|
|
244
|
+
blocksAutonomy: false,
|
|
245
|
+
reason: setupMarkerDone ? 'A setup marker already exists for this Agent scope.' : 'No setup marker exists yet, so the user may see first-run guidance again.',
|
|
246
|
+
nextAction: setupMarkerDone ? 'Reopen setup only when changing provider, channel, automation, or local behavior decisions.' : 'Open onboarding, review the selected choices, then apply and close when the assistant is usable.',
|
|
247
|
+
userRoute: 'Agent Workspace -> Start -> Onboarding',
|
|
248
|
+
modelRoute: 'agent_harness mode:"open_ui_surface" surfaceId:"onboarding"',
|
|
249
|
+
},
|
|
250
|
+
];
|
|
251
|
+
|
|
252
|
+
return plan.sort((left, right) => left.priority - right.priority);
|
|
253
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import type { ArtifactStore } from '@pellux/goodvibes-sdk/platform/artifacts';
|
|
2
|
+
import type { OnboardingStep1CapabilityItem, OnboardingSurfaceRecord } from '../runtime/onboarding/index.ts';
|
|
3
|
+
import type { AgentHarnessVibeHealth } from './agent-harness-vibe-health.ts';
|
|
4
|
+
import type { AgentHarnessSudoPosture } from './agent-harness-sudo-posture.ts';
|
|
5
|
+
|
|
6
|
+
export interface AgentHarnessSetupArgs {
|
|
7
|
+
readonly setupItemId?: unknown;
|
|
8
|
+
readonly target?: unknown;
|
|
9
|
+
readonly query?: unknown;
|
|
10
|
+
readonly includeParameters?: unknown;
|
|
11
|
+
readonly limit?: unknown;
|
|
12
|
+
readonly fields?: unknown;
|
|
13
|
+
readonly explicitUserRequest?: unknown;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type SetupResolution =
|
|
17
|
+
| { readonly status: 'found'; readonly item: Record<string, unknown> }
|
|
18
|
+
| { readonly status: 'ambiguous'; readonly input: string; readonly candidates: readonly Record<string, unknown>[] }
|
|
19
|
+
| { readonly status: 'missing_lookup'; readonly usage: string };
|
|
20
|
+
|
|
21
|
+
export type SetupLookupSource = 'setupItemId' | 'target' | 'query';
|
|
22
|
+
|
|
23
|
+
export interface SurfaceRegistryLike {
|
|
24
|
+
syncConfiguredSurfaces(): readonly OnboardingSurfaceRecord[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type SetupPlanStatus = 'ready' | 'blocked' | 'recommended' | 'optional' | 'check';
|
|
28
|
+
export type SetupRepairCardState = 'available' | 'requires-live-host' | 'missing';
|
|
29
|
+
export type SetupRepairCardEffect = 'read-only' | 'confirmed-effect';
|
|
30
|
+
export type SetupRepairRecommendation = 'recommended' | 'inspect-first' | 'not-needed' | 'unavailable';
|
|
31
|
+
export type SetupServiceProbeStatus = 'reachable' | 'unreachable' | 'not-enabled' | 'not-probed';
|
|
32
|
+
export type SetupSmokeArtifactStore = Partial<Pick<ArtifactStore, 'create' | 'list'>>;
|
|
33
|
+
export type SetupHandoffKind = 'diagnostic' | 'workspace-action' | 'ui-surface' | 'confirmed-route' | 'operator-method' | 'conversation' | 'user-command' | 'tool-discovery';
|
|
34
|
+
export type SetupHandoffEffect = 'read-only' | 'visible-navigation' | 'confirmed-effect' | 'user-run';
|
|
35
|
+
|
|
36
|
+
export interface OperatorContractMethod {
|
|
37
|
+
readonly id: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface SetupPlanItem {
|
|
41
|
+
readonly id: string;
|
|
42
|
+
readonly label: string;
|
|
43
|
+
readonly status: SetupPlanStatus;
|
|
44
|
+
readonly priority: number;
|
|
45
|
+
readonly blocksAutonomy: boolean;
|
|
46
|
+
readonly reason: string;
|
|
47
|
+
readonly nextAction: string;
|
|
48
|
+
readonly userRoute: string;
|
|
49
|
+
readonly modelRoute: string;
|
|
50
|
+
readonly relatedSetupItemId?: string;
|
|
51
|
+
readonly signals?: readonly string[];
|
|
52
|
+
readonly repairCards?: readonly SetupRepairCard[];
|
|
53
|
+
readonly serviceLifecycleDecision?: SetupServiceLifecycleDecision;
|
|
54
|
+
readonly bootstrapPlan?: SetupBootstrapPlan;
|
|
55
|
+
readonly serviceProbe?: SetupServiceProbe;
|
|
56
|
+
readonly authPosture?: SetupConnectedHostAuthPosture;
|
|
57
|
+
readonly installSmokePlan?: SetupInstallSmokePlan;
|
|
58
|
+
readonly localModelReadiness?: Record<string, unknown>;
|
|
59
|
+
readonly vibeHealth?: AgentHarnessVibeHealth;
|
|
60
|
+
readonly sudoPosture?: AgentHarnessSudoPosture;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface SetupRepairCard {
|
|
64
|
+
readonly id: string;
|
|
65
|
+
readonly label: string;
|
|
66
|
+
readonly state: SetupRepairCardState;
|
|
67
|
+
readonly effect: SetupRepairCardEffect;
|
|
68
|
+
readonly methodId?: string;
|
|
69
|
+
readonly modelRoute?: string;
|
|
70
|
+
readonly userRoute: string;
|
|
71
|
+
readonly prerequisite?: string;
|
|
72
|
+
readonly recommendation: SetupRepairRecommendation;
|
|
73
|
+
readonly liveEvidence?: SetupRepairLiveEvidence;
|
|
74
|
+
readonly outcome?: SetupRepairOutcome;
|
|
75
|
+
readonly recommendedWhen: string;
|
|
76
|
+
readonly safety: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface SetupRepairLiveEvidence {
|
|
80
|
+
readonly probeStatus: SetupServiceProbeStatus;
|
|
81
|
+
readonly summary: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface SetupRepairOutcome {
|
|
85
|
+
readonly target: string;
|
|
86
|
+
readonly successCriteria: readonly string[];
|
|
87
|
+
readonly evidenceFields: readonly string[];
|
|
88
|
+
readonly verificationRoute: string;
|
|
89
|
+
readonly recoveryRoute: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface SetupServiceLifecycleDecision {
|
|
93
|
+
readonly status: 'needs-status-receipt' | 'no-lifecycle-action' | 'bootstrap-first' | 'status-route-unavailable';
|
|
94
|
+
readonly recommendedAction: 'read-services-status' | 'inspect-service-posture' | 'none';
|
|
95
|
+
readonly modelRoute: string;
|
|
96
|
+
readonly reason: string;
|
|
97
|
+
readonly evidence: {
|
|
98
|
+
readonly probeStatus: SetupServiceProbeStatus;
|
|
99
|
+
readonly binding: string;
|
|
100
|
+
readonly hostIssue: boolean;
|
|
101
|
+
readonly serviceStatusMethodPublished: boolean;
|
|
102
|
+
};
|
|
103
|
+
readonly receiptRules: readonly string[];
|
|
104
|
+
readonly blockedMutations: readonly string[];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface SetupServiceProbe {
|
|
108
|
+
readonly status: SetupServiceProbeStatus;
|
|
109
|
+
readonly endpointId: string;
|
|
110
|
+
readonly label: string;
|
|
111
|
+
readonly enabled: boolean;
|
|
112
|
+
readonly binding: string;
|
|
113
|
+
readonly diagnosticRoute: string;
|
|
114
|
+
readonly issues: readonly string[];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface SetupConnectedHostAuthPosture {
|
|
118
|
+
readonly owner: 'connected-host';
|
|
119
|
+
readonly operatorToken: {
|
|
120
|
+
readonly present: boolean;
|
|
121
|
+
readonly usable: boolean;
|
|
122
|
+
readonly path: string;
|
|
123
|
+
readonly fingerprint?: string;
|
|
124
|
+
readonly error?: string;
|
|
125
|
+
};
|
|
126
|
+
readonly compatibilityAuth: {
|
|
127
|
+
readonly userStorePath: string;
|
|
128
|
+
readonly userStorePresent: boolean;
|
|
129
|
+
readonly bootstrapCredentialPath: string;
|
|
130
|
+
readonly bootstrapCredentialPresent: boolean;
|
|
131
|
+
readonly users: number;
|
|
132
|
+
readonly sessions: number;
|
|
133
|
+
};
|
|
134
|
+
readonly routes: {
|
|
135
|
+
readonly reviewCommand: string;
|
|
136
|
+
readonly connectedHostStatus: string;
|
|
137
|
+
readonly pairingPosture: string;
|
|
138
|
+
readonly qrPairingRoute: string;
|
|
139
|
+
readonly manualTokenRoute: string;
|
|
140
|
+
readonly provisionTokenRoute: string;
|
|
141
|
+
readonly tokenProvisioningOwner: string;
|
|
142
|
+
readonly tokenProvisioningSource: string;
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface SetupInstallSmokeCheck {
|
|
147
|
+
readonly id: string;
|
|
148
|
+
readonly label: string;
|
|
149
|
+
readonly status: 'ready' | 'blocked' | 'user-run';
|
|
150
|
+
readonly evidence: string;
|
|
151
|
+
readonly route: string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export interface SetupInstallSmokePlan {
|
|
155
|
+
readonly status: 'ready-to-run' | 'blocked';
|
|
156
|
+
readonly source: string;
|
|
157
|
+
readonly checks: readonly SetupInstallSmokeCheck[];
|
|
158
|
+
readonly successCriteria: readonly string[];
|
|
159
|
+
readonly policy: string;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export interface SetupInstallSmokeRunSummary {
|
|
163
|
+
readonly ready: number;
|
|
164
|
+
readonly blocked: number;
|
|
165
|
+
readonly userRun: number;
|
|
166
|
+
readonly total: number;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface SetupSmokeEvidenceField {
|
|
170
|
+
readonly id: string;
|
|
171
|
+
readonly label: string;
|
|
172
|
+
readonly value: string;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface SetupBootstrapStep {
|
|
176
|
+
readonly id: string;
|
|
177
|
+
readonly label: string;
|
|
178
|
+
readonly purpose: string;
|
|
179
|
+
readonly commands: readonly string[];
|
|
180
|
+
readonly expected: string;
|
|
181
|
+
readonly fallback?: string;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export interface SetupBootstrapPlan {
|
|
185
|
+
readonly status: 'recommended' | 'optional';
|
|
186
|
+
readonly source: string;
|
|
187
|
+
readonly recommendedWhen: string;
|
|
188
|
+
readonly steps: readonly SetupBootstrapStep[];
|
|
189
|
+
readonly reconnectRoutes: Record<string, string>;
|
|
190
|
+
readonly policy: string;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export interface SetupHandoffCard {
|
|
194
|
+
readonly id: string;
|
|
195
|
+
readonly label: string;
|
|
196
|
+
readonly kind: SetupHandoffKind;
|
|
197
|
+
readonly effect: SetupHandoffEffect;
|
|
198
|
+
readonly userRoute: string;
|
|
199
|
+
readonly modelRoute: string;
|
|
200
|
+
readonly nextStep: string;
|
|
201
|
+
readonly safety: string;
|
|
202
|
+
readonly requiresConfirmation?: boolean;
|
|
203
|
+
readonly prerequisite?: string;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export interface SetupRepairDecision {
|
|
207
|
+
readonly id: string;
|
|
208
|
+
readonly label: string;
|
|
209
|
+
readonly status: 'inspect-first' | 'ready' | 'confirmed-repair-available' | 'user-run-bootstrap';
|
|
210
|
+
readonly effect: SetupHandoffEffect;
|
|
211
|
+
readonly modelRoute: string;
|
|
212
|
+
readonly userRoute: string;
|
|
213
|
+
readonly nextStep: string;
|
|
214
|
+
readonly reason: string;
|
|
215
|
+
readonly safety: string;
|
|
216
|
+
readonly requiresConfirmation?: boolean;
|
|
217
|
+
readonly prerequisite?: string;
|
|
218
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { statSync } from 'node:fs';
|
|
2
|
+
import { buildProviderAccountSnapshot } from '../panels/provider-account-snapshot.ts';
|
|
3
|
+
import { requireLocalUserAuthManager, requirePlatform, requireProvider, requireSecretsManager, requireServiceRegistry, requireShellPaths, requireSubscriptionManager } from '../input/commands/runtime-services.ts';
|
|
4
|
+
import { collectOnboardingSnapshot } from '../runtime/onboarding/index.ts';
|
|
5
|
+
import type { CommandContext } from '../input/command-registry.ts';
|
|
6
|
+
import { buildCliServicePosture, type CliServicePosture } from '../cli/service-posture.ts';
|
|
7
|
+
import type { AgentHarnessSetupArgs, SetupLookupSource, SetupPlanStatus, SurfaceRegistryLike, SetupSmokeArtifactStore } from './agent-harness-setup-posture-types.ts';
|
|
8
|
+
import type { OnboardingStep1CapabilityItem } from '../runtime/onboarding/index.ts';
|
|
9
|
+
|
|
10
|
+
export function readString(value: unknown): string {
|
|
11
|
+
return typeof value === 'string' ? value.trim() : '';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function readRecord(value: unknown): Record<string, unknown> {
|
|
15
|
+
return value && typeof value === 'object' ? value as Record<string, unknown> : {};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function readStringArray(value: unknown): readonly string[] {
|
|
19
|
+
return Array.isArray(value) ? value.map((entry) => readString(entry)).filter(Boolean) : [];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function readFieldMap(value: unknown): Readonly<Record<string, string>> {
|
|
23
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) return {};
|
|
24
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, typeof entry === 'string' ? entry : String(entry)]));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function readLimit(value: unknown, fallback: number): number {
|
|
28
|
+
const parsed = typeof value === 'string' && value.trim() ? Number(value) : value;
|
|
29
|
+
if (typeof parsed !== 'number' || !Number.isFinite(parsed)) return fallback;
|
|
30
|
+
return Math.max(1, Math.min(500, Math.trunc(parsed)));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function quoteRouteValue(value: string): string {
|
|
34
|
+
return value.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function operatorMethodRoute(methodId: string, confirmed: boolean): string {
|
|
38
|
+
return `agent_operator_method methodId:"${quoteRouteValue(methodId)}" input:{}${confirmed ? ' confirm:true explicitUserRequest:"..."' : ''}`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function safeIso(value: number | null | undefined): string | null {
|
|
42
|
+
if (typeof value !== 'number' || !Number.isFinite(value)) return null;
|
|
43
|
+
return new Date(value).toISOString();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function provisionConnectedHostTokenRoute(): string {
|
|
47
|
+
return 'setup action:"token" setupItemId:"connected-host-auth" confirm:true explicitUserRequest:"..."';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function safeFileMode(path: string): string | null {
|
|
51
|
+
try {
|
|
52
|
+
return `0${(statSync(path).mode & 0o777).toString(8)}`;
|
|
53
|
+
} catch {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function setupSmokeArtifactStore(context: CommandContext): SetupSmokeArtifactStore | null {
|
|
59
|
+
const candidate = (context.platform as { readonly artifactStore?: unknown }).artifactStore;
|
|
60
|
+
if (candidate && typeof candidate === 'object') {
|
|
61
|
+
return candidate as SetupSmokeArtifactStore;
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function surfaceRegistry(context: CommandContext): SurfaceRegistryLike | undefined {
|
|
67
|
+
const candidate = (context.platform as { readonly surfaceRegistry?: unknown }).surfaceRegistry;
|
|
68
|
+
if (candidate && typeof candidate === 'object' && 'syncConfiguredSurfaces' in candidate) {
|
|
69
|
+
return candidate as SurfaceRegistryLike;
|
|
70
|
+
}
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function setupServiceRuntime(context: CommandContext) {
|
|
75
|
+
const shellPaths = requireShellPaths(context);
|
|
76
|
+
return {
|
|
77
|
+
configManager: requirePlatform(context).configManager,
|
|
78
|
+
workingDirectory: shellPaths.workingDirectory,
|
|
79
|
+
homeDirectory: shellPaths.homeDirectory,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export async function collectServicePosture(context: CommandContext): Promise<CliServicePosture | null> {
|
|
84
|
+
try {
|
|
85
|
+
return await buildCliServicePosture(setupServiceRuntime(context), {
|
|
86
|
+
probe: true,
|
|
87
|
+
logTailBytes: 0,
|
|
88
|
+
});
|
|
89
|
+
} catch {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export async function collectSnapshot(context: CommandContext) {
|
|
95
|
+
const registry = surfaceRegistry(context);
|
|
96
|
+
return await collectOnboardingSnapshot({
|
|
97
|
+
config: requirePlatform(context).configManager,
|
|
98
|
+
shellPaths: requireShellPaths(context),
|
|
99
|
+
acknowledgementScope: 'project',
|
|
100
|
+
subscriptions: requireSubscriptionManager(context),
|
|
101
|
+
secrets: requireSecretsManager(context),
|
|
102
|
+
auth: requireLocalUserAuthManager(context),
|
|
103
|
+
services: requireServiceRegistry(context),
|
|
104
|
+
...(registry ? {
|
|
105
|
+
surfaces: {
|
|
106
|
+
list: () => registry.syncConfiguredSurfaces(),
|
|
107
|
+
},
|
|
108
|
+
} : {}),
|
|
109
|
+
providerAccounts: {
|
|
110
|
+
loadSnapshot: () => buildProviderAccountSnapshot({
|
|
111
|
+
providerModels: requireProvider(context).providerRegistry,
|
|
112
|
+
services: requireServiceRegistry(context),
|
|
113
|
+
subscriptions: requireSubscriptionManager(context),
|
|
114
|
+
environment: {
|
|
115
|
+
hasEnvironmentVariable: (name: string) => Boolean(process.env[name]),
|
|
116
|
+
},
|
|
117
|
+
}),
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function lookupFromArgs(args: AgentHarnessSetupArgs): { readonly source: SetupLookupSource; readonly input: string } | null {
|
|
123
|
+
const setupItemId = readString(args.setupItemId);
|
|
124
|
+
if (setupItemId) return { source: 'setupItemId', input: setupItemId };
|
|
125
|
+
const target = readString(args.target);
|
|
126
|
+
if (target) return { source: 'target', input: target };
|
|
127
|
+
const query = readString(args.query);
|
|
128
|
+
return query ? { source: 'query', input: query } : null;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function itemSearchText(item: OnboardingStep1CapabilityItem): string {
|
|
132
|
+
return [
|
|
133
|
+
item.id,
|
|
134
|
+
item.label,
|
|
135
|
+
item.detail,
|
|
136
|
+
item.selected ? 'selected ready configured enabled' : 'optional attention unselected',
|
|
137
|
+
].join('\n').toLowerCase();
|
|
138
|
+
}
|
|
139
|
+
export function summarizeLocalBehavior(snapshot: Awaited<ReturnType<typeof collectSnapshot>>): Record<string, unknown> {
|
|
140
|
+
const discovery = snapshot.localBehaviorDiscovery;
|
|
141
|
+
return {
|
|
142
|
+
personas: discovery.personas,
|
|
143
|
+
skills: discovery.skills,
|
|
144
|
+
routines: discovery.routines,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export function setupProviderSignalIds(snapshot: Awaited<ReturnType<typeof collectSnapshot>>): readonly string[] {
|
|
149
|
+
return [...new Set<string>([
|
|
150
|
+
...(snapshot.providerAccounts?.providers ?? [])
|
|
151
|
+
.filter((provider) => provider.activeRoute !== 'unconfigured' || provider.oauthReady || provider.pendingLogin)
|
|
152
|
+
.map((provider) => provider.providerId),
|
|
153
|
+
...snapshot.services.oauthProviderIds,
|
|
154
|
+
...snapshot.services.services
|
|
155
|
+
.filter((service) => service.hasPrimaryCredential || service.hasPasswordCredential)
|
|
156
|
+
.map((service) => service.providerId),
|
|
157
|
+
...snapshot.subscriptions.activeProviderIds,
|
|
158
|
+
...snapshot.subscriptions.pendingProviderIds,
|
|
159
|
+
])].sort((left, right) => left.localeCompare(right));
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export function capabilityById(items: readonly OnboardingStep1CapabilityItem[], id: OnboardingStep1CapabilityItem['id']): OnboardingStep1CapabilityItem {
|
|
163
|
+
const item = items.find((candidate) => candidate.id === id);
|
|
164
|
+
if (!item) throw new Error(`Missing onboarding capability ${id}`);
|
|
165
|
+
return item;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export function setupPlanStatusForCapability(
|
|
169
|
+
item: OnboardingStep1CapabilityItem,
|
|
170
|
+
fallback: Exclude<SetupPlanStatus, 'check' | 'ready'>,
|
|
171
|
+
): SetupPlanStatus {
|
|
172
|
+
return item.selected ? 'ready' : fallback;
|
|
173
|
+
}
|