@quantiya/codevibe-claude-plugin 2.0.73 → 2.0.74

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.
Files changed (32) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/node_modules/@quantiya/codevibe-core/dist/appsync/appsync-client.d.ts +39 -0
  3. package/node_modules/@quantiya/codevibe-core/dist/appsync/queries.d.ts +2 -0
  4. package/node_modules/@quantiya/codevibe-core/dist/index.d.ts +1 -1
  5. package/node_modules/@quantiya/codevibe-core/dist/index.js +564 -552
  6. package/node_modules/@quantiya/codevibe-core/dist/local-model/ollama-gemma-runner.d.ts +18 -0
  7. package/node_modules/@quantiya/codevibe-core/dist/local-model/ollama.d.ts +26 -0
  8. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/attachments.d.ts +8 -14
  9. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/cli.d.ts +49 -63
  10. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/cli.js +2395 -2407
  11. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/components/OrchestrationApp.d.ts +3 -1
  12. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/git-status-summary.d.ts +5 -10
  13. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/index.d.ts +29 -46
  14. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/route-browse.d.ts +4 -4
  15. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/runtime-labels.d.ts +63 -0
  16. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/task-progress-relay.d.ts +9 -1
  17. package/node_modules/@quantiya/codevibe-core/dist/orchestration-shell/task-progress.d.ts +7 -0
  18. package/node_modules/@quantiya/codevibe-core/dist/planner/cache.d.ts +7 -0
  19. package/node_modules/@quantiya/codevibe-core/dist/planner/gemma-errors.d.ts +61 -0
  20. package/node_modules/@quantiya/codevibe-core/dist/planner/gemma-pipeline.d.ts +219 -0
  21. package/node_modules/@quantiya/codevibe-core/dist/planner/gemma-runner.d.ts +66 -0
  22. package/node_modules/@quantiya/codevibe-core/dist/planner/hosted-gemma-runner.d.ts +83 -0
  23. package/node_modules/@quantiya/codevibe-core/dist/planner/index.d.ts +5 -3
  24. package/node_modules/@quantiya/codevibe-core/dist/planner/local-advisory.d.ts +3 -6
  25. package/node_modules/@quantiya/codevibe-core/dist/planner/local-gemma.d.ts +82 -21
  26. package/node_modules/@quantiya/codevibe-core/dist/planner/types.d.ts +4 -4
  27. package/node_modules/@quantiya/codevibe-core/dist/reviewer/verdict-classifier.d.ts +18 -5
  28. package/node_modules/@quantiya/codevibe-core/package.json +1 -1
  29. package/package.json +2 -2
  30. package/node_modules/@quantiya/codevibe-core/dist/planner/composite-adapter.d.ts +0 -39
  31. package/node_modules/@quantiya/codevibe-core/dist/planner/composite-advisory.d.ts +0 -26
  32. package/node_modules/@quantiya/codevibe-core/dist/planner/hosted-advisory.d.ts +0 -40
@@ -0,0 +1,18 @@
1
+ import { GemmaCallError } from '../planner/gemma-errors';
2
+ import { type GemmaRunner, type RunnerAdvisoryOptions, type RunnerCapabilities, type RunnerClassifyOptions, type RunnerResult } from '../planner/gemma-runner';
3
+ import { type OllamaRuntimeConfig } from './ollama';
4
+ /** Map any failure of a local call to the typed set (§3.2). */
5
+ export declare function toLocalGemmaError(err: unknown, signal?: AbortSignal): GemmaCallError;
6
+ export declare class OllamaGemmaRunner implements GemmaRunner {
7
+ private readonly config;
8
+ readonly runtime: "local";
9
+ readonly label: string;
10
+ readonly capabilities: RunnerCapabilities;
11
+ private readonly legacy;
12
+ constructor(config: OllamaRuntimeConfig);
13
+ classify(prompt: string, opts: RunnerClassifyOptions): Promise<RunnerResult>;
14
+ generateAdvisory(prompt: string, opts: RunnerAdvisoryOptions): Promise<RunnerResult>;
15
+ probe(): Promise<boolean>;
16
+ warm(): Promise<boolean>;
17
+ unload(): Promise<boolean>;
18
+ }
@@ -93,6 +93,32 @@ export interface OllamaPullProgress {
93
93
  }
94
94
  /** Progress sink for {@link requestOllamaPull}. Defaults to a no-op so existing callers/tests are unaffected. */
95
95
  export type OllamaPullProgressListener = (progress: OllamaPullProgress) => void;
96
+ /** Raw result of a non-streamed generate (planner parity runner contract, §3.2). */
97
+ export interface OllamaDetailedGeneration {
98
+ /** The model's text, NOT trimmed and possibly empty (the pipeline decides). */
99
+ text: string;
100
+ doneReason?: string;
101
+ promptEvalCount?: number;
102
+ }
103
+ /** Thrown when the prompt filled the context window (the runner maps it to a context-full error). */
104
+ export declare class OllamaContextWindowFullError extends Error {
105
+ constructor(message: string);
106
+ }
107
+ /**
108
+ * Planner parity §3.2 — the non-streamed generate the shared pipeline's local runner uses
109
+ * for classify: same request body and window check as {@link requestOllamaGenerate}, but it
110
+ * returns the raw text with `done_reason` (an empty answer is the pipeline's decision, not a
111
+ * transport error) and honours an abort signal.
112
+ */
113
+ export declare function requestOllamaGenerateDetailed(config: OllamaRuntimeConfig, promptText: string, opts: {
114
+ numPredict: number;
115
+ jsonSchema?: object;
116
+ formatJson?: boolean;
117
+ timeoutMs?: number;
118
+ numCtx?: number;
119
+ think?: boolean;
120
+ signal?: AbortSignal;
121
+ }): Promise<OllamaDetailedGeneration>;
96
122
  /**
97
123
  * Consecutive streamed tokens that render NO visible text before the generation is cut
98
124
  * off. Observed 2026-09-12 on gemma4:12b-it-qat / Ollama 0.31.1 at temperature 0: the model
@@ -1,4 +1,5 @@
1
1
  import type { ImageAttachment } from './types';
2
+ import type { PipelineImage } from '../planner/gemma-pipeline';
2
3
  import { type AnchoredCommittedFile } from '../local-executor/anchored-fs';
3
4
  import { type WorkspaceRootAuthority } from '../local-executor/workspace-authority';
4
5
  import { AdvisoryAttachmentJournal, type AdvisoryAttachmentBatchAuthority, type AdvisoryAttachmentPublicationAuthority } from './advisory-attachment-journal';
@@ -166,8 +167,6 @@ export declare function rewriteAttachmentTokensToRefs(brief: string, attachments
166
167
  * two token classes (typed raw-path spans vs `[Image #N]` chips) are disjoint.
167
168
  */
168
169
  export declare function rewriteChipTokensByNumber(brief: string, orderedPaths: string[], attachments: ImageAttachment[]): string;
169
- /** Per-model-call total base64-source cap (§6): base64 inflates ~33%; distinct from the 10 MB per-file copy cap. */
170
- export declare const MAX_BASE64_SOURCE_BYTES: number;
171
170
  /**
172
171
  * The SECURITY-boundary read (§4/§6/§7.3): open the LEXICAL absolute path with
173
172
  * `O_RDONLY | O_NOFOLLOW` (refuses if the final component is a symlink — defeats a
@@ -182,19 +181,14 @@ export declare function readImageFdSafe(sourcePath: string, maxBytes?: number):
182
181
  mime: string;
183
182
  };
184
183
  /**
185
- * Shell-layer helper (§6): read the attachments fd-safe and return RAW base64
186
- * (NO `data:` prefix — Ollama's `images[]` wants raw base64) for the LOCAL model,
187
- * under a per-call total-source-bytes cap + a count cap (first-N-under-cap). Any
188
- * attachment that fails the fd-safe read is returned in `failed` — callers
189
- * proceed text-only with a content-free advisory, never block/throw.
184
+ * Shell-layer helper (§6, planner parity §3.7): the turn's attachments as pipeline images.
185
+ * Each is read fd-safe (`readImageFdSafe`) only when a call selects images; a read that
186
+ * fails makes that image "unreadable" (the shared note names it) and never blocks the call.
187
+ * Selection — attachment order, first-N-under-cap, formats — is the pipeline's, per attempt,
188
+ * under the routed runtime's capability (`selectImagesForCapability`; local reads 8 images
189
+ * up to 8 MiB per call in PNG/JPEG/GIF/BMP, hosted 8 up to 2,400,000 B and also WEBP).
190
190
  */
191
- export declare function attachmentsToBase64(attachments: ImageAttachment[], opts?: {
192
- maxTotalBytes?: number;
193
- maxCount?: number;
194
- }): {
195
- images: string[];
196
- failed: ImageAttachment[];
197
- };
191
+ export declare function attachmentsToPipelineImages(attachments: ImageAttachment[]): PipelineImage[];
198
192
  /**
199
193
  * Detects whether a clarifying question emitted on an image attachment turn is a blind deflection
200
194
  * caused by a text-only classifier's inability to see/inspect images (e.g. asking the user to
@@ -5,7 +5,9 @@ import { type ModeSelectionDeps } from './mode-selection';
5
5
  import { type RunOrchestrationShellArgs } from './index';
6
6
  import { type ShellEventEmit, type ShellEventEmitResult } from './emit-shell-event';
7
7
  import { type ShadowEnv } from '../local-executor/workspace-shadow';
8
- import { BackendPlannerClient, PlannerCacheLayer, PlannerHealthMachine, HostedGemmaAdvisoryRunner, type AdvisoryRunner, type LocalGemmaAdvisoryRunner, type LocalGemmaPlannerRunner } from '../planner';
8
+ import { GemmaCallPipeline } from '../planner/gemma-pipeline';
9
+ import { HostedGemmaRunner } from '../planner/hosted-gemma-runner';
10
+ import { OllamaGemmaRunner } from '../local-model/ollama-gemma-runner';
9
11
  import type { PlannerAdapter, PlannerInput, PlannerDecision, PlannerProbeResult } from '../planner/adapter';
10
12
  import { keychainManager } from '../keychain';
11
13
  export { keychainManager };
@@ -18,7 +20,7 @@ import type { WorkspaceOutcomeSinkTap } from './workspace-terminal-coordinator';
18
20
  import type { GroupDecisionSubmitDeps } from './gate-decision-submit';
19
21
  import { QuorumLoop, type ReviewerSafetyNoticeSink } from './quorum-loop';
20
22
  import type { TaskProgressEvent } from './task-progress';
21
- import { type VerdictClassifier } from '../reviewer/verdict-classifier';
23
+ import { type VerdictClassifier, type VerdictGemmaPort } from '../reviewer/verdict-classifier';
22
24
  import { type LocalModelArtifactConfig, type LocalModelCommand, type LocalModelEntitlement, type LocalModelStore } from '../local-model/manager';
23
25
  import { type LocalModelState } from '../local-model/state';
24
26
  /**
@@ -30,10 +32,9 @@ export declare class PlannerUnavailableError extends Error {
30
32
  constructor(msg: string);
31
33
  }
32
34
  /**
33
- * Local-LLM planner placeholder for the Gemma QAT migration slice. This adapter
34
- * is intentionally local-only: it never calls AppSync planner mutations or any
35
- * hosted fallback. Until the verified Gemma runner is wired, natural-language
36
- * planning requests fail closed with an actionable shell message.
35
+ * The planner when the session has NO model source (Free tier without a usable local
36
+ * model, D-9 included): it never calls AppSync planner mutations or any hosted model, and
37
+ * natural-language planning requests fail closed with an actionable shell message.
37
38
  */
38
39
  export declare class LocalModelPlannerUnavailableAdapter implements PlannerAdapter {
39
40
  private readonly reason;
@@ -202,18 +203,13 @@ export declare function checkImplementorCredentialNotice(args?: {
202
203
  platform?: string;
203
204
  }): Promise<string | null>;
204
205
  export interface LocalGemmaPlannerBuildResult {
205
- adapter: PlannerAdapter;
206
- advisoryRunner: LocalGemmaAdvisoryRunner | null;
207
206
  /**
208
- * REVIEWER-VERDICT-GEMMA-CLASSIFIER-DESIGN.md (§Wiring) — the SAME resolved
209
- * Gemma runner instance as {@link advisoryRunner} (both `null` on the unavailable
210
- * path), exposed with the wider `LocalGemmaPlannerRunner` type (it carries
211
- * `classify`, which the verdict classifier needs; `advisoryRunner` keeps the
212
- * stricter `LocalGemmaAdvisoryRunner` type its consumer requires). One instance ⇒
213
- * a SINGLE availability source for both the planner and the verdict classifier —
214
- * they can never disagree about whether Gemma is up.
207
+ * The local Gemma transport (planner parity §3.1), or `null` when the local model is
208
+ * unavailable — `reason` then says why. One instance per session: `resolvePlannerAdapter`
209
+ * puts it in the session's runner source, which serves the planner, every advisory call
210
+ * and the reviewer-verdict classifier, so they never disagree about whether Gemma is up.
215
211
  */
216
- classifyRunner: LocalGemmaPlannerRunner | null;
212
+ runner: OllamaGemmaRunner | null;
217
213
  runtimeKind: NonNullable<RunOrchestrationShellArgs['plannerRuntimeKind']>;
218
214
  /**
219
215
  * TUI redesign (2026-06-29) — display label for the status-bar planner badge
@@ -253,60 +249,49 @@ export declare function runAuditCli(parsed: ParsedAuditArgs, deps?: {
253
249
  }): Promise<number>;
254
250
  export declare function main(argv: string[]): Promise<number>;
255
251
  /**
256
- * CP-1.b IMPL r4 H-1 — Production planner stack factory.
257
- *
258
- * Builds the full BackendPlannerClient + PlannerCacheLayer +
259
- * PlannerHealthMachine chain so the orchestration shell can call
260
- * `plannerAdapter.classify()` on natural-language input.
252
+ * Planner parity §3.1 — the HOSTED Gemma transport over this session's AppSync client:
253
+ * the client-rendered planner-proxy paths, encrypted under the session key, which it
254
+ * resolves through `keychainManager.getSessionKey` (as the retired hosted advisory runner
255
+ * did). The pipeline's `setActiveSession` binds it to the session.
261
256
  *
262
- * Co-located with the CLI bootstrap (NOT inside `runOrchestrationShell`)
263
- * because the shell accepts an injected adapter for tests; the
264
- * production bootstrap site is the single canonical instantiation
265
- * point.
266
- *
267
- * Exported for unit tests; production callers go through `main()`.
257
+ * Exported for unit tests; production callers go through `resolvePlannerAdapter`.
268
258
  */
269
- export interface ProductionPlannerStackResult {
270
- adapter: BackendPlannerClient;
271
- cache: PlannerCacheLayer;
272
- health: PlannerHealthMachine;
273
- hostedAdvisoryRunner: HostedGemmaAdvisoryRunner;
274
- }
275
- export declare function buildProductionPlannerStack(appsyncClient: AppSyncClient, emitter: (args: ShellEventEmit) => Promise<unknown>): ProductionPlannerStackResult;
259
+ export declare function buildHostedGemmaRunner(appsyncClient: AppSyncClient): HostedGemmaRunner;
276
260
  export interface ResolvePlannerAdapterArgs {
277
261
  localPlanner: LocalGemmaPlannerBuildResult;
278
262
  tier: Tier;
279
263
  appsyncClient: AppSyncClient;
280
- emitter: (args: ShellEventEmit) => Promise<unknown>;
281
264
  env?: NodeJS.ProcessEnv;
282
- buildHostedStack?: (appsyncClient: AppSyncClient, emitter: (args: ShellEventEmit) => Promise<unknown>) => ProductionPlannerStackResult;
265
+ /** Test seam. */
266
+ buildHostedRunner?: (appsyncClient: AppSyncClient) => HostedGemmaRunner;
283
267
  }
284
268
  export interface ResolvedPlannerResult {
285
269
  adapter: PlannerAdapter;
270
+ /**
271
+ * The session's Gemma pipeline — the ONLY caller of a runner (§3.1). It serves the
272
+ * planner (through `adapter`), every advisory call and the reviewer-verdict classifier.
273
+ * `null` when the session has no model source.
274
+ */
275
+ pipeline: GemmaCallPipeline | null;
276
+ /** The status badge's initial state (display only). */
286
277
  runtimeKind: NonNullable<RunOrchestrationShellArgs['plannerRuntimeKind']>;
287
278
  runtimeLabel: string;
288
- advisoryRunner: AdvisoryRunner | null;
289
- classifyRunner: LocalGemmaPlannerRunner | null;
290
- cache: PlannerCacheLayer | null;
291
- health: PlannerHealthMachine | null;
292
- source: 'local' | 'hosted' | 'local_unavailable';
279
+ source: 'composite' | 'local' | 'hosted' | 'local_unavailable';
293
280
  }
294
281
  /**
295
- * Resolves the active planner adapter for the orchestration shell session.
282
+ * Resolves the session's runner source (planner parity §3.1):
283
+ *
284
+ * | Tier | Local available | Source |
285
+ * |---------|-----------------|-------------------------|
286
+ * | Pro/Max | yes | composite (local first) |
287
+ * | Pro/Max | no | hosted runner alone |
288
+ * | Free | yes | local runner alone |
289
+ * | Free | no | none (unavailable) |
296
290
  *
297
- * Precedence & Invariants:
298
- * 1. Forced hosted mode (`CODEVIBE_FORCE_HOSTED_PLANNER=1` or `CODEVIBE_PLANNER_PROVIDER=hosted`):
299
- * - Allowed for PRO and MAX tiers. Returns the production hosted Bedrock planner stack and hosted advisory runner.
300
- * - Disallowed for FREE tier (preserves $0 marginal cost invariant). Falls back to local adapter.
301
- * 2. Local-first preference:
302
- * - When local Gemma is enabled and operational (`!localPlanner.reason`), returns the composite adapter
303
- * and composite advisory runner for PRO/MAX (local-first with seamless hosted Bedrock fallback).
304
- * Returns local adapter/runner for FREE tier.
305
- * 3. Unavailable fallback:
306
- * - When local Gemma is unavailable (`localPlanner.reason` is truthy):
307
- * - PRO / MAX: Falls back to the hosted Bedrock planner stack (`hosted`) and hosted advisory runner.
308
- * - FREE: Retains the local unavailable adapter (`local_unavailable`), strictly preventing
309
- * cloud inference costs.
291
+ * `CODEVIBE_FORCE_HOSTED_PLANNER=1` / `CODEVIBE_PLANNER_PROVIDER=hosted` select the
292
+ * hosted runner alone ONLY for Pro/Max; a Free session keeps the table and never sends a
293
+ * hosted request. One pipeline over the source serves the planner, every advisory call
294
+ * and the verdict classifier, so they all see the same runtime at the same moment.
310
295
  */
311
296
  export declare function resolvePlannerAdapter(args: ResolvePlannerAdapterArgs): ResolvedPlannerResult;
312
297
  export interface BuildTeamLocalExecutorResult {
@@ -420,16 +405,17 @@ export declare function makeStrictBadgeSink(appsyncClient: AppSyncClient, sessio
420
405
  *
421
406
  * - `classifyRunner === undefined` → the classifier is NOT wired (unit tests /
422
407
  * the canned-prompt legacy paths the design leaves on regex) → `undefined`
423
- * (the provider uses `parseVerdictOutput`). Production ALWAYS wires it (a
424
- * `LocalGemmaPlannerRunner | null`), so this branch never fires in production.
408
+ * (the provider uses `parseVerdictOutput`). Production ALWAYS wires it (the
409
+ * session's Gemma pipeline or `null`), so this branch never fires in production.
425
410
  * - `CODEVIBE_REVIEWER_VERDICT_CLASSIFIER=regex` → `undefined` (the ONLY operator
426
411
  * revert to the regex parser). Any other value (incl. a typo) stays `gemma` so
427
412
  * a mistyped flag can NEVER silently disable the fail-closed classifier.
428
- * - `gemma` (default) → the real fail-closed Gemma classifier when the runner is
429
- * present; a dummy always-ESCALATE classifier when it is `null` (Ollama
430
- * unreachable at boot) — NEVER a silent regex fallback (agy-MED-1).
413
+ * - `gemma` (default) → the real fail-closed Gemma classifier over the session's
414
+ * pipeline (parity D-11: the same source as the planner, so it fails over with
415
+ * it); a dummy always-ESCALATE classifier when it is `null` (no model source at
416
+ * boot) — NEVER a silent regex fallback (agy-MED-1).
431
417
  */
432
- export declare function resolveVerdictClassifier(classifyRunner: LocalGemmaPlannerRunner | null | undefined, env?: NodeJS.ProcessEnv): VerdictClassifier | undefined;
418
+ export declare function resolveVerdictClassifier(classifyRunner: VerdictGemmaPort | null | undefined, env?: NodeJS.ProcessEnv): VerdictClassifier | undefined;
433
419
  export interface BuildQuorumLoopExecutorResult {
434
420
  localExecutor: LocalExecutor;
435
421
  quorumLoop: QuorumLoop;
@@ -486,7 +472,7 @@ export declare function buildQuorumLoopExecutor(args: {
486
472
  * planner's), forwarded to `buildAndArmQuorumLoop` where the verdict classifier is
487
473
  * built. ABSENT (tests) → the classifier is not wired → regex parser.
488
474
  */
489
- classifyRunner?: LocalGemmaPlannerRunner | null;
475
+ classifyRunner?: VerdictGemmaPort | null;
490
476
  }): Promise<BuildQuorumLoopExecutorResult>;
491
477
  /**
492
478
  * Single-task LE emit → wire shape. Exported for tests.
@@ -529,7 +515,7 @@ export declare function buildTeamLocalExecutor(args: {
529
515
  * planner's), forwarded to `buildAndArmQuorumLoop` where the verdict classifier is
530
516
  * built. ABSENT (tests) → the classifier is not wired → regex parser.
531
517
  */
532
- classifyRunner?: LocalGemmaPlannerRunner | null;
518
+ classifyRunner?: VerdictGemmaPort | null;
533
519
  /** P36: Task-completion audit summary local store callback. */
534
520
  onTaskAuditSummary?: (summary: TaskAuditSummaryModel, markdown: string) => void;
535
521
  /** P36: Aggregate team merge audit summary callback. */