@quantiya/codevibe-core 2.0.86 → 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.
- package/dist/index.d.ts +4 -2
- package/dist/index.js +527 -524
- package/dist/orchestration-shell/cli.js +14 -4
- package/dist/prompt-parser.d.ts +3 -2
- package/dist/terminal-menu.d.ts +10 -2
- package/dist/tui-parser/gemma-tui-parser.d.ts +23 -0
- package/dist/tui-parser/index.d.ts +2 -1
- package/dist/tui-parser/port-adapters.d.ts +17 -0
- package/package.json +1 -1
|
@@ -28751,8 +28751,13 @@ var PlannerOutputUnparseableError = class _PlannerOutputUnparseableError extends
|
|
|
28751
28751
|
"brainstorm",
|
|
28752
28752
|
"refuse"
|
|
28753
28753
|
]);
|
|
28754
|
+
function isRealHttpUrl(url) {
|
|
28755
|
+
if (typeof url != "string") return !1;
|
|
28756
|
+
let trimmed = url.trim();
|
|
28757
|
+
return trimmed.length === 0 || trimmed === "http(s) url" || trimmed === "https://[path]" ? !1 : new RegExp("^" + HTTP_URL_PATTERN_SOURCE + "$").test(trimmed);
|
|
28758
|
+
}
|
|
28754
28759
|
function hasRealBrowseFields(obj) {
|
|
28755
|
-
let hasRealBrowseUrls = Array.isArray(obj.browseUrls) && obj.browseUrls.
|
|
28760
|
+
let hasRealBrowseUrls = Array.isArray(obj.browseUrls) && obj.browseUrls.some(isRealHttpUrl), hasRealBrowseQuery = typeof obj.browseQuery == "string" && obj.browseQuery.trim().length > 0;
|
|
28756
28761
|
return hasRealBrowseUrls || hasRealBrowseQuery;
|
|
28757
28762
|
}
|
|
28758
28763
|
function validationError(message2, obj, canDegrade) {
|
|
@@ -28938,7 +28943,7 @@ function renderLocalGemmaPlannerPromptWithShape(input) {
|
|
|
28938
28943
|
'User: "also add a --cv-quiet flag to release.sh" (session.currentTaskState is in_progress) -> {"action":"start_task","rationale":"asks for a new deliverable while a task runs"}',
|
|
28939
28944
|
"",
|
|
28940
28945
|
OUTPUT_CONTRACT_HEADER,
|
|
28941
|
-
`{"action":"${[...localGemmaAllowedActions()].join("|")}","rationale":"short reason","clarifying_question":"question text or null","advisory_summary":"answer text or null","browseUrls":["
|
|
28946
|
+
`{"action":"${[...localGemmaAllowedActions()].join("|")}","rationale":"short reason","clarifying_question":"question text or null","advisory_summary":"answer text or null","browseUrls":["https://example.com"] or null,"browseQuery":"web-search query or null"}`,
|
|
28942
28947
|
"Only a browse action may set browseUrls/browseQuery (null for every other action). ask_user always sets clarifying_question to the question for the user. Do not include gateRequest or any other keys.",
|
|
28943
28948
|
"Destructive workspace operations: a bounded operation that removes named project files requires explicit confirmation of that operation and target before dispatch, rather than blanket refusal. If confirmation is not yet present in clarifications, choose ask_user and ask a concise question identifying the target and consequence. If the user confirms the same operation and target in clarifications, choose start_task; the implementor still enforces filesystem authority and execution safeguards. If the user declines, choose advisory_response acknowledging cancellation and do not start a task. This does not permit destructive root/home deletion or override unsafe-request refusal rules. Keep rationale to one short sentence.",
|
|
28944
28949
|
'turnState identifies this submission: new_request means the user has submitted a NEW request, even when its text repeats an earlier request; clarification_answer means the user is answering the current question in clarifications. priorSessionContext is historical reference material only. Never treat an old answer as the current answer or respond to an earlier request instead of userPrompt. For example: history says the user declined deletion; turnState is new_request; userPrompt asks to delete the same file -> ask_user for fresh confirmation, NOT advisory_response about the old cancellation. A previous approval also cannot authorize a new deletion \u2014 even when the LAST line of priorSessionContext is a bare "yes": that answered an EARLIER question, and turnState says this is a NEW request that needs its own confirmation.',
|
|
@@ -29157,8 +29162,8 @@ function parseLocalGemmaPlannerDecision(raw) {
|
|
|
29157
29162
|
if (obj.advisory_summary !== void 0 || obj.clarifying_question !== void 0)
|
|
29158
29163
|
throw validationError("Gemma planner browse output must not include advisory_summary or clarifying_question", obj, canDegrade);
|
|
29159
29164
|
} else {
|
|
29160
|
-
let hasRealBrowseUrls = Array.isArray(obj.browseUrls) && obj.browseUrls.
|
|
29161
|
-
if ((hasRealBrowseUrls || hasRealBrowseQuery) && (
|
|
29165
|
+
let hasRealBrowseUrls = Array.isArray(obj.browseUrls) && obj.browseUrls.some(isRealHttpUrl), hasRealBrowseQuery = typeof obj.browseQuery == "string" && obj.browseQuery.trim().length > 0, userFacingPlannerText = typeof obj.advisory_summary == "string" && obj.advisory_summary.trim().length > 0 || typeof obj.clarifying_question == "string" && obj.clarifying_question.trim().length > 0, taskStartingAction = obj.action === "start_task" || obj.action === "team_decompose";
|
|
29166
|
+
if ((hasRealBrowseUrls || hasRealBrowseQuery) && (userFacingPlannerText || taskStartingAction || obj.action === "refuse" || obj.action === "ask_user"))
|
|
29162
29167
|
throw new PlannerOutputUnparseableError(
|
|
29163
29168
|
"Gemma planner non-browse output must not combine browse fields with user-facing or task-starting planner output",
|
|
29164
29169
|
{ kind: "validation" }
|
|
@@ -86464,6 +86469,11 @@ async function runOrchestrationShellSession(args) {
|
|
|
86464
86469
|
}
|
|
86465
86470
|
), handleUserInput = (text2, images, options) => {
|
|
86466
86471
|
if (shellSubmissionsFenced) return Promise.resolve();
|
|
86472
|
+
if (args.appsyncClient && args.session?.userId && !args.appsyncClient.companionSyncStatusSnapshot?.(args.session.userId)) {
|
|
86473
|
+
let refreshAbort = new AbortController(), timeout = setTimeout(() => refreshAbort.abort(), 4500);
|
|
86474
|
+
timeout.unref?.(), args.appsyncClient.getCompanionSyncState(refreshAbort.signal).catch(() => {
|
|
86475
|
+
}).finally(() => clearTimeout(timeout));
|
|
86476
|
+
}
|
|
86467
86477
|
let submission = serializedHandleUserInput(text2, images, options);
|
|
86468
86478
|
return isShellSlashCommand(text2) || (activeShellSubmissions.add(submission), submission.then(
|
|
86469
86479
|
() => activeShellSubmissions.delete(submission),
|
package/dist/prompt-parser.d.ts
CHANGED
|
@@ -40,10 +40,11 @@ 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;
|
|
45
|
-
import { parseInteractivePromptWithGemma, type TuiGemmaPort } from './tui-parser/gemma-tui-parser';
|
|
46
|
-
export { parseInteractivePromptWithGemma, type TuiGemmaPort };
|
|
46
|
+
import { parseInteractivePromptWithGemma, ModelPortUnavailableError, type TuiGemmaPort } from './tui-parser/gemma-tui-parser';
|
|
47
|
+
export { parseInteractivePromptWithGemma, ModelPortUnavailableError, type TuiGemmaPort };
|
|
47
48
|
/**
|
|
48
49
|
* Asynchronously parse an interactive prompt with model-based structured JSON parsing
|
|
49
50
|
* when available, respecting the CODEVIBE_TUI_PARSER operational kill-switch.
|
package/dist/terminal-menu.d.ts
CHANGED
|
@@ -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,8 +29,8 @@ 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;
|
|
24
|
-
import { parseActiveTerminalMenuWithGemma, type GemmaTerminalMenu, type TuiGemmaPort } from './tui-parser/gemma-tui-parser';
|
|
25
|
-
export { parseActiveTerminalMenuWithGemma, type GemmaTerminalMenu };
|
|
32
|
+
import { parseActiveTerminalMenuWithGemma, ModelPortUnavailableError, type GemmaTerminalMenu, type TuiGemmaPort } from './tui-parser/gemma-tui-parser';
|
|
33
|
+
export { parseActiveTerminalMenuWithGemma, ModelPortUnavailableError, type GemmaTerminalMenu };
|
|
26
34
|
/**
|
|
27
35
|
* Asynchronously parse an active terminal menu using Gemma structured JSON when available,
|
|
28
36
|
* respecting the CODEVIBE_TUI_PARSER operational kill-switch.
|
|
@@ -1,4 +1,8 @@
|
|
|
1
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
|
+
}
|
|
2
6
|
export interface TuiGemmaPort {
|
|
3
7
|
classify(req: {
|
|
4
8
|
prompt: string;
|
|
@@ -34,6 +38,7 @@ export declare function parseTuiGemmaResponse(raw: string): RawGemmaTuiResponse
|
|
|
34
38
|
export declare function parseRawTuiWithGemma(snapshot: string, port: TuiGemmaPort, opts?: {
|
|
35
39
|
timeoutMs?: number;
|
|
36
40
|
signal?: AbortSignal;
|
|
41
|
+
rethrowPortErrors?: boolean;
|
|
37
42
|
}): Promise<RawGemmaTuiResponse | null>;
|
|
38
43
|
/**
|
|
39
44
|
* Parse an interactive terminal prompt using Gemma with structured JSON.
|
|
@@ -42,6 +47,8 @@ export declare function parseRawTuiWithGemma(snapshot: string, port: TuiGemmaPor
|
|
|
42
47
|
export declare function parseInteractivePromptWithGemma(snapshot: string, port: TuiGemmaPort, opts?: {
|
|
43
48
|
timeoutMs?: number;
|
|
44
49
|
signal?: AbortSignal;
|
|
50
|
+
boundedOptionBlock?: boolean;
|
|
51
|
+
rethrowPortErrors?: boolean;
|
|
45
52
|
}): Promise<ParsedInteractivePrompt | null>;
|
|
46
53
|
/** Check whether an option's label matches its row text without altering meaning or imposing ASCII word boundaries (Codex R51-F2). */
|
|
47
54
|
export declare function isOptionTextRowMatch(rowContent: string, label: string): boolean;
|
|
@@ -49,12 +56,27 @@ export interface GroundedMenuRow {
|
|
|
49
56
|
optionNumber: string;
|
|
50
57
|
rowText: string;
|
|
51
58
|
lineIndex: number;
|
|
59
|
+
fullSpanText?: string;
|
|
60
|
+
fullSpanJoinedNoSpace?: string;
|
|
61
|
+
continuationLines?: string[];
|
|
52
62
|
}
|
|
53
63
|
/**
|
|
54
64
|
* Extract candidate option rows from snapshot and isolate the single active menu block
|
|
55
65
|
* at the bottom of the snapshot, ignoring stale options in prior scrollback blocks (Codex R52-F2).
|
|
56
66
|
*/
|
|
57
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;
|
|
58
80
|
/**
|
|
59
81
|
* Structured TerminalMenu returned by Gemma TUI parser.
|
|
60
82
|
*/
|
|
@@ -71,4 +93,5 @@ export interface GemmaTerminalMenu {
|
|
|
71
93
|
export declare function parseActiveTerminalMenuWithGemma(snapshot: string, port: TuiGemmaPort, opts?: {
|
|
72
94
|
timeoutMs?: number;
|
|
73
95
|
signal?: AbortSignal;
|
|
96
|
+
rethrowPortErrors?: boolean;
|
|
74
97
|
}): Promise<GemmaTerminalMenu | null>;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { parseInteractivePromptWithGemma, parseActiveTerminalMenuWithGemma, hasInteractivePromptMarkers, buildTuiParserPrompt, parseTuiGemmaResponse, isOptionTextRowMatch, TUI_PARSER_JSON_SCHEMA, type TuiGemmaPort, type RawGemmaTuiOption, type RawGemmaTuiResponse, type GemmaTerminalMenu, } from './gemma-tui-parser';
|
|
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