@quantiya/codevibe-core 2.0.48 → 2.0.50

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.
@@ -26,6 +26,16 @@ export interface PlannerAppSyncTransport {
26
26
  ok: boolean;
27
27
  ms: number;
28
28
  }>;
29
+ generatePlannerAdvisory?(input: {
30
+ sessionId: string;
31
+ prompt: string;
32
+ maxTokens?: number;
33
+ temperature?: number;
34
+ }): Promise<{
35
+ advisoryText: string;
36
+ serverLatencyMs: number;
37
+ providerUsed: string;
38
+ }>;
29
39
  }
30
40
  /**
31
41
  * Crypto bridge — `encryptString` + `encryptJson` + `decryptJson`
@@ -0,0 +1,25 @@
1
+ import type { Tier } from '../orchestration-shell/types';
2
+ import type { AdvisoryOptions, AdvisoryRunner } from './local-advisory';
3
+ export interface CompositeAdvisoryRunnerOptions {
4
+ localRunner?: AdvisoryRunner | null;
5
+ hostedRunner: AdvisoryRunner;
6
+ tier: Tier;
7
+ onFallbackToHosted?: (error: Error) => void;
8
+ }
9
+ /**
10
+ * CompositeAdvisoryRunner coordinates local and hosted advisory execution:
11
+ * - Free Tier Invariant: strictly isolates Free tier from cloud inference ($0 marginal cost).
12
+ * - Local-First Preference: routes natural language turns / browse to local Gemma when healthy.
13
+ * - Dynamic Failover: if local Gemma fails (Ollama down, crash, OOM), seamlessly falls back
14
+ * to hosted Bedrock Gemma for Pro/Max users without interrupting the session.
15
+ */
16
+ export declare class CompositeAdvisoryRunner implements AdvisoryRunner {
17
+ private readonly opts;
18
+ private localHealthy;
19
+ constructor(opts: CompositeAdvisoryRunnerOptions);
20
+ get runtimeLabel(): string;
21
+ get providerKind(): 'local' | 'hosted';
22
+ generateAdvisory(promptText: string, options?: AdvisoryOptions): Promise<string>;
23
+ warm(): Promise<boolean>;
24
+ unload(): Promise<boolean>;
25
+ }
@@ -0,0 +1,37 @@
1
+ import type { AdvisoryOptions, AdvisoryRunner } from './local-advisory';
2
+ import type { PlannerCryptoBridge, SessionKeyResolver } from './client';
3
+ export interface HostedAdvisoryTransport {
4
+ generatePlannerAdvisory(input: {
5
+ sessionId: string;
6
+ prompt: string;
7
+ maxTokens?: number;
8
+ temperature?: number;
9
+ }): Promise<{
10
+ advisoryText: string;
11
+ serverLatencyMs: number;
12
+ providerUsed: string;
13
+ }>;
14
+ }
15
+ export interface HostedGemmaAdvisoryRunnerDeps {
16
+ transport: HostedAdvisoryTransport;
17
+ crypto: PlannerCryptoBridge;
18
+ sessionKeyResolver: SessionKeyResolver;
19
+ activeSessionIdHolder: {
20
+ value: string | null;
21
+ };
22
+ }
23
+ /**
24
+ * HostedGemmaAdvisoryRunner executes advisory text generation (browse synthesis,
25
+ * brainstorm, etc.) against Google Gemma 3 12B on AWS Bedrock via AppSync planner proxy.
26
+ *
27
+ * Wire payload is encrypted end-to-end with AES-256-GCM under the session key.
28
+ */
29
+ export declare class HostedGemmaAdvisoryRunner implements AdvisoryRunner {
30
+ private readonly deps;
31
+ readonly runtimeLabel = "Hosted Gemma (AWS Bedrock)";
32
+ readonly providerKind: "hosted";
33
+ constructor(deps: HostedGemmaAdvisoryRunnerDeps);
34
+ generateAdvisory(promptText: string, options?: AdvisoryOptions): Promise<string>;
35
+ warm(): Promise<boolean>;
36
+ unload(): Promise<boolean>;
37
+ }
@@ -4,5 +4,7 @@ export { PlannerCacheLayer } from './cache';
4
4
  export { PlannerHealthMachine } from './health-state';
5
5
  export { BackendPlannerClient, PlannerBudgetExceededError, PlannerTierGateRejectedError, type PlannerAppSyncTransport, type PlannerCryptoBridge, type SessionKeyResolver, type ShellEventEmit, type EmitShellEventFn, } from './client';
6
6
  export { LocalGemmaPlannerAdapter, parseLocalGemmaPlannerDecision, PlannerOutputUnparseableError, renderLocalGemmaPlannerPrompt, type LocalGemmaPlannerRunner, } from './local-gemma';
7
- export { parseLocalGemmaAdvisorySummary, renderLocalGemmaFamiliarizePrompt, renderLocalGemmaMultiBrowsePrompt, renderLocalGemmaBrowsePrompt, MAX_BROWSE_CONTENT_CHARS, MAX_MULTI_BROWSE_TOTAL_CONTENT_CHARS, MAX_MULTI_BROWSE_RENDERED_PROMPT_CHARS, type LocalGemmaAdvisoryRunner, } from './local-advisory';
7
+ export { parseLocalGemmaAdvisorySummary, renderLocalGemmaFamiliarizePrompt, renderLocalGemmaMultiBrowsePrompt, renderLocalGemmaBrowsePrompt, MAX_BROWSE_CONTENT_CHARS, MAX_MULTI_BROWSE_TOTAL_CONTENT_CHARS, MAX_MULTI_BROWSE_RENDERED_PROMPT_CHARS, type AdvisoryRunner, type AdvisoryOptions, type AdvisoryResponseFormat, type LocalGemmaAdvisoryRunner, type LocalGemmaAdvisoryOptions, type LocalGemmaAdvisoryResponseFormat, } from './local-advisory';
8
8
  export { CompositePlannerAdapter, type CompositePlannerAdapterOptions, } from './composite-adapter';
9
+ export { HostedGemmaAdvisoryRunner, type HostedGemmaAdvisoryRunnerDeps, type HostedAdvisoryTransport, } from './hosted-advisory';
10
+ export { CompositeAdvisoryRunner, type CompositeAdvisoryRunnerOptions, } from './composite-advisory';
@@ -1,6 +1,6 @@
1
1
  import type { StructuralSummary } from '../structural-summary/types';
2
- export interface LocalGemmaAdvisoryRunner {
3
- generateAdvisory(promptText: string, options?: LocalGemmaAdvisoryOptions): Promise<string>;
2
+ export interface AdvisoryRunner {
3
+ generateAdvisory(promptText: string, options?: AdvisoryOptions): Promise<string>;
4
4
  /**
5
5
  * Dogfood #618 — optional fire-and-forget model pre-warm (load + keep_alive).
6
6
  * Never throws; resolves false on failure. Called once at shell startup.
@@ -13,10 +13,11 @@ export interface LocalGemmaAdvisoryRunner {
13
13
  */
14
14
  unload?(): Promise<boolean>;
15
15
  runtimeLabel: string;
16
+ readonly providerKind?: 'local' | 'hosted';
16
17
  }
17
- export type LocalGemmaAdvisoryResponseFormat = 'json' | 'text';
18
- export interface LocalGemmaAdvisoryOptions {
19
- responseFormat?: LocalGemmaAdvisoryResponseFormat;
18
+ export type AdvisoryResponseFormat = 'json' | 'text';
19
+ export interface AdvisoryOptions {
20
+ responseFormat?: AdvisoryResponseFormat;
20
21
  numPredict?: number;
21
22
  /**
22
23
  * RAW base64 images (NO `data:` prefix) for the MULTIMODAL local answerer
@@ -38,7 +39,15 @@ export interface LocalGemmaAdvisoryOptions {
38
39
  * Omitted unless set; browse callers pass false (R8-F2, R9-F4).
39
40
  */
40
41
  think?: boolean;
42
+ /**
43
+ * Temperature hint for advisory generation.
44
+ */
45
+ temperature?: number;
41
46
  }
47
+ /** Backward-compatibility aliases for local runner consumers */
48
+ export type LocalGemmaAdvisoryRunner = AdvisoryRunner;
49
+ export type LocalGemmaAdvisoryResponseFormat = AdvisoryResponseFormat;
50
+ export type LocalGemmaAdvisoryOptions = AdvisoryOptions;
42
51
  export declare const MAX_RENDERED_PROMPT_CHARS = 30000;
43
52
  export declare const MAX_RENDERED_PROMPT_TOKENS = 7500;
44
53
  export declare function redactAbsoluteLocalPaths(text: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantiya/codevibe-core",
3
- "version": "2.0.48",
3
+ "version": "2.0.50",
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",