@quantiya/codevibe-core 2.0.84 → 2.0.86

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.
@@ -0,0 +1,48 @@
1
+ export type PromptIntentAction = 'start_task' | 'familiarize' | 'advisory_response' | 'browse' | 'brainstorm' | 'ask_user';
2
+ export type PromptIntentSource = 'model' | 'semantic_fail_closed' | 'infrastructure_outage';
3
+ export interface PromptIntentClassification {
4
+ action: PromptIntentAction;
5
+ is_code_or_disk_mutation: boolean;
6
+ confidence: 'high' | 'low';
7
+ rationale: string;
8
+ source: PromptIntentSource;
9
+ requires_file_read?: boolean;
10
+ }
11
+ export interface GemmaIntentPort {
12
+ classify(req: {
13
+ prompt: string;
14
+ jsonSchema?: Record<string, unknown>;
15
+ maxOutputTokens: number;
16
+ signal?: AbortSignal;
17
+ timeoutMs?: number;
18
+ }): Promise<{
19
+ text: string;
20
+ }>;
21
+ }
22
+ export declare const INTENT_CLASSIFIER_JSON_SCHEMA: Record<string, unknown>;
23
+ export declare function buildIntentClassifierPrompt(prompt: string, clarifications?: {
24
+ question: string;
25
+ answer: string;
26
+ }[]): string;
27
+ export declare function parseIntentGemmaResponse(raw: string): PromptIntentClassification | null;
28
+ /**
29
+ * Detect whether an error represents a genuine infrastructure transport/network/timeout outage
30
+ * rather than a model semantic, contract, capability, or internal programming error.
31
+ * Only genuine infrastructure outages permit falling back to secondary regex heuristics (Codex R50-F4, Claude NB2).
32
+ */
33
+ export declare function isInfrastructureTransportOutage(err: unknown): boolean;
34
+ /**
35
+ * Classify a user turn using Gemma with structured JSON.
36
+ * Returns `PromptIntentClassification`.
37
+ * Always fails closed to `start_task` on any error or ambiguity.
38
+ */
39
+ export declare function classifyPromptIntentWithGemma(input: {
40
+ prompt: string;
41
+ clarifications?: {
42
+ question: string;
43
+ answer: string;
44
+ }[];
45
+ }, port: GemmaIntentPort, opts?: {
46
+ timeoutMs?: number;
47
+ signal?: AbortSignal;
48
+ }): Promise<PromptIntentClassification>;
@@ -343,7 +343,7 @@ export { reducer } from './reducer';
343
343
  export { createOrchestrationStore, type OrchestrationStore } from './store';
344
344
  export { routeBrowse, RETAINED_PAGE_MAX_CHARS, type RouteBrowseDeps, type RetainedBrowsePage, } from './route-browse';
345
345
  export { composeBrainstormPanelBrief, fitTextToBudget, MAX_BRAINSTORM_PAGE_CHARS, MAX_BRAINSTORM_PAGE_TOKENS, MAX_BRAINSTORM_PAGE_BYTES, } from './brainstorm-quorum';
346
- export { extractQueryRelevantSnippets, isPromptRelevantToRetainedPage, htmlToText } from './web/extract';
346
+ export { extractQueryRelevantSnippets, isPromptRelevantToRetainedPage, isBlindBrowseClarification, htmlToText } from './web/extract';
347
347
  export { validateAgyArgPrompt, AGY_ARG_PROMPT_MAX_UTF8_BYTES, } from '../agy-cli-contract';
348
348
  export type { Mode, Tier, PlannerDecision, AgentKind, PlannerHealthState, RunningTaskState, ReviewerSeatState, GateState, ExecutionEventEntry, RefusalEventEntry, BypassEventEntry, MobileEventEntry, EventStreamEntry, ConversationEntry, QueuedTask, PendingClarification, OrchestrationState, OrchestrationAction, LastModeFile, TeamState, TeamTrackEntry, TeamTrackState, TeamMergeGateStatus, LiveProgress, } from './types';
349
349
  export { formatElapsed, isSpinnerPhase, renderProgressLine, type TaskProgressEvent, type OnProgress, } from './task-progress';
@@ -925,6 +925,35 @@ export declare function routeFamiliarize(deps: {
925
925
  userPrompt?: string;
926
926
  onProgress?: (event: TaskProgressEvent) => void;
927
927
  }): Promise<void>;
928
+ /**
929
+ * Routes a bare document inspection or file summarization inquiry
930
+ * (e.g. "Pick a file and summarize its numbers and key details", "Summarize package.json", "Summarize notice.pdf")
931
+ * to a read-only frontier agent in plan mode.
932
+ *
933
+ * When a frontier agent is available (`localExecutor` + `quorumLoop`):
934
+ * - Selects the default implementor agent from detected agents (default CLAUDE or ANTIGRAVITY).
935
+ * - Spawns the read-only agent via `runReadOnlyAgentAdvisoryResult` in plan mode.
936
+ * - The agent reads the file(s) and produces grounded document facts.
937
+ * - Dispatches the sanitized text to `store` as `SHELL_ADVISORY`.
938
+ * - NEVER calls `writeRepoState` and NEVER creates a task or shadow workspace.
939
+ *
940
+ * When no frontier agent is wired or invocation fails:
941
+ * - Fails closed with an explicit user-facing message explaining that a read-capable model is required.
942
+ * - NEVER displays internal classifier rationale as the user's answer.
943
+ */
944
+ /**
945
+ * Parses numbered or disjunctive alternatives from a clarifying question string.
946
+ * Supports:
947
+ * - Numbered lists: "1. View in chat 2. Group in chat 3. Write summary to report.md" or "1) ... 2) ..."
948
+ * - Disjunctive lists: "A, B, or C?" or "A or B?"
949
+ */
950
+ export declare function parseNumberedOptions(question: string): string[];
951
+ export declare function routeDocumentInspectionAdvisory(deps: {
952
+ store: OrchestrationStore;
953
+ args: RunOrchestrationShellArgs;
954
+ userPrompt: string;
955
+ onProgress?: (event: TaskProgressEvent) => void;
956
+ }): Promise<boolean>;
928
957
  export declare function routeBrainstorm(deps: {
929
958
  store: OrchestrationStore;
930
959
  args: RunOrchestrationShellArgs;
@@ -518,7 +518,7 @@ export interface QuorumLoopDeps {
518
518
  * weakening any production timeout or filesystem check.
519
519
  */
520
520
  shadowRecoveryOps?: {
521
- listRecoverableShadows?: (env: ShadowEnv) => Promise<RecoveredShadow[]>;
521
+ listRecoverableShadows?: (env: ShadowEnv, ownedTaskIds?: ReadonlySet<string>) => Promise<RecoveredShadow[]>;
522
522
  listShadowCleanupResidue?: (taskIds: ReadonlySet<string>, env: ShadowEnv) => Promise<ShadowCleanupResidue[]>;
523
523
  captureWorkspaceRootAuthority?: typeof captureWorkspaceRootAuthority;
524
524
  reopenShadow?: (recovered: RecoveredShadow, env: ShadowEnv) => Promise<WorkspaceShadow | null>;
@@ -56,3 +56,9 @@ export declare function isPromptRelevantToRetainedPage(prompt: string, retainedP
56
56
  title?: string;
57
57
  text?: string;
58
58
  } | null): boolean;
59
+ /**
60
+ * Detects whether a planner clarifying question is a blind deflection regarding web browsing
61
+ * (e.g. asking for a URL, link, or website address because the model lacks awareness of the retained page),
62
+ * as opposed to a genuine question about user preferences, sections, files, or instructions.
63
+ */
64
+ export declare function isBlindBrowseClarification(clarifyingQuestion?: string): boolean;
@@ -42,3 +42,14 @@ export declare function normalizeSnapshot(snapshot: string): string;
42
42
  export declare function countUnescapedBackticks(str: string): number;
43
43
  export declare function isMcpHeadingLine(line: string): boolean;
44
44
  export declare function isPromptHeadingLine(line: string): boolean;
45
+ import { parseInteractivePromptWithGemma, type TuiGemmaPort } from './tui-parser/gemma-tui-parser';
46
+ export { parseInteractivePromptWithGemma, type TuiGemmaPort };
47
+ /**
48
+ * Asynchronously parse an interactive prompt with model-based structured JSON parsing
49
+ * when available, respecting the CODEVIBE_TUI_PARSER operational kill-switch.
50
+ */
51
+ export declare function parseInteractivePromptAsync(snapshot: string, port?: TuiGemmaPort, opts?: {
52
+ timeoutMs?: number;
53
+ signal?: AbortSignal;
54
+ boundedOptionBlock?: boolean;
55
+ }): Promise<ParsedInteractivePrompt | null>;
@@ -21,3 +21,13 @@ export declare function selectTerminalMenuOption(identity: string, number: strin
21
21
  * and a separate terminal footer with key hints.
22
22
  */
23
23
  export declare function parseActiveTerminalMenu(snapshot: string): TerminalMenu | null;
24
+ import { parseActiveTerminalMenuWithGemma, type GemmaTerminalMenu, type TuiGemmaPort } from './tui-parser/gemma-tui-parser';
25
+ export { parseActiveTerminalMenuWithGemma, type GemmaTerminalMenu };
26
+ /**
27
+ * Asynchronously parse an active terminal menu using Gemma structured JSON when available,
28
+ * respecting the CODEVIBE_TUI_PARSER operational kill-switch.
29
+ */
30
+ export declare function parseActiveTerminalMenuAsync(snapshot: string, port?: TuiGemmaPort, opts?: {
31
+ timeoutMs?: number;
32
+ signal?: AbortSignal;
33
+ }): Promise<TerminalMenu | null>;
@@ -0,0 +1,74 @@
1
+ import type { ParsedInteractivePrompt } from '../prompt-parser';
2
+ export interface TuiGemmaPort {
3
+ classify(req: {
4
+ prompt: string;
5
+ jsonSchema?: Record<string, unknown>;
6
+ maxOutputTokens: number;
7
+ signal?: AbortSignal;
8
+ timeoutMs?: number;
9
+ }): Promise<{
10
+ text: string;
11
+ }>;
12
+ }
13
+ export interface RawGemmaTuiOption {
14
+ number: string;
15
+ text: string;
16
+ is_selected?: boolean;
17
+ }
18
+ export interface RawGemmaTuiResponse {
19
+ is_interactive_prompt: boolean;
20
+ kind: 'numbered' | 'yes_no' | 'text' | 'none';
21
+ prompt_text: string;
22
+ selected_option_number?: string | null;
23
+ options?: RawGemmaTuiOption[];
24
+ requires_follow_up_text?: boolean;
25
+ }
26
+ export declare const TUI_PARSER_JSON_SCHEMA: Record<string, unknown>;
27
+ /** Deterministic pre-guard to quickly reject snapshots that cannot be interactive menus. */
28
+ export declare function hasInteractivePromptMarkers(text: string): boolean;
29
+ export declare function buildTuiParserPrompt(normalizedSnapshot: string): string;
30
+ export declare function parseTuiGemmaResponse(raw: string): RawGemmaTuiResponse | null;
31
+ /**
32
+ * Low-level raw structured response parser with timeout and cancellation bounds.
33
+ */
34
+ export declare function parseRawTuiWithGemma(snapshot: string, port: TuiGemmaPort, opts?: {
35
+ timeoutMs?: number;
36
+ signal?: AbortSignal;
37
+ }): Promise<RawGemmaTuiResponse | null>;
38
+ /**
39
+ * Parse an interactive terminal prompt using Gemma with structured JSON.
40
+ * Returns `ParsedInteractivePrompt` or `null`.
41
+ */
42
+ export declare function parseInteractivePromptWithGemma(snapshot: string, port: TuiGemmaPort, opts?: {
43
+ timeoutMs?: number;
44
+ signal?: AbortSignal;
45
+ }): Promise<ParsedInteractivePrompt | null>;
46
+ /** Check whether an option's label matches its row text without altering meaning or imposing ASCII word boundaries (Codex R51-F2). */
47
+ export declare function isOptionTextRowMatch(rowContent: string, label: string): boolean;
48
+ export interface GroundedMenuRow {
49
+ optionNumber: string;
50
+ rowText: string;
51
+ lineIndex: number;
52
+ }
53
+ /**
54
+ * Extract candidate option rows from snapshot and isolate the single active menu block
55
+ * at the bottom of the snapshot, ignoring stale options in prior scrollback blocks (Codex R52-F2).
56
+ */
57
+ export declare function getActiveMenuBlock(snapshot: string): GroundedMenuRow[];
58
+ /**
59
+ * Structured TerminalMenu returned by Gemma TUI parser.
60
+ */
61
+ export interface GemmaTerminalMenu {
62
+ prompt: ParsedInteractivePrompt;
63
+ selectedNumber: string;
64
+ identity: string;
65
+ snapshot: string;
66
+ }
67
+ /**
68
+ * Parse an active terminal menu using Gemma with structured JSON.
69
+ * Returns `GemmaTerminalMenu` or `null`.
70
+ */
71
+ export declare function parseActiveTerminalMenuWithGemma(snapshot: string, port: TuiGemmaPort, opts?: {
72
+ timeoutMs?: number;
73
+ signal?: AbortSignal;
74
+ }): Promise<GemmaTerminalMenu | null>;
@@ -0,0 +1 @@
1
+ export { parseInteractivePromptWithGemma, parseActiveTerminalMenuWithGemma, hasInteractivePromptMarkers, buildTuiParserPrompt, parseTuiGemmaResponse, isOptionTextRowMatch, TUI_PARSER_JSON_SCHEMA, type TuiGemmaPort, type RawGemmaTuiOption, type RawGemmaTuiResponse, type GemmaTerminalMenu, } from './gemma-tui-parser';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantiya/codevibe-core",
3
- "version": "2.0.84",
3
+ "version": "2.0.86",
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",