@quantiya/codevibe-core 2.0.85 → 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.
- package/dist/index.js +534 -531
- package/dist/orchestration-shell/cli.js +290 -55
- package/dist/orchestration-shell/command-intent.d.ts +18 -0
- package/dist/orchestration-shell/gemma-intent-classifier.d.ts +48 -0
- package/dist/orchestration-shell/index.d.ts +30 -1
- package/dist/orchestration-shell/web/extract.d.ts +6 -0
- package/dist/prompt-parser.d.ts +11 -0
- package/dist/terminal-menu.d.ts +10 -0
- package/dist/tui-parser/gemma-tui-parser.d.ts +74 -0
- package/dist/tui-parser/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -35885,14 +35885,6 @@ function attachmentsToPipelineImages(attachments) {
|
|
|
35885
35885
|
read: () => readImageFdSafe(attachment.sourcePath, MAX_IMAGE_BYTES)
|
|
35886
35886
|
}));
|
|
35887
35887
|
}
|
|
35888
|
-
function isBlindImageClarification(prompt, clarifyingQuestion) {
|
|
35889
|
-
if (clarifyingQuestion && clarifyingQuestion.trim().length > 0) {
|
|
35890
|
-
let q = clarifyingQuestion.toLowerCase();
|
|
35891
|
-
return /what .*like me to do with the (screenshot|image)/i.test(q) || /what .*want me to do with the (screenshot|image)/i.test(q) || /how should i use (that|this) information/i.test(q) || /information from the (screenshot|image)/i.test(q) || /rephrase that as a specific command or request/i.test(q) || /cannot (see|view|read|inspect) (the )?(image|screenshot)/i.test(q) || /describe what you('d| would) like me to do with (the )?(screenshot|image)/i.test(q);
|
|
35892
|
-
}
|
|
35893
|
-
let p = prompt.toLowerCase();
|
|
35894
|
-
return /what('s| is| do you see) (in |on )?(the |this )?(screenshot|image|picture)/i.test(p) || /what does (the |this )?(screenshot|image|picture) (show|contain|depict)/i.test(p) || /what (shape|color|text) is (in |on )?(this |the )?(image|screenshot)/i.test(p);
|
|
35895
|
-
}
|
|
35896
35888
|
|
|
35897
35889
|
// src/orchestration-shell/slash-suggest.ts
|
|
35898
35890
|
function isSlashCommandInProgress(value) {
|
|
@@ -67590,34 +67582,6 @@ function isWebAccessNeeded(text2) {
|
|
|
67590
67582
|
text2
|
|
67591
67583
|
));
|
|
67592
67584
|
}
|
|
67593
|
-
function hasFileMutationIntent(text2) {
|
|
67594
|
-
if (!text2 || typeof text2 != "string") return !1;
|
|
67595
|
-
let stripped = stripLeadingAgentControlToken(text2).trim(), textWithoutUrls = stripped.replace(/https?:\/\/[^\s]+/gi, " ").trim();
|
|
67596
|
-
if (/\b(?:how\s+(?:to|do\s+I|can\s+I)|explain\s+how\s+to|tell\s+me\s+how\s+to)\b/i.test(stripped) || /(?:^|[.?!;])\s*(?:what\s+(?:is|are)\b|c[oó]mo\s+(?:hacer|puedo|se\s+puede|escribir|guardar|crear)|comment\s+(?:faire|écrire|sauvegarder|créer|enregistrer)|wie\s+(?:kann\s+ich|macht\s+man|schreibt\s+man|speichert\s+man|erstellt\s+man))\b/i.test(stripped) || /(?:如何|怎么|怎样|告诉我(?:如何|怎么|怎样)|解释如何|请问|什么是)/.test(stripped) || /(?:どうやって|方法(?:を(?:教えて|説明して))|やり方を教えて|でしょうか|とは(?:何|なん)ですか)/.test(stripped) || /(?:어떻게|방법을?\s*(?:알려줘|설명해줘)|법\s*설명|하는지\s*알려줘)/.test(stripped))
|
|
67597
|
-
return !1;
|
|
67598
|
-
if (/>{1,2}\s*[\w./-]+\b/.test(textWithoutUrls))
|
|
67599
|
-
return !0;
|
|
67600
|
-
let fileExt = "(?:md|markdown|txt|json|csv|ts|js|tsx|jsx|py|html|css|yaml|yml|log|sh|xml|toml|sql|env)", writeToFilePatternEn = new RegExp(
|
|
67601
|
-
`\\b(?:write|save|create|dump|output|put|export|store|record|guardar|escribir|crear|enregistrer|\xE9crire|cr\xE9er|sauvegarder|speichern|schreiben|erstellen)\\b[\\s\\S]*?\\b(?:into|to|in|as|en|dans|auf|zu)\\b(?!\\s+(?:chat|console|stdout|screen|terminal)\\b)[\\s\\S]*?(?:(?:a|an|the|un|une|ein|eine|el|la)?\\s*file(?:\\s+named|\\s+called)?\\s+)?[\\w./-]+\\.${fileExt}\\b`,
|
|
67602
|
-
"i"
|
|
67603
|
-
), writeToFilePatternGermanic = new RegExp(
|
|
67604
|
-
`\\b(?:in|auf|zu|into|to)\\s+[\\w./-]+\\.${fileExt}[\\s\\S]*?\\b(?:speichern|schreiben|erstellen|ablegen)\\b`,
|
|
67605
|
-
"i"
|
|
67606
|
-
), namedFilePatternEn = /\b(?:into|to|in|en|dans|auf|zu)\s+(?:a|an|un|une|ein|eine|el|la)?\s*file(?:\s+(?:named|called))?\s+[\w./-]+\b/i, createFilePatternEn = /\b(?:create|add|touch)\s+(?:a|an|the)?\s*(?:new\s+)?(?:file|markdown\s+file|script)\b/i, directFileVerbPatternEn = new RegExp(
|
|
67607
|
-
`\\b(?:create|write|touch|add|crear|escribir|cr\xE9er|\xE9crire|erstellen)\\s+[\\w./-]+\\.${fileExt}\\b`,
|
|
67608
|
-
"i"
|
|
67609
|
-
), writeToFilePatternZh = new RegExp(
|
|
67610
|
-
`(?:\u5199\u5165|\u4FDD\u5B58\u5230?|\u521B\u5EFA|\u751F\u6210|\u8F93\u51FA\u5230|\u5B58\u5165|\u5BFC\u51FA\u5230?|\u8BB0\u5F55\u5230?)[\\s\\S]*?[\\w./-]+\\.${fileExt}\\b`,
|
|
67611
|
-
"i"
|
|
67612
|
-
), writeToFilePatternJa = new RegExp(
|
|
67613
|
-
`(?:[\\w./-]+\\.${fileExt}[\\s\\S]*?(?:\u306B|\u3078)?\\s*(?:\u66F8\u304D\u51FA|\u4FDD\u5B58|\u4F5C\u6210|\u751F\u6210|\u51FA\u529B|\u8A18\u9332|\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8)|(?:\u66F8\u304D\u51FA|\u4FDD\u5B58|\u4F5C\u6210|\u751F\u6210|\u51FA\u529B|\u8A18\u9332|\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8)[\\s\\S]*?[\\w./-]+\\.${fileExt})`,
|
|
67614
|
-
"i"
|
|
67615
|
-
), writeToFilePatternKo = new RegExp(
|
|
67616
|
-
`(?:[\\w./-]+\\.${fileExt}[\\s\\S]*?(?:\uC5D0|\uC73C\uB85C|\uB85C)?\\s*(?:\uC800\uC7A5|\uC791\uC131|\uC0DD\uC131|\uAE30\uB85D|\uCD9C\uB825|\uB0B4\uBCF4\uB0B4\uAE30)|(?:\uC800\uC7A5|\uC791\uC131|\uC0DD\uC131|\uAE30\uB85D|\uCD9C\uB825|\uB0B4\uBCF4\uB0B4\uAE30)[\\s\\S]*?[\\w./-]+\\.${fileExt})`,
|
|
67617
|
-
"i"
|
|
67618
|
-
);
|
|
67619
|
-
return writeToFilePatternEn.test(textWithoutUrls) || writeToFilePatternGermanic.test(textWithoutUrls) || namedFilePatternEn.test(textWithoutUrls) || createFilePatternEn.test(textWithoutUrls) || directFileVerbPatternEn.test(textWithoutUrls) || writeToFilePatternZh.test(textWithoutUrls) || writeToFilePatternJa.test(textWithoutUrls) || writeToFilePatternKo.test(textWithoutUrls);
|
|
67620
|
-
}
|
|
67621
67585
|
|
|
67622
67586
|
// src/orchestration-shell/quorum-loop.ts
|
|
67623
67587
|
var CONTINUATION_EXPIRES_TTL_MS = 1440 * 60 * 1e3, ACTIVE_AGENT_KINDS = ["CLAUDE", "CODEX", "ANTIGRAVITY"], TEAM_RECOVERY_RELAUNCH_CONCURRENCY = 3;
|
|
@@ -83856,6 +83820,155 @@ var DEFAULT_REFRESH_MS = 300 * 1e3, MAX_RESOLUTION_TICK_ATTEMPTS = 12, TERMINAL_
|
|
|
83856
83820
|
}
|
|
83857
83821
|
};
|
|
83858
83822
|
|
|
83823
|
+
// src/orchestration-shell/gemma-intent-classifier.ts
|
|
83824
|
+
var INTENT_CLASSIFIER_JSON_SCHEMA = {
|
|
83825
|
+
type: "object",
|
|
83826
|
+
properties: {
|
|
83827
|
+
action: {
|
|
83828
|
+
type: "string",
|
|
83829
|
+
enum: ["start_task", "familiarize", "advisory_response", "browse", "brainstorm", "ask_user"]
|
|
83830
|
+
},
|
|
83831
|
+
is_code_or_disk_mutation: { type: "boolean" },
|
|
83832
|
+
confidence: { type: "string", enum: ["high", "low"] },
|
|
83833
|
+
requires_file_read: { type: "boolean" },
|
|
83834
|
+
rationale: { type: "string" }
|
|
83835
|
+
},
|
|
83836
|
+
required: ["action", "is_code_or_disk_mutation", "confidence", "requires_file_read", "rationale"]
|
|
83837
|
+
}, DEFAULT_INTENT_TIMEOUT_MS = 5e3, INTENT_MAX_OUTPUT_TOKENS = 256;
|
|
83838
|
+
function buildIntentClassifierPrompt(prompt, clarifications) {
|
|
83839
|
+
return [
|
|
83840
|
+
"You are a strict code/workspace intent classifier for CodeVibe.",
|
|
83841
|
+
"Analyze the user prompt and clarifications to determine whether the user is requesting a code or filesystem mutation, or an informational/read-only turn.",
|
|
83842
|
+
"Output STRICT JSON ONLY matching this schema:",
|
|
83843
|
+
'{"action": "start_task"|"familiarize"|"advisory_response"|"browse"|"brainstorm"|"ask_user", "is_code_or_disk_mutation": boolean, "confidence": "high"|"low", "requires_file_read": boolean, "rationale": "short explanation"}',
|
|
83844
|
+
"",
|
|
83845
|
+
"Rules:",
|
|
83846
|
+
'1. "is_code_or_disk_mutation": true if the user asks to create, modify, edit, delete, write, record, note, save, append, refactor, implement, or run code/tests/files on disk (e.g. "fix auth.ts", "delete temp.js", "create a React component", "run the test suite", "update the config file"). CRITICAL: writing, noting, recording, or saving data into any file (e.g. "note X in file.csv", "write X into file.txt", "record X in file.json") IS a disk mutation ("is_code_or_disk_mutation": true, "action": "start_task"). CRITICAL: adding comments to code or commenting helpers/functions in source files (e.g. "comment the helpers in auth.ts", "prepend a comment to auth.ts", "comment out the unused helpers") IS a code modification ("is_code_or_disk_mutation": true, "action": "start_task"), whereas providing commentary or feedback about code in chat (e.g. "comment on the logic in auth.ts", "comment on the error handling") is read-only ("is_code_or_disk_mutation": false, "action": "advisory_response").',
|
|
83847
|
+
'2. "is_code_or_disk_mutation": false for read-only understanding, file inspection, or informational questions (e.g. "What files are here?", "Summarize numbers in statement.pdf", "Explain how auth works", "Organize them by category in your response", "Explain what happens when I press tab and enter", "Read auth.ts and explain why we can populate the values in output.json"). Questions asking to explain why tests fail, analyze crashes, explain system behavior after a change, or explain why an action/step is taken (e.g. "Explain why we update config.json", "Explain why we read notice.pdf and redact the amounts", "Explain why we inspect auth.ts and note findings into report.md"), or asking to paste example commands in a chat reply, are explanatory inquiries ("is_code_or_disk_mutation": false, "action": "advisory_response") when no explicit disk edit is commanded.',
|
|
83848
|
+
"3. Action routing:",
|
|
83849
|
+
' - "familiarize": Read-only overview or exploration of the project, folder, files, or workspace structure without file modification.',
|
|
83850
|
+
' - "advisory_response": General questions, capability queries, or reading/summarizing/explaining specific files without disk mutation.',
|
|
83851
|
+
' - "start_task": Direct request to modify code, edit files, fix bugs, implement features, or run commands on disk.',
|
|
83852
|
+
' - "browse": Web browsing or search without disk mutation.',
|
|
83853
|
+
' - "brainstorm": Exploring architecture choices or design options.',
|
|
83854
|
+
'4. "requires_file_read": true if answering the prompt requires reading or inspecting specific file(s) or document(s) in the workspace (e.g. "Tell me the wage amount from w2_2024_employer.txt", "Summarize statement.pdf", "Inspect auth.ts", "w2_2024_employer.txt"). false for general conceptual questions, project structure/familiarize, or questions not referencing specific workspace files.',
|
|
83855
|
+
'5. Conversational keypresses (e.g. "press enter", "hit tab") and data attributes (e.g. "comment text", "table columns") are NOT code or file mutations.',
|
|
83856
|
+
'6. If the request is ambiguous, self-contradictory, contains mixed read and write instructions, or you are uncertain, set "confidence": "low", "is_code_or_disk_mutation": true, and "action": "start_task".',
|
|
83857
|
+
"",
|
|
83858
|
+
clarifications && clarifications.length > 0 ? [
|
|
83859
|
+
"Prior clarifications in this turn:",
|
|
83860
|
+
...clarifications.map((c, i) => `Q${i + 1}: ${c.question}
|
|
83861
|
+
A${i + 1}: ${c.answer}`),
|
|
83862
|
+
""
|
|
83863
|
+
].join(`
|
|
83864
|
+
`) : "",
|
|
83865
|
+
"=== BEGIN USER PROMPT ===",
|
|
83866
|
+
prompt,
|
|
83867
|
+
"=== END USER PROMPT ==="
|
|
83868
|
+
].join(`
|
|
83869
|
+
`);
|
|
83870
|
+
}
|
|
83871
|
+
function parseIntentGemmaResponse(raw) {
|
|
83872
|
+
try {
|
|
83873
|
+
let parsed = JSON.parse(raw.trim());
|
|
83874
|
+
return typeof parsed != "object" || parsed === null || typeof parsed.is_code_or_disk_mutation != "boolean" || !["start_task", "familiarize", "advisory_response", "browse", "brainstorm", "ask_user"].includes(
|
|
83875
|
+
parsed.action
|
|
83876
|
+
) || parsed.confidence !== "high" && parsed.confidence !== "low" || typeof parsed.rationale != "string" || parsed.rationale.trim().length === 0 || parsed.action === "start_task" && !parsed.is_code_or_disk_mutation || parsed.action !== "start_task" && parsed.is_code_or_disk_mutation || typeof parsed.requires_file_read != "boolean" ? null : {
|
|
83877
|
+
action: parsed.action,
|
|
83878
|
+
is_code_or_disk_mutation: !!parsed.is_code_or_disk_mutation,
|
|
83879
|
+
confidence: parsed.confidence,
|
|
83880
|
+
rationale: parsed.rationale.trim(),
|
|
83881
|
+
source: "model",
|
|
83882
|
+
requires_file_read: parsed.requires_file_read
|
|
83883
|
+
};
|
|
83884
|
+
} catch {
|
|
83885
|
+
return null;
|
|
83886
|
+
}
|
|
83887
|
+
}
|
|
83888
|
+
function failClosedDefault(rationale, source2 = "semantic_fail_closed") {
|
|
83889
|
+
return {
|
|
83890
|
+
action: "start_task",
|
|
83891
|
+
is_code_or_disk_mutation: !0,
|
|
83892
|
+
confidence: "low",
|
|
83893
|
+
rationale,
|
|
83894
|
+
source: source2,
|
|
83895
|
+
requires_file_read: !1
|
|
83896
|
+
};
|
|
83897
|
+
}
|
|
83898
|
+
function isInfrastructureTransportOutage(err) {
|
|
83899
|
+
if (!err || err instanceof GemmaPolicyError || err instanceof GemmaContextFullError || err instanceof GemmaEmptyOutputError || err instanceof GemmaHiddenTokenLoopError || err instanceof GemmaBackendTooOldError || err?.name === "GemmaPolicyError" || err?.name === "GemmaContextFullError" || err?.name === "GemmaEmptyOutputError" || err?.name === "GemmaHiddenTokenLoopError" || err?.name === "GemmaBackendTooOldError" || err?.name === "AssertionError" || err?.constructor?.name === "AssertionError")
|
|
83900
|
+
return !1;
|
|
83901
|
+
let errMessage = String(err?.message || ""), causeObj = err?.cause, causeMessage = String(causeObj?.message || "");
|
|
83902
|
+
if (/\b(?:has no classify|no classify)\b/i.test(errMessage) || /\b(?:has no classify|no classify)\b/i.test(causeMessage))
|
|
83903
|
+
return !1;
|
|
83904
|
+
let e = err, cause = e.cause || void 0, causeCode = String(cause?.code || ""), causeName = String(cause?.name || ""), nestedCause = cause?.cause || void 0, nestedCauseCode = String(nestedCause?.code || ""), nestedCauseName = String(nestedCause?.name || ""), deepCause = nestedCause?.cause || void 0, deepCauseCode = String(deepCause?.code || "");
|
|
83905
|
+
if (causeName === "AssertionError" || nestedCauseName === "AssertionError" || cause instanceof ReferenceError || cause instanceof RangeError || cause instanceof SyntaxError || nestedCause instanceof ReferenceError || nestedCause instanceof RangeError || nestedCause instanceof SyntaxError || causeName === "ReferenceError" || causeName === "RangeError" || causeName === "SyntaxError" || nestedCauseName === "ReferenceError" || nestedCauseName === "RangeError" || nestedCauseName === "SyntaxError")
|
|
83906
|
+
return !1;
|
|
83907
|
+
let networkCodes = [
|
|
83908
|
+
"ECONNREFUSED",
|
|
83909
|
+
"ENOTFOUND",
|
|
83910
|
+
"EAI_AGAIN",
|
|
83911
|
+
"EHOSTUNREACH",
|
|
83912
|
+
"ENETUNREACH",
|
|
83913
|
+
"ECONNRESET",
|
|
83914
|
+
"EPIPE",
|
|
83915
|
+
"ETIMEDOUT",
|
|
83916
|
+
"UND_ERR_CONNECT_TIMEOUT",
|
|
83917
|
+
"UND_ERR_SOCKET",
|
|
83918
|
+
"UND_ERR_HEADERS_TIMEOUT",
|
|
83919
|
+
"UND_ERR_BODY_TIMEOUT",
|
|
83920
|
+
"UND_ERR_DESTROYED",
|
|
83921
|
+
"UND_ERR_CLOSED"
|
|
83922
|
+
];
|
|
83923
|
+
if (networkCodes.includes(causeCode) || networkCodes.includes(nestedCauseCode) || networkCodes.includes(deepCauseCode))
|
|
83924
|
+
return !0;
|
|
83925
|
+
if (err instanceof GemmaTransportError || err?.name === "GemmaTransportError")
|
|
83926
|
+
return cause instanceof TypeError || causeName === "TypeError" || nestedCause instanceof TypeError || nestedCauseName === "TypeError" ? !!(networkCodes.includes(nestedCauseCode) || networkCodes.includes(causeCode) || networkCodes.includes(deepCauseCode)) : !0;
|
|
83927
|
+
if (err instanceof TypeError || err?.name === "TypeError") {
|
|
83928
|
+
let causeMsg = String(cause?.message || ""), parentMsg = String(e.message || "");
|
|
83929
|
+
return !!(/\b(?:fetch failed)\b/i.test(parentMsg) && (/\b(?:connect ECONNREFUSED|ENOTFOUND|EAI_AGAIN|network|socket|timed?\s*out|und_err)\b/i.test(causeMsg) || /\b(?:connect ECONNREFUSED|ENOTFOUND|EAI_AGAIN|network|socket|und_err)\b/i.test(parentMsg)));
|
|
83930
|
+
}
|
|
83931
|
+
if (err instanceof ReferenceError || err instanceof RangeError || err instanceof SyntaxError || err?.name === "ReferenceError" || err?.name === "RangeError" || err?.name === "SyntaxError")
|
|
83932
|
+
return !1;
|
|
83933
|
+
if (err instanceof GemmaAbortError || err?.name === "AbortError")
|
|
83934
|
+
return !0;
|
|
83935
|
+
let name = String(e.name || ""), msg = String(e.message || ""), code = String(e.code || "");
|
|
83936
|
+
return !!(name === "TimeoutError" || name === "AbortError" || code === "ETIMEDOUT" || code === "UND_ERR_CONNECT_TIMEOUT" || code === "UND_ERR_SOCKET" || code === "UND_ERR_HEADERS_TIMEOUT" || code === "UND_ERR_BODY_TIMEOUT" || code === "UND_ERR_DESTROYED" || code === "UND_ERR_CLOSED" || /\b(?:timed?\s*out|caller_aborted)\b/i.test(msg) || networkCodes.includes(code) || /\b(?:fetch failed|socket hang up|connection refused|network error|dns lookup failed|cannot reach|und_err_socket|und_err_connect_timeout)\b/i.test(
|
|
83937
|
+
msg
|
|
83938
|
+
));
|
|
83939
|
+
}
|
|
83940
|
+
async function classifyPromptIntentWithGemma(input, port, opts) {
|
|
83941
|
+
if (!input || !input.prompt || input.prompt.trim().length === 0)
|
|
83942
|
+
return failClosedDefault("empty_prompt", "semantic_fail_closed");
|
|
83943
|
+
if (opts?.signal?.aborted)
|
|
83944
|
+
return failClosedDefault("caller_aborted", "infrastructure_outage");
|
|
83945
|
+
let timeoutMs = opts?.timeoutMs ?? DEFAULT_INTENT_TIMEOUT_MS, controller = new AbortController(), timer, callerAbortHandler, failurePromise = new Promise((_, reject) => {
|
|
83946
|
+
timer = setTimeout(() => {
|
|
83947
|
+
reject(new Error(`Gemma intent classification timed out after ${timeoutMs}ms`)), controller.abort();
|
|
83948
|
+
}, timeoutMs), opts?.signal && (callerAbortHandler = () => {
|
|
83949
|
+
reject(new Error("caller_aborted")), controller.abort();
|
|
83950
|
+
}, opts.signal.addEventListener("abort", callerAbortHandler, { once: !0 }));
|
|
83951
|
+
});
|
|
83952
|
+
try {
|
|
83953
|
+
let prompt = buildIntentClassifierPrompt(input.prompt, input.clarifications), classifyPromise = port.classify({
|
|
83954
|
+
prompt,
|
|
83955
|
+
jsonSchema: INTENT_CLASSIFIER_JSON_SCHEMA,
|
|
83956
|
+
maxOutputTokens: INTENT_MAX_OUTPUT_TOKENS,
|
|
83957
|
+
signal: controller.signal,
|
|
83958
|
+
timeoutMs
|
|
83959
|
+
});
|
|
83960
|
+
classifyPromise.catch(() => {
|
|
83961
|
+
});
|
|
83962
|
+
let res = await Promise.race([classifyPromise, failurePromise]), parsed = parseIntentGemmaResponse(res.text);
|
|
83963
|
+
return parsed ? parsed.confidence === "low" ? failClosedDefault("low_confidence_intent", "semantic_fail_closed") : parsed : failClosedDefault("unparseable_gemma_intent_response", "semantic_fail_closed");
|
|
83964
|
+
} catch (err) {
|
|
83965
|
+
let msg = err?.message || "unknown";
|
|
83966
|
+
return err instanceof GemmaPolicyError || err instanceof GemmaContextFullError || err instanceof GemmaEmptyOutputError || err instanceof GemmaHiddenTokenLoopError || err instanceof GemmaBackendTooOldError || err?.name === "GemmaPolicyError" || err?.name === "GemmaContextFullError" || err?.name === "GemmaEmptyOutputError" || err?.name === "GemmaHiddenTokenLoopError" || err?.name === "GemmaBackendTooOldError" ? failClosedDefault(`gemma_policy_or_capacity_error: ${msg}`, "semantic_fail_closed") : isInfrastructureTransportOutage(err) ? failClosedDefault(`gemma_transport_outage: ${msg}`, "infrastructure_outage") : failClosedDefault(`gemma_intent_error: ${msg}`, "semantic_fail_closed");
|
|
83967
|
+
} finally {
|
|
83968
|
+
timer && clearTimeout(timer), opts?.signal && callerAbortHandler && opts.signal.removeEventListener("abort", callerAbortHandler);
|
|
83969
|
+
}
|
|
83970
|
+
}
|
|
83971
|
+
|
|
83859
83972
|
// src/orchestration-shell/brainstorm-quorum.ts
|
|
83860
83973
|
var BRAINSTORM_PANEL_MIN_TIER = "MAX";
|
|
83861
83974
|
function resolveBrainstormPanel(input) {
|
|
@@ -89197,7 +89310,7 @@ async function redelegateRepoStateReadQuietly(deps) {
|
|
|
89197
89310
|
if (!repoStateRedelegationsInFlight.has(workspaceId)) {
|
|
89198
89311
|
repoStateRedelegationsInFlight.add(workspaceId);
|
|
89199
89312
|
try {
|
|
89200
|
-
let workingDir = args.quorumLoop.getWorkingDir(), detected = typeof args.quorumLoop.getDetectedAgents == "function" ? args.quorumLoop.getDetectedAgents() : [], { agent } = selectImplementorAgent(detected), brief = renderFamiliarizeAgentBrief(
|
|
89313
|
+
let workingDir = args.quorumLoop.getWorkingDir(), detected = typeof args.quorumLoop.getDetectedAgents == "function" ? args.quorumLoop.getDetectedAgents() : [], pref = readImplementorPreferenceSync(), { agent } = selectImplementorAgent(detected, null, [], pref.priorityOrder), brief = renderFamiliarizeAgentBrief(
|
|
89201
89314
|
"The repository HEAD moved since the last codebase overview. Re-read the codebase and produce an updated structural overview."
|
|
89202
89315
|
), baseIntent = agentMentionIntentFromOverride(agent), intent = baseIntent ? { ...baseIntent, promptForPlanning: brief } : {
|
|
89203
89316
|
target: "CLAUDE",
|
|
@@ -89277,7 +89390,7 @@ async function routeFamiliarize(deps) {
|
|
|
89277
89390
|
let state = store.getState(), frontierAvailable = !!(args.localExecutor && args.quorumLoop);
|
|
89278
89391
|
if (state.structuralSummary && frontierAvailable)
|
|
89279
89392
|
try {
|
|
89280
|
-
let workingDir = args.quorumLoop.getWorkingDir(), detected = typeof args.quorumLoop.getDetectedAgents == "function" ? args.quorumLoop.getDetectedAgents() : [], { agent } = selectImplementorAgent(detected), brief = renderFamiliarizeAgentBrief(deps.userPrompt), baseIntent = agentMentionIntentFromOverride(agent), intent = baseIntent ? { ...baseIntent, promptForPlanning: brief } : {
|
|
89393
|
+
let workingDir = args.quorumLoop.getWorkingDir(), detected = typeof args.quorumLoop.getDetectedAgents == "function" ? args.quorumLoop.getDetectedAgents() : [], pref = readImplementorPreferenceSync(), { agent } = selectImplementorAgent(detected, null, [], pref.priorityOrder), brief = renderFamiliarizeAgentBrief(deps.userPrompt), baseIntent = agentMentionIntentFromOverride(agent), intent = baseIntent ? { ...baseIntent, promptForPlanning: brief } : {
|
|
89281
89394
|
target: "CLAUDE",
|
|
89282
89395
|
rawMention: "@claude",
|
|
89283
89396
|
isLeadingControlToken: !0,
|
|
@@ -89373,6 +89486,61 @@ function renderFamiliarizeAgentBrief(userPrompt) {
|
|
|
89373
89486
|
].join(`
|
|
89374
89487
|
`);
|
|
89375
89488
|
}
|
|
89489
|
+
async function routeDocumentInspectionAdvisory(deps) {
|
|
89490
|
+
let { store, args, userPrompt } = deps;
|
|
89491
|
+
if (!args.localExecutor || !args.quorumLoop)
|
|
89492
|
+
return store.dispatch({
|
|
89493
|
+
type: "SHELL_ADVISORY",
|
|
89494
|
+
source: "shell",
|
|
89495
|
+
text: "A read-capable model is required to inspect and summarize documents in this workspace. No task was started and no files were modified."
|
|
89496
|
+
}), !1;
|
|
89497
|
+
let workingDir = args.quorumLoop.getWorkingDir(), detected = typeof args.quorumLoop.getDetectedAgents == "function" ? args.quorumLoop.getDetectedAgents() : [], pref = readImplementorPreferenceSync(), { agent } = selectImplementorAgent(detected, null, [], pref.priorityOrder), baseIntent = agentMentionIntentFromOverride(agent), intent = baseIntent ? { ...baseIntent, promptForPlanning: userPrompt } : {
|
|
89498
|
+
target: "CLAUDE",
|
|
89499
|
+
rawMention: "@claude",
|
|
89500
|
+
isLeadingControlToken: !1,
|
|
89501
|
+
promptForPlanning: userPrompt,
|
|
89502
|
+
tokenStartUtf16: 0,
|
|
89503
|
+
tokenEndUtf16: 0
|
|
89504
|
+
}, showSpinner = store.getState().progress === null;
|
|
89505
|
+
showSpinner && deps.onProgress?.({
|
|
89506
|
+
phase: "advisory_dispatched",
|
|
89507
|
+
agents: [agentDisplayName(agent)]
|
|
89508
|
+
});
|
|
89509
|
+
try {
|
|
89510
|
+
let result = await runReadOnlyAgentAdvisoryResult({
|
|
89511
|
+
shellArgs: args,
|
|
89512
|
+
agent,
|
|
89513
|
+
intent,
|
|
89514
|
+
advisoryBrief: userPrompt,
|
|
89515
|
+
workingDir
|
|
89516
|
+
});
|
|
89517
|
+
if (result.ok) {
|
|
89518
|
+
let output = sanitizeForTerminal(result.text);
|
|
89519
|
+
return store.dispatch({
|
|
89520
|
+
type: "SHELL_ADVISORY",
|
|
89521
|
+
source: "shell",
|
|
89522
|
+
text: output
|
|
89523
|
+
}), !0;
|
|
89524
|
+
} else {
|
|
89525
|
+
let failureMessage = "A read-capable model is required to inspect and summarize documents in this workspace. No task was started and no files were modified.";
|
|
89526
|
+
return result.usage.unavailableReason === "workspace_mutation_detected" ? failureMessage = "A workspace mutation was detected during document inspection. Please inspect the workspace." : result.usage.unavailableReason === "workspace_verification_unavailable" ? failureMessage = "Workspace integrity could not be verified following document inspection." : result.timedOut && (failureMessage = "Document inspection timed out. No task was started and no files were modified."), store.dispatch({
|
|
89527
|
+
type: "SHELL_ADVISORY",
|
|
89528
|
+
source: "shell",
|
|
89529
|
+
text: failureMessage
|
|
89530
|
+
}), !1;
|
|
89531
|
+
}
|
|
89532
|
+
} catch (err) {
|
|
89533
|
+
return logger.warn("[orchestration-shell] document inspection advisory failed", {
|
|
89534
|
+
error: err.message
|
|
89535
|
+
}), store.dispatch({
|
|
89536
|
+
type: "SHELL_ADVISORY",
|
|
89537
|
+
source: "shell",
|
|
89538
|
+
text: "Document inspection encountered an unexpected error. Please inspect the workspace."
|
|
89539
|
+
}), !1;
|
|
89540
|
+
} finally {
|
|
89541
|
+
showSpinner && deps.onProgress?.({ phase: "waiting_user" });
|
|
89542
|
+
}
|
|
89543
|
+
}
|
|
89376
89544
|
async function routeBrainstorm(deps) {
|
|
89377
89545
|
let {
|
|
89378
89546
|
store,
|
|
@@ -91090,7 +91258,7 @@ async function handleShellUserInput(deps) {
|
|
|
91090
91258
|
wallClockMsRemaining: 3e4,
|
|
91091
91259
|
reviseAttempts: 0
|
|
91092
91260
|
}
|
|
91093
|
-
}, decision, pendingStartConfirmation, showClassifySpinner = store.getState().progress === null, classifyPipeline = args.localAdvisoryRunner, stopClassifyRelabel;
|
|
91261
|
+
}, decision, pendingStartConfirmation, isDemotedDocumentInspection = !1, showClassifySpinner = store.getState().progress === null, classifyPipeline = args.localAdvisoryRunner, stopClassifyRelabel;
|
|
91094
91262
|
showClassifySpinner && (dispatchProgress({
|
|
91095
91263
|
phase: "planner_classifying",
|
|
91096
91264
|
...classifyPipeline ? { runtimeNoun: progressRuntimeNoun(classifyPipeline) } : {}
|
|
@@ -91106,20 +91274,71 @@ async function handleShellUserInput(deps) {
|
|
|
91106
91274
|
} finally {
|
|
91107
91275
|
stopClassifyRelabel?.();
|
|
91108
91276
|
}
|
|
91109
|
-
|
|
91277
|
+
logger.info("[orchestration-shell] Planner classified input", {
|
|
91110
91278
|
prompt: plannerInput.prompt,
|
|
91111
91279
|
action: decision.action,
|
|
91112
91280
|
rationale: decision.rationale
|
|
91113
|
-
}),
|
|
91114
|
-
|
|
91115
|
-
|
|
91116
|
-
|
|
91117
|
-
|
|
91118
|
-
|
|
91119
|
-
|
|
91120
|
-
|
|
91121
|
-
|
|
91122
|
-
|
|
91281
|
+
}), isDemotedDocumentInspection = !1;
|
|
91282
|
+
let gemmaEvaluatedIntent = !1, allTurnTexts = [
|
|
91283
|
+
plannerInput.prompt,
|
|
91284
|
+
...plannerInput.clarifications.map((c) => c.answer)
|
|
91285
|
+
];
|
|
91286
|
+
if ((decision.action === "start_task" || decision.action === "browse") && args.localAdvisoryRunner && process.env.CODEVIBE_INTENT_CLASSIFIER !== "regex") {
|
|
91287
|
+
let gemmaIntent = await classifyPromptIntentWithGemma(
|
|
91288
|
+
{ prompt: plannerInput.prompt, clarifications: plannerInput.clarifications },
|
|
91289
|
+
args.localAdvisoryRunner
|
|
91290
|
+
);
|
|
91291
|
+
if (gemmaIntent.source === "model")
|
|
91292
|
+
gemmaEvaluatedIntent = !0, decision.action === "browse" ? gemmaIntent.is_code_or_disk_mutation && (logger.info(
|
|
91293
|
+
"[orchestration-shell] Gemma intent classifier: promoting browse to start_task with code/disk mutation",
|
|
91294
|
+
{ prompt: plannerInput.prompt, rationale: gemmaIntent.rationale }
|
|
91295
|
+
), decision = {
|
|
91296
|
+
action: "start_task",
|
|
91297
|
+
rationale: decision.rationale ? `${decision.rationale} (promoted to start_task via Gemma intent classifier)` : gemmaIntent.rationale
|
|
91298
|
+
}) : gemmaIntent.is_code_or_disk_mutation ? logger.info(
|
|
91299
|
+
"[orchestration-shell] Gemma intent classifier: confirmed start_task with code/disk mutation",
|
|
91300
|
+
{ prompt: plannerInput.prompt, rationale: gemmaIntent.rationale }
|
|
91301
|
+
) : gemmaIntent.action === "familiarize" && !gemmaIntent.requires_file_read ? (logger.info(
|
|
91302
|
+
"[orchestration-shell] Gemma intent classifier: demoting start_task to familiarize",
|
|
91303
|
+
{ prompt: plannerInput.prompt, rationale: gemmaIntent.rationale }
|
|
91304
|
+
), decision = {
|
|
91305
|
+
action: "familiarize",
|
|
91306
|
+
rationale: decision.rationale ? `${decision.rationale} (demoted to familiarize via Gemma intent classifier)` : gemmaIntent.rationale
|
|
91307
|
+
}) : (logger.info(
|
|
91308
|
+
"[orchestration-shell] Gemma intent classifier: demoting start_task to advisory_response",
|
|
91309
|
+
{ prompt: plannerInput.prompt, rationale: gemmaIntent.rationale }
|
|
91310
|
+
), gemmaIntent.requires_file_read && (isDemotedDocumentInspection = !0), decision = {
|
|
91311
|
+
action: "advisory_response",
|
|
91312
|
+
rationale: decision.rationale ? `${decision.rationale} (demoted to advisory_response via Gemma intent classifier)` : gemmaIntent.rationale,
|
|
91313
|
+
advisory_summary: void 0
|
|
91314
|
+
});
|
|
91315
|
+
else if (gemmaIntent.source === "semantic_fail_closed")
|
|
91316
|
+
gemmaEvaluatedIntent = !0, logger.warn(
|
|
91317
|
+
"[orchestration-shell] Gemma intent classifier: semantic fail-closed; asking user to clarify intent",
|
|
91318
|
+
{ rationale: gemmaIntent.rationale }
|
|
91319
|
+
), decision = {
|
|
91320
|
+
action: "ask_user",
|
|
91321
|
+
rationale: gemmaIntent.rationale,
|
|
91322
|
+
clarifying_question: "Could you please clarify whether you would like to inspect/read files or modify code on disk?"
|
|
91323
|
+
};
|
|
91324
|
+
else {
|
|
91325
|
+
gemmaEvaluatedIntent = !0;
|
|
91326
|
+
let outageMessage = "Model service is temporarily unavailable. CodeVibe cannot process requests without a responsive model.";
|
|
91327
|
+
logger.warn(
|
|
91328
|
+
"[orchestration-shell] Gemma intent classifier: infrastructure outage; halting with user outage advisory",
|
|
91329
|
+
{ rationale: gemmaIntent.rationale }
|
|
91330
|
+
), store.dispatch({
|
|
91331
|
+
type: "PLANNER_DECISION",
|
|
91332
|
+
decision: {
|
|
91333
|
+
action: "advisory_response",
|
|
91334
|
+
rationale: gemmaIntent.rationale,
|
|
91335
|
+
advisory_summary: outageMessage
|
|
91336
|
+
}
|
|
91337
|
+
}), clearPendingClarificationIfPresent(store);
|
|
91338
|
+
return;
|
|
91339
|
+
}
|
|
91340
|
+
}
|
|
91341
|
+
if (decision.action === "start_task" && plannerInput.clarifications.length === 0 && isDestructiveFileRequest(plannerInput.prompt))
|
|
91123
91342
|
logger.warn(
|
|
91124
91343
|
"[orchestration-shell] P43 backstop: a destructive file request was classified start_task without a confirmation this turn; asking first",
|
|
91125
91344
|
{ rationale: decision.rationale }
|
|
@@ -91232,7 +91451,7 @@ async function handleShellUserInput(deps) {
|
|
|
91232
91451
|
} : void 0, isImageAdvisory = decision.action === "advisory_response" && turnAttachments.length > 0, mentionIntentForLocalSuppression = mentionIntent ?? agentMentionIntentFromOverride(effectiveExplicitAgentOverride), suppressMentionLocalAnswer = shouldSuppressMentionLocalAnswer(
|
|
91233
91452
|
mentionIntentForLocalSuppression,
|
|
91234
91453
|
decision
|
|
91235
|
-
), contextualAdvisoryTurns = decision.action === "advisory_response" && !isImageAdvisory && !suppressMentionLocalAnswer && args.localAdvisoryRunner ? collectPriorBrainstormTurns(store.getState().conversation, dispatchText) : [], isTextAdvisory = decision.action === "advisory_response" && !isImageAdvisory && !suppressMentionLocalAnswer && !!args.localAdvisoryRunner, reducerDecision = isImageAdvisory ? { ...decision, advisory_summary: void 0, clarifying_question: void 0, rationale: "" } : isTextAdvisory ? { ...decision, advisory_summary: void 0, clarifying_question: void 0, rationale: "" } : suppressMentionLocalAnswer ? { ...decision, advisory_summary: void 0, clarifying_question: void 0, rationale: "" } : decision.action === "team_decompose" || decision.action === "familiarize" || decision.action === "brainstorm" || // WEB-BROWSING (Stage-2-r3 MED): strip any advisory_summary/clarifying_question
|
|
91454
|
+
), contextualAdvisoryTurns = decision.action === "advisory_response" && !isImageAdvisory && !suppressMentionLocalAnswer && args.localAdvisoryRunner ? collectPriorBrainstormTurns(store.getState().conversation, dispatchText) : [], isTextAdvisory = decision.action === "advisory_response" && !isImageAdvisory && !suppressMentionLocalAnswer && !!args.localAdvisoryRunner, reducerDecision = isImageAdvisory ? { ...decision, advisory_summary: void 0, clarifying_question: void 0, rationale: "" } : isTextAdvisory ? { ...decision, advisory_summary: void 0, clarifying_question: void 0, rationale: "" } : suppressMentionLocalAnswer ? { ...decision, advisory_summary: void 0, clarifying_question: void 0, rationale: "" } : isDemotedDocumentInspection ? { ...decision, advisory_summary: void 0, clarifying_question: void 0, rationale: "" } : decision.action === "team_decompose" || decision.action === "familiarize" || decision.action === "brainstorm" || // WEB-BROWSING (Stage-2-r3 MED): strip any advisory_summary/clarifying_question
|
|
91236
91455
|
// off a `browse` so no ungrounded planner text renders before the fetched answer.
|
|
91237
91456
|
decision.action === "browse" ? { ...decision, advisory_summary: void 0, clarifying_question: void 0 } : decision;
|
|
91238
91457
|
if (store.dispatch({
|
|
@@ -91240,7 +91459,21 @@ async function handleShellUserInput(deps) {
|
|
|
91240
91459
|
decision: reducerDecision,
|
|
91241
91460
|
...brainstormMetadata ? { brainstorm: brainstormMetadata } : {},
|
|
91242
91461
|
...pendingStartConfirmation ? { startConfirmation: pendingStartConfirmation } : {}
|
|
91243
|
-
}),
|
|
91462
|
+
}), isDemotedDocumentInspection && !suppressMentionLocalAnswer) {
|
|
91463
|
+
let advisoryBrief = composeReadOnlyAdvisoryBrief(
|
|
91464
|
+
pendingForPlanning,
|
|
91465
|
+
plannerPromptText,
|
|
91466
|
+
answeredThisTurn
|
|
91467
|
+
);
|
|
91468
|
+
await routeDocumentInspectionAdvisory({
|
|
91469
|
+
store,
|
|
91470
|
+
args,
|
|
91471
|
+
userPrompt: advisoryBrief,
|
|
91472
|
+
onProgress: deps.onProgress
|
|
91473
|
+
});
|
|
91474
|
+
return;
|
|
91475
|
+
}
|
|
91476
|
+
if (suppressMentionLocalAnswer && mentionIntentForLocalSuppression) {
|
|
91244
91477
|
let carriedMentionTargets = mentionTargets.length > 0 ? mentionTargets : latestMentionTargetsFromPendingClarification(pending2, answeredThisTurn), multiDirectedCarried = carriedMentionTargets.length > 1 && !carriedMentionTargets.includes("ALL"), advisoryBrief = composeReadOnlyAdvisoryBrief(
|
|
91245
91478
|
multiDirectedCarried ? pending2 : pendingForPlanning,
|
|
91246
91479
|
multiDirectedCarried ? dispatchText : plannerPromptText,
|
|
@@ -97671,14 +97904,16 @@ async function triggerStartupOrphanSweep(appsyncClient, currentSessionId, staleT
|
|
|
97671
97904
|
ownerRootDir: shadowEnv?.ownerRootDir ?? processOwnerRoot(),
|
|
97672
97905
|
...shadowEnv
|
|
97673
97906
|
};
|
|
97674
|
-
|
|
97907
|
+
await reapOrphanShadows(/* @__PURE__ */ new Set(), env).catch((err) => {
|
|
97675
97908
|
logger.warn("[cli] shadow orphan startup sweep error (non-fatal)", {
|
|
97676
97909
|
err: err?.message
|
|
97677
97910
|
});
|
|
97678
|
-
})
|
|
97911
|
+
});
|
|
97912
|
+
let envExcludes = (process.env.CODEVIBE_SWEEP_EXCLUDE_SESSION_IDS ?? "").split(",").map((s) => s.trim()).filter(Boolean), excludeSessionIds = Array.from(/* @__PURE__ */ new Set([currentSessionId, ...envExcludes]));
|
|
97913
|
+
return await appsyncClient.sweepOrphanSessions({
|
|
97679
97914
|
agentType: "CODEVIBE" /* CODEVIBE */,
|
|
97680
97915
|
staleThresholdMs,
|
|
97681
|
-
excludeSessionIds
|
|
97916
|
+
excludeSessionIds
|
|
97682
97917
|
});
|
|
97683
97918
|
} catch (err) {
|
|
97684
97919
|
return logger.warn("[cli] startup orphan sweep failed (non-fatal)", {
|
|
@@ -61,6 +61,24 @@ export declare function buildCommandIntentMetadata(text: string): CommandIntentM
|
|
|
61
61
|
* Supports language-agnostic URLs, as well as English, Chinese, and Japanese web search intents.
|
|
62
62
|
*/
|
|
63
63
|
export declare function isWebAccessNeeded(text: string): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Common file and document extensions for code, documentation, scripts, data, and office files.
|
|
66
|
+
*/
|
|
67
|
+
export declare const DOCUMENT_AND_CODE_EXTENSIONS = "(?:pdf|docx|doc|xlsx|xls|csv|tsv|txt|md|markdown|json|yaml|yml|toml|env|log|ts|js|tsx|jsx|py|rs|go|java|c|cpp|h|html|css|sql|sh)";
|
|
68
|
+
/**
|
|
69
|
+
* Strips negated mutation verb phrases (e.g. "do not fix ...", "don't modify ...",
|
|
70
|
+
* "without changing any code", "不做修改", "修正しないで", "수정하지 말고", "do not write report.md")
|
|
71
|
+
* from text so that negative constraints do not trigger mutation action verbs,
|
|
72
|
+
* while preserving any independent affirmative mutation instructions in the same clause.
|
|
73
|
+
*/
|
|
74
|
+
export declare function stripNegatedMutationSpans(text: string): string;
|
|
75
|
+
/**
|
|
76
|
+
* Helper to recognize source content references that describe entities or topics inside a file or database
|
|
77
|
+
* (e.g. "generate a list of the fields in config.json", "generate a summary of the functions in README.md",
|
|
78
|
+
* "generate a summary of the error handling in auth.ts", "output a list of the functions in auth.sh")
|
|
79
|
+
* rather than write destinations.
|
|
80
|
+
*/
|
|
81
|
+
export declare function isGenerateSourceContentRef(target: string, hasWebContext?: boolean): boolean;
|
|
64
82
|
/**
|
|
65
83
|
* Detects whether a prompt expresses intent to create, write, save, or modify local files/reports,
|
|
66
84
|
* as opposed to a purely read-only conversational request.
|
|
@@ -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;
|
|
@@ -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;
|
package/dist/prompt-parser.d.ts
CHANGED
|
@@ -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>;
|
package/dist/terminal-menu.d.ts
CHANGED
|
@@ -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>;
|