@a-t-h-i/bot-lobby 0.6.80 → 0.7.0
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/THIRD_PARTY_NOTICES.md +0 -1
- package/package.json +1 -1
- package/prompts/lobby-chat.md +1 -1
- package/prompts/master.md +15 -2
- package/prompts/panel.md +4 -4
- package/prompts/planner.md +2 -2
- package/prompts/worker.md +6 -1
- package/src/ask/tool.ts +1 -1
- package/src/classifier/effort.ts +5 -0
- package/src/classifier/files.ts +7 -0
- package/src/classifier/knowledge.ts +88 -0
- package/src/classifier/lobby.ts +1 -1
- package/src/desk/board-client.ts +1 -1
- package/src/desk/board.ts +1 -1
- package/src/execution/assignment.ts +77 -1
- package/src/execution/delegation.ts +80 -27
- package/src/execution/verification.ts +216 -0
- package/src/knowledge/catalog-tools.ts +1 -1
- package/src/knowledge/catalogue.ts +21 -6
- package/src/knowledge/compactor.ts +212 -5
- package/src/knowledge/oracle-digest.ts +2 -2
- package/src/knowledge/paths.ts +9 -0
- package/src/knowledge/repo-map.ts +1 -0
- package/src/knowledge/retrieval.ts +8 -2
- package/src/knowledge/store.ts +68 -14
- package/src/lobby/chat-agents.ts +57 -8
- package/src/lobby/feed.ts +2 -2
- package/src/lobby/knowledge.ts +3 -3
- package/src/lobby/pi-commands.ts +1 -1
- package/src/lobby/planner.ts +6 -6
- package/src/lobby/prompts.ts +2 -2
- package/src/lobby/runtime.ts +4 -4
- package/src/lobby/service.ts +88 -51
- package/src/master/master.ts +87 -14
- package/src/master/scout-prefetch.ts +14 -1
- package/src/pi/commands.ts +28 -10
- package/src/pi/events.ts +21 -10
- package/src/pi/owner.ts +21 -3
- package/src/pi/start-task.ts +9 -6
- package/src/pi/switch-pending.ts +24 -0
- package/src/pi/tools.ts +14 -0
- package/src/roles/worker.ts +33 -3
- package/src/schemas/configuration.ts +9 -0
- package/src/schemas/task.ts +18 -0
- package/src/schemas/verification.ts +38 -0
- package/src/state/metrics.ts +32 -2
- package/src/webui/api/knowledge.ts +1 -1
- package/src/webui/api/tasks.ts +1 -1
- package/src/webui/dev/fake-service.ts +7 -7
- package/src/workflow/track.ts +65 -3
- package/src/workflow/workflow.ts +142 -17
- package/webui/dist/assets/{CodeSurface-v19_sKLO.js → CodeSurface-FHm02AXI.js} +1 -1
- package/webui/dist/assets/{TerminalView-BW7Ik8CM.js → TerminalView-Be3q2ej_.js} +1 -1
- package/webui/dist/assets/{index-QvpDedq6.js → index-B_7Iioqo.js} +45 -45
- package/webui/dist/assets/index-DPP8sEwW.css +2 -0
- package/webui/dist/build.json +58 -58
- package/webui/dist/index.html +2 -2
- package/webui/dist/assets/index-BKF36jpt.css +0 -2
package/src/workflow/workflow.ts
CHANGED
|
@@ -7,9 +7,10 @@ import { checkWorkerAssignments, recordWorkerAssignments } from "../state/persis
|
|
|
7
7
|
import { existsSync, mkdirSync, readFileSync, realpathSync } from "node:fs";
|
|
8
8
|
import { checkpointSummary, settledDecisions } from "../state/checkpoint.ts";
|
|
9
9
|
import { draftAssignments, draftAssignmentsNote } from "./draft-assignments.ts";
|
|
10
|
-
import { prefetchDomains, startScoutPrefetch, stopScoutPrefetch, takeScoutPrefetch } from "../master/scout-prefetch.ts";
|
|
10
|
+
import { prefetchDomains, skipSingleWorkerPrefetch, startScoutPrefetch, stopScoutPrefetch, takeScoutPrefetch } from "../master/scout-prefetch.ts";
|
|
11
11
|
import { isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
12
12
|
import { profileFor, type BotLobbyConfig, type ProfileResolver } from "../schemas/configuration.ts";
|
|
13
|
+
import { randomUUID } from "node:crypto";
|
|
13
14
|
import type { AgentRun, Pushback, ResearchResult, ReviewResult } from "../schemas/findings.ts";
|
|
14
15
|
import {
|
|
15
16
|
MAX_RUN_LOG,
|
|
@@ -30,7 +31,8 @@ import { loadTask, ownerlessTask, readTaskArtifact, removeTaskScratchpads, saveT
|
|
|
30
31
|
import { dataRoot, readDataRoots } from "../state/project.ts";
|
|
31
32
|
import { appendCompletedTask, appendDecision, applyKnowledge, readFileOr, writeFileEnsured, type KnowledgeKind } from "../knowledge/store.ts";
|
|
32
33
|
import { proposalParts, propose } from "../knowledge/ledger.ts";
|
|
33
|
-
import { compactKnowledgeFile, overThreshold } from "../knowledge/compactor.ts";
|
|
34
|
+
import { compactKnowledgeFile, overThreshold, scheduleKnowledgeMaintenance } from "../knowledge/compactor.ts";
|
|
35
|
+
import { finalChecks, runVerification, verificationSummary } from "../execution/verification.ts";
|
|
34
36
|
import { oracleBookmarkOp, retireBookmarks, type OracleBookmarkOp } from "../knowledge/bookmarks.ts";
|
|
35
37
|
import { knowledgeDir, type KnowledgeAgent } from "../knowledge/paths.ts";
|
|
36
38
|
import { lobbyTopics } from "../lobby/topics.ts";
|
|
@@ -75,11 +77,11 @@ import { nextStates } from "./transitions.ts";
|
|
|
75
77
|
import type { FileHinter } from "../classifier/files.ts";
|
|
76
78
|
import type { KnowledgePicker } from "../classifier/knowledge.ts";
|
|
77
79
|
import type { Classifier } from "../classifier/classifier.ts";
|
|
78
|
-
import type { EffortRouter } from "../classifier/effort.ts";
|
|
80
|
+
import type { EffortRouter, EffortScore } from "../classifier/effort.ts";
|
|
79
81
|
import { answerClarify } from "../classifier/triage.ts";
|
|
80
|
-
import { appendMetrics, metricFromRun } from "../state/metrics.ts";
|
|
82
|
+
import { appendMetrics, avoidedLaunchRecord, metricFromRun } from "../state/metrics.ts";
|
|
81
83
|
import { markCommentsAddressed, pendingComments, readPlanComments } from "../state/comments.ts";
|
|
82
|
-
import { builtSomething, fastNext, onFastTrack, parseRoster, PLANNED_NEXT, qaRequired, qaTookPart, readRequest, rosterWords, satOut, trackSummary } from "./track.ts";
|
|
84
|
+
import { builtSomething, fastNext, fastPathRecord, onFastTrack, parseRoster, PLANNED_NEXT, promoteFastPath, qaRequired, qaTookPart, readRequest, rosterWords, satOut, singleWorker, trackSummary } from "./track.ts";
|
|
83
85
|
import { requestBesidePlan } from "../state/backlog.ts";
|
|
84
86
|
import { missingWorktree, taskCwd } from "../execution/workspace.ts";
|
|
85
87
|
import { completionReview, deferReview, refreshReview } from "../delivery/review.ts";
|
|
@@ -401,12 +403,44 @@ function scoutRequestFor(task: Task, deps: WorkflowDeps, instruction: string, do
|
|
|
401
403
|
|
|
402
404
|
const DEFAULT_SCOUT_INSTRUCTION = "Investigate this request and report findings the Master needs.";
|
|
403
405
|
|
|
406
|
+
/** Populate a fast-track task's single-worker record from the reading that chose its track, once; other tracks get none. */
|
|
407
|
+
function ensureFastPath(task: Task, effort?: EffortScore): void {
|
|
408
|
+
if (task.fastPath || !task.track || task.track.path !== "fast") return;
|
|
409
|
+
const record = fastPathRecord(taskRequest(task), task.track, effort);
|
|
410
|
+
if (record) task.fastPath = record;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/** The estimated-effort reading for a task's request, when the effort router is on; never a failure. */
|
|
414
|
+
async function effortScore(deps: WorkflowDeps, request: string): Promise<EffortScore | undefined> {
|
|
415
|
+
try {
|
|
416
|
+
return await deps.effort?.score(request);
|
|
417
|
+
} catch {
|
|
418
|
+
return undefined;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/** Record a launch the single-worker fast path refused, so the avoided work is measurable. */
|
|
423
|
+
function avoidedLaunch(deps: WorkflowDeps, task: Task, what: string): void {
|
|
424
|
+
appendMetrics(deps.root, deps.configDir, [avoidedLaunchRecord(task.id, `${what}: single-worker fast path`)]);
|
|
425
|
+
}
|
|
426
|
+
|
|
404
427
|
/**
|
|
405
428
|
* Start the task's opening scout while the oracle reads the request: the full
|
|
406
429
|
* workflow only (the fast track and an agreed plan skip scouting), over the
|
|
407
430
|
* domains the triage names. Returns the domains it scouts; none when it did not start.
|
|
408
431
|
*/
|
|
409
|
-
export function prefetchScouts(task: Task, config: BotLobbyConfig, makeDeps: () => WorkflowDeps): Domain[] {
|
|
432
|
+
export function prefetchScouts(task: Task, config: BotLobbyConfig, makeDeps: () => WorkflowDeps, effort?: EffortScore): Domain[] {
|
|
433
|
+
// A single-worker fast-path task never opens a scout: its one worker reads what it needs itself.
|
|
434
|
+
ensureFastPath(task, effort);
|
|
435
|
+
if (singleWorker(task)) {
|
|
436
|
+
// The refusal stands even when the caller's deps cannot be built; the record is best-effort.
|
|
437
|
+
try {
|
|
438
|
+
skipSingleWorkerPrefetch(task, makeDeps());
|
|
439
|
+
} catch {
|
|
440
|
+
// No metrics sink: no scout either.
|
|
441
|
+
}
|
|
442
|
+
return [];
|
|
443
|
+
}
|
|
410
444
|
if (!config.workflow.prefetchScout || task.approvedPlan || task.track?.path === "fast") return [];
|
|
411
445
|
const domains = prefetchDomains(task.triage);
|
|
412
446
|
if (domains.length === 0) return [];
|
|
@@ -418,6 +452,12 @@ export function prefetchScouts(task: Task, config: BotLobbyConfig, makeDeps: ()
|
|
|
418
452
|
|
|
419
453
|
async function handleScout(task: Task, params: OrchestrateParams, deps: WorkflowDeps): Promise<string> {
|
|
420
454
|
requireState(task, ["created", "clarifying", "scouting", "synthesizing"]);
|
|
455
|
+
// The single-worker fast path skips scouts: its one worker reads what it needs itself.
|
|
456
|
+
ensureFastPath(task);
|
|
457
|
+
if (singleWorker(task)) {
|
|
458
|
+
avoidedLaunch(deps, task, "scout");
|
|
459
|
+
throw new Error(`task ${task.id} is on the single-worker fast path: no scouts. Delegate straight to its one worker with action=implement; if the work genuinely needs reconnaissance, promote the task with action=track track=full and the reason.`);
|
|
460
|
+
}
|
|
421
461
|
const domains = deriveDomains(params.domains);
|
|
422
462
|
if (task.state === "created") transition(task, "clarifying");
|
|
423
463
|
if (task.state === "clarifying") transition(task, "scouting");
|
|
@@ -542,6 +582,12 @@ async function handleResearch(task: Task, params: OrchestrateParams, deps: Workf
|
|
|
542
582
|
}
|
|
543
583
|
|
|
544
584
|
async function handlePropose(task: Task, params: OrchestrateParams, deps: WorkflowDeps): Promise<string> {
|
|
585
|
+
// The single-worker fast path skips proposal rounds: its work goes straight to the worker.
|
|
586
|
+
ensureFastPath(task);
|
|
587
|
+
if (singleWorker(task)) {
|
|
588
|
+
avoidedLaunch(deps, task, "proposal round");
|
|
589
|
+
throw new Error(`task ${task.id} is on the single-worker fast path: no proposal round. Delegate straight to its one worker with action=implement, then call action=complete.`);
|
|
590
|
+
}
|
|
545
591
|
requireState(task, ["created", "clarifying", "synthesizing", "awaiting_approval"]);
|
|
546
592
|
const proposal = params.proposal?.trim();
|
|
547
593
|
if (!proposal) throw new Error("propose requires a proposal");
|
|
@@ -851,6 +897,24 @@ interface Assignment {
|
|
|
851
897
|
assignment?: WorkerAssignment;
|
|
852
898
|
}
|
|
853
899
|
|
|
900
|
+
/**
|
|
901
|
+
* The single-worker fast path's dispatch policy: one implementation worker
|
|
902
|
+
* carries the task's edits, focused tests and corrections. The first
|
|
903
|
+
* delegation names the owner when the reading did not; a parallel batch or a
|
|
904
|
+
* second implementation domain is refused.
|
|
905
|
+
*/
|
|
906
|
+
function dispatchSingleWorker(task: Task, assignments: readonly Assignment[], deps: WorkflowDeps): void {
|
|
907
|
+
const owner = task.fastPath!.owner;
|
|
908
|
+
const batch = assignments.length > 1;
|
|
909
|
+
const second = !batch && owner !== undefined && assignments[0]!.domain !== owner;
|
|
910
|
+
if (!batch && !second) {
|
|
911
|
+
if (owner === undefined) task.fastPath!.owner = assignments[0]!.domain;
|
|
912
|
+
return;
|
|
913
|
+
}
|
|
914
|
+
avoidedLaunch(deps, task, batch ? "parallel implementation batch" : "second implementation worker");
|
|
915
|
+
throw new Error(`task ${task.id} is on the single-worker fast path: one implementation worker${owner ? ` (${owner})` : ""} carries the edits, focused tests and corrections. ${batch ? "Run one assignment at a time" : `Delegate this to ${owner} instead`}; if the work genuinely needs more workers, promote the task with action=track track=full and the reason.`);
|
|
916
|
+
}
|
|
917
|
+
|
|
854
918
|
/** The delegation as a list: `assignments` for a parallel batch, otherwise the single domain/task. */
|
|
855
919
|
async function parseAssignments(params: OrchestrateParams, cwd: string): Promise<Assignment[]> {
|
|
856
920
|
if (params.assignments !== undefined && (params.workerAssignment !== undefined || params.domain !== undefined || params.task !== undefined)) throw new Error("Use either assignments or a single domain/workerAssignment, not both");
|
|
@@ -1046,6 +1110,7 @@ function absorbWorkerOutcome(task: Task, deps: WorkflowDeps, outcome: WorkerOutc
|
|
|
1046
1110
|
});
|
|
1047
1111
|
const approvals = recordWorkerApprovals(task, outcome, deps.config, isAutoMode(deps.root, deps.configDir, task.id));
|
|
1048
1112
|
const pushback = recordPushback(task, outcome);
|
|
1113
|
+
promoteOnRiskyDecision(task, outcome, deps);
|
|
1049
1114
|
task.blockers = [...task.blockers.filter((blocker) => blocker.domain !== domain), ...outcome.result.blockers];
|
|
1050
1115
|
updateScratchpad(deps, task, outcome);
|
|
1051
1116
|
const grown = qaJoinsGrownFastTask(task, outcome);
|
|
@@ -1095,6 +1160,22 @@ function workerNeeds(outcome: WorkerOutcome): AssignmentExpansionRequest[] {
|
|
|
1095
1160
|
/** Reports longer than this are kept whole in a file and the oracle gets the path. */
|
|
1096
1161
|
const LONG_REPORT = 2400;
|
|
1097
1162
|
|
|
1163
|
+
/** Genuine risk in a worker's own words: security, credentials, data loss, concurrency, migrations. */
|
|
1164
|
+
const RISKY_DECISION = /\b(?:secur(?:e|ity)|vulnerab(?:le|ility)|credential|password|secret|api keys?|data loss|drop table|delete (?:all|the) data|backfill|migration|race condition|concurren(?:cy|t)|deadlock|transactions?)\b/i;
|
|
1165
|
+
const SEVERE_RISK = /\b(?:secur(?:e|ity)|vulnerab(?:le|ility)|credential|password|secret|api keys?|data loss|drop table)\b/i;
|
|
1166
|
+
|
|
1167
|
+
/** A worker's decision request that names genuine risk promotes the task off the single-worker fast path before further risky work. */
|
|
1168
|
+
function promoteOnRiskyDecision(task: Task, outcome: WorkerOutcome, deps: WorkflowDeps): void {
|
|
1169
|
+
if (!task.fastPath || task.fastPath.promotedAt) return;
|
|
1170
|
+
const risky = workerNeeds(outcome).filter((need) => need.kind === "decision" && RISKY_DECISION.test(`${need.reason} ${need.requested.join(" ")}`));
|
|
1171
|
+
if (risky.length === 0) return;
|
|
1172
|
+
const evidence = risky.map((need) => `${need.reason} (requested: ${need.requested.join(", ")})`).join("; ");
|
|
1173
|
+
const level: "medium" | "high" = SEVERE_RISK.test(evidence) ? "high" : "medium";
|
|
1174
|
+
if (!promoteFastPath(task, level, evidence)) return;
|
|
1175
|
+
recordDecision(task, `Risk promotion: ${AGENT_LABELS[outcome.result.domain]} asked for a decision naming ${level} risk (${truncate(evidence, 200)}); the task takes the full workflow.`);
|
|
1176
|
+
deps.notify(`Task ${task.id} promoted off the single-worker fast path: a decision request names ${level} risk.`, "warning");
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1098
1179
|
/**
|
|
1099
1180
|
* Keep a long worker report whole in the task's `reports/` folder, so the
|
|
1100
1181
|
* oracle reads what it needs from the file instead of getting a shortened
|
|
@@ -1123,8 +1204,11 @@ function qaJoinsGrownFastTask(task: Task, outcome: WorkerOutcome): string {
|
|
|
1123
1204
|
if (!track || track.path !== "fast" || track.roster.includes("qa")) return "";
|
|
1124
1205
|
const asks = [...outcome.result.dependencyNeeds, ...outcome.result.architectureChanges];
|
|
1125
1206
|
if (asks.length === 0) return "";
|
|
1126
|
-
|
|
1127
|
-
|
|
1207
|
+
// A task that outgrew its read is no longer single-worker work: it leaves the path, and QA joins with the full workflow.
|
|
1208
|
+
if (!promoteFastPath(task, "medium", `outgrew the fast path: ${AGENT_LABELS[outcome.result.domain]} asked for ${truncate(asks.join("; "), 160)}`)) {
|
|
1209
|
+
track.roster = parseRoster([...track.roster, "qa"]);
|
|
1210
|
+
track.reasons = [...track.reasons, `tests: ${AGENT_LABELS[outcome.result.domain]} asked for a dependency or an architecture change`];
|
|
1211
|
+
}
|
|
1128
1212
|
recordDecision(task, `QA joined the fast track: ${AGENT_LABELS[outcome.result.domain]} asked for ${truncate(asks.join("; "), 200)}.`);
|
|
1129
1213
|
return "QA now takes part: a fast-track change that needs a new dependency or an architecture change is checked before it completes.";
|
|
1130
1214
|
}
|
|
@@ -1154,8 +1238,13 @@ async function qaJoinsRiskyFastTask(task: Task, deps: WorkflowDeps): Promise<str
|
|
|
1154
1238
|
if (!track || track.path !== "fast" || track.roster.includes("qa") || task.qaWaiver || !builtSomething(task)) return "";
|
|
1155
1239
|
const risk = await assessBuilt(task, deps);
|
|
1156
1240
|
if (!risk || (risk.risk !== "medium" && risk.risk !== "high")) return "";
|
|
1157
|
-
|
|
1158
|
-
|
|
1241
|
+
// Genuine risk in what was built ends the single-worker path first; the evidence is kept on the record.
|
|
1242
|
+
if (promoteFastPath(task, risk.risk, risk.riskFactors.length > 0 ? risk.riskFactors.join("; ") : `the change reads ${risk.risk} risk`)) {
|
|
1243
|
+
deps.notify(`Task ${task.id} promoted off the single-worker fast path: the change reads ${risk.risk.toUpperCase()} risk; QA takes part before completion.`, "warning");
|
|
1244
|
+
} else {
|
|
1245
|
+
track.roster = parseRoster([...track.roster, "qa"]);
|
|
1246
|
+
track.reasons = [...track.reasons, `tests: the change reads ${risk.risk} risk`];
|
|
1247
|
+
}
|
|
1159
1248
|
recordDecision(task, `QA joined the fast track: the change reads ${risk.risk.toUpperCase()} risk (${truncate(risk.riskFactors.join("; "), 200)}).`);
|
|
1160
1249
|
return `QA joins before completion: ${qaRiskLine(risk)}. Run action=qa, then complete.`;
|
|
1161
1250
|
}
|
|
@@ -1170,6 +1259,9 @@ async function handleImplement(task: Task, params: OrchestrateParams, deps: Work
|
|
|
1170
1259
|
}
|
|
1171
1260
|
if (!starting) requireState(task, ["planning", "implementing", "reviewing"]);
|
|
1172
1261
|
const assignments = await parseAssignments(params, deps.cwd);
|
|
1262
|
+
// The single-worker fast path keeps one implementation owner: no parallel batch, no second domain.
|
|
1263
|
+
ensureFastPath(task);
|
|
1264
|
+
if (singleWorker(task)) dispatchSingleWorker(task, assignments, deps);
|
|
1173
1265
|
const structured = assignments.flatMap(({ domain, assignment }) => assignment ? [{ domain, assignment }] : []);
|
|
1174
1266
|
checkWorkerAssignments(task, structured);
|
|
1175
1267
|
// A harness cannot keep a sanitized conversation or attest its tools: refuse here, before anything is recorded.
|
|
@@ -1555,6 +1647,7 @@ function checksVerdict(lint: LintReport | undefined, deps: WorkflowDeps, waived:
|
|
|
1555
1647
|
|
|
1556
1648
|
async function handleQa(task: Task, params: OrchestrateParams, deps: WorkflowDeps): Promise<string> {
|
|
1557
1649
|
requireState(task, ["implementing", "reviewing"]);
|
|
1650
|
+
ensureFastPath(task);
|
|
1558
1651
|
if (satOut(task, "qa")) throw new Error(`${benchedRefusal(task, "qa")} There is no QA gate: complete once every step is done.`);
|
|
1559
1652
|
if (task.state !== "reviewing") transition(task, "reviewing");
|
|
1560
1653
|
const iterations = (task.reviewIterations?.qa ?? 0) + 1;
|
|
@@ -1578,6 +1671,14 @@ async function handleQa(task: Task, params: OrchestrateParams, deps: WorkflowDep
|
|
|
1578
1671
|
const header = `QA gate: ${result.verdict.toUpperCase()} on the engine's checks; no QA agent ran. ${qaRiskLine(risk)}.\nWhy: ${risk.reasoning}\nChecks:\n${result.verification}`;
|
|
1579
1672
|
return qaReport(header, result, decision, provenance, lintLine);
|
|
1580
1673
|
}
|
|
1674
|
+
// An independent reviewer only runs once the change is off the single-worker path: a read that warrants one is genuine risk, and promotes first.
|
|
1675
|
+
if (singleWorker(task)) {
|
|
1676
|
+
promoteForGate(task, risk, deps);
|
|
1677
|
+
if (singleWorker(task)) {
|
|
1678
|
+
avoidedLaunch(deps, task, "independent QA reviewer");
|
|
1679
|
+
throw new Error(`task ${task.id} is on the single-worker fast path: no independent QA reviewer runs for it. The engine's checks still run at action=complete; if the change needs QA eyes, promote the task with action=track track=full and the reason.`);
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1581
1682
|
const outcome = await runReviewer({ ...qaRequest(deps, task, diff, risk, params.task, provenance, lint), effort: deps.effort }, deps.runProcess ?? spawnPiProcess);
|
|
1582
1683
|
const { result, run } = outcome;
|
|
1583
1684
|
recordAdvisoryPushbacks(task, [{ pushback: result.pushback, who: "qa" }]);
|
|
@@ -1602,6 +1703,14 @@ function reviewLimit(task: Task, deps: WorkflowDeps): number {
|
|
|
1602
1703
|
return deps.config.workflow.maxReviewIterations + (task.extraReviewRounds ?? 0);
|
|
1603
1704
|
}
|
|
1604
1705
|
|
|
1706
|
+
/** The gate's own read is a classifier risk signal: a change that warrants an independent reviewer is not single-worker work. */
|
|
1707
|
+
function promoteForGate(task: Task, risk: QaRiskAssessment, deps: WorkflowDeps): void {
|
|
1708
|
+
const evidence = risk.riskFactors.length > 0 ? risk.riskFactors.join("; ") : `the change reads ${risk.risk} risk to the QA gate`;
|
|
1709
|
+
if (!promoteFastPath(task, risk.risk === "high" ? "high" : "medium", evidence)) return;
|
|
1710
|
+
recordDecision(task, `Risk promotion: the QA gate's read says ${risk.risk.toUpperCase()} risk (${truncate(evidence, 200)}); the task takes the full workflow.`);
|
|
1711
|
+
deps.notify(`Task ${task.id} promoted off the single-worker fast path: the change reads ${risk.risk.toUpperCase()} risk; QA takes part.`, "warning");
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1605
1714
|
/** What QA still asks for, one line each: its blocking findings and required changes. */
|
|
1606
1715
|
function openAsks(result: Pick<ReviewResult, "findings" | "requiredChanges">): string[] {
|
|
1607
1716
|
return [
|
|
@@ -1686,7 +1795,7 @@ function handleKnowledge(task: Task | undefined, params: OrchestrateParams, deps
|
|
|
1686
1795
|
agent,
|
|
1687
1796
|
kind,
|
|
1688
1797
|
text,
|
|
1689
|
-
by: "
|
|
1798
|
+
by: "Orchestrator",
|
|
1690
1799
|
what: task ? `recorded this while working on task ${task.id}` : "saved this from a chat with you",
|
|
1691
1800
|
source: task ? `Task ${task.id}` : "Chat with you",
|
|
1692
1801
|
});
|
|
@@ -1802,9 +1911,23 @@ async function handleComplete(task: Task, params: OrchestrateParams, deps: Workf
|
|
|
1802
1911
|
// New lint errors in what the task touched hold it in block mode, unless the user accepted the work as it is.
|
|
1803
1912
|
const lint = await lintTask(task, deps);
|
|
1804
1913
|
if (lint && lintHolds(lint, deps.config.lint.mode, Boolean(task.lintWaiver))) throw new Error(`cannot complete: ${lintRefusal(lint)}`);
|
|
1805
|
-
//
|
|
1914
|
+
// Final verification: the applicable engine-run checks (typecheck, tests, build, browser fixtures —
|
|
1915
|
+
// fast tasks included) must pass on the tree as it stands before anything is committed. Recorded
|
|
1916
|
+
// passes are reused while their inputs are unchanged; missing, stale, failed, cancelled and
|
|
1917
|
+
// unavailable results are not passes. Heavy checks run here only, never between worker steps.
|
|
1918
|
+
const verification = await runVerification({ top: deps.cwd, checks: finalChecks(deps.cwd), previous: task.verification, ...(deps.signal ? { signal: deps.signal } : {}) });
|
|
1919
|
+
deps.signal?.throwIfAborted();
|
|
1920
|
+
task.verification = verification;
|
|
1921
|
+
saveTask(deps.root, deps.configDir, task);
|
|
1922
|
+
appendMetrics(deps.root, deps.configDir, [{ id: randomUUID(), kind: "master", agent: "ORACLE", status: "success", startedAt: verification.at, durationMs: verification.results.reduce((total, result) => total + result.ms, 0), purpose: `final verification (${verification.results.length} checks)`, cacheHits: verification.results.filter((result) => result.reused).length, ...(task.id ? { taskId: task.id } : {}) }]);
|
|
1923
|
+
if (verification.state !== "passing") throw new Error(`cannot complete: final verification failed — ${verificationSummary(verification)}. Fix the failing checks and call complete again; unchanged passes are kept.`);
|
|
1924
|
+
// The gate refuses before any side effect, so a refusal leaves the task untouched. Oversized knowledge no
|
|
1925
|
+
// longer holds completion: automatic maintenance is scheduled and runs after this response.
|
|
1806
1926
|
const oversized = overThreshold(readDataRoots(deps.root, deps.configDir), deps.config.knowledge.compactionThreshold);
|
|
1807
|
-
|
|
1927
|
+
for (const entry of oversized) {
|
|
1928
|
+
scheduleKnowledgeMaintenance({ dataRoot: dataRoot(deps.root, deps.configDir), agent: entry.agent, file: entry.file, backupCount: deps.config.knowledge.backupCount });
|
|
1929
|
+
}
|
|
1930
|
+
const maintenance = oversized.length > 0 ? ` Automatic knowledge maintenance scheduled for ${oversized.map((entry) => `${entry.agent}/${entry.file}`).join(", ")}; it archives duplicate and historical material after this response.` : "";
|
|
1808
1931
|
deps.signal?.throwIfAborted();
|
|
1809
1932
|
const committed = await commitTaskWork(task, params, deps);
|
|
1810
1933
|
deps.signal?.throwIfAborted();
|
|
@@ -1824,7 +1947,7 @@ async function handleComplete(task: Task, params: OrchestrateParams, deps: Workf
|
|
|
1824
1947
|
flushDecisions(deps, task);
|
|
1825
1948
|
const delivery = await offerDelivery(task, deps);
|
|
1826
1949
|
const left = lint?.state === "failing" ? ` ${task.lintWaiver ? "Accepted by the user with lint errors" : "Lint (advisory)"}: ${lintSummary(lint)} Tell the user.` : "";
|
|
1827
|
-
return `Task ${task.id} completed.${committed} History recorded and temporary scratchpads removed. ${delivery}${left}`;
|
|
1950
|
+
return `Task ${task.id} completed.${committed} History recorded and temporary scratchpads removed. ${delivery}${left}${maintenance}`;
|
|
1828
1951
|
}
|
|
1829
1952
|
|
|
1830
1953
|
/** The files a task's own workers changed: not one that held changes before they started, nor another task's. */
|
|
@@ -1911,7 +2034,7 @@ async function offerAcceptance(task: Task, deps: WorkflowDeps): Promise<void> {
|
|
|
1911
2034
|
].filter(Boolean).join("\n\n"),
|
|
1912
2035
|
["Complete it anyway", "Not yet"],
|
|
1913
2036
|
);
|
|
1914
|
-
if (choice === "Complete it anyway") waiveQa(task, asks, "when the
|
|
2037
|
+
if (choice === "Complete it anyway") waiveQa(task, asks, "when the orchestrator completed it");
|
|
1915
2038
|
}
|
|
1916
2039
|
|
|
1917
2040
|
function flushDecisions(deps: WorkflowDeps, task: Task): void {
|
|
@@ -1960,7 +2083,7 @@ async function letJoin(task: Task, joining: readonly TrackMember[], reason: stri
|
|
|
1960
2083
|
const them = joining.length === 1 ? "it" : "them";
|
|
1961
2084
|
if (isAutoMode(deps.root, deps.configDir, task.id)) throw new Error(`${words} sat out the planning panel for this plan, and only the user can let ${them} work on the task (auto mode is on: nobody can be asked)`);
|
|
1962
2085
|
const yes = `Let ${them} join`;
|
|
1963
|
-
const choice = await deps.choose(`${words} sat out the planning panel for ${task.id}. The
|
|
2086
|
+
const choice = await deps.choose(`${words} sat out the planning panel for ${task.id}. The orchestrator asks to add ${them}: ${reason}`, [yes, `Keep ${them} out`]);
|
|
1964
2087
|
if (choice !== yes) throw new Error(`the user kept ${words} out of this task: give the work to the members who took part in the plan`);
|
|
1965
2088
|
recordDecision(task, `The user let ${words} join the task, though ${joining.length === 1 ? "it" : "they"} sat out the planning panel: ${reason}`);
|
|
1966
2089
|
}
|
|
@@ -1990,7 +2113,7 @@ async function handleTrack(task: Task, params: OrchestrateParams, deps: Workflow
|
|
|
1990
2113
|
path,
|
|
1991
2114
|
size: current?.size ?? "small",
|
|
1992
2115
|
roster,
|
|
1993
|
-
reasons: [`
|
|
2116
|
+
reasons: [`orchestrator: ${reason}`, ...(current?.reasons ?? [])].slice(0, 8),
|
|
1994
2117
|
source: "oracle",
|
|
1995
2118
|
...(current?.userChoice ? { userChoice: current.userChoice } : {}),
|
|
1996
2119
|
...(current?.autoPlan ? { autoPlan: true } : {}),
|
|
@@ -1998,6 +2121,8 @@ async function handleTrack(task: Task, params: OrchestrateParams, deps: Workflow
|
|
|
1998
2121
|
at: new Date().toISOString(),
|
|
1999
2122
|
};
|
|
2000
2123
|
recordDecision(task, `Track: ${path === "fast" ? "fast track" : "full workflow"}; ${rosterWords(roster)} — ${reason}`);
|
|
2124
|
+
// The oracle's own reading of the request may differ from the engine's; the single-worker record follows the corrected track.
|
|
2125
|
+
ensureFastPath(task, await effortScore(deps, taskRequest(task)));
|
|
2001
2126
|
if (path === "fast") {
|
|
2002
2127
|
return `Fast track: ${rosterWords(roster)}. Delegate straight away with action=implement (open each task with "Step N:"); no scouts, proposal or plan. ${qaRequired(task) ? "QA takes part before completion: action=qa, sized to the change." : "No QA gate unless the change turns out riskier than it read."} Then action=complete.`;
|
|
2003
2128
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/astro-p42oEArs.js","assets/json-qhed-kSA.js","assets/javascript-BgS3c2Ky.js","assets/typescript-BydbNFcO.js","assets/rolldown-runtime-hePW80VL.js","assets/css-C8fQr_0Q.js","assets/postcss-D_Wz94rJ.js","assets/tsx-CUOciP0b.js","assets/graphql-AVu4aKQX.js","assets/jsx-gTgmArGx.js","assets/html-wSbaAAK3.js","assets/java-DdHNQ9hk.js","assets/kts-DFAlwc6n.js","assets/kotlin-DhhofPvG.js","assets/lua-xZcbXUE9.js","assets/c-DaO8xguW.js","assets/php-C6PDnbTe.js","assets/xml-CeXJrFlG.js","assets/sql-CEbI0hMM.js","assets/properties-CxAuzHS9.js","assets/ini-B5eOa1yu.js","assets/ruby-CPL7DL0w.js","assets/shellscript-CLZ0U2zV.js","assets/yaml-rwi0_p6S.js","assets/scss-CHVQqdPx.js","assets/svelte-DKhxH1PN.js","assets/vue-kBwcnTZb.js","assets/yml-s9iVJXCw.js","assets/zsh-B7CDPTg5.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{a as n,c as r,i,l as a,n as o,o as s,r as c,s as l,t as u}from"./ccount-DQxSH8e6.js";import{t as d}from"./index-
|
|
2
|
+
import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{a as n,c as r,i,l as a,n as o,o as s,r as c,s as l,t as u}from"./ccount-DQxSH8e6.js";import{t as d}from"./index-B_7Iioqo.js";var f={}.hasOwnProperty;function p(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&f.call(t,e)){let n=String(t[e]);i=f.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var m=10,h=13,g=4,_=40;function v(e){let t=[0],n=e.indexOf(`\r`),r=e.indexOf(`
|
|
3
3
|
`),i=0,a=0;for(;n!==-1||r!==-1;){let o;if(n!==-1&&(r===-1||n<r)?r===n+1?(o=r+1,n=e.indexOf(`\r`,o),r=e.indexOf(`
|
|
4
4
|
`,o)):(o=n+1,n=e.indexOf(`\r`,o)):(o=r+1,r=e.indexOf(`
|
|
5
5
|
`,o)),t.push(o),++a===g){if(o-i<=_){for(let n=o;n<e.length;n++){let r=e.charCodeAt(n);(r===m||r===h)&&(r===h&&n+1<e.length&&e.charCodeAt(n+1)===m&&n++,t.push(n+1))}return t}i=o,a=0}}return t}function y(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);(r===m||r===h)&&(r===h&&n+1<e.length&&e.charCodeAt(n+1)===m&&n++,t++)}return t}function b(e){let t=v(e);return Array.from({length:t.length},(n,r)=>{let i=t[r],a=t[r+1]??e.length;return e.slice(i,a)})}var x=100,S=`insert`,C=`backspace`,w=`delete`,T=class e{#e=[];#t=[];#n;#r=!1;constructor(e){this.#n=Math.max(1,e?.maxEntries??x)}get canUndo(){return this.#e.length>0}get canRedo(){return this.#t.length>0}getState(){return{undoStack:this.#e.map(ee),redoStack:this.#t.map(ee),maxEntries:this.#n,canCoalesce:this.#r}}getLiveState(){return Object.defineProperties({},{undoStack:{enumerable:!0,get:()=>this.#e},redoStack:{enumerable:!0,get:()=>this.#t},maxEntries:{enumerable:!0,get:()=>this.#n},canCoalesce:{enumerable:!0,get:()=>this.#r}})}static fromState(t){let n=new e({maxEntries:t.maxEntries});return n.#e=t.undoStack,n.#t=t.redoStack,n.#r=t.canCoalesce,n}clear(){this.#e.length=0,this.#t.length=0,this.#r=!1}clearRedo(){this.#t.length=0}push(e){this.#e.push(e),this.clearRedo(),this.#r=!0,this.#e.length>this.#n&&this.#e.shift()}setLastUndoSelectionsAfter(e){let t=this.#e[this.#e.length-1];t!==void 0&&(t.selectionsAfter=e.map(e=>({...e})))}setLastUndoLineAnnotations(e,t){let n=this.#e[this.#e.length-1];n!==void 0&&(n.lineAnnotationsBefore=e.slice(),n.lineAnnotationsAfter=t.slice())}peekUndo(){return this.#e[this.#e.length-1]}peekUndoForCoalescing(){return this.#r?this.peekUndo():void 0}replaceLastUndo(e){if(this.#e.length===0){this.push(e);return}this.#e[this.#e.length-1]=e,this.clearRedo(),this.#r=!0}popUndoToRedo(){let e=this.#e.pop();if(e!==void 0)return this.#t.push(e),this.#r=!1,e}popRedoToUndo(){let e=this.#t.pop();if(e!==void 0)return this.#e.push(e),this.#r=!1,e}};function E(e){return{...e,forwardEdits:e.forwardEdits.map(e=>({...e})),inverseEdits:e.inverseEdits.map(e=>({...e})),selectionsBefore:e.selectionsBefore?.map(D),selectionsAfter:e.selectionsAfter?.map(D),lineAnnotationsBefore:e.lineAnnotationsBefore?.slice(),lineAnnotationsAfter:e.lineAnnotationsAfter?.slice()}}function ee(e){return{...E(e),lineAnnotationsBefore:e.lineAnnotationsBefore?.map(e=>({...e})),lineAnnotationsAfter:e.lineAnnotationsAfter?.map(e=>({...e}))}}function D(e){return{...e,start:{...e.start},end:{...e.end}}}function O(e,t,n,r,i,a,o,s){let c=[...t].sort((e,t)=>e.start-t.start),l=[],u;if(i?.length===c.length){let t=[];for(let n of i){if(n.start.line!==n.end.line||n.start.character!==n.end.character)break;t.push(e.offsetAt(n.start))}if(t.length===c.length){t.sort((e,t)=>e-t);let e=!0,n=!0;for(let r=0;r<c.length;r++){let i=c[r];if(i.text.length>0||i.start===i.end){e=!1,n=!1;break}e&&=t[r]===i.end,n&&=t[r]===i.start}u=e?C:n?w:void 0}}for(let t=0,n=0;t<c.length;t++){let r=c[t],i=e.getTextSlice(r.start,r.end),a=r.start+n;l.push({start:a,end:a+r.text.length,text:i}),n+=r.text.length-(r.end-r.start)}return{forwardEdits:c.map(e=>({...e})),inverseEdits:l,versionBefore:n,versionAfter:r,selectionsBefore:i?.map(e=>({...e})),selectionsAfter:a?.map(e=>({...e})),lineAnnotationsBefore:o?.slice(),lineAnnotationsAfter:s?.slice(),coalescingMode:u}}function k(e,t){if(e===void 0||e.undoBoundary===!0||t.undoBoundary===!0||e.forwardEdits.length===0||e.forwardEdits.length!==e.inverseEdits.length||e.forwardEdits.length!==t.forwardEdits.length||t.forwardEdits.length!==t.inverseEdits.length)return!1;let n;for(let r=0;r<e.forwardEdits.length;r++){let i=e.forwardEdits[r],a=e.inverseEdits[r],o=t.forwardEdits[r],s=t.inverseEdits[r],c=ne(o.start,e.forwardEdits),l=i.start<=i.end&&i.text.length>0&&!i.text.includes(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,l as n}from"./ccount-DQxSH8e6.js";import{i as r,n as i,r as a}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,l as n}from"./ccount-DQxSH8e6.js";import{i as r,n as i,r as a}from"./index-B_7Iioqo.js";var o=e(n(),1),s=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=(e,t)=>{for(var n in t)s(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,r)=>{for(var i=r>1?void 0:r?c(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&s(t,n,i),i},d=(e,t)=>(n,r)=>t(n,r,e),f=`Terminal input`,p={get:()=>f,set:e=>f=e},m=`Too much output to announce, navigate to rows manually to read`,h={get:()=>m,set:e=>m=e};function g(e){return e.replace(/\r?\n/g,`\r`)}function _(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function ee(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function te(e,t,n,r){e.stopPropagation(),e.clipboardData&&ne(e.clipboardData.getData(`text/plain`),t,n,r)}function ne(e,t,n,r){e=g(e),e=_(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function re(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function ie(e,t,n,r,i){re(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function ae(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function oe(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var se=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},ce=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},v=``,le=` `,ue=class e{constructor(){this.fg=0,this.bg=0,this.extended=new de}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},de=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},y=class e extends ue{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new de,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?ae(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},fe=`di$target`,pe=`di$dependencies`,me=new Map;function b(e){return e[pe]||[]}function x(e){if(me.has(e))return me.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);he(t,e,r)};return t._id=e,me.set(e,t),t}function he(e,t,n){t[fe]===t?t[pe].push({id:e,index:n}):(t[pe]=[{id:e,index:n}],t[fe]=t)}var S=x(`BufferService`),ge=x(`CoreMouseService`),_e=x(`CoreService`),C=x(`CharsetService`),ve=x(`InstantiationService`),w=x(`LogService`),T=x(`OptionsService`),ye=x(`OscLinkService`),be=x(`UnicodeService`),xe=x(`DecorationService`),Se=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new y,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(c!==-1||n.hasContent(t)){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Ce(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Se=u([d(0,S),d(1,T),d(2,ye)],Se);function Ce(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
2
2
|
|
|
3
3
|
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var we=x(`CharSizeService`),Te=x(`CoreBrowserService`),Ee=x(`MouseService`),De=x(`RenderService`),Oe=x(`SelectionService`),ke=x(`CharacterJoinerService`),Ae=x(`ThemeService`),je=x(`LinkProviderService`),Me=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Re.isErrorNoTelemetry(e)?new Re(e.message+`
|
|
4
4
|
|