@quantiya/codevibe-core 1.0.17 → 2.0.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/dist/appsync/appsync-client.d.ts +16 -84
- package/dist/appsync/queries.d.ts +2 -8
- package/dist/audit-keys/__tests__/audit-keys-parity.test.d.ts +1 -0
- package/dist/audit-keys/index.d.ts +41 -0
- package/dist/auth/auth-service.d.ts +4 -2
- package/dist/auth/auth-telemetry.d.ts +0 -9
- package/dist/index.d.ts +4 -0
- package/dist/index.js +72 -45
- package/dist/orchestration/detect-agents.d.ts +56 -0
- package/dist/orchestration/index.d.ts +2 -0
- package/dist/orchestration/orchestration-cli.d.ts +9 -0
- package/dist/reviewer/__tests__/integration.test.d.ts +1 -0
- package/dist/reviewer/__tests__/mocks.test.d.ts +1 -0
- package/dist/reviewer/__tests__/output-parser.test.d.ts +1 -0
- package/dist/reviewer/__tests__/registry.test.d.ts +1 -0
- package/dist/reviewer/__tests__/subprocess.test.d.ts +1 -0
- package/dist/reviewer/index.d.ts +15 -0
- package/dist/reviewer/mocks.d.ts +80 -0
- package/dist/reviewer/output-parser.d.ts +95 -0
- package/dist/reviewer/provider.d.ts +153 -0
- package/dist/reviewer/providers/__tests__/claude-live-smoke.test.d.ts +1 -0
- package/dist/reviewer/providers/__tests__/claude.test.d.ts +1 -0
- package/dist/reviewer/providers/__tests__/codex-live-smoke.test.d.ts +1 -0
- package/dist/reviewer/providers/__tests__/codex.test.d.ts +1 -0
- package/dist/reviewer/providers/__tests__/gemini-live-smoke.test.d.ts +1 -0
- package/dist/reviewer/providers/__tests__/gemini.test.d.ts +1 -0
- package/dist/reviewer/providers/claude.d.ts +59 -0
- package/dist/reviewer/providers/codex.d.ts +67 -0
- package/dist/reviewer/providers/common.d.ts +25 -0
- package/dist/reviewer/providers/gemini.d.ts +108 -0
- package/dist/reviewer/registry.d.ts +87 -0
- package/dist/reviewer/subprocess.d.ts +117 -0
- package/dist/reviewer/types.d.ts +101 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/reviewer.d.ts +67 -0
- package/dist/types/session.d.ts +16 -0
- package/package.json +6 -3
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { type ReviewerProvider, type ReviewerSpec } from './provider.js';
|
|
2
|
+
import type { AgentKind, ReviewerVerdict } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Per-agent reviewer dispatch.
|
|
5
|
+
*
|
|
6
|
+
* Build with the fluent `with()` builder for the common production
|
|
7
|
+
* case (register all known agents up front), or the mutating
|
|
8
|
+
* `register()` helper when the set is determined at runtime.
|
|
9
|
+
* `providerFor` exposes the underlying provider for callers (e.g.,
|
|
10
|
+
* test harnesses) that need direct access without going through the
|
|
11
|
+
* `evaluate` method.
|
|
12
|
+
*
|
|
13
|
+
* `ReviewerRegistry` itself implements `ReviewerProvider` so it
|
|
14
|
+
* slots into anything that takes a single provider — including
|
|
15
|
+
* another `ReviewerRegistry`. (Compose-of-compose works for free.)
|
|
16
|
+
*/
|
|
17
|
+
export declare class ReviewerRegistry implements ReviewerProvider {
|
|
18
|
+
private readonly providers;
|
|
19
|
+
/**
|
|
20
|
+
* Builder-style register: returns `this` with `agent` mapped to
|
|
21
|
+
* `provider`. Intended for the production "register all three at
|
|
22
|
+
* startup" pattern:
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* const registry = new ReviewerRegistry()
|
|
26
|
+
* .with('claude', new ClaudeReviewerProvider())
|
|
27
|
+
* .with('gemini', new GeminiReviewerProvider())
|
|
28
|
+
* .with('codex', new CodexReviewerProvider());
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* Re-registering the same agent overwrites the previous provider —
|
|
32
|
+
* useful for tests that swap in a fixture provider after construction.
|
|
33
|
+
*/
|
|
34
|
+
with(agent: AgentKind, provider: ReviewerProvider): this;
|
|
35
|
+
/**
|
|
36
|
+
* Mutating register. Equivalent to `with()` but returns void; use
|
|
37
|
+
* when chaining isn't readable (e.g., conditional registration in
|
|
38
|
+
* a loop).
|
|
39
|
+
*/
|
|
40
|
+
register(agent: AgentKind, provider: ReviewerProvider): void;
|
|
41
|
+
/**
|
|
42
|
+
* Lookup the provider for `agent`. Returns `undefined` if no
|
|
43
|
+
* provider is registered. Callers should prefer using the
|
|
44
|
+
* `evaluate` method on the registry itself, which handles the
|
|
45
|
+
* missing-provider case as a typed `ReviewerError`. This method
|
|
46
|
+
* is exposed for test harnesses that need direct provider access
|
|
47
|
+
* (e.g., to call provider methods that aren't part of the
|
|
48
|
+
* interface).
|
|
49
|
+
*/
|
|
50
|
+
providerFor(agent: AgentKind): ReviewerProvider | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Returns the set of agents that have registered providers, in
|
|
53
|
+
* insertion order. Useful for callers that want to log the
|
|
54
|
+
* configured registry shape or for a future startup-time validator
|
|
55
|
+
* that checks the policy snapshot's reviewer_agents are all covered.
|
|
56
|
+
*/
|
|
57
|
+
registeredAgents(): AgentKind[];
|
|
58
|
+
/**
|
|
59
|
+
* Dispatch by `spec.agent` to the registered provider. If no
|
|
60
|
+
* provider is registered for that agent, throw
|
|
61
|
+
* `ReviewerErrorClass` with `kind: 'spawn_failed'` so the engine's
|
|
62
|
+
* existing escalation path handles it. The `reason` field includes
|
|
63
|
+
* the agent name so audit can identify the misconfiguration.
|
|
64
|
+
*/
|
|
65
|
+
evaluate(spec: ReviewerSpec, gateId: string): Promise<ReviewerVerdict>;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Production factory: build a registry pre-populated with all three
|
|
69
|
+
* subprocess providers (Claude, Gemini, Codex) using the standard
|
|
70
|
+
* binaries from PATH. Equivalent of Rust's
|
|
71
|
+
* `withSubprocessProviders()` napi factory.
|
|
72
|
+
*
|
|
73
|
+
* Plugins call this once at startup and hand the registry to the
|
|
74
|
+
* engine fan-out path. Inert registrations cost nothing — no
|
|
75
|
+
* subprocess fires until the policy actually references that agent.
|
|
76
|
+
*
|
|
77
|
+
* For tests / dev environments that need to override binary paths,
|
|
78
|
+
* construct the providers manually:
|
|
79
|
+
*
|
|
80
|
+
* ```ts
|
|
81
|
+
* const registry = new ReviewerRegistry()
|
|
82
|
+
* .with('claude', new ClaudeReviewerProvider({ executable: '/opt/bin/claude' }))
|
|
83
|
+
* .with('gemini', new GeminiReviewerProvider({ executable: '/opt/bin/gemini' }))
|
|
84
|
+
* .with('codex', new CodexReviewerProvider({ executable: '/opt/bin/codex' }));
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export declare function createSubprocessReviewerRegistry(): ReviewerRegistry;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Successful subprocess run. Exit status may still be failure (non-zero
|
|
3
|
+
* code); the caller decides whether to treat that as a reviewer spawn error
|
|
4
|
+
* or as a parse failure with whatever stdout it produced.
|
|
5
|
+
*/
|
|
6
|
+
export interface SubprocessOutcome {
|
|
7
|
+
/** Captured stdout decoded as UTF-8. Reviewers that emit non-UTF-8 are
|
|
8
|
+
* misbehaving by contract; lossy decode keeps the parser running rather
|
|
9
|
+
* than returning an IO error for what is really a "reviewer is broken"
|
|
10
|
+
* scenario. */
|
|
11
|
+
stdout: string;
|
|
12
|
+
/** Captured stderr (same lossy-decode policy). Surfaced to callers so
|
|
13
|
+
* audit records can include it. */
|
|
14
|
+
stderr: string;
|
|
15
|
+
/** Wall-clock milliseconds from `spawn()` to exit. Populated even on
|
|
16
|
+
* non-zero exit because per-reviewer latency is a cost / reliability
|
|
17
|
+
* telemetry input. */
|
|
18
|
+
elapsed_ms: number;
|
|
19
|
+
/** Whether the process exited with status 0. Separate from the stdout
|
|
20
|
+
* contents — a reviewer that printed its verdict and then crashed on
|
|
21
|
+
* shutdown is still "failed" from an audit perspective even if the
|
|
22
|
+
* verdict parses cleanly. */
|
|
23
|
+
exit_success: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Subprocess-layer errors. Discriminated union; callers (per-agent
|
|
27
|
+
* providers) map these into `ReviewerError` with their own `AgentKind`.
|
|
28
|
+
*/
|
|
29
|
+
export type SubprocessError = {
|
|
30
|
+
/** The child process could not be spawned at all (binary not on
|
|
31
|
+
* PATH, permission denied, fork/exec failed). */
|
|
32
|
+
kind: 'spawn_failed';
|
|
33
|
+
reason: string;
|
|
34
|
+
} | {
|
|
35
|
+
/** The child exceeded its `timeout_ms` budget. The child has been
|
|
36
|
+
* (or will be) killed via SIGKILL by the time this error is
|
|
37
|
+
* returned. */
|
|
38
|
+
kind: 'timeout';
|
|
39
|
+
/** The timeout budget in ms, for telemetry. */
|
|
40
|
+
elapsed_ms: number;
|
|
41
|
+
} | {
|
|
42
|
+
/** A non-timeout IO failure occurred while running the subprocess
|
|
43
|
+
* (stdin write failed, stdout read failed, etc.). */
|
|
44
|
+
kind: 'io';
|
|
45
|
+
reason: string;
|
|
46
|
+
} | {
|
|
47
|
+
/** Caller signalled abort via the `signal` option before the child
|
|
48
|
+
* exited. The child has been killed via SIGKILL. Distinct from
|
|
49
|
+
* `timeout` so the audit log can attribute "reviewer cancelled by
|
|
50
|
+
* engine" separately from "reviewer ran past budget." */
|
|
51
|
+
kind: 'cancelled';
|
|
52
|
+
};
|
|
53
|
+
/** Class wrapper so callers can `throw`/`catch` typed errors. */
|
|
54
|
+
export declare class SubprocessErrorClass extends Error {
|
|
55
|
+
readonly detail: SubprocessError;
|
|
56
|
+
constructor(detail: SubprocessError);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Inputs to `runReviewer`. Callers (per-agent providers) build this struct
|
|
60
|
+
* with their agent-specific binary + args + env, then hand off lifecycle
|
|
61
|
+
* management to this module.
|
|
62
|
+
*/
|
|
63
|
+
export interface RunReviewerOptions {
|
|
64
|
+
/** Path or command name to spawn. */
|
|
65
|
+
command: string;
|
|
66
|
+
/** Arguments to pass to the command. */
|
|
67
|
+
args: readonly string[];
|
|
68
|
+
/**
|
|
69
|
+
* Environment variables to set. **MUST include
|
|
70
|
+
* `QUORUM_REVIEWER_SUBPROCESS: '1'`** — this is the plugin-isolation env
|
|
71
|
+
* guard that prevents reviewer hook fires from evicting the user's
|
|
72
|
+
* primary plugin session. Each provider is responsible for setting it;
|
|
73
|
+
* this module does NOT inject it automatically because providers may
|
|
74
|
+
* also need to forward `process.env` selectively.
|
|
75
|
+
*/
|
|
76
|
+
env: NodeJS.ProcessEnv;
|
|
77
|
+
/** Working directory; falls back to `process.cwd()`. */
|
|
78
|
+
cwd?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Prompt to write to the child's stdin. Always followed by stdin EOF.
|
|
81
|
+
* Most reviewer CLIs finish reading the prompt then begin emitting
|
|
82
|
+
* output — a reviewer that blocks on a stuck stdin pipe is the §3.1
|
|
83
|
+
* test scenario.
|
|
84
|
+
*/
|
|
85
|
+
prompt: string;
|
|
86
|
+
/**
|
|
87
|
+
* Wall-clock timeout (ms) bounding the whole spawn-to-exit window,
|
|
88
|
+
* INCLUDING the stdin write. This is the load-bearing detail per §3.1:
|
|
89
|
+
* an earlier (Rust v1) implementation wrapped only the wait-for-exit,
|
|
90
|
+
* which let a child that refused to drain stdin block the parent in
|
|
91
|
+
* pipe-full back-pressure indefinitely. Wrapping write+wait under one
|
|
92
|
+
* timeout is the fix.
|
|
93
|
+
*/
|
|
94
|
+
timeout_ms: number;
|
|
95
|
+
/**
|
|
96
|
+
* Optional `AbortSignal` for engine-driven cancellation (e.g., user
|
|
97
|
+
* abort, sibling reviewer hard-rejecting). Aborting after a clean exit
|
|
98
|
+
* is a no-op; aborting mid-flight teardown is a `cancelled` error.
|
|
99
|
+
*/
|
|
100
|
+
signal?: AbortSignal;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Run a preconfigured command as a reviewer subprocess.
|
|
104
|
+
*
|
|
105
|
+
* Contract:
|
|
106
|
+
* - Stdin, stdout, stderr are piped (caller cannot override; output capture
|
|
107
|
+
* is the whole purpose of the call).
|
|
108
|
+
* - `prompt` is written to the child's stdin then stdin is closed (EOF).
|
|
109
|
+
* - The whole spawn → write-stdin → wait-for-exit lifecycle races against
|
|
110
|
+
* `timeout_ms` AND any `signal` abort. On timeout / abort the streams
|
|
111
|
+
* are explicitly destroyed and the child is SIGKILL'd before throwing.
|
|
112
|
+
*
|
|
113
|
+
* Throws `SubprocessErrorClass` on failure; the `.detail.kind` discriminator
|
|
114
|
+
* tells the caller which path tripped (`spawn_failed` / `timeout` / `io` /
|
|
115
|
+
* `cancelled`).
|
|
116
|
+
*/
|
|
117
|
+
export declare function runReviewer(opts: RunReviewerOptions): Promise<SubprocessOutcome>;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Three agent kinds the reviewer subprocess layer can spawn.
|
|
3
|
+
*
|
|
4
|
+
* Lowercase wire format matches `codevibe_policy::AgentKind`'s
|
|
5
|
+
* `#[serde(rename_all = "lowercase")]` attribute. **Append-only after launch**
|
|
6
|
+
* — adding a fourth agent (e.g. a hypothetical fourth CLI) is fine; renaming
|
|
7
|
+
* `claude` → `Claude` would break every audit chain entry that has serialised
|
|
8
|
+
* it.
|
|
9
|
+
*/
|
|
10
|
+
export type AgentKind = 'claude' | 'gemini' | 'codex';
|
|
11
|
+
/**
|
|
12
|
+
* Review lens a reviewer seat evaluates through.
|
|
13
|
+
*
|
|
14
|
+
* snake_case wire format matches `codevibe_policy::ReviewerRole`'s
|
|
15
|
+
* `#[serde(rename_all = "snake_case")]` attribute, locked in Phase 2f.0.a.1.
|
|
16
|
+
* **Append-only post-launch** — these strings are cryptographically bound
|
|
17
|
+
* into the audit hash chain once used. Renaming or removing a value would
|
|
18
|
+
* break chain verification on every prior entry. Adding new values is fine
|
|
19
|
+
* (Custom roles slipped to 2.0.1 per the locked design).
|
|
20
|
+
*
|
|
21
|
+
* Code-artifact lenses: architecture, correctness, security.
|
|
22
|
+
* Docs-artifact lenses: accuracy, clarity, completeness.
|
|
23
|
+
* Mixed-artifact composite lenses: architecture_and_accuracy,
|
|
24
|
+
* correctness_and_clarity, security_and_completeness.
|
|
25
|
+
*
|
|
26
|
+
* The AppSync-facing `ReviewerRole` enum in `src/types/reviewer.ts` uses
|
|
27
|
+
* UPPERCASE GraphQL convention; this snake_case version is for the Rust
|
|
28
|
+
* engine wire. Translation between the two layers is the AppSync resolver's
|
|
29
|
+
* job, not the reviewer module's.
|
|
30
|
+
*/
|
|
31
|
+
export type ReviewerRole = 'architecture' | 'correctness' | 'security' | 'accuracy' | 'clarity' | 'completeness' | 'architecture_and_accuracy' | 'correctness_and_clarity' | 'security_and_completeness';
|
|
32
|
+
/**
|
|
33
|
+
* Reviewer verdict kinds. Four values, each maps to a different path through
|
|
34
|
+
* the consensus engine.
|
|
35
|
+
*
|
|
36
|
+
* UPPERCASE wire format matches `codevibe_reviewer::VerdictKind`'s
|
|
37
|
+
* `#[serde(rename_all = "UPPERCASE")]` attribute. Append-only post-launch.
|
|
38
|
+
*
|
|
39
|
+
* - `APPROVE` — plan/artifact is sound, proceed.
|
|
40
|
+
* - `REJECT` — plan/artifact has fundamental problems; do not proceed.
|
|
41
|
+
* - `REVISE` — plan/artifact is close but needs specific changes. Requires
|
|
42
|
+
* populated `suggested_changes` per the parser's locked invariant.
|
|
43
|
+
* - `ESCALATE` — reviewer cannot decide confidently; surface to user.
|
|
44
|
+
*/
|
|
45
|
+
export type VerdictKind = 'APPROVE' | 'REJECT' | 'REVISE' | 'ESCALATE';
|
|
46
|
+
/**
|
|
47
|
+
* Newtype-equivalent for `ReviewerVerdict.verdict_id`. Mirrors Rust's
|
|
48
|
+
* `VerdictId(pub Uuid)` with `#[serde(transparent)]` — wire form is just the
|
|
49
|
+
* UUID string, no envelope.
|
|
50
|
+
*/
|
|
51
|
+
export type VerdictId = string;
|
|
52
|
+
/**
|
|
53
|
+
* One reviewer's verdict at one gate. Records reasoning plus perf/cost
|
|
54
|
+
* metadata for telemetry (review latency, token cost per task, etc.).
|
|
55
|
+
*
|
|
56
|
+
* `gate_id` is a plain UUID string (matches Rust's `Uuid` field — the engine
|
|
57
|
+
* wraps this in its own `GateId` newtype, but the reviewer crate stays
|
|
58
|
+
* agnostic to avoid an engine→reviewer→engine cycle).
|
|
59
|
+
*
|
|
60
|
+
* # Identity
|
|
61
|
+
*
|
|
62
|
+
* Per Phase 2f.0.a's seat/role pivot, verdicts are keyed on `seat_id` +
|
|
63
|
+
* `role`, NOT on `reviewer_agent`. Consensus dedup + audit attribution
|
|
64
|
+
* happen via `seat_id`; `reviewer_agent` stays for cost-attribution metadata
|
|
65
|
+
* only and is NOT a uniqueness key (two seats may share an agent in the
|
|
66
|
+
* single-vendor case).
|
|
67
|
+
*
|
|
68
|
+
* Field ordering + names match the Rust struct verbatim — the audit chain's
|
|
69
|
+
* SHA-256 hashes serialised JSON, so any change to field order or naming
|
|
70
|
+
* would invalidate every prior chain entry. Append-only after launch.
|
|
71
|
+
*/
|
|
72
|
+
export interface ReviewerVerdict {
|
|
73
|
+
/** Primary key. UUID v4 string. */
|
|
74
|
+
verdict_id: VerdictId;
|
|
75
|
+
/** Foreign key to `ReviewGate`. Plain UUID string per the reviewer crate's
|
|
76
|
+
* agnostic-to-engine design. */
|
|
77
|
+
gate_id: string;
|
|
78
|
+
/** Seat that produced the verdict. Primary identity key for dedup +
|
|
79
|
+
* audit attribution. Providers MUST copy this from `ReviewerSpec.seat_id`. */
|
|
80
|
+
seat_id: number;
|
|
81
|
+
/** Lens the seat reviewed through. Copied from `ReviewerSpec.role` verbatim. */
|
|
82
|
+
role: ReviewerRole;
|
|
83
|
+
/** Agent that produced the verdict. Descriptive metadata (cost attribution,
|
|
84
|
+
* per-agent reliability); NOT an identity key. */
|
|
85
|
+
reviewer_agent: AgentKind;
|
|
86
|
+
/** The verdict itself. */
|
|
87
|
+
verdict: VerdictKind;
|
|
88
|
+
/** Reviewer's free-form reasoning. */
|
|
89
|
+
reasoning: string;
|
|
90
|
+
/** Ordered list of specific changes. **Required** when `verdict === 'REVISE'`;
|
|
91
|
+
* empty for other verdicts (enforced by the output parser). */
|
|
92
|
+
suggested_changes: string[];
|
|
93
|
+
/** Model identifier used (for cost attribution). */
|
|
94
|
+
model_used: string | null;
|
|
95
|
+
/** Tokens consumed by this reviewer. */
|
|
96
|
+
tokens_used: number | null;
|
|
97
|
+
/** End-to-end latency for this reviewer's verdict (ms). */
|
|
98
|
+
latency_ms: number | null;
|
|
99
|
+
/** ISO 8601 UTC timestamp string when the reviewer returned the verdict. */
|
|
100
|
+
submitted_at: string;
|
|
101
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Review lens a reviewer seat evaluates through. Mirrors
|
|
3
|
+
* codevibe-policy::ReviewerRole in the Rust engine.
|
|
4
|
+
*
|
|
5
|
+
* **Append-only post-launch** per the 2026-04-23 memory lock — these
|
|
6
|
+
* string values are cryptographically bound into the audit hash chain
|
|
7
|
+
* once used. Renaming or removing a value would break chain verification
|
|
8
|
+
* on every prior entry. Add new values freely; never rename or remove.
|
|
9
|
+
*
|
|
10
|
+
* UPPERCASE here (matches AppSync GraphQL enum convention). The Lambda
|
|
11
|
+
* translates to snake_case before writing to the audit chain / Rust
|
|
12
|
+
* engine wire.
|
|
13
|
+
*/
|
|
14
|
+
export declare enum ReviewerRole {
|
|
15
|
+
ARCHITECTURE = "ARCHITECTURE",
|
|
16
|
+
CORRECTNESS = "CORRECTNESS",
|
|
17
|
+
SECURITY = "SECURITY",
|
|
18
|
+
ACCURACY = "ACCURACY",
|
|
19
|
+
CLARITY = "CLARITY",
|
|
20
|
+
COMPLETENESS = "COMPLETENESS",
|
|
21
|
+
ARCHITECTURE_AND_ACCURACY = "ARCHITECTURE_AND_ACCURACY",
|
|
22
|
+
CORRECTNESS_AND_CLARITY = "CORRECTNESS_AND_CLARITY",
|
|
23
|
+
SECURITY_AND_COMPLETENESS = "SECURITY_AND_COMPLETENESS"
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* One seat in a user's reviewer panel. `seat_id` is the panel position
|
|
27
|
+
* (0-indexed: Pro has seats 0–1, Max has 0–2). `role` is the review lens
|
|
28
|
+
* — unique within a policy. `agent` (CLAUDE | GEMINI | CODEX) may repeat
|
|
29
|
+
* across seats — single-vendor users get multiple same-kind seats with
|
|
30
|
+
* distinct roles.
|
|
31
|
+
*/
|
|
32
|
+
export interface ReviewerAgentSpec {
|
|
33
|
+
seatId: number;
|
|
34
|
+
role: ReviewerRole;
|
|
35
|
+
agent: 'CLAUDE' | 'GEMINI' | 'CODEX';
|
|
36
|
+
modelHint?: string | null;
|
|
37
|
+
}
|
|
38
|
+
export interface ReviewerAgentSpecInput {
|
|
39
|
+
seatId: number;
|
|
40
|
+
role: ReviewerRole;
|
|
41
|
+
agent: 'CLAUDE' | 'GEMINI' | 'CODEX';
|
|
42
|
+
modelHint?: string | null;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Input for updateReviewerPolicy. Fields are independent:
|
|
46
|
+
* - orchestrationEnabledDefault: set to true/false to persist the user's
|
|
47
|
+
* opt-in preference for new sessions. Null = leave unchanged.
|
|
48
|
+
* - reviewerSeats: non-empty array sets a custom panel. Empty array
|
|
49
|
+
* resets to tier defaults. Null = leave unchanged.
|
|
50
|
+
*/
|
|
51
|
+
export interface UpdateReviewerPolicyInput {
|
|
52
|
+
orchestrationEnabledDefault?: boolean | null;
|
|
53
|
+
reviewerSeats?: ReviewerAgentSpecInput[] | null;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* User record returned by updateAvailableAgents and updateReviewerPolicy.
|
|
57
|
+
* Subset of the full AppSync User type — only the fields the two mutations
|
|
58
|
+
* return. Use this in the AppSyncClient response typing, not as a general
|
|
59
|
+
* "User" replacement.
|
|
60
|
+
*/
|
|
61
|
+
export interface UserReviewerPolicySnapshot {
|
|
62
|
+
userId: string;
|
|
63
|
+
availableAgents?: Array<'CLAUDE' | 'GEMINI' | 'CODEX'> | null;
|
|
64
|
+
orchestrationEnabledDefault?: boolean | null;
|
|
65
|
+
reviewerSeats?: ReviewerAgentSpec[] | null;
|
|
66
|
+
updatedAt: string;
|
|
67
|
+
}
|
package/dist/types/session.d.ts
CHANGED
|
@@ -32,6 +32,12 @@ export interface Session {
|
|
|
32
32
|
creatorDeviceId?: string;
|
|
33
33
|
encryptionVersion?: number;
|
|
34
34
|
lastHeartbeatAt?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Quorum 2.0 opt-in flag (2f.0.a.3). True routes the session to the
|
|
37
|
+
* 2.0 orchestration flow once 2f.3 Lambda is live; null/false keeps
|
|
38
|
+
* the 1.0 companion flow.
|
|
39
|
+
*/
|
|
40
|
+
orchestrationEnabled?: boolean | null;
|
|
35
41
|
}
|
|
36
42
|
/**
|
|
37
43
|
* GraphQL input for creating sessions
|
|
@@ -47,6 +53,11 @@ export interface CreateSessionInput {
|
|
|
47
53
|
creatorDeviceId?: string;
|
|
48
54
|
isEncrypted?: boolean;
|
|
49
55
|
encryptionVersion?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Quorum 2.0 (2f.0.a.3). Null/absent = server reads
|
|
58
|
+
* User.orchestrationEnabledDefault (option 6a auto-populate).
|
|
59
|
+
*/
|
|
60
|
+
orchestrationEnabled?: boolean;
|
|
50
61
|
}
|
|
51
62
|
/**
|
|
52
63
|
* GraphQL input for updating sessions
|
|
@@ -56,4 +67,9 @@ export interface UpdateSessionInput {
|
|
|
56
67
|
status?: SessionStatus;
|
|
57
68
|
metadata?: Record<string, any>;
|
|
58
69
|
lastHeartbeatAt?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Quorum 2.0 (2f.0.a.3). Per-session override for the orchestration
|
|
72
|
+
* opt-in. Plugin CLI --orchestration/--no-orchestration sets this.
|
|
73
|
+
*/
|
|
74
|
+
orchestrationEnabled?: boolean;
|
|
59
75
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quantiya/codevibe-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Core library for CodeVibe plugins - shared keychain, crypto, AppSync, and auth functionality",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
"build": "rm -rf dist && npm run emit-types && esbuild src/index.ts --bundle --platform=node --target=node18 --minify --packages=external --outfile=dist/index.js",
|
|
19
19
|
"clean": "rm -rf dist",
|
|
20
20
|
"prepublishOnly": "npm run build",
|
|
21
|
-
"test": "
|
|
21
|
+
"test": "vitest run",
|
|
22
|
+
"test:watch": "vitest",
|
|
23
|
+
"test:live": "QUORUM_LIVE_SMOKE=1 vitest run"
|
|
22
24
|
},
|
|
23
25
|
"dependencies": {
|
|
24
26
|
"uuid": "^9.0.0",
|
|
@@ -32,7 +34,8 @@
|
|
|
32
34
|
"@types/uuid": "^9.0.0",
|
|
33
35
|
"@types/ws": "^8.5.0",
|
|
34
36
|
"esbuild": "^0.28.0",
|
|
35
|
-
"typescript": "^5.0.0"
|
|
37
|
+
"typescript": "^5.0.0",
|
|
38
|
+
"vitest": "^1.6.1"
|
|
36
39
|
},
|
|
37
40
|
"engines": {
|
|
38
41
|
"node": ">=18.0.0"
|