opencode-swarm 7.144.0 → 7.144.2
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/agents/architect.d.ts +65 -0
- package/dist/agents/coder.d.ts +1 -0
- package/dist/agents/critic.d.ts +1 -0
- package/dist/agents/explorer.d.ts +1 -0
- package/dist/agents/reviewer.d.ts +1 -0
- package/dist/cli/{ast-diff-ypptrcan.js → ast-diff-wbjcazfx.js} +5 -3
- package/dist/cli/{config-doctor-7gy47evn.js → config-doctor-7dfvxwjb.js} +3 -3
- package/dist/cli/{core-cpcspaw5.js → core-dwmwdc4y.js} +2 -2
- package/dist/cli/{curator-llm-factory-fyjmgxyp.js → curator-llm-factory-rrs1q4hg.js} +20 -20
- package/dist/cli/{curator-v97jnwn2.js → curator-w213v33y.js} +20 -20
- package/dist/cli/{evidence-summary-service-79mtxzhd.js → evidence-summary-service-t7n2h1he.js} +7 -7
- package/dist/cli/{explorer-18353rhn.js → explorer-zvk5kbcb.js} +3 -1
- package/dist/cli/{gate-evidence-kgyqz1g1.js → gate-evidence-xvxn603y.js} +3 -3
- package/dist/cli/{guardrail-explain-9ry66z5g.js → guardrail-explain-v1mwsnkq.js} +21 -21
- package/dist/cli/{guardrail-log-fe6smme1.js → guardrail-log-dn03dpz2.js} +4 -4
- package/dist/cli/{hive-promoter-vwq1dbh1.js → hive-promoter-asjtj7ga.js} +20 -20
- package/dist/cli/{index-8xertnqz.js → index-333kvewd.js} +4 -4
- package/dist/cli/{index-xmzmeknp.js → index-70ha9e09.js} +2 -1
- package/dist/cli/{index-269b52r3.js → index-7ca3a6gj.js} +3 -3
- package/dist/cli/{index-5n69863d.js → index-7ryh498h.js} +1 -173
- package/dist/cli/{index-vb9cpaz4.js → index-av0f6mm0.js} +5 -5
- package/dist/cli/{index-jqabjy7t.js → index-ckrasab9.js} +4 -4
- package/dist/cli/{index-jvbfrwt2.js → index-d55crzd4.js} +1 -1
- package/dist/cli/index-ddpkwdcb.js +176 -0
- package/dist/cli/{index-1pr8x10a.js → index-dg2w0wr4.js} +3 -3
- package/dist/cli/{index-tfkfyshg.js → index-dhh2j2nd.js} +2 -7
- package/dist/cli/{index-0ck3e366.js → index-g1c5fgaw.js} +1 -1
- package/dist/cli/{index-d45yrzkg.js → index-g2ajae1z.js} +2 -2
- package/dist/cli/{index-3q9w6e6v.js → index-h3z64mhz.js} +6 -2
- package/dist/cli/{index-6p09gyra.js → index-hqvt3mhk.js} +1 -1
- package/dist/cli/{index-evvbmbbv.js → index-jb4tchvy.js} +2 -2
- package/dist/cli/{index-rd2082y4.js → index-jsfghpy2.js} +2 -2
- package/dist/cli/{index-mw6p3nt6.js → index-m6wv2qdr.js} +1 -1
- package/dist/cli/{index-ewzmjm7m.js → index-ne8cfgw5.js} +1 -1
- package/dist/cli/{index-j1scj25g.js → index-nretd4qn.js} +6659 -1725
- package/dist/cli/{index-ez18gjk2.js → index-p3tnmkvc.js} +3 -3
- package/dist/cli/{index-3v3dxf75.js → index-qpt8ahph.js} +196 -93
- package/dist/cli/{index-e70d3xr7.js → index-tg9fn2dy.js} +22 -22
- package/dist/cli/{index-jqsfsqbx.js → index-whezv7vc.js} +4 -0
- package/dist/cli/{index-4905hd2m.js → index-wx8zdh4a.js} +6 -1
- package/dist/cli/{index-d45d4zyq.js → index-y95nwsge.js} +1 -1
- package/dist/cli/{index-zv4pwyas.js → index-zr370283.js} +3 -3
- package/dist/cli/index.js +22 -36
- package/dist/cli/{knowledge-escalator-rmy3jcx4.js → knowledge-escalator-cg19dhe5.js} +7 -7
- package/dist/cli/{knowledge-events-1tqpbwvj.js → knowledge-events-yzvysaqd.js} +5 -5
- package/dist/cli/{knowledge-store-389ck792.js → knowledge-store-6f77xpmm.js} +1 -1
- package/dist/cli/{knowledge-validator-kvtk6633.js → knowledge-validator-4b28zdxa.js} +2 -2
- package/dist/cli/{runtime-te94z1zb.js → runtime-x10qb3z1.js} +3 -2
- package/dist/cli/{scan-cursor-ahgm4f5p.js → scan-cursor-nqbb1xt6.js} +2 -2
- package/dist/cli/{schema-epdq7ykx.js → schema-jj2pb6zp.js} +2 -2
- package/dist/cli/{scope-persistence-37s9n40v.js → scope-persistence-63nasq0z.js} +5 -5
- package/dist/cli/{skill-generator-4d2t5gem.js → skill-generator-nsymtdqm.js} +8 -8
- package/dist/cli/tree-sitter-431q1bka.js +26 -0
- package/dist/cli/{worktree-isolation-4628yaka.js → worktree-isolation-g54kxw6x.js} +20 -20
- package/dist/config/constants.d.ts +1 -1
- package/dist/config/schema.d.ts +8 -0
- package/dist/hooks/review-receipt-scope.d.ts +42 -15
- package/dist/hooks/reviewer-scope-file-fingerprint.d.ts +58 -6
- package/dist/hooks/reviewer-scope-lifecycle.d.ts +9 -1
- package/dist/hooks/reviewer-scope-mergeback.d.ts +23 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +564 -522
- package/dist/memory/config.d.ts +6 -0
- package/dist/memory/consolidation.d.ts +2 -0
- package/dist/memory/gateway.d.ts +12 -1
- package/dist/memory/index.d.ts +6 -4
- package/dist/memory/jsonl-migration.d.ts +28 -3
- package/dist/memory/local-jsonl-provider.d.ts +16 -1
- package/dist/memory/maintenance.d.ts +5 -0
- package/dist/memory/memory-family-migration.d.ts +12 -0
- package/dist/memory/outcome-events.d.ts +24 -0
- package/dist/memory/provider.d.ts +7 -1
- package/dist/memory/reflection-injection.d.ts +1 -0
- package/dist/memory/reflection-service.d.ts +68 -0
- package/dist/memory/reflection.d.ts +41 -0
- package/dist/memory/schema.d.ts +13 -1
- package/dist/memory/sqlite-provider.d.ts +18 -1
- package/dist/memory/types.d.ts +19 -1
- package/dist/state.d.ts +107 -2
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/manifest.d.ts +1 -0
- package/dist/tools/swarm-memory-outcome.d.ts +11 -0
- package/dist/tools/tool-metadata.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import {
|
|
3
|
-
withTimeout
|
|
4
|
-
} from "./index-4905hd2m.js";
|
|
5
2
|
import {
|
|
6
3
|
__require
|
|
7
4
|
} from "./index-a76rekgs.js";
|
|
8
5
|
|
|
9
|
-
// src/lang/runtime.ts
|
|
10
|
-
import { existsSync, statSync } from "fs";
|
|
11
|
-
import * as path from "path";
|
|
12
|
-
import { fileURLToPath } from "url";
|
|
13
|
-
|
|
14
6
|
// node_modules/web-tree-sitter/tree-sitter.js
|
|
15
7
|
var __defProp = Object.defineProperty;
|
|
16
8
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
@@ -3222,168 +3214,4 @@ var Parser = class {
|
|
|
3222
3214
|
return this.logCallback;
|
|
3223
3215
|
}
|
|
3224
3216
|
};
|
|
3225
|
-
|
|
3226
|
-
// src/lang/runtime.ts
|
|
3227
|
-
var parserCache = new Map;
|
|
3228
|
-
var inflightLoads = new Map;
|
|
3229
|
-
var GRAMMAR_LOAD_TIMEOUT_MS = 1e4;
|
|
3230
|
-
var initializedLanguages = new Set;
|
|
3231
|
-
var treeSitterInitPromise = null;
|
|
3232
|
-
var _internals = {
|
|
3233
|
-
parserInit: Parser.init,
|
|
3234
|
-
getModuleDir: () => path.dirname(fileURLToPath(import.meta.url)),
|
|
3235
|
-
fileExists: existsSync
|
|
3236
|
-
};
|
|
3237
|
-
async function initTreeSitter() {
|
|
3238
|
-
if (!treeSitterInitPromise) {
|
|
3239
|
-
treeSitterInitPromise = (async () => {
|
|
3240
|
-
const thisDir = _internals.getModuleDir();
|
|
3241
|
-
const isSource = thisDir.replace(/\\/g, "/").endsWith("/src/lang");
|
|
3242
|
-
if (isSource) {
|
|
3243
|
-
await _internals.parserInit();
|
|
3244
|
-
} else {
|
|
3245
|
-
const grammarsDir = getGrammarsDirAbsolute();
|
|
3246
|
-
const coreWasmPath = path.join(grammarsDir, "tree-sitter.wasm");
|
|
3247
|
-
if (!_internals.fileExists(coreWasmPath)) {
|
|
3248
|
-
throw new Error(`Core tree-sitter WASM runtime missing: ${coreWasmPath}
|
|
3249
|
-
` + `The installed OpenCode plugin cache is incomplete or stale. Run ` + `'bunx opencode-swarm update', then restart OpenCode so it fetches ` + `a fresh package from npm.`);
|
|
3250
|
-
}
|
|
3251
|
-
await _internals.parserInit({
|
|
3252
|
-
locateFile(scriptName) {
|
|
3253
|
-
return path.join(grammarsDir, scriptName);
|
|
3254
|
-
}
|
|
3255
|
-
});
|
|
3256
|
-
}
|
|
3257
|
-
})().catch((err2) => {
|
|
3258
|
-
treeSitterInitPromise = null;
|
|
3259
|
-
throw err2;
|
|
3260
|
-
});
|
|
3261
|
-
}
|
|
3262
|
-
return treeSitterInitPromise;
|
|
3263
|
-
}
|
|
3264
|
-
var LANGUAGE_WASM_MAP = {
|
|
3265
|
-
javascript: "tree-sitter-javascript.wasm",
|
|
3266
|
-
typescript: "tree-sitter-typescript.wasm",
|
|
3267
|
-
tsx: "tree-sitter-tsx.wasm",
|
|
3268
|
-
python: "tree-sitter-python.wasm",
|
|
3269
|
-
go: "tree-sitter-go.wasm",
|
|
3270
|
-
rust: "tree-sitter-rust.wasm",
|
|
3271
|
-
cpp: "tree-sitter-cpp.wasm",
|
|
3272
|
-
c: "tree-sitter-cpp.wasm",
|
|
3273
|
-
csharp: "tree-sitter-c-sharp.wasm",
|
|
3274
|
-
css: "tree-sitter-css.wasm",
|
|
3275
|
-
bash: "tree-sitter-bash.wasm",
|
|
3276
|
-
ruby: "tree-sitter-ruby.wasm",
|
|
3277
|
-
php: "tree-sitter-php.wasm",
|
|
3278
|
-
java: "tree-sitter-java.wasm",
|
|
3279
|
-
kotlin: "tree-sitter-kotlin.wasm",
|
|
3280
|
-
swift: "tree-sitter-swift.wasm",
|
|
3281
|
-
dart: "tree-sitter-dart.wasm",
|
|
3282
|
-
powershell: "tree-sitter-powershell.wasm",
|
|
3283
|
-
ini: "tree-sitter-ini.wasm",
|
|
3284
|
-
regex: "tree-sitter-regex.wasm"
|
|
3285
|
-
};
|
|
3286
|
-
function sanitizeLanguageId(languageId) {
|
|
3287
|
-
const normalized = languageId.toLowerCase();
|
|
3288
|
-
if (!/^[a-z0-9-]+$/.test(normalized)) {
|
|
3289
|
-
throw new Error(`Invalid language ID: ${languageId}`);
|
|
3290
|
-
}
|
|
3291
|
-
return normalized;
|
|
3292
|
-
}
|
|
3293
|
-
function getWasmFileName(languageId) {
|
|
3294
|
-
const sanitized = sanitizeLanguageId(languageId).toLowerCase();
|
|
3295
|
-
if (LANGUAGE_WASM_MAP[sanitized]) {
|
|
3296
|
-
return LANGUAGE_WASM_MAP[sanitized];
|
|
3297
|
-
}
|
|
3298
|
-
return `tree-sitter-${sanitized}.wasm`;
|
|
3299
|
-
}
|
|
3300
|
-
function resolveGrammarsDir(thisDir) {
|
|
3301
|
-
const normalized = thisDir.replace(/\\/g, "/");
|
|
3302
|
-
const isSource = normalized.endsWith("/src/lang");
|
|
3303
|
-
const isCliBundle = normalized.endsWith("/cli");
|
|
3304
|
-
return isSource ? path.join(thisDir, "grammars") : isCliBundle ? path.join(thisDir, "..", "lang", "grammars") : path.join(thisDir, "lang", "grammars");
|
|
3305
|
-
}
|
|
3306
|
-
function getGrammarsDirAbsolute() {
|
|
3307
|
-
const thisDir = _internals.getModuleDir();
|
|
3308
|
-
return resolveGrammarsDir(thisDir);
|
|
3309
|
-
}
|
|
3310
|
-
async function loadGrammar(languageId) {
|
|
3311
|
-
if (typeof languageId !== "string" || languageId.length > 100) {
|
|
3312
|
-
throw new Error(`Invalid languageId: must be a string of at most 100 characters`);
|
|
3313
|
-
}
|
|
3314
|
-
const normalizedId = sanitizeLanguageId(languageId).toLowerCase();
|
|
3315
|
-
if (normalizedId.length === 0) {
|
|
3316
|
-
throw new Error(`Invalid languageId: empty after sanitization`);
|
|
3317
|
-
}
|
|
3318
|
-
if (parserCache.has(normalizedId)) {
|
|
3319
|
-
return parserCache.get(normalizedId);
|
|
3320
|
-
}
|
|
3321
|
-
const existing = inflightLoads.get(normalizedId);
|
|
3322
|
-
if (existing)
|
|
3323
|
-
return existing;
|
|
3324
|
-
const loadPromise = (async () => {
|
|
3325
|
-
await initTreeSitter();
|
|
3326
|
-
const parser = new Parser;
|
|
3327
|
-
const wasmFileName = getWasmFileName(normalizedId);
|
|
3328
|
-
const wasmPath = path.join(getGrammarsDirAbsolute(), wasmFileName);
|
|
3329
|
-
if (!_internals.fileExists(wasmPath)) {
|
|
3330
|
-
throw new Error(`Grammar file not found for ${languageId}: ${wasmPath}
|
|
3331
|
-
` + `Make sure to run 'bun run build' to copy grammar files to dist/lang/grammars/. ` + `If this is an installed OpenCode plugin cache, run ` + `'bunx opencode-swarm update' and restart OpenCode.`);
|
|
3332
|
-
}
|
|
3333
|
-
try {
|
|
3334
|
-
const language = await withTimeout(Language.load(wasmPath), GRAMMAR_LOAD_TIMEOUT_MS, new Error(`Timed out after ${GRAMMAR_LOAD_TIMEOUT_MS}ms loading grammar`));
|
|
3335
|
-
parser.setLanguage(language);
|
|
3336
|
-
} catch (error) {
|
|
3337
|
-
throw new Error(`Failed to load grammar for ${languageId}: ${error instanceof Error ? error.message : String(error)}
|
|
3338
|
-
` + `WASM path: ${wasmPath}`);
|
|
3339
|
-
}
|
|
3340
|
-
parserCache.set(normalizedId, parser);
|
|
3341
|
-
initializedLanguages.add(normalizedId);
|
|
3342
|
-
return parser;
|
|
3343
|
-
})();
|
|
3344
|
-
inflightLoads.set(normalizedId, loadPromise);
|
|
3345
|
-
try {
|
|
3346
|
-
return await loadPromise;
|
|
3347
|
-
} finally {
|
|
3348
|
-
inflightLoads.delete(normalizedId);
|
|
3349
|
-
}
|
|
3350
|
-
}
|
|
3351
|
-
async function isGrammarAvailable(languageId) {
|
|
3352
|
-
if (typeof languageId !== "string" || languageId.length > 100) {
|
|
3353
|
-
return false;
|
|
3354
|
-
}
|
|
3355
|
-
let normalizedId;
|
|
3356
|
-
try {
|
|
3357
|
-
normalizedId = sanitizeLanguageId(languageId).toLowerCase();
|
|
3358
|
-
} catch {
|
|
3359
|
-
return false;
|
|
3360
|
-
}
|
|
3361
|
-
if (normalizedId.length === 0) {
|
|
3362
|
-
return false;
|
|
3363
|
-
}
|
|
3364
|
-
if (parserCache.has(normalizedId)) {
|
|
3365
|
-
return true;
|
|
3366
|
-
}
|
|
3367
|
-
try {
|
|
3368
|
-
const wasmFileName = getWasmFileName(normalizedId);
|
|
3369
|
-
const wasmPath = path.join(getGrammarsDirAbsolute(), wasmFileName);
|
|
3370
|
-
statSync(wasmPath);
|
|
3371
|
-
return true;
|
|
3372
|
-
} catch {
|
|
3373
|
-
return false;
|
|
3374
|
-
}
|
|
3375
|
-
}
|
|
3376
|
-
function clearParserCache() {
|
|
3377
|
-
parserCache.clear();
|
|
3378
|
-
inflightLoads.clear();
|
|
3379
|
-
initializedLanguages.clear();
|
|
3380
|
-
treeSitterInitPromise = null;
|
|
3381
|
-
}
|
|
3382
|
-
function getInitializedLanguages() {
|
|
3383
|
-
return Array.from(initializedLanguages);
|
|
3384
|
-
}
|
|
3385
|
-
function getSupportedLanguages() {
|
|
3386
|
-
return Object.keys(LANGUAGE_WASM_MAP);
|
|
3387
|
-
}
|
|
3388
|
-
|
|
3389
|
-
export { Query, parserCache, _internals, resolveGrammarsDir, loadGrammar, isGrammarAvailable, clearParserCache, getInitializedLanguages, getSupportedLanguages };
|
|
3217
|
+
export { LookaheadIterator, Tree, TreeCursor, Node, CaptureQuantifier, Query, Language, LANGUAGE_VERSION, MIN_COMPATIBLE_VERSION, Parser };
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
queryHistoricalOutcomes,
|
|
4
4
|
readKnowledgeEvents,
|
|
5
5
|
recordKnowledgeEvent
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-p3tnmkvc.js";
|
|
7
7
|
import {
|
|
8
8
|
jaccardBigram,
|
|
9
9
|
readKnowledge,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
resolveSwarmKnowledgePath,
|
|
12
12
|
transactKnowledge,
|
|
13
13
|
wordBigrams
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-ckrasab9.js";
|
|
15
15
|
import {
|
|
16
16
|
init_knowledge_types,
|
|
17
17
|
isActiveStatus
|
|
@@ -224,11 +224,11 @@ async function maybeQuarantineOnContradiction(directory, entryId, threshold, win
|
|
|
224
224
|
alreadyInactive: true
|
|
225
225
|
};
|
|
226
226
|
}
|
|
227
|
-
const { quarantineEntry } = await import("./knowledge-validator-
|
|
227
|
+
const { quarantineEntry } = await import("./knowledge-validator-4b28zdxa.js");
|
|
228
228
|
let policyConfig;
|
|
229
229
|
try {
|
|
230
|
-
const { KnowledgeConfigSchema } = await import("./schema-
|
|
231
|
-
const { loadPluginConfigWithMeta } = await import("./index-
|
|
230
|
+
const { KnowledgeConfigSchema } = await import("./schema-jj2pb6zp.js");
|
|
231
|
+
const { loadPluginConfigWithMeta } = await import("./index-333kvewd.js");
|
|
232
232
|
const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
|
|
233
233
|
policyConfig = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
|
|
234
234
|
} catch {
|
|
@@ -709,7 +709,7 @@ async function applyConfidenceFloorAction(directory, touched, options) {
|
|
|
709
709
|
const {
|
|
710
710
|
readAuthoritativeKnowledgeCounterRollups,
|
|
711
711
|
effectiveRetrievalOutcomes
|
|
712
|
-
} = await import("./knowledge-events-
|
|
712
|
+
} = await import("./knowledge-events-yzvysaqd.js");
|
|
713
713
|
const rollups = await readAuthoritativeKnowledgeCounterRollups(directory);
|
|
714
714
|
const flagIds = new Set;
|
|
715
715
|
for (const e of atFloor) {
|
|
@@ -776,11 +776,11 @@ async function applyConfidenceFloorAction(directory, touched, options) {
|
|
|
776
776
|
});
|
|
777
777
|
}
|
|
778
778
|
if (action === "quarantine" && toQuarantine.length > 0) {
|
|
779
|
-
const { quarantineEntry } = await import("./knowledge-validator-
|
|
780
|
-
const { KnowledgeConfigSchema } = await import("./schema-
|
|
779
|
+
const { quarantineEntry } = await import("./knowledge-validator-4b28zdxa.js");
|
|
780
|
+
const { KnowledgeConfigSchema } = await import("./schema-jj2pb6zp.js");
|
|
781
781
|
let config;
|
|
782
782
|
try {
|
|
783
|
-
const { loadPluginConfigWithMeta } = await import("./index-
|
|
783
|
+
const { loadPluginConfigWithMeta } = await import("./index-333kvewd.js");
|
|
784
784
|
const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
|
|
785
785
|
config = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
|
|
786
786
|
} catch {
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
Language,
|
|
4
|
+
Parser
|
|
5
|
+
} from "./index-7ryh498h.js";
|
|
6
|
+
import {
|
|
7
|
+
withTimeout
|
|
8
|
+
} from "./index-wx8zdh4a.js";
|
|
9
|
+
|
|
10
|
+
// src/lang/runtime.ts
|
|
11
|
+
import { existsSync, statSync } from "fs";
|
|
12
|
+
import * as path from "path";
|
|
13
|
+
import { fileURLToPath } from "url";
|
|
14
|
+
var parserCache = new Map;
|
|
15
|
+
var inflightLoads = new Map;
|
|
16
|
+
var GRAMMAR_LOAD_TIMEOUT_MS = 1e4;
|
|
17
|
+
var initializedLanguages = new Set;
|
|
18
|
+
var treeSitterInitPromise = null;
|
|
19
|
+
var _internals = {
|
|
20
|
+
parserInit: Parser.init,
|
|
21
|
+
getModuleDir: () => path.dirname(fileURLToPath(import.meta.url)),
|
|
22
|
+
fileExists: existsSync
|
|
23
|
+
};
|
|
24
|
+
async function initTreeSitter() {
|
|
25
|
+
if (!treeSitterInitPromise) {
|
|
26
|
+
treeSitterInitPromise = (async () => {
|
|
27
|
+
const thisDir = _internals.getModuleDir();
|
|
28
|
+
const isSource = thisDir.replace(/\\/g, "/").endsWith("/src/lang");
|
|
29
|
+
if (isSource) {
|
|
30
|
+
await _internals.parserInit();
|
|
31
|
+
} else {
|
|
32
|
+
const grammarsDir = getGrammarsDirAbsolute();
|
|
33
|
+
const coreWasmPath = path.join(grammarsDir, "tree-sitter.wasm");
|
|
34
|
+
if (!_internals.fileExists(coreWasmPath)) {
|
|
35
|
+
throw new Error(`Core tree-sitter WASM runtime missing: ${coreWasmPath}
|
|
36
|
+
` + `The installed OpenCode plugin cache is incomplete or stale. Run ` + `'bunx opencode-swarm update', then restart OpenCode so it fetches ` + `a fresh package from npm.`);
|
|
37
|
+
}
|
|
38
|
+
await _internals.parserInit({
|
|
39
|
+
locateFile(scriptName) {
|
|
40
|
+
return path.join(grammarsDir, scriptName);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
})().catch((err) => {
|
|
45
|
+
treeSitterInitPromise = null;
|
|
46
|
+
throw err;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return treeSitterInitPromise;
|
|
50
|
+
}
|
|
51
|
+
var LANGUAGE_WASM_MAP = {
|
|
52
|
+
javascript: "tree-sitter-javascript.wasm",
|
|
53
|
+
typescript: "tree-sitter-typescript.wasm",
|
|
54
|
+
tsx: "tree-sitter-tsx.wasm",
|
|
55
|
+
python: "tree-sitter-python.wasm",
|
|
56
|
+
go: "tree-sitter-go.wasm",
|
|
57
|
+
rust: "tree-sitter-rust.wasm",
|
|
58
|
+
cpp: "tree-sitter-cpp.wasm",
|
|
59
|
+
c: "tree-sitter-cpp.wasm",
|
|
60
|
+
csharp: "tree-sitter-c-sharp.wasm",
|
|
61
|
+
css: "tree-sitter-css.wasm",
|
|
62
|
+
bash: "tree-sitter-bash.wasm",
|
|
63
|
+
ruby: "tree-sitter-ruby.wasm",
|
|
64
|
+
php: "tree-sitter-php.wasm",
|
|
65
|
+
java: "tree-sitter-java.wasm",
|
|
66
|
+
kotlin: "tree-sitter-kotlin.wasm",
|
|
67
|
+
swift: "tree-sitter-swift.wasm",
|
|
68
|
+
dart: "tree-sitter-dart.wasm",
|
|
69
|
+
powershell: "tree-sitter-powershell.wasm",
|
|
70
|
+
ini: "tree-sitter-ini.wasm",
|
|
71
|
+
regex: "tree-sitter-regex.wasm"
|
|
72
|
+
};
|
|
73
|
+
function sanitizeLanguageId(languageId) {
|
|
74
|
+
const normalized = languageId.toLowerCase();
|
|
75
|
+
if (!/^[a-z0-9-]+$/.test(normalized)) {
|
|
76
|
+
throw new Error(`Invalid language ID: ${languageId}`);
|
|
77
|
+
}
|
|
78
|
+
return normalized;
|
|
79
|
+
}
|
|
80
|
+
function getWasmFileName(languageId) {
|
|
81
|
+
const sanitized = sanitizeLanguageId(languageId).toLowerCase();
|
|
82
|
+
if (LANGUAGE_WASM_MAP[sanitized]) {
|
|
83
|
+
return LANGUAGE_WASM_MAP[sanitized];
|
|
84
|
+
}
|
|
85
|
+
return `tree-sitter-${sanitized}.wasm`;
|
|
86
|
+
}
|
|
87
|
+
function resolveGrammarsDir(thisDir) {
|
|
88
|
+
const normalized = thisDir.replace(/\\/g, "/");
|
|
89
|
+
const isSource = normalized.endsWith("/src/lang");
|
|
90
|
+
const isCliBundle = normalized.endsWith("/cli");
|
|
91
|
+
return isSource ? path.join(thisDir, "grammars") : isCliBundle ? path.join(thisDir, "..", "lang", "grammars") : path.join(thisDir, "lang", "grammars");
|
|
92
|
+
}
|
|
93
|
+
function getGrammarsDirAbsolute() {
|
|
94
|
+
const thisDir = _internals.getModuleDir();
|
|
95
|
+
return resolveGrammarsDir(thisDir);
|
|
96
|
+
}
|
|
97
|
+
async function loadGrammar(languageId) {
|
|
98
|
+
if (typeof languageId !== "string" || languageId.length > 100) {
|
|
99
|
+
throw new Error(`Invalid languageId: must be a string of at most 100 characters`);
|
|
100
|
+
}
|
|
101
|
+
const normalizedId = sanitizeLanguageId(languageId).toLowerCase();
|
|
102
|
+
if (normalizedId.length === 0) {
|
|
103
|
+
throw new Error(`Invalid languageId: empty after sanitization`);
|
|
104
|
+
}
|
|
105
|
+
if (parserCache.has(normalizedId)) {
|
|
106
|
+
return parserCache.get(normalizedId);
|
|
107
|
+
}
|
|
108
|
+
const existing = inflightLoads.get(normalizedId);
|
|
109
|
+
if (existing)
|
|
110
|
+
return existing;
|
|
111
|
+
const loadPromise = (async () => {
|
|
112
|
+
await initTreeSitter();
|
|
113
|
+
const parser = new Parser;
|
|
114
|
+
const wasmFileName = getWasmFileName(normalizedId);
|
|
115
|
+
const wasmPath = path.join(getGrammarsDirAbsolute(), wasmFileName);
|
|
116
|
+
if (!_internals.fileExists(wasmPath)) {
|
|
117
|
+
throw new Error(`Grammar file not found for ${languageId}: ${wasmPath}
|
|
118
|
+
` + `Make sure to run 'bun run build' to copy grammar files to dist/lang/grammars/. ` + `If this is an installed OpenCode plugin cache, run ` + `'bunx opencode-swarm update' and restart OpenCode.`);
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
const language = await withTimeout(Language.load(wasmPath), GRAMMAR_LOAD_TIMEOUT_MS, new Error(`Timed out after ${GRAMMAR_LOAD_TIMEOUT_MS}ms loading grammar`));
|
|
122
|
+
parser.setLanguage(language);
|
|
123
|
+
} catch (error) {
|
|
124
|
+
throw new Error(`Failed to load grammar for ${languageId}: ${error instanceof Error ? error.message : String(error)}
|
|
125
|
+
` + `WASM path: ${wasmPath}`);
|
|
126
|
+
}
|
|
127
|
+
parserCache.set(normalizedId, parser);
|
|
128
|
+
initializedLanguages.add(normalizedId);
|
|
129
|
+
return parser;
|
|
130
|
+
})();
|
|
131
|
+
inflightLoads.set(normalizedId, loadPromise);
|
|
132
|
+
try {
|
|
133
|
+
return await loadPromise;
|
|
134
|
+
} finally {
|
|
135
|
+
inflightLoads.delete(normalizedId);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
async function isGrammarAvailable(languageId) {
|
|
139
|
+
if (typeof languageId !== "string" || languageId.length > 100) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
let normalizedId;
|
|
143
|
+
try {
|
|
144
|
+
normalizedId = sanitizeLanguageId(languageId).toLowerCase();
|
|
145
|
+
} catch {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
if (normalizedId.length === 0) {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
if (parserCache.has(normalizedId)) {
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
try {
|
|
155
|
+
const wasmFileName = getWasmFileName(normalizedId);
|
|
156
|
+
const wasmPath = path.join(getGrammarsDirAbsolute(), wasmFileName);
|
|
157
|
+
statSync(wasmPath);
|
|
158
|
+
return true;
|
|
159
|
+
} catch {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function clearParserCache() {
|
|
164
|
+
parserCache.clear();
|
|
165
|
+
inflightLoads.clear();
|
|
166
|
+
initializedLanguages.clear();
|
|
167
|
+
treeSitterInitPromise = null;
|
|
168
|
+
}
|
|
169
|
+
function getInitializedLanguages() {
|
|
170
|
+
return Array.from(initializedLanguages);
|
|
171
|
+
}
|
|
172
|
+
function getSupportedLanguages() {
|
|
173
|
+
return Object.keys(LANGUAGE_WASM_MAP);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export { parserCache, _internals, resolveGrammarsDir, loadGrammar, isGrammarAvailable, clearParserCache, getInitializedLanguages, getSupportedLanguages };
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import {
|
|
3
3
|
init_loader,
|
|
4
4
|
loadPluginConfigWithMeta
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-y95nwsge.js";
|
|
6
6
|
import {
|
|
7
7
|
init_schema
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-h3z64mhz.js";
|
|
9
9
|
import {
|
|
10
10
|
DEFAULT_WORKTREE_ISOLATION_CONFIG,
|
|
11
11
|
init_constants
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-whezv7vc.js";
|
|
13
13
|
|
|
14
14
|
// src/config/index.ts
|
|
15
15
|
init_constants();
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
SWARM_WORKTREE_DIR_NAME,
|
|
8
8
|
init_constants
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-whezv7vc.js";
|
|
10
10
|
import {
|
|
11
11
|
bunSpawn
|
|
12
12
|
} from "./index-4nt52yr9.js";
|
|
@@ -86,7 +86,7 @@ var _internals = {
|
|
|
86
86
|
symlinkSync: fs.symlinkSync
|
|
87
87
|
},
|
|
88
88
|
writeScopeToDisk: async (directory, taskId, files) => {
|
|
89
|
-
const { writeScopeToDisk: realWrite } = await import("./scope-persistence-
|
|
89
|
+
const { writeScopeToDisk: realWrite } = await import("./scope-persistence-63nasq0z.js");
|
|
90
90
|
return realWrite(directory, taskId, files);
|
|
91
91
|
},
|
|
92
92
|
writeLaneProfileToDisk: async (_worktreePath, _laneIndex, _envOverrides) => {
|
|
@@ -275,11 +275,6 @@ async function provisionWorktree(directory, id, sessionId, options) {
|
|
|
275
275
|
};
|
|
276
276
|
const expectedPath = normalizeGitPath(worktreePath);
|
|
277
277
|
let entries = [];
|
|
278
|
-
let current = {
|
|
279
|
-
path: "",
|
|
280
|
-
branch: undefined,
|
|
281
|
-
prunable: false
|
|
282
|
-
};
|
|
283
278
|
if (listResult.exitCode !== 0) {
|
|
284
279
|
const raw = listResult.stderr.trim() || listResult.stdout.trim();
|
|
285
280
|
const bounded = raw.length > 500 ? `${raw.slice(0, 500)}... (truncated)` : raw;
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
import {
|
|
12
12
|
init_schema,
|
|
13
13
|
stripKnownSwarmPrefix
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-h3z64mhz.js";
|
|
15
15
|
import {
|
|
16
16
|
init_constants
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-whezv7vc.js";
|
|
18
18
|
import {
|
|
19
19
|
init_logger,
|
|
20
20
|
warn
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
ALL_AGENT_NAMES,
|
|
4
4
|
SUMMARIZER_EXEMPT_TOOL_NAMES,
|
|
5
5
|
init_constants
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-whezv7vc.js";
|
|
7
7
|
import {
|
|
8
8
|
OUTCOME_BLOCK_THRESHOLD,
|
|
9
9
|
init_knowledge_types
|
|
@@ -21,7 +21,7 @@ var package_default;
|
|
|
21
21
|
var init_package = __esm(() => {
|
|
22
22
|
package_default = {
|
|
23
23
|
name: "opencode-swarm",
|
|
24
|
-
version: "7.144.
|
|
24
|
+
version: "7.144.2",
|
|
25
25
|
description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
26
26
|
main: "dist/index.js",
|
|
27
27
|
types: "dist/index.d.ts",
|
|
@@ -977,6 +977,10 @@ var init_schema = __esm(() => {
|
|
|
977
977
|
tokenBudget: 1000
|
|
978
978
|
}
|
|
979
979
|
}),
|
|
980
|
+
reflection: exports_external.object({
|
|
981
|
+
enabled: exports_external.boolean().default(false),
|
|
982
|
+
halfLifeDays: exports_external.number().finite().positive().max(3650).default(30)
|
|
983
|
+
}).default({ enabled: false, halfLifeDays: 30 }),
|
|
980
984
|
learning: exports_external.object({
|
|
981
985
|
learningRate: exports_external.number().min(0).max(1).default(0.1),
|
|
982
986
|
propagationFactor: exports_external.number().min(0).max(1).default(0.3),
|
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
PluginConfigSchema,
|
|
7
7
|
init_schema,
|
|
8
8
|
stripKnownSwarmPrefix
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-h3z64mhz.js";
|
|
10
10
|
import {
|
|
11
11
|
ALL_AGENT_NAMES,
|
|
12
12
|
init_constants
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-whezv7vc.js";
|
|
14
14
|
import {
|
|
15
15
|
log
|
|
16
16
|
} from "./index-zgwm4ryv.js";
|
|
@@ -12,14 +12,14 @@ import {
|
|
|
12
12
|
detectPosixWrites,
|
|
13
13
|
detectWindowsWrites,
|
|
14
14
|
resolveWriteTargets
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-nretd4qn.js";
|
|
16
16
|
import {
|
|
17
17
|
checkFileAuthority,
|
|
18
18
|
classifyFile,
|
|
19
19
|
isInDeclaredScope,
|
|
20
20
|
redactPath,
|
|
21
21
|
redactShellCommand
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-g2ajae1z.js";
|
|
23
23
|
|
|
24
24
|
// src/services/guardrail-explain-service.ts
|
|
25
25
|
import path from "path";
|