@quantiya/codevibe-core 2.0.6 → 2.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/dist/agy-cli-contract.d.ts +14 -0
- package/dist/appsync/appsync-client.d.ts +59 -31
- package/dist/appsync/event-throttle.d.ts +33 -0
- package/dist/appsync/index.d.ts +3 -2
- package/dist/appsync/queries.d.ts +4 -2
- package/dist/auth/auth-telemetry.d.ts +26 -0
- package/dist/auth/vendor-key-cli.d.ts +49 -0
- package/dist/companion-mode/index.d.ts +36 -22
- package/dist/companion-mode/persist-preference.d.ts +1 -5
- package/dist/companion-mode/resolve-agent.d.ts +5 -4
- package/dist/config/config.d.ts +0 -5
- package/dist/credential-broker/__tests__/upstream-result-helpers.d.ts +21 -0
- package/dist/credential-broker/broker.d.ts +196 -12
- package/dist/credential-broker/chatgpt-config.d.ts +40 -0
- package/dist/credential-broker/index.d.ts +4 -1
- package/dist/credential-broker/oauth-account-lock.d.ts +104 -0
- package/dist/credential-broker/oauth-refresh.d.ts +72 -0
- package/dist/credential-broker/types.d.ts +165 -17
- package/dist/credential-broker/upstream-client.d.ts +3 -2
- package/dist/credential-broker/vendor-key-store.d.ts +32 -1
- package/dist/crypto/__tests__/encrypt-for-emit.test.d.ts +1 -0
- package/dist/crypto/encrypt-for-emit.d.ts +39 -0
- package/dist/crypto/index.d.ts +2 -0
- package/dist/daemon/__tests__/process-guards.test.d.ts +1 -0
- package/dist/daemon/index.d.ts +2 -0
- package/dist/daemon/process-guards.d.ts +38 -0
- package/dist/index.d.ts +17 -2
- package/dist/index.js +308 -281
- package/dist/keychain/keychain-manager.d.ts +25 -4
- package/dist/local-executor/__tests__/reviewer-rationale-flag.test.d.ts +1 -0
- package/dist/local-executor/class-a-sign.d.ts +15 -0
- package/dist/local-executor/group-decision-outcome.d.ts +11 -0
- package/dist/local-executor/implementor-argv.d.ts +89 -7
- package/dist/local-executor/local-executor-impl.d.ts +18 -7
- package/dist/local-executor/merge-conflict-resolve.d.ts +19 -0
- package/dist/local-executor/revert-reconcile.d.ts +12 -0
- package/dist/local-executor/reviewer-rationale-flag.d.ts +10 -0
- package/dist/local-executor/types.d.ts +1 -0
- package/dist/local-model/manager.d.ts +1 -1
- package/dist/local-model/ollama.d.ts +40 -0
- package/dist/orchestration/__tests__/detect-agents.test.d.ts +1 -0
- package/dist/orchestration/detect-agents.d.ts +10 -30
- package/dist/orchestration/index.d.ts +1 -2
- package/dist/orchestration-shell/__tests__/a1a-planner-offers.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/a6-cli-surface.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/advisory-attachments-dir-race.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/advisory-multi-mention-panel.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/advisory-panel-attachments.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/advisory-quota-stdout-result.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/agent-turn-context-batch.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/bounded-shutdown.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/brainstorm-quorum-wiring.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/brainstorm-quorum.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cli-team-session-key.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/command-intent.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/context-compaction.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/context-items-hosted-sync.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/context-items-wiring.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/context-items.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cp8-full-team-events.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/cp8-team-decomposed-zk.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/explicit-tty-exit.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/mention-suggest.test.d.ts +1 -0
- package/dist/orchestration-shell/__tests__/route-browse-summarize-recovery.test.d.ts +1 -0
- package/dist/orchestration-shell/attachments.d.ts +58 -2
- package/dist/orchestration-shell/bounded-shutdown.d.ts +16 -0
- package/dist/orchestration-shell/brainstorm-quorum.d.ts +118 -0
- package/dist/orchestration-shell/cli.d.ts +97 -70
- package/dist/orchestration-shell/cli.js +30990 -22426
- package/dist/orchestration-shell/command-intent.d.ts +56 -0
- package/dist/orchestration-shell/components/InputBar.d.ts +6 -0
- package/dist/orchestration-shell/components/OrchestrationApp.d.ts +2 -0
- package/dist/orchestration-shell/context-compaction.d.ts +264 -0
- package/dist/orchestration-shell/context-items-hosted-sync.d.ts +19 -0
- package/dist/orchestration-shell/context-items.d.ts +408 -0
- package/dist/orchestration-shell/context-store.d.ts +162 -0
- package/dist/orchestration-shell/emit-shell-event.d.ts +34 -13
- package/dist/orchestration-shell/explicit-tty-exit.d.ts +18 -0
- package/dist/orchestration-shell/gate-prompts.d.ts +3 -3
- package/dist/orchestration-shell/index.d.ts +306 -37
- package/dist/orchestration-shell/mention-suggest.d.ts +11 -0
- package/dist/orchestration-shell/mode-selection.d.ts +4 -22
- package/dist/orchestration-shell/quorum-loop.d.ts +336 -20
- package/dist/orchestration-shell/task-progress.d.ts +2 -0
- package/dist/orchestration-shell/team-decompose.d.ts +37 -19
- package/dist/orchestration-shell/types.d.ts +71 -4
- package/dist/planner/index.d.ts +1 -1
- package/dist/planner/local-advisory.d.ts +12 -0
- package/dist/planner/local-gemma.d.ts +27 -0
- package/dist/planner/types.d.ts +7 -0
- package/dist/reviewer/index.d.ts +0 -2
- package/dist/reviewer/provider.d.ts +9 -6
- package/dist/reviewer/providers/antigravity.d.ts +2 -3
- package/dist/reviewer/registry.d.ts +9 -4
- package/dist/reviewer/token-usage.d.ts +10 -0
- package/dist/session/__tests__/device-registration-lease.test.d.ts +1 -0
- package/dist/session/__tests__/pending-session-create.test.d.ts +1 -0
- package/dist/session/__tests__/session-rekey-fingerprint.test.d.ts +1 -0
- package/dist/session/__tests__/session-resume-key-reconciliation.test.d.ts +1 -0
- package/dist/session/__tests__/session-resume-pending-first.test.d.ts +1 -0
- package/dist/session/device-key-watcher.d.ts +1 -0
- package/dist/session/index.d.ts +4 -2
- package/dist/session/pending-session-create.d.ts +61 -0
- package/dist/session/register-device-key.d.ts +11 -1
- package/dist/session/session-rekey.d.ts +4 -5
- package/dist/session/session-resume.d.ts +21 -1
- package/dist/substrate/docker.d.ts +7 -0
- package/dist/substrate/sandbox-exec.d.ts +17 -3
- package/dist/substrate/types.d.ts +32 -3
- package/dist/substrate-launch/apikey-bootstrap.d.ts +24 -1
- package/dist/substrate-launch/engage-substrate.d.ts +17 -0
- package/dist/substrate-launch/sanitized-env.d.ts +5 -5
- package/dist/tool-activity/__tests__/consolidator.test.d.ts +1 -0
- package/dist/tool-activity/__tests__/digest.test.d.ts +1 -0
- package/dist/tool-activity/__tests__/flock-rollout-lock.test.d.ts +1 -0
- package/dist/tool-activity/__tests__/ledger.test.d.ts +1 -0
- package/dist/tool-activity/__tests__/outbox.test.d.ts +1 -0
- package/dist/tool-activity/__tests__/replay-cursor.test.d.ts +1 -0
- package/dist/tool-activity/__tests__/session-map.test.d.ts +1 -0
- package/dist/tool-activity/__tests__/socket-rollout-lock.test.d.ts +1 -0
- package/dist/tool-activity/atomic-file.d.ts +27 -0
- package/dist/tool-activity/consolidator.d.ts +253 -0
- package/dist/tool-activity/digest.d.ts +4 -0
- package/dist/tool-activity/flock-rollout-lock.d.ts +68 -0
- package/dist/tool-activity/index.d.ts +9 -0
- package/dist/tool-activity/ledger.d.ts +274 -0
- package/dist/tool-activity/outbox.d.ts +60 -0
- package/dist/tool-activity/replay-cursor.d.ts +156 -0
- package/dist/tool-activity/session-map.d.ts +133 -0
- package/dist/tool-activity/socket-rollout-lock.d.ts +57 -0
- package/dist/tool-activity/types.d.ts +368 -0
- package/dist/types/encryption.d.ts +4 -0
- package/dist/types/events.d.ts +24 -4
- package/dist/types/session.d.ts +32 -2
- package/package.json +5 -4
- package/dist/orchestration/orchestration-cli.d.ts +0 -12
- package/dist/orchestration/setup-bootstrap.d.ts +0 -146
- package/dist/orchestration/setup-failure-recourse.d.ts +0 -23
- package/dist/orchestration/setup-save.d.ts +0 -47
- package/dist/orchestration/setup-seat-picker.d.ts +0 -72
- package/dist/orchestration/setup-telemetry.d.ts +0 -54
- package/dist/orchestration/setup-test-agents.d.ts +0 -108
- package/dist/orchestration/setup-types.d.ts +0 -146
- package/dist/orchestration/setup-wizard.d.ts +0 -57
- package/dist/orchestration-shell/cohort-flag.d.ts +0 -16
- package/dist/reviewer/providers/gemini.d.ts +0 -109
- /package/dist/{companion-mode/__tests__/detect-parallel.test.d.ts → appsync/__tests__/appsync-client-context-items.test.d.ts} +0 -0
- /package/dist/{orchestration-shell/__tests__/cli-stub-session-adapter.test.d.ts → appsync/__tests__/heartbeat-active.test.d.ts} +0 -0
- /package/dist/{orchestration/__tests__/setup-bootstrap.test.d.ts → appsync/__tests__/orphan-sweep-null-heartbeat.test.d.ts} +0 -0
- /package/dist/{orchestration/__tests__/setup-failure-recourse.test.d.ts → auth/__tests__/vendor-key-cli.test.d.ts} +0 -0
- /package/dist/{orchestration/__tests__/setup-save.test.d.ts → companion-mode/__tests__/mode-selected-emit.test.d.ts} +0 -0
- /package/dist/{orchestration/__tests__/setup-seat-picker.test.d.ts → companion-mode/__tests__/private-launcher-detection.test.d.ts} +0 -0
- /package/dist/{orchestration/__tests__/setup-telemetry.test.d.ts → companion-mode/__tests__/private-launcher-path.test.d.ts} +0 -0
- /package/dist/{orchestration/__tests__/setup-test-agents.test.d.ts → credential-broker/__tests__/broker-c4.test.d.ts} +0 -0
- /package/dist/{orchestration/__tests__/setup-types.test.d.ts → credential-broker/__tests__/broker-streaming.test.d.ts} +0 -0
- /package/dist/{orchestration/__tests__/setup-wizard.test.d.ts → credential-broker/__tests__/chatgpt-config.test.d.ts} +0 -0
- /package/dist/{reviewer/providers/__tests__/gemini-live-smoke.test.d.ts → credential-broker/__tests__/oauth-account-lock.test.d.ts} +0 -0
- /package/dist/{reviewer/providers/__tests__/gemini.test.d.ts → credential-broker/__tests__/oauth-refresh.test.d.ts} +0 -0
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { AppSyncClient } from '../appsync/appsync-client.js';
|
|
2
|
-
import { DetectableAgent } from './detect-agents.js';
|
|
3
|
-
import { CountBucket, WizardEntry, WizardTier } from './setup-types.js';
|
|
4
|
-
import type { AgentKind } from '../reviewer/types.js';
|
|
5
|
-
import type { UserReviewerPolicySnapshot } from '../types/reviewer.js';
|
|
6
|
-
/**
|
|
7
|
-
* Thrown by `defaultClientFactory` when `authenticateWithStoredTokens`
|
|
8
|
-
* returns false AND the most recent failure kind is `'refresh_network'`
|
|
9
|
-
* (transient 5xx / DNS / socket-reset during the Cognito refresh-token
|
|
10
|
-
* POST). The wizard's `runBootstrap` catch routes this to
|
|
11
|
-
* `subscription_status_network` — same recourse as
|
|
12
|
-
* `getSubscriptionStatus` blowing up, but distinct from a genuine
|
|
13
|
-
* `not_signed_in` (which we still surface as `not_signed_in` so the
|
|
14
|
-
* user is told to re-authenticate).
|
|
15
|
-
*
|
|
16
|
-
* Stage 2 round-1 Codex M1. The error message is intentionally
|
|
17
|
-
* network-shaped so the existing `isNetworkLikeError(message)` regex
|
|
18
|
-
* also matches — defense in depth in case a future caller throws this
|
|
19
|
-
* outside the bootstrap path.
|
|
20
|
-
*/
|
|
21
|
-
export declare class AuthRefreshNetworkError extends Error {
|
|
22
|
-
constructor(cause: string);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Successful bootstrap output. The wizard's state machine consumes
|
|
26
|
-
* this to seed Step 1 (seat assignment).
|
|
27
|
-
*
|
|
28
|
-
* R1/R2 round-1 finding M1+L3+M6 (resolved 2026-05-08): the
|
|
29
|
-
* authenticated `client` and the user's `email` are exposed here so
|
|
30
|
-
* the wizard can render `✓ Signed in as <email>` per design §1
|
|
31
|
-
* lines 47-50 and avoid double-authenticating before save.
|
|
32
|
-
*/
|
|
33
|
-
export interface BootstrapResult {
|
|
34
|
-
tier: WizardTier;
|
|
35
|
-
/** Pro=2, Max=3. Free can't reach success (tier-gated above). */
|
|
36
|
-
seatBudget: number;
|
|
37
|
-
/** Lower-cased agent kinds detected on PATH, in canonical order. */
|
|
38
|
-
installedAgents: AgentKind[];
|
|
39
|
-
/** Pre-bucketed for telemetry; saved here so Step 1's emit doesn't recompute. */
|
|
40
|
-
installedAgentsBucket: CountBucket;
|
|
41
|
-
/**
|
|
42
|
-
* The authenticated AppSyncClient. Wizard reuses this for the save
|
|
43
|
-
* step rather than re-running `authenticateWithStoredTokens()` —
|
|
44
|
-
* eliminates the auth-evicted-between-bootstrap-and-save telemetry
|
|
45
|
-
* gap (R1 round-1 M1) and the wasteful double-auth (R1 round-1 L3).
|
|
46
|
-
*/
|
|
47
|
-
client: AppSyncClient;
|
|
48
|
-
/**
|
|
49
|
-
* Email of the signed-in user (Cognito `email` claim), or null if
|
|
50
|
-
* the claim is not present. Used by the wizard's bootstrap-summary
|
|
51
|
-
* UI per design §1 lines 47-50.
|
|
52
|
-
*/
|
|
53
|
-
userEmail: string | null;
|
|
54
|
-
/**
|
|
55
|
-
* Stage 2 round-1 Codex M2: the user's saved reviewer policy at
|
|
56
|
-
* bootstrap time, so the wizard can pre-populate seat-picker
|
|
57
|
-
* defaults on a re-run instead of always falling back to the
|
|
58
|
-
* tier-default agent / role priority. `null` when the snapshot
|
|
59
|
-
* fetch failed (the wizard then proceeds without saved-defaults —
|
|
60
|
-
* the canonical priority order is the fallback).
|
|
61
|
-
*
|
|
62
|
-
* Fetched via the existing `updateAvailableAgents` mutation, which
|
|
63
|
-
* is idempotent + already called by every plugin startup
|
|
64
|
-
* (`appsync-client.ts:721-724`). The wizard repeating it is safe
|
|
65
|
-
* and avoids introducing a new wire contract just to read three
|
|
66
|
-
* fields back.
|
|
67
|
-
*/
|
|
68
|
-
savedPolicy: UserReviewerPolicySnapshot | null;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Failure shape — discriminated by `kind`. The wizard surfaces a
|
|
72
|
-
* user-facing message and exits with code 1; telemetry is fired by
|
|
73
|
-
* `runBootstrap()` before the result is returned (so callers don't
|
|
74
|
-
* re-fire on their failure path).
|
|
75
|
-
*/
|
|
76
|
-
export type BootstrapFailure = {
|
|
77
|
-
kind: 'tier_gate_free';
|
|
78
|
-
tier: 'FREE';
|
|
79
|
-
} | {
|
|
80
|
-
kind: 'not_signed_in';
|
|
81
|
-
} | {
|
|
82
|
-
kind: 'subscription_status_network';
|
|
83
|
-
cause: string;
|
|
84
|
-
} | {
|
|
85
|
-
kind: 'no_clis_installed';
|
|
86
|
-
};
|
|
87
|
-
export type BootstrapOutput = {
|
|
88
|
-
ok: true;
|
|
89
|
-
result: BootstrapResult;
|
|
90
|
-
} | {
|
|
91
|
-
ok: false;
|
|
92
|
-
failure: BootstrapFailure;
|
|
93
|
-
};
|
|
94
|
-
/**
|
|
95
|
-
* Inputs for `runBootstrap`. Threads the wizard run id through so
|
|
96
|
-
* telemetry events stitch by `wizard_run_id`.
|
|
97
|
-
*
|
|
98
|
-
* `clientFactory` is injected so tests can swap in a mock AppSync
|
|
99
|
-
* client; production passes `defaultClientFactory`.
|
|
100
|
-
*
|
|
101
|
-
* `agentDetector` defaults to `detectInstalledAgents` (the production
|
|
102
|
-
* PATH walk) but is swappable for unit tests.
|
|
103
|
-
*
|
|
104
|
-
* `entry` is threaded in so `runBootstrap` can fire `wizard_started`
|
|
105
|
-
* itself — Stage 2 round-1 Codex M3 moved the emit from the wizard
|
|
106
|
-
* (where it skipped Free / no_clis users) into bootstrap (where it
|
|
107
|
-
* fires post-tier-and-agents-known, before any gate).
|
|
108
|
-
*/
|
|
109
|
-
export interface BootstrapDeps {
|
|
110
|
-
wizardRunId: string;
|
|
111
|
-
clientFactory: () => Promise<AppSyncClient | null>;
|
|
112
|
-
agentDetector: () => DetectableAgent[];
|
|
113
|
-
entry: WizardEntry;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Production client factory. Builds an AppSyncClient and authenticates
|
|
117
|
-
* with stored tokens. Returns null on `'no_tokens'` /
|
|
118
|
-
* `'refresh_auth_rejected'` (the wizard maps both to `not_signed_in`);
|
|
119
|
-
* THROWS `AuthRefreshNetworkError` on `'refresh_network'` so the
|
|
120
|
-
* wizard's `runBootstrap` catch routes the user to
|
|
121
|
-
* `subscription_status_network` instead of mistakenly telling a
|
|
122
|
-
* signed-in user to re-login when their refresh-token POST hit a
|
|
123
|
-
* transient 5xx.
|
|
124
|
-
*
|
|
125
|
-
* Stage 2 round-1 Codex M1: pre-fix, `authenticateWithStoredTokens`
|
|
126
|
-
* returned false on every error path, including network failures
|
|
127
|
-
* inside `callCognitoRefresh`'s catch block; the bootstrap's
|
|
128
|
-
* `isNetworkLikeError` check only ran on caught throws and so never
|
|
129
|
-
* fired in production for refresh-network failures.
|
|
130
|
-
*/
|
|
131
|
-
export declare function defaultClientFactory(): Promise<AppSyncClient | null>;
|
|
132
|
-
/**
|
|
133
|
-
* Run Step 0. Emits `wizard_step_started{step:'bootstrap'}` on entry,
|
|
134
|
-
* then either `wizard_step_completed` on success OR
|
|
135
|
-
* `wizard_step_failed` + `wizard_aborted` on failure. Returns the
|
|
136
|
-
* `BootstrapOutput` in either case so the caller can render UX before
|
|
137
|
-
* exiting.
|
|
138
|
-
*
|
|
139
|
-
* Stage 2 round-1 Codex M3: `wizard_started` is emitted from here,
|
|
140
|
-
* post-tier-and-agents-known, BEFORE the tier-gate / no-CLIs check.
|
|
141
|
-
* Free + no_clis users now fire `wizard_started` (so analytics has
|
|
142
|
-
* the funnel-entry numerator); auth/network bootstrap-aborts skip
|
|
143
|
-
* `wizard_started` (no tier known) and surface as
|
|
144
|
-
* `wizard_aborted{auth_expired | bootstrap_failure}` instead.
|
|
145
|
-
*/
|
|
146
|
-
export declare function runBootstrap(deps: BootstrapDeps): Promise<BootstrapOutput>;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { PickerIO } from './setup-seat-picker.js';
|
|
2
|
-
export type Step2Choice = 'retry' | 'save_anyway' | 'exit';
|
|
3
|
-
export type Step3Choice = 'retry' | 'exit';
|
|
4
|
-
/**
|
|
5
|
-
* Render the Step 2 recourse menu after a Test My Agents failure.
|
|
6
|
-
* Loops on invalid input. Returns the user's choice. The caller is
|
|
7
|
-
* responsible for emitting `wizard_aborted` if `exit` is chosen.
|
|
8
|
-
*
|
|
9
|
-
* `canSaveAnyway` controls whether the `[s]` option is offered. When
|
|
10
|
-
* false (spawn_failure / timeout), only `[r]` and `[x]` are accepted.
|
|
11
|
-
*/
|
|
12
|
-
export declare function askStep2Recourse(io: PickerIO, canSaveAnyway: boolean): Promise<Step2Choice>;
|
|
13
|
-
/**
|
|
14
|
-
* Render the Step 3 recourse menu after a save failure. The caller's
|
|
15
|
-
* retry loop preserves the in-memory `seats` state so retry is free.
|
|
16
|
-
*
|
|
17
|
-
* `recoverable` honors the §6 outcome table: when false
|
|
18
|
-
* (auth_token_expired), `[r]` is suppressed because retry can only
|
|
19
|
-
* fail again — the user must re-run `codevibe login` and start a new
|
|
20
|
-
* wizard. The recourse menu collapses to a single `[x] exit` choice
|
|
21
|
-
* with a re-auth instruction line. (R1 round-1 M3 / R2 round-1 M4.)
|
|
22
|
-
*/
|
|
23
|
-
export declare function askStep3Recourse(io: PickerIO, recoverable?: boolean): Promise<Step3Choice>;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { AppSyncClient } from '../appsync/appsync-client.js';
|
|
2
|
-
import { WizardSeatPick, WizardStepFailureReason } from './setup-types.js';
|
|
3
|
-
export type SaveResult = {
|
|
4
|
-
ok: true;
|
|
5
|
-
} | {
|
|
6
|
-
ok: false;
|
|
7
|
-
reason: WizardStepFailureReason;
|
|
8
|
-
/**
|
|
9
|
-
* Whether `[r] retry` makes sense for this failure. Network /
|
|
10
|
-
* 5xx / throttle are retryable (transient). auth_token_expired
|
|
11
|
-
* is NOT retryable in-process — the user must re-run `codevibe
|
|
12
|
-
* login` and start a new wizard run.
|
|
13
|
-
*/
|
|
14
|
-
recoverable: boolean;
|
|
15
|
-
};
|
|
16
|
-
export interface SaveDeps {
|
|
17
|
-
wizardRunId: string;
|
|
18
|
-
client: AppSyncClient;
|
|
19
|
-
seats: WizardSeatPick[];
|
|
20
|
-
/**
|
|
21
|
-
* Whether the user reached this step via "save anyway" after a
|
|
22
|
-
* Test My Agents warning. Drives the wizard_completed.outcome
|
|
23
|
-
* value at the wizard's terminal exit (`'ok' | 'saved_after_test_warning'`).
|
|
24
|
-
* Not used here — Step 3 just persists; the top-level wizard
|
|
25
|
-
* threads the outcome value into the final `wizard_completed` event.
|
|
26
|
-
*/
|
|
27
|
-
savedAfterTestWarning: boolean;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Run Step 3. Emits `wizard_step_started{step:'save'}` on entry,
|
|
31
|
-
* `wizard_step_completed` on success, or `wizard_step_failed` with
|
|
32
|
-
* the classified reason. Returns a SaveResult the wizard's recourse
|
|
33
|
-
* loop consumes.
|
|
34
|
-
*/
|
|
35
|
-
export declare function runSave(deps: SaveDeps): Promise<SaveResult>;
|
|
36
|
-
/**
|
|
37
|
-
* Classify a thrown error from `updateReviewerPolicy` into one of the
|
|
38
|
-
* §7 save-step reason codes. Best-effort matching against the AppSync
|
|
39
|
-
* client's error message conventions:
|
|
40
|
-
* - 401 / "Unauthorized" / "Token expired" → auth_token_expired
|
|
41
|
-
* - 429 / "Throttling" / "Rate exceeded" → update_policy_throttle
|
|
42
|
-
* - 5xx / "Internal" / "InternalServerError" → update_policy_5xx
|
|
43
|
-
* - everything else (fetch threw, ECONNRESET, DNS) → update_policy_network
|
|
44
|
-
*
|
|
45
|
-
* Exposed for tests to assert classification mapping.
|
|
46
|
-
*/
|
|
47
|
-
export declare function classifySaveError(err: unknown): WizardStepFailureReason;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import * as readline from 'readline';
|
|
2
|
-
import { WizardSeatPick, WizardRole } from './setup-types.js';
|
|
3
|
-
import type { AgentKind } from '../reviewer/types.js';
|
|
4
|
-
/**
|
|
5
|
-
* One entry in the optional `savedSeats` array — the user's previously
|
|
6
|
-
* persisted reviewer policy, threaded in by the wizard on a re-run so
|
|
7
|
-
* the picker pre-fills per-seat agent + role defaults. Stage 2 round-1
|
|
8
|
-
* Codex M2.
|
|
9
|
-
*
|
|
10
|
-
* Stale entries (agent no longer installed, role not in
|
|
11
|
-
* `WIZARD_ROLES`, role already taken by a previous seat) are silently
|
|
12
|
-
* ignored — the picker falls back to the canonical priority defaults
|
|
13
|
-
* for that seat.
|
|
14
|
-
*/
|
|
15
|
-
export interface SavedSeatHint {
|
|
16
|
-
seatId: number;
|
|
17
|
-
agent: AgentKind;
|
|
18
|
-
role: WizardRole;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Reader/writer abstraction so tests can drive the picker with
|
|
22
|
-
* scripted answers instead of an interactive readline. Production
|
|
23
|
-
* passes a Node readline.Interface; tests pass a fake.
|
|
24
|
-
*/
|
|
25
|
-
export interface PickerIO {
|
|
26
|
-
/** Render a line to the user. No newline appended; pass '\n' if needed. */
|
|
27
|
-
write: (line: string) => void;
|
|
28
|
-
/** Prompt the user and return the trimmed answer (without trailing newline). */
|
|
29
|
-
ask: (prompt: string) => Promise<string>;
|
|
30
|
-
}
|
|
31
|
-
export interface SeatPickerDeps {
|
|
32
|
-
wizardRunId: string;
|
|
33
|
-
installedAgents: AgentKind[];
|
|
34
|
-
seatBudget: number;
|
|
35
|
-
io: PickerIO;
|
|
36
|
-
/**
|
|
37
|
-
* Optional per-seat hints from the user's saved reviewer policy
|
|
38
|
-
* (Stage 2 round-1 Codex M2). When present and valid (agent
|
|
39
|
-
* installed; role still available for that seat), the picker uses
|
|
40
|
-
* the hint as the default instead of the canonical
|
|
41
|
-
* AGENT_PRIORITY / DEFAULT_ROLE_BY_SEAT priority.
|
|
42
|
-
*
|
|
43
|
-
* Indexed by `seatId` (NOT array position) — the implementation
|
|
44
|
-
* looks up `savedSeats.find(s => s.seatId === seatId)` so absent /
|
|
45
|
-
* out-of-order entries are fine.
|
|
46
|
-
*/
|
|
47
|
-
savedSeats?: ReadonlyArray<SavedSeatHint>;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Run Step 1. Returns the user's per-seat picks. Caller is
|
|
51
|
-
* responsible for closing the readline interface.
|
|
52
|
-
*/
|
|
53
|
-
export declare function runSeatPicker(deps: SeatPickerDeps): Promise<WizardSeatPick[]>;
|
|
54
|
-
/**
|
|
55
|
-
* Default-role-fallback rule (PHASE-3-A-DESIGN.md §1). Seat 0 wants
|
|
56
|
-
* `architecture`, Seat 1 wants `correctness`, Seat 2 wants `security`.
|
|
57
|
-
* If the canonical pick is gone (taken by a previous seat), fall
|
|
58
|
-
* back to the first remaining role in canonical order.
|
|
59
|
-
*
|
|
60
|
-
* Stage 2 round-1 Codex M2: when `savedRole` is provided AND that
|
|
61
|
-
* role is in `WIZARD_ROLES` AND it's still in `availableRoles` (not
|
|
62
|
-
* taken by a previous seat), use it as the default instead of the
|
|
63
|
-
* canonical-default-by-seat priority. Stale saved values (role
|
|
64
|
-
* already taken, or a non-3-role value from a 2.0.x custom-roles
|
|
65
|
-
* future expansion) are silently ignored.
|
|
66
|
-
*/
|
|
67
|
-
export declare function pickDefaultRole(seatId: number, availableRoles: ReadonlyArray<WizardRole>, savedRole?: WizardRole): WizardRole;
|
|
68
|
-
/**
|
|
69
|
-
* Build a `PickerIO` from a Node readline interface. Production
|
|
70
|
-
* callers use this; tests construct their own `PickerIO` directly.
|
|
71
|
-
*/
|
|
72
|
-
export declare function readlinePickerIO(rl: readline.Interface): PickerIO;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { WizardStep, WizardStepFailureReason, WizardAbortReason, WizardEntry, WizardTier, CountBucket, LatencyBucket } from './setup-types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Generate a fresh `wizard_run_id` for one wizard invocation. Returned
|
|
4
|
-
* by `runSetupWizard()` entry and threaded into every emit call.
|
|
5
|
-
*
|
|
6
|
-
* v4 UUID — uses Node's crypto.randomUUID when available (Node 14.17+);
|
|
7
|
-
* otherwise falls back to a manual v4 derivation. Either path produces
|
|
8
|
-
* a 36-char hex-with-dashes string suitable for the GA4 custom-dimension
|
|
9
|
-
* `wizard_run_id` registered in `register-custom-dimensions.py`.
|
|
10
|
-
*/
|
|
11
|
-
export declare function newWizardRunId(): string;
|
|
12
|
-
export declare function emitWizardStarted(args: {
|
|
13
|
-
wizardRunId: string;
|
|
14
|
-
tier: WizardTier;
|
|
15
|
-
entry: WizardEntry;
|
|
16
|
-
installedAgentsBucket: CountBucket;
|
|
17
|
-
}): Promise<void>;
|
|
18
|
-
export declare function emitWizardStepStarted(args: {
|
|
19
|
-
wizardRunId: string;
|
|
20
|
-
step: WizardStep;
|
|
21
|
-
}): Promise<void>;
|
|
22
|
-
export declare function emitWizardStepCompleted(args: {
|
|
23
|
-
wizardRunId: string;
|
|
24
|
-
step: WizardStep;
|
|
25
|
-
latencyBucket: LatencyBucket;
|
|
26
|
-
}): Promise<void>;
|
|
27
|
-
export declare function emitWizardStepFailed(args: {
|
|
28
|
-
wizardRunId: string;
|
|
29
|
-
step: WizardStep;
|
|
30
|
-
reason: WizardStepFailureReason;
|
|
31
|
-
latencyBucket: LatencyBucket;
|
|
32
|
-
}): Promise<void>;
|
|
33
|
-
export declare function emitWizardCompleted(args: {
|
|
34
|
-
wizardRunId: string;
|
|
35
|
-
outcome: 'ok' | 'saved_after_test_warning';
|
|
36
|
-
tier: WizardTier;
|
|
37
|
-
seatsBucket: CountBucket;
|
|
38
|
-
agentsDistinctBucket: CountBucket;
|
|
39
|
-
rolesDistinctBucket: CountBucket;
|
|
40
|
-
totalLatencyBucket: LatencyBucket;
|
|
41
|
-
}): Promise<void>;
|
|
42
|
-
export declare function emitWizardAborted(args: {
|
|
43
|
-
wizardRunId: string;
|
|
44
|
-
reason: WizardAbortReason;
|
|
45
|
-
lastStep: WizardStep;
|
|
46
|
-
}): Promise<void>;
|
|
47
|
-
type BeaconRecord = {
|
|
48
|
-
name: string;
|
|
49
|
-
params: Record<string, string | number>;
|
|
50
|
-
};
|
|
51
|
-
type BeaconSink = (record: BeaconRecord) => void;
|
|
52
|
-
export declare function __setBeaconSink(sink: BeaconSink): void;
|
|
53
|
-
export declare function __resetBeaconSink(): void;
|
|
54
|
-
export {};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { WizardSeatPick, WizardStepFailureReason } from './setup-types.js';
|
|
2
|
-
import type { ReviewerSpec, ReviewerVerdict } from '../reviewer/index.js';
|
|
3
|
-
/**
|
|
4
|
-
* Canned proposal — byte-identical across all installations. Locked
|
|
5
|
-
* 2026-05-03 per PHASE-3-A-DESIGN.md §3. Do NOT edit without going
|
|
6
|
-
* through a re-review of the entire Test My Agents protocol; the
|
|
7
|
-
* prose is part of the wizard's contract test surface (the new-contract
|
|
8
|
-
* row at PHASE-3-A-DESIGN.md:495 asserts byte-identicality).
|
|
9
|
-
*
|
|
10
|
-
* The proposal is intentionally trivial + read-only. The wizard does
|
|
11
|
-
* NOT actually create /tmp/quorum_test_hello.py — APPROVE is the
|
|
12
|
-
* expected outcome from a working reviewer.
|
|
13
|
-
*/
|
|
14
|
-
export declare const CANNED_PROPOSAL = "## Problem\nAdd a one-line Python \"Hello, World\" script to a new file.\n\n## Proposal\nCreate a single Python file at /tmp/quorum_test_hello.py containing the\nsingle line: print(\"hello world\")\n\n## Implementation Plan\n1. Create the file at /tmp/quorum_test_hello.py\n2. Write print(\"hello world\") on line 1 followed by a trailing newline\n3. Make no other changes\n\n## Expected Outputs\n- /tmp/quorum_test_hello.py \u2014 exists, contains the single-line script\n";
|
|
15
|
-
/**
|
|
16
|
-
* Per-seat timeout. PHASE-3-A-DESIGN.md §6 "Timeout (60s/seat)".
|
|
17
|
-
* Conservative — gives a slow CLI room to start + respond on a
|
|
18
|
-
* cold-spawned reviewer process. Shorter would pollute the failure
|
|
19
|
-
* recourse menu with false positives on first-run latency.
|
|
20
|
-
*/
|
|
21
|
-
export declare const PER_SEAT_TIMEOUT_MS = 60000;
|
|
22
|
-
/**
|
|
23
|
-
* Per-seat outcome rendered by the wizard. Returned by
|
|
24
|
-
* `runTestMyAgents` in the `seatOutcomes` array so the recourse menu
|
|
25
|
-
* can display each seat's status individually (per §3 "per-seat
|
|
26
|
-
* outputs ... are tagged with the seat ID and rendered together").
|
|
27
|
-
*/
|
|
28
|
-
export interface SeatOutcome {
|
|
29
|
-
seatId: number;
|
|
30
|
-
agent: WizardSeatPick['agent'];
|
|
31
|
-
role: WizardSeatPick['role'];
|
|
32
|
-
/** Wall-clock seconds elapsed for this seat's evaluate() call. */
|
|
33
|
-
elapsedSeconds: number;
|
|
34
|
-
/** Discriminated outcome — APPROVE plus the 6 failure shapes. */
|
|
35
|
-
result: {
|
|
36
|
-
kind: 'approve';
|
|
37
|
-
} | {
|
|
38
|
-
kind: 'revise';
|
|
39
|
-
} | {
|
|
40
|
-
kind: 'reject';
|
|
41
|
-
} | {
|
|
42
|
-
kind: 'escalate';
|
|
43
|
-
} | {
|
|
44
|
-
kind: 'parse_failure';
|
|
45
|
-
} | {
|
|
46
|
-
kind: 'spawn_failure';
|
|
47
|
-
reason: string;
|
|
48
|
-
} | {
|
|
49
|
-
kind: 'timeout';
|
|
50
|
-
elapsedMs: number;
|
|
51
|
-
} | {
|
|
52
|
-
kind: 'unknown_error';
|
|
53
|
-
message: string;
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
export type TestMyAgentsResult = {
|
|
57
|
-
ok: true;
|
|
58
|
-
seatOutcomes: SeatOutcome[];
|
|
59
|
-
} | {
|
|
60
|
-
ok: false;
|
|
61
|
-
reason: WizardStepFailureReason;
|
|
62
|
-
canSaveAnyway: boolean;
|
|
63
|
-
seatOutcomes: SeatOutcome[];
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* Inputs for `runTestMyAgents`. The registry factory is injected so
|
|
67
|
-
* tests can swap in a mock; production passes
|
|
68
|
-
* `createSubprocessReviewerRegistry`.
|
|
69
|
-
*/
|
|
70
|
-
export interface TestMyAgentsDeps {
|
|
71
|
-
wizardRunId: string;
|
|
72
|
-
seats: WizardSeatPick[];
|
|
73
|
-
registryFactory?: () => {
|
|
74
|
-
evaluate: (spec: ReviewerSpec, gateId: string) => Promise<ReviewerVerdict>;
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* Status renderer. Tests pass a buffer; production passes a function
|
|
78
|
-
* that writes to process.stdout. Each call gets one line (no
|
|
79
|
-
* trailing newline added — caller controls).
|
|
80
|
-
*/
|
|
81
|
-
write?: (line: string) => void;
|
|
82
|
-
/**
|
|
83
|
-
* Test seam: a synthetic gateId. Phase 3.a's wizard is wholly
|
|
84
|
-
* client-side (PHASE-3-A-DESIGN.md §5 "Wizard never spawns through
|
|
85
|
-
* OrchestrationClient.connect()"), so the gateId is a local
|
|
86
|
-
* synthetic UUID — providers echo it back on the verdict but the
|
|
87
|
-
* wizard does not persist it. Tests can pin a known value.
|
|
88
|
-
*/
|
|
89
|
-
gateId?: string;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Run Step 2. Emits `wizard_step_started`, dispatches all seats in
|
|
93
|
-
* parallel via Promise.allSettled, classifies each outcome, emits
|
|
94
|
-
* `wizard_step_completed` (all APPROVE) or `wizard_step_failed` with
|
|
95
|
-
* the worst-blocker reason. Returns per-seat outcomes for the
|
|
96
|
-
* wizard's recourse renderer.
|
|
97
|
-
*/
|
|
98
|
-
export declare function runTestMyAgents(deps: TestMyAgentsDeps): Promise<TestMyAgentsResult>;
|
|
99
|
-
/**
|
|
100
|
-
* Render a per-failure-kind explanatory sentence per the §6 outcome
|
|
101
|
-
* table + §1 line 140 "Display the structured error describing what
|
|
102
|
-
* failed" requirement. The wizard prints this before the recourse
|
|
103
|
-
* menu so users see WHY each non-APPROVE seat failed, not just a
|
|
104
|
-
* status line.
|
|
105
|
-
*
|
|
106
|
-
* R1 round-1 M3 (resolved 2026-05-08).
|
|
107
|
-
*/
|
|
108
|
-
export declare function humanizeStep2Failures(outcomes: SeatOutcome[]): string[];
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import type { ReviewerRole as PolicyReviewerRole } from '../reviewer/types.js';
|
|
2
|
-
import type { AgentKind } from '../reviewer/types.js';
|
|
3
|
-
import { ReviewerRole as SchemaReviewerRole } from '../types/reviewer.js';
|
|
4
|
-
/**
|
|
5
|
-
* Tier returned by `getSubscriptionStatus`. Drives seat budget +
|
|
6
|
-
* tier-gate at bootstrap.
|
|
7
|
-
*
|
|
8
|
-
* UPPERCASE wire format matches `codevibe-backend/graphql/schema.graphql:209`
|
|
9
|
-
* (`enum SubscriptionTier { FREE PRO MAX }`).
|
|
10
|
-
*/
|
|
11
|
-
export type WizardTier = 'FREE' | 'PRO' | 'MAX';
|
|
12
|
-
/**
|
|
13
|
-
* Tier-aware seat budget. Mirrors
|
|
14
|
-
* `codevibe-backend/lambda/user-management/index.ts:184-188`'s
|
|
15
|
-
* `REVIEWER_SEAT_COUNT` map. Free has no seats — orchestration is not
|
|
16
|
-
* permitted at that tier; the wizard short-circuits at bootstrap with
|
|
17
|
-
* the §6 upgrade interstitial.
|
|
18
|
-
*/
|
|
19
|
-
export declare const SEAT_BUDGET: Record<WizardTier, number | null>;
|
|
20
|
-
/**
|
|
21
|
-
* The 3-role lock from PHASE-3-A-DESIGN.md: the wizard offers ONLY
|
|
22
|
-
* `architecture` / `correctness` / `security`. The schema's
|
|
23
|
-
* `ReviewerRole` enum at `codevibe-backend/graphql/schema.graphql:167-177`
|
|
24
|
-
* still has 9 variants for backward compat / 2.0.x custom-roles
|
|
25
|
-
* (#80) — but the wizard NEVER sends a non-3-role seat to
|
|
26
|
-
* `updateReviewerPolicy`.
|
|
27
|
-
*
|
|
28
|
-
* snake_case matches `codevibe-core/src/reviewer/types.ts:52-61` (the
|
|
29
|
-
* reviewer-module wire). The wizard converts to AppSync UPPERCASE at
|
|
30
|
-
* the save boundary via `roleToAppSync()`.
|
|
31
|
-
*/
|
|
32
|
-
export declare const WIZARD_ROLES: readonly ["architecture", "correctness", "security"];
|
|
33
|
-
export type WizardRole = (typeof WIZARD_ROLES)[number];
|
|
34
|
-
/**
|
|
35
|
-
* Tier-aware default role for each seat (§1 "Default-role fallback").
|
|
36
|
-
* Seat 0 = architecture, Seat 1 = correctness, Seat 2 = security.
|
|
37
|
-
* When the canonical default is already taken by a previous seat, the
|
|
38
|
-
* wizard falls back to the first remaining role in canonical order.
|
|
39
|
-
*/
|
|
40
|
-
export declare const DEFAULT_ROLE_BY_SEAT: WizardRole[];
|
|
41
|
-
/**
|
|
42
|
-
* Canonical agent ordering used for wizard defaults. The first
|
|
43
|
-
* installed agent in this order is the default for each seat unless
|
|
44
|
-
* the user picks otherwise. AGY-2.0: antigravity ranks LAST (weakest —
|
|
45
|
-
* defaulted only on an agy-only host), mirroring TIER2_REVIEWER_RANK.
|
|
46
|
-
*/
|
|
47
|
-
export declare const AGENT_PRIORITY: AgentKind[];
|
|
48
|
-
/**
|
|
49
|
-
* The wizard's terminal outcomes. Drives `wizard_completed` /
|
|
50
|
-
* `wizard_aborted` GA4 events and the exit code.
|
|
51
|
-
*/
|
|
52
|
-
export type WizardOutcome = {
|
|
53
|
-
kind: 'ok';
|
|
54
|
-
saved: true;
|
|
55
|
-
seats: ReadonlyArray<WizardSeatPick>;
|
|
56
|
-
} | {
|
|
57
|
-
kind: 'saved_after_test_warning';
|
|
58
|
-
saved: true;
|
|
59
|
-
seats: ReadonlyArray<WizardSeatPick>;
|
|
60
|
-
} | {
|
|
61
|
-
kind: 'aborted';
|
|
62
|
-
reason: WizardAbortReason;
|
|
63
|
-
lastStep: WizardStep;
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* Reasons the wizard exited without saving. Mirror the
|
|
67
|
-
* `wizard_aborted.reason` taxonomy in PHASE-3-A-DESIGN.md §7.
|
|
68
|
-
*/
|
|
69
|
-
export type WizardAbortReason = 'ctrl_c' | 'tier_gate_free' | 'no_clis' | 'step_user_exit' | 'step_save_failed_exit' | 'auth_expired' | 'bootstrap_failure';
|
|
70
|
-
/**
|
|
71
|
-
* Wizard step taxonomy — used for `wizard_step_started`/`completed`/
|
|
72
|
-
* `failed` and `wizard_aborted.last_step`.
|
|
73
|
-
*/
|
|
74
|
-
export type WizardStep = 'bootstrap' | 'seat_assignment' | 'test_my_agents' | 'save';
|
|
75
|
-
/**
|
|
76
|
-
* Per-step `wizard_step_failed.reason` codes. Mirror the table in
|
|
77
|
-
* PHASE-3-A-DESIGN.md §7. Each step has its own bounded reason set;
|
|
78
|
-
* `seat_assignment` has no failure modes (the picker filters out
|
|
79
|
-
* invalid choices UI-side).
|
|
80
|
-
*/
|
|
81
|
-
export type WizardStepFailureReason = 'tier_gate_free' | 'not_signed_in' | 'subscription_status_network' | 'no_clis_installed' | 'test_revise' | 'test_reject' | 'test_escalate' | 'test_parse_failure' | 'test_spawn_failure' | 'test_timeout' | 'update_policy_network' | 'update_policy_5xx' | 'update_policy_throttle' | 'auth_token_expired';
|
|
82
|
-
/**
|
|
83
|
-
* One seat the user picked in Step 1. The wizard converts these to
|
|
84
|
-
* `ReviewerAgentSpecInput[]` at save time by uppercase-mapping role +
|
|
85
|
-
* agent (the schema's wire form).
|
|
86
|
-
*/
|
|
87
|
-
export interface WizardSeatPick {
|
|
88
|
-
seatId: number;
|
|
89
|
-
agent: AgentKind;
|
|
90
|
-
role: WizardRole;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Latency bucket for GA4 `latency_bucket_s` / `total_latency_bucket_s`
|
|
94
|
-
* dimensions. Bounded set — keeps GA4 cardinality tractable per R2
|
|
95
|
-
* round-1 MEDIUM (PHASE-3-A-DESIGN.md §7).
|
|
96
|
-
*/
|
|
97
|
-
export type LatencyBucket = '<2' | '2-5' | '5-10' | '10-30' | '30+';
|
|
98
|
-
/**
|
|
99
|
-
* Categorical bucket for "how many agents are installed" /
|
|
100
|
-
* "how many seats". Locked at "1" / "2" / "3" — there is no "4+"
|
|
101
|
-
* because Max is the ceiling.
|
|
102
|
-
*/
|
|
103
|
-
export type CountBucket = '1' | '2' | '3';
|
|
104
|
-
/**
|
|
105
|
-
* Entry point identifier — distinguishes meta CLI invocation from
|
|
106
|
-
* each plugin's alias (`codevibe-{claude,gemini,codex} orchestration setup`).
|
|
107
|
-
*/
|
|
108
|
-
export type WizardEntry = 'meta_cli' | 'claude_alias' | 'gemini_alias' | 'codex_alias';
|
|
109
|
-
/**
|
|
110
|
-
* Bucket a wall-clock duration into one of the 5 latency-bucket values.
|
|
111
|
-
* Used by telemetry for per-step + total-wizard timing dimensions.
|
|
112
|
-
*/
|
|
113
|
-
export declare function bucketLatencySeconds(seconds: number): LatencyBucket;
|
|
114
|
-
/**
|
|
115
|
-
* Bucket an integer count into "1" / "2" / "3", clamping anything
|
|
116
|
-
* higher to "3". Used for `seats_bucket`, `agents_distinct_bucket`,
|
|
117
|
-
* `roles_distinct_bucket`, `installed_agents_bucket`.
|
|
118
|
-
*/
|
|
119
|
-
export declare function bucketCount(n: number): CountBucket;
|
|
120
|
-
/**
|
|
121
|
-
* Map a wizard role (snake_case) to the reviewer-module's snake_case
|
|
122
|
-
* `ReviewerRole` literal type — used when building a `ReviewerSpec`
|
|
123
|
-
* for `createSubprocessReviewerRegistry().evaluate()`. Pass-through
|
|
124
|
-
* because `WizardRole` is a strict subset of `PolicyReviewerRole`.
|
|
125
|
-
*/
|
|
126
|
-
export declare function roleToReviewerSpec(role: WizardRole): PolicyReviewerRole;
|
|
127
|
-
/**
|
|
128
|
-
* Map a wizard role (snake_case) to the AppSync schema's UPPERCASE
|
|
129
|
-
* `ReviewerRole` enum — used when building a `ReviewerAgentSpecInput`
|
|
130
|
-
* for the `updateReviewerPolicy` mutation. The wizard locks to 3
|
|
131
|
-
* roles, so this mapping is exhaustive over `WizardRole` and never
|
|
132
|
-
* produces one of the 6 non-3-role variants.
|
|
133
|
-
*/
|
|
134
|
-
export declare function roleToAppSync(role: WizardRole): SchemaReviewerRole;
|
|
135
|
-
/**
|
|
136
|
-
* Map AgentKind (lowercase reviewer-module wire) to the UPPERCASE AppSync
|
|
137
|
-
* reviewer-agent enum. Used at save time when building the
|
|
138
|
-
* `ReviewerAgentSpecInput[]` for `updateReviewerPolicy`.
|
|
139
|
-
*
|
|
140
|
-
* The codomain is the REVIEWER-agent union
|
|
141
|
-
* (`CLAUDE | GEMINI | CODEX | ANTIGRAVITY`, per `ReviewerAgentSpecInput.agent`),
|
|
142
|
-
* NOT the session `AgentType` enum — a reviewer seat can be ANTIGRAVITY
|
|
143
|
-
* (never in `AgentType`) and can never be the CODEVIBE orchestrator, so the
|
|
144
|
-
* two enums are deliberately distinct.
|
|
145
|
-
*/
|
|
146
|
-
export declare function agentToAppSync(agent: AgentKind): 'CLAUDE' | 'GEMINI' | 'CODEX' | 'ANTIGRAVITY';
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { DetectableAgent } from './detect-agents.js';
|
|
2
|
-
import { WizardEntry } from './setup-types.js';
|
|
3
|
-
import { PickerIO } from './setup-seat-picker.js';
|
|
4
|
-
import { AppSyncClient } from '../appsync/appsync-client.js';
|
|
5
|
-
import type { ReviewerSpec, ReviewerVerdict } from '../reviewer/index.js';
|
|
6
|
-
/**
|
|
7
|
-
* Parse `--entry=<value>` from argv. Defaults to `meta_cli` if absent
|
|
8
|
-
* or invalid. Plugin wrappers pass `--entry=claude_alias` /
|
|
9
|
-
* `gemini_alias` / `codex_alias` per the §4 alias contract.
|
|
10
|
-
*/
|
|
11
|
-
export declare function parseEntry(argv: string[]): WizardEntry;
|
|
12
|
-
/**
|
|
13
|
-
* Injectable dependencies for `runSetupWizardWithDeps`. Factored out
|
|
14
|
-
* so unit tests can drive the whole state machine deterministically
|
|
15
|
-
* (no real readline, no real subprocess spawn, no real network).
|
|
16
|
-
*
|
|
17
|
-
* Production callers use `runSetupWizard`, which wires the production
|
|
18
|
-
* deps + calls `process.exit(result.exitCode)`.
|
|
19
|
-
*/
|
|
20
|
-
export interface SetupWizardDeps {
|
|
21
|
-
/** Builds an authenticated AppSyncClient or returns null if unauthenticated. */
|
|
22
|
-
clientFactory: () => Promise<AppSyncClient | null>;
|
|
23
|
-
/** Returns the subset of agents present on PATH. */
|
|
24
|
-
agentDetector: () => DetectableAgent[];
|
|
25
|
-
/** Optional reviewer registry (Step 2). Default: real subprocess registry. */
|
|
26
|
-
registryFactory?: () => {
|
|
27
|
-
evaluate: (spec: ReviewerSpec, gateId: string) => Promise<ReviewerVerdict>;
|
|
28
|
-
};
|
|
29
|
-
/** Output writer — writes the line as-is (caller controls newlines). */
|
|
30
|
-
write: (line: string) => void;
|
|
31
|
-
/** Build a fresh PickerIO + close handle for the next interactive prompt. */
|
|
32
|
-
createPickerIO: () => {
|
|
33
|
-
io: PickerIO;
|
|
34
|
-
close: () => void;
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Result of the wizard's state machine. The public `runSetupWizard`
|
|
39
|
-
* wrapper translates this to a `process.exit(exitCode)`.
|
|
40
|
-
*/
|
|
41
|
-
export interface SetupWizardResult {
|
|
42
|
-
exitCode: number;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Production entry point. Called from `runOrchestrationCli` when
|
|
46
|
-
* `argv[3] === 'setup'`. Builds production deps + calls process.exit
|
|
47
|
-
* with the wizard's exit code. Drives the full state machine via
|
|
48
|
-
* `runSetupWizardWithDeps`.
|
|
49
|
-
*/
|
|
50
|
-
export declare function runSetupWizard(argv: string[]): Promise<void>;
|
|
51
|
-
/**
|
|
52
|
-
* Testable wizard core. Exits with code 0 on success or any user-
|
|
53
|
-
* initiated abort; exit 1 on a failure the user couldn't recover
|
|
54
|
-
* from in the recourse loop. SIGINT is registered + cleaned up
|
|
55
|
-
* around the call (no-op for tests when SIGINT is never fired).
|
|
56
|
-
*/
|
|
57
|
-
export declare function runSetupWizardWithDeps(argv: string[], deps: SetupWizardDeps): Promise<SetupWizardResult>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filesystem location of the cohort-flag file (`~/.codevibe/cohort-flags.json`).
|
|
3
|
-
* Exposed as a function so test code can monkey-patch via env override.
|
|
4
|
-
*/
|
|
5
|
-
export declare function cohortFlagFilePath(): string;
|
|
6
|
-
/**
|
|
7
|
-
* Reads the named cohort flag for the given session/user. Returns
|
|
8
|
-
* `false` on every failure mode (file missing, malformed JSON, flag
|
|
9
|
-
* unset, non-boolean value). This is fail-closed by design — per §3
|
|
10
|
-
* H6 mitigation, the cohort gate MUST default off until Phase 4 flips
|
|
11
|
-
* the flag.
|
|
12
|
-
*
|
|
13
|
-
* `sessionId` is accepted in the signature for future per-session
|
|
14
|
-
* cohort overrides; CP-1.a ignores it.
|
|
15
|
-
*/
|
|
16
|
-
export declare function getCohortFlag(name: string, _sessionId: string): Promise<boolean>;
|