@quantiya/codevibe-core 2.0.85 → 2.0.87

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.
@@ -40,5 +40,17 @@ export declare function parseInteractivePrompt(snapshot: string, options?: {
40
40
  */
41
41
  export declare function normalizeSnapshot(snapshot: string): string;
42
42
  export declare function countUnescapedBackticks(str: string): number;
43
+ export declare function extractPromptBlock(lines: string[], endIndex: number, boundedOptionBlock?: boolean, isApprovalPrompt?: boolean): string[];
43
44
  export declare function isMcpHeadingLine(line: string): boolean;
44
45
  export declare function isPromptHeadingLine(line: string): boolean;
46
+ import { parseInteractivePromptWithGemma, ModelPortUnavailableError, type TuiGemmaPort } from './tui-parser/gemma-tui-parser';
47
+ export { parseInteractivePromptWithGemma, ModelPortUnavailableError, type TuiGemmaPort };
48
+ /**
49
+ * Asynchronously parse an interactive prompt with model-based structured JSON parsing
50
+ * when available, respecting the CODEVIBE_TUI_PARSER operational kill-switch.
51
+ */
52
+ export declare function parseInteractivePromptAsync(snapshot: string, port?: TuiGemmaPort, opts?: {
53
+ timeoutMs?: number;
54
+ signal?: AbortSignal;
55
+ boundedOptionBlock?: boolean;
56
+ }): Promise<ParsedInteractivePrompt | null>;
@@ -14,6 +14,14 @@ export declare function selectTerminalMenuOption(identity: string, number: strin
14
14
  key(key: 'Up' | 'Down' | 'Enter'): Promise<boolean>;
15
15
  wait(): Promise<void>;
16
16
  }): Promise<TerminalMenuDelivery>;
17
+ export interface StyledRow {
18
+ text: string;
19
+ bold: boolean;
20
+ dim: boolean;
21
+ highlighted: boolean;
22
+ }
23
+ /** Preserve the small amount of terminal style that identifies a live selector. */
24
+ export declare function styledRows(snapshot: string): StyledRow[];
17
25
  /**
18
26
  * Recognize a bottom-pane numbered selector, never a bare numbered list.
19
27
  * Recognizes styled (bold) titles or prompt heading patterns (with bounded
@@ -21,3 +29,13 @@ export declare function selectTerminalMenuOption(identity: string, number: strin
21
29
  * and a separate terminal footer with key hints.
22
30
  */
23
31
  export declare function parseActiveTerminalMenu(snapshot: string): TerminalMenu | null;
32
+ import { parseActiveTerminalMenuWithGemma, ModelPortUnavailableError, type GemmaTerminalMenu, type TuiGemmaPort } from './tui-parser/gemma-tui-parser';
33
+ export { parseActiveTerminalMenuWithGemma, ModelPortUnavailableError, type GemmaTerminalMenu };
34
+ /**
35
+ * Asynchronously parse an active terminal menu using Gemma structured JSON when available,
36
+ * respecting the CODEVIBE_TUI_PARSER operational kill-switch.
37
+ */
38
+ export declare function parseActiveTerminalMenuAsync(snapshot: string, port?: TuiGemmaPort, opts?: {
39
+ timeoutMs?: number;
40
+ signal?: AbortSignal;
41
+ }): Promise<TerminalMenu | null>;
@@ -0,0 +1,97 @@
1
+ import type { ParsedInteractivePrompt } from '../prompt-parser';
2
+ export declare class ModelPortUnavailableError extends Error {
3
+ readonly cause?: unknown | undefined;
4
+ constructor(message: string, cause?: unknown | undefined);
5
+ }
6
+ export interface TuiGemmaPort {
7
+ classify(req: {
8
+ prompt: string;
9
+ jsonSchema?: Record<string, unknown>;
10
+ maxOutputTokens: number;
11
+ signal?: AbortSignal;
12
+ timeoutMs?: number;
13
+ }): Promise<{
14
+ text: string;
15
+ }>;
16
+ }
17
+ export interface RawGemmaTuiOption {
18
+ number: string;
19
+ text: string;
20
+ is_selected?: boolean;
21
+ }
22
+ export interface RawGemmaTuiResponse {
23
+ is_interactive_prompt: boolean;
24
+ kind: 'numbered' | 'yes_no' | 'text' | 'none';
25
+ prompt_text: string;
26
+ selected_option_number?: string | null;
27
+ options?: RawGemmaTuiOption[];
28
+ requires_follow_up_text?: boolean;
29
+ }
30
+ export declare const TUI_PARSER_JSON_SCHEMA: Record<string, unknown>;
31
+ /** Deterministic pre-guard to quickly reject snapshots that cannot be interactive menus. */
32
+ export declare function hasInteractivePromptMarkers(text: string): boolean;
33
+ export declare function buildTuiParserPrompt(normalizedSnapshot: string): string;
34
+ export declare function parseTuiGemmaResponse(raw: string): RawGemmaTuiResponse | null;
35
+ /**
36
+ * Low-level raw structured response parser with timeout and cancellation bounds.
37
+ */
38
+ export declare function parseRawTuiWithGemma(snapshot: string, port: TuiGemmaPort, opts?: {
39
+ timeoutMs?: number;
40
+ signal?: AbortSignal;
41
+ rethrowPortErrors?: boolean;
42
+ }): Promise<RawGemmaTuiResponse | null>;
43
+ /**
44
+ * Parse an interactive terminal prompt using Gemma with structured JSON.
45
+ * Returns `ParsedInteractivePrompt` or `null`.
46
+ */
47
+ export declare function parseInteractivePromptWithGemma(snapshot: string, port: TuiGemmaPort, opts?: {
48
+ timeoutMs?: number;
49
+ signal?: AbortSignal;
50
+ boundedOptionBlock?: boolean;
51
+ rethrowPortErrors?: boolean;
52
+ }): Promise<ParsedInteractivePrompt | null>;
53
+ /** Check whether an option's label matches its row text without altering meaning or imposing ASCII word boundaries (Codex R51-F2). */
54
+ export declare function isOptionTextRowMatch(rowContent: string, label: string): boolean;
55
+ export interface GroundedMenuRow {
56
+ optionNumber: string;
57
+ rowText: string;
58
+ lineIndex: number;
59
+ fullSpanText?: string;
60
+ fullSpanJoinedNoSpace?: string;
61
+ continuationLines?: string[];
62
+ }
63
+ /**
64
+ * Extract candidate option rows from snapshot and isolate the single active menu block
65
+ * at the bottom of the snapshot, ignoring stale options in prior scrollback blocks (Codex R52-F2).
66
+ */
67
+ export declare function getActiveMenuBlock(snapshot: string): GroundedMenuRow[];
68
+ /**
69
+ * Enumerate possible string joins for multi-line wrapped option rows (Codex R3-F4, R4-F4, R5-F3).
70
+ * Each continuation line can be joined with either a space (' ') or without space ('') for mid-token wraps.
71
+ * For up to 10 continuation lines, enumerates full combinations. For >10 lines, generates complete
72
+ * space and no-space joins without returning truncated combinations.
73
+ */
74
+ export declare function enumerateWrappedRowJoins(rowText: string, continuations: string[]): string[];
75
+ /**
76
+ * Progressive prefix-pruned matcher for multi-line wrapped option rows (Codex R4-F4, R5-F3, R6-F3, R6-F4).
77
+ * Matches complete continuation spans without arbitrary length truncation while supporting full normalization.
78
+ */
79
+ export declare function isWrappedOptionMatch(rowText: string, continuations: string[], targetText: string): boolean;
80
+ /**
81
+ * Structured TerminalMenu returned by Gemma TUI parser.
82
+ */
83
+ export interface GemmaTerminalMenu {
84
+ prompt: ParsedInteractivePrompt;
85
+ selectedNumber: string;
86
+ identity: string;
87
+ snapshot: string;
88
+ }
89
+ /**
90
+ * Parse an active terminal menu using Gemma with structured JSON.
91
+ * Returns `GemmaTerminalMenu` or `null`.
92
+ */
93
+ export declare function parseActiveTerminalMenuWithGemma(snapshot: string, port: TuiGemmaPort, opts?: {
94
+ timeoutMs?: number;
95
+ signal?: AbortSignal;
96
+ rethrowPortErrors?: boolean;
97
+ }): Promise<GemmaTerminalMenu | null>;
@@ -0,0 +1,2 @@
1
+ export { parseInteractivePromptWithGemma, parseActiveTerminalMenuWithGemma, getActiveMenuBlock, enumerateWrappedRowJoins, isWrappedOptionMatch, ModelPortUnavailableError, hasInteractivePromptMarkers, buildTuiParserPrompt, parseTuiGemmaResponse, isOptionTextRowMatch, TUI_PARSER_JSON_SCHEMA, type TuiGemmaPort, type RawGemmaTuiOption, type RawGemmaTuiResponse, type GemmaTerminalMenu, type GroundedMenuRow, } from './gemma-tui-parser';
2
+ export { createTuiGemmaPortFromRunner, createHostedTuiGemmaPort, } from './port-adapters';
@@ -0,0 +1,17 @@
1
+ import type { AppSyncClient } from '../appsync';
2
+ import type { GemmaRunner } from '../planner/gemma-runner';
3
+ import type { TuiGemmaPort } from './gemma-tui-parser';
4
+ export declare class ModelPortUnavailableError extends Error {
5
+ readonly cause?: unknown | undefined;
6
+ constructor(message: string, cause?: unknown | undefined);
7
+ }
8
+ /**
9
+ * Creates a TuiGemmaPort over any GemmaRunner (local or hosted).
10
+ */
11
+ export declare function createTuiGemmaPortFromRunner(runner: GemmaRunner): TuiGemmaPort;
12
+ /**
13
+ * Creates a hosted TuiGemmaPort backed by AppSync and the session key.
14
+ * This is suitable for companion daemons (Codex, Claude, etc.) that have an active AppSyncClient
15
+ * and access to the session key.
16
+ */
17
+ export declare function createHostedTuiGemmaPort(appsyncClient: AppSyncClient, getSessionId: () => string | null | undefined, getTier?: () => string | null | undefined): TuiGemmaPort;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantiya/codevibe-core",
3
- "version": "2.0.85",
3
+ "version": "2.0.87",
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",