opencode-swarm 7.149.0 → 7.150.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/dist/background/candidate-contract.d.ts +1 -1
- package/dist/background/pending-delegations.d.ts +6 -0
- package/dist/background/pr-review-contract.d.ts +20 -0
- package/dist/cli/{config-doctor-fx8d6pma.js → config-doctor-96qyv31a.js} +2 -2
- package/dist/cli/{core-0v762txd.js → core-xx0x5tfv.js} +1 -1
- package/dist/cli/{curation-policy-4jxx3ey4.js → curation-policy-nck9g765.js} +6 -6
- package/dist/cli/{curator-6w4frzdz.js → curator-frrehxxe.js} +28 -28
- package/dist/cli/{curator-llm-factory-8fstpeqh.js → curator-llm-factory-b83jsg02.js} +28 -28
- package/dist/cli/{evidence-summary-service-x00z38n2.js → evidence-summary-service-dv4bt2bx.js} +12 -12
- package/dist/cli/{gate-evidence-ejdek2td.js → gate-evidence-dkvs7aez.js} +6 -6
- package/dist/cli/{guardrail-explain-nynjhbzk.js → guardrail-explain-1zbk21fq.js} +29 -29
- package/dist/cli/{guardrail-log-6bktj08e.js → guardrail-log-d20jewtr.js} +5 -5
- package/dist/cli/{guardrail-reset-hsfd5ykq.js → guardrail-reset-wb3ba243.js} +28 -28
- package/dist/cli/{hive-promoter-32artf8c.js → hive-promoter-10zv1b45.js} +28 -28
- package/dist/cli/{index-pgfn8h50.js → index-0tn1kxej.js} +7 -7
- package/dist/cli/{index-mza55jmc.js → index-1rpjd5na.js} +1 -1
- package/dist/cli/{index-42habrdv.js → index-1rww5k9e.js} +4 -4
- package/dist/cli/{index-5q5ws00e.js → index-1wmd5wn1.js} +4 -4
- package/dist/cli/{index-bmaz2yy4.js → index-4sdhbxgq.js} +1 -1
- package/dist/cli/{index-ka2vav7t.js → index-8cn6545x.js} +30 -30
- package/dist/cli/{index-kb1p6dpx.js → index-an922xj4.js} +7 -7
- package/dist/cli/{index-cfvbd3dg.js → index-apwcvfjt.js} +2 -2
- package/dist/cli/{index-wsar7d91.js → index-bhg6brtw.js} +1 -1
- package/dist/cli/{index-ame8ek9g.js → index-dtmgt2xn.js} +5 -5
- package/dist/cli/{index-c83bztkp.js → index-exn0ztsv.js} +1 -1
- package/dist/cli/{index-ef0wracg.js → index-g75rbw3e.js} +5 -5
- package/dist/cli/{index-zkcwan96.js → index-ggs716fj.js} +1 -1
- package/dist/cli/{index-ccyve4pb.js → index-htqs4p52.js} +1 -1
- package/dist/cli/{index-c1h0rdkr.js → index-jb9tb1sd.js} +1 -1
- package/dist/cli/{index-wbz365gn.js → index-k2sm9677.js} +1 -1
- package/dist/cli/{index-a90c1gtn.js → index-m8dn0qnm.js} +1 -1
- package/dist/cli/{index-01q7mb83.js → index-ma1p1w05.js} +6 -6
- package/dist/cli/{index-41n0thtd.js → index-mef0trex.js} +2 -1
- package/dist/cli/{index-8hkxm9mh.js → index-mnhagjvn.js} +4 -4
- package/dist/cli/{index-vfv4vnnc.js → index-n99s022c.js} +1 -1
- package/dist/cli/{index-z6471b7r.js → index-prxrmc3b.js} +2 -2
- package/dist/cli/{index-bcfcekx9.js → index-qqs44wcp.js} +1525 -459
- package/dist/cli/{index-79pwr8hc.js → index-r5djc1cc.js} +5 -5
- package/dist/cli/{index-s7t2c9jd.js → index-reknv4f9.js} +2 -2
- package/dist/cli/{index-hbhw2qd7.js → index-s0xz2520.js} +3 -3
- package/dist/cli/{index-q8e2yd98.js → index-t54jt9cs.js} +1 -1
- package/dist/cli/{index-n6jykega.js → index-vy6q9d8j.js} +3 -2
- package/dist/cli/{index-xdp0bx28.js → index-w9pb72vg.js} +2 -2
- package/dist/cli/{index-8yan955h.js → index-x3pt7d0b.js} +2 -2
- package/dist/cli/{index-wj0gnab0.js → index-xggpmtfx.js} +1 -1
- package/dist/cli/{index-6thxr1q7.js → index-zyv56em5.js} +3 -3
- package/dist/cli/index.js +28 -28
- package/dist/cli/{knowledge-escalator-ty2kesdj.js → knowledge-escalator-pc7smwrd.js} +11 -11
- package/dist/cli/{knowledge-events-x3rd7r3j.js → knowledge-events-jmb3jm84.js} +9 -9
- package/dist/cli/{knowledge-link-a5f89833.js → knowledge-link-mzn8x0qd.js} +5 -5
- package/dist/cli/{knowledge-store-zsz4dxjq.js → knowledge-store-wd6zh05h.js} +6 -6
- package/dist/cli/{knowledge-validator-bdhgkw9f.js → knowledge-validator-2v6ar1wk.js} +8 -8
- package/dist/cli/{pending-delegations-aez8ebdr.js → pending-delegations-qzy6rnvw.js} +3 -3
- package/dist/cli/{pr-subscriptions-cpnwvc6y.js → pr-subscriptions-q862pvz1.js} +3 -3
- package/dist/cli/{runner-9mnkfjw7.js → runner-1aygs98c.js} +6 -6
- package/dist/cli/{scan-cursor-3ba1spad.js → scan-cursor-hr8e3jqj.js} +7 -7
- package/dist/cli/{schema-h251vmd1.js → schema-g44y7s0w.js} +1 -1
- package/dist/cli/{scope-persistence-h1b31ba2.js → scope-persistence-0n2cv4kn.js} +8 -8
- package/dist/cli/{skill-generator-esrn40th.js → skill-generator-0gmpxwgk.js} +13 -13
- package/dist/cli/{telemetry-jtq6px7k.js → telemetry-5deacb7w.js} +1 -1
- package/dist/cli/{worktree-collision-ownership-r8j31h06.js → worktree-collision-ownership-9v8e0dz7.js} +3 -3
- package/dist/cli/{worktree-isolation-pbr4d5m9.js → worktree-isolation-pcr5zv0c.js} +28 -28
- package/dist/failures/invocation-failure.d.ts +7 -0
- package/dist/hooks/pr-workflow-gate.d.ts +37 -6
- package/dist/index.js +199 -172
- package/dist/lang/symbol-graph.d.ts +15 -0
- package/dist/services/session-reflection.d.ts +7 -0
- package/dist/state.d.ts +10 -0
- package/dist/tools/dispatch-lanes.d.ts +50 -1
- package/dist/tools/repo-graph/builder.d.ts +27 -1
- package/dist/tools/symbols.d.ts +35 -0
- package/dist/tools/write-pr-review-artifact.d.ts +2 -0
- package/package.json +2 -1
|
@@ -6,17 +6,17 @@ import {
|
|
|
6
6
|
resolveExecutableFromPath,
|
|
7
7
|
runEvaluation,
|
|
8
8
|
runExternalTool
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-n99s022c.js";
|
|
10
10
|
import {
|
|
11
11
|
normalizeToolNameLowerCase,
|
|
12
12
|
stableCanonicalStringify
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-bhg6brtw.js";
|
|
14
14
|
import {
|
|
15
15
|
detectStraySwarmDirs,
|
|
16
16
|
readDoctorArtifact,
|
|
17
17
|
removeStraySwarmDir,
|
|
18
18
|
runConfigDoctor
|
|
19
|
-
} from "./index-
|
|
19
|
+
} from "./index-htqs4p52.js";
|
|
20
20
|
import {
|
|
21
21
|
MAX_TRANSIENT_RETRIES,
|
|
22
22
|
archiveEvidence,
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
updateTaskStatus,
|
|
63
63
|
validateProjectRoot,
|
|
64
64
|
validateSymlinkBoundary
|
|
65
|
-
} from "./index-
|
|
65
|
+
} from "./index-an922xj4.js";
|
|
66
66
|
import {
|
|
67
67
|
EvaluationTaskV1Schema,
|
|
68
68
|
GateAuditManifestV1Schema,
|
|
@@ -79,7 +79,7 @@ import {
|
|
|
79
79
|
saveGateAuditResult,
|
|
80
80
|
savePromotionDecision,
|
|
81
81
|
saveTaskSetSnapshot
|
|
82
|
-
} from "./index-
|
|
82
|
+
} from "./index-prxrmc3b.js";
|
|
83
83
|
import {
|
|
84
84
|
loadDatabaseCtor
|
|
85
85
|
} from "./index-134d35c1.js";
|
|
@@ -105,12 +105,12 @@ import {
|
|
|
105
105
|
} from "./index-y8552snf.js";
|
|
106
106
|
import {
|
|
107
107
|
readRecentEscalations
|
|
108
|
-
} from "./index-
|
|
108
|
+
} from "./index-g75rbw3e.js";
|
|
109
109
|
import {
|
|
110
110
|
alreadyCuratedThisGeneration,
|
|
111
111
|
claimNextScanBatch,
|
|
112
112
|
resolveCohortId
|
|
113
|
-
} from "./index-
|
|
113
|
+
} from "./index-reknv4f9.js";
|
|
114
114
|
import {
|
|
115
115
|
CURATOR_INIT_PROMPT,
|
|
116
116
|
CURATOR_PHASE_PROMPT,
|
|
@@ -159,7 +159,7 @@ import {
|
|
|
159
159
|
listActive,
|
|
160
160
|
subscribe,
|
|
161
161
|
unsubscribe
|
|
162
|
-
} from "./index-
|
|
162
|
+
} from "./index-k2sm9677.js";
|
|
163
163
|
import {
|
|
164
164
|
BUNDLED_PROJECT_SKILL_ROOT,
|
|
165
165
|
DEFAULT_SKILL_MIN_CONFIDENCE,
|
|
@@ -180,7 +180,7 @@ import {
|
|
|
180
180
|
retireSkill,
|
|
181
181
|
selectCandidateEntries,
|
|
182
182
|
syncBundledProjectSkillsIfMissingAsync
|
|
183
|
-
} from "./index-
|
|
183
|
+
} from "./index-1rww5k9e.js";
|
|
184
184
|
import {
|
|
185
185
|
appendUnactionable,
|
|
186
186
|
quarantineEntry,
|
|
@@ -191,11 +191,11 @@ import {
|
|
|
191
191
|
validateActionableFields,
|
|
192
192
|
validateLesson,
|
|
193
193
|
validateSkillPath
|
|
194
|
-
} from "./index-
|
|
194
|
+
} from "./index-mnhagjvn.js";
|
|
195
195
|
import {
|
|
196
196
|
authorizeCuration,
|
|
197
197
|
buildConfigFingerprintInput
|
|
198
|
-
} from "./index-
|
|
198
|
+
} from "./index-4sdhbxgq.js";
|
|
199
199
|
import {
|
|
200
200
|
cohortConfigFingerprint
|
|
201
201
|
} from "./index-rtry5xyf.js";
|
|
@@ -219,7 +219,7 @@ import {
|
|
|
219
219
|
scanBackgroundCoderReservationsForAdmission,
|
|
220
220
|
scanDelegationsForRecovery,
|
|
221
221
|
sweepStaleDelegations
|
|
222
|
-
} from "./index-
|
|
222
|
+
} from "./index-vy6q9d8j.js";
|
|
223
223
|
import {
|
|
224
224
|
WORKTREE_LIFECYCLE_LOCK_FILE,
|
|
225
225
|
recordWorktreeProvisioningOwner,
|
|
@@ -252,18 +252,18 @@ import {
|
|
|
252
252
|
transitionTaskWorkflowEvidence,
|
|
253
253
|
withTaskEvidenceTransaction,
|
|
254
254
|
writeWorkflowWalFile
|
|
255
|
-
} from "./index-
|
|
255
|
+
} from "./index-1wmd5wn1.js";
|
|
256
256
|
import {
|
|
257
257
|
provisionWorktree,
|
|
258
258
|
removeWorktree
|
|
259
|
-
} from "./index-
|
|
259
|
+
} from "./index-1rpjd5na.js";
|
|
260
260
|
import {
|
|
261
261
|
MAX_PENDING_SCOPE_BINDINGS,
|
|
262
262
|
canonicalWorkspaceIdentity,
|
|
263
263
|
clearAllScopes,
|
|
264
264
|
clearScopeBindingFromDisk,
|
|
265
265
|
clearScopeBindings
|
|
266
|
-
} from "./index-
|
|
266
|
+
} from "./index-r5djc1cc.js";
|
|
267
267
|
import {
|
|
268
268
|
appendLedgerEvent,
|
|
269
269
|
computePlanHash,
|
|
@@ -278,7 +278,7 @@ import {
|
|
|
278
278
|
readPlanEpochIdentity,
|
|
279
279
|
replayFromLedgerWithStatus,
|
|
280
280
|
takeSnapshotEvent
|
|
281
|
-
} from "./index-
|
|
281
|
+
} from "./index-zyv56em5.js";
|
|
282
282
|
import {
|
|
283
283
|
CORE_EVENT_LOCKED,
|
|
284
284
|
appendCoreEventSync,
|
|
@@ -288,7 +288,7 @@ import {
|
|
|
288
288
|
hasSpecDriftAuditEvent,
|
|
289
289
|
hasTaskRepairAuditEvent,
|
|
290
290
|
readCoreEvents
|
|
291
|
-
} from "./index-
|
|
291
|
+
} from "./index-exn0ztsv.js";
|
|
292
292
|
import {
|
|
293
293
|
isPathWithinDeclaredScope,
|
|
294
294
|
sanitizeDiagnosticText
|
|
@@ -340,7 +340,7 @@ import {
|
|
|
340
340
|
transactFile,
|
|
341
341
|
transactKnowledge,
|
|
342
342
|
wordBigrams
|
|
343
|
-
} from "./index-
|
|
343
|
+
} from "./index-ma1p1w05.js";
|
|
344
344
|
import {
|
|
345
345
|
MAX_EVENT_LOG_ENTRIES,
|
|
346
346
|
_internals as _internals2,
|
|
@@ -354,10 +354,10 @@ import {
|
|
|
354
354
|
recordKnowledgeEvent,
|
|
355
355
|
recordPhaseCloseIntent,
|
|
356
356
|
resolveKnowledgeEventsPath
|
|
357
|
-
} from "./index-
|
|
357
|
+
} from "./index-0tn1kxej.js";
|
|
358
358
|
import {
|
|
359
359
|
resolveWorktreeIsolationConfig
|
|
360
|
-
} from "./index-
|
|
360
|
+
} from "./index-w9pb72vg.js";
|
|
361
361
|
import {
|
|
362
362
|
RetrospectiveEvidenceSchema
|
|
363
363
|
} from "./index-gprxjmm7.js";
|
|
@@ -379,7 +379,7 @@ import {
|
|
|
379
379
|
init_loader,
|
|
380
380
|
loadPluginConfig,
|
|
381
381
|
loadPluginConfigWithMeta
|
|
382
|
-
} from "./index-
|
|
382
|
+
} from "./index-t54jt9cs.js";
|
|
383
383
|
import {
|
|
384
384
|
DEFAULT_SKILL_OPT_CONFIG,
|
|
385
385
|
FALLBACK_MODELS_MAX,
|
|
@@ -393,7 +393,7 @@ import {
|
|
|
393
393
|
package_default,
|
|
394
394
|
resolveAutoReviewConfig,
|
|
395
395
|
stripKnownSwarmPrefix
|
|
396
|
-
} from "./index-
|
|
396
|
+
} from "./index-mef0trex.js";
|
|
397
397
|
import {
|
|
398
398
|
AGENT_TOOL_MAP,
|
|
399
399
|
ALL_AGENT_NAMES,
|
|
@@ -433,10 +433,10 @@ import {
|
|
|
433
433
|
resolveLinkDir,
|
|
434
434
|
sanitizeLinkId,
|
|
435
435
|
writeLinkPointer
|
|
436
|
-
} from "./index-
|
|
436
|
+
} from "./index-jb9tb1sd.js";
|
|
437
437
|
import {
|
|
438
438
|
atomicWriteFile
|
|
439
|
-
} from "./index-
|
|
439
|
+
} from "./index-apwcvfjt.js";
|
|
440
440
|
import {
|
|
441
441
|
KNOWLEDGE_SCHEMA_VERSION,
|
|
442
442
|
OUTCOME_BLOCK_THRESHOLD,
|
|
@@ -448,7 +448,7 @@ import {
|
|
|
448
448
|
atomicWriteSwarmFileSync,
|
|
449
449
|
matchTempGrammar,
|
|
450
450
|
parseTargetBasename
|
|
451
|
-
} from "./index-
|
|
451
|
+
} from "./index-dtmgt2xn.js";
|
|
452
452
|
import {
|
|
453
453
|
assertProjectRoot,
|
|
454
454
|
hasExplicitProjectBoundary,
|
|
@@ -456,12 +456,12 @@ import {
|
|
|
456
456
|
listActiveLocks,
|
|
457
457
|
tryAcquireLock,
|
|
458
458
|
withEvidenceLock
|
|
459
|
-
} from "./index-
|
|
459
|
+
} from "./index-m8dn0qnm.js";
|
|
460
460
|
import {
|
|
461
461
|
emit,
|
|
462
462
|
getLastHeartbeat,
|
|
463
463
|
telemetry
|
|
464
|
-
} from "./index-
|
|
464
|
+
} from "./index-xggpmtfx.js";
|
|
465
465
|
import {
|
|
466
466
|
require_proper_lockfile
|
|
467
467
|
} from "./index-7g4c7s5r.js";
|
|
@@ -599,6 +599,7 @@ function formatLegacyQaBindingRecovery(identity, retryAction) {
|
|
|
599
599
|
}
|
|
600
600
|
|
|
601
601
|
// src/db/qa-gate-profile.ts
|
|
602
|
+
init_logger();
|
|
602
603
|
var _internals5 = {
|
|
603
604
|
getProfile,
|
|
604
605
|
getProfileLookupForIdentity,
|
|
@@ -826,7 +827,9 @@ function hasAnyProfileWithEnabledGate(directory, gate) {
|
|
|
826
827
|
const parsed = JSON.parse(row.gates);
|
|
827
828
|
if (parsed?.[gate] === true)
|
|
828
829
|
return true;
|
|
829
|
-
} catch {
|
|
830
|
+
} catch (err) {
|
|
831
|
+
warn(`[qa-gate-profile] skipping unparseable qa_gate_profile row while checking gate "${gate}": ${err instanceof Error ? err.message : String(err)}`);
|
|
832
|
+
}
|
|
830
833
|
}
|
|
831
834
|
return false;
|
|
832
835
|
}
|
|
@@ -5596,7 +5599,7 @@ async function cleanupRecoveredWorktree(directory, descriptor) {
|
|
|
5596
5599
|
awaitingMergeByCallID,
|
|
5597
5600
|
cleanupStandardWorktreeForCallId,
|
|
5598
5601
|
standardWorktreeByCallID
|
|
5599
|
-
} = await import("./worktree-isolation-
|
|
5602
|
+
} = await import("./worktree-isolation-pcr5zv0c.js");
|
|
5600
5603
|
standardWorktreeByCallID.delete(descriptor.callID);
|
|
5601
5604
|
if (hasResidue)
|
|
5602
5605
|
awaitingMergeByCallID.set(descriptor.callID, {
|
|
@@ -5698,7 +5701,7 @@ async function recoverCoderSettlement(directory, taskId) {
|
|
|
5698
5701
|
awaitingMergeByCallID,
|
|
5699
5702
|
finishStandardWorktreeDispatch,
|
|
5700
5703
|
standardWorktreeByCallID
|
|
5701
|
-
} = await import("./worktree-isolation-
|
|
5704
|
+
} = await import("./worktree-isolation-pcr5zv0c.js");
|
|
5702
5705
|
const descriptor = wal.worktree;
|
|
5703
5706
|
const reconstructedDispatch = {
|
|
5704
5707
|
callID: descriptor.callID,
|
|
@@ -6576,6 +6579,69 @@ function repairCleanEvidencePipes(text) {
|
|
|
6576
6579
|
return { text: lines.join(`
|
|
6577
6580
|
`), repaired };
|
|
6578
6581
|
}
|
|
6582
|
+
function escapeCandidateField(value) {
|
|
6583
|
+
return value.trim().replace(/\|/g, "\\|");
|
|
6584
|
+
}
|
|
6585
|
+
function repairCandidateEvidencePipes(text, family) {
|
|
6586
|
+
let repaired = false;
|
|
6587
|
+
const lines = text.split(/\r?\n/).map((line) => {
|
|
6588
|
+
const fields = splitPipeFields(line);
|
|
6589
|
+
if (fields[0]?.trim() !== CANDIDATE_MARKER || fields.length <= CANDIDATE_FIELD_COUNT + 1 || fields.length > CANDIDATE_FIELD_COUNT + 17 || !isCandidateConfidence(fields.at(-1)?.trim())) {
|
|
6590
|
+
return line;
|
|
6591
|
+
}
|
|
6592
|
+
const normalized = fields.map(escapeCandidateField);
|
|
6593
|
+
const overflowEvidence = family === "base_explorer" ? normalized.slice(7, -2) : normalized.slice(8, -1);
|
|
6594
|
+
if (overflowEvidence.length < 3 || overflowEvidence.some((fragment) => fragment.length < 4)) {
|
|
6595
|
+
return line;
|
|
6596
|
+
}
|
|
6597
|
+
const rebuilt = family === "base_explorer" ? [
|
|
6598
|
+
...normalized.slice(0, 7),
|
|
6599
|
+
overflowEvidence.join(" \\| "),
|
|
6600
|
+
...normalized.slice(-2)
|
|
6601
|
+
] : [
|
|
6602
|
+
...normalized.slice(0, 8),
|
|
6603
|
+
overflowEvidence.join(" \\| "),
|
|
6604
|
+
normalized.at(-1) ?? ""
|
|
6605
|
+
];
|
|
6606
|
+
if (rebuilt.length !== CANDIDATE_FIELD_COUNT + 1)
|
|
6607
|
+
return line;
|
|
6608
|
+
repaired = true;
|
|
6609
|
+
return rebuilt.join(" | ");
|
|
6610
|
+
});
|
|
6611
|
+
return { text: lines.join(`
|
|
6612
|
+
`), repaired };
|
|
6613
|
+
}
|
|
6614
|
+
function resynchronizeLateCanonicalHeader(text, family) {
|
|
6615
|
+
const lines = text.split(/\r?\n/);
|
|
6616
|
+
const firstMarker = lines.findIndex((line) => {
|
|
6617
|
+
const marker = splitPipeFields(line)[0]?.trim();
|
|
6618
|
+
return marker === CANDIDATE_MARKER || marker === CLEAN_MARKER;
|
|
6619
|
+
});
|
|
6620
|
+
if (firstMarker < 0 || !analyzeCandidateLine(lines[firstMarker], family)?.valid) {
|
|
6621
|
+
return { text, repaired: false };
|
|
6622
|
+
}
|
|
6623
|
+
const headerIndexes = lines.flatMap((line, index) => line.trim() === CANDIDATE_HEADERS[family] ? [index] : []);
|
|
6624
|
+
if (!headerIndexes.some((index) => index > firstMarker)) {
|
|
6625
|
+
return { text, repaired: false };
|
|
6626
|
+
}
|
|
6627
|
+
if (declaredCanonicalFamilies(text).some((declared) => declared !== family)) {
|
|
6628
|
+
return { text, repaired: false };
|
|
6629
|
+
}
|
|
6630
|
+
const withoutHeaders = lines.filter((_line, index) => !headerIndexes.includes(index));
|
|
6631
|
+
const insertion = withoutHeaders.findIndex((line) => {
|
|
6632
|
+
const marker = splitPipeFields(line)[0]?.trim();
|
|
6633
|
+
return marker === CANDIDATE_MARKER || marker === CLEAN_MARKER;
|
|
6634
|
+
});
|
|
6635
|
+
return {
|
|
6636
|
+
text: [
|
|
6637
|
+
...withoutHeaders.slice(0, insertion),
|
|
6638
|
+
CANDIDATE_HEADERS[family],
|
|
6639
|
+
...withoutHeaders.slice(insertion)
|
|
6640
|
+
].join(`
|
|
6641
|
+
`),
|
|
6642
|
+
repaired: true
|
|
6643
|
+
};
|
|
6644
|
+
}
|
|
6579
6645
|
function isStrictProtocolDataLine(line, family) {
|
|
6580
6646
|
const clean = repairRedundantCleanConfidenceLine(line, family).line;
|
|
6581
6647
|
const fields = splitPipeFields(clean).map((field) => field.trim());
|
|
@@ -6644,7 +6710,15 @@ function normalizeCandidateArtifact(rawText, fallbackFamily) {
|
|
|
6644
6710
|
const pipeRepair = repairCleanEvidencePipes(cleanRepair.text);
|
|
6645
6711
|
if (pipeRepair.repaired)
|
|
6646
6712
|
repairKinds.push("clean-evidence-pipe-tail-merge");
|
|
6647
|
-
const
|
|
6713
|
+
const candidatePipeRepair = repairCandidateEvidencePipes(pipeRepair.text, fallbackFamily);
|
|
6714
|
+
if (candidatePipeRepair.repaired) {
|
|
6715
|
+
repairKinds.push("candidate-evidence-pipe-recovery-lossy");
|
|
6716
|
+
}
|
|
6717
|
+
const lateHeaderRepair = resynchronizeLateCanonicalHeader(candidatePipeRepair.text, fallbackFamily);
|
|
6718
|
+
if (lateHeaderRepair.repaired) {
|
|
6719
|
+
repairKinds.push("late-canonical-header-resynchronized");
|
|
6720
|
+
}
|
|
6721
|
+
const duplicateHeaderDrop = dropDuplicateHeaderRows(lateHeaderRepair.text);
|
|
6648
6722
|
if (duplicateHeaderDrop.dropped) {
|
|
6649
6723
|
repairKinds.push("duplicate-header-row-dropped");
|
|
6650
6724
|
}
|
|
@@ -7680,13 +7754,24 @@ var PrReviewHandoffSchema = exports_external.object({
|
|
|
7680
7754
|
summary: exports_external.string().trim().min(1).max(20000),
|
|
7681
7755
|
provenance: exports_external.array(exports_external.string().trim().min(1).max(4000)).min(1).max(1000)
|
|
7682
7756
|
}).strict();
|
|
7757
|
+
var PrReviewPartialBaseCoverageSchema = exports_external.object({
|
|
7758
|
+
missing_dimension: exports_external.enum([
|
|
7759
|
+
"intent-architecture",
|
|
7760
|
+
"correctness-state",
|
|
7761
|
+
"tests-falsifiability",
|
|
7762
|
+
"security-trust",
|
|
7763
|
+
"reliability-performance",
|
|
7764
|
+
"compatibility-delivery"
|
|
7765
|
+
])
|
|
7766
|
+
}).strict();
|
|
7683
7767
|
var WritePrReviewArtifactArgsSchema = exports_external.discriminatedUnion("kind", [
|
|
7684
7768
|
exports_external.object({
|
|
7685
7769
|
kind: exports_external.literal("findings"),
|
|
7686
7770
|
run_id: PrReviewRunIdSchema.optional(),
|
|
7687
7771
|
pr_head_sha: exports_external.string().trim().regex(/^[0-9a-f]{6,64}$/i),
|
|
7688
7772
|
boundary: exports_external.enum(PR_REVIEW_ARTIFACT_BOUNDARIES),
|
|
7689
|
-
records: exports_external.array(PrReviewFindingSchema).min(1).max(1000)
|
|
7773
|
+
records: exports_external.array(PrReviewFindingSchema).min(1).max(1000),
|
|
7774
|
+
partial_base_coverage: PrReviewPartialBaseCoverageSchema.optional()
|
|
7690
7775
|
}).strict(),
|
|
7691
7776
|
exports_external.object({
|
|
7692
7777
|
kind: exports_external.literal("handoff"),
|
|
@@ -7695,6 +7780,13 @@ var WritePrReviewArtifactArgsSchema = exports_external.discriminatedUnion("kind"
|
|
|
7695
7780
|
handoff: PrReviewHandoffSchema
|
|
7696
7781
|
}).strict()
|
|
7697
7782
|
]).superRefine((value, ctx) => {
|
|
7783
|
+
if (value.kind === "findings" && value.partial_base_coverage !== undefined && value.boundary !== "post_explorer") {
|
|
7784
|
+
ctx.addIssue({
|
|
7785
|
+
code: "custom",
|
|
7786
|
+
path: ["partial_base_coverage"],
|
|
7787
|
+
message: "is valid only for the post_explorer boundary"
|
|
7788
|
+
});
|
|
7789
|
+
}
|
|
7698
7790
|
const bytes = serializedPrReviewArtifactInputBytes(value);
|
|
7699
7791
|
const maxBytes = value.kind === "findings" ? PR_REVIEW_FINDINGS_WRITE_MAX_BYTES : PR_REVIEW_HANDOFF_WRITE_MAX_BYTES;
|
|
7700
7792
|
if (bytes > maxBytes) {
|
|
@@ -8529,6 +8621,15 @@ var PrReviewResilienceStateRecordSchema = exports_external.object({
|
|
|
8529
8621
|
attempts: exports_external.array(PrReviewResilienceAttemptRecordSchema).max(3),
|
|
8530
8622
|
circuit: PrReviewResilienceCircuitRecordSchema.optional()
|
|
8531
8623
|
}).strict();
|
|
8624
|
+
var PrReviewPartialBaseCoverageRecordSchema = exports_external.object({
|
|
8625
|
+
runId: exports_external.string().min(1).max(128),
|
|
8626
|
+
prHeadSha: exports_external.string().regex(/^[0-9a-f]{6,64}$/i),
|
|
8627
|
+
revisionDigest: exports_external.string().min(1).max(256),
|
|
8628
|
+
missingDimension: exports_external.enum(PR_REVIEW_BASE_DIMENSION_IDS),
|
|
8629
|
+
failureClass: exports_external.enum(["contract", "resource", "deadline"]),
|
|
8630
|
+
terminalEventId: exports_external.string().min(1).max(256),
|
|
8631
|
+
admittedAt: exports_external.string().datetime()
|
|
8632
|
+
}).strict();
|
|
8532
8633
|
var PrFeedbackLaneOwnershipSchema = exports_external.object({
|
|
8533
8634
|
laneId: exports_external.string().min(1),
|
|
8534
8635
|
ownedItemIds: exports_external.array(exports_external.string().min(1)).min(1)
|
|
@@ -8681,6 +8782,7 @@ var PrWorkflowGateStateSchema = exports_external.object({
|
|
|
8681
8782
|
prReviewBaseDispatches: exports_external.array(PrReviewBaseDispatchRecordSchema).max(MAX_WORKFLOW_BATCHES).optional(),
|
|
8682
8783
|
prReviewBaseDispatch: PrReviewBaseDispatchRecordSchema.optional(),
|
|
8683
8784
|
prReviewResilience: PrReviewResilienceStateRecordSchema.optional(),
|
|
8785
|
+
prReviewContractRetryDimensions: exports_external.array(PrReviewBaseDimensionIdSchema).max(PR_REVIEW_BASE_DIMENSION_IDS.length).optional(),
|
|
8684
8786
|
prReviewTriggerLedger: exports_external.array(PrReviewInlineTriggerRowSchema).length(PR_REVIEW_REQUIRED_TRIGGER_IDS.length).optional(),
|
|
8685
8787
|
prReviewTriggerEvalPath: exports_external.string().min(1).optional(),
|
|
8686
8788
|
prReviewTriggerEvalRunId: exports_external.string().min(1).optional(),
|
|
@@ -8691,6 +8793,9 @@ var PrWorkflowGateStateSchema = exports_external.object({
|
|
|
8691
8793
|
prReviewReservedRunId: exports_external.string().min(1).optional(),
|
|
8692
8794
|
prReviewArtifactRunId: exports_external.string().min(1).optional(),
|
|
8693
8795
|
prReviewFindingsPath: exports_external.string().min(1).optional(),
|
|
8796
|
+
prReviewPartialBaseCoverage: PrReviewPartialBaseCoverageRecordSchema.optional(),
|
|
8797
|
+
prReviewCoverageDisclosurePath: exports_external.string().min(1).max(512).optional(),
|
|
8798
|
+
prReviewCoverageDisclosureDigest: exports_external.string().regex(/^[0-9a-f]{64}$/).optional(),
|
|
8694
8799
|
prReviewArtifactBoundaries: exports_external.array(exports_external.enum(["post_explorer", "post_reviewer", "post_critic"])).max(3).optional(),
|
|
8695
8800
|
prReviewHandoffPath: exports_external.string().min(1).optional(),
|
|
8696
8801
|
prReviewHandoffRequired: exports_external.boolean().optional(),
|
|
@@ -8817,13 +8922,6 @@ var PR_WORKFLOW_SWEEPABLE_LANE_STATUSES = new Set(["pending", "running"]);
|
|
|
8817
8922
|
var CAS_ESCAPE_DISCLOSURE = "state revision unsalvageable; cleared without compare-and-swap";
|
|
8818
8923
|
var PR_WORKFLOW_LANE_LIVENESS_PROBE_TIMEOUT_MS = 5000;
|
|
8819
8924
|
var PR_WORKFLOW_PENDING_LIVENESS_THRESHOLD_MS = 3 * 60000;
|
|
8820
|
-
var PR_WORKFLOW_PENDING_LIVENESS_MODES = new Set([
|
|
8821
|
-
"swarm-pr-review:base",
|
|
8822
|
-
"swarm-pr-review:micro",
|
|
8823
|
-
"swarm-pr-review:council",
|
|
8824
|
-
"swarm-pr-review:reviewer",
|
|
8825
|
-
"swarm-pr-review:critic"
|
|
8826
|
-
]);
|
|
8827
8925
|
var LIVE_SESSION_STATUS_TYPES = new Set([
|
|
8828
8926
|
"busy",
|
|
8829
8927
|
"retry"
|
|
@@ -9221,6 +9319,28 @@ async function assertPrFeedbackTrackingCheckout(directory, prHeadSha) {
|
|
|
9221
9319
|
throw new Error(`BLOCKED: PR_FEEDBACK upstream "${attachedUpstream.remoteTrackingRef}" must point to the exact intake PR head "${prHeadSha}" before the first head bind`);
|
|
9222
9320
|
}
|
|
9223
9321
|
}
|
|
9322
|
+
function normalizeFailureSignatureText(value) {
|
|
9323
|
+
return value.toLowerCase().replace(/\b\d{4}-\d{2}-\d{2}t\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?(?:z|[+-]\d{2}:\d{2})\b/g, "<iso-timestamp>").replace(/\b\d{10,16}\b/g, "<epoch>").replace(/\b((?:session|request|trace|correlation|run)(?:[_-]?id)?)\s*[:=]\s*([a-z0-9._:-]*[0-9_-][a-z0-9._:-]*)\b/g, "$1=<id>").replace(/\b((?:session|sess|request|req|trace|correlation|corr|run)(?:[_-]?id)?)\s+((?:(?:sess?|req|trace|corr|run)[_-][a-z0-9._:-]+|[a-z][a-z0-9._:-]*\d[a-z0-9._:-]*))\b/g, "$1 <id>").replace(/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/g, "<uuid>").replace(/\b[0-9a-f]{16,64}\b/g, "<hex>").replace(/[a-z]:\\[^\s)]+/gi, "<path>").replace(/(?:\/[\w.@:-]+)+/g, "<path>").replace(/\s+/g, " ").trim().slice(0, 160);
|
|
9324
|
+
}
|
|
9325
|
+
function classifyTerminalFailureSignature(record) {
|
|
9326
|
+
if (!TERMINAL_FAILED_DELEGATION_STATUSES.has(record.status))
|
|
9327
|
+
return null;
|
|
9328
|
+
const result = record.terminalResult?.result ?? record.result;
|
|
9329
|
+
if (!result)
|
|
9330
|
+
return `terminal-zero-output:${record.status}`;
|
|
9331
|
+
const outputRef = result.outputRef?.trim();
|
|
9332
|
+
const text = result.text?.trim() ?? "";
|
|
9333
|
+
if (!outputRef && text.length === 0 && (result.chars ?? 0) === 0) {
|
|
9334
|
+
return `terminal-zero-output:${record.status}`;
|
|
9335
|
+
}
|
|
9336
|
+
const errorText = result.error?.trim();
|
|
9337
|
+
if (errorText) {
|
|
9338
|
+
return `terminal-error-output:${record.status}:${normalizeFailureSignatureText(errorText)}`;
|
|
9339
|
+
}
|
|
9340
|
+
if (record.status === "completed")
|
|
9341
|
+
return null;
|
|
9342
|
+
return `terminal-nonzero-output:${record.status}`;
|
|
9343
|
+
}
|
|
9224
9344
|
var TERMINAL_FAILED_DELEGATION_STATUSES = new Set([
|
|
9225
9345
|
"completed",
|
|
9226
9346
|
"error",
|
|
@@ -9276,6 +9396,40 @@ function minimumConsolidatedLaneCover(sets) {
|
|
|
9276
9396
|
}
|
|
9277
9397
|
return best[full];
|
|
9278
9398
|
}
|
|
9399
|
+
var PR_REVIEW_COVERAGE_DISCLOSURE_MAX_BYTES = 4096;
|
|
9400
|
+
function coverageDisclosureRelativePath(runId) {
|
|
9401
|
+
return path12.join("pr-review", runId, "coverage-disclosure.json");
|
|
9402
|
+
}
|
|
9403
|
+
async function readAndVerifyCoverageDisclosure(directory, state) {
|
|
9404
|
+
const record = state.prReviewPartialBaseCoverage;
|
|
9405
|
+
const relativePath = state.prReviewCoverageDisclosurePath;
|
|
9406
|
+
const expectedDigest = state.prReviewCoverageDisclosureDigest;
|
|
9407
|
+
if (!record && !relativePath && !expectedDigest)
|
|
9408
|
+
return null;
|
|
9409
|
+
if (!record || !relativePath || !expectedDigest) {
|
|
9410
|
+
throw new Error("BLOCKED: PR_REVIEW partial base coverage disclosure state is incomplete");
|
|
9411
|
+
}
|
|
9412
|
+
const expectedPath = coverageDisclosureRelativePath(record.runId).split(path12.sep).join("/");
|
|
9413
|
+
if (relativePath !== expectedPath) {
|
|
9414
|
+
throw new Error("BLOCKED: PR_REVIEW partial base coverage disclosure path does not match its bound run");
|
|
9415
|
+
}
|
|
9416
|
+
const raw = await readBoundedSwarmRegularFile(directory, relativePath, PR_REVIEW_COVERAGE_DISCLOSURE_MAX_BYTES, "PR_REVIEW partial base coverage disclosure");
|
|
9417
|
+
const digest = createHash5("sha256").update(raw, "utf8").digest("hex");
|
|
9418
|
+
if (digest !== expectedDigest) {
|
|
9419
|
+
throw new Error("BLOCKED: PR_REVIEW partial base coverage disclosure digest does not match durable state");
|
|
9420
|
+
}
|
|
9421
|
+
let decoded;
|
|
9422
|
+
try {
|
|
9423
|
+
decoded = JSON.parse(raw);
|
|
9424
|
+
} catch {
|
|
9425
|
+
throw new Error("BLOCKED: PR_REVIEW partial base coverage disclosure is invalid JSON");
|
|
9426
|
+
}
|
|
9427
|
+
const parsed = PrReviewPartialBaseCoverageRecordSchema.safeParse(decoded);
|
|
9428
|
+
if (!parsed.success || JSON.stringify(parsed.data) !== JSON.stringify(record)) {
|
|
9429
|
+
throw new Error("BLOCKED: PR_REVIEW partial base coverage disclosure does not match durable state");
|
|
9430
|
+
}
|
|
9431
|
+
return record;
|
|
9432
|
+
}
|
|
9279
9433
|
async function assertPrReviewBaseCoverageSettled(directory, sessionID, gateContext) {
|
|
9280
9434
|
const state = await requireBoundState(directory, sessionID, "PR_REVIEW");
|
|
9281
9435
|
const batches = state.prReviewBaseDispatches ?? [];
|
|
@@ -9293,6 +9447,10 @@ async function assertPrReviewBaseCoverageSettled(directory, sessionID, gateConte
|
|
|
9293
9447
|
}
|
|
9294
9448
|
const missing = PR_REVIEW_BASE_DIMENSION_IDS.filter((dimension) => !covered.has(dimension));
|
|
9295
9449
|
if (missing.length > 0 || covered.size !== PR_REVIEW_BASE_DIMENSION_IDS.length) {
|
|
9450
|
+
const disclosure = await readAndVerifyCoverageDisclosure(directory, state);
|
|
9451
|
+
if (disclosure && missing.length === 1 && covered.size === PR_REVIEW_BASE_DIMENSION_IDS.length - 1 && disclosure.missingDimension === missing[0] && disclosure.prHeadSha === state.prHeadSha && disclosure.revisionDigest === ctx.revisionDigest && disclosure.runId === (state.prReviewArtifactRunId ?? state.prReviewReservedRunId)) {
|
|
9452
|
+
return state;
|
|
9453
|
+
}
|
|
9296
9454
|
throw new Error(`BLOCKED: PR_REVIEW base coverage is incomplete; missing dimensions: ${missing.join(", ") || "(none)"}${malformedDiagnostics.length > 0 ? `; first failed lane predicates: ${malformedDiagnostics.join(" | ")}` : ""}; valid dimensions: ${PR_REVIEW_BASE_DIMENSION_IDS.join(", ")}; expected candidate row: ${CANDIDATE_HEADERS.base_explorer}; expected clean row: ${CLEAN_TEMPLATES.base_explorer}`);
|
|
9297
9455
|
}
|
|
9298
9456
|
return state;
|
|
@@ -9794,6 +9952,7 @@ async function transitionPrReviewToFeedback(directory, sessionID, request) {
|
|
|
9794
9952
|
}));
|
|
9795
9953
|
}
|
|
9796
9954
|
var _test_exports2 = {
|
|
9955
|
+
classifyTerminalFailureSignature,
|
|
9797
9956
|
minimumConsolidatedLaneCover,
|
|
9798
9957
|
analyzePrReviewBatchRecordIntegrity,
|
|
9799
9958
|
MAX_COVER_UNIVERSE_BITS,
|
|
@@ -13089,6 +13248,7 @@ async function computeGateStatistics(directory, minSamples = 6, runId) {
|
|
|
13089
13248
|
}
|
|
13090
13249
|
|
|
13091
13250
|
// src/services/cost-accounting.ts
|
|
13251
|
+
init_logger();
|
|
13092
13252
|
import * as fs8 from "fs";
|
|
13093
13253
|
import * as os from "os";
|
|
13094
13254
|
import * as path15 from "path";
|
|
@@ -13121,11 +13281,17 @@ function readTelemetryEvents(directory) {
|
|
|
13121
13281
|
}
|
|
13122
13282
|
} catch {}
|
|
13123
13283
|
const events = [];
|
|
13284
|
+
let unreadableSnapshots = 0;
|
|
13285
|
+
let firstUnreadableReason = "";
|
|
13124
13286
|
for (const file of snapshotFiles) {
|
|
13125
13287
|
let content = "";
|
|
13126
13288
|
try {
|
|
13127
13289
|
content = fs8.readFileSync(file, "utf-8");
|
|
13128
|
-
} catch {
|
|
13290
|
+
} catch (err) {
|
|
13291
|
+
unreadableSnapshots += 1;
|
|
13292
|
+
if (!firstUnreadableReason) {
|
|
13293
|
+
firstUnreadableReason = err instanceof Error ? err.message : String(err);
|
|
13294
|
+
}
|
|
13129
13295
|
continue;
|
|
13130
13296
|
}
|
|
13131
13297
|
for (const line of content.split(/\r?\n/)) {
|
|
@@ -13139,6 +13305,9 @@ function readTelemetryEvents(directory) {
|
|
|
13139
13305
|
} catch {}
|
|
13140
13306
|
}
|
|
13141
13307
|
}
|
|
13308
|
+
if (unreadableSnapshots > 0) {
|
|
13309
|
+
warn(`[cost-accounting] ${unreadableSnapshots} of ${snapshotFiles.length} snapshot file(s) were unreadable; cost totals undercount. First reason: ${firstUnreadableReason}`);
|
|
13310
|
+
}
|
|
13142
13311
|
try {
|
|
13143
13312
|
for (const f of snapshotFiles) {
|
|
13144
13313
|
try {
|
|
@@ -16121,8 +16290,40 @@ function redactUrl(match) {
|
|
|
16121
16290
|
return `<url:${hashValue(match).slice(0, 12)}>`;
|
|
16122
16291
|
}
|
|
16123
16292
|
}
|
|
16293
|
+
var FILL_MAX_RUN = 8;
|
|
16294
|
+
var FILL = `[\\s\\p{Cc}\\p{Cf}\\p{Default_Ignorable_Code_Point}]{0,${FILL_MAX_RUN}}`;
|
|
16295
|
+
var CONTROL_CHAR_RUN = /[\p{Cc}\p{Cf}\p{Default_Ignorable_Code_Point}]+/gu;
|
|
16296
|
+
var MAX_SANITIZE_INPUT_CHARS = MAX_DISPLAY_BYTES * 8;
|
|
16297
|
+
function tolerantKeyword(word) {
|
|
16298
|
+
return word.split("").join(FILL);
|
|
16299
|
+
}
|
|
16300
|
+
var CREDENTIAL_KEYWORDS_LOWER = [
|
|
16301
|
+
"bearer",
|
|
16302
|
+
"token",
|
|
16303
|
+
"secret",
|
|
16304
|
+
"password",
|
|
16305
|
+
"authorization"
|
|
16306
|
+
].map(tolerantKeyword);
|
|
16307
|
+
var API_KEY_PATTERN = `${tolerantKeyword("api")}${FILL}[_-]?${FILL}${tolerantKeyword("key")}`;
|
|
16308
|
+
var CREDENTIAL_KEYWORD_ALTERNATION = `(?:${API_KEY_PATTERN}|${CREDENTIAL_KEYWORDS_LOWER.join("|")})`;
|
|
16309
|
+
var SCREAMING_SUFFIXES = ["TOKEN", "KEY", "SECRET", "PASSWORD", "AUTH"];
|
|
16310
|
+
var TOLERANT_BEARER_PREFIX = tolerantKeyword("Bearer");
|
|
16311
|
+
var CREDENTIAL_KV_PATTERN = new RegExp(`\\b(${CREDENTIAL_KEYWORD_ALTERNATION})\\b${FILL}[:=]${FILL}(?:${TOLERANT_BEARER_PREFIX}${FILL})?[^\\s,;]+`, "giu");
|
|
16312
|
+
var SCREAMING_KEY_HORIZONTAL_FILL_CHARS = "\\x00-\\x09\\x0e-\\x1f\\x7f-\\x9f\\p{Zs}\\p{Cf}\\p{Default_Ignorable_Code_Point}";
|
|
16313
|
+
var SCREAMING_KV_CANDIDATE_PATTERN = new RegExp(`\\b([A-Z0-9_${SCREAMING_KEY_HORIZONTAL_FILL_CHARS}]{1,80})${FILL}=${FILL}([^\\s]+)`, "gu");
|
|
16314
|
+
function screamingKeyContainsSuffix(key) {
|
|
16315
|
+
const stripped = key.replace(CONTROL_CHAR_RUN, "").replace(/\s+/g, "");
|
|
16316
|
+
return SCREAMING_SUFFIXES.some((suffix) => stripped.includes(suffix));
|
|
16317
|
+
}
|
|
16124
16318
|
function sanitizeFailureEvidenceDisplay(value) {
|
|
16125
|
-
const
|
|
16319
|
+
const bounded = value.slice(0, MAX_SANITIZE_INPUT_CHARS);
|
|
16320
|
+
const redacted = bounded.replace(/\bhttps?:\/\/[^\s'"<>]+/gi, (match) => redactUrl(match)).replace(CREDENTIAL_KV_PATTERN, (_, key) => {
|
|
16321
|
+
return `${key.replace(CONTROL_CHAR_RUN, "")}=<redacted>`;
|
|
16322
|
+
}).replace(SCREAMING_KV_CANDIDATE_PATTERN, (match, key) => {
|
|
16323
|
+
if (!screamingKeyContainsSuffix(key))
|
|
16324
|
+
return match;
|
|
16325
|
+
return `${key.replace(CONTROL_CHAR_RUN, "").replace(/\s+/g, "")}=<redacted>`;
|
|
16326
|
+
}).replace(CONTROL_CHAR_RUN, " ");
|
|
16126
16327
|
return boundedUtf8(redacted.trim());
|
|
16127
16328
|
}
|
|
16128
16329
|
function signalFrom(value) {
|
|
@@ -18302,7 +18503,7 @@ function planMerges(active, threshold, maxComparisons, maxMerges) {
|
|
|
18302
18503
|
};
|
|
18303
18504
|
}
|
|
18304
18505
|
async function sweepActiveNearDuplicates(directory, options = {}) {
|
|
18305
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
18506
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-s0xz2520.js");
|
|
18306
18507
|
const { config } = loadPluginConfigWithMeta2(directory);
|
|
18307
18508
|
const sweepConfig = config.learning?.dedup_sweep;
|
|
18308
18509
|
if (sweepConfig?.enabled === false)
|
|
@@ -19432,7 +19633,7 @@ async function runCuratorPhase(directory, phase, agentsDispatched, config, knowl
|
|
|
19432
19633
|
}
|
|
19433
19634
|
if (config.skill_generation_enabled === true && skillCandidates.length > 0) {
|
|
19434
19635
|
try {
|
|
19435
|
-
const skillModule = await import("./skill-generator-
|
|
19636
|
+
const skillModule = await import("./skill-generator-0gmpxwgk.js");
|
|
19436
19637
|
for (const cand of skillCandidates) {
|
|
19437
19638
|
if (cand.confidence < (config.min_skill_confidence ?? DEFAULT_SKILL_MIN_CONFIDENCE)) {
|
|
19438
19639
|
continue;
|
|
@@ -19904,7 +20105,7 @@ async function applyCuratorKnowledgeUpdates(directory, recommendations, knowledg
|
|
|
19904
20105
|
} catch {}
|
|
19905
20106
|
}
|
|
19906
20107
|
if (contradictedEntries.length > 0 && knowledgeConfig.contradiction_threshold_action === "quarantine") {
|
|
19907
|
-
const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-
|
|
20108
|
+
const { maybeQuarantineOnContradiction } = await import("./knowledge-escalator-pc7smwrd.js");
|
|
19908
20109
|
for (const { id } of contradictedEntries) {
|
|
19909
20110
|
try {
|
|
19910
20111
|
await maybeQuarantineOnContradiction(directory, id, knowledgeConfig.contradiction_quarantine_threshold, knowledgeConfig.contradiction_quarantine_window_days);
|
|
@@ -20723,7 +20924,7 @@ async function runCuratorPostMortem(directory, options = {}) {
|
|
|
20723
20924
|
warnings.push("Failed to collect knowledge summary.");
|
|
20724
20925
|
}
|
|
20725
20926
|
try {
|
|
20726
|
-
const { getScanStatus } = await import("./scan-cursor-
|
|
20927
|
+
const { getScanStatus } = await import("./scan-cursor-hr8e3jqj.js");
|
|
20727
20928
|
const scanStatus = await getScanStatus(directory);
|
|
20728
20929
|
if (scanStatus.remaining_estimate > 0) {
|
|
20729
20930
|
warnings.push(`Fair scan: reviewed ${knowledgeSummary.length} entries this sweep (generation ${scanStatus.generation}); ${scanStatus.remaining_estimate} more eligible entries will be visited in future curation sweeps.`);
|
|
@@ -20895,9 +21096,9 @@ var _internals26 = {
|
|
|
20895
21096
|
verifyPostMortemKnowledgeActions,
|
|
20896
21097
|
repairPostMortemActions,
|
|
20897
21098
|
loadDefaultKnowledgeConfig: async (directory) => {
|
|
20898
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
21099
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-g44y7s0w.js");
|
|
20899
21100
|
try {
|
|
20900
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
21101
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-s0xz2520.js");
|
|
20901
21102
|
const loaded = loadPluginConfigWithMeta2(directory);
|
|
20902
21103
|
return KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
|
|
20903
21104
|
} catch {
|
|
@@ -20905,11 +21106,11 @@ var _internals26 = {
|
|
|
20905
21106
|
}
|
|
20906
21107
|
},
|
|
20907
21108
|
applyCuratorKnowledgeUpdates: async (directory, recommendations, knowledgeConfig, generation) => {
|
|
20908
|
-
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-
|
|
21109
|
+
const { applyCuratorKnowledgeUpdates: applyCuratorKnowledgeUpdates2 } = await import("./curator-frrehxxe.js");
|
|
20909
21110
|
return applyCuratorKnowledgeUpdates2(directory, recommendations, knowledgeConfig, generation);
|
|
20910
21111
|
},
|
|
20911
21112
|
checkHivePromotions: async (entries, knowledgeConfig, directory) => {
|
|
20912
|
-
const { checkHivePromotions } = await import("./hive-promoter-
|
|
21113
|
+
const { checkHivePromotions } = await import("./hive-promoter-10zv1b45.js");
|
|
20913
21114
|
return checkHivePromotions(entries, knowledgeConfig, directory);
|
|
20914
21115
|
},
|
|
20915
21116
|
applyProposalTriage: async (directory, triage) => {
|
|
@@ -20918,7 +21119,7 @@ var _internals26 = {
|
|
|
20918
21119
|
activateProposal,
|
|
20919
21120
|
listSkills: listSkills2,
|
|
20920
21121
|
sanitizeSlug
|
|
20921
|
-
} = await import("./skill-generator-
|
|
21122
|
+
} = await import("./skill-generator-0gmpxwgk.js");
|
|
20922
21123
|
const result = {
|
|
20923
21124
|
approved: [],
|
|
20924
21125
|
rejected: [],
|
|
@@ -22248,9 +22449,9 @@ function hashContent(content) {
|
|
|
22248
22449
|
return createHash10("sha1").update(content).digest("hex");
|
|
22249
22450
|
}
|
|
22250
22451
|
async function loadConfigForPolicyCurator(directory) {
|
|
22251
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
22452
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-g44y7s0w.js");
|
|
22252
22453
|
try {
|
|
22253
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
22454
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-s0xz2520.js");
|
|
22254
22455
|
const { config: loadedConfig } = loadPluginConfigWithMeta2(directory);
|
|
22255
22456
|
return KnowledgeConfigSchema2.parse(loadedConfig.knowledge ?? {});
|
|
22256
22457
|
} catch {
|
|
@@ -29894,7 +30095,8 @@ function gatherToolProblems(toolAggregates) {
|
|
|
29894
30095
|
failureCount: agg.failureCount,
|
|
29895
30096
|
totalCalls: agg.count,
|
|
29896
30097
|
failureRate: Math.round(failureRate * 100) / 100,
|
|
29897
|
-
avgDurationMs: Math.round(agg.totalDuration / agg.count)
|
|
30098
|
+
avgDurationMs: Math.round(agg.totalDuration / agg.count),
|
|
30099
|
+
...agg.failureReasons && agg.failureReasons.length > 0 ? { failureReasons: agg.failureReasons } : {}
|
|
29898
30100
|
});
|
|
29899
30101
|
}
|
|
29900
30102
|
}
|
|
@@ -30205,6 +30407,9 @@ function buildReflectionDataSummary(data) {
|
|
|
30205
30407
|
lines.push("TOOL PROBLEMS (tools with >20% failure rate or >2 failures):");
|
|
30206
30408
|
for (const p of data.toolProblems) {
|
|
30207
30409
|
lines.push(` - ${p.tool}: ${p.failureCount}/${p.totalCalls} failures (${Math.round(p.failureRate * 100)}%), avg ${p.avgDurationMs}ms`);
|
|
30410
|
+
if (p.failureReasons && p.failureReasons.length > 0) {
|
|
30411
|
+
lines.push(` reasons: ${p.failureReasons.join("; ")}`);
|
|
30412
|
+
}
|
|
30208
30413
|
}
|
|
30209
30414
|
lines.push("");
|
|
30210
30415
|
}
|
|
@@ -30320,7 +30525,7 @@ function buildSignalsBlock(data) {
|
|
|
30320
30525
|
if (p.failureCount > 0) {
|
|
30321
30526
|
reproBacked.push({
|
|
30322
30527
|
title: `Tool ${p.tool} failing (${p.failureCount}/${p.totalCalls}, ${Math.round(p.failureRate * 100)}%)`,
|
|
30323
|
-
evidence: `tool failure rate ${Math.round(p.failureRate * 100)}% (${p.failureCount}/${p.totalCalls})`
|
|
30528
|
+
evidence: `tool failure rate ${Math.round(p.failureRate * 100)}% (${p.failureCount}/${p.totalCalls})${p.failureReasons && p.failureReasons.length > 0 ? `; reasons: ${p.failureReasons.join("; ")}` : ""}`
|
|
30324
30529
|
});
|
|
30325
30530
|
}
|
|
30326
30531
|
}
|
|
@@ -30463,6 +30668,9 @@ function buildDeterministicReport(data) {
|
|
|
30463
30668
|
lines.push("");
|
|
30464
30669
|
for (const p of data.toolProblems) {
|
|
30465
30670
|
lines.push(`- **${p.tool}**: ${p.failureCount}/${p.totalCalls} failures (${Math.round(p.failureRate * 100)}%), avg ${p.avgDurationMs}ms per call`);
|
|
30671
|
+
if (p.failureReasons && p.failureReasons.length > 0) {
|
|
30672
|
+
lines.push(` - reasons: ${p.failureReasons.join("; ")}`);
|
|
30673
|
+
}
|
|
30466
30674
|
}
|
|
30467
30675
|
lines.push("");
|
|
30468
30676
|
}
|
|
@@ -33450,7 +33658,7 @@ async function runFinalizeStage(ctx) {
|
|
|
33450
33658
|
}
|
|
33451
33659
|
}
|
|
33452
33660
|
try {
|
|
33453
|
-
const { CuratorConfigSchema: CCS } = await import("./schema-
|
|
33661
|
+
const { CuratorConfigSchema: CCS } = await import("./schema-g44y7s0w.js");
|
|
33454
33662
|
const { config: pmLoadedConfig } = _internals41.loadPluginConfigWithMeta(ctx.directory);
|
|
33455
33663
|
const curatorCfg = CCS.parse(pmLoadedConfig.curator ?? {});
|
|
33456
33664
|
if (curatorCfg.enabled && curatorCfg.postmortem_enabled) {
|
|
@@ -34320,7 +34528,7 @@ var _internals41 = {
|
|
|
34320
34528
|
closePlanTerminalState: reconcileCloseTerminalStateForPlan,
|
|
34321
34529
|
endAgentSession,
|
|
34322
34530
|
flushAndDrainTelemetry: async () => {
|
|
34323
|
-
const { flushAndDrainTelemetry } = await import("./telemetry-
|
|
34531
|
+
const { flushAndDrainTelemetry } = await import("./telemetry-5deacb7w.js");
|
|
34324
34532
|
return flushAndDrainTelemetry();
|
|
34325
34533
|
},
|
|
34326
34534
|
finalizeContextTelemetry: (directory) => {
|
|
@@ -35652,9 +35860,9 @@ var _internals45 = {
|
|
|
35652
35860
|
loadPluginConfigWithMeta,
|
|
35653
35861
|
loadCuratorDeps: async () => {
|
|
35654
35862
|
const [{ CuratorConfigSchema }, curator, { createCuratorLLMDelegate: createCuratorLLMDelegate2 }] = await Promise.all([
|
|
35655
|
-
import("./schema-
|
|
35656
|
-
import("./curator-
|
|
35657
|
-
import("./curator-llm-factory-
|
|
35863
|
+
import("./schema-g44y7s0w.js"),
|
|
35864
|
+
import("./curator-frrehxxe.js"),
|
|
35865
|
+
import("./curator-llm-factory-b83jsg02.js")
|
|
35658
35866
|
]);
|
|
35659
35867
|
return { CuratorConfigSchema, curator, createCuratorLLMDelegate: createCuratorLLMDelegate2 };
|
|
35660
35868
|
}
|
|
@@ -36644,7 +36852,7 @@ async function computeCurationDiagnostics(directory, entries) {
|
|
|
36644
36852
|
let scanCompleted = false;
|
|
36645
36853
|
let scanRemaining = 0;
|
|
36646
36854
|
try {
|
|
36647
|
-
const { getScanStatus } = await import("./scan-cursor-
|
|
36855
|
+
const { getScanStatus } = await import("./scan-cursor-hr8e3jqj.js");
|
|
36648
36856
|
const status = await getScanStatus(directory);
|
|
36649
36857
|
scanGeneration = status.generation;
|
|
36650
36858
|
scanCompleted = status.completed;
|
|
@@ -36652,19 +36860,19 @@ async function computeCurationDiagnostics(directory, entries) {
|
|
|
36652
36860
|
} catch {}
|
|
36653
36861
|
let configMatch = null;
|
|
36654
36862
|
try {
|
|
36655
|
-
const { isLinked: isLinked2 } = await import("./knowledge-link-
|
|
36863
|
+
const { isLinked: isLinked2 } = await import("./knowledge-link-mzn8x0qd.js");
|
|
36656
36864
|
if (isLinked2(directory)) {
|
|
36657
|
-
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-
|
|
36865
|
+
const { KnowledgeConfigSchema: KnowledgeConfigSchema2 } = await import("./schema-g44y7s0w.js");
|
|
36658
36866
|
let config;
|
|
36659
36867
|
try {
|
|
36660
|
-
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-
|
|
36868
|
+
const { loadPluginConfigWithMeta: loadPluginConfigWithMeta2 } = await import("./index-s0xz2520.js");
|
|
36661
36869
|
const loaded = loadPluginConfigWithMeta2(directory);
|
|
36662
36870
|
config = KnowledgeConfigSchema2.parse(loaded.config.knowledge ?? {});
|
|
36663
36871
|
} catch {
|
|
36664
36872
|
config = KnowledgeConfigSchema2.parse({});
|
|
36665
36873
|
}
|
|
36666
36874
|
const { cohortConfigFingerprint: cohortConfigFingerprint2 } = await import("./config-fingerprint-v22xh5a2.js");
|
|
36667
|
-
const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-
|
|
36875
|
+
const { buildConfigFingerprintInput: buildConfigFingerprintInput2, readCohortConfigFingerprint } = await import("./curation-policy-nck9g765.js");
|
|
36668
36876
|
const currentFp = cohortConfigFingerprint2(buildConfigFingerprintInput2(config));
|
|
36669
36877
|
const cohortFp = await readCohortConfigFingerprint(directory);
|
|
36670
36878
|
configMatch = cohortFp === null ? null : currentFp === cohortFp;
|
|
@@ -37968,7 +38176,7 @@ async function handleDoctorCommand(directory, args) {
|
|
|
37968
38176
|
const result = runConfigDoctor(config, directory);
|
|
37969
38177
|
let output;
|
|
37970
38178
|
if (enableAutoFix && result.hasAutoFixableIssues) {
|
|
37971
|
-
const { runConfigDoctorWithFixes } = await import("./config-doctor-
|
|
38179
|
+
const { runConfigDoctorWithFixes } = await import("./config-doctor-96qyv31a.js");
|
|
37972
38180
|
const fixResult = await runConfigDoctorWithFixes(directory, config, true, {
|
|
37973
38181
|
applyLossy: true
|
|
37974
38182
|
});
|
|
@@ -38908,7 +39116,7 @@ async function handleEvidenceCommand(directory, args) {
|
|
|
38908
39116
|
return formatTaskEvidenceMarkdown(evidenceData);
|
|
38909
39117
|
}
|
|
38910
39118
|
async function handleEvidenceSummaryCommand(directory) {
|
|
38911
|
-
const { buildEvidenceSummary } = await import("./evidence-summary-service-
|
|
39119
|
+
const { buildEvidenceSummary } = await import("./evidence-summary-service-dv4bt2bx.js");
|
|
38912
39120
|
const artifact = await buildEvidenceSummary(directory);
|
|
38913
39121
|
if (!artifact) {
|
|
38914
39122
|
return "No plan found. Run `/swarm plan` to check plan status.";
|
|
@@ -50113,6 +50321,8 @@ var QUERIES = {
|
|
|
50113
50321
|
) @func.def
|
|
50114
50322
|
(class_declaration name: (name) @class.name) @class.def
|
|
50115
50323
|
(interface_declaration name: (name) @interface.name) @interface.def
|
|
50324
|
+
(trait_declaration name: (name) @trait.name) @trait.def
|
|
50325
|
+
(enum_declaration name: (name) @enum.name) @enum.def
|
|
50116
50326
|
`,
|
|
50117
50327
|
imports: `
|
|
50118
50328
|
(namespace_use_declaration) @import
|
|
@@ -50359,6 +50569,7 @@ function buildFacts(tree, qs, grammarId) {
|
|
|
50359
50569
|
defNameKeys.add(nodeKey(nameNode));
|
|
50360
50570
|
}
|
|
50361
50571
|
}
|
|
50572
|
+
augmentNativeDynamicDefs(grammarId, root.text, defs);
|
|
50362
50573
|
const importsWithIndex = [];
|
|
50363
50574
|
const addImport = (entry, node) => {
|
|
50364
50575
|
if (!entry)
|
|
@@ -50440,12 +50651,28 @@ function buildFacts(tree, qs, grammarId) {
|
|
|
50440
50651
|
}
|
|
50441
50652
|
}
|
|
50442
50653
|
}
|
|
50443
|
-
if (isEsMGrammar(grammarId)) {
|
|
50654
|
+
if (isEsMGrammar(grammarId) || grammarId === "dart") {
|
|
50444
50655
|
for (const exportNode of exportNodes) {
|
|
50445
50656
|
addImport(parseImport(grammarId, exportNode.text.trim()), exportNode);
|
|
50446
50657
|
}
|
|
50447
50658
|
}
|
|
50448
|
-
const
|
|
50659
|
+
for (const fallback of fallbackImportsForSource(grammarId, root.text)) {
|
|
50660
|
+
importsWithIndex.push(fallback);
|
|
50661
|
+
}
|
|
50662
|
+
const seenImports = new Set;
|
|
50663
|
+
const imports = importsWithIndex.sort((a, b) => a.index - b.index).map((item) => item.entry).filter((entry) => {
|
|
50664
|
+
const key = JSON.stringify([
|
|
50665
|
+
entry.specifier,
|
|
50666
|
+
entry.importType,
|
|
50667
|
+
entry.bindings,
|
|
50668
|
+
entry.reExport ?? false,
|
|
50669
|
+
entry.exportedBindings ?? []
|
|
50670
|
+
]);
|
|
50671
|
+
if (seenImports.has(key))
|
|
50672
|
+
return false;
|
|
50673
|
+
seenImports.add(key);
|
|
50674
|
+
return true;
|
|
50675
|
+
});
|
|
50449
50676
|
const topLevelDefs = defNodes.filter((d) => isTopLevelDef(d.node, root)).map((d) => ({ name: d.name, node: d.node }));
|
|
50450
50677
|
const refs = [];
|
|
50451
50678
|
const refParamTypes = grammarId === "swift" ? SWIFT_REF_PARAM_TYPES : PARAM_TYPES;
|
|
@@ -50490,7 +50717,390 @@ function buildFacts(tree, qs, grammarId) {
|
|
|
50490
50717
|
});
|
|
50491
50718
|
}
|
|
50492
50719
|
}
|
|
50493
|
-
|
|
50720
|
+
const normalizedDefs = defs.map((def) => ({
|
|
50721
|
+
...def,
|
|
50722
|
+
endLine: Math.max(def.endLine, def.startLine)
|
|
50723
|
+
}));
|
|
50724
|
+
return { defs: normalizedDefs, imports, refs };
|
|
50725
|
+
}
|
|
50726
|
+
function augmentNativeDynamicDefs(grammarId, source, defs) {
|
|
50727
|
+
switch (grammarId) {
|
|
50728
|
+
case "dart":
|
|
50729
|
+
augmentDartDefs(source, defs);
|
|
50730
|
+
return;
|
|
50731
|
+
case "ruby":
|
|
50732
|
+
augmentRubyDefs(source, defs);
|
|
50733
|
+
return;
|
|
50734
|
+
case "php":
|
|
50735
|
+
augmentPhpDefs(source, defs);
|
|
50736
|
+
return;
|
|
50737
|
+
}
|
|
50738
|
+
}
|
|
50739
|
+
function upsertAugmentedDef(defs, def) {
|
|
50740
|
+
const existing = defs.find((item) => item.name === def.name && item.startLine === def.startLine);
|
|
50741
|
+
if (existing) {
|
|
50742
|
+
existing.kind = def.kind;
|
|
50743
|
+
existing.exported = def.exported;
|
|
50744
|
+
existing.visibilityInfo = def.visibilityInfo;
|
|
50745
|
+
existing.endLine = Math.max(existing.endLine, def.endLine);
|
|
50746
|
+
return;
|
|
50747
|
+
}
|
|
50748
|
+
defs.push(def);
|
|
50749
|
+
}
|
|
50750
|
+
function symbolVisibilityInfo(visibility, exported, exportedReason) {
|
|
50751
|
+
return {
|
|
50752
|
+
exported,
|
|
50753
|
+
visibility,
|
|
50754
|
+
exportedReason,
|
|
50755
|
+
apiSurfaceKind: exported ? "public" : "private"
|
|
50756
|
+
};
|
|
50757
|
+
}
|
|
50758
|
+
function addRegexDef(defs, source, name, kind, start, end, visibility, exported, exportedReason) {
|
|
50759
|
+
upsertAugmentedDef(defs, {
|
|
50760
|
+
name,
|
|
50761
|
+
kind,
|
|
50762
|
+
exported,
|
|
50763
|
+
visibilityInfo: symbolVisibilityInfo(visibility, exported, exportedReason),
|
|
50764
|
+
startLine: lineNumberAt(source, start),
|
|
50765
|
+
endLine: lineNumberAt(source, end)
|
|
50766
|
+
});
|
|
50767
|
+
}
|
|
50768
|
+
function findMatchingBrace(source, openIndex) {
|
|
50769
|
+
if (source[openIndex] !== "{")
|
|
50770
|
+
return null;
|
|
50771
|
+
let depth = 0;
|
|
50772
|
+
for (let i = openIndex;i < source.length; i++) {
|
|
50773
|
+
const ch = source[i];
|
|
50774
|
+
if (ch === "{")
|
|
50775
|
+
depth++;
|
|
50776
|
+
else if (ch === "}") {
|
|
50777
|
+
depth--;
|
|
50778
|
+
if (depth === 0)
|
|
50779
|
+
return i;
|
|
50780
|
+
}
|
|
50781
|
+
}
|
|
50782
|
+
return null;
|
|
50783
|
+
}
|
|
50784
|
+
function lineNumberAt(text, index) {
|
|
50785
|
+
let line = 1;
|
|
50786
|
+
for (let i = 0;i < index && i < text.length; i++) {
|
|
50787
|
+
if (text[i] === `
|
|
50788
|
+
`)
|
|
50789
|
+
line++;
|
|
50790
|
+
}
|
|
50791
|
+
return line;
|
|
50792
|
+
}
|
|
50793
|
+
function advanceLineOffset(source, offset, lineLength) {
|
|
50794
|
+
const after = offset + lineLength;
|
|
50795
|
+
if (source[after] === "\r" && source[after + 1] === `
|
|
50796
|
+
`)
|
|
50797
|
+
return after + 2;
|
|
50798
|
+
if (source[after] === `
|
|
50799
|
+
` || source[after] === "\r")
|
|
50800
|
+
return after + 1;
|
|
50801
|
+
return after;
|
|
50802
|
+
}
|
|
50803
|
+
function declarationEnd(source, start) {
|
|
50804
|
+
const open2 = source.indexOf("{", start);
|
|
50805
|
+
const semi = source.indexOf(";", start);
|
|
50806
|
+
if (open2 !== -1 && (semi === -1 || open2 < semi)) {
|
|
50807
|
+
return findMatchingBrace(source, open2) ?? open2;
|
|
50808
|
+
}
|
|
50809
|
+
return semi === -1 ? start : semi;
|
|
50810
|
+
}
|
|
50811
|
+
var dartTypeRe = /\b(extension\s+type|class|mixin|enum|extension|typedef)\s+(?!on\b)([A-Za-z_][A-Za-z0-9_]*)/g;
|
|
50812
|
+
function maskCommentsForAugment(source) {
|
|
50813
|
+
let out = "";
|
|
50814
|
+
let inBlock = false;
|
|
50815
|
+
let quote = null;
|
|
50816
|
+
for (let i = 0;i < source.length; i++) {
|
|
50817
|
+
const ch = source[i];
|
|
50818
|
+
const two = source.substring(i, i + 2);
|
|
50819
|
+
if (quote !== null) {
|
|
50820
|
+
if (ch === "\\") {
|
|
50821
|
+
out += " ";
|
|
50822
|
+
i++;
|
|
50823
|
+
continue;
|
|
50824
|
+
}
|
|
50825
|
+
if (ch === quote) {
|
|
50826
|
+
quote = null;
|
|
50827
|
+
out += ch;
|
|
50828
|
+
} else {
|
|
50829
|
+
out += ch === `
|
|
50830
|
+
` ? `
|
|
50831
|
+
` : " ";
|
|
50832
|
+
}
|
|
50833
|
+
continue;
|
|
50834
|
+
}
|
|
50835
|
+
if (!inBlock && two === "/*") {
|
|
50836
|
+
inBlock = true;
|
|
50837
|
+
out += " ";
|
|
50838
|
+
i++;
|
|
50839
|
+
continue;
|
|
50840
|
+
}
|
|
50841
|
+
if (inBlock) {
|
|
50842
|
+
if (two === "*/") {
|
|
50843
|
+
inBlock = false;
|
|
50844
|
+
out += " ";
|
|
50845
|
+
i++;
|
|
50846
|
+
} else {
|
|
50847
|
+
out += source[i] === `
|
|
50848
|
+
` ? `
|
|
50849
|
+
` : " ";
|
|
50850
|
+
}
|
|
50851
|
+
continue;
|
|
50852
|
+
}
|
|
50853
|
+
if (two === "//" || source[i] === "#") {
|
|
50854
|
+
out += two === "//" ? " " : " ";
|
|
50855
|
+
if (two === "//")
|
|
50856
|
+
i++;
|
|
50857
|
+
while (i + 1 < source.length && source[i + 1] !== `
|
|
50858
|
+
`) {
|
|
50859
|
+
out += " ";
|
|
50860
|
+
i++;
|
|
50861
|
+
}
|
|
50862
|
+
continue;
|
|
50863
|
+
}
|
|
50864
|
+
if (ch === '"' || ch === "'") {
|
|
50865
|
+
if (source[i + 1] === ch && source[i + 2] === ch) {
|
|
50866
|
+
out += ch + ch + ch;
|
|
50867
|
+
i += 2;
|
|
50868
|
+
while (i + 1 < source.length) {
|
|
50869
|
+
if (source[i + 1] === ch && source[i + 2] === ch && source[i + 3] === ch) {
|
|
50870
|
+
out += ch + ch + ch;
|
|
50871
|
+
i += 3;
|
|
50872
|
+
break;
|
|
50873
|
+
}
|
|
50874
|
+
out += source[i + 1] === `
|
|
50875
|
+
` ? `
|
|
50876
|
+
` : " ";
|
|
50877
|
+
i++;
|
|
50878
|
+
}
|
|
50879
|
+
continue;
|
|
50880
|
+
}
|
|
50881
|
+
quote = ch;
|
|
50882
|
+
out += ch;
|
|
50883
|
+
continue;
|
|
50884
|
+
}
|
|
50885
|
+
out += ch;
|
|
50886
|
+
}
|
|
50887
|
+
return out;
|
|
50888
|
+
}
|
|
50889
|
+
function augmentDartDefs(source, defs) {
|
|
50890
|
+
const masked = maskCommentsForAugment(source);
|
|
50891
|
+
dartTypeRe.lastIndex = 0;
|
|
50892
|
+
for (let m = dartTypeRe.exec(masked);m !== null; m = dartTypeRe.exec(masked)) {
|
|
50893
|
+
const exported = !m[2].startsWith("_");
|
|
50894
|
+
const kindWord = m[1].trim().split(/\s+/).pop() ?? m[1];
|
|
50895
|
+
addRegexDef(defs, source, m[2], kindWord === "enum" ? "enum" : kindWord === "class" ? "class" : "type", m.index, declarationEnd(masked, m.index), exported ? "public" : "private", exported, exported ? "naming_convention" : "unknown");
|
|
50896
|
+
}
|
|
50897
|
+
}
|
|
50898
|
+
var rubyMethodDefNameRe = /^def\s+(?:(self)\.)?([A-Za-z_][A-Za-z0-9_?!]*)/;
|
|
50899
|
+
var rubyTargetedVisibilityRe = /^(private|protected)\s+((?::[A-Za-z_][A-Za-z0-9_?!]*\s*,\s*)*:[A-Za-z_][A-Za-z0-9_?!]*)$/;
|
|
50900
|
+
var rubyEndWordRe = /\bend\b/g;
|
|
50901
|
+
var rubyHeredocOpenRe = /(?:^|[=(,[]\s*|(?:puts|print|raise|return|p)\s+)<<[~-]?['"]?([A-Za-z_][A-Za-z0-9_]*)['"]?/;
|
|
50902
|
+
function augmentRubyDefs(source, defs) {
|
|
50903
|
+
const lines = source.split(/\r?\n/);
|
|
50904
|
+
const state = {
|
|
50905
|
+
visibility: "public",
|
|
50906
|
+
stack: [],
|
|
50907
|
+
endLevel: 0,
|
|
50908
|
+
heredocId: null
|
|
50909
|
+
};
|
|
50910
|
+
let offset = 0;
|
|
50911
|
+
for (const line of lines) {
|
|
50912
|
+
const trimmed = line.trim();
|
|
50913
|
+
if (state.heredocId !== null) {
|
|
50914
|
+
if (trimmed === state.heredocId)
|
|
50915
|
+
state.heredocId = null;
|
|
50916
|
+
} else {
|
|
50917
|
+
const open2 = trimmed.match(rubyHeredocOpenRe);
|
|
50918
|
+
if (open2)
|
|
50919
|
+
state.heredocId = open2[1];
|
|
50920
|
+
augmentRubyLine(trimmed, line, offset, source, defs, state);
|
|
50921
|
+
}
|
|
50922
|
+
offset = advanceLineOffset(source, offset, line.length);
|
|
50923
|
+
}
|
|
50924
|
+
}
|
|
50925
|
+
function augmentRubyLine(trimmed, line, offset, source, defs, state) {
|
|
50926
|
+
if (trimmed === "private" || trimmed === "protected") {
|
|
50927
|
+
state.visibility = trimmed;
|
|
50928
|
+
}
|
|
50929
|
+
const targeted = trimmed.match(rubyTargetedVisibilityRe);
|
|
50930
|
+
if (targeted) {
|
|
50931
|
+
const visibility = targeted[1];
|
|
50932
|
+
for (const name of targeted[2].split(",").map((part) => part.trim())) {
|
|
50933
|
+
const sym = name.replace(/^:/, "");
|
|
50934
|
+
for (let i = defs.length - 1;i >= 0; i--) {
|
|
50935
|
+
const d = defs[i];
|
|
50936
|
+
if (d.name === sym && d.startLine <= lineNumberAt(source, offset)) {
|
|
50937
|
+
d.exported = false;
|
|
50938
|
+
d.visibilityInfo = symbolVisibilityInfo(visibility, false, "unknown");
|
|
50939
|
+
break;
|
|
50940
|
+
}
|
|
50941
|
+
}
|
|
50942
|
+
}
|
|
50943
|
+
}
|
|
50944
|
+
const moduleMatch = trimmed.match(/^module\s+([A-Z][A-Za-z0-9_:]*)/);
|
|
50945
|
+
const classMatch = trimmed.match(/^class\s+([A-Z][A-Za-z0-9_:]*)/);
|
|
50946
|
+
if (moduleMatch || classMatch) {
|
|
50947
|
+
state.stack.push({
|
|
50948
|
+
visibility: state.visibility,
|
|
50949
|
+
atEndLevel: state.endLevel
|
|
50950
|
+
});
|
|
50951
|
+
state.visibility = "public";
|
|
50952
|
+
state.endLevel++;
|
|
50953
|
+
const name = (moduleMatch ?? classMatch)[1];
|
|
50954
|
+
addRegexDef(defs, source, name, moduleMatch ? "type" : "class", offset + line.indexOf((moduleMatch ?? classMatch)[0]), offset + line.length, "public", true, "module_public");
|
|
50955
|
+
}
|
|
50956
|
+
const constMatch = trimmed.match(/^([A-Z][A-Za-z0-9_]*)\s*=/);
|
|
50957
|
+
if (constMatch) {
|
|
50958
|
+
addRegexDef(defs, source, constMatch[1], "const", offset + line.indexOf(constMatch[1]), offset + line.length, "public", true, "module_public");
|
|
50959
|
+
}
|
|
50960
|
+
const methodMatch = trimmed.match(rubyMethodDefNameRe);
|
|
50961
|
+
if (methodMatch) {
|
|
50962
|
+
state.endLevel++;
|
|
50963
|
+
const isSingleton = Boolean(methodMatch[1]);
|
|
50964
|
+
const shortName = methodMatch[2];
|
|
50965
|
+
const name = isSingleton ? `self.${shortName}` : shortName;
|
|
50966
|
+
const visibility = isSingleton ? "public" : state.visibility;
|
|
50967
|
+
const exported = visibility !== "private" && !shortName.startsWith("_");
|
|
50968
|
+
addRegexDef(defs, source, name, "method", offset + line.indexOf("def"), offset + line.length, visibility, exported, exported ? "module_public" : "unknown");
|
|
50969
|
+
}
|
|
50970
|
+
rubyEndWordRe.lastIndex = 0;
|
|
50971
|
+
const ends = trimmed.match(rubyEndWordRe)?.length ?? 0;
|
|
50972
|
+
if (ends > 0) {
|
|
50973
|
+
state.endLevel -= ends;
|
|
50974
|
+
while (state.stack.length > 0 && state.endLevel <= state.stack[state.stack.length - 1].atEndLevel) {
|
|
50975
|
+
state.visibility = state.stack.pop().visibility;
|
|
50976
|
+
}
|
|
50977
|
+
}
|
|
50978
|
+
}
|
|
50979
|
+
var phpNamespaceRe = /\bnamespace\s+([^;{]+)\s*[;{]/g;
|
|
50980
|
+
var phpTypeRe = /\b(trait|class|interface|enum)\s+([A-Za-z_][A-Za-z0-9_]*)/g;
|
|
50981
|
+
var phpFunctionRe = /\b(?:(public|protected|private|static|final|abstract)\s+){0,6}function\s+([A-Za-z_][A-Za-z0-9_]*)\s*\(/g;
|
|
50982
|
+
function augmentPhpDefs(source, defs) {
|
|
50983
|
+
const masked = maskCommentsForAugment(source);
|
|
50984
|
+
phpNamespaceRe.lastIndex = 0;
|
|
50985
|
+
for (let m = phpNamespaceRe.exec(masked);m !== null; m = phpNamespaceRe.exec(masked)) {
|
|
50986
|
+
addRegexDef(defs, source, m[1].trim(), "type", m.index, m.index + m[0].length, "public", true, "namespace_public");
|
|
50987
|
+
}
|
|
50988
|
+
const typeRanges = [];
|
|
50989
|
+
phpTypeRe.lastIndex = 0;
|
|
50990
|
+
for (let m = phpTypeRe.exec(masked);m !== null; m = phpTypeRe.exec(masked)) {
|
|
50991
|
+
const bodyStart = masked.indexOf("{", m.index);
|
|
50992
|
+
const bodyEnd = bodyStart === -1 ? null : findMatchingBrace(masked, bodyStart);
|
|
50993
|
+
if (bodyStart !== -1 && bodyEnd !== null) {
|
|
50994
|
+
typeRanges.push({ start: bodyStart, end: bodyEnd });
|
|
50995
|
+
}
|
|
50996
|
+
addRegexDef(defs, source, m[2], m[1] === "class" ? "class" : m[1] === "enum" ? "enum" : "interface", m.index, declarationEnd(masked, m.index), "public", true, "module_public");
|
|
50997
|
+
}
|
|
50998
|
+
phpFunctionRe.lastIndex = 0;
|
|
50999
|
+
for (let m = phpFunctionRe.exec(masked);m !== null; m = phpFunctionRe.exec(masked)) {
|
|
51000
|
+
const modifiers = m[0].slice(0, m[0].indexOf("function"));
|
|
51001
|
+
const visibility = modifiers.match(/\b(public|protected|private)\b/)?.[1] ?? "public";
|
|
51002
|
+
const exported = visibility !== "private" && !m[2].startsWith("_");
|
|
51003
|
+
const effectiveVisibility = m[2].startsWith("_") ? "private" : visibility;
|
|
51004
|
+
const kind = typeRanges.some((range) => m.index >= range.start && m.index <= range.end) ? "method" : "function";
|
|
51005
|
+
addRegexDef(defs, source, m[2], kind, m.index, declarationEnd(masked, m.index), effectiveVisibility, exported, exported ? "module_public" : "unknown");
|
|
51006
|
+
}
|
|
51007
|
+
}
|
|
51008
|
+
function fallbackImportsForSource(grammarId, source) {
|
|
51009
|
+
const entries = [];
|
|
51010
|
+
if (grammarId !== "dart" && grammarId !== "ruby" && grammarId !== "php") {
|
|
51011
|
+
return entries;
|
|
51012
|
+
}
|
|
51013
|
+
const masked = maskCommentsForAugment(source);
|
|
51014
|
+
const lines = source.split(/\r?\n/);
|
|
51015
|
+
const maskedLines = masked.split(/\r?\n/);
|
|
51016
|
+
let offset = 0;
|
|
51017
|
+
let heredocId = null;
|
|
51018
|
+
let braceDepth = 0;
|
|
51019
|
+
let pending = null;
|
|
51020
|
+
const flushPending = (endLine) => {
|
|
51021
|
+
if (!pending)
|
|
51022
|
+
return;
|
|
51023
|
+
let parsed = null;
|
|
51024
|
+
if (grammarId === "dart")
|
|
51025
|
+
parsed = parseDartImport(pending.text);
|
|
51026
|
+
else if (grammarId === "php")
|
|
51027
|
+
parsed = parsePhpUse(pending.text);
|
|
51028
|
+
for (const entry of parsed ? Array.isArray(parsed) ? parsed : [parsed] : []) {
|
|
51029
|
+
entries.push({
|
|
51030
|
+
index: pending.startOffset,
|
|
51031
|
+
entry: { ...entry, startLine: pending.startLine, endLine }
|
|
51032
|
+
});
|
|
51033
|
+
}
|
|
51034
|
+
pending = null;
|
|
51035
|
+
};
|
|
51036
|
+
for (let li = 0;li < lines.length; li++) {
|
|
51037
|
+
const line = lines[li];
|
|
51038
|
+
const trimmed = line.trim();
|
|
51039
|
+
const maskedTrimmed = maskedLines[li]?.trim() ?? "";
|
|
51040
|
+
const startLine = lineNumberAt(source, offset);
|
|
51041
|
+
if (grammarId === "ruby") {
|
|
51042
|
+
if (heredocId !== null) {
|
|
51043
|
+
if (maskedTrimmed === heredocId)
|
|
51044
|
+
heredocId = null;
|
|
51045
|
+
} else {
|
|
51046
|
+
const open2 = maskedTrimmed.match(rubyHeredocOpenRe);
|
|
51047
|
+
if (open2)
|
|
51048
|
+
heredocId = open2[1];
|
|
51049
|
+
else {
|
|
51050
|
+
const parsed = parseRubyRequire(trimmed);
|
|
51051
|
+
if (parsed) {
|
|
51052
|
+
entries.push({
|
|
51053
|
+
index: offset,
|
|
51054
|
+
entry: { ...parsed, startLine, endLine: startLine }
|
|
51055
|
+
});
|
|
51056
|
+
}
|
|
51057
|
+
}
|
|
51058
|
+
}
|
|
51059
|
+
offset = advanceLineOffset(source, offset, line.length);
|
|
51060
|
+
continue;
|
|
51061
|
+
}
|
|
51062
|
+
if (grammarId === "php") {
|
|
51063
|
+
for (const ch of maskedLines[li] ?? "") {
|
|
51064
|
+
if (ch === "{")
|
|
51065
|
+
braceDepth++;
|
|
51066
|
+
else if (ch === "}")
|
|
51067
|
+
braceDepth = Math.max(0, braceDepth - 1);
|
|
51068
|
+
}
|
|
51069
|
+
}
|
|
51070
|
+
if (pending) {
|
|
51071
|
+
pending.text += ` ${trimmed}`;
|
|
51072
|
+
pending.lines++;
|
|
51073
|
+
if (trimmed.includes(";") || pending.lines > 10) {
|
|
51074
|
+
flushPending(startLine);
|
|
51075
|
+
} else if (trimmed === "") {
|
|
51076
|
+
pending = null;
|
|
51077
|
+
}
|
|
51078
|
+
offset = advanceLineOffset(source, offset, line.length);
|
|
51079
|
+
continue;
|
|
51080
|
+
}
|
|
51081
|
+
const startsStatement = grammarId === "dart" ? /^(import|export)\s/.test(maskedTrimmed) : /^use\s/.test(maskedTrimmed);
|
|
51082
|
+
const inClassBody = grammarId === "php" && braceDepth > 0;
|
|
51083
|
+
if (startsStatement && !inClassBody) {
|
|
51084
|
+
if (trimmed.includes(";")) {
|
|
51085
|
+
let parsed = null;
|
|
51086
|
+
if (grammarId === "dart")
|
|
51087
|
+
parsed = parseDartImport(trimmed);
|
|
51088
|
+
else if (grammarId === "php")
|
|
51089
|
+
parsed = parsePhpUse(trimmed);
|
|
51090
|
+
for (const entry of parsed ? Array.isArray(parsed) ? parsed : [parsed] : []) {
|
|
51091
|
+
entries.push({
|
|
51092
|
+
index: offset,
|
|
51093
|
+
entry: { ...entry, startLine, endLine: startLine }
|
|
51094
|
+
});
|
|
51095
|
+
}
|
|
51096
|
+
} else {
|
|
51097
|
+
pending = { startOffset: offset, startLine, text: trimmed, lines: 1 };
|
|
51098
|
+
}
|
|
51099
|
+
}
|
|
51100
|
+
offset = advanceLineOffset(source, offset, line.length);
|
|
51101
|
+
}
|
|
51102
|
+
flushPending(lineNumberAt(source, offset));
|
|
51103
|
+
return entries;
|
|
50494
51104
|
}
|
|
50495
51105
|
function safeMatches(lang, pattern, root) {
|
|
50496
51106
|
if (!_QueryCtor)
|
|
@@ -50944,28 +51554,52 @@ function parseSwiftImport(text) {
|
|
|
50944
51554
|
}
|
|
50945
51555
|
function parseDartImport(text) {
|
|
50946
51556
|
const t = text.trim();
|
|
50947
|
-
const
|
|
50948
|
-
if (
|
|
51557
|
+
const exportMatch = t.match(/^export\s+['"]([^'"]+)['"](?:\s+show\s+([^;]+))?/);
|
|
51558
|
+
if (exportMatch) {
|
|
51559
|
+
const shown = exportMatch[2]?.split(",").map((part) => part.trim()).filter(Boolean);
|
|
51560
|
+
const bindings = shown && shown.length > 0 ? shown.map((name) => ({ imported: name, local: name })) : [{ imported: "*", local: "*" }];
|
|
50949
51561
|
return {
|
|
50950
|
-
specifier:
|
|
50951
|
-
importType: "named",
|
|
50952
|
-
bindings
|
|
51562
|
+
specifier: exportMatch[1],
|
|
51563
|
+
importType: shown && shown.length > 0 ? "named" : "namespace",
|
|
51564
|
+
bindings,
|
|
51565
|
+
reExport: true,
|
|
51566
|
+
exportedBindings: bindings.map((binding) => ({
|
|
51567
|
+
imported: binding.imported,
|
|
51568
|
+
exported: binding.local
|
|
51569
|
+
}))
|
|
50953
51570
|
};
|
|
50954
51571
|
}
|
|
50955
|
-
const
|
|
50956
|
-
if (
|
|
50957
|
-
|
|
51572
|
+
const importMatch = t.match(/^import\s+['"]([^'"]+)['"]([^;]*)/);
|
|
51573
|
+
if (importMatch) {
|
|
51574
|
+
const clause = importMatch[2];
|
|
51575
|
+
const alias = clause?.match(/\bas\s+\w+/);
|
|
51576
|
+
const shown = clause?.match(/\bshow\s+([^;]+)/)?.[1].split(",").map((part) => part.trim()).filter(Boolean);
|
|
51577
|
+
const primary = {
|
|
51578
|
+
specifier: importMatch[1],
|
|
51579
|
+
importType: !alias && shown && shown.length > 0 ? "named" : "namespace",
|
|
51580
|
+
bindings: !alias && shown && shown.length > 0 ? shown.map((name) => ({ imported: name, local: name })) : []
|
|
51581
|
+
};
|
|
51582
|
+
const conditional = clause?.match(/\bif\s*\([^)]*\)\s*['"]([^'"]+)['"]/);
|
|
51583
|
+
if (conditional) {
|
|
51584
|
+
return [
|
|
51585
|
+
primary,
|
|
51586
|
+
{ specifier: conditional[1], importType: "namespace", bindings: [] }
|
|
51587
|
+
];
|
|
51588
|
+
}
|
|
51589
|
+
return primary;
|
|
50958
51590
|
}
|
|
50959
51591
|
return null;
|
|
50960
51592
|
}
|
|
50961
51593
|
function parseRubyRequire(text) {
|
|
50962
51594
|
const t = text.trim();
|
|
51595
|
+
const isRequireRelative = /^require_relative\b/.test(t);
|
|
50963
51596
|
const stripped = t.replace(/^(?:require(?:_relative)?)\s+['"]?/, "").replace(/['"]$/, "");
|
|
50964
51597
|
if (!stripped || stripped === t)
|
|
50965
51598
|
return null;
|
|
50966
|
-
const
|
|
51599
|
+
const specifier = isRequireRelative && !stripped.startsWith(".") ? `./${stripped}` : stripped;
|
|
51600
|
+
const isRelative = specifier.startsWith("./") || specifier.startsWith("../");
|
|
50967
51601
|
return {
|
|
50968
|
-
specifier
|
|
51602
|
+
specifier,
|
|
50969
51603
|
importType: isRelative ? "default" : "namespace",
|
|
50970
51604
|
bindings: []
|
|
50971
51605
|
};
|
|
@@ -50977,7 +51611,7 @@ function parsePhpUse(text) {
|
|
|
50977
51611
|
return {
|
|
50978
51612
|
specifier: m[1],
|
|
50979
51613
|
importType: "named",
|
|
50980
|
-
bindings: [{ imported: m[1], local: m[2] }]
|
|
51614
|
+
bindings: [{ imported: m[1].split("\\").pop() ?? m[1], local: m[2] }]
|
|
50981
51615
|
};
|
|
50982
51616
|
}
|
|
50983
51617
|
const simple = t.match(/^use\s+(?:(?:function|const)\s+)?([^;\s]+)\s*;?\s*$/i);
|
|
@@ -51053,7 +51687,10 @@ var IMPORT_ANCESTOR_TYPES = new Set([
|
|
|
51053
51687
|
"use_declaration",
|
|
51054
51688
|
"using_directive",
|
|
51055
51689
|
"namespace_use_declaration",
|
|
51056
|
-
"
|
|
51690
|
+
"namespace_use_clause",
|
|
51691
|
+
"library_import",
|
|
51692
|
+
"library_export",
|
|
51693
|
+
"export_directive"
|
|
51057
51694
|
]);
|
|
51058
51695
|
function isInsideImportStatement(node) {
|
|
51059
51696
|
return hasAncestorOfType(node, IMPORT_ANCESTOR_TYPES);
|
|
@@ -51100,7 +51737,13 @@ var SYMBOL_EXTENSIONS = new Set([
|
|
|
51100
51737
|
".py",
|
|
51101
51738
|
".pyw",
|
|
51102
51739
|
".rs",
|
|
51103
|
-
".go"
|
|
51740
|
+
".go",
|
|
51741
|
+
".dart",
|
|
51742
|
+
".rb",
|
|
51743
|
+
".rake",
|
|
51744
|
+
".gemspec",
|
|
51745
|
+
".php",
|
|
51746
|
+
".phtml"
|
|
51104
51747
|
]);
|
|
51105
51748
|
var SKIP_DIRECTORIES = new Set([
|
|
51106
51749
|
"node_modules",
|
|
@@ -51527,6 +52170,346 @@ function extractGoSymbols(filePath, cwd) {
|
|
|
51527
52170
|
return a.name.localeCompare(b.name);
|
|
51528
52171
|
});
|
|
51529
52172
|
}
|
|
52173
|
+
var memoSource = null;
|
|
52174
|
+
var memoStarts = [0];
|
|
52175
|
+
function lineStartsOf(content) {
|
|
52176
|
+
if (memoSource !== content) {
|
|
52177
|
+
const starts = [0];
|
|
52178
|
+
for (let i = 0;i < content.length; i++) {
|
|
52179
|
+
if (content[i] === `
|
|
52180
|
+
`)
|
|
52181
|
+
starts.push(i + 1);
|
|
52182
|
+
}
|
|
52183
|
+
memoSource = content;
|
|
52184
|
+
memoStarts = starts;
|
|
52185
|
+
}
|
|
52186
|
+
return memoStarts;
|
|
52187
|
+
}
|
|
52188
|
+
function lineNumberAt2(content, index) {
|
|
52189
|
+
const starts = lineStartsOf(content);
|
|
52190
|
+
let lo = 0;
|
|
52191
|
+
let hi = starts.length - 1;
|
|
52192
|
+
while (lo < hi) {
|
|
52193
|
+
const mid = lo + hi + 1 >> 1;
|
|
52194
|
+
if (starts[mid] <= index)
|
|
52195
|
+
lo = mid;
|
|
52196
|
+
else
|
|
52197
|
+
hi = mid - 1;
|
|
52198
|
+
}
|
|
52199
|
+
return lo + 1;
|
|
52200
|
+
}
|
|
52201
|
+
function advanceLineOffset2(source, offset, lineLength) {
|
|
52202
|
+
const after = offset + lineLength;
|
|
52203
|
+
if (source[after] === "\r" && source[after + 1] === `
|
|
52204
|
+
`)
|
|
52205
|
+
return after + 2;
|
|
52206
|
+
if (source[after] === `
|
|
52207
|
+
` || source[after] === "\r")
|
|
52208
|
+
return after + 1;
|
|
52209
|
+
return after;
|
|
52210
|
+
}
|
|
52211
|
+
function lineTextAt(content, index) {
|
|
52212
|
+
const lineStart = content.lastIndexOf(`
|
|
52213
|
+
`, Math.max(0, index - 1)) + 1;
|
|
52214
|
+
const lineEnd = content.indexOf(`
|
|
52215
|
+
`, lineStart);
|
|
52216
|
+
return content.substring(lineStart, lineEnd === -1 ? content.length : lineEnd).trim().substring(0, 120);
|
|
52217
|
+
}
|
|
52218
|
+
function findMatchingBrace2(content, openIndex) {
|
|
52219
|
+
if (content[openIndex] !== "{")
|
|
52220
|
+
return null;
|
|
52221
|
+
let depth = 0;
|
|
52222
|
+
for (let i = openIndex;i < content.length; i++) {
|
|
52223
|
+
const ch = content[i];
|
|
52224
|
+
if (ch === "{")
|
|
52225
|
+
depth++;
|
|
52226
|
+
else if (ch === "}") {
|
|
52227
|
+
depth--;
|
|
52228
|
+
if (depth === 0)
|
|
52229
|
+
return i;
|
|
52230
|
+
}
|
|
52231
|
+
}
|
|
52232
|
+
return null;
|
|
52233
|
+
}
|
|
52234
|
+
function stripLineCommentsForScan(content) {
|
|
52235
|
+
let out = "";
|
|
52236
|
+
let inBlock = false;
|
|
52237
|
+
let quote = null;
|
|
52238
|
+
for (let i = 0;i < content.length; i++) {
|
|
52239
|
+
const ch = content[i];
|
|
52240
|
+
const two = content.substring(i, i + 2);
|
|
52241
|
+
if (quote !== null) {
|
|
52242
|
+
if (ch === "\\") {
|
|
52243
|
+
out += " ";
|
|
52244
|
+
i++;
|
|
52245
|
+
continue;
|
|
52246
|
+
}
|
|
52247
|
+
if (ch === quote) {
|
|
52248
|
+
quote = null;
|
|
52249
|
+
out += ch;
|
|
52250
|
+
} else {
|
|
52251
|
+
out += ch === `
|
|
52252
|
+
` ? `
|
|
52253
|
+
` : " ";
|
|
52254
|
+
}
|
|
52255
|
+
continue;
|
|
52256
|
+
}
|
|
52257
|
+
if (!inBlock && two === "/*") {
|
|
52258
|
+
inBlock = true;
|
|
52259
|
+
out += " ";
|
|
52260
|
+
i++;
|
|
52261
|
+
continue;
|
|
52262
|
+
}
|
|
52263
|
+
if (inBlock) {
|
|
52264
|
+
if (two === "*/") {
|
|
52265
|
+
inBlock = false;
|
|
52266
|
+
out += " ";
|
|
52267
|
+
i++;
|
|
52268
|
+
} else {
|
|
52269
|
+
out += ch === `
|
|
52270
|
+
` ? `
|
|
52271
|
+
` : " ";
|
|
52272
|
+
}
|
|
52273
|
+
continue;
|
|
52274
|
+
}
|
|
52275
|
+
if (two === "//" || ch === "#") {
|
|
52276
|
+
out += two === "//" ? " " : " ";
|
|
52277
|
+
if (two === "//")
|
|
52278
|
+
i++;
|
|
52279
|
+
while (i + 1 < content.length && content[i + 1] !== `
|
|
52280
|
+
`) {
|
|
52281
|
+
out += " ";
|
|
52282
|
+
i++;
|
|
52283
|
+
}
|
|
52284
|
+
continue;
|
|
52285
|
+
}
|
|
52286
|
+
if (ch === '"' || ch === "'") {
|
|
52287
|
+
if (ch === content[i + 1] && ch === content[i + 2]) {
|
|
52288
|
+
out += ch + ch + ch;
|
|
52289
|
+
i += 2;
|
|
52290
|
+
while (i + 1 < content.length) {
|
|
52291
|
+
if (content[i + 1] === ch && content[i + 2] === ch && content[i + 3] === ch) {
|
|
52292
|
+
out += ch + ch + ch;
|
|
52293
|
+
i += 3;
|
|
52294
|
+
break;
|
|
52295
|
+
}
|
|
52296
|
+
out += content[i + 1] === `
|
|
52297
|
+
` ? `
|
|
52298
|
+
` : " ";
|
|
52299
|
+
i++;
|
|
52300
|
+
}
|
|
52301
|
+
continue;
|
|
52302
|
+
}
|
|
52303
|
+
quote = ch;
|
|
52304
|
+
out += ch;
|
|
52305
|
+
continue;
|
|
52306
|
+
}
|
|
52307
|
+
out += ch;
|
|
52308
|
+
}
|
|
52309
|
+
return out;
|
|
52310
|
+
}
|
|
52311
|
+
function addUniqueSymbol(symbols, seen, candidate) {
|
|
52312
|
+
const key = `${candidate.name}:${candidate.kind}`;
|
|
52313
|
+
if (seen.has(key))
|
|
52314
|
+
return;
|
|
52315
|
+
seen.add(key);
|
|
52316
|
+
symbols.push(candidate);
|
|
52317
|
+
}
|
|
52318
|
+
function sortSymbols(symbols) {
|
|
52319
|
+
return symbols.sort((a, b) => {
|
|
52320
|
+
if (a.line !== b.line)
|
|
52321
|
+
return a.line - b.line;
|
|
52322
|
+
return a.name.localeCompare(b.name);
|
|
52323
|
+
});
|
|
52324
|
+
}
|
|
52325
|
+
function extractDartSymbols(filePath, cwd) {
|
|
52326
|
+
const raw = readValidatedSourceFile(filePath, cwd);
|
|
52327
|
+
if (raw === null)
|
|
52328
|
+
return [];
|
|
52329
|
+
const content = stripLineCommentsForScan(raw);
|
|
52330
|
+
const symbols = [];
|
|
52331
|
+
const seen = new Set;
|
|
52332
|
+
const typeBodies = [];
|
|
52333
|
+
for (const match of content.matchAll(/\b(extension\s+type|class|mixin|enum|extension|typedef)\s+(?!on\b)([A-Za-z_][A-Za-z0-9_]*)/g)) {
|
|
52334
|
+
const kindWord = match[1].trim().split(/\s+/).pop() ?? match[1];
|
|
52335
|
+
const kind = kindWord === "enum" ? "enum" : kindWord === "class" ? "class" : "type";
|
|
52336
|
+
const bodyStart = content.indexOf("{", match.index);
|
|
52337
|
+
const bodyEnd = bodyStart === -1 ? null : findMatchingBrace2(content, bodyStart);
|
|
52338
|
+
if (bodyStart !== -1 && bodyEnd !== null) {
|
|
52339
|
+
typeBodies.push({ start: bodyStart, end: bodyEnd, name: match[2] });
|
|
52340
|
+
}
|
|
52341
|
+
addUniqueSymbol(symbols, seen, {
|
|
52342
|
+
name: match[2],
|
|
52343
|
+
kind,
|
|
52344
|
+
exported: !match[2].startsWith("_"),
|
|
52345
|
+
signature: lineTextAt(raw, match.index),
|
|
52346
|
+
line: lineNumberAt2(raw, match.index)
|
|
52347
|
+
});
|
|
52348
|
+
}
|
|
52349
|
+
const dartFunctionRe = /\b(?:void|[A-Za-z_][A-Za-z0-9_<>,?]*)\s+([A-Za-z_][A-Za-z0-9_]*)\s*\(/g;
|
|
52350
|
+
const KEYWORD_NAME_SKIP = new Set([
|
|
52351
|
+
"if",
|
|
52352
|
+
"for",
|
|
52353
|
+
"while",
|
|
52354
|
+
"switch",
|
|
52355
|
+
"return",
|
|
52356
|
+
"else",
|
|
52357
|
+
"throw",
|
|
52358
|
+
"new",
|
|
52359
|
+
"await",
|
|
52360
|
+
"yield",
|
|
52361
|
+
"case",
|
|
52362
|
+
"catch",
|
|
52363
|
+
"Function"
|
|
52364
|
+
]);
|
|
52365
|
+
const KEYWORD_TYPE_SKIP = new Set([
|
|
52366
|
+
"return",
|
|
52367
|
+
"else",
|
|
52368
|
+
"throw",
|
|
52369
|
+
"new",
|
|
52370
|
+
"await",
|
|
52371
|
+
"yield",
|
|
52372
|
+
"case",
|
|
52373
|
+
"catch",
|
|
52374
|
+
"final",
|
|
52375
|
+
"const"
|
|
52376
|
+
]);
|
|
52377
|
+
for (const match of content.matchAll(dartFunctionRe)) {
|
|
52378
|
+
if (KEYWORD_NAME_SKIP.has(match[1]))
|
|
52379
|
+
continue;
|
|
52380
|
+
if (KEYWORD_TYPE_SKIP.has(match[0].split(/\s+/)[0]))
|
|
52381
|
+
continue;
|
|
52382
|
+
const enclosing = typeBodies.find((body) => match.index >= body.start && match.index <= body.end);
|
|
52383
|
+
addUniqueSymbol(symbols, seen, {
|
|
52384
|
+
name: enclosing ? `${enclosing.name}.${match[1]}` : match[1],
|
|
52385
|
+
kind: enclosing ? "method" : "function",
|
|
52386
|
+
exported: !match[1].startsWith("_"),
|
|
52387
|
+
signature: lineTextAt(raw, match.index),
|
|
52388
|
+
line: lineNumberAt2(raw, match.index)
|
|
52389
|
+
});
|
|
52390
|
+
}
|
|
52391
|
+
return sortSymbols(symbols);
|
|
52392
|
+
}
|
|
52393
|
+
function extractRubySymbols(filePath, cwd) {
|
|
52394
|
+
const raw = readValidatedSourceFile(filePath, cwd);
|
|
52395
|
+
if (raw === null)
|
|
52396
|
+
return [];
|
|
52397
|
+
const symbols = [];
|
|
52398
|
+
const seen = new Set;
|
|
52399
|
+
const byName = new Map;
|
|
52400
|
+
let offset = 0;
|
|
52401
|
+
let currentVisibility = "public";
|
|
52402
|
+
const visibilityStack = [];
|
|
52403
|
+
let endLevel = 0;
|
|
52404
|
+
let heredocId = null;
|
|
52405
|
+
for (const line of raw.split(/\r?\n/)) {
|
|
52406
|
+
const trimmed = line.trim();
|
|
52407
|
+
if (heredocId !== null) {
|
|
52408
|
+
if (trimmed === heredocId)
|
|
52409
|
+
heredocId = null;
|
|
52410
|
+
} else {
|
|
52411
|
+
const open2 = trimmed.match(/(?:^|[=(,[]\s*|(?:puts|print|raise|return|p)\s+)<<[~-]?['"]?([A-Za-z_][A-Za-z0-9_]*)['"]?/);
|
|
52412
|
+
if (open2)
|
|
52413
|
+
heredocId = open2[1];
|
|
52414
|
+
if (trimmed === "private" || trimmed === "protected") {
|
|
52415
|
+
currentVisibility = trimmed;
|
|
52416
|
+
}
|
|
52417
|
+
const targeted = trimmed.match(/^(private|protected)\s+((?::[A-Za-z_][A-Za-z0-9_?!]*\s*,\s*)*:[A-Za-z_][A-Za-z0-9_?!]*)$/);
|
|
52418
|
+
if (targeted) {
|
|
52419
|
+
for (const part of targeted[2].split(",")) {
|
|
52420
|
+
const sym = byName.get(part.trim().replace(/^:/, ""));
|
|
52421
|
+
if (sym) {
|
|
52422
|
+
sym.exported = false;
|
|
52423
|
+
}
|
|
52424
|
+
}
|
|
52425
|
+
}
|
|
52426
|
+
const moduleMatch = trimmed.match(/^module\s+([A-Z][A-Za-z0-9_:]*)/);
|
|
52427
|
+
const classMatch = trimmed.match(/^class\s+([A-Z][A-Za-z0-9_:]*)/);
|
|
52428
|
+
if (moduleMatch || classMatch) {
|
|
52429
|
+
visibilityStack.push({
|
|
52430
|
+
visibility: currentVisibility,
|
|
52431
|
+
atEndLevel: endLevel
|
|
52432
|
+
});
|
|
52433
|
+
currentVisibility = "public";
|
|
52434
|
+
endLevel++;
|
|
52435
|
+
}
|
|
52436
|
+
const constMatch = trimmed.match(/^([A-Z][A-Za-z0-9_]*)\s*=/);
|
|
52437
|
+
const methodMatch = trimmed.match(/^def\s+(?:(self)\.)?([A-Za-z_][A-Za-z0-9_?!]*)/);
|
|
52438
|
+
if (methodMatch)
|
|
52439
|
+
endLevel++;
|
|
52440
|
+
const lineIndex = offset + Math.max(0, line.indexOf(trimmed));
|
|
52441
|
+
if (moduleMatch || classMatch || constMatch || methodMatch) {
|
|
52442
|
+
const singleton = Boolean(methodMatch?.[1]);
|
|
52443
|
+
const shortName = methodMatch?.[2];
|
|
52444
|
+
const name = moduleMatch?.[1] ?? classMatch?.[1] ?? constMatch?.[1] ?? (singleton && shortName ? `self.${shortName}` : shortName);
|
|
52445
|
+
const visibility = singleton ? "public" : currentVisibility;
|
|
52446
|
+
const candidate = {
|
|
52447
|
+
name,
|
|
52448
|
+
kind: moduleMatch ? "type" : classMatch ? "class" : constMatch ? "const" : "method",
|
|
52449
|
+
exported: methodMatch ? visibility !== "private" && !(shortName ?? "").startsWith("_") : true,
|
|
52450
|
+
signature: trimmed.substring(0, 100),
|
|
52451
|
+
line: lineNumberAt2(raw, lineIndex)
|
|
52452
|
+
};
|
|
52453
|
+
addUniqueSymbol(symbols, seen, candidate);
|
|
52454
|
+
byName.set(name, candidate);
|
|
52455
|
+
}
|
|
52456
|
+
const ends = trimmed.match(/\bend\b/g)?.length ?? 0;
|
|
52457
|
+
if (ends > 0) {
|
|
52458
|
+
endLevel -= ends;
|
|
52459
|
+
while (visibilityStack.length > 0 && endLevel <= visibilityStack[visibilityStack.length - 1].atEndLevel) {
|
|
52460
|
+
currentVisibility = visibilityStack.pop().visibility;
|
|
52461
|
+
}
|
|
52462
|
+
}
|
|
52463
|
+
}
|
|
52464
|
+
offset = advanceLineOffset2(raw, offset, line.length);
|
|
52465
|
+
}
|
|
52466
|
+
return sortSymbols(symbols);
|
|
52467
|
+
}
|
|
52468
|
+
function extractPhpSymbols(filePath, cwd) {
|
|
52469
|
+
const raw = readValidatedSourceFile(filePath, cwd);
|
|
52470
|
+
if (raw === null)
|
|
52471
|
+
return [];
|
|
52472
|
+
const content = stripLineCommentsForScan(raw);
|
|
52473
|
+
const symbols = [];
|
|
52474
|
+
const seen = new Set;
|
|
52475
|
+
const typeRanges = [];
|
|
52476
|
+
for (const match of content.matchAll(/\bnamespace\s+([A-Za-z_\\][A-Za-z0-9_\\]*)\s*[;{]/g)) {
|
|
52477
|
+
addUniqueSymbol(symbols, seen, {
|
|
52478
|
+
name: match[1],
|
|
52479
|
+
kind: "type",
|
|
52480
|
+
exported: true,
|
|
52481
|
+
signature: lineTextAt(raw, match.index),
|
|
52482
|
+
line: lineNumberAt2(raw, match.index)
|
|
52483
|
+
});
|
|
52484
|
+
}
|
|
52485
|
+
for (const match of content.matchAll(/\b(?:final\s+|abstract\s+|readonly\s+)?(class|interface|trait|enum)\s+([A-Za-z_][A-Za-z0-9_]*)/g)) {
|
|
52486
|
+
const bodyStart = content.indexOf("{", match.index);
|
|
52487
|
+
const bodyEnd = bodyStart === -1 ? null : findMatchingBrace2(content, bodyStart);
|
|
52488
|
+
if (bodyStart !== -1 && bodyEnd !== null) {
|
|
52489
|
+
typeRanges.push({ start: bodyStart, end: bodyEnd });
|
|
52490
|
+
}
|
|
52491
|
+
addUniqueSymbol(symbols, seen, {
|
|
52492
|
+
name: match[2],
|
|
52493
|
+
kind: match[1] === "class" ? "class" : match[1] === "enum" ? "enum" : "interface",
|
|
52494
|
+
exported: !match[2].startsWith("_"),
|
|
52495
|
+
signature: lineTextAt(raw, match.index),
|
|
52496
|
+
line: lineNumberAt2(raw, match.index)
|
|
52497
|
+
});
|
|
52498
|
+
}
|
|
52499
|
+
for (const match of content.matchAll(/\b(?:(public|protected|private|static|final|abstract)\s+){0,6}function\s+([A-Za-z_][A-Za-z0-9_]*)\s*\(/g)) {
|
|
52500
|
+
const insideType = typeRanges.some((range) => match.index >= range.start && match.index <= range.end);
|
|
52501
|
+
const modifiers = match[0].slice(0, match[0].indexOf("function"));
|
|
52502
|
+
const visibility = modifiers.match(/\b(public|protected|private)\b/)?.[1];
|
|
52503
|
+
addUniqueSymbol(symbols, seen, {
|
|
52504
|
+
name: match[2],
|
|
52505
|
+
kind: insideType ? "method" : "function",
|
|
52506
|
+
exported: visibility !== "private" && !match[2].startsWith("_"),
|
|
52507
|
+
signature: lineTextAt(raw, match.index),
|
|
52508
|
+
line: lineNumberAt2(raw, match.index)
|
|
52509
|
+
});
|
|
52510
|
+
}
|
|
52511
|
+
return sortSymbols(symbols);
|
|
52512
|
+
}
|
|
51530
52513
|
function findSourceFiles(cwd, maxFiles) {
|
|
51531
52514
|
const files = [];
|
|
51532
52515
|
walkDir(cwd, cwd, files, maxFiles);
|
|
@@ -51590,6 +52573,18 @@ function searchWorkspaceSymbols(cwd, name, exportedOnly = true) {
|
|
|
51590
52573
|
case ".go":
|
|
51591
52574
|
syms = extractGoSymbols(relFile, cwd);
|
|
51592
52575
|
break;
|
|
52576
|
+
case ".dart":
|
|
52577
|
+
syms = _internals65.extractDartSymbols(relFile, cwd);
|
|
52578
|
+
break;
|
|
52579
|
+
case ".rb":
|
|
52580
|
+
case ".rake":
|
|
52581
|
+
case ".gemspec":
|
|
52582
|
+
syms = _internals65.extractRubySymbols(relFile, cwd);
|
|
52583
|
+
break;
|
|
52584
|
+
case ".php":
|
|
52585
|
+
case ".phtml":
|
|
52586
|
+
syms = _internals65.extractPhpSymbols(relFile, cwd);
|
|
52587
|
+
break;
|
|
51593
52588
|
default:
|
|
51594
52589
|
continue;
|
|
51595
52590
|
}
|
|
@@ -51628,7 +52623,7 @@ function searchWorkspaceSymbols(cwd, name, exportedOnly = true) {
|
|
|
51628
52623
|
};
|
|
51629
52624
|
}
|
|
51630
52625
|
var symbols = createSwarmTool({
|
|
51631
|
-
description: "Extract all exported symbols from a source file: functions with signatures, " + "classes with public members, interfaces, types, enums, constants. " + "Supports TypeScript/JavaScript, Python, Rust, and
|
|
52626
|
+
description: "Extract all exported symbols from a source file: functions with signatures, " + "classes with public members, interfaces, types, enums, constants. " + "Supports TypeScript/JavaScript, Python, Rust, Go, Dart, Ruby, and PHP. " + "Use for architect planning, designer scaffolding, and understanding module " + "public API surface.",
|
|
51632
52627
|
args: {
|
|
51633
52628
|
file: exports_external.string().optional().describe('File path to extract symbols from (e.g., "src/auth/login.ts"). Required when not using workspace mode.'),
|
|
51634
52629
|
exported_only: exports_external.boolean().default(true).describe("If true, only return exported/public symbols. If false, include all top-level symbols."),
|
|
@@ -51712,10 +52707,22 @@ var symbols = createSwarmTool({
|
|
|
51712
52707
|
case ".go":
|
|
51713
52708
|
syms = extractGoSymbols(file, cwd);
|
|
51714
52709
|
break;
|
|
52710
|
+
case ".dart":
|
|
52711
|
+
syms = _internals65.extractDartSymbols(file, cwd);
|
|
52712
|
+
break;
|
|
52713
|
+
case ".rb":
|
|
52714
|
+
case ".rake":
|
|
52715
|
+
case ".gemspec":
|
|
52716
|
+
syms = _internals65.extractRubySymbols(file, cwd);
|
|
52717
|
+
break;
|
|
52718
|
+
case ".php":
|
|
52719
|
+
case ".phtml":
|
|
52720
|
+
syms = _internals65.extractPhpSymbols(file, cwd);
|
|
52721
|
+
break;
|
|
51715
52722
|
default:
|
|
51716
52723
|
return JSON.stringify({
|
|
51717
52724
|
file,
|
|
51718
|
-
error: `Unsupported file extension: ${ext}. Supported: .ts, .tsx, .js, .jsx, .mjs, .cjs, .py, .pyw, .rs, .go`,
|
|
52725
|
+
error: `Unsupported file extension: ${ext}. Supported: .ts, .tsx, .js, .jsx, .mjs, .cjs, .py, .pyw, .rs, .go, .dart, .rb, .rake, .gemspec, .php, .phtml`,
|
|
51719
52726
|
symbols: []
|
|
51720
52727
|
}, null, 2);
|
|
51721
52728
|
}
|
|
@@ -51732,6 +52739,11 @@ var symbols = createSwarmTool({
|
|
|
51732
52739
|
}, null, 2);
|
|
51733
52740
|
}
|
|
51734
52741
|
});
|
|
52742
|
+
var _internals65 = {
|
|
52743
|
+
extractDartSymbols,
|
|
52744
|
+
extractRubySymbols,
|
|
52745
|
+
extractPhpSymbols
|
|
52746
|
+
};
|
|
51735
52747
|
|
|
51736
52748
|
// src/tools/repo-graph/ontology.ts
|
|
51737
52749
|
import * as path73 from "path";
|
|
@@ -52333,14 +53345,20 @@ var ONTOLOGY_FINDING_SEVERITY_SET = new Set(ONTOLOGY_FINDING_SEVERITY_VALUES);
|
|
|
52333
53345
|
var IMPORT_TYPE_SET = new Set(IMPORT_TYPE_VALUES);
|
|
52334
53346
|
|
|
52335
53347
|
// src/tools/repo-graph/builder.ts
|
|
52336
|
-
var
|
|
53348
|
+
var _internals66 = {
|
|
52337
53349
|
now: Date.now,
|
|
52338
53350
|
safeRealpathSync,
|
|
52339
53351
|
extractTSSymbols,
|
|
52340
53352
|
extractPythonSymbols,
|
|
52341
53353
|
extractRustSymbols,
|
|
52342
53354
|
extractGoSymbols,
|
|
53355
|
+
extractDartSymbols,
|
|
53356
|
+
extractRubySymbols,
|
|
53357
|
+
extractPhpSymbols,
|
|
52343
53358
|
parseFileImports,
|
|
53359
|
+
parseDartFileImports,
|
|
53360
|
+
parseRubyFileImports,
|
|
53361
|
+
parsePhpFileImports,
|
|
52344
53362
|
extractFileOntology,
|
|
52345
53363
|
stripComments: stripComments2,
|
|
52346
53364
|
computeUsedSymbols,
|
|
@@ -52498,6 +53516,15 @@ function parseFileImports(rawContent, sourceFile, workspaceRoot) {
|
|
|
52498
53516
|
if (ext === ".cs" || ext === ".csx") {
|
|
52499
53517
|
return parseCSharpFileImports(rawContent);
|
|
52500
53518
|
}
|
|
53519
|
+
if (ext === ".dart") {
|
|
53520
|
+
return parseDartFileImports(rawContent);
|
|
53521
|
+
}
|
|
53522
|
+
if (ext === ".rb" || ext === ".rake" || ext === ".gemspec") {
|
|
53523
|
+
return parseRubyFileImports(rawContent);
|
|
53524
|
+
}
|
|
53525
|
+
if (ext === ".php" || ext === ".phtml" || sourceFile?.endsWith(".blade.php")) {
|
|
53526
|
+
return parsePhpFileImports(rawContent);
|
|
53527
|
+
}
|
|
52501
53528
|
const imports = [];
|
|
52502
53529
|
const content = stripComments2(rawContent);
|
|
52503
53530
|
const importRegex = /import\s+(?:\{[\s\S]*?\}|(?:\*\s+as\s+\w+)|\w+)\s+from\s+['"`]([^'"`\0\t\r\n]+)['"`]|import\s+['"`]([^'"`\0\t\r\n]+)['"`]|require\s*\(\s*['"`]([^'"`\0\t\r\n]+)['"`]\s*\)|export\s*\{[^}]*\}\s*from\s+['"`]([^'"`\0\t\r\n]+)['"`]|export\s+\*(?:\s+as\s+\w+)?\s+from\s+['"`]([^'"`\0\t\r\n]+)['"`]|import\s*\(\s*['"`]([^'"`\0\t\r\n]+)['"`]\s*\)/g;
|
|
@@ -52611,6 +53638,41 @@ function parseCSharpFileImports(rawContent) {
|
|
|
52611
53638
|
}
|
|
52612
53639
|
return imports;
|
|
52613
53640
|
}
|
|
53641
|
+
function parseDartFileImports(rawContent) {
|
|
53642
|
+
const imports = [];
|
|
53643
|
+
for (const match of rawContent.matchAll(/^[ \t]*(import|export)[ \t]+['"]([^'"]+)['"]([^;]*)/gm)) {
|
|
53644
|
+
const clause = match[3];
|
|
53645
|
+
const shown = clause?.match(/\bshow\s+([^;]+)/)?.[1].split(",").map((part) => part.trim()).filter(Boolean);
|
|
53646
|
+
const alias = clause?.match(/\bas\s+\w+/);
|
|
53647
|
+
const bindings = !alias && shown && shown.length > 0 ? shown.map((name) => ({ imported: name, local: name })) : [];
|
|
53648
|
+
const parsed = makeParsedImport(match[2], bindings.length > 0 ? "named" : "namespace", bindings, match[1] === "export");
|
|
53649
|
+
if (parsed)
|
|
53650
|
+
imports.push(parsed);
|
|
53651
|
+
}
|
|
53652
|
+
return imports;
|
|
53653
|
+
}
|
|
53654
|
+
function parseRubyFileImports(rawContent) {
|
|
53655
|
+
const imports = [];
|
|
53656
|
+
for (const match of rawContent.matchAll(/^[ \t]*(require_relative|require)[ \t]+['"]([^'"]+)['"]/gm)) {
|
|
53657
|
+
const relative10 = match[1] === "require_relative";
|
|
53658
|
+
const specifier = relative10 && !match[2].startsWith(".") ? `./${match[2]}` : match[2];
|
|
53659
|
+
const parsed = makeParsedImport(specifier, relative10 ? "default" : "namespace", []);
|
|
53660
|
+
if (parsed)
|
|
53661
|
+
imports.push(parsed);
|
|
53662
|
+
}
|
|
53663
|
+
return imports;
|
|
53664
|
+
}
|
|
53665
|
+
function parsePhpFileImports(rawContent) {
|
|
53666
|
+
const imports = [];
|
|
53667
|
+
for (const match of rawContent.matchAll(/^[ \t]*use[ \t]+(?:(?:function|const)[ \t]+)?([^;\s]+)(?:[ \t]+as[ \t]+(\w+))?[ \t]*;?[ \t]*\r?$/gim)) {
|
|
53668
|
+
const imported = match[1].split("\\").pop() ?? match[1];
|
|
53669
|
+
const bindings = match[2] ? [{ imported, local: match[2] }] : [];
|
|
53670
|
+
const parsed = makeParsedImport(match[1], bindings.length > 0 ? "named" : "namespace", bindings);
|
|
53671
|
+
if (parsed)
|
|
53672
|
+
imports.push(parsed);
|
|
53673
|
+
}
|
|
53674
|
+
return imports;
|
|
53675
|
+
}
|
|
52614
53676
|
function parsePythonFileImports(rawContent, sourceFile) {
|
|
52615
53677
|
const imports = [];
|
|
52616
53678
|
const isPackageInit = sourceFile ? ["__init__.py", "__init__.pyw"].includes(path74.basename(sourceFile)) : false;
|
|
@@ -52882,7 +53944,7 @@ function recordManifestDir(manifestDirs, absoluteRoot, dir, entryName) {
|
|
|
52882
53944
|
function isWalkBudgetExceeded(ctx) {
|
|
52883
53945
|
if (ctx.abortReason !== undefined)
|
|
52884
53946
|
return true;
|
|
52885
|
-
if (
|
|
53947
|
+
if (_internals66.now() - ctx.startedAt > ctx.walkBudgetMs) {
|
|
52886
53948
|
ctx.abortReason = "budget";
|
|
52887
53949
|
return true;
|
|
52888
53950
|
}
|
|
@@ -52914,7 +53976,7 @@ async function walkRepoGraphInputs(dir, options) {
|
|
|
52914
53976
|
const ctx = {
|
|
52915
53977
|
stats,
|
|
52916
53978
|
seenRealPaths: new Set,
|
|
52917
|
-
startedAt:
|
|
53979
|
+
startedAt: _internals66.now(),
|
|
52918
53980
|
walkBudgetMs: options?.walkBudgetMs ?? DEFAULT_WALK_BUDGET_MS,
|
|
52919
53981
|
maxFiles: options?.maxFiles ?? DEFAULT_WALK_FILE_CAP,
|
|
52920
53982
|
followSymlinks: options?.followSymlinks ?? false,
|
|
@@ -53015,7 +54077,7 @@ async function walkRepoGraphInputs(dir, options) {
|
|
|
53015
54077
|
unreadableDirectories,
|
|
53016
54078
|
unreadableFiles,
|
|
53017
54079
|
probedFiles: metadata.length,
|
|
53018
|
-
elapsedMs: Math.max(0,
|
|
54080
|
+
elapsedMs: Math.max(0, _internals66.now() - ctx.startedAt)
|
|
53019
54081
|
};
|
|
53020
54082
|
}
|
|
53021
54083
|
var RANGE_WIDENED_GRAMMARS = new Set([
|
|
@@ -53023,7 +54085,10 @@ var RANGE_WIDENED_GRAMMARS = new Set([
|
|
|
53023
54085
|
"kotlin",
|
|
53024
54086
|
"csharp",
|
|
53025
54087
|
"cpp",
|
|
53026
|
-
"swift"
|
|
54088
|
+
"swift",
|
|
54089
|
+
"dart",
|
|
54090
|
+
"ruby",
|
|
54091
|
+
"php"
|
|
53027
54092
|
]);
|
|
53028
54093
|
|
|
53029
54094
|
// src/tools/repo-graph/query.ts
|
|
@@ -53057,7 +54122,7 @@ var MAX_RELATIVE_PATH_LENGTH = 4096;
|
|
|
53057
54122
|
var WINDOWS_RENAME_MAX_RETRIES2 = 5;
|
|
53058
54123
|
var WINDOWS_RENAME_RETRY_DELAY_MS = 100;
|
|
53059
54124
|
var probeCache = new Map;
|
|
53060
|
-
var
|
|
54125
|
+
var _internals67 = {
|
|
53061
54126
|
now: Date.now,
|
|
53062
54127
|
walkRepoGraphInputs,
|
|
53063
54128
|
open: fsPromises3.open,
|
|
@@ -53096,11 +54161,11 @@ async function writeFingerprintAtomic(root, data) {
|
|
|
53096
54161
|
const temp = path75.join(path75.dirname(target), `.repo-graph.fingerprint.${process.pid}.${Date.now()}.${Math.random().toString(36).slice(2, 10)}.tmp`);
|
|
53097
54162
|
validateSymlinkBoundary(temp, root);
|
|
53098
54163
|
try {
|
|
53099
|
-
await
|
|
54164
|
+
await _internals67.bunWrite(temp, data);
|
|
53100
54165
|
let lastError;
|
|
53101
54166
|
for (let attempt = 0;attempt < WINDOWS_RENAME_MAX_RETRIES2; attempt++) {
|
|
53102
54167
|
try {
|
|
53103
|
-
await
|
|
54168
|
+
await _internals67.fsRename(temp, target);
|
|
53104
54169
|
lastError = undefined;
|
|
53105
54170
|
break;
|
|
53106
54171
|
} catch (error2) {
|
|
@@ -53109,20 +54174,20 @@ async function writeFingerprintAtomic(root, data) {
|
|
|
53109
54174
|
if (code !== "EEXIST" && code !== "EPERM" && code !== "EBUSY" || attempt === WINDOWS_RENAME_MAX_RETRIES2 - 1) {
|
|
53110
54175
|
break;
|
|
53111
54176
|
}
|
|
53112
|
-
await new Promise((resolve26) => setTimeout(resolve26,
|
|
54177
|
+
await new Promise((resolve26) => setTimeout(resolve26, _internals67.retryDelayMs));
|
|
53113
54178
|
}
|
|
53114
54179
|
}
|
|
53115
54180
|
if (lastError !== undefined)
|
|
53116
54181
|
throw lastError;
|
|
53117
54182
|
} finally {
|
|
53118
54183
|
try {
|
|
53119
|
-
await
|
|
54184
|
+
await _internals67.fsUnlink(temp);
|
|
53120
54185
|
} catch {}
|
|
53121
54186
|
}
|
|
53122
54187
|
}
|
|
53123
54188
|
async function refuseFingerprint(root) {
|
|
53124
54189
|
try {
|
|
53125
|
-
await
|
|
54190
|
+
await _internals67.fsUnlink(fingerprintPath(root));
|
|
53126
54191
|
} catch {}
|
|
53127
54192
|
invalidateFreshnessCache(root);
|
|
53128
54193
|
return false;
|
|
@@ -53189,7 +54254,7 @@ function diagnosticPaths(root, diagnostics) {
|
|
|
53189
54254
|
async function writeFingerprint(root, graph, options) {
|
|
53190
54255
|
invalidateFreshnessCache(root);
|
|
53191
54256
|
try {
|
|
53192
|
-
const walk = await
|
|
54257
|
+
const walk = await _internals67.walkRepoGraphInputs(root, {
|
|
53193
54258
|
walkBudgetMs: options?.walkBudgetMs,
|
|
53194
54259
|
maxFiles: options?.maxFiles,
|
|
53195
54260
|
followSymlinks: options?.followSymlinks,
|
|
@@ -53270,7 +54335,7 @@ async function writeFingerprint(root, graph, options) {
|
|
|
53270
54335
|
|
|
53271
54336
|
// src/tools/repo-graph/storage.ts
|
|
53272
54337
|
var WINDOWS_RENAME_RETRY_DELAY_MS2 = 100;
|
|
53273
|
-
var
|
|
54338
|
+
var _internals68 = {
|
|
53274
54339
|
safeRealpathSync,
|
|
53275
54340
|
fsRename: fsPromises4.rename.bind(fsPromises4),
|
|
53276
54341
|
retryDelayMs: WINDOWS_RENAME_RETRY_DELAY_MS2,
|
|
@@ -54535,15 +55600,15 @@ async function handleMemoryUnlinkCommand(directory, args) {
|
|
|
54535
55600
|
}
|
|
54536
55601
|
|
|
54537
55602
|
// src/services/plan-service.ts
|
|
54538
|
-
var
|
|
55603
|
+
var _internals69 = {
|
|
54539
55604
|
loadPlanJsonOnly,
|
|
54540
55605
|
derivePlanMarkdown,
|
|
54541
55606
|
readSwarmFileAsync
|
|
54542
55607
|
};
|
|
54543
55608
|
async function getPlanData(directory, phaseArg) {
|
|
54544
|
-
const plan = await
|
|
55609
|
+
const plan = await _internals69.loadPlanJsonOnly(directory);
|
|
54545
55610
|
if (plan) {
|
|
54546
|
-
const fullMarkdown =
|
|
55611
|
+
const fullMarkdown = _internals69.derivePlanMarkdown(plan);
|
|
54547
55612
|
if (phaseArg === undefined || phaseArg === null || phaseArg === "") {
|
|
54548
55613
|
return {
|
|
54549
55614
|
hasPlan: true,
|
|
@@ -54586,7 +55651,7 @@ async function getPlanData(directory, phaseArg) {
|
|
|
54586
55651
|
isLegacy: false
|
|
54587
55652
|
};
|
|
54588
55653
|
}
|
|
54589
|
-
const planContent = await
|
|
55654
|
+
const planContent = await _internals69.readSwarmFileAsync(directory, "plan.md");
|
|
54590
55655
|
if (!planContent) {
|
|
54591
55656
|
return {
|
|
54592
55657
|
hasPlan: false,
|
|
@@ -54683,7 +55748,7 @@ async function handlePlanCommand(directory, args) {
|
|
|
54683
55748
|
return formatPlanMarkdown(planData);
|
|
54684
55749
|
}
|
|
54685
55750
|
// src/commands/post-mortem.ts
|
|
54686
|
-
var
|
|
55751
|
+
var _internals70 = {
|
|
54687
55752
|
createCuratorLLMDelegate,
|
|
54688
55753
|
runCuratorPostMortem
|
|
54689
55754
|
};
|
|
@@ -54731,10 +55796,10 @@ async function handlePostMortemCommand(directory, args, options) {
|
|
|
54731
55796
|
};
|
|
54732
55797
|
if (options?.sessionID) {
|
|
54733
55798
|
try {
|
|
54734
|
-
pmOptions.llmDelegate =
|
|
55799
|
+
pmOptions.llmDelegate = _internals70.createCuratorLLMDelegate(directory, "postmortem", options.sessionID);
|
|
54735
55800
|
} catch {}
|
|
54736
55801
|
}
|
|
54737
|
-
const result = await
|
|
55802
|
+
const result = await _internals70.runCuratorPostMortem(directory, pmOptions);
|
|
54738
55803
|
const lines = [];
|
|
54739
55804
|
if (result.success) {
|
|
54740
55805
|
lines.push("## Post-Mortem Report Generated");
|
|
@@ -55023,7 +56088,7 @@ function resolveGhBinaryCandidates(options = {}) {
|
|
|
55023
56088
|
function resolveGhBinary() {
|
|
55024
56089
|
if (ghBinaryTestPin !== undefined)
|
|
55025
56090
|
return ghBinaryTestPin;
|
|
55026
|
-
return
|
|
56091
|
+
return _internals71.resolveExecutableFromPath(resolveGhBinaryCandidates());
|
|
55027
56092
|
}
|
|
55028
56093
|
function normalizeRepo(value) {
|
|
55029
56094
|
if (value === undefined || value === null || value === "")
|
|
@@ -55144,7 +56209,7 @@ var gh_evidence = createSwarmTool({
|
|
|
55144
56209
|
if (!Array.isArray(fields)) {
|
|
55145
56210
|
return JSON.stringify(fields, null, 2);
|
|
55146
56211
|
}
|
|
55147
|
-
const executable =
|
|
56212
|
+
const executable = _internals71.resolveGhBinary();
|
|
55148
56213
|
if (!executable) {
|
|
55149
56214
|
return JSON.stringify({
|
|
55150
56215
|
error: true,
|
|
@@ -55163,7 +56228,7 @@ var gh_evidence = createSwarmTool({
|
|
|
55163
56228
|
if (isLogFailedMode) {
|
|
55164
56229
|
ghArgs.push("--log-failed");
|
|
55165
56230
|
}
|
|
55166
|
-
const run = await
|
|
56231
|
+
const run = await _internals71.runExternalTool({
|
|
55167
56232
|
executable,
|
|
55168
56233
|
args: ghArgs,
|
|
55169
56234
|
cwd: directory,
|
|
@@ -55247,7 +56312,7 @@ var gh_evidence = createSwarmTool({
|
|
|
55247
56312
|
}, null, 2);
|
|
55248
56313
|
}
|
|
55249
56314
|
});
|
|
55250
|
-
var
|
|
56315
|
+
var _internals71 = {
|
|
55251
56316
|
resolveGhBinaryCandidates,
|
|
55252
56317
|
resolveExecutableFromPath,
|
|
55253
56318
|
resolveGhBinary,
|
|
@@ -55354,7 +56419,7 @@ function formatMergeGroupStatus(status, conclusion, htmlUrl) {
|
|
|
55354
56419
|
}
|
|
55355
56420
|
return parts.join(" ");
|
|
55356
56421
|
}
|
|
55357
|
-
var
|
|
56422
|
+
var _internals72 = {
|
|
55358
56423
|
formatRelativeTime,
|
|
55359
56424
|
formatMergeGroupStatus,
|
|
55360
56425
|
listActive,
|
|
@@ -55362,7 +56427,7 @@ var _internals71 = {
|
|
|
55362
56427
|
parseMergeGroupRuns
|
|
55363
56428
|
};
|
|
55364
56429
|
async function handlePrMonitorStatusCommand(directory, _args, sessionID, source) {
|
|
55365
|
-
const allActive = await
|
|
56430
|
+
const allActive = await _internals72.listActive(directory);
|
|
55366
56431
|
const allSessions = source === "cli";
|
|
55367
56432
|
const subs = allSessions ? allActive : allActive.filter((record) => record.sessionID === sessionID);
|
|
55368
56433
|
if (subs.length === 0) {
|
|
@@ -55378,7 +56443,7 @@ async function handlePrMonitorStatusCommand(directory, _args, sessionID, source)
|
|
|
55378
56443
|
const index = i + 1;
|
|
55379
56444
|
lines.push(` ${index}. ${sub.repoFullName}#${sub.prNumber}`);
|
|
55380
56445
|
lines.push(` URL: ${sub.prUrl}`);
|
|
55381
|
-
const mergeGroupRuns = await
|
|
56446
|
+
const mergeGroupRuns = await _internals72.listMergeGroupRuns(directory, sub.repoFullName, sub.prNumber);
|
|
55382
56447
|
if (mergeGroupRuns.runs.length > 0) {
|
|
55383
56448
|
lines.push(" Merge-group runs:");
|
|
55384
56449
|
for (const run of mergeGroupRuns.runs) {
|
|
@@ -55519,7 +56584,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
|
|
|
55519
56584
|
const repoFullName = `${prInfo.owner}/${prInfo.repo}`;
|
|
55520
56585
|
const prUrl = `https://github.com/${prInfo.owner}/${prInfo.repo}/pull/${prInfo.number}`;
|
|
55521
56586
|
try {
|
|
55522
|
-
const config =
|
|
56587
|
+
const config = _internals73.loadPluginConfig(directory);
|
|
55523
56588
|
const prMonitorConfig = config.pr_monitor;
|
|
55524
56589
|
if (!prMonitorConfig?.enabled) {
|
|
55525
56590
|
return [
|
|
@@ -55529,7 +56594,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
|
|
|
55529
56594
|
].join(`
|
|
55530
56595
|
`);
|
|
55531
56596
|
}
|
|
55532
|
-
await
|
|
56597
|
+
await _internals73.subscribe(directory, {
|
|
55533
56598
|
sessionID,
|
|
55534
56599
|
prNumber: prInfo.number,
|
|
55535
56600
|
repoFullName,
|
|
@@ -55557,7 +56622,7 @@ async function handlePrSubscribeCommand(directory, args, sessionID) {
|
|
|
55557
56622
|
`);
|
|
55558
56623
|
}
|
|
55559
56624
|
}
|
|
55560
|
-
var
|
|
56625
|
+
var _internals73 = {
|
|
55561
56626
|
loadPluginConfig,
|
|
55562
56627
|
subscribe
|
|
55563
56628
|
};
|
|
@@ -55580,9 +56645,9 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
|
|
|
55580
56645
|
`);
|
|
55581
56646
|
}
|
|
55582
56647
|
const refToken = rest[0];
|
|
55583
|
-
const prInfo =
|
|
56648
|
+
const prInfo = _internals74.parsePrRef(refToken, directory);
|
|
55584
56649
|
if (!prInfo) {
|
|
55585
|
-
if (
|
|
56650
|
+
if (_internals74.looksLikePrRef(refToken)) {
|
|
55586
56651
|
return [
|
|
55587
56652
|
`Error: Could not resolve PR reference from "${refToken}".`,
|
|
55588
56653
|
"",
|
|
@@ -55603,8 +56668,8 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
|
|
|
55603
56668
|
const repoFullName = `${prInfo.owner}/${prInfo.repo}`;
|
|
55604
56669
|
const prUrl = `https://github.com/${prInfo.owner}/${prInfo.repo}/pull/${prInfo.number}`;
|
|
55605
56670
|
try {
|
|
55606
|
-
const correlationId =
|
|
55607
|
-
const result = await
|
|
56671
|
+
const correlationId = _internals74.buildCorrelationId(sessionID, repoFullName, prInfo.number);
|
|
56672
|
+
const result = await _internals74.unsubscribe(directory, correlationId);
|
|
55608
56673
|
if (!result) {
|
|
55609
56674
|
return [
|
|
55610
56675
|
`Not subscribed to ${prUrl}`,
|
|
@@ -55631,7 +56696,7 @@ async function handlePrUnsubscribeCommand(directory, args, sessionID) {
|
|
|
55631
56696
|
`);
|
|
55632
56697
|
}
|
|
55633
56698
|
}
|
|
55634
|
-
var
|
|
56699
|
+
var _internals74 = {
|
|
55635
56700
|
unsubscribe,
|
|
55636
56701
|
buildCorrelationId,
|
|
55637
56702
|
parsePrRef,
|
|
@@ -55681,7 +56746,7 @@ function normalizeRelativePathForPlatform(value, platform) {
|
|
|
55681
56746
|
}
|
|
55682
56747
|
function isRegularFile(candidate) {
|
|
55683
56748
|
try {
|
|
55684
|
-
return
|
|
56749
|
+
return _internals75.statSync(candidate).isFile();
|
|
55685
56750
|
} catch {
|
|
55686
56751
|
return false;
|
|
55687
56752
|
}
|
|
@@ -55689,21 +56754,21 @@ function isRegularFile(candidate) {
|
|
|
55689
56754
|
function readTextFileBounded(filePath, maxBytes) {
|
|
55690
56755
|
let fd;
|
|
55691
56756
|
try {
|
|
55692
|
-
fd =
|
|
55693
|
-
const stats =
|
|
56757
|
+
fd = _internals75.openSync(filePath, "r");
|
|
56758
|
+
const stats = _internals75.fstatSync(fd);
|
|
55694
56759
|
if (!stats.isFile() || !Number.isSafeInteger(stats.size) || stats.size < 0 || stats.size > maxBytes) {
|
|
55695
56760
|
return null;
|
|
55696
56761
|
}
|
|
55697
56762
|
const bytes = Buffer.alloc(stats.size);
|
|
55698
56763
|
let offset = 0;
|
|
55699
56764
|
while (offset < bytes.byteLength) {
|
|
55700
|
-
const bytesRead =
|
|
56765
|
+
const bytesRead = _internals75.readSync(fd, bytes, offset, bytes.byteLength - offset, null);
|
|
55701
56766
|
if (bytesRead === 0)
|
|
55702
56767
|
break;
|
|
55703
56768
|
offset += bytesRead;
|
|
55704
56769
|
}
|
|
55705
56770
|
const overflowProbe = Buffer.alloc(1);
|
|
55706
|
-
if (
|
|
56771
|
+
if (_internals75.readSync(fd, overflowProbe, 0, 1, null) > 0)
|
|
55707
56772
|
return null;
|
|
55708
56773
|
return bytes.subarray(0, offset).toString("utf8");
|
|
55709
56774
|
} catch {
|
|
@@ -55711,7 +56776,7 @@ function readTextFileBounded(filePath, maxBytes) {
|
|
|
55711
56776
|
} finally {
|
|
55712
56777
|
if (fd !== undefined) {
|
|
55713
56778
|
try {
|
|
55714
|
-
|
|
56779
|
+
_internals75.closeSync(fd);
|
|
55715
56780
|
} catch {}
|
|
55716
56781
|
}
|
|
55717
56782
|
}
|
|
@@ -55732,7 +56797,7 @@ function getAncestorDirectories(directory) {
|
|
|
55732
56797
|
}
|
|
55733
56798
|
return roots;
|
|
55734
56799
|
}
|
|
55735
|
-
function getTrustedShimNames(linter, platform =
|
|
56800
|
+
function getTrustedShimNames(linter, platform = _internals75.platform()) {
|
|
55736
56801
|
const isWindows = platform === "win32";
|
|
55737
56802
|
if (linter === "biome") {
|
|
55738
56803
|
return isWindows ? ["biome.exe", "biome.cmd", "biome.ps1"] : ["biome"];
|
|
@@ -55749,7 +56814,7 @@ function getPackageManifestPath(searchRoot, linter) {
|
|
|
55749
56814
|
return path81.join(getPackageRootFromSearchRoot(searchRoot, linter), "package.json");
|
|
55750
56815
|
}
|
|
55751
56816
|
function getPackageDisplayPath(searchRoot, linter) {
|
|
55752
|
-
return path81.join(searchRoot, NODE_MODULES, BIN_DIRECTORY, linter === "biome" ?
|
|
56817
|
+
return path81.join(searchRoot, NODE_MODULES, BIN_DIRECTORY, linter === "biome" ? _internals75.platform() === "win32" ? "biome.exe" : "biome" : _internals75.platform() === "win32" ? "eslint" : "eslint");
|
|
55753
56818
|
}
|
|
55754
56819
|
function getBiomeNativePackage(platform, arch) {
|
|
55755
56820
|
const archMap = platform === "darwin" ? { arm64: "@biomejs/cli-darwin-arm64", x64: "@biomejs/cli-darwin-x64" } : platform === "linux" ? {
|
|
@@ -55764,7 +56829,7 @@ function getBiomeNativePackage(platform, arch) {
|
|
|
55764
56829
|
return null;
|
|
55765
56830
|
return archMap[arch] ?? null;
|
|
55766
56831
|
}
|
|
55767
|
-
function getBiomeNativeExecutable(searchRoot, platform =
|
|
56832
|
+
function getBiomeNativeExecutable(searchRoot, platform = _internals75.platform(), arch = _internals75.arch()) {
|
|
55768
56833
|
const nativePackage = getBiomeNativePackage(platform, arch);
|
|
55769
56834
|
if (!nativePackage)
|
|
55770
56835
|
return null;
|
|
@@ -55800,8 +56865,8 @@ function resolveCanonicalPackageCommand(searchRoot, linter, source) {
|
|
|
55800
56865
|
let canonicalCandidate;
|
|
55801
56866
|
try {
|
|
55802
56867
|
const packageRoot = path81.dirname(manifestPath);
|
|
55803
|
-
canonicalPackageRoot =
|
|
55804
|
-
canonicalCandidate =
|
|
56868
|
+
canonicalPackageRoot = _internals75.realpathSync(packageRoot);
|
|
56869
|
+
canonicalCandidate = _internals75.realpathSync(path81.resolve(packageRoot, relativeBinPath));
|
|
55805
56870
|
} catch {
|
|
55806
56871
|
return null;
|
|
55807
56872
|
}
|
|
@@ -55813,7 +56878,7 @@ function resolveCanonicalPackageCommand(searchRoot, linter, source) {
|
|
|
55813
56878
|
return null;
|
|
55814
56879
|
return {
|
|
55815
56880
|
linter,
|
|
55816
|
-
executable:
|
|
56881
|
+
executable: _internals75.execPath(),
|
|
55817
56882
|
argsPrefix: [canonicalCandidate],
|
|
55818
56883
|
displayPrefix: [getPackageDisplayPath(searchRoot, linter)],
|
|
55819
56884
|
source
|
|
@@ -55854,7 +56919,7 @@ function resolveLocalLinterCommand(linter, directory) {
|
|
|
55854
56919
|
}
|
|
55855
56920
|
return null;
|
|
55856
56921
|
}
|
|
55857
|
-
function findPathShimCandidate(linter, envPath =
|
|
56922
|
+
function findPathShimCandidate(linter, envPath = _internals75.pathEnv(), platform = _internals75.platform()) {
|
|
55858
56923
|
const entries = envPath.split(path81.delimiter).filter(Boolean);
|
|
55859
56924
|
const shimNames = getTrustedShimNames(linter, platform).filter((name) => name.endsWith(".cmd") || name.endsWith(".ps1") || platform !== "win32");
|
|
55860
56925
|
for (const entry of entries) {
|
|
@@ -55884,7 +56949,7 @@ function getExpectedShimSuffixes(linter) {
|
|
|
55884
56949
|
normalizeRelativePathForPlatform(nodeModulesPackageOnlySuffix, "linux")
|
|
55885
56950
|
];
|
|
55886
56951
|
}
|
|
55887
|
-
function resolvePathShimTarget(shimPath, linter, platform =
|
|
56952
|
+
function resolvePathShimTarget(shimPath, linter, platform = _internals75.platform()) {
|
|
55888
56953
|
const contents = readTextFileBounded(shimPath, MAX_PATH_SHIM_BYTES);
|
|
55889
56954
|
if (contents === null)
|
|
55890
56955
|
return null;
|
|
@@ -55931,7 +56996,7 @@ function resolvePathShimTarget(shimPath, linter, platform = _internals74.platfor
|
|
|
55931
56996
|
return null;
|
|
55932
56997
|
let canonicalShimDir;
|
|
55933
56998
|
try {
|
|
55934
|
-
canonicalShimDir =
|
|
56999
|
+
canonicalShimDir = _internals75.realpathSync(path81.dirname(shimPath));
|
|
55935
57000
|
} catch {
|
|
55936
57001
|
return null;
|
|
55937
57002
|
}
|
|
@@ -55940,7 +57005,7 @@ function resolvePathShimTarget(shimPath, linter, platform = _internals74.platfor
|
|
|
55940
57005
|
return null;
|
|
55941
57006
|
let canonicalTarget;
|
|
55942
57007
|
try {
|
|
55943
|
-
canonicalTarget =
|
|
57008
|
+
canonicalTarget = _internals75.realpathSync(resolvedTarget);
|
|
55944
57009
|
} catch {
|
|
55945
57010
|
return null;
|
|
55946
57011
|
}
|
|
@@ -55950,7 +57015,7 @@ function resolvePathShimTarget(shimPath, linter, platform = _internals74.platfor
|
|
|
55950
57015
|
}
|
|
55951
57016
|
let canonicalShimParent;
|
|
55952
57017
|
try {
|
|
55953
|
-
canonicalShimParent =
|
|
57018
|
+
canonicalShimParent = _internals75.realpathSync(path81.dirname(canonicalShimDir));
|
|
55954
57019
|
} catch {
|
|
55955
57020
|
return null;
|
|
55956
57021
|
}
|
|
@@ -55964,8 +57029,8 @@ function resolvePathShimTarget(shimPath, linter, platform = _internals74.platfor
|
|
|
55964
57029
|
return canonicalTarget;
|
|
55965
57030
|
}
|
|
55966
57031
|
function resolvePathLinterCommand(linter, directory) {
|
|
55967
|
-
const platform =
|
|
55968
|
-
const envPath =
|
|
57032
|
+
const platform = _internals75.platform();
|
|
57033
|
+
const envPath = _internals75.pathEnv();
|
|
55969
57034
|
const nativeNames = platform === "win32" ? linter === "biome" ? ["biome.exe"] : ["eslint.exe"] : linter === "biome" ? ["biome"] : ["eslint"];
|
|
55970
57035
|
const nativeExecutable = resolveExecutableFromPath(nativeNames, envPath, platform);
|
|
55971
57036
|
if (nativeExecutable) {
|
|
@@ -55985,7 +57050,7 @@ function resolvePathLinterCommand(linter, directory) {
|
|
|
55985
57050
|
return null;
|
|
55986
57051
|
return {
|
|
55987
57052
|
linter,
|
|
55988
|
-
executable:
|
|
57053
|
+
executable: _internals75.execPath(),
|
|
55989
57054
|
argsPrefix: [shimTarget],
|
|
55990
57055
|
displayPrefix: [path81.join(directory, NODE_MODULES, BIN_DIRECTORY, linter)],
|
|
55991
57056
|
source: "path-shim"
|
|
@@ -56022,7 +57087,7 @@ function buildExecutionError(mode, command, linter, result) {
|
|
|
56022
57087
|
};
|
|
56023
57088
|
}
|
|
56024
57089
|
async function probeResolvedCommand(command, cwd, abortSignal) {
|
|
56025
|
-
const result = await
|
|
57090
|
+
const result = await _internals75.runExternalTool({
|
|
56026
57091
|
executable: command.executable,
|
|
56027
57092
|
args: [...command.argsPrefix, "--version"],
|
|
56028
57093
|
cwd,
|
|
@@ -56040,7 +57105,7 @@ async function resolveLinterCommand(linter, directory) {
|
|
|
56040
57105
|
async function detectResolvedLinter(directory, abortSignal) {
|
|
56041
57106
|
if (!directory)
|
|
56042
57107
|
return null;
|
|
56043
|
-
if (!
|
|
57108
|
+
if (!_internals75.existsSync(directory))
|
|
56044
57109
|
return null;
|
|
56045
57110
|
const cwd = toAbsoluteDirectory(directory);
|
|
56046
57111
|
for (const linter of SUPPORTED_LINTERS) {
|
|
@@ -56054,12 +57119,12 @@ async function detectResolvedLinter(directory, abortSignal) {
|
|
|
56054
57119
|
return null;
|
|
56055
57120
|
}
|
|
56056
57121
|
function detectRuff(cwd) {
|
|
56057
|
-
if (
|
|
57122
|
+
if (_internals75.existsSync(path81.join(cwd, "ruff.toml")))
|
|
56058
57123
|
return hasAdditionalCommand("ruff");
|
|
56059
57124
|
try {
|
|
56060
57125
|
const pyproject = path81.join(cwd, "pyproject.toml");
|
|
56061
|
-
if (
|
|
56062
|
-
const content =
|
|
57126
|
+
if (_internals75.existsSync(pyproject)) {
|
|
57127
|
+
const content = _internals75.readFileSync(pyproject, "utf-8");
|
|
56063
57128
|
if (content.includes("[tool.ruff]"))
|
|
56064
57129
|
return hasAdditionalCommand("ruff");
|
|
56065
57130
|
}
|
|
@@ -56067,32 +57132,32 @@ function detectRuff(cwd) {
|
|
|
56067
57132
|
return false;
|
|
56068
57133
|
}
|
|
56069
57134
|
function detectClippy(cwd) {
|
|
56070
|
-
return
|
|
57135
|
+
return _internals75.existsSync(path81.join(cwd, "Cargo.toml")) && hasAdditionalCommand("cargo");
|
|
56071
57136
|
}
|
|
56072
57137
|
function detectGolangciLint(cwd) {
|
|
56073
|
-
return
|
|
57138
|
+
return _internals75.existsSync(path81.join(cwd, "go.mod")) && hasAdditionalCommand("golangci-lint");
|
|
56074
57139
|
}
|
|
56075
57140
|
function readTextFileSafe(filePath) {
|
|
56076
57141
|
try {
|
|
56077
|
-
return
|
|
57142
|
+
return _internals75.readFileSync(filePath, "utf-8");
|
|
56078
57143
|
} catch {
|
|
56079
57144
|
return "";
|
|
56080
57145
|
}
|
|
56081
57146
|
}
|
|
56082
57147
|
function resolveAdditionalExecutable(name) {
|
|
56083
|
-
const platform =
|
|
57148
|
+
const platform = _internals75.platform();
|
|
56084
57149
|
if (platform !== "win32") {
|
|
56085
|
-
return
|
|
57150
|
+
return _internals75.isCommandAvailable(name) ? name : null;
|
|
56086
57151
|
}
|
|
56087
|
-
return resolveExecutableFromPath([`${name}.exe`],
|
|
57152
|
+
return resolveExecutableFromPath([`${name}.exe`], _internals75.pathEnv(), platform);
|
|
56088
57153
|
}
|
|
56089
57154
|
function resolveWindowsCommandInterpreter() {
|
|
56090
|
-
const candidate =
|
|
57155
|
+
const candidate = _internals75.comSpec();
|
|
56091
57156
|
if (!candidate || !path81.isAbsolute(candidate) || path81.basename(candidate).toLowerCase() !== "cmd.exe" || !isRegularFile(candidate)) {
|
|
56092
57157
|
return null;
|
|
56093
57158
|
}
|
|
56094
57159
|
try {
|
|
56095
|
-
const canonical =
|
|
57160
|
+
const canonical = _internals75.realpathSync(candidate);
|
|
56096
57161
|
return path81.basename(canonical).toLowerCase() === "cmd.exe" ? canonical : null;
|
|
56097
57162
|
} catch {
|
|
56098
57163
|
return null;
|
|
@@ -56104,7 +57169,7 @@ function buildWindowsBatchCommand(wrapperPath, args) {
|
|
|
56104
57169
|
return null;
|
|
56105
57170
|
let canonicalWrapper;
|
|
56106
57171
|
try {
|
|
56107
|
-
canonicalWrapper =
|
|
57172
|
+
canonicalWrapper = _internals75.realpathSync(wrapperPath);
|
|
56108
57173
|
} catch {
|
|
56109
57174
|
return null;
|
|
56110
57175
|
}
|
|
@@ -56118,13 +57183,13 @@ function buildWindowsBatchCommand(wrapperPath, args) {
|
|
|
56118
57183
|
return [interpreter, "/d", "/s", "/v:off", "/c", command];
|
|
56119
57184
|
}
|
|
56120
57185
|
function resolveWindowsBatchCommandFromPath(name, args) {
|
|
56121
|
-
if (
|
|
57186
|
+
if (_internals75.platform() !== "win32")
|
|
56122
57187
|
return null;
|
|
56123
|
-
const wrapper = resolveExecutableFromPath(WINDOWS_BATCH_WRAPPER_EXTENSIONS.map((extension) => `${name}${extension}`),
|
|
57188
|
+
const wrapper = resolveExecutableFromPath(WINDOWS_BATCH_WRAPPER_EXTENSIONS.map((extension) => `${name}${extension}`), _internals75.pathEnv(), "win32");
|
|
56124
57189
|
return wrapper ? buildWindowsBatchCommand(wrapper, args) : null;
|
|
56125
57190
|
}
|
|
56126
57191
|
function resolveContainedWindowsBatchCommand(cwd, fileName, args) {
|
|
56127
|
-
if (
|
|
57192
|
+
if (_internals75.platform() !== "win32")
|
|
56128
57193
|
return null;
|
|
56129
57194
|
const candidate = path81.join(cwd, fileName);
|
|
56130
57195
|
if (!isRegularFile(candidate))
|
|
@@ -56132,8 +57197,8 @@ function resolveContainedWindowsBatchCommand(cwd, fileName, args) {
|
|
|
56132
57197
|
let canonicalCwd;
|
|
56133
57198
|
let canonicalCandidate;
|
|
56134
57199
|
try {
|
|
56135
|
-
canonicalCwd =
|
|
56136
|
-
canonicalCandidate =
|
|
57200
|
+
canonicalCwd = _internals75.realpathSync(cwd);
|
|
57201
|
+
canonicalCandidate = _internals75.realpathSync(candidate);
|
|
56137
57202
|
} catch {
|
|
56138
57203
|
return null;
|
|
56139
57204
|
}
|
|
@@ -56154,22 +57219,22 @@ function hasAdditionalCommand(name) {
|
|
|
56154
57219
|
}
|
|
56155
57220
|
function resolvePhpVendorCommand(cwd, name) {
|
|
56156
57221
|
const relativeProxy = path81.join("vendor", "bin", name);
|
|
56157
|
-
if (!
|
|
57222
|
+
if (!_internals75.existsSync(path81.join(cwd, relativeProxy)))
|
|
56158
57223
|
return null;
|
|
56159
|
-
if (
|
|
57224
|
+
if (_internals75.platform() !== "win32")
|
|
56160
57225
|
return [relativeProxy];
|
|
56161
57226
|
const phpExecutable = resolveAdditionalExecutable("php");
|
|
56162
57227
|
return phpExecutable ? [phpExecutable, relativeProxy] : null;
|
|
56163
57228
|
}
|
|
56164
57229
|
function hasCheckstyleGradleSignal(cwd) {
|
|
56165
|
-
const gradleFiles = ["build.gradle", "build.gradle.kts"].map((file) => path81.join(cwd, file)).filter((file) =>
|
|
56166
|
-
return
|
|
57230
|
+
const gradleFiles = ["build.gradle", "build.gradle.kts"].map((file) => path81.join(cwd, file)).filter((file) => _internals75.existsSync(file));
|
|
57231
|
+
return _internals75.existsSync(path81.join(cwd, "checkstyle.xml")) || _internals75.existsSync(path81.join(cwd, "config", "checkstyle", "checkstyle.xml")) || gradleFiles.some((file) => /\bcheckstyle\b/i.test(readTextFileSafe(file)));
|
|
56167
57232
|
}
|
|
56168
57233
|
function resolveCheckstyleCommand(cwd) {
|
|
56169
|
-
const hasMavenProject =
|
|
57234
|
+
const hasMavenProject = _internals75.existsSync(path81.join(cwd, "pom.xml"));
|
|
56170
57235
|
const hasGradleSignal = hasCheckstyleGradleSignal(cwd);
|
|
56171
57236
|
if (hasGradleSignal) {
|
|
56172
|
-
if (
|
|
57237
|
+
if (_internals75.platform() === "win32") {
|
|
56173
57238
|
const gradlew = resolveContainedWindowsBatchCommand(cwd, "gradlew.bat", [
|
|
56174
57239
|
"checkstyleMain"
|
|
56175
57240
|
]);
|
|
@@ -56177,7 +57242,7 @@ function resolveCheckstyleCommand(cwd) {
|
|
|
56177
57242
|
return gradlew;
|
|
56178
57243
|
} else {
|
|
56179
57244
|
const gradlew = path81.join(cwd, "gradlew");
|
|
56180
|
-
if (
|
|
57245
|
+
if (_internals75.existsSync(gradlew))
|
|
56181
57246
|
return [gradlew, "checkstyleMain"];
|
|
56182
57247
|
}
|
|
56183
57248
|
const gradle = buildAdditionalCommand("gradle", ["checkstyleMain"]);
|
|
@@ -56191,7 +57256,7 @@ function resolveCheckstyleCommand(cwd) {
|
|
|
56191
57256
|
}
|
|
56192
57257
|
return null;
|
|
56193
57258
|
}
|
|
56194
|
-
function isUnsafeShellWrapperExecutable(executable, platform =
|
|
57259
|
+
function isUnsafeShellWrapperExecutable(executable, platform = _internals75.platform()) {
|
|
56195
57260
|
return platform === "win32" && UNSAFE_SHELL_WRAPPER_EXTENSIONS.has(path81.extname(executable).toLowerCase());
|
|
56196
57261
|
}
|
|
56197
57262
|
function detectCheckstyle(cwd) {
|
|
@@ -56199,7 +57264,7 @@ function detectCheckstyle(cwd) {
|
|
|
56199
57264
|
}
|
|
56200
57265
|
function hasRootKotlinFile(cwd) {
|
|
56201
57266
|
try {
|
|
56202
|
-
return
|
|
57267
|
+
return _internals75.readdirSync(cwd).some((f) => f.endsWith(".kt") || f.endsWith(".kts"));
|
|
56203
57268
|
} catch {
|
|
56204
57269
|
return false;
|
|
56205
57270
|
}
|
|
@@ -56209,27 +57274,27 @@ function buildGradleHasKotlinSignal(cwd) {
|
|
|
56209
57274
|
return /\b(kotlin|org\.jetbrains\.kotlin|ktlint)\b/i.test(content);
|
|
56210
57275
|
}
|
|
56211
57276
|
function detectKtlint(cwd) {
|
|
56212
|
-
const hasKotlin =
|
|
57277
|
+
const hasKotlin = _internals75.existsSync(path81.join(cwd, "build.gradle.kts")) || _internals75.existsSync(path81.join(cwd, "build.gradle")) && buildGradleHasKotlinSignal(cwd) || hasRootKotlinFile(cwd);
|
|
56213
57278
|
return hasKotlin && hasAdditionalCommand("ktlint");
|
|
56214
57279
|
}
|
|
56215
57280
|
function detectPhpLinter(cwd) {
|
|
56216
|
-
if ((
|
|
57281
|
+
if ((_internals75.existsSync(path81.join(cwd, "phpstan.neon")) || _internals75.existsSync(path81.join(cwd, "phpstan.neon.dist"))) && resolvePhpVendorCommand(cwd, "phpstan") !== null) {
|
|
56217
57282
|
return "phpstan";
|
|
56218
57283
|
}
|
|
56219
|
-
if (
|
|
57284
|
+
if (_internals75.existsSync(path81.join(cwd, "pint.json")) && resolvePhpVendorCommand(cwd, "pint") !== null) {
|
|
56220
57285
|
return "pint";
|
|
56221
57286
|
}
|
|
56222
|
-
if (
|
|
57287
|
+
if (_internals75.existsSync(path81.join(cwd, ".php-cs-fixer.php")) && resolvePhpVendorCommand(cwd, "php-cs-fixer") !== null) {
|
|
56223
57288
|
return "php-cs-fixer";
|
|
56224
57289
|
}
|
|
56225
|
-
if (
|
|
57290
|
+
if (_internals75.existsSync(path81.join(cwd, "phpcs.xml")) && resolvePhpVendorCommand(cwd, "phpcs") !== null) {
|
|
56226
57291
|
return "phpcs";
|
|
56227
57292
|
}
|
|
56228
57293
|
return null;
|
|
56229
57294
|
}
|
|
56230
57295
|
function detectDotnetFormat(cwd) {
|
|
56231
57296
|
try {
|
|
56232
|
-
const files =
|
|
57297
|
+
const files = _internals75.readdirSync(cwd);
|
|
56233
57298
|
const hasCsproj = files.some((f) => f.endsWith(".csproj") || f.endsWith(".sln"));
|
|
56234
57299
|
return hasCsproj && hasAdditionalCommand("dotnet");
|
|
56235
57300
|
} catch {
|
|
@@ -56237,14 +57302,14 @@ function detectDotnetFormat(cwd) {
|
|
|
56237
57302
|
}
|
|
56238
57303
|
}
|
|
56239
57304
|
function detectCppcheck(cwd) {
|
|
56240
|
-
if (
|
|
57305
|
+
if (_internals75.existsSync(path81.join(cwd, "CMakeLists.txt"))) {
|
|
56241
57306
|
return hasAdditionalCommand("cppcheck");
|
|
56242
57307
|
}
|
|
56243
57308
|
try {
|
|
56244
57309
|
const dirsToCheck = [cwd, path81.join(cwd, "src")];
|
|
56245
57310
|
const hasCpp = dirsToCheck.some((dir) => {
|
|
56246
57311
|
try {
|
|
56247
|
-
return
|
|
57312
|
+
return _internals75.readdirSync(dir).some((f) => /\.(c|cpp|cc|cxx|h|hpp)$/.test(f));
|
|
56248
57313
|
} catch {
|
|
56249
57314
|
return false;
|
|
56250
57315
|
}
|
|
@@ -56255,13 +57320,13 @@ function detectCppcheck(cwd) {
|
|
|
56255
57320
|
}
|
|
56256
57321
|
}
|
|
56257
57322
|
function detectSwiftlint(cwd) {
|
|
56258
|
-
return
|
|
57323
|
+
return _internals75.existsSync(path81.join(cwd, "Package.swift")) && hasAdditionalCommand("swiftlint");
|
|
56259
57324
|
}
|
|
56260
57325
|
function detectDartAnalyze(cwd) {
|
|
56261
|
-
return
|
|
57326
|
+
return _internals75.existsSync(path81.join(cwd, "pubspec.yaml")) && hasAdditionalCommand("dart");
|
|
56262
57327
|
}
|
|
56263
57328
|
function detectRubocop(cwd) {
|
|
56264
|
-
return (
|
|
57329
|
+
return (_internals75.existsSync(path81.join(cwd, "Gemfile")) || _internals75.existsSync(path81.join(cwd, "gems.rb")) || _internals75.existsSync(path81.join(cwd, ".rubocop.yml"))) && (hasAdditionalCommand("rubocop") || hasAdditionalCommand("bundle"));
|
|
56265
57330
|
}
|
|
56266
57331
|
function detectAdditionalLinter(cwd) {
|
|
56267
57332
|
if (detectRuff(cwd))
|
|
@@ -56306,7 +57371,7 @@ async function runResolvedLint(command, mode, directory, abortSignal) {
|
|
|
56306
57371
|
error: "Command exceeds maximum allowed length"
|
|
56307
57372
|
};
|
|
56308
57373
|
}
|
|
56309
|
-
const runResult = await
|
|
57374
|
+
const runResult = await _internals75.runExternalTool({
|
|
56310
57375
|
executable: command.executable,
|
|
56311
57376
|
args: [...command.argsPrefix, ...lintArgs],
|
|
56312
57377
|
cwd: toAbsoluteDirectory(directory),
|
|
@@ -56384,7 +57449,7 @@ function getAdditionalLinterCommand(linter, mode, cwd) {
|
|
|
56384
57449
|
}
|
|
56385
57450
|
}
|
|
56386
57451
|
async function runLint(linter, mode, directory, abortSignal) {
|
|
56387
|
-
const resolved = await
|
|
57452
|
+
const resolved = await _internals75.resolveLinterCommand(linter, directory);
|
|
56388
57453
|
if (!resolved) {
|
|
56389
57454
|
return {
|
|
56390
57455
|
success: false,
|
|
@@ -56425,7 +57490,7 @@ async function runAdditionalLint(linter, mode, cwd, abortSignal) {
|
|
|
56425
57490
|
error: `No safely executable ${linter} command found`
|
|
56426
57491
|
};
|
|
56427
57492
|
}
|
|
56428
|
-
const runResult = await
|
|
57493
|
+
const runResult = await _internals75.runExternalTool({
|
|
56429
57494
|
executable,
|
|
56430
57495
|
args,
|
|
56431
57496
|
cwd: toAbsoluteDirectory(cwd),
|
|
@@ -56433,7 +57498,7 @@ async function runAdditionalLint(linter, mode, cwd, abortSignal) {
|
|
|
56433
57498
|
maxStdoutBytes: MAX_OUTPUT_BYTES2,
|
|
56434
57499
|
maxStderrBytes: MAX_OUTPUT_BYTES2,
|
|
56435
57500
|
abortSignal,
|
|
56436
|
-
windowsVerbatimArguments:
|
|
57501
|
+
windowsVerbatimArguments: _internals75.platform() === "win32" && path81.basename(executable).toLowerCase() === "cmd.exe"
|
|
56437
57502
|
});
|
|
56438
57503
|
if (runResult.status !== "completed") {
|
|
56439
57504
|
return buildExecutionError(mode, command, linter, runResult);
|
|
@@ -56480,15 +57545,15 @@ var lint = createSwarmTool({
|
|
|
56480
57545
|
}
|
|
56481
57546
|
const { mode } = args;
|
|
56482
57547
|
const cwd = directory;
|
|
56483
|
-
const resolvedLinter = await
|
|
57548
|
+
const resolvedLinter = await _internals75.detectResolvedLinter(directory, ctx?.abort);
|
|
56484
57549
|
if (resolvedLinter) {
|
|
56485
|
-
const result = await
|
|
57550
|
+
const result = await _internals75.runResolvedLint(resolvedLinter, mode, directory, ctx?.abort);
|
|
56486
57551
|
return JSON.stringify(result, null, 2);
|
|
56487
57552
|
}
|
|
56488
|
-
const additionalLinter =
|
|
57553
|
+
const additionalLinter = _internals75.detectAdditionalLinter(cwd);
|
|
56489
57554
|
if (additionalLinter) {
|
|
56490
57555
|
warn(`[lint] Using ${additionalLinter} linter for this project`);
|
|
56491
|
-
const result = await
|
|
57556
|
+
const result = await _internals75.runAdditionalLint(additionalLinter, mode, cwd, ctx?.abort);
|
|
56492
57557
|
return JSON.stringify(result, null, 2);
|
|
56493
57558
|
}
|
|
56494
57559
|
const errorResult = {
|
|
@@ -56502,7 +57567,7 @@ For Rust: rustup component add clippy`
|
|
|
56502
57567
|
return JSON.stringify(errorResult, null, 2);
|
|
56503
57568
|
}
|
|
56504
57569
|
});
|
|
56505
|
-
var
|
|
57570
|
+
var _internals75 = {
|
|
56506
57571
|
MAX_PACKAGE_MANIFEST_BYTES,
|
|
56507
57572
|
MAX_PATH_SHIM_BYTES,
|
|
56508
57573
|
arch: () => process.arch,
|
|
@@ -56906,14 +57971,14 @@ function readBoundedFile(filePath, expectedPathStat) {
|
|
|
56906
57971
|
let fd = null;
|
|
56907
57972
|
try {
|
|
56908
57973
|
const flags = fs33.constants.O_RDONLY | (O_NOFOLLOW !== undefined ? O_NOFOLLOW : 0);
|
|
56909
|
-
fd =
|
|
57974
|
+
fd = _internals76.openFile(filePath, flags);
|
|
56910
57975
|
} catch {
|
|
56911
57976
|
return { status: "incomplete", reason: "read_error" };
|
|
56912
57977
|
}
|
|
56913
57978
|
let outcome;
|
|
56914
57979
|
let closeFailed = false;
|
|
56915
57980
|
try {
|
|
56916
|
-
const stat9 =
|
|
57981
|
+
const stat9 = _internals76.fstatFile(fd);
|
|
56917
57982
|
const descriptorIdentity = getStableFileIdentity(stat9);
|
|
56918
57983
|
const initialSize = stat9.size;
|
|
56919
57984
|
if (!stat9.isFile()) {
|
|
@@ -56925,14 +57990,14 @@ function readBoundedFile(filePath, expectedPathStat) {
|
|
|
56925
57990
|
const buffer = Buffer.allocUnsafe(bufferLength);
|
|
56926
57991
|
let bytesRead = 0;
|
|
56927
57992
|
while (bytesRead < buffer.length) {
|
|
56928
|
-
const count =
|
|
57993
|
+
const count = _internals76.readFileChunk(fd, buffer, bytesRead, buffer.length - bytesRead, null);
|
|
56929
57994
|
if (count === 0)
|
|
56930
57995
|
break;
|
|
56931
57996
|
bytesRead += count;
|
|
56932
57997
|
}
|
|
56933
|
-
const postStat =
|
|
57998
|
+
const postStat = _internals76.fstatFile(fd);
|
|
56934
57999
|
const postDescriptorIdentity = getStableFileIdentity(postStat);
|
|
56935
|
-
const postPathStat =
|
|
58000
|
+
const postPathStat = _internals76.lstatFile(filePath);
|
|
56936
58001
|
const postPathIdentity = getStableFileIdentity(postPathStat);
|
|
56937
58002
|
if (!postStat.isFile() || postDescriptorIdentity === null || postDescriptorIdentity !== descriptorIdentity || postPathStat.isSymbolicLink() || !postPathStat.isFile() || postPathIdentity === null || postPathIdentity !== descriptorIdentity) {
|
|
56938
58003
|
outcome = { status: "incomplete", reason: "read_error" };
|
|
@@ -56954,7 +58019,7 @@ function readBoundedFile(filePath, expectedPathStat) {
|
|
|
56954
58019
|
} finally {
|
|
56955
58020
|
if (fd !== null) {
|
|
56956
58021
|
try {
|
|
56957
|
-
|
|
58022
|
+
_internals76.closeFile(fd);
|
|
56958
58023
|
} catch {
|
|
56959
58024
|
closeFailed = true;
|
|
56960
58025
|
}
|
|
@@ -56967,7 +58032,7 @@ function readBoundedFile(filePath, expectedPathStat) {
|
|
|
56967
58032
|
function scanFileForSecrets(filePath, mode) {
|
|
56968
58033
|
const findings = [];
|
|
56969
58034
|
try {
|
|
56970
|
-
const lstat3 =
|
|
58035
|
+
const lstat3 = _internals76.lstatFile(filePath);
|
|
56971
58036
|
if (lstat3.isSymbolicLink()) {
|
|
56972
58037
|
return mode === "explicit" ? { status: "incomplete", reason: "symlink" } : { status: "skipped", reason: "symlink" };
|
|
56973
58038
|
}
|
|
@@ -57146,8 +58211,8 @@ async function collectScannableFiles(dir, excludeExact, excludeGlobs, scanDir, v
|
|
|
57146
58211
|
while (true) {
|
|
57147
58212
|
if (state.entriesSinceYield >= DISCOVERY_YIELD_INTERVAL) {
|
|
57148
58213
|
state.entriesSinceYield = 0;
|
|
57149
|
-
await
|
|
57150
|
-
if (
|
|
58214
|
+
await _internals76.yieldToEventLoop();
|
|
58215
|
+
if (_internals76.now() >= state.deadline) {
|
|
57151
58216
|
state.deadlineExceeded = true;
|
|
57152
58217
|
recordIncompletePath(state.incompletePaths, scanDir, currentDir, "deadline");
|
|
57153
58218
|
stoppedEarly = true;
|
|
@@ -57210,7 +58275,7 @@ async function collectScannableFiles(dir, excludeExact, excludeGlobs, scanDir, v
|
|
|
57210
58275
|
}
|
|
57211
58276
|
} finally {
|
|
57212
58277
|
try {
|
|
57213
|
-
|
|
58278
|
+
_internals76.closeDirectory(directory);
|
|
57214
58279
|
} catch (error2) {
|
|
57215
58280
|
if (error2.code !== "ERR_DIR_CLOSED") {
|
|
57216
58281
|
state.cleanupFailed = true;
|
|
@@ -57332,7 +58397,7 @@ var secretscan = createSwarmTool({
|
|
|
57332
58397
|
symlinkSkipped: 0
|
|
57333
58398
|
};
|
|
57334
58399
|
const visited = new Set;
|
|
57335
|
-
const deadline =
|
|
58400
|
+
const deadline = _internals76.now() + SCAN_TIME_BUDGET_MS;
|
|
57336
58401
|
const discovery = {
|
|
57337
58402
|
files: [],
|
|
57338
58403
|
totalCandidates: 0,
|
|
@@ -57344,7 +58409,7 @@ var secretscan = createSwarmTool({
|
|
|
57344
58409
|
directoriesQueued: 1,
|
|
57345
58410
|
unexaminedDirectories: 0
|
|
57346
58411
|
};
|
|
57347
|
-
await
|
|
58412
|
+
await _internals76.yieldToEventLoop();
|
|
57348
58413
|
await collectScannableFiles(scanDir, excludeExact, excludeGlobs, scanDir, visited, stats, discovery);
|
|
57349
58414
|
const files = discovery.files;
|
|
57350
58415
|
files.sort(compareFilePaths);
|
|
@@ -57363,7 +58428,7 @@ var secretscan = createSwarmTool({
|
|
|
57363
58428
|
let skippedFiles = stats.skippedFiles;
|
|
57364
58429
|
let incompleteFiles = stats.fileErrors + Math.max(0, discovery.totalCandidates - filesToScan.length) + (discovery.deadlineExceeded || discovery.cleanupFailed ? 1 : 0) + discovery.unexaminedDirectories;
|
|
57365
58430
|
for (let index = 0;index < filesToScan.length; index++) {
|
|
57366
|
-
if (
|
|
58431
|
+
if (_internals76.now() >= deadline) {
|
|
57367
58432
|
for (const remaining of filesToScan.slice(index)) {
|
|
57368
58433
|
recordIncompletePath(discovery.incompletePaths, scanDir, remaining, "deadline");
|
|
57369
58434
|
}
|
|
@@ -57399,7 +58464,7 @@ var secretscan = createSwarmTool({
|
|
|
57399
58464
|
}
|
|
57400
58465
|
}
|
|
57401
58466
|
if (index + 1 < filesToScan.length) {
|
|
57402
|
-
await
|
|
58467
|
+
await _internals76.yieldToEventLoop();
|
|
57403
58468
|
}
|
|
57404
58469
|
}
|
|
57405
58470
|
allFindings.sort((a, b) => {
|
|
@@ -57462,7 +58527,7 @@ var secretscan = createSwarmTool({
|
|
|
57462
58527
|
});
|
|
57463
58528
|
async function runSecretscan(directory) {
|
|
57464
58529
|
try {
|
|
57465
|
-
const result = await
|
|
58530
|
+
const result = await _internals76.secretscan.execute({ directory }, {});
|
|
57466
58531
|
const jsonStr = typeof result === "string" ? result : result.output;
|
|
57467
58532
|
return JSON.parse(jsonStr);
|
|
57468
58533
|
} catch (e) {
|
|
@@ -57513,10 +58578,10 @@ async function runSecretscanOnFiles(files, directory) {
|
|
|
57513
58578
|
if (files.length > filesToScan.length) {
|
|
57514
58579
|
recordIncompletePath(incompletePaths, canonicalRoot, canonicalRoot, "max_files");
|
|
57515
58580
|
}
|
|
57516
|
-
const deadline =
|
|
57517
|
-
await
|
|
58581
|
+
const deadline = _internals76.now() + SCAN_TIME_BUDGET_MS;
|
|
58582
|
+
await _internals76.yieldToEventLoop();
|
|
57518
58583
|
for (let index = 0;index < filesToScan.length; index++) {
|
|
57519
|
-
if (
|
|
58584
|
+
if (_internals76.now() >= deadline) {
|
|
57520
58585
|
for (const remaining of filesToScan.slice(index)) {
|
|
57521
58586
|
const remainingPath = path82.isAbsolute(remaining) ? path82.resolve(remaining) : path82.resolve(rawRoot, remaining);
|
|
57522
58587
|
recordIncompletePath(incompletePaths, canonicalRoot, remainingPath, "deadline");
|
|
@@ -57543,7 +58608,7 @@ async function runSecretscanOnFiles(files, directory) {
|
|
|
57543
58608
|
}
|
|
57544
58609
|
let lstat3;
|
|
57545
58610
|
try {
|
|
57546
|
-
lstat3 =
|
|
58611
|
+
lstat3 = _internals76.lstatFile(resolvedPath);
|
|
57547
58612
|
} catch (error2) {
|
|
57548
58613
|
const err = error2;
|
|
57549
58614
|
if (err.code === "ENOENT") {
|
|
@@ -57612,7 +58677,7 @@ async function runSecretscanOnFiles(files, directory) {
|
|
|
57612
58677
|
assertNever(outcome);
|
|
57613
58678
|
}
|
|
57614
58679
|
if (index + 1 < filesToScan.length) {
|
|
57615
|
-
await
|
|
58680
|
+
await _internals76.yieldToEventLoop();
|
|
57616
58681
|
}
|
|
57617
58682
|
}
|
|
57618
58683
|
findings.sort((a, b) => {
|
|
@@ -57642,7 +58707,7 @@ async function runSecretscanOnFiles(files, directory) {
|
|
|
57642
58707
|
};
|
|
57643
58708
|
}
|
|
57644
58709
|
}
|
|
57645
|
-
var
|
|
58710
|
+
var _internals76 = {
|
|
57646
58711
|
secretscan,
|
|
57647
58712
|
runSecretscan,
|
|
57648
58713
|
runSecretscanOnFiles,
|
|
@@ -57926,7 +58991,7 @@ async function buildImpactMapInternal(cwd) {
|
|
|
57926
58991
|
}
|
|
57927
58992
|
return impactMap;
|
|
57928
58993
|
}
|
|
57929
|
-
var
|
|
58994
|
+
var _internals77 = {
|
|
57930
58995
|
validateProjectRoot,
|
|
57931
58996
|
normalizePath: normalizePath2,
|
|
57932
58997
|
isCacheStale,
|
|
@@ -57941,8 +59006,8 @@ var _internals76 = {
|
|
|
57941
59006
|
_clearGoModuleCache
|
|
57942
59007
|
};
|
|
57943
59008
|
async function buildImpactMap(cwd) {
|
|
57944
|
-
const impactMap = await
|
|
57945
|
-
await
|
|
59009
|
+
const impactMap = await _internals77.buildImpactMapInternal(cwd);
|
|
59010
|
+
await _internals77.saveImpactMap(cwd, impactMap);
|
|
57946
59011
|
return impactMap;
|
|
57947
59012
|
}
|
|
57948
59013
|
async function loadImpactMap(cwd, options) {
|
|
@@ -57956,7 +59021,7 @@ async function loadImpactMap(cwd, options) {
|
|
|
57956
59021
|
const hasValidValues = Object.values(map).every((v) => Array.isArray(v) && v.every((item) => typeof item === "string"));
|
|
57957
59022
|
if (hasValidValues) {
|
|
57958
59023
|
const generatedAt = new Date(data.generatedAt).getTime();
|
|
57959
|
-
if (!
|
|
59024
|
+
if (!_internals77.isCacheStale(map, generatedAt)) {
|
|
57960
59025
|
return map;
|
|
57961
59026
|
}
|
|
57962
59027
|
if (options?.skipRebuild) {
|
|
@@ -57976,13 +59041,13 @@ async function loadImpactMap(cwd, options) {
|
|
|
57976
59041
|
if (options?.skipRebuild) {
|
|
57977
59042
|
return {};
|
|
57978
59043
|
}
|
|
57979
|
-
return
|
|
59044
|
+
return _internals77.buildImpactMap(cwd);
|
|
57980
59045
|
}
|
|
57981
59046
|
async function saveImpactMap(cwd, impactMap) {
|
|
57982
59047
|
if (!path83.isAbsolute(cwd)) {
|
|
57983
59048
|
throw new Error(`saveImpactMap requires an absolute project root path, got: "${cwd}"`);
|
|
57984
59049
|
}
|
|
57985
|
-
|
|
59050
|
+
_internals77.validateProjectRoot(cwd);
|
|
57986
59051
|
const cacheDir2 = path83.join(cwd, ".swarm", "cache");
|
|
57987
59052
|
const cachePath = path83.join(cacheDir2, "impact-map.json");
|
|
57988
59053
|
if (!fs34.existsSync(cacheDir2)) {
|
|
@@ -58006,7 +59071,7 @@ async function analyzeImpact(changedFiles, cwd, budget) {
|
|
|
58006
59071
|
};
|
|
58007
59072
|
}
|
|
58008
59073
|
const validFiles = changedFiles.filter((f) => typeof f === "string" && f.length > 0 && !f.includes("\x00"));
|
|
58009
|
-
const impactMap = await
|
|
59074
|
+
const impactMap = await _internals77.loadImpactMap(cwd);
|
|
58010
59075
|
const impactedTestsSet = new Set;
|
|
58011
59076
|
const untestedFiles = [];
|
|
58012
59077
|
let visitedCount = 0;
|
|
@@ -58283,7 +59348,7 @@ function batchAppendTestRuns(records, workingDir) {
|
|
|
58283
59348
|
}
|
|
58284
59349
|
const historyPath = getHistoryPath(workingDir);
|
|
58285
59350
|
const historyDir = path84.dirname(historyPath);
|
|
58286
|
-
|
|
59351
|
+
_internals78.validateProjectRoot(workingDir);
|
|
58287
59352
|
if (!fs35.existsSync(historyDir)) {
|
|
58288
59353
|
fs35.mkdirSync(historyDir, { recursive: true });
|
|
58289
59354
|
}
|
|
@@ -58406,7 +59471,7 @@ function getAllHistory(workingDir) {
|
|
|
58406
59471
|
records.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
|
|
58407
59472
|
return records;
|
|
58408
59473
|
}
|
|
58409
|
-
var
|
|
59474
|
+
var _internals78 = {
|
|
58410
59475
|
validateProjectRoot
|
|
58411
59476
|
};
|
|
58412
59477
|
|
|
@@ -58419,7 +59484,7 @@ var MAX_SAFE_TEST_FILES = 50;
|
|
|
58419
59484
|
var MAX_SAFE_SOURCE_FILES = 1;
|
|
58420
59485
|
async function estimateFanOut(sourceFiles, cwd) {
|
|
58421
59486
|
try {
|
|
58422
|
-
const impactMap = await
|
|
59487
|
+
const impactMap = await _internals79.loadImpactMap(cwd, {
|
|
58423
59488
|
skipRebuild: true
|
|
58424
59489
|
});
|
|
58425
59490
|
const uniqueTestFiles = new Set;
|
|
@@ -58590,7 +59655,7 @@ function resolveNativeTarget(target, workingDir) {
|
|
|
58590
59655
|
if (relative14.startsWith("..") || path85.isAbsolute(relative14)) {
|
|
58591
59656
|
return { success: false, error: "Native target path escapes project root" };
|
|
58592
59657
|
}
|
|
58593
|
-
if (!
|
|
59658
|
+
if (!_internals79.isCommandAvailable(target.framework === "go-test" ? "go" : "ctest")) {
|
|
58594
59659
|
return {
|
|
58595
59660
|
success: false,
|
|
58596
59661
|
error: `Native target framework "${target.framework}" is unavailable`
|
|
@@ -58651,45 +59716,45 @@ function hasDevDependency(devDeps, ...patterns) {
|
|
|
58651
59716
|
return hasPackageJsonDependency(devDeps, ...patterns);
|
|
58652
59717
|
}
|
|
58653
59718
|
function detectGoTest(cwd) {
|
|
58654
|
-
return
|
|
59719
|
+
return _internals79.existsSync(path85.join(cwd, "go.mod")) && _internals79.isCommandAvailable("go");
|
|
58655
59720
|
}
|
|
58656
59721
|
function detectJavaMaven(cwd) {
|
|
58657
|
-
return
|
|
59722
|
+
return _internals79.existsSync(path85.join(cwd, "pom.xml")) && _internals79.isCommandAvailable("mvn");
|
|
58658
59723
|
}
|
|
58659
59724
|
function detectGradle(cwd) {
|
|
58660
|
-
const hasBuildFile =
|
|
58661
|
-
const hasGradlew =
|
|
58662
|
-
return hasBuildFile && (hasGradlew ||
|
|
59725
|
+
const hasBuildFile = _internals79.existsSync(path85.join(cwd, "build.gradle")) || _internals79.existsSync(path85.join(cwd, "build.gradle.kts"));
|
|
59726
|
+
const hasGradlew = _internals79.existsSync(path85.join(cwd, "gradlew")) || _internals79.existsSync(path85.join(cwd, "gradlew.bat"));
|
|
59727
|
+
return hasBuildFile && (hasGradlew || _internals79.isCommandAvailable("gradle"));
|
|
58663
59728
|
}
|
|
58664
59729
|
function detectDotnetTest(cwd) {
|
|
58665
59730
|
try {
|
|
58666
|
-
const files =
|
|
59731
|
+
const files = _internals79.readdirSync(cwd);
|
|
58667
59732
|
const hasCsproj = files.some((f) => f.endsWith(".csproj"));
|
|
58668
|
-
return hasCsproj &&
|
|
59733
|
+
return hasCsproj && _internals79.isCommandAvailable("dotnet");
|
|
58669
59734
|
} catch {
|
|
58670
59735
|
return false;
|
|
58671
59736
|
}
|
|
58672
59737
|
}
|
|
58673
59738
|
function detectCTest(cwd) {
|
|
58674
|
-
const hasSource =
|
|
58675
|
-
const hasBuildCache =
|
|
58676
|
-
return (hasSource || hasBuildCache) &&
|
|
59739
|
+
const hasSource = _internals79.existsSync(path85.join(cwd, "CMakeLists.txt"));
|
|
59740
|
+
const hasBuildCache = _internals79.existsSync(path85.join(cwd, "CMakeCache.txt")) || _internals79.existsSync(path85.join(cwd, "build", "CMakeCache.txt"));
|
|
59741
|
+
return (hasSource || hasBuildCache) && _internals79.isCommandAvailable("ctest");
|
|
58677
59742
|
}
|
|
58678
59743
|
function detectSwiftTest(cwd) {
|
|
58679
|
-
return
|
|
59744
|
+
return _internals79.existsSync(path85.join(cwd, "Package.swift")) && _internals79.isCommandAvailable("swift");
|
|
58680
59745
|
}
|
|
58681
59746
|
function detectDartTest(cwd) {
|
|
58682
|
-
return
|
|
59747
|
+
return _internals79.existsSync(path85.join(cwd, "pubspec.yaml")) && (_internals79.isCommandAvailable("dart") || _internals79.isCommandAvailable("flutter"));
|
|
58683
59748
|
}
|
|
58684
59749
|
function detectRSpec(cwd) {
|
|
58685
|
-
const hasRSpecFile =
|
|
58686
|
-
const hasGemfile =
|
|
58687
|
-
const hasSpecDir =
|
|
59750
|
+
const hasRSpecFile = _internals79.existsSync(path85.join(cwd, ".rspec"));
|
|
59751
|
+
const hasGemfile = _internals79.existsSync(path85.join(cwd, "Gemfile"));
|
|
59752
|
+
const hasSpecDir = _internals79.existsSync(path85.join(cwd, "spec"));
|
|
58688
59753
|
const hasRSpec = hasRSpecFile || hasGemfile && hasSpecDir;
|
|
58689
|
-
return hasRSpec && (
|
|
59754
|
+
return hasRSpec && (_internals79.isCommandAvailable("bundle") || _internals79.isCommandAvailable("rspec"));
|
|
58690
59755
|
}
|
|
58691
59756
|
function detectMinitest(cwd) {
|
|
58692
|
-
return
|
|
59757
|
+
return _internals79.existsSync(path85.join(cwd, "test")) && (_internals79.existsSync(path85.join(cwd, "Gemfile")) || _internals79.existsSync(path85.join(cwd, "Rakefile"))) && _internals79.isCommandAvailable("ruby");
|
|
58693
59758
|
}
|
|
58694
59759
|
var DISPATCH_FRAMEWORK_MAP = {
|
|
58695
59760
|
bun: "bun",
|
|
@@ -58782,8 +59847,8 @@ async function detectTestFramework(cwd) {
|
|
|
58782
59847
|
const baseDir = cwd;
|
|
58783
59848
|
try {
|
|
58784
59849
|
const packageJsonPath = path85.join(baseDir, "package.json");
|
|
58785
|
-
if (
|
|
58786
|
-
const content =
|
|
59850
|
+
if (_internals79.existsSync(packageJsonPath)) {
|
|
59851
|
+
const content = _internals79.readFileSync(packageJsonPath, "utf-8");
|
|
58787
59852
|
const pkg = JSON.parse(content);
|
|
58788
59853
|
const _deps = pkg.dependencies || {};
|
|
58789
59854
|
const devDeps = pkg.devDependencies || {};
|
|
@@ -58802,7 +59867,7 @@ async function detectTestFramework(cwd) {
|
|
|
58802
59867
|
return "jest";
|
|
58803
59868
|
if (hasDevDependency(devDeps, "mocha", "@types/mocha"))
|
|
58804
59869
|
return "mocha";
|
|
58805
|
-
if (
|
|
59870
|
+
if (_internals79.existsSync(path85.join(baseDir, "bun.lockb")) || _internals79.existsSync(path85.join(baseDir, "bun.lock"))) {
|
|
58806
59871
|
if (scripts.test?.includes("bun"))
|
|
58807
59872
|
return "bun";
|
|
58808
59873
|
}
|
|
@@ -58812,28 +59877,28 @@ async function detectTestFramework(cwd) {
|
|
|
58812
59877
|
const pyprojectTomlPath = path85.join(baseDir, "pyproject.toml");
|
|
58813
59878
|
const setupCfgPath = path85.join(baseDir, "setup.cfg");
|
|
58814
59879
|
const requirementsTxtPath = path85.join(baseDir, "requirements.txt");
|
|
58815
|
-
if (
|
|
58816
|
-
const content =
|
|
59880
|
+
if (_internals79.existsSync(pyprojectTomlPath)) {
|
|
59881
|
+
const content = _internals79.readFileSync(pyprojectTomlPath, "utf-8");
|
|
58817
59882
|
if (content.includes("[tool.pytest"))
|
|
58818
59883
|
return "pytest";
|
|
58819
59884
|
if (content.includes("pytest"))
|
|
58820
59885
|
return "pytest";
|
|
58821
59886
|
}
|
|
58822
|
-
if (
|
|
58823
|
-
const content =
|
|
59887
|
+
if (_internals79.existsSync(setupCfgPath)) {
|
|
59888
|
+
const content = _internals79.readFileSync(setupCfgPath, "utf-8");
|
|
58824
59889
|
if (content.includes("[pytest]"))
|
|
58825
59890
|
return "pytest";
|
|
58826
59891
|
}
|
|
58827
|
-
if (
|
|
58828
|
-
const content =
|
|
59892
|
+
if (_internals79.existsSync(requirementsTxtPath)) {
|
|
59893
|
+
const content = _internals79.readFileSync(requirementsTxtPath, "utf-8");
|
|
58829
59894
|
if (content.includes("pytest"))
|
|
58830
59895
|
return "pytest";
|
|
58831
59896
|
}
|
|
58832
59897
|
} catch {}
|
|
58833
59898
|
try {
|
|
58834
59899
|
const cargoTomlPath = path85.join(baseDir, "Cargo.toml");
|
|
58835
|
-
if (
|
|
58836
|
-
const content =
|
|
59900
|
+
if (_internals79.existsSync(cargoTomlPath)) {
|
|
59901
|
+
const content = _internals79.readFileSync(cargoTomlPath, "utf-8");
|
|
58837
59902
|
if (content.includes("[dev-dependencies]")) {
|
|
58838
59903
|
if (content.includes("tokio") || content.includes("mockall") || content.includes("pretty_assertions")) {
|
|
58839
59904
|
return "cargo";
|
|
@@ -58845,7 +59910,7 @@ async function detectTestFramework(cwd) {
|
|
|
58845
59910
|
const pesterConfigPath = path85.join(baseDir, "pester.config.ps1");
|
|
58846
59911
|
const pesterConfigJsonPath = path85.join(baseDir, "pester.config.ps1.json");
|
|
58847
59912
|
const pesterPs1Path = path85.join(baseDir, "tests.ps1");
|
|
58848
|
-
if (
|
|
59913
|
+
if (_internals79.existsSync(pesterConfigPath) || _internals79.existsSync(pesterConfigJsonPath) || _internals79.existsSync(pesterPs1Path)) {
|
|
58849
59914
|
return "pester";
|
|
58850
59915
|
}
|
|
58851
59916
|
} catch {}
|
|
@@ -58873,12 +59938,12 @@ async function detectTestFramework(cwd) {
|
|
|
58873
59938
|
return "none";
|
|
58874
59939
|
}
|
|
58875
59940
|
function detectPhpTest(cwd) {
|
|
58876
|
-
if (
|
|
59941
|
+
if (_internals79.existsSync(path85.join(cwd, "artisan")) && _internals79.existsSync(path85.join(cwd, "composer.json"))) {
|
|
58877
59942
|
return "php-artisan";
|
|
58878
59943
|
}
|
|
58879
|
-
if (
|
|
59944
|
+
if (_internals79.existsSync(path85.join(cwd, "Pest.php")))
|
|
58880
59945
|
return "pest";
|
|
58881
|
-
if (
|
|
59946
|
+
if (_internals79.existsSync(path85.join(cwd, "phpunit.xml")) || _internals79.existsSync(path85.join(cwd, "phpunit.xml.dist"))) {
|
|
58882
59947
|
return "phpunit";
|
|
58883
59948
|
}
|
|
58884
59949
|
return null;
|
|
@@ -59301,9 +60366,9 @@ function buildTestCommand(framework, scope, files, coverage, baseDir, bail, targ
|
|
|
59301
60366
|
return args;
|
|
59302
60367
|
}
|
|
59303
60368
|
case "dart-test":
|
|
59304
|
-
return
|
|
60369
|
+
return _internals79.isCommandAvailable("flutter") ? ["flutter", "test", ...files] : ["dart", "test", ...files];
|
|
59305
60370
|
case "rspec": {
|
|
59306
|
-
const args =
|
|
60371
|
+
const args = _internals79.isCommandAvailable("bundle") ? ["bundle", "exec", "rspec"] : ["rspec"];
|
|
59307
60372
|
if (bail)
|
|
59308
60373
|
args.push("--fail-fast");
|
|
59309
60374
|
if (scope !== "all" && files.length > 0) {
|
|
@@ -59850,7 +60915,7 @@ async function runTests(framework, scope, files, coverage, timeout_ms, cwd, bail
|
|
|
59850
60915
|
resolve30({ kind: "timeout" });
|
|
59851
60916
|
}, timeout_ms);
|
|
59852
60917
|
});
|
|
59853
|
-
proc =
|
|
60918
|
+
proc = _internals79.bunSpawn(command, {
|
|
59854
60919
|
stdin: "ignore",
|
|
59855
60920
|
stdout: "pipe",
|
|
59856
60921
|
stderr: "pipe",
|
|
@@ -60445,7 +61510,7 @@ var test_runner = createSwarmTool({
|
|
|
60445
61510
|
return JSON.stringify(errorResult, null, 2);
|
|
60446
61511
|
}
|
|
60447
61512
|
try {
|
|
60448
|
-
const impactResult = await
|
|
61513
|
+
const impactResult = await _internals79.analyzeImpact(sourceFiles, workingDir, MAX_SAFE_TEST_FILES);
|
|
60449
61514
|
if (impactResult.budgetExceeded) {
|
|
60450
61515
|
const errorResult = {
|
|
60451
61516
|
success: false,
|
|
@@ -60536,7 +61601,7 @@ var test_runner = createSwarmTool({
|
|
|
60536
61601
|
return JSON.stringify(result, null, 2);
|
|
60537
61602
|
}
|
|
60538
61603
|
});
|
|
60539
|
-
var
|
|
61604
|
+
var _internals79 = {
|
|
60540
61605
|
analyzeImpact,
|
|
60541
61606
|
loadImpactMap,
|
|
60542
61607
|
isCommandAvailable,
|
|
@@ -60641,9 +61706,9 @@ function getVersionFileVersion(dir) {
|
|
|
60641
61706
|
async function runVersionCheck(dir, _timeoutMs) {
|
|
60642
61707
|
const startTime = Date.now();
|
|
60643
61708
|
try {
|
|
60644
|
-
const packageVersion =
|
|
60645
|
-
const changelogVersion =
|
|
60646
|
-
const versionFileVersion =
|
|
61709
|
+
const packageVersion = _internals80.getPackageVersion(dir);
|
|
61710
|
+
const changelogVersion = _internals80.getChangelogVersion(dir);
|
|
61711
|
+
const versionFileVersion = _internals80.getVersionFileVersion(dir);
|
|
60647
61712
|
const versions = [];
|
|
60648
61713
|
if (packageVersion)
|
|
60649
61714
|
versions.push(`package.json: ${packageVersion}`);
|
|
@@ -60832,7 +61897,7 @@ async function runTestsCheck(_dir, scope, timeoutMs) {
|
|
|
60832
61897
|
async function runSecretsCheck(dir, timeoutMs) {
|
|
60833
61898
|
const startTime = Date.now();
|
|
60834
61899
|
try {
|
|
60835
|
-
const secretsPromise =
|
|
61900
|
+
const secretsPromise = _internals80.runSecretscan(dir);
|
|
60836
61901
|
const timeoutPromise = new Promise((_, reject) => {
|
|
60837
61902
|
setTimeout(() => {
|
|
60838
61903
|
reject(new Error(`Secrets check timed out after ${timeoutMs}ms`));
|
|
@@ -61199,7 +62264,7 @@ async function runPreflight(dir, phase, config) {
|
|
|
61199
62264
|
const reportId = `preflight-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
61200
62265
|
let validatedDir;
|
|
61201
62266
|
try {
|
|
61202
|
-
validatedDir =
|
|
62267
|
+
validatedDir = _internals80.validateDirectoryPath(dir);
|
|
61203
62268
|
} catch (error2) {
|
|
61204
62269
|
return {
|
|
61205
62270
|
id: reportId,
|
|
@@ -61219,7 +62284,7 @@ async function runPreflight(dir, phase, config) {
|
|
|
61219
62284
|
}
|
|
61220
62285
|
let validatedTimeout;
|
|
61221
62286
|
try {
|
|
61222
|
-
validatedTimeout =
|
|
62287
|
+
validatedTimeout = _internals80.validateTimeout(config?.checkTimeoutMs, DEFAULT_CONFIG.checkTimeoutMs);
|
|
61223
62288
|
} catch (error2) {
|
|
61224
62289
|
return {
|
|
61225
62290
|
id: reportId,
|
|
@@ -61260,12 +62325,12 @@ async function runPreflight(dir, phase, config) {
|
|
|
61260
62325
|
});
|
|
61261
62326
|
const checks = [];
|
|
61262
62327
|
log("[Preflight] Running lint check...");
|
|
61263
|
-
const lintResult = await
|
|
62328
|
+
const lintResult = await _internals80.runLintCheck(validatedDir, cfg.linter, cfg.checkTimeoutMs);
|
|
61264
62329
|
checks.push(lintResult);
|
|
61265
62330
|
log(`[Preflight] Lint check: ${lintResult.status} ${lintResult.message}`);
|
|
61266
62331
|
if (!cfg.skipTests) {
|
|
61267
62332
|
log("[Preflight] Running tests check...");
|
|
61268
|
-
const testsResult = await
|
|
62333
|
+
const testsResult = await _internals80.runTestsCheck(validatedDir, cfg.testScope, cfg.checkTimeoutMs);
|
|
61269
62334
|
checks.push(testsResult);
|
|
61270
62335
|
log(`[Preflight] Tests check: ${testsResult.status} ${testsResult.message}`);
|
|
61271
62336
|
} else {
|
|
@@ -61277,7 +62342,7 @@ async function runPreflight(dir, phase, config) {
|
|
|
61277
62342
|
}
|
|
61278
62343
|
if (!cfg.skipSecrets) {
|
|
61279
62344
|
log("[Preflight] Running secrets check...");
|
|
61280
|
-
const secretsResult = await
|
|
62345
|
+
const secretsResult = await _internals80.runSecretsCheck(validatedDir, cfg.checkTimeoutMs);
|
|
61281
62346
|
checks.push(secretsResult);
|
|
61282
62347
|
log(`[Preflight] Secrets check: ${secretsResult.status} ${secretsResult.message}`);
|
|
61283
62348
|
} else {
|
|
@@ -61289,7 +62354,7 @@ async function runPreflight(dir, phase, config) {
|
|
|
61289
62354
|
}
|
|
61290
62355
|
if (!cfg.skipEvidence) {
|
|
61291
62356
|
log("[Preflight] Running evidence check...");
|
|
61292
|
-
const evidenceResult = await
|
|
62357
|
+
const evidenceResult = await _internals80.runEvidenceCheck(validatedDir);
|
|
61293
62358
|
checks.push(evidenceResult);
|
|
61294
62359
|
log(`[Preflight] Evidence check: ${evidenceResult.status} ${evidenceResult.message}`);
|
|
61295
62360
|
} else {
|
|
@@ -61300,12 +62365,12 @@ async function runPreflight(dir, phase, config) {
|
|
|
61300
62365
|
});
|
|
61301
62366
|
}
|
|
61302
62367
|
log("[Preflight] Running requirement coverage check...");
|
|
61303
|
-
const reqCoverageResult = await
|
|
62368
|
+
const reqCoverageResult = await _internals80.runRequirementCoverageCheck(validatedDir, phase);
|
|
61304
62369
|
checks.push(reqCoverageResult);
|
|
61305
62370
|
log(`[Preflight] Requirement coverage check: ${reqCoverageResult.status} ${reqCoverageResult.message}`);
|
|
61306
62371
|
if (!cfg.skipVersion) {
|
|
61307
62372
|
log("[Preflight] Running version check...");
|
|
61308
|
-
const versionResult = await
|
|
62373
|
+
const versionResult = await _internals80.runVersionCheck(validatedDir, cfg.checkTimeoutMs);
|
|
61309
62374
|
checks.push(versionResult);
|
|
61310
62375
|
log(`[Preflight] Version check: ${versionResult.status} ${versionResult.message}`);
|
|
61311
62376
|
} else {
|
|
@@ -61368,10 +62433,10 @@ function formatPreflightMarkdown(report) {
|
|
|
61368
62433
|
async function handlePreflightCommand(directory, _args) {
|
|
61369
62434
|
const plan = await loadPlan(directory);
|
|
61370
62435
|
const phase = plan?.current_phase ?? 1;
|
|
61371
|
-
const report = await
|
|
61372
|
-
return
|
|
62436
|
+
const report = await _internals80.runPreflight(directory, phase);
|
|
62437
|
+
return _internals80.formatPreflightMarkdown(report);
|
|
61373
62438
|
}
|
|
61374
|
-
var
|
|
62439
|
+
var _internals80 = {
|
|
61375
62440
|
runPreflight,
|
|
61376
62441
|
formatPreflightMarkdown,
|
|
61377
62442
|
handlePreflightCommand,
|
|
@@ -62655,7 +63720,7 @@ function pruneOldResetBackups(backupsRoot, warnings) {
|
|
|
62655
63720
|
}
|
|
62656
63721
|
|
|
62657
63722
|
// src/commands/reset.ts
|
|
62658
|
-
var
|
|
63723
|
+
var _internals81 = {
|
|
62659
63724
|
backupSwarmStateBeforeReset
|
|
62660
63725
|
};
|
|
62661
63726
|
async function handleResetCommand(directory, args) {
|
|
@@ -62695,7 +63760,7 @@ async function handleResetCommand(directory, args) {
|
|
|
62695
63760
|
];
|
|
62696
63761
|
const results = [];
|
|
62697
63762
|
try {
|
|
62698
|
-
const backup =
|
|
63763
|
+
const backup = _internals81.backupSwarmStateBeforeReset(directory, "reset", [
|
|
62699
63764
|
...filesToReset,
|
|
62700
63765
|
"summaries"
|
|
62701
63766
|
]);
|
|
@@ -62837,7 +63902,7 @@ function clearTrajectoryStep(sessionId) {
|
|
|
62837
63902
|
}
|
|
62838
63903
|
|
|
62839
63904
|
// src/commands/reset-session.ts
|
|
62840
|
-
var
|
|
63905
|
+
var _internals82 = {
|
|
62841
63906
|
cleanupOrphanedBranches,
|
|
62842
63907
|
backupSwarmStateBeforeReset,
|
|
62843
63908
|
recoverStaleCoderSettlements
|
|
@@ -62850,7 +63915,7 @@ function errorMessage(err) {
|
|
|
62850
63915
|
async function handleResetSessionCommand(directory, _args) {
|
|
62851
63916
|
const results = [];
|
|
62852
63917
|
try {
|
|
62853
|
-
const backup =
|
|
63918
|
+
const backup = _internals82.backupSwarmStateBeforeReset(directory, "reset-session", ["session"]);
|
|
62854
63919
|
if (backup.backupDir && backup.copied.length > 0) {
|
|
62855
63920
|
const rel = path89.relative(directory, backup.backupDir);
|
|
62856
63921
|
results.push(`\uD83D\uDCE6 Backed up session state to ${rel}/ (restore by copying files back into .swarm/session/)`);
|
|
@@ -62912,7 +63977,7 @@ async function handleResetSessionCommand(directory, _args) {
|
|
|
62912
63977
|
results.push(`\u2705 Cleared ${activeAgentCount} active-agent mapping(s)`);
|
|
62913
63978
|
let preserveWorktrees = false;
|
|
62914
63979
|
try {
|
|
62915
|
-
const { results: settlementResults, truncated } = await
|
|
63980
|
+
const { results: settlementResults, truncated } = await _internals82.recoverStaleCoderSettlements(directory, {
|
|
62916
63981
|
force: true
|
|
62917
63982
|
});
|
|
62918
63983
|
if (settlementResults.length === 0) {
|
|
@@ -62972,7 +64037,7 @@ async function handleResetSessionCommand(directory, _args) {
|
|
|
62972
64037
|
results.push(`\u26A0\uFE0F Failed to remove .swarm-worktrees/: ${errorMessage(err)}`);
|
|
62973
64038
|
}
|
|
62974
64039
|
try {
|
|
62975
|
-
const branchResult = await
|
|
64040
|
+
const branchResult = await _internals82.cleanupOrphanedBranches(directory, []);
|
|
62976
64041
|
if (branchResult.removed.length > 0) {
|
|
62977
64042
|
results.push(`\u2705 Removed ${branchResult.removed.length} orphan swarm-lane branch(es)`);
|
|
62978
64043
|
}
|
|
@@ -63367,8 +64432,8 @@ async function runGit2(directory, args, options) {
|
|
|
63367
64432
|
};
|
|
63368
64433
|
let proc;
|
|
63369
64434
|
try {
|
|
63370
|
-
const gitExecutable = await
|
|
63371
|
-
proc =
|
|
64435
|
+
const gitExecutable = await _internals83.resolveGitExecutable();
|
|
64436
|
+
proc = _internals83.bunSpawn([gitExecutable, "-c", "core.quotepath=false", ...args], spawnOptions);
|
|
63372
64437
|
} catch (error2) {
|
|
63373
64438
|
return {
|
|
63374
64439
|
ok: false,
|
|
@@ -63451,8 +64516,8 @@ function sameCanonicalDirectory(left, right) {
|
|
|
63451
64516
|
if (samePath(left, right))
|
|
63452
64517
|
return true;
|
|
63453
64518
|
try {
|
|
63454
|
-
const leftStat =
|
|
63455
|
-
const rightStat =
|
|
64519
|
+
const leftStat = _internals83.lstatBigIntSync(left);
|
|
64520
|
+
const rightStat = _internals83.lstatBigIntSync(right);
|
|
63456
64521
|
return leftStat.isDirectory() && rightStat.isDirectory() && !leftStat.isSymbolicLink() && !rightStat.isSymbolicLink() && (leftStat.dev !== 0n || leftStat.ino !== 0n) && sameFileIdentity(leftStat, rightStat);
|
|
63457
64522
|
} catch {
|
|
63458
64523
|
return false;
|
|
@@ -63557,18 +64622,18 @@ function hashWorkingTreeIdentity(root, rawPath, budget) {
|
|
|
63557
64622
|
}
|
|
63558
64623
|
});
|
|
63559
64624
|
try {
|
|
63560
|
-
if (
|
|
64625
|
+
if (_internals83.now() > budget.deadlineMs) {
|
|
63561
64626
|
return deadlineExceeded("working-tree content identity deadline expired before file hashing started");
|
|
63562
64627
|
}
|
|
63563
|
-
const pathStat =
|
|
64628
|
+
const pathStat = _internals83.lstatBigIntSync(candidate);
|
|
63564
64629
|
if (!pathStat.isFile() || pathStat.isSymbolicLink())
|
|
63565
64630
|
return { identity: null };
|
|
63566
|
-
const canonicalBeforeOpen =
|
|
64631
|
+
const canonicalBeforeOpen = _internals83.realpathSync(candidate);
|
|
63567
64632
|
if (!isContained(root, canonicalBeforeOpen))
|
|
63568
64633
|
return { identity: null };
|
|
63569
|
-
handle =
|
|
63570
|
-
const openedBeforeRead =
|
|
63571
|
-
const canonicalAfterOpen =
|
|
64634
|
+
handle = _internals83.openSync(canonicalBeforeOpen, "r");
|
|
64635
|
+
const openedBeforeRead = _internals83.fstatBigIntSync(handle);
|
|
64636
|
+
const canonicalAfterOpen = _internals83.realpathSync(candidate);
|
|
63572
64637
|
if (!openedBeforeRead.isFile() || !compareStats(pathStat, openedBeforeRead) || !samePath(canonicalBeforeOpen, canonicalAfterOpen) || !isContained(root, canonicalAfterOpen)) {
|
|
63573
64638
|
return { identity: null };
|
|
63574
64639
|
}
|
|
@@ -63586,17 +64651,17 @@ function hashWorkingTreeIdentity(root, rawPath, budget) {
|
|
|
63586
64651
|
const buffer = Buffer.alloc(64 * 1024);
|
|
63587
64652
|
let offset = 0;
|
|
63588
64653
|
while (offset < fileBytes) {
|
|
63589
|
-
if (
|
|
64654
|
+
if (_internals83.now() > budget.deadlineMs) {
|
|
63590
64655
|
return deadlineExceeded("working-tree content identity deadline expired while hashing file content");
|
|
63591
64656
|
}
|
|
63592
|
-
const read =
|
|
64657
|
+
const read = _internals83.readSync(handle, buffer, 0, Math.min(buffer.byteLength, fileBytes - offset), offset);
|
|
63593
64658
|
if (read === 0)
|
|
63594
64659
|
break;
|
|
63595
64660
|
hash2.update(buffer.subarray(0, read));
|
|
63596
64661
|
offset += read;
|
|
63597
64662
|
}
|
|
63598
|
-
const openedAfterRead =
|
|
63599
|
-
const canonicalAfterRead =
|
|
64663
|
+
const openedAfterRead = _internals83.fstatBigIntSync(handle);
|
|
64664
|
+
const canonicalAfterRead = _internals83.realpathSync(candidate);
|
|
63600
64665
|
if (!compareStats(openedBeforeRead, openedAfterRead) || !samePath(canonicalBeforeOpen, canonicalAfterRead) || !isContained(root, canonicalAfterRead) || offset !== fileBytes) {
|
|
63601
64666
|
return { identity: null };
|
|
63602
64667
|
}
|
|
@@ -63613,7 +64678,7 @@ function hashWorkingTreeIdentity(root, rawPath, budget) {
|
|
|
63613
64678
|
} finally {
|
|
63614
64679
|
if (handle !== undefined) {
|
|
63615
64680
|
try {
|
|
63616
|
-
|
|
64681
|
+
_internals83.closeSync(handle);
|
|
63617
64682
|
} catch {}
|
|
63618
64683
|
}
|
|
63619
64684
|
}
|
|
@@ -63625,7 +64690,7 @@ async function buildReviewManifest(root, selector, files, completeness, timeoutM
|
|
|
63625
64690
|
const missingIdentityBindings = new Set;
|
|
63626
64691
|
const workingTreeBudget = selector.kind === "range" ? undefined : {
|
|
63627
64692
|
remainingBytes: WORKTREE_IDENTITY_TOTAL_BYTES,
|
|
63628
|
-
deadlineMs:
|
|
64693
|
+
deadlineMs: _internals83.now() + Math.min(timeoutMs, WORKTREE_IDENTITY_MAX_DURATION_MS)
|
|
63629
64694
|
};
|
|
63630
64695
|
const orderedScopes = [...files.values()].sort((left, right) => compareUtf8Bytes(left.newPath ?? left.oldPath ?? "", right.newPath ?? right.oldPath ?? ""));
|
|
63631
64696
|
const oldTreeForSelector = selector.kind === "working-tree" ? revisionContext.headSha : selector.kind === "range" ? selector.operator === "..." ? revisionContext.mergeBase : revisionContext.baseSha : revisionContext.mergeBase;
|
|
@@ -63765,7 +64830,7 @@ function readSafeUntracked(root, rawPath, maxFileBytes) {
|
|
|
63765
64830
|
}
|
|
63766
64831
|
let handle;
|
|
63767
64832
|
try {
|
|
63768
|
-
const pathStat =
|
|
64833
|
+
const pathStat = _internals83.lstatBigIntSync(candidate);
|
|
63769
64834
|
if (pathStat.isSymbolicLink()) {
|
|
63770
64835
|
return {
|
|
63771
64836
|
truncated: false,
|
|
@@ -63786,7 +64851,7 @@ function readSafeUntracked(root, rawPath, maxFileBytes) {
|
|
|
63786
64851
|
}
|
|
63787
64852
|
};
|
|
63788
64853
|
}
|
|
63789
|
-
const canonicalBeforeOpen =
|
|
64854
|
+
const canonicalBeforeOpen = _internals83.realpathSync(candidate);
|
|
63790
64855
|
if (!isContained(root, canonicalBeforeOpen)) {
|
|
63791
64856
|
return {
|
|
63792
64857
|
truncated: false,
|
|
@@ -63797,9 +64862,9 @@ function readSafeUntracked(root, rawPath, maxFileBytes) {
|
|
|
63797
64862
|
}
|
|
63798
64863
|
};
|
|
63799
64864
|
}
|
|
63800
|
-
handle =
|
|
63801
|
-
const openedBeforeRead =
|
|
63802
|
-
const canonicalAfterOpen =
|
|
64865
|
+
handle = _internals83.openSync(canonicalBeforeOpen, "r");
|
|
64866
|
+
const openedBeforeRead = _internals83.fstatBigIntSync(handle);
|
|
64867
|
+
const canonicalAfterOpen = _internals83.realpathSync(candidate);
|
|
63803
64868
|
if (!openedBeforeRead.isFile() || !sameFileSnapshot(pathStat, openedBeforeRead) || !samePath(canonicalBeforeOpen, canonicalAfterOpen) || !isContained(root, canonicalAfterOpen)) {
|
|
63804
64869
|
return {
|
|
63805
64870
|
truncated: false,
|
|
@@ -63814,13 +64879,13 @@ function readSafeUntracked(root, rawPath, maxFileBytes) {
|
|
|
63814
64879
|
const bytes = Buffer.alloc(requested);
|
|
63815
64880
|
let count = 0;
|
|
63816
64881
|
while (count < requested) {
|
|
63817
|
-
const read =
|
|
64882
|
+
const read = _internals83.readSync(handle, bytes, count, requested - count, count);
|
|
63818
64883
|
if (read === 0)
|
|
63819
64884
|
break;
|
|
63820
64885
|
count += read;
|
|
63821
64886
|
}
|
|
63822
|
-
const openedAfterRead =
|
|
63823
|
-
const canonicalAfterRead =
|
|
64887
|
+
const openedAfterRead = _internals83.fstatBigIntSync(handle);
|
|
64888
|
+
const canonicalAfterRead = _internals83.realpathSync(candidate);
|
|
63824
64889
|
if (!sameFileSnapshot(openedBeforeRead, openedAfterRead) || !samePath(canonicalBeforeOpen, canonicalAfterRead) || !isContained(root, canonicalAfterRead) || openedBeforeRead.size <= BigInt(maxFileBytes) && BigInt(count) !== openedBeforeRead.size) {
|
|
63825
64890
|
return {
|
|
63826
64891
|
truncated: false,
|
|
@@ -63872,7 +64937,7 @@ function readSafeUntracked(root, rawPath, maxFileBytes) {
|
|
|
63872
64937
|
} finally {
|
|
63873
64938
|
if (handle !== undefined) {
|
|
63874
64939
|
try {
|
|
63875
|
-
|
|
64940
|
+
_internals83.closeSync(handle);
|
|
63876
64941
|
} catch {}
|
|
63877
64942
|
}
|
|
63878
64943
|
}
|
|
@@ -63910,7 +64975,7 @@ async function collectReviewDiff(options) {
|
|
|
63910
64975
|
const maxUntrackedFileBytes = boundedPositiveInteger(options.maxUntrackedFileBytes, DEFAULT_MAX_UNTRACKED_FILE_BYTES, MAX_UNTRACKED_FILE_BYTES);
|
|
63911
64976
|
let root;
|
|
63912
64977
|
try {
|
|
63913
|
-
root =
|
|
64978
|
+
root = _internals83.realpathSync(options.directory);
|
|
63914
64979
|
} catch (error2) {
|
|
63915
64980
|
return {
|
|
63916
64981
|
status: "error",
|
|
@@ -63933,7 +64998,7 @@ async function collectReviewDiff(options) {
|
|
|
63933
64998
|
}
|
|
63934
64999
|
let gitRoot;
|
|
63935
65000
|
try {
|
|
63936
|
-
gitRoot =
|
|
65001
|
+
gitRoot = _internals83.realpathSync(topLevel.stdout.trim());
|
|
63937
65002
|
} catch {
|
|
63938
65003
|
return {
|
|
63939
65004
|
status: "error",
|
|
@@ -64234,7 +65299,7 @@ async function collectReviewDiff(options) {
|
|
|
64234
65299
|
const clean = canonicalText.trim().length === 0 && untrackedCount === 0 && skipReasons.length === 0;
|
|
64235
65300
|
return { status: clean ? "clean" : "ok", ...scope };
|
|
64236
65301
|
}
|
|
64237
|
-
var
|
|
65302
|
+
var _internals83 = {
|
|
64238
65303
|
bunSpawn,
|
|
64239
65304
|
realpathSync: fs41.realpathSync,
|
|
64240
65305
|
lstatBigIntSync: (path92) => fs41.lstatSync(path92, { bigint: true }),
|
|
@@ -64296,7 +65361,7 @@ function resolveReceiptsDir(directory) {
|
|
|
64296
65361
|
function resolveReceiptIndexPath(directory) {
|
|
64297
65362
|
return path92.join(resolveReceiptsDir(directory), "index.json");
|
|
64298
65363
|
}
|
|
64299
|
-
var
|
|
65364
|
+
var _internals84 = {
|
|
64300
65365
|
openSync: fs42.openSync,
|
|
64301
65366
|
lstatBigIntSync: (path93) => fs42.lstatSync(path93, { bigint: true }),
|
|
64302
65367
|
fstatBigIntSync: (fd) => fs42.fstatSync(fd, { bigint: true })
|
|
@@ -64308,7 +65373,7 @@ function pathsEqual(left, right) {
|
|
|
64308
65373
|
}
|
|
64309
65374
|
function captureCanonicalDirectory(directory, label, expected) {
|
|
64310
65375
|
const resolved = path92.resolve(directory);
|
|
64311
|
-
const stat9 =
|
|
65376
|
+
const stat9 = _internals84.lstatBigIntSync(resolved);
|
|
64312
65377
|
if (!stat9.isDirectory() || stat9.isSymbolicLink()) {
|
|
64313
65378
|
throw new Error(`${label} must be a real directory`);
|
|
64314
65379
|
}
|
|
@@ -64394,7 +65459,7 @@ function assertDirectReceiptFile(context, filePath, mustExist) {
|
|
|
64394
65459
|
throw new Error("review receipt file escapes its expected directory");
|
|
64395
65460
|
}
|
|
64396
65461
|
try {
|
|
64397
|
-
const stat9 =
|
|
65462
|
+
const stat9 = _internals84.lstatBigIntSync(resolved);
|
|
64398
65463
|
if (!stat9.isFile() || stat9.isSymbolicLink()) {
|
|
64399
65464
|
throw new Error("review receipt path must be a real file");
|
|
64400
65465
|
}
|
|
@@ -64418,7 +65483,7 @@ function readReviewReceiptText(directory, receiptPath, maxBytes = 1048576) {
|
|
|
64418
65483
|
const resolved = assertDirectReceiptFile(context, receiptPath, true);
|
|
64419
65484
|
if (path92.extname(resolved) !== ".json")
|
|
64420
65485
|
return null;
|
|
64421
|
-
const pathBeforeOpen =
|
|
65486
|
+
const pathBeforeOpen = _internals84.lstatBigIntSync(resolved);
|
|
64422
65487
|
if (!pathBeforeOpen.isFile() || pathBeforeOpen.isSymbolicLink() || pathBeforeOpen.size < 0n || pathBeforeOpen.size > BigInt(maxBytes)) {
|
|
64423
65488
|
return null;
|
|
64424
65489
|
}
|
|
@@ -64426,10 +65491,10 @@ function readReviewReceiptText(directory, receiptPath, maxBytes = 1048576) {
|
|
|
64426
65491
|
if (!pathsEqual(canonicalBeforeOpen, resolved))
|
|
64427
65492
|
return null;
|
|
64428
65493
|
assertReceiptContextCurrent(context);
|
|
64429
|
-
descriptor =
|
|
64430
|
-
const openedBeforeRead =
|
|
65494
|
+
descriptor = _internals84.openSync(canonicalBeforeOpen, "r");
|
|
65495
|
+
const openedBeforeRead = _internals84.fstatBigIntSync(descriptor);
|
|
64431
65496
|
assertReceiptContextCurrent(context);
|
|
64432
|
-
const pathAfterOpen =
|
|
65497
|
+
const pathAfterOpen = _internals84.lstatBigIntSync(resolved);
|
|
64433
65498
|
const canonicalAfterOpen = fs42.realpathSync(resolved);
|
|
64434
65499
|
if (!openedBeforeRead.isFile() || openedBeforeRead.size < 0n || openedBeforeRead.size > BigInt(maxBytes) || !sameFileSnapshot2(pathBeforeOpen, openedBeforeRead) || !sameFileSnapshot2(openedBeforeRead, pathAfterOpen) || !pathsEqual(canonicalBeforeOpen, canonicalAfterOpen)) {
|
|
64435
65500
|
return null;
|
|
@@ -64442,9 +65507,9 @@ function readReviewReceiptText(directory, receiptPath, maxBytes = 1048576) {
|
|
|
64442
65507
|
break;
|
|
64443
65508
|
bytesRead += count;
|
|
64444
65509
|
}
|
|
64445
|
-
const openedAfterRead =
|
|
65510
|
+
const openedAfterRead = _internals84.fstatBigIntSync(descriptor);
|
|
64446
65511
|
assertReceiptContextCurrent(context);
|
|
64447
|
-
const pathAfterRead =
|
|
65512
|
+
const pathAfterRead = _internals84.lstatBigIntSync(resolved);
|
|
64448
65513
|
const canonicalAfterRead = fs42.realpathSync(resolved);
|
|
64449
65514
|
if (bytesRead !== buffer.length || !sameFileSnapshot2(openedBeforeRead, openedAfterRead) || !sameFileSnapshot2(openedAfterRead, pathAfterRead) || !pathsEqual(canonicalBeforeOpen, canonicalAfterRead)) {
|
|
64450
65515
|
return null;
|
|
@@ -64997,7 +66062,7 @@ var RETRYABLE_CAPTURE_FAILURE_CODES = new Set([
|
|
|
64997
66062
|
]);
|
|
64998
66063
|
var REVIEWER_SCOPE_CAPTURE_CHUNK_BYTES = 262144;
|
|
64999
66064
|
var REVIEWER_SCOPE_CAPTURE_BATCH_DEADLINE_MS = 1e4;
|
|
65000
|
-
var
|
|
66065
|
+
var _internals85 = {
|
|
65001
66066
|
open: fs43.openSync,
|
|
65002
66067
|
fstat: (fd, options) => fs43.fstatSync(fd, options),
|
|
65003
66068
|
read: fs43.readSync,
|
|
@@ -65034,7 +66099,7 @@ function deletedPathIsContained(canonicalRoot, absolute) {
|
|
|
65034
66099
|
let current = path93.dirname(absolute);
|
|
65035
66100
|
for (;; ) {
|
|
65036
66101
|
try {
|
|
65037
|
-
const canonical =
|
|
66102
|
+
const canonical = _internals85.realpathSync(current);
|
|
65038
66103
|
return canonicalRoot === canonical || isWithinRoot2(canonicalRoot, canonical);
|
|
65039
66104
|
} catch (error2) {
|
|
65040
66105
|
if (error2.code !== "ENOENT")
|
|
@@ -65080,7 +66145,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65080
66145
|
let canonicalParent;
|
|
65081
66146
|
const absolute = path93.resolve(directory, normalized);
|
|
65082
66147
|
try {
|
|
65083
|
-
canonicalRoot =
|
|
66148
|
+
canonicalRoot = _internals85.realpathSync(path93.resolve(directory));
|
|
65084
66149
|
} catch {
|
|
65085
66150
|
return {
|
|
65086
66151
|
kind: "capture_failed",
|
|
@@ -65090,13 +66155,13 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65090
66155
|
};
|
|
65091
66156
|
}
|
|
65092
66157
|
try {
|
|
65093
|
-
canonicalParent =
|
|
66158
|
+
canonicalParent = _internals85.realpathSync(path93.dirname(absolute));
|
|
65094
66159
|
} catch (error2) {
|
|
65095
66160
|
if (error2.code === "ENOENT") {
|
|
65096
66161
|
let secondObservation = null;
|
|
65097
66162
|
let secondFailed = false;
|
|
65098
66163
|
try {
|
|
65099
|
-
secondObservation =
|
|
66164
|
+
secondObservation = _internals85.realpathSync(path93.dirname(absolute));
|
|
65100
66165
|
} catch (secondError) {
|
|
65101
66166
|
if (secondError.code !== "ENOENT") {
|
|
65102
66167
|
return {
|
|
@@ -65113,7 +66178,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65113
66178
|
canonicalParent = secondObservation;
|
|
65114
66179
|
} else {
|
|
65115
66180
|
try {
|
|
65116
|
-
|
|
66181
|
+
_internals85.lstat(absolute);
|
|
65117
66182
|
return {
|
|
65118
66183
|
kind: "capture_failed",
|
|
65119
66184
|
file: normalized,
|
|
@@ -65159,7 +66224,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65159
66224
|
}
|
|
65160
66225
|
let before;
|
|
65161
66226
|
try {
|
|
65162
|
-
before =
|
|
66227
|
+
before = _internals85.lstat(absolute);
|
|
65163
66228
|
} catch (error2) {
|
|
65164
66229
|
if (error2.code === "ENOENT") {
|
|
65165
66230
|
return deletedPathIsContained(canonicalRoot, absolute) ? { kind: "captured_deleted", file: normalized } : {
|
|
@@ -65186,7 +66251,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65186
66251
|
};
|
|
65187
66252
|
}
|
|
65188
66253
|
try {
|
|
65189
|
-
const canonicalTarget =
|
|
66254
|
+
const canonicalTarget = _internals85.realpathSync(absolute);
|
|
65190
66255
|
if (!isWithinRoot2(canonicalRoot, canonicalTarget) || path93.dirname(canonicalTarget) !== canonicalParent) {
|
|
65191
66256
|
return {
|
|
65192
66257
|
kind: "capture_failed",
|
|
@@ -65214,7 +66279,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65214
66279
|
const openFlags = fs43.constants.O_RDONLY | (process.platform === "win32" ? 0 : fs43.constants.O_NOFOLLOW);
|
|
65215
66280
|
let beforeBigInt;
|
|
65216
66281
|
try {
|
|
65217
|
-
beforeBigInt =
|
|
66282
|
+
beforeBigInt = _internals85.lstat(absolute, {
|
|
65218
66283
|
bigint: true
|
|
65219
66284
|
});
|
|
65220
66285
|
} catch {
|
|
@@ -65227,7 +66292,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65227
66292
|
}
|
|
65228
66293
|
let fd;
|
|
65229
66294
|
try {
|
|
65230
|
-
fd =
|
|
66295
|
+
fd = _internals85.open(absolute, openFlags);
|
|
65231
66296
|
} catch (error2) {
|
|
65232
66297
|
const code = error2.code;
|
|
65233
66298
|
if (code === "ENOENT" || code === "ELOOP") {
|
|
@@ -65257,7 +66322,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65257
66322
|
};
|
|
65258
66323
|
}
|
|
65259
66324
|
try {
|
|
65260
|
-
const openedBefore =
|
|
66325
|
+
const openedBefore = _internals85.fstat(fd, { bigint: true });
|
|
65261
66326
|
if (!openedBefore.isFile()) {
|
|
65262
66327
|
return {
|
|
65263
66328
|
kind: "capture_failed",
|
|
@@ -65278,7 +66343,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65278
66343
|
const chunk = Buffer.alloc(REVIEWER_SCOPE_CAPTURE_CHUNK_BYTES);
|
|
65279
66344
|
let totalBytes = 0;
|
|
65280
66345
|
for (;; ) {
|
|
65281
|
-
if (options.deadlineAt !== undefined &&
|
|
66346
|
+
if (options.deadlineAt !== undefined && _internals85.now() > options.deadlineAt) {
|
|
65282
66347
|
return {
|
|
65283
66348
|
kind: "capture_failed",
|
|
65284
66349
|
file: normalized,
|
|
@@ -65288,7 +66353,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65288
66353
|
}
|
|
65289
66354
|
let bytesRead;
|
|
65290
66355
|
try {
|
|
65291
|
-
bytesRead =
|
|
66356
|
+
bytesRead = _internals85.read(fd, chunk, 0, chunk.byteLength, null);
|
|
65292
66357
|
} catch (error2) {
|
|
65293
66358
|
const code = error2.code;
|
|
65294
66359
|
return {
|
|
@@ -65304,7 +66369,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65304
66369
|
totalBytes += bytesRead;
|
|
65305
66370
|
hash2.update(bytesRead === chunk.byteLength ? chunk : chunk.subarray(0, bytesRead));
|
|
65306
66371
|
}
|
|
65307
|
-
const openedAfter =
|
|
66372
|
+
const openedAfter = _internals85.fstat(fd, { bigint: true });
|
|
65308
66373
|
if (!sameSnapshot(openedBefore, openedAfter)) {
|
|
65309
66374
|
return {
|
|
65310
66375
|
kind: "capture_failed",
|
|
@@ -65323,7 +66388,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65323
66388
|
}
|
|
65324
66389
|
let pathAfter;
|
|
65325
66390
|
try {
|
|
65326
|
-
pathAfter =
|
|
66391
|
+
pathAfter = _internals85.stat(absolute, { bigint: true });
|
|
65327
66392
|
} catch {
|
|
65328
66393
|
return {
|
|
65329
66394
|
kind: "capture_failed",
|
|
@@ -65342,7 +66407,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65342
66407
|
}
|
|
65343
66408
|
let canonicalAfterRead;
|
|
65344
66409
|
try {
|
|
65345
|
-
canonicalAfterRead =
|
|
66410
|
+
canonicalAfterRead = _internals85.realpathSync(absolute);
|
|
65346
66411
|
} catch {
|
|
65347
66412
|
return {
|
|
65348
66413
|
kind: "capture_failed",
|
|
@@ -65368,7 +66433,7 @@ function captureReviewerScopeFileFingerprint(directory, file, options = {}) {
|
|
|
65368
66433
|
} finally {
|
|
65369
66434
|
if (fd !== undefined) {
|
|
65370
66435
|
try {
|
|
65371
|
-
|
|
66436
|
+
_internals85.close(fd);
|
|
65372
66437
|
} catch {}
|
|
65373
66438
|
}
|
|
65374
66439
|
}
|
|
@@ -65400,7 +66465,7 @@ var HEAD_OUTPUT_BYTES = 256;
|
|
|
65400
66465
|
var HEAD_SHA_PATTERN = /^[0-9a-f]{40,64}$/i;
|
|
65401
66466
|
var REVIEWER_TASK_SCOPE_DESCRIPTION = "reviewer-task-files-v2";
|
|
65402
66467
|
var REVIEWER_TASK_SCOPE_HEADER = "opencode-swarm-reviewer-task-scope-v2";
|
|
65403
|
-
var
|
|
66468
|
+
var _internals86 = {
|
|
65404
66469
|
spawn: child_process6.spawn,
|
|
65405
66470
|
realpath: fs44.promises.realpath,
|
|
65406
66471
|
resolveGitExecutable
|
|
@@ -65427,7 +66492,7 @@ async function resolveHeadSha(directory) {
|
|
|
65427
66492
|
let child;
|
|
65428
66493
|
let timeoutHandle;
|
|
65429
66494
|
try {
|
|
65430
|
-
child =
|
|
66495
|
+
child = _internals86.spawn(_internals86.resolveGitExecutable(), ["rev-parse", "--verify", "HEAD"], {
|
|
65431
66496
|
cwd: directory,
|
|
65432
66497
|
stdio: ["ignore", "pipe", "ignore"],
|
|
65433
66498
|
timeout: HEAD_TIMEOUT_MS,
|
|
@@ -65511,7 +66576,7 @@ async function buildReviewerTaskScope(directory, modifiedFiles, maxBytes = DEFAU
|
|
|
65511
66576
|
let realRoot;
|
|
65512
66577
|
try {
|
|
65513
66578
|
lexicalRoot = path94.resolve(directory);
|
|
65514
|
-
realRoot = await
|
|
66579
|
+
realRoot = await _internals86.realpath(lexicalRoot);
|
|
65515
66580
|
} catch {
|
|
65516
66581
|
return { ok: false, code: "workspace_unresolvable", retryable: false };
|
|
65517
66582
|
}
|
|
@@ -65784,7 +66849,7 @@ function parseReviewerOutput(text, options = {}) {
|
|
|
65784
66849
|
outputMode: "legacy"
|
|
65785
66850
|
};
|
|
65786
66851
|
}
|
|
65787
|
-
var
|
|
66852
|
+
var _internals87 = {
|
|
65788
66853
|
delegationBegin: telemetry.delegationBegin,
|
|
65789
66854
|
delegationEnd: telemetry.delegationEnd,
|
|
65790
66855
|
resolveReviewerTaskScope,
|
|
@@ -66084,7 +67149,7 @@ function scopeFreshnessMismatches(reviewed, current) {
|
|
|
66084
67149
|
}
|
|
66085
67150
|
function createScopeVerifier(input, reviewed, maxBytes) {
|
|
66086
67151
|
return async () => {
|
|
66087
|
-
const current = await
|
|
67152
|
+
const current = await _internals88.collectReviewDiff({
|
|
66088
67153
|
directory: input.directory,
|
|
66089
67154
|
selector: input.selector,
|
|
66090
67155
|
maxBytes
|
|
@@ -66093,7 +67158,7 @@ function createScopeVerifier(input, reviewed, maxBytes) {
|
|
|
66093
67158
|
};
|
|
66094
67159
|
}
|
|
66095
67160
|
async function stalePersistenceResult(input, maxBytes, message, modelCalls) {
|
|
66096
|
-
const current = await
|
|
67161
|
+
const current = await _internals88.collectReviewDiff({
|
|
66097
67162
|
directory: input.directory,
|
|
66098
67163
|
selector: input.selector,
|
|
66099
67164
|
maxBytes
|
|
@@ -66481,7 +67546,7 @@ async function persistErrorResult(input, diff, result, error2, dispatches, promp
|
|
|
66481
67546
|
evidence2.review.error = error2;
|
|
66482
67547
|
addCost(evidence2, dispatches);
|
|
66483
67548
|
try {
|
|
66484
|
-
result.evidencePath = await
|
|
67549
|
+
result.evidencePath = await _internals88.persistEvidence(input.directory, evidence2);
|
|
66485
67550
|
} catch {
|
|
66486
67551
|
if (input.config.final_review.mode === "gate") {
|
|
66487
67552
|
result.blocked = true;
|
|
@@ -66498,7 +67563,7 @@ async function runReviewEngine(input) {
|
|
|
66498
67563
|
const gateMode = input.config.final_review.mode === "gate";
|
|
66499
67564
|
const maxBytes = input.trigger === "task_completion" ? input.config.max_diff_kb * 1024 : input.config.final_review.max_diff_bytes;
|
|
66500
67565
|
const timeoutMs = input.trigger === "task_completion" ? input.config.timeout_ms : input.config.final_review.timeout_ms;
|
|
66501
|
-
const diff = await
|
|
67566
|
+
const diff = await _internals88.collectReviewDiff({
|
|
66502
67567
|
directory: input.directory,
|
|
66503
67568
|
selector: input.selector,
|
|
66504
67569
|
maxBytes
|
|
@@ -66514,7 +67579,7 @@ async function runReviewEngine(input) {
|
|
|
66514
67579
|
evidence3.policy.digest = evidence3.scope.manifest.review_policy_digest;
|
|
66515
67580
|
let evidencePath2;
|
|
66516
67581
|
try {
|
|
66517
|
-
evidencePath2 = await
|
|
67582
|
+
evidencePath2 = await _internals88.persistEvidence(input.directory, evidence3, { verifyCurrent: createScopeVerifier(input, diff, maxBytes) });
|
|
66518
67583
|
} catch (error2) {
|
|
66519
67584
|
if (error2 instanceof ReviewScopeStaleError) {
|
|
66520
67585
|
return stalePersistenceResult(input, maxBytes, "Review scope changed before clean evidence could be committed.", 0);
|
|
@@ -66538,7 +67603,7 @@ async function runReviewEngine(input) {
|
|
|
66538
67603
|
});
|
|
66539
67604
|
const reviewManifest = await materializeAutoReviewManifest(input.directory, diff.manifest, input.config);
|
|
66540
67605
|
if (input.phase !== undefined && (input.trigger === "phase_completion" || input.trigger === "plan_completion")) {
|
|
66541
|
-
const existing =
|
|
67606
|
+
const existing = _internals88.readPhaseEvidence(input.directory, input.phase);
|
|
66542
67607
|
const integrity = existing ? validateAutoReviewEvidenceIntegrity(input.directory, existing, {
|
|
66543
67608
|
scopeHash: diff.scopeHash,
|
|
66544
67609
|
phase: input.phase,
|
|
@@ -66666,7 +67731,7 @@ async function runReviewEngine(input) {
|
|
|
66666
67731
|
validation: byId.get(finding.finding_id)
|
|
66667
67732
|
}));
|
|
66668
67733
|
}
|
|
66669
|
-
const currentScope = await
|
|
67734
|
+
const currentScope = await _internals88.collectReviewDiff({
|
|
66670
67735
|
directory: input.directory,
|
|
66671
67736
|
selector: input.selector,
|
|
66672
67737
|
maxBytes
|
|
@@ -66747,7 +67812,7 @@ async function runReviewEngine(input) {
|
|
|
66747
67812
|
findingValidations: findings.map((finding) => finding.validation).filter((item) => Boolean(item))
|
|
66748
67813
|
});
|
|
66749
67814
|
receiptId = receipt.id;
|
|
66750
|
-
receiptPath = await
|
|
67815
|
+
receiptPath = await _internals88.persistReceipt(input.directory, receipt, {
|
|
66751
67816
|
verifyCurrent: createScopeVerifier(input, diff, maxBytes)
|
|
66752
67817
|
});
|
|
66753
67818
|
evidence2.receipt_path = receiptPath;
|
|
@@ -66777,7 +67842,7 @@ async function runReviewEngine(input) {
|
|
|
66777
67842
|
}
|
|
66778
67843
|
let evidencePath;
|
|
66779
67844
|
try {
|
|
66780
|
-
evidencePath = await
|
|
67845
|
+
evidencePath = await _internals88.persistEvidence(input.directory, evidence2, {
|
|
66781
67846
|
verifyCurrent: createScopeVerifier(input, diff, maxBytes)
|
|
66782
67847
|
});
|
|
66783
67848
|
} catch (error2) {
|
|
@@ -66815,7 +67880,7 @@ async function runReviewEngine(input) {
|
|
|
66815
67880
|
input.injectAdvisory?.(input.sessionID, advisoryMessage(input, result));
|
|
66816
67881
|
return result;
|
|
66817
67882
|
}
|
|
66818
|
-
var
|
|
67883
|
+
var _internals88 = {
|
|
66819
67884
|
collectReviewDiff,
|
|
66820
67885
|
persistEvidence: persistAutoReviewEvidence,
|
|
66821
67886
|
persistReceipt: persistReviewReceipt,
|
|
@@ -67086,7 +68151,7 @@ async function handleReviewCommand(ctx) {
|
|
|
67086
68151
|
} catch (error2) {
|
|
67087
68152
|
return `Review configuration error: ${error2 instanceof Error ? error2.message : String(error2)}`;
|
|
67088
68153
|
}
|
|
67089
|
-
const result = await
|
|
68154
|
+
const result = await _internals89.runReviewEngine({
|
|
67090
68155
|
directory: ctx.directory,
|
|
67091
68156
|
sessionID: ctx.sessionID,
|
|
67092
68157
|
trigger: "manual",
|
|
@@ -67100,10 +68165,10 @@ async function handleReviewCommand(ctx) {
|
|
|
67100
68165
|
validatorModel,
|
|
67101
68166
|
validatorFallbackModels
|
|
67102
68167
|
});
|
|
67103
|
-
const evidence2 =
|
|
68168
|
+
const evidence2 = _internals89.readEvidence(result.evidencePath, ctx.directory);
|
|
67104
68169
|
return parsed.json ? renderJson(result, evidence2, parsed.selector) : renderHuman(result, evidence2, parsed.selector);
|
|
67105
68170
|
}
|
|
67106
|
-
var
|
|
68171
|
+
var _internals89 = {
|
|
67107
68172
|
runReviewEngine,
|
|
67108
68173
|
readEvidence
|
|
67109
68174
|
};
|
|
@@ -67345,7 +68410,7 @@ async function handleRollbackCommand(directory, args) {
|
|
|
67345
68410
|
// src/commands/sdd.ts
|
|
67346
68411
|
import * as fs49 from "fs";
|
|
67347
68412
|
import * as path99 from "path";
|
|
67348
|
-
var
|
|
68413
|
+
var _internals90 = {
|
|
67349
68414
|
writeProjectedSpecSync
|
|
67350
68415
|
};
|
|
67351
68416
|
var SWARM_SPEC_REL = path99.join(".swarm", "spec.md");
|
|
@@ -67745,7 +68810,7 @@ ${USAGE13}`;
|
|
|
67745
68810
|
|
|
67746
68811
|
${USAGE13}`;
|
|
67747
68812
|
}
|
|
67748
|
-
const result2 =
|
|
68813
|
+
const result2 = _internals90.writeProjectedSpecSync(directory, {
|
|
67749
68814
|
source: "speckit",
|
|
67750
68815
|
feature: resolution.feature,
|
|
67751
68816
|
dryRun: parsed.dryRun,
|
|
@@ -67803,7 +68868,7 @@ ${formatList(result2.projection.warnings)}` : ""
|
|
|
67803
68868
|
].join(`
|
|
67804
68869
|
`);
|
|
67805
68870
|
}
|
|
67806
|
-
const result =
|
|
68871
|
+
const result = _internals90.writeProjectedSpecSync(directory, {
|
|
67807
68872
|
changeId: parsed.changeId,
|
|
67808
68873
|
dryRun: parsed.dryRun,
|
|
67809
68874
|
overwrite: parsed.overwrite
|
|
@@ -68030,7 +69095,7 @@ function writeFileFsyncedThenRename(tempPath, targetPath, data) {
|
|
|
68030
69095
|
throw err;
|
|
68031
69096
|
}
|
|
68032
69097
|
}
|
|
68033
|
-
var
|
|
69098
|
+
var _internals91 = {
|
|
68034
69099
|
withEvidenceLock,
|
|
68035
69100
|
writeFileFsyncedThenRename,
|
|
68036
69101
|
writeFileSync: writeFileSyncAsync,
|
|
@@ -68049,7 +69114,7 @@ async function appendEvent2(directory, eventInput) {
|
|
|
68049
69114
|
throw new Error(`invalid candidate id: ${eventInput.candidateId}`);
|
|
68050
69115
|
}
|
|
68051
69116
|
const filePath = ledgerPath(directory, eventInput.skillSlug, eventInput.candidateId);
|
|
68052
|
-
return
|
|
69117
|
+
return _internals91.withEvidenceLock(directory, path100.join(".swarm", "evolution", "skills", eventInput.skillSlug, eventInput.candidateId, "lifecycle.jsonl"), "skill-opt-ledger", "append-skill-opt-event", async () => {
|
|
68053
69118
|
ensureCandidateDir(directory, eventInput.skillSlug, eventInput.candidateId);
|
|
68054
69119
|
const existing = existsSync56(filePath) ? readFileSync42(filePath, "utf8") : "";
|
|
68055
69120
|
const events = parseEventsFromText(existing);
|
|
@@ -68081,8 +69146,8 @@ async function appendEvent2(directory, eventInput) {
|
|
|
68081
69146
|
const validContent = events.map((e) => JSON.stringify(e)).join(`
|
|
68082
69147
|
`) + (events.length > 0 ? `
|
|
68083
69148
|
` : "");
|
|
68084
|
-
|
|
68085
|
-
const verify = parseEventsFromText(
|
|
69149
|
+
_internals91.writeFileFsyncedThenRename(tempPath, filePath, validContent + line);
|
|
69150
|
+
const verify = parseEventsFromText(_internals91.readFileSync(filePath, "utf8"));
|
|
68086
69151
|
const last = verify.length > 0 ? verify[verify.length - 1] : null;
|
|
68087
69152
|
if (!last || last.seq !== event.seq || last.hashAfter !== event.hashAfter) {
|
|
68088
69153
|
throw new Error(`skill-opt ledger append verification failed for candidate ${event.candidateId} seq ${event.seq}`);
|
|
@@ -68186,7 +69251,7 @@ function writeStateProjection(directory, skillSlug, candidateId2, replay) {
|
|
|
68186
69251
|
updatedAt: new Date().toISOString()
|
|
68187
69252
|
};
|
|
68188
69253
|
const tempPath = `${target}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
|
|
68189
|
-
|
|
69254
|
+
_internals91.writeFileFsyncedThenRename(tempPath, target, `${JSON.stringify(projection, null, 2)}
|
|
68190
69255
|
`);
|
|
68191
69256
|
}
|
|
68192
69257
|
function writeArtifact(directory, skillSlug, candidateId2, fileName, content) {
|
|
@@ -68194,7 +69259,7 @@ function writeArtifact(directory, skillSlug, candidateId2, fileName, content) {
|
|
|
68194
69259
|
const dir = ensureCandidateDir(directory, skillSlug, candidateId2);
|
|
68195
69260
|
const target = path100.join(dir, fileName);
|
|
68196
69261
|
const tempPath = `${target}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
|
|
68197
|
-
|
|
69262
|
+
_internals91.writeFileFsyncedThenRename(tempPath, target, content);
|
|
68198
69263
|
return target;
|
|
68199
69264
|
}
|
|
68200
69265
|
function readArtifact(directory, skillSlug, candidateId2, fileName) {
|
|
@@ -68287,16 +69352,16 @@ function currentCandidateState(directory, skillSlug, candidateId2) {
|
|
|
68287
69352
|
function writeSkillFileAtomic(targetPath, content) {
|
|
68288
69353
|
const tempPath = `${targetPath}.tmp.${Date.now()}.${Math.floor(Math.random() * 1e9)}`;
|
|
68289
69354
|
try {
|
|
68290
|
-
|
|
68291
|
-
|
|
69355
|
+
_internals92.writeFileSync(tempPath, content, "utf8");
|
|
69356
|
+
_internals92.renameSync(tempPath, targetPath);
|
|
68292
69357
|
} finally {
|
|
68293
69358
|
try {
|
|
68294
69359
|
if (existsSync57(tempPath))
|
|
68295
|
-
|
|
69360
|
+
_internals92.unlinkSync(tempPath);
|
|
68296
69361
|
} catch {}
|
|
68297
69362
|
}
|
|
68298
69363
|
}
|
|
68299
|
-
var
|
|
69364
|
+
var _internals92 = {
|
|
68300
69365
|
writeFileSync: writeFileSync18,
|
|
68301
69366
|
renameSync: renameSync16,
|
|
68302
69367
|
unlinkSync: unlinkSync21
|
|
@@ -68753,7 +69818,7 @@ function buildGeneratorInputs(args) {
|
|
|
68753
69818
|
}
|
|
68754
69819
|
};
|
|
68755
69820
|
}
|
|
68756
|
-
var
|
|
69821
|
+
var _internals93 = {
|
|
68757
69822
|
draftDeterministic: defaultDeterministicDraft
|
|
68758
69823
|
};
|
|
68759
69824
|
function defaultDeterministicDraft(inputs) {
|
|
@@ -68823,7 +69888,7 @@ function countChangedLines(a, b) {
|
|
|
68823
69888
|
return changed;
|
|
68824
69889
|
}
|
|
68825
69890
|
function draftCandidate(inputs) {
|
|
68826
|
-
const candidate2 =
|
|
69891
|
+
const candidate2 = _internals93.draftDeterministic(inputs);
|
|
68827
69892
|
enforceTrustRegion(candidate2, inputs.budget);
|
|
68828
69893
|
return candidate2;
|
|
68829
69894
|
}
|
|
@@ -68866,7 +69931,7 @@ import * as path103 from "path";
|
|
|
68866
69931
|
// src/hooks/spawn-helper.ts
|
|
68867
69932
|
import * as child_process7 from "child_process";
|
|
68868
69933
|
var WIN32_CMD_BINARIES = new Set(["npm", "npx", "pnpm", "yarn"]);
|
|
68869
|
-
var
|
|
69934
|
+
var _internals94 = {
|
|
68870
69935
|
spawn: child_process7.spawn
|
|
68871
69936
|
};
|
|
68872
69937
|
function spawnAsync(command, cwd, timeoutMs) {
|
|
@@ -68874,7 +69939,7 @@ function spawnAsync(command, cwd, timeoutMs) {
|
|
|
68874
69939
|
try {
|
|
68875
69940
|
const [rawCmd, ...args] = command;
|
|
68876
69941
|
const cmd = process.platform === "win32" && WIN32_CMD_BINARIES.has(rawCmd) && !rawCmd.includes(".") ? `${rawCmd}.cmd` : rawCmd;
|
|
68877
|
-
const proc =
|
|
69942
|
+
const proc = _internals94.spawn(cmd, args, {
|
|
68878
69943
|
cwd,
|
|
68879
69944
|
stdio: ["ignore", "pipe", "pipe"]
|
|
68880
69945
|
});
|
|
@@ -68940,7 +70005,7 @@ function spawnAsync(command, cwd, timeoutMs) {
|
|
|
68940
70005
|
}
|
|
68941
70006
|
|
|
68942
70007
|
// src/services/skill-optimizer/smoke.ts
|
|
68943
|
-
var
|
|
70008
|
+
var _internals95 = {
|
|
68944
70009
|
validateSkillPath,
|
|
68945
70010
|
isSymbolicLink: (p) => {
|
|
68946
70011
|
try {
|
|
@@ -68961,7 +70026,7 @@ var _internals94 = {
|
|
|
68961
70026
|
async function validateSkillSmoke(input) {
|
|
68962
70027
|
const notes = [];
|
|
68963
70028
|
const repoRel = path103.join(".opencode", "skills", "generated", input.skillSlug, "SKILL.md");
|
|
68964
|
-
if (!
|
|
70029
|
+
if (!_internals95.validateSkillPath(repoRel)) {
|
|
68965
70030
|
return {
|
|
68966
70031
|
ok: false,
|
|
68967
70032
|
verdict: "VIOLATED",
|
|
@@ -68970,16 +70035,16 @@ async function validateSkillSmoke(input) {
|
|
|
68970
70035
|
}
|
|
68971
70036
|
const skillRoot = path103.join(input.directory, ".opencode", "skills", "generated", input.skillSlug);
|
|
68972
70037
|
if (existsSync58(skillRoot)) {
|
|
68973
|
-
if (
|
|
70038
|
+
if (_internals95.isSymbolicLink(skillRoot)) {
|
|
68974
70039
|
return {
|
|
68975
70040
|
ok: false,
|
|
68976
70041
|
verdict: "VIOLATED",
|
|
68977
70042
|
notes: ["skill root is a symlink (reparse denied)"]
|
|
68978
70043
|
};
|
|
68979
70044
|
}
|
|
68980
|
-
const realRoot =
|
|
68981
|
-
const realProjectDir =
|
|
68982
|
-
if (
|
|
70045
|
+
const realRoot = _internals95.realpath(skillRoot);
|
|
70046
|
+
const realProjectDir = _internals95.realpath(input.directory);
|
|
70047
|
+
if (_internals95.escapedRoot(realProjectDir, realRoot)) {
|
|
68983
70048
|
return {
|
|
68984
70049
|
ok: false,
|
|
68985
70050
|
verdict: "VIOLATED",
|
|
@@ -68997,7 +70062,7 @@ async function validateSkillSmoke(input) {
|
|
|
68997
70062
|
notes: [`frontmatter: ${fmError}`]
|
|
68998
70063
|
};
|
|
68999
70064
|
}
|
|
69000
|
-
const rejected = await
|
|
70065
|
+
const rejected = await _internals95.isRejectedSkillContent(input.directory, input.skillSlug, input.candidateContent);
|
|
69001
70066
|
if (rejected) {
|
|
69002
70067
|
return {
|
|
69003
70068
|
ok: false,
|
|
@@ -69007,7 +70072,7 @@ async function validateSkillSmoke(input) {
|
|
|
69007
70072
|
]
|
|
69008
70073
|
};
|
|
69009
70074
|
}
|
|
69010
|
-
const evalResult = await
|
|
70075
|
+
const evalResult = await _internals95.evaluateSkillChange({
|
|
69011
70076
|
directory: input.directory,
|
|
69012
70077
|
slug: input.skillSlug,
|
|
69013
70078
|
candidateContent: input.candidateContent,
|
|
@@ -69026,7 +70091,7 @@ async function validateSkillSmoke(input) {
|
|
|
69026
70091
|
notes.push(`phrase-eval passed (score ${evalResult.candidateScore.toFixed(2)})`);
|
|
69027
70092
|
}
|
|
69028
70093
|
if (input.checkCommand && input.checkCommand.length > 0) {
|
|
69029
|
-
const cmdResult = await
|
|
70094
|
+
const cmdResult = await _internals95.spawnAsync(input.checkCommand, input.directory, input.checkTimeoutMs ?? 60000);
|
|
69030
70095
|
if (!cmdResult || cmdResult.exitCode !== 0) {
|
|
69031
70096
|
return {
|
|
69032
70097
|
ok: false,
|
|
@@ -69096,7 +70161,7 @@ async function prepareCandidatePayloads(inputRoot, candidateId2, skillSlug, base
|
|
|
69096
70161
|
candidate2.contentHash = await computeCandidateInputContentHash2(inputRoot, candidate2);
|
|
69097
70162
|
return { baseline, candidate: candidate2 };
|
|
69098
70163
|
}
|
|
69099
|
-
var
|
|
70164
|
+
var _internals96 = {
|
|
69100
70165
|
tryAcquireLock,
|
|
69101
70166
|
emitTelemetry: emit,
|
|
69102
70167
|
evaluateCandidateV1,
|
|
@@ -69104,7 +70169,7 @@ var _internals95 = {
|
|
|
69104
70169
|
};
|
|
69105
70170
|
async function acquireProjectLock(directory) {
|
|
69106
70171
|
assertProjectRoot(directory);
|
|
69107
|
-
const result = await
|
|
70172
|
+
const result = await _internals96.tryAcquireLock(directory, PROJECT_LOCK_PATH, "skill-opt-controller", "project-run");
|
|
69108
70173
|
if (!result.acquired)
|
|
69109
70174
|
return null;
|
|
69110
70175
|
return async () => {
|
|
@@ -69118,7 +70183,7 @@ async function acquireProjectLock(directory) {
|
|
|
69118
70183
|
async function acquireSkillLock(directory, skillSlug) {
|
|
69119
70184
|
assertProjectRoot(directory);
|
|
69120
70185
|
const lockPath = path104.join(".swarm", "evolution", "skills", skillSlug, ".skill.lock");
|
|
69121
|
-
const result = await
|
|
70186
|
+
const result = await _internals96.tryAcquireLock(directory, lockPath, "skill-opt-controller", `skill-${skillSlug}`);
|
|
69122
70187
|
if (!result.acquired)
|
|
69123
70188
|
return null;
|
|
69124
70189
|
return async () => {
|
|
@@ -69315,13 +70380,13 @@ async function runValidationWithTransientRetry(input, candidateContent, baseline
|
|
|
69315
70380
|
while (true) {
|
|
69316
70381
|
try {
|
|
69317
70382
|
const evalInputRoot = input.inputRoot ?? input.directory;
|
|
69318
|
-
const { baseline, candidate: candidate2 } = await
|
|
70383
|
+
const { baseline, candidate: candidate2 } = await _internals96.prepareCandidatePayloads(evalInputRoot, candidateId2, input.skillSlug, input.baselineModel, input.candidateModel, baselineContent, candidateContent);
|
|
69319
70384
|
if (!input.dispatcher) {
|
|
69320
70385
|
throw new Error("no evaluation dispatcher available (cannot run validation)");
|
|
69321
70386
|
}
|
|
69322
|
-
const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-
|
|
70387
|
+
const { createModelEvaluationExecutor: createModelEvaluationExecutor2 } = await import("./runner-1aygs98c.js");
|
|
69323
70388
|
const executor = createModelEvaluationExecutor2(input.dispatcher, input.sessionId);
|
|
69324
|
-
const result = await
|
|
70389
|
+
const result = await _internals96.evaluateCandidateV1({
|
|
69325
70390
|
projectRoot: input.directory,
|
|
69326
70391
|
inputRoot: input.inputRoot ?? input.directory,
|
|
69327
70392
|
tasks: input.validationTasks,
|
|
@@ -69379,7 +70444,7 @@ async function runValidationWithTransientRetry(input, candidateContent, baseline
|
|
|
69379
70444
|
deadband: input.config.deadband
|
|
69380
70445
|
};
|
|
69381
70446
|
}
|
|
69382
|
-
|
|
70447
|
+
_internals96.emitTelemetry?.("loop_detected", {
|
|
69383
70448
|
skillSlug: input.skillSlug,
|
|
69384
70449
|
reason: message.slice(0, 160),
|
|
69385
70450
|
source: "skill-opt-controller"
|
|
@@ -70228,7 +71293,7 @@ function getCompactionMetrics(sessionId) {
|
|
|
70228
71293
|
}
|
|
70229
71294
|
|
|
70230
71295
|
// src/services/status-service.ts
|
|
70231
|
-
var
|
|
71296
|
+
var _internals97 = {
|
|
70232
71297
|
loadLeanTurboRunState,
|
|
70233
71298
|
hasActiveLeanTurbo,
|
|
70234
71299
|
hasActiveFullAuto,
|
|
@@ -70502,11 +71567,11 @@ async function getStatusData(directory, agents, sessionId, options) {
|
|
|
70502
71567
|
} catch {
|
|
70503
71568
|
status.memoryCohort = { linked: false };
|
|
70504
71569
|
}
|
|
70505
|
-
status.fullAutoActive =
|
|
71570
|
+
status.fullAutoActive = _internals97.hasActiveFullAuto();
|
|
70506
71571
|
if (status.fullAutoActive) {
|
|
70507
|
-
const sid =
|
|
71572
|
+
const sid = _internals97.getActiveFullAutoSessionID();
|
|
70508
71573
|
if (sid) {
|
|
70509
|
-
const runState =
|
|
71574
|
+
const runState = _internals97.loadFullAutoRunState(directory, sid);
|
|
70510
71575
|
if (runState?.lastEscalation) {
|
|
70511
71576
|
status.fullAutoEscalation = {
|
|
70512
71577
|
reason: runState.lastEscalation.reason,
|
|
@@ -70540,7 +71605,7 @@ async function getStatusData(directory, agents, sessionId, options) {
|
|
|
70540
71605
|
}
|
|
70541
71606
|
function enrichWithLeanTurbo(status, directory) {
|
|
70542
71607
|
const turboMode = hasActiveTurboMode();
|
|
70543
|
-
const leanActive =
|
|
71608
|
+
const leanActive = _internals97.hasActiveLeanTurbo();
|
|
70544
71609
|
let turboStrategy = "off";
|
|
70545
71610
|
if (leanActive) {
|
|
70546
71611
|
turboStrategy = "lean";
|
|
@@ -70571,7 +71636,7 @@ function enrichWithLeanTurbo(status, directory) {
|
|
|
70571
71636
|
}
|
|
70572
71637
|
}
|
|
70573
71638
|
if (leanSessionID) {
|
|
70574
|
-
const runState =
|
|
71639
|
+
const runState = _internals97.loadLeanTurboRunState(directory, leanSessionID);
|
|
70575
71640
|
if (runState) {
|
|
70576
71641
|
status.leanTurboPhase = runState.phase;
|
|
70577
71642
|
status.leanMaxParallelCoders = runState.maxParallelCoders;
|
|
@@ -70931,7 +71996,7 @@ init_logger();
|
|
|
70931
71996
|
var TURBO_BYPASS_DISCLOSURE = "Bypassed: Stage B (reviewer + test_engineer) for Tier 0-2 tasks; phase_complete Gates 1-5 " + "(completion-verify, drift-verifier, hallucination-guard, mutation-gate, phase-council). " + "Still enforced: Stage A (lint, imports, pre_check_batch); Tier 3 Stage B; Gate 5b " + "(architecture-supervisor); Gate 6 (final-council); Gate 7 (full-auto).";
|
|
70932
71997
|
|
|
70933
71998
|
// src/commands/turbo.ts
|
|
70934
|
-
var
|
|
71999
|
+
var _internals98 = {
|
|
70935
72000
|
loadPluginConfigWithMeta
|
|
70936
72001
|
};
|
|
70937
72002
|
async function handleTurboCommand(directory, args, sessionID) {
|
|
@@ -70991,7 +72056,7 @@ async function handleTurboCommand(directory, args, sessionID) {
|
|
|
70991
72056
|
if (arg0 === "on") {
|
|
70992
72057
|
let strategy = "standard";
|
|
70993
72058
|
try {
|
|
70994
|
-
const { config } =
|
|
72059
|
+
const { config } = _internals98.loadPluginConfigWithMeta(directory);
|
|
70995
72060
|
if (config.turbo?.strategy === "lean") {
|
|
70996
72061
|
strategy = "lean";
|
|
70997
72062
|
}
|
|
@@ -71088,7 +72153,7 @@ function enableLeanTurbo(session, directory, sessionID) {
|
|
|
71088
72153
|
let maxParallelCoders = 4;
|
|
71089
72154
|
let conflictPolicy = "serialize";
|
|
71090
72155
|
try {
|
|
71091
|
-
const { config } =
|
|
72156
|
+
const { config } = _internals98.loadPluginConfigWithMeta(directory);
|
|
71092
72157
|
const leanConfig = config.turbo?.lean;
|
|
71093
72158
|
if (leanConfig) {
|
|
71094
72159
|
maxParallelCoders = leanConfig.max_parallel_coders ?? 4;
|
|
@@ -71296,7 +72361,7 @@ function findSimilarCommands(query) {
|
|
|
71296
72361
|
}
|
|
71297
72362
|
const scored = VALID_COMMANDS.map((cmd) => {
|
|
71298
72363
|
const cmdLower = cmd.toLowerCase();
|
|
71299
|
-
const fullScore =
|
|
72364
|
+
const fullScore = _internals99.levenshteinDistance(q, cmdLower);
|
|
71300
72365
|
let tokenScore = Infinity;
|
|
71301
72366
|
if (cmd.includes(" ") || cmd.includes("-")) {
|
|
71302
72367
|
const qTokens = q.split(/[\s-]+/);
|
|
@@ -71309,7 +72374,7 @@ function findSimilarCommands(query) {
|
|
|
71309
72374
|
for (const ct of cmdTokens) {
|
|
71310
72375
|
if (ct.length === 0)
|
|
71311
72376
|
continue;
|
|
71312
|
-
const dist =
|
|
72377
|
+
const dist = _internals99.levenshteinDistance(qt, ct);
|
|
71313
72378
|
if (dist < minDist)
|
|
71314
72379
|
minDist = dist;
|
|
71315
72380
|
}
|
|
@@ -71319,7 +72384,7 @@ function findSimilarCommands(query) {
|
|
|
71319
72384
|
}
|
|
71320
72385
|
const dashStrippedQ = q.replace(/-/g, "");
|
|
71321
72386
|
const dashStrippedCmd = cmdLower.replace(/-/g, "");
|
|
71322
|
-
const dashScore =
|
|
72387
|
+
const dashScore = _internals99.levenshteinDistance(dashStrippedQ, dashStrippedCmd);
|
|
71323
72388
|
const score = Math.min(fullScore, tokenScore, dashScore);
|
|
71324
72389
|
return { cmd, score };
|
|
71325
72390
|
});
|
|
@@ -71354,16 +72419,16 @@ function buildDetailedHelp(commandName, entry) {
|
|
|
71354
72419
|
async function handleHelpCommand(ctx) {
|
|
71355
72420
|
const targetCommand = ctx.args.join(" ");
|
|
71356
72421
|
if (!targetCommand) {
|
|
71357
|
-
const { buildHelpText } = await import("./index-
|
|
72422
|
+
const { buildHelpText } = await import("./index-8cn6545x.js");
|
|
71358
72423
|
return buildHelpText();
|
|
71359
72424
|
}
|
|
71360
72425
|
const tokens = targetCommand.split(/\s+/);
|
|
71361
|
-
const resolved =
|
|
72426
|
+
const resolved = _internals99.resolveCommand(tokens);
|
|
71362
72427
|
if (resolved) {
|
|
71363
|
-
return
|
|
72428
|
+
return _internals99.buildDetailedHelp(resolved.key, resolved.entry);
|
|
71364
72429
|
}
|
|
71365
|
-
const similar =
|
|
71366
|
-
const { buildHelpText: fullHelp } = await import("./index-
|
|
72430
|
+
const similar = _internals99.findSimilarCommands(targetCommand);
|
|
72431
|
+
const { buildHelpText: fullHelp } = await import("./index-8cn6545x.js");
|
|
71367
72432
|
if (similar.length > 0) {
|
|
71368
72433
|
return `Command '/swarm ${targetCommand}' not found.
|
|
71369
72434
|
|
|
@@ -71474,7 +72539,7 @@ var COMMAND_REGISTRY = {
|
|
|
71474
72539
|
toolNoArgs: true
|
|
71475
72540
|
},
|
|
71476
72541
|
help: {
|
|
71477
|
-
handler: (ctx) =>
|
|
72542
|
+
handler: (ctx) => _internals99.handleHelpCommand(ctx),
|
|
71478
72543
|
description: "Show help for swarm commands",
|
|
71479
72544
|
category: "core",
|
|
71480
72545
|
args: "[command]",
|
|
@@ -71543,7 +72608,7 @@ var COMMAND_REGISTRY = {
|
|
|
71543
72608
|
},
|
|
71544
72609
|
"guardrail explain": {
|
|
71545
72610
|
handler: async (ctx) => {
|
|
71546
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
72611
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-1zbk21fq.js");
|
|
71547
72612
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
71548
72613
|
},
|
|
71549
72614
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -71553,7 +72618,7 @@ var COMMAND_REGISTRY = {
|
|
|
71553
72618
|
},
|
|
71554
72619
|
"guardrail reset": {
|
|
71555
72620
|
handler: async (ctx) => {
|
|
71556
|
-
const { handleGuardrailReset } = await import("./guardrail-reset-
|
|
72621
|
+
const { handleGuardrailReset } = await import("./guardrail-reset-wb3ba243.js");
|
|
71557
72622
|
return handleGuardrailReset(ctx.args, ctx.sessionID);
|
|
71558
72623
|
},
|
|
71559
72624
|
description: "Reset one exact active invocation/action circuit after repair",
|
|
@@ -71562,7 +72627,7 @@ var COMMAND_REGISTRY = {
|
|
|
71562
72627
|
},
|
|
71563
72628
|
"guardrail-explain": {
|
|
71564
72629
|
handler: async (ctx) => {
|
|
71565
|
-
const { handleGuardrailExplain } = await import("./guardrail-explain-
|
|
72630
|
+
const { handleGuardrailExplain } = await import("./guardrail-explain-1zbk21fq.js");
|
|
71566
72631
|
return handleGuardrailExplain(ctx.directory, ctx.args);
|
|
71567
72632
|
},
|
|
71568
72633
|
description: "Dry-run: show what the guardrails would do to a command or write target (executes nothing)",
|
|
@@ -71572,7 +72637,7 @@ var COMMAND_REGISTRY = {
|
|
|
71572
72637
|
},
|
|
71573
72638
|
"guardrail-reset": {
|
|
71574
72639
|
handler: async (ctx) => {
|
|
71575
|
-
const { handleGuardrailReset } = await import("./guardrail-reset-
|
|
72640
|
+
const { handleGuardrailReset } = await import("./guardrail-reset-wb3ba243.js");
|
|
71576
72641
|
return handleGuardrailReset(ctx.args, ctx.sessionID);
|
|
71577
72642
|
},
|
|
71578
72643
|
description: "Reset one exact active invocation/action circuit after repair",
|
|
@@ -71582,7 +72647,7 @@ var COMMAND_REGISTRY = {
|
|
|
71582
72647
|
},
|
|
71583
72648
|
"guardrail-log": {
|
|
71584
72649
|
handler: async (ctx) => {
|
|
71585
|
-
const { handleGuardrailLog } = await import("./guardrail-log-
|
|
72650
|
+
const { handleGuardrailLog } = await import("./guardrail-log-d20jewtr.js");
|
|
71586
72651
|
return handleGuardrailLog(ctx.directory, ctx.args);
|
|
71587
72652
|
},
|
|
71588
72653
|
description: "Read the guardrail decision log (use --blocks-only for blocks)",
|
|
@@ -72588,7 +73653,7 @@ function validateToolPolicy() {
|
|
|
72588
73653
|
}
|
|
72589
73654
|
return { valid: warnings.length === 0, warnings };
|
|
72590
73655
|
}
|
|
72591
|
-
var
|
|
73656
|
+
var _internals99 = {
|
|
72592
73657
|
handleHelpCommand,
|
|
72593
73658
|
validateAliases,
|
|
72594
73659
|
validateToolPolicy,
|
|
@@ -72598,16 +73663,16 @@ var _internals98 = {
|
|
|
72598
73663
|
findSimilarCommands,
|
|
72599
73664
|
buildDetailedHelp
|
|
72600
73665
|
};
|
|
72601
|
-
var validation =
|
|
73666
|
+
var validation = _internals99.validateAliases();
|
|
72602
73667
|
if (!validation.valid) {
|
|
72603
73668
|
throw new Error(`COMMAND_REGISTRY alias validation failed:
|
|
72604
73669
|
${validation.errors.join(`
|
|
72605
73670
|
`)}`);
|
|
72606
73671
|
}
|
|
72607
|
-
|
|
73672
|
+
_internals99.emitValidationWarnings("COMMAND_REGISTRY alias warnings", validation.warnings);
|
|
72608
73673
|
try {
|
|
72609
|
-
const toolPolicyValidation =
|
|
72610
|
-
|
|
73674
|
+
const toolPolicyValidation = _internals99.validateToolPolicy();
|
|
73675
|
+
_internals99.emitValidationWarnings("COMMAND_REGISTRY toolPolicy warnings", toolPolicyValidation.warnings);
|
|
72611
73676
|
} catch (e) {
|
|
72612
73677
|
warn(`COMMAND_REGISTRY toolPolicy validation failed (non-fatal): ${e.message}`);
|
|
72613
73678
|
}
|
|
@@ -73516,6 +74581,7 @@ HARD CONSTRAINTS (apply regardless of skill load success):
|
|
|
73516
74581
|
- Treat the controller Git-state result as final for the attempt: \`clean\` proceeds; \`stashable\` permits one preparation call; \`recovery-required\` or \`indeterminate\` means report the typed \`required_action\`, abort/clear any already-active gate, and STOP unless \`retryable: true\`. Never loop on stash against an unmerged index or in-progress Git operation.
|
|
73517
74582
|
- RUN ALL BASE LANES: the default PR_REVIEW path covers all six repository-agnostic base dimensions from the skill on every PR. Use \`mode: "swarm-pr-review:base"\`, the exact \`workflow_lane\` identifiers, and the exact bound \`pr_head_sha\`. With the default \`pr_review_resilience\` policy enabled, depth tier M/L MUST stage attempt 0 as one singleton \`pr_review_wave_stage: "canary"\` batch followed by a \`"fanout"\` batch whose combined canary+fanout ownership partitions all six dimensions exactly once; tier L still requires six singleton combined lanes, and tier S keeps the legacy one-wave path. If a project disables \`pr_review_resilience\`, stay on the legacy one-wave base dispatch. The runtime rejects omitted stage metadata, partial, duplicate, mislabelled, or structurally invalid waves.
|
|
73518
74583
|
- RETRY STRUCTURALLY: retry only unresolved failed base obligations in later \`swarm-pr-review:base\` async batches with the same exact \`pr_head_sha\`. Under staged resilience, attempts are numbered by \`pr_review_wave_attempt\`: attempt 0 plus at most two retry attempts (1 and 2), each with one singleton canary batch and then its matching fanout batch when obligations remain. Blocking \`dispatch_lanes\` and direct Task explorer/reviewer/critic dispatch are not provenance-equivalent and are rejected. If the runtime returns typed \`retry_exhausted\` or \`circuit_open\`, or if the second retry still cannot close coverage, collect every lane to settlement, do not probe downstream writers or micro lanes, call \`abort_pr_workflow\` with \`mode: "PR_REVIEW"\`, \`kind: "recovery"\`, and a non-empty one-line \`reason\` naming the failed lane or correlated failure and exhausted retries, then call \`prepare_pr_workflow_checkout\` with \`operation: "restore"\` before reporting the blocker.
|
|
74584
|
+
- RECOVER CONTRACT FAILURES EXPLICITLY: when collection reports \`workflow_lane_failure_class: "contract"\`, retry that one singleton base dimension once with \`pr_review_contract_retry: true\`; this retry is outside staged \`pr_review_wave_attempt\` accounting and cannot be combined with stage metadata. If exactly five base dimensions settle successfully and one dimension remains terminally failed with a typed \`contract\`, \`resource\`, or \`deadline\` class, the \`post_explorer\` findings write may explicitly submit \`partial_base_coverage: { missing_dimension: "<exact lane>" }\`. Never infer or omit this disclosure: the runtime verifies five-of-six, persists an immutable coverage receipt, and rejects any other partial shape.
|
|
73519
74585
|
- USE ASYNC DISPATCH WITHOUT IDLING: each admissible base wave uses one \`dispatch_lanes_async\` call. With enabled tier-M/L staged resilience, this means one singleton canary call followed by one unresolved-only fanout call after canary admission; it never means one legacy call carrying the whole initial base wave. Record each \`batch_id\`, then keep doing non-dependent architect work while its lanes run. Poll with \`collect_lane_results\` without \`wait\` (or \`wait: false\`) to process settled lanes and continue independent work between polls; use \`wait: true\` only as the final join when no independent work remains.
|
|
73520
74586
|
- EVALUATE ALL RISK FAMILIES: after the base explorer lanes settle, evaluate every repository-agnostic trigger row against the exact diff/context pack. Record applicable families as \`MATCHED\` and inapplicable families as provenance-free \`NOT_TRIGGERED\` with concrete absence evidence; \`unclassified-risk\` always remains \`MATCHED\`. Launch \`swarm-pr-review:micro\` lanes only for the \`MATCHED\` IDs. The first micro dispatch MUST pass the complete exact eleven-row \`trigger_evaluation\`, which freezes it for this session; any subsequent same-session micro batch may omit it and reuse the frozen ledger, while an explicitly supplied copy must remain exactly identical. Use each dispatched trigger ID as \`workflow_lane\`. Missing an evaluation row or a matched-family attestation is BLOCKED; a \`NOT_TRIGGERED\` family must not create a micro artifact.
|
|
73521
74587
|
- RUN HEAD-BOUND VALIDATION: dispatch independent reviewers with \`mode: "swarm-pr-review:reviewer"\` and critics with \`mode: "swarm-pr-review:critic"\`, unique \`workflow_lane\` obligations, role-correct agents, and the same exact \`pr_head_sha\`. Critic dispatch is blocked until all declared reviewer obligations have successful artifacts.
|
|
@@ -74987,7 +76053,7 @@ function formatCommandNotFound(tokens) {
|
|
|
74987
76053
|
const attemptedCommand = tokens[0] || "";
|
|
74988
76054
|
const MAX_DISPLAY = 100;
|
|
74989
76055
|
const displayCommand = attemptedCommand.length > MAX_DISPLAY ? `${attemptedCommand.slice(0, MAX_DISPLAY)}...` : attemptedCommand;
|
|
74990
|
-
const similar =
|
|
76056
|
+
const similar = _internals99.findSimilarCommands(attemptedCommand);
|
|
74991
76057
|
const header = `Command \`/swarm ${displayCommand}\` not found.`;
|
|
74992
76058
|
const suggestions = similar.length > 0 ? `Did you mean:
|
|
74993
76059
|
${similar.map((cmd) => ` - /swarm ${cmd}`).join(`
|
|
@@ -78007,7 +79073,7 @@ function getDisplayBudget() {
|
|
|
78007
79073
|
async function rehydratePrSubscriptions(sessionID, directory) {
|
|
78008
79074
|
const map = new Map;
|
|
78009
79075
|
try {
|
|
78010
|
-
const { listActive: listActive2 } = await import("./pr-subscriptions-
|
|
79076
|
+
const { listActive: listActive2 } = await import("./pr-subscriptions-q862pvz1.js");
|
|
78011
79077
|
const records = await listActive2(directory);
|
|
78012
79078
|
for (const record of records) {
|
|
78013
79079
|
if (record.sessionID !== sessionID)
|
|
@@ -78320,8 +79386,8 @@ var WORKTREE_LIST_TIMEOUT_MS = 15000;
|
|
|
78320
79386
|
async function preProvisionCollisionCheck(taskId, directory, _sessionId) {
|
|
78321
79387
|
let proc;
|
|
78322
79388
|
try {
|
|
78323
|
-
proc =
|
|
78324
|
-
|
|
79389
|
+
proc = _internals101.bunSpawn([
|
|
79390
|
+
_internals101.resolveGitExecutable(),
|
|
78325
79391
|
"-C",
|
|
78326
79392
|
directory,
|
|
78327
79393
|
"worktree",
|
|
@@ -78423,7 +79489,7 @@ function isLaneOwnedByCurrentSession(branchName, expectedSessionId) {
|
|
|
78423
79489
|
return extracted === expectedSessionId;
|
|
78424
79490
|
}
|
|
78425
79491
|
async function inspectStandardWorktreeCollisionOwnership(identity) {
|
|
78426
|
-
const collisionOwnership = await import("./worktree-collision-ownership-
|
|
79492
|
+
const collisionOwnership = await import("./worktree-collision-ownership-9v8e0dz7.js");
|
|
78427
79493
|
return collisionOwnership.inspectStandardWorktreeCollisionOwnership(identity);
|
|
78428
79494
|
}
|
|
78429
79495
|
async function precreateStandardWorktreeSession(args) {
|
|
@@ -78450,12 +79516,12 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
78450
79516
|
return;
|
|
78451
79517
|
}
|
|
78452
79518
|
const laneIndex = allocateStandardLaneIndex(args.parentSessionID);
|
|
78453
|
-
const lifecycleLock = await
|
|
79519
|
+
const lifecycleLock = await _internals101.tryAcquireWorktreeLifecycleLock(args.directory, WORKTREE_LIFECYCLE_LOCK_FILE, "worktree-provisioning", args.taskId);
|
|
78454
79520
|
if (!lifecycleLock.acquired) {
|
|
78455
79521
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, "STANDARD_WORKTREE_LIFECYCLE_BUSY: init orphan recovery is active; retry this coder dispatch after recovery completes.");
|
|
78456
79522
|
}
|
|
78457
79523
|
try {
|
|
78458
|
-
const collision = await
|
|
79524
|
+
const collision = await _internals101.preProvisionCollisionCheck(args.taskId, args.directory, args.parentSessionID);
|
|
78459
79525
|
if (collision.uncertainty) {
|
|
78460
79526
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `STANDARD_WORKTREE_COLLISION_SCAN_UNCERTAIN: ${collision.uncertainty}. Destructive cleanup and provisioning were blocked.`);
|
|
78461
79527
|
}
|
|
@@ -78464,17 +79530,17 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
78464
79530
|
const ownerInfo = collision.ownerSessionId ? ` owned by session ${collision.ownerSessionId}` : " with uncertain ownership";
|
|
78465
79531
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `PREPROVISION_COLLISION: task ${args.taskId} already has a lane on branch ${collision.existingBranch ?? "unknown"}${ownerInfo}; cleanup and provisioning were blocked.`);
|
|
78466
79532
|
}
|
|
78467
|
-
for (const dispatch of
|
|
79533
|
+
for (const dispatch of _internals101.standardWorktreeByCallID.values()) {
|
|
78468
79534
|
if (dispatch.handle.branchName === collision.existingBranch) {
|
|
78469
79535
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `PREPROVISION_COLLISION_ACTIVE: branch ${collision.existingBranch} is still tracked by an active standard-worktree dispatch.`);
|
|
78470
79536
|
}
|
|
78471
79537
|
}
|
|
78472
|
-
for (const record of
|
|
79538
|
+
for (const record of _internals101.awaitingMergeByCallID.values()) {
|
|
78473
79539
|
if (record.branch === collision.existingBranch) {
|
|
78474
79540
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `PREPROVISION_COLLISION_AWAITING_MERGE: branch ${collision.existingBranch} is still awaiting merge-back.`);
|
|
78475
79541
|
}
|
|
78476
79542
|
}
|
|
78477
|
-
const ownership = await
|
|
79543
|
+
const ownership = await _internals101.inspectStandardWorktreeCollisionOwnership({
|
|
78478
79544
|
directory: args.directory,
|
|
78479
79545
|
parentSessionId: args.parentSessionID,
|
|
78480
79546
|
taskId: args.taskId,
|
|
@@ -78499,30 +79565,30 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
78499
79565
|
}
|
|
78500
79566
|
}
|
|
78501
79567
|
if (collisionPathExists) {
|
|
78502
|
-
const preserveResult = await
|
|
79568
|
+
const preserveResult = await _internals101.preserveDirtyWorktreeAtPath(collision.worktreePath, collision.existingBranch, "denied", args.directory, worktreeConfig.worktree_dir);
|
|
78503
79569
|
if (preserveResult.outcome === "preserve-failed") {
|
|
78504
79570
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `STANDARD_WORKTREE_PRESERVATION_FAILED_ABORT_CLEANUP: pre-provision collision for task ${args.taskId} could not be preserved (${preserveResult.error}). Cleanup and provisioning were blocked.`);
|
|
78505
79571
|
}
|
|
78506
|
-
const removeResult = await
|
|
79572
|
+
const removeResult = await _internals101.removeWorktree(collision.worktreePath, args.directory, { force: true, worktreeDir: worktreeConfig.worktree_dir });
|
|
78507
79573
|
if ("error" in removeResult) {
|
|
78508
79574
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `STANDARD_WORKTREE_COLLISION_REMOVE_FAILED: ${removeResult.error}. Provisioning was blocked.`);
|
|
78509
79575
|
}
|
|
78510
|
-
const cleanupResult = await
|
|
79576
|
+
const cleanupResult = await _internals101.postMergeCleanup(args.directory, collision.existingBranch);
|
|
78511
79577
|
if ("error" in cleanupResult) {
|
|
78512
79578
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `STANDARD_WORKTREE_COLLISION_BRANCH_CLEANUP_FAILED: ${cleanupResult.error}. Provisioning was blocked.`);
|
|
78513
79579
|
}
|
|
78514
79580
|
} else {
|
|
78515
|
-
const pruneResult = await
|
|
79581
|
+
const pruneResult = await _internals101.pruneStaleWorktreeMetadata(args.directory);
|
|
78516
79582
|
if ("error" in pruneResult) {
|
|
78517
79583
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `STANDARD_WORKTREE_COLLISION_PRUNE_FAILED: ${pruneResult.error}. Provisioning was blocked without deleting the lane branch.`);
|
|
78518
79584
|
}
|
|
78519
79585
|
}
|
|
78520
|
-
const verification = await
|
|
79586
|
+
const verification = await _internals101.preProvisionCollisionCheck(args.taskId, args.directory, args.parentSessionID);
|
|
78521
79587
|
if (verification.uncertainty || verification.collision) {
|
|
78522
79588
|
hardStopStandardWorktreeLifecycle(args.parentSessionID, `STANDARD_WORKTREE_COLLISION_CLEANUP_UNVERIFIED: ${verification.uncertainty ?? "git still reports the colliding lane after cleanup"}. Provisioning was blocked.`);
|
|
78523
79589
|
}
|
|
78524
79590
|
}
|
|
78525
|
-
|
|
79591
|
+
_internals101.recordWorktreeProvisioningOwner(args.directory, {
|
|
78526
79592
|
callID: args.callID,
|
|
78527
79593
|
parentSessionId: args.parentSessionID,
|
|
78528
79594
|
worktreeSessionId: args.parentSessionID,
|
|
@@ -78540,7 +79606,7 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
78540
79606
|
}
|
|
78541
79607
|
let provisionResult;
|
|
78542
79608
|
try {
|
|
78543
|
-
provisionResult = await
|
|
79609
|
+
provisionResult = await _internals101.provisionWorktree(args.directory, args.taskId, args.parentSessionID, {
|
|
78544
79610
|
purpose: "lane",
|
|
78545
79611
|
worktreeDir: worktreeConfig.worktree_dir,
|
|
78546
79612
|
mergeStrategy: worktreeConfig.merge_strategy,
|
|
@@ -78548,11 +79614,11 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
78548
79614
|
scope: args.scope
|
|
78549
79615
|
});
|
|
78550
79616
|
} catch (error2) {
|
|
78551
|
-
|
|
79617
|
+
_internals101.removeWorktreeProvisioningOwner(args.directory, args.callID);
|
|
78552
79618
|
throw error2;
|
|
78553
79619
|
}
|
|
78554
79620
|
if ("error" in provisionResult) {
|
|
78555
|
-
|
|
79621
|
+
_internals101.removeWorktreeProvisioningOwner(args.directory, args.callID);
|
|
78556
79622
|
const message = `STANDARD_WORKTREE_PROVISION_FAILED: ${provisionResult.error}.`;
|
|
78557
79623
|
handleStandardWorktreeFailure(args.parentSessionID, worktreeConfig.policy, message);
|
|
78558
79624
|
return;
|
|
@@ -78571,7 +79637,7 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
78571
79637
|
const laneProfile = computeLaneRuntimeProfile(worktreeConfig.runtime_isolation, laneIndex, provisionResult.worktreePath);
|
|
78572
79638
|
if (laneProfile) {
|
|
78573
79639
|
try {
|
|
78574
|
-
const { writeLaneProfileToDiskReal } = await import("./core-
|
|
79640
|
+
const { writeLaneProfileToDiskReal } = await import("./core-xx0x5tfv.js");
|
|
78575
79641
|
await writeLaneProfileToDiskReal(provisionResult.worktreePath, laneProfile.laneIndex, laneProfile.envOverrides);
|
|
78576
79642
|
} catch {}
|
|
78577
79643
|
}
|
|
@@ -78592,13 +79658,13 @@ async function precreateStandardWorktreeSession(args) {
|
|
|
78592
79658
|
query: { directory: provisionResult.worktreePath }
|
|
78593
79659
|
});
|
|
78594
79660
|
if (!createResult.data?.id) {
|
|
78595
|
-
await
|
|
79661
|
+
await _internals101.removeWorktree(provisionResult.worktreePath, args.directory, {
|
|
78596
79662
|
force: true,
|
|
78597
79663
|
worktreeDir: worktreeConfig.worktree_dir
|
|
78598
79664
|
}).catch((cleanupError) => {
|
|
78599
79665
|
log(`[worktree-isolation] session-create failure cleanup could not remove lane ${provisionResult.worktreePath}: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`);
|
|
78600
79666
|
});
|
|
78601
|
-
|
|
79667
|
+
_internals101.removeWorktreeProvisioningOwner(args.directory, args.callID);
|
|
78602
79668
|
const createError = createResult.error;
|
|
78603
79669
|
const detail = typeof createError === "string" ? createError : JSON.stringify(createError ?? "missing session id");
|
|
78604
79670
|
const message = `STANDARD_WORKTREE_SESSION_CREATE_FAILED: ${detail}.`;
|
|
@@ -78626,8 +79692,8 @@ async function preserveBackgroundWorktreeOwnershipForCallId(callID) {
|
|
|
78626
79692
|
return { outcome: "not-found" };
|
|
78627
79693
|
let refProc;
|
|
78628
79694
|
try {
|
|
78629
|
-
refProc =
|
|
78630
|
-
|
|
79695
|
+
refProc = _internals101.bunSpawn([
|
|
79696
|
+
_internals101.resolveGitExecutable(),
|
|
78631
79697
|
"-C",
|
|
78632
79698
|
dispatch.handle.worktreePath,
|
|
78633
79699
|
"rev-parse",
|
|
@@ -78671,8 +79737,8 @@ async function preserveBackgroundWorktreeOwnershipForCallId(callID) {
|
|
|
78671
79737
|
const tag = `swarm-preserved-owner/${session}/${lane}/${callDigest}`;
|
|
78672
79738
|
let tagProc;
|
|
78673
79739
|
try {
|
|
78674
|
-
tagProc =
|
|
78675
|
-
|
|
79740
|
+
tagProc = _internals101.bunSpawn([
|
|
79741
|
+
_internals101.resolveGitExecutable(),
|
|
78676
79742
|
"-C",
|
|
78677
79743
|
dispatch.handle.worktreePath,
|
|
78678
79744
|
"tag",
|
|
@@ -78722,8 +79788,8 @@ async function preserveDirtyWorktreeForCallId(callID, reason, _directory, _workt
|
|
|
78722
79788
|
}
|
|
78723
79789
|
let statusProc;
|
|
78724
79790
|
try {
|
|
78725
|
-
statusProc =
|
|
78726
|
-
|
|
79791
|
+
statusProc = _internals101.bunSpawn([
|
|
79792
|
+
_internals101.resolveGitExecutable(),
|
|
78727
79793
|
"-C",
|
|
78728
79794
|
worktreePath,
|
|
78729
79795
|
"status",
|
|
@@ -78765,7 +79831,7 @@ async function preserveDirtyWorktreeForCallId(callID, reason, _directory, _workt
|
|
|
78765
79831
|
}
|
|
78766
79832
|
let addProc;
|
|
78767
79833
|
try {
|
|
78768
|
-
addProc =
|
|
79834
|
+
addProc = _internals101.bunSpawn([_internals101.resolveGitExecutable(), "-C", worktreePath, "add", "-A"], {
|
|
78769
79835
|
stdin: "ignore",
|
|
78770
79836
|
stdout: "pipe",
|
|
78771
79837
|
stderr: "pipe",
|
|
@@ -78799,8 +79865,8 @@ async function preserveDirtyWorktreeForCallId(callID, reason, _directory, _workt
|
|
|
78799
79865
|
const commitMessage = `swarm-preserved: ${reason} for callID ${sanitizedCallID} at ${isoDate}`;
|
|
78800
79866
|
let commitProc;
|
|
78801
79867
|
try {
|
|
78802
|
-
commitProc =
|
|
78803
|
-
|
|
79868
|
+
commitProc = _internals101.bunSpawn([
|
|
79869
|
+
_internals101.resolveGitExecutable(),
|
|
78804
79870
|
"-C",
|
|
78805
79871
|
worktreePath,
|
|
78806
79872
|
"commit",
|
|
@@ -78838,8 +79904,8 @@ async function preserveDirtyWorktreeForCallId(callID, reason, _directory, _workt
|
|
|
78838
79904
|
}
|
|
78839
79905
|
let hashProc;
|
|
78840
79906
|
try {
|
|
78841
|
-
hashProc =
|
|
78842
|
-
|
|
79907
|
+
hashProc = _internals101.bunSpawn([
|
|
79908
|
+
_internals101.resolveGitExecutable(),
|
|
78843
79909
|
"-C",
|
|
78844
79910
|
worktreePath,
|
|
78845
79911
|
"rev-parse",
|
|
@@ -78885,7 +79951,7 @@ async function preserveDirtyWorktreeForCallId(callID, reason, _directory, _workt
|
|
|
78885
79951
|
const tagName = `swarm-preserved-${sanitizedCallID}-${shortHash}`;
|
|
78886
79952
|
let tagProc;
|
|
78887
79953
|
try {
|
|
78888
|
-
tagProc =
|
|
79954
|
+
tagProc = _internals101.bunSpawn([_internals101.resolveGitExecutable(), "-C", worktreePath, "tag", tagName], {
|
|
78889
79955
|
stdin: "ignore",
|
|
78890
79956
|
stdout: "pipe",
|
|
78891
79957
|
stderr: "pipe",
|
|
@@ -78921,8 +79987,8 @@ async function preserveDirtyWorktreeForCallId(callID, reason, _directory, _workt
|
|
|
78921
79987
|
async function preserveDirtyWorktreeAtPath(worktreePath, branchName, reason, _directory, _worktree_dir) {
|
|
78922
79988
|
let statusProc;
|
|
78923
79989
|
try {
|
|
78924
|
-
statusProc =
|
|
78925
|
-
|
|
79990
|
+
statusProc = _internals101.bunSpawn([
|
|
79991
|
+
_internals101.resolveGitExecutable(),
|
|
78926
79992
|
"-C",
|
|
78927
79993
|
worktreePath,
|
|
78928
79994
|
"status",
|
|
@@ -78964,7 +80030,7 @@ async function preserveDirtyWorktreeAtPath(worktreePath, branchName, reason, _di
|
|
|
78964
80030
|
}
|
|
78965
80031
|
let addProc;
|
|
78966
80032
|
try {
|
|
78967
|
-
addProc =
|
|
80033
|
+
addProc = _internals101.bunSpawn([_internals101.resolveGitExecutable(), "-C", worktreePath, "add", "-A"], {
|
|
78968
80034
|
stdin: "ignore",
|
|
78969
80035
|
stdout: "pipe",
|
|
78970
80036
|
stderr: "pipe",
|
|
@@ -78999,8 +80065,8 @@ async function preserveDirtyWorktreeAtPath(worktreePath, branchName, reason, _di
|
|
|
78999
80065
|
const commitMessage = `swarm-preserved: ${reason} for worktree ${sanitizedPath} at ${isoDate}`;
|
|
79000
80066
|
let commitProc;
|
|
79001
80067
|
try {
|
|
79002
|
-
commitProc =
|
|
79003
|
-
|
|
80068
|
+
commitProc = _internals101.bunSpawn([
|
|
80069
|
+
_internals101.resolveGitExecutable(),
|
|
79004
80070
|
"-C",
|
|
79005
80071
|
worktreePath,
|
|
79006
80072
|
"commit",
|
|
@@ -79038,8 +80104,8 @@ async function preserveDirtyWorktreeAtPath(worktreePath, branchName, reason, _di
|
|
|
79038
80104
|
}
|
|
79039
80105
|
let hashProc;
|
|
79040
80106
|
try {
|
|
79041
|
-
hashProc =
|
|
79042
|
-
|
|
80107
|
+
hashProc = _internals101.bunSpawn([
|
|
80108
|
+
_internals101.resolveGitExecutable(),
|
|
79043
80109
|
"-C",
|
|
79044
80110
|
worktreePath,
|
|
79045
80111
|
"rev-parse",
|
|
@@ -79085,7 +80151,7 @@ async function preserveDirtyWorktreeAtPath(worktreePath, branchName, reason, _di
|
|
|
79085
80151
|
const tagName = `swarm-preserved-worktree-${sanitizedBranch}-${shortHash}`;
|
|
79086
80152
|
let tagProc;
|
|
79087
80153
|
try {
|
|
79088
|
-
tagProc =
|
|
80154
|
+
tagProc = _internals101.bunSpawn([_internals101.resolveGitExecutable(), "-C", worktreePath, "tag", tagName], {
|
|
79089
80155
|
stdin: "ignore",
|
|
79090
80156
|
stdout: "pipe",
|
|
79091
80157
|
stderr: "pipe",
|
|
@@ -79137,7 +80203,7 @@ async function cleanupStandardWorktreeForCallId(callID, reason, directory, workt
|
|
|
79137
80203
|
let preserveResult;
|
|
79138
80204
|
if (reason === "denied" || reason === "cancelled") {
|
|
79139
80205
|
try {
|
|
79140
|
-
preserveResult = await
|
|
80206
|
+
preserveResult = await _internals101.preserveDirtyWorktreeForCallId(callID, reason, directory, worktree_dir);
|
|
79141
80207
|
} catch (err) {
|
|
79142
80208
|
log(`[swarm] cleanupStandardWorktreeForCallId: preserveDirtyWorktreeForCallId threw for ${callID}: ${err}`);
|
|
79143
80209
|
preserveResult = {
|
|
@@ -79148,7 +80214,7 @@ async function cleanupStandardWorktreeForCallId(callID, reason, directory, workt
|
|
|
79148
80214
|
}
|
|
79149
80215
|
if (preserveResult.outcome === "clean") {
|
|
79150
80216
|
try {
|
|
79151
|
-
preserveResult = await
|
|
80217
|
+
preserveResult = await _internals101.preserveDirtyWorktreeForCallId(callID, reason, directory, worktree_dir);
|
|
79152
80218
|
} catch (err) {
|
|
79153
80219
|
log(`[swarm] cleanupStandardWorktreeForCallId: final preservation check threw for ${callID}: ${err}`);
|
|
79154
80220
|
preserveResult = {
|
|
@@ -79166,11 +80232,11 @@ async function cleanupStandardWorktreeForCallId(callID, reason, directory, workt
|
|
|
79166
80232
|
pushAdvisory(session2, `STANDARD_WORKTREE_PRESERVATION_FAILED_ABORT_CLEANUP: dispatch ${callID} has dirty uncommitted work but preservation failed (${preserveResult.error}). Cleanup aborted to protect uncommitted work. Investigate and resolve manually. Worktree=${worktreePath}; branch=${branchName}.`);
|
|
79167
80233
|
return;
|
|
79168
80234
|
}
|
|
79169
|
-
await
|
|
80235
|
+
await _internals101.removeWorktree(worktreePath, directory, {
|
|
79170
80236
|
force: true,
|
|
79171
80237
|
worktreeDir: worktree_dir
|
|
79172
80238
|
}).catch((err) => log(`[swarm] cleanupStandardWorktreeForCallId: removeWorktree failed for ${callID}: ${err}`));
|
|
79173
|
-
await
|
|
80239
|
+
await _internals101.postMergeCleanup(directory, branchName).catch((err) => log(`[swarm] cleanupStandardWorktreeForCallId: postMergeCleanup failed for ${callID}: ${err}`));
|
|
79174
80240
|
standardWorktreeByCallID.delete(callID);
|
|
79175
80241
|
awaitingMergeByCallID.delete(callID);
|
|
79176
80242
|
const session = ensureAgentSession(parentSessionID);
|
|
@@ -79189,7 +80255,7 @@ async function finishStandardWorktreeDispatch(directory, dispatch, config, callI
|
|
|
79189
80255
|
const wtConfig = config ? resolveWorktreeIsolationConfig(config) : DEFAULT_WORKTREE_ISOLATION_CONFIG;
|
|
79190
80256
|
const resolvedCallID = callID ?? dispatch.callID;
|
|
79191
80257
|
const run = async () => {
|
|
79192
|
-
const mergeResult = await
|
|
80258
|
+
const mergeResult = await _internals101.attemptMergeBackFromDirty(dispatch.handle.worktreePath, dispatch.handle.branchName, directory, getMergeStrategy({ merge_strategy: dispatch.mergeStrategy }), {
|
|
79193
80259
|
operationId: settlement.operationId,
|
|
79194
80260
|
resume: settlement.resume,
|
|
79195
80261
|
onBeforeMerge: settlement.onBeforeMerge
|
|
@@ -79229,7 +80295,7 @@ async function finishStandardWorktreeDispatch(directory, dispatch, config, callI
|
|
|
79229
80295
|
}
|
|
79230
80296
|
clearWorktreeMergeStatus(statusKey);
|
|
79231
80297
|
try {
|
|
79232
|
-
const { removeLaneProfileFromDiskReal } = await import("./core-
|
|
80298
|
+
const { removeLaneProfileFromDiskReal } = await import("./core-xx0x5tfv.js");
|
|
79233
80299
|
await removeLaneProfileFromDiskReal(dispatch.handle.worktreePath, dispatch.laneIndex);
|
|
79234
80300
|
} catch {}
|
|
79235
80301
|
const state = serializationStateBySessionID.get(dispatch.parentSessionID);
|
|
@@ -79347,7 +80413,7 @@ async function readLaneEnvFileFromDisk(worktreePath, laneIndex) {
|
|
|
79347
80413
|
}
|
|
79348
80414
|
return result;
|
|
79349
80415
|
}
|
|
79350
|
-
var
|
|
80416
|
+
var _internals101 = {
|
|
79351
80417
|
provisionWorktree,
|
|
79352
80418
|
removeWorktree,
|
|
79353
80419
|
attemptMergeBackFromDirty,
|
|
@@ -79375,4 +80441,4 @@ var _internals100 = {
|
|
|
79375
80441
|
resolveGitExecutable
|
|
79376
80442
|
};
|
|
79377
80443
|
|
|
79378
|
-
export { resetActionCircuitExternally, getBlockingActionCircuit, parseLeanLaneIndex, computeLaneRuntimeProfile, MAX_TRACKED_STANDARD_WORKTREE_CALLS, awaitingMergeByCallID, standardWorktreeByCallID, standardWorktreeSerializationSessions, getStandardWorktreeDegradationReason, resetStandardWorktreeIsolationState, checkStandardWorktreeSerializationRelease, sanitizeWorktreeTaskId, preProvisionCollisionCheck, isLaneOwnedByCurrentSession, precreateStandardWorktreeSession, preserveBackgroundWorktreeOwnershipForCallId, preserveDirtyWorktreeForCallId, preserveDirtyWorktreeAtPath, cleanupStandardWorktreeForCallId, abortStandardWorktreeDispatch, finishStandardWorktreeDispatch, readLaneEnvFileFromDisk,
|
|
80444
|
+
export { resetActionCircuitExternally, getBlockingActionCircuit, parseLeanLaneIndex, computeLaneRuntimeProfile, MAX_TRACKED_STANDARD_WORKTREE_CALLS, awaitingMergeByCallID, standardWorktreeByCallID, standardWorktreeSerializationSessions, getStandardWorktreeDegradationReason, resetStandardWorktreeIsolationState, checkStandardWorktreeSerializationRelease, sanitizeWorktreeTaskId, preProvisionCollisionCheck, isLaneOwnedByCurrentSession, precreateStandardWorktreeSession, preserveBackgroundWorktreeOwnershipForCallId, preserveDirtyWorktreeForCallId, preserveDirtyWorktreeAtPath, cleanupStandardWorktreeForCallId, abortStandardWorktreeDispatch, finishStandardWorktreeDispatch, readLaneEnvFileFromDisk, _internals101 as _internals, dcNormalizeCommand, dcUnwrapWrappers, dcSplitSegments, dcExtractRecursiveRmTargets, dcEvaluateRecursiveDeleteTargets, dcCheckJunctionCreation, dcExtractWindowsCmdTargets, dcExtractPowerShellTargets, normalizeSwarmCommandInput, canonicalCommandKey, formatCommandNotFound, executeSwarmCommand, SWARM_COMMAND_TOOL_COMMANDS, SWARM_COMMAND_TOOL_ALLOWLIST, HUMAN_ONLY_SWARM_COMMANDS, classifySwarmCommandToolUse, classifySwarmCommandChatFallbackUse, detectPosixWrites, detectWindowsWrites, resolveWriteTargets, getAgentSession, handleAcknowledgeSpecDriftCommand, handleAgentsCommand, handleAnalyzeCommand, handleArchiveCommand, handleAutoProceedCommand, handleBenchmarkCommand, handleBrainstormCommand, handleCheckpointCommand, handleCiSimulateCommand, handleClarifyCommand, createCuratorLLMDelegate, _internals25 as _internals1, normalizeRecommendationEntryIdToken, parseKnowledgeRecommendations, parseKnowledgeRecommendationsWithDiagnostics, parseStructuredCuratorBlocks, readCuratorSummary, writeCuratorSummary, appendCuratorRecommendation, mergeCuratorPhaseSummary, filterPhaseEvents, checkPhaseCompliance, runCuratorInit, runCuratorPhase, applyCuratorKnowledgeUpdates, isHiveEligible, countDistinctProjects, checkHivePromotions, _internals29 as _internals2, createHivePromoterHook, promoteToHive, promoteFromSwarm, handleCloseCommand, handleCodebaseReviewCommand, handleConcurrencyCommand, handleConfigCommand, handleConsolidateCommand, handleCostsCommand, handleCouncilCommand, handleCurateCommand, handleDarkMatterCommand, handleDeepDiveCommand, handleDeepResearchCommand, getPluginConfigDir, getPluginCachePaths, getPluginLockFilePaths, VERSION_PINNED_LEAF, discoverVersionPinnedCachePaths, readCachePackageVersion, handleDiagnoseCommand, handleDoctorCommand, handleEvidenceCommand, handleEvidenceSummaryCommand, handleExportCommand, handleFullAutoCommand, handleGateAuditCommand, handleGateStatsCommand, handleHandoffCommand, handleHistoryCommand, handleKnowledgeQuarantineCommand, handleKnowledgeRestoreCommand, handleKnowledgeMigrateCommand, handleKnowledgeListCommand, handleKnowledgeUnactionableCommand, handleKnowledgeRetryHardeningCommand, handleLearningCommand, handleLinkCommand, safeRealpathSync, handleMemoryCommand, handleMemoryStatusCommand, handleMemoryValueLogCommand, handleMemoryMigrateCommand, handleMemoryImportCommand, handleMemoryExportCommand, handlePlanCommand, handlePreflightCommand, handlePromoteCommand, handleQaGatesCommand, handleRecoverCommand, handleResetCommand, handleResetSessionCommand, handleRetrieveCommand, handleReviewCommand, handleRollbackCommand, handleSddStatusCommand, handleSddValidateCommand, handleSddProjectCommand, handleSddCommand, handleSimulateCommand, handleSpecifyCommand, handleStatusCommand, handleSyncPlanCommand, handleTurboCommand, handleUnlinkCommand, handleWriteRetroCommand, handleHelpCommand, COMMAND_REGISTRY, VALID_COMMANDS, _internals99 as _internals3, resolveCommand };
|