opencode-swarm 6.69.0 → 6.71.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/cli/index.js +427 -90
- package/dist/config/schema.d.ts +6 -0
- package/dist/hooks/delegation-gate.d.ts +11 -0
- package/dist/hooks/guardrails.d.ts +43 -1
- package/dist/index.js +41560 -41101
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -16947,7 +16947,7 @@ var require_signal_exit = __commonJS((exports, module) => {
|
|
|
16947
16947
|
emitter.count -= 1;
|
|
16948
16948
|
};
|
|
16949
16949
|
module.exports.unload = unload;
|
|
16950
|
-
|
|
16950
|
+
emit2 = function emit3(event, code, signal) {
|
|
16951
16951
|
if (emitter.emitted[event]) {
|
|
16952
16952
|
return;
|
|
16953
16953
|
}
|
|
@@ -16963,8 +16963,8 @@ var require_signal_exit = __commonJS((exports, module) => {
|
|
|
16963
16963
|
var listeners = process3.listeners(sig);
|
|
16964
16964
|
if (listeners.length === emitter.count) {
|
|
16965
16965
|
unload();
|
|
16966
|
-
|
|
16967
|
-
|
|
16966
|
+
emit2("exit", null, sig);
|
|
16967
|
+
emit2("afterexit", null, sig);
|
|
16968
16968
|
if (isWin && sig === "SIGHUP") {
|
|
16969
16969
|
sig = "SIGINT";
|
|
16970
16970
|
}
|
|
@@ -17000,8 +17000,8 @@ var require_signal_exit = __commonJS((exports, module) => {
|
|
|
17000
17000
|
return;
|
|
17001
17001
|
}
|
|
17002
17002
|
process3.exitCode = code || 0;
|
|
17003
|
-
|
|
17004
|
-
|
|
17003
|
+
emit2("exit", process3.exitCode, null);
|
|
17004
|
+
emit2("afterexit", process3.exitCode, null);
|
|
17005
17005
|
originalProcessReallyExit.call(process3, process3.exitCode);
|
|
17006
17006
|
};
|
|
17007
17007
|
originalProcessEmit = process3.emit;
|
|
@@ -17011,8 +17011,8 @@ var require_signal_exit = __commonJS((exports, module) => {
|
|
|
17011
17011
|
process3.exitCode = arg;
|
|
17012
17012
|
}
|
|
17013
17013
|
var ret = originalProcessEmit.apply(this, arguments);
|
|
17014
|
-
|
|
17015
|
-
|
|
17014
|
+
emit2("exit", process3.exitCode, null);
|
|
17015
|
+
emit2("afterexit", process3.exitCode, null);
|
|
17016
17016
|
return ret;
|
|
17017
17017
|
} else {
|
|
17018
17018
|
return originalProcessEmit.apply(this, arguments);
|
|
@@ -17025,7 +17025,7 @@ var require_signal_exit = __commonJS((exports, module) => {
|
|
|
17025
17025
|
var EE;
|
|
17026
17026
|
var emitter;
|
|
17027
17027
|
var unload;
|
|
17028
|
-
var
|
|
17028
|
+
var emit2;
|
|
17029
17029
|
var sigListeners;
|
|
17030
17030
|
var loaded;
|
|
17031
17031
|
var load;
|
|
@@ -19091,7 +19091,9 @@ var GuardrailsConfigSchema = exports_external.object({
|
|
|
19091
19091
|
require_reviewer_test_engineer: exports_external.boolean().default(true)
|
|
19092
19092
|
}).optional(),
|
|
19093
19093
|
profiles: exports_external.record(exports_external.string(), GuardrailsProfileSchema).optional(),
|
|
19094
|
-
block_destructive_commands: exports_external.boolean().default(true)
|
|
19094
|
+
block_destructive_commands: exports_external.boolean().default(true),
|
|
19095
|
+
interpreter_allowed_agents: exports_external.array(exports_external.string().min(1)).optional(),
|
|
19096
|
+
shell_audit_log: exports_external.boolean().default(true)
|
|
19095
19097
|
});
|
|
19096
19098
|
var WatchdogConfigSchema = exports_external.object({
|
|
19097
19099
|
scope_guard: exports_external.boolean().default(true),
|
|
@@ -19205,7 +19207,8 @@ var AgentAuthorityRuleSchema = exports_external.object({
|
|
|
19205
19207
|
});
|
|
19206
19208
|
var AuthorityConfigSchema = exports_external.object({
|
|
19207
19209
|
enabled: exports_external.boolean().default(true),
|
|
19208
|
-
rules: exports_external.record(exports_external.string(), AgentAuthorityRuleSchema).default({})
|
|
19210
|
+
rules: exports_external.record(exports_external.string(), AgentAuthorityRuleSchema).default({}),
|
|
19211
|
+
universal_deny_prefixes: exports_external.array(exports_external.string().min(1)).default([])
|
|
19209
19212
|
});
|
|
19210
19213
|
var CouncilConfigSchema = exports_external.object({
|
|
19211
19214
|
enabled: exports_external.boolean().default(false),
|
|
@@ -19464,6 +19467,416 @@ init_manager2();
|
|
|
19464
19467
|
|
|
19465
19468
|
// src/state.ts
|
|
19466
19469
|
init_plan_schema();
|
|
19470
|
+
|
|
19471
|
+
// src/hooks/delegation-gate.ts
|
|
19472
|
+
init_telemetry();
|
|
19473
|
+
|
|
19474
|
+
// node_modules/quick-lru/index.js
|
|
19475
|
+
class QuickLRU extends Map {
|
|
19476
|
+
#size = 0;
|
|
19477
|
+
#cache = new Map;
|
|
19478
|
+
#oldCache = new Map;
|
|
19479
|
+
#maxSize;
|
|
19480
|
+
#maxAge;
|
|
19481
|
+
#onEviction;
|
|
19482
|
+
constructor(options = {}) {
|
|
19483
|
+
super();
|
|
19484
|
+
if (!(options.maxSize && options.maxSize > 0)) {
|
|
19485
|
+
throw new TypeError("`maxSize` must be a number greater than 0");
|
|
19486
|
+
}
|
|
19487
|
+
if (typeof options.maxAge === "number" && options.maxAge === 0) {
|
|
19488
|
+
throw new TypeError("`maxAge` must be a number greater than 0");
|
|
19489
|
+
}
|
|
19490
|
+
this.#maxSize = options.maxSize;
|
|
19491
|
+
this.#maxAge = options.maxAge || Number.POSITIVE_INFINITY;
|
|
19492
|
+
this.#onEviction = options.onEviction;
|
|
19493
|
+
}
|
|
19494
|
+
get __oldCache() {
|
|
19495
|
+
return this.#oldCache;
|
|
19496
|
+
}
|
|
19497
|
+
#emitEvictions(cache) {
|
|
19498
|
+
if (typeof this.#onEviction !== "function") {
|
|
19499
|
+
return;
|
|
19500
|
+
}
|
|
19501
|
+
for (const [key, item] of cache) {
|
|
19502
|
+
this.#onEviction(key, item.value);
|
|
19503
|
+
}
|
|
19504
|
+
}
|
|
19505
|
+
#deleteIfExpired(key, item) {
|
|
19506
|
+
if (typeof item.expiry === "number" && item.expiry <= Date.now()) {
|
|
19507
|
+
if (typeof this.#onEviction === "function") {
|
|
19508
|
+
this.#onEviction(key, item.value);
|
|
19509
|
+
}
|
|
19510
|
+
return this.delete(key);
|
|
19511
|
+
}
|
|
19512
|
+
return false;
|
|
19513
|
+
}
|
|
19514
|
+
#getOrDeleteIfExpired(key, item) {
|
|
19515
|
+
const deleted = this.#deleteIfExpired(key, item);
|
|
19516
|
+
if (deleted === false) {
|
|
19517
|
+
return item.value;
|
|
19518
|
+
}
|
|
19519
|
+
}
|
|
19520
|
+
#getItemValue(key, item) {
|
|
19521
|
+
return item.expiry ? this.#getOrDeleteIfExpired(key, item) : item.value;
|
|
19522
|
+
}
|
|
19523
|
+
#peek(key, cache) {
|
|
19524
|
+
const item = cache.get(key);
|
|
19525
|
+
return this.#getItemValue(key, item);
|
|
19526
|
+
}
|
|
19527
|
+
#set(key, value) {
|
|
19528
|
+
this.#cache.set(key, value);
|
|
19529
|
+
this.#size++;
|
|
19530
|
+
if (this.#size >= this.#maxSize) {
|
|
19531
|
+
this.#size = 0;
|
|
19532
|
+
this.#emitEvictions(this.#oldCache);
|
|
19533
|
+
this.#oldCache = this.#cache;
|
|
19534
|
+
this.#cache = new Map;
|
|
19535
|
+
}
|
|
19536
|
+
}
|
|
19537
|
+
#moveToRecent(key, item) {
|
|
19538
|
+
this.#oldCache.delete(key);
|
|
19539
|
+
this.#set(key, item);
|
|
19540
|
+
}
|
|
19541
|
+
*#entriesAscending() {
|
|
19542
|
+
for (const item of this.#oldCache) {
|
|
19543
|
+
const [key, value] = item;
|
|
19544
|
+
if (!this.#cache.has(key)) {
|
|
19545
|
+
const deleted = this.#deleteIfExpired(key, value);
|
|
19546
|
+
if (deleted === false) {
|
|
19547
|
+
yield item;
|
|
19548
|
+
}
|
|
19549
|
+
}
|
|
19550
|
+
}
|
|
19551
|
+
for (const item of this.#cache) {
|
|
19552
|
+
const [key, value] = item;
|
|
19553
|
+
const deleted = this.#deleteIfExpired(key, value);
|
|
19554
|
+
if (deleted === false) {
|
|
19555
|
+
yield item;
|
|
19556
|
+
}
|
|
19557
|
+
}
|
|
19558
|
+
}
|
|
19559
|
+
get(key) {
|
|
19560
|
+
if (this.#cache.has(key)) {
|
|
19561
|
+
const item = this.#cache.get(key);
|
|
19562
|
+
return this.#getItemValue(key, item);
|
|
19563
|
+
}
|
|
19564
|
+
if (this.#oldCache.has(key)) {
|
|
19565
|
+
const item = this.#oldCache.get(key);
|
|
19566
|
+
if (this.#deleteIfExpired(key, item) === false) {
|
|
19567
|
+
this.#moveToRecent(key, item);
|
|
19568
|
+
return item.value;
|
|
19569
|
+
}
|
|
19570
|
+
}
|
|
19571
|
+
}
|
|
19572
|
+
set(key, value, { maxAge = this.#maxAge } = {}) {
|
|
19573
|
+
const expiry = typeof maxAge === "number" && maxAge !== Number.POSITIVE_INFINITY ? Date.now() + maxAge : undefined;
|
|
19574
|
+
if (this.#cache.has(key)) {
|
|
19575
|
+
this.#cache.set(key, {
|
|
19576
|
+
value,
|
|
19577
|
+
expiry
|
|
19578
|
+
});
|
|
19579
|
+
} else {
|
|
19580
|
+
this.#set(key, { value, expiry });
|
|
19581
|
+
}
|
|
19582
|
+
return this;
|
|
19583
|
+
}
|
|
19584
|
+
has(key) {
|
|
19585
|
+
if (this.#cache.has(key)) {
|
|
19586
|
+
return !this.#deleteIfExpired(key, this.#cache.get(key));
|
|
19587
|
+
}
|
|
19588
|
+
if (this.#oldCache.has(key)) {
|
|
19589
|
+
return !this.#deleteIfExpired(key, this.#oldCache.get(key));
|
|
19590
|
+
}
|
|
19591
|
+
return false;
|
|
19592
|
+
}
|
|
19593
|
+
peek(key) {
|
|
19594
|
+
if (this.#cache.has(key)) {
|
|
19595
|
+
return this.#peek(key, this.#cache);
|
|
19596
|
+
}
|
|
19597
|
+
if (this.#oldCache.has(key)) {
|
|
19598
|
+
return this.#peek(key, this.#oldCache);
|
|
19599
|
+
}
|
|
19600
|
+
}
|
|
19601
|
+
expiresIn(key) {
|
|
19602
|
+
const item = this.#cache.get(key) ?? this.#oldCache.get(key);
|
|
19603
|
+
if (item) {
|
|
19604
|
+
return item.expiry ? item.expiry - Date.now() : Number.POSITIVE_INFINITY;
|
|
19605
|
+
}
|
|
19606
|
+
}
|
|
19607
|
+
delete(key) {
|
|
19608
|
+
const deleted = this.#cache.delete(key);
|
|
19609
|
+
if (deleted) {
|
|
19610
|
+
this.#size--;
|
|
19611
|
+
}
|
|
19612
|
+
return this.#oldCache.delete(key) || deleted;
|
|
19613
|
+
}
|
|
19614
|
+
clear() {
|
|
19615
|
+
this.#cache.clear();
|
|
19616
|
+
this.#oldCache.clear();
|
|
19617
|
+
this.#size = 0;
|
|
19618
|
+
}
|
|
19619
|
+
resize(newSize) {
|
|
19620
|
+
if (!(newSize && newSize > 0)) {
|
|
19621
|
+
throw new TypeError("`maxSize` must be a number greater than 0");
|
|
19622
|
+
}
|
|
19623
|
+
const items = [...this.#entriesAscending()];
|
|
19624
|
+
const removeCount = items.length - newSize;
|
|
19625
|
+
if (removeCount < 0) {
|
|
19626
|
+
this.#cache = new Map(items);
|
|
19627
|
+
this.#oldCache = new Map;
|
|
19628
|
+
this.#size = items.length;
|
|
19629
|
+
} else {
|
|
19630
|
+
if (removeCount > 0) {
|
|
19631
|
+
this.#emitEvictions(items.slice(0, removeCount));
|
|
19632
|
+
}
|
|
19633
|
+
this.#oldCache = new Map(items.slice(removeCount));
|
|
19634
|
+
this.#cache = new Map;
|
|
19635
|
+
this.#size = 0;
|
|
19636
|
+
}
|
|
19637
|
+
this.#maxSize = newSize;
|
|
19638
|
+
}
|
|
19639
|
+
evict(count = 1) {
|
|
19640
|
+
const requested = Number(count);
|
|
19641
|
+
if (!requested || requested <= 0) {
|
|
19642
|
+
return;
|
|
19643
|
+
}
|
|
19644
|
+
const items = [...this.#entriesAscending()];
|
|
19645
|
+
const evictCount = Math.trunc(Math.min(requested, Math.max(items.length - 1, 0)));
|
|
19646
|
+
if (evictCount <= 0) {
|
|
19647
|
+
return;
|
|
19648
|
+
}
|
|
19649
|
+
this.#emitEvictions(items.slice(0, evictCount));
|
|
19650
|
+
this.#oldCache = new Map(items.slice(evictCount));
|
|
19651
|
+
this.#cache = new Map;
|
|
19652
|
+
this.#size = 0;
|
|
19653
|
+
}
|
|
19654
|
+
*keys() {
|
|
19655
|
+
for (const [key] of this) {
|
|
19656
|
+
yield key;
|
|
19657
|
+
}
|
|
19658
|
+
}
|
|
19659
|
+
*values() {
|
|
19660
|
+
for (const [, value] of this) {
|
|
19661
|
+
yield value;
|
|
19662
|
+
}
|
|
19663
|
+
}
|
|
19664
|
+
*[Symbol.iterator]() {
|
|
19665
|
+
for (const item of this.#cache) {
|
|
19666
|
+
const [key, value] = item;
|
|
19667
|
+
const deleted = this.#deleteIfExpired(key, value);
|
|
19668
|
+
if (deleted === false) {
|
|
19669
|
+
yield [key, value.value];
|
|
19670
|
+
}
|
|
19671
|
+
}
|
|
19672
|
+
for (const item of this.#oldCache) {
|
|
19673
|
+
const [key, value] = item;
|
|
19674
|
+
if (!this.#cache.has(key)) {
|
|
19675
|
+
const deleted = this.#deleteIfExpired(key, value);
|
|
19676
|
+
if (deleted === false) {
|
|
19677
|
+
yield [key, value.value];
|
|
19678
|
+
}
|
|
19679
|
+
}
|
|
19680
|
+
}
|
|
19681
|
+
}
|
|
19682
|
+
*entriesDescending() {
|
|
19683
|
+
let items = [...this.#cache];
|
|
19684
|
+
for (let i = items.length - 1;i >= 0; --i) {
|
|
19685
|
+
const item = items[i];
|
|
19686
|
+
const [key, value] = item;
|
|
19687
|
+
const deleted = this.#deleteIfExpired(key, value);
|
|
19688
|
+
if (deleted === false) {
|
|
19689
|
+
yield [key, value.value];
|
|
19690
|
+
}
|
|
19691
|
+
}
|
|
19692
|
+
items = [...this.#oldCache];
|
|
19693
|
+
for (let i = items.length - 1;i >= 0; --i) {
|
|
19694
|
+
const item = items[i];
|
|
19695
|
+
const [key, value] = item;
|
|
19696
|
+
if (!this.#cache.has(key)) {
|
|
19697
|
+
const deleted = this.#deleteIfExpired(key, value);
|
|
19698
|
+
if (deleted === false) {
|
|
19699
|
+
yield [key, value.value];
|
|
19700
|
+
}
|
|
19701
|
+
}
|
|
19702
|
+
}
|
|
19703
|
+
}
|
|
19704
|
+
*entriesAscending() {
|
|
19705
|
+
for (const [key, value] of this.#entriesAscending()) {
|
|
19706
|
+
yield [key, value.value];
|
|
19707
|
+
}
|
|
19708
|
+
}
|
|
19709
|
+
get size() {
|
|
19710
|
+
if (!this.#size) {
|
|
19711
|
+
return this.#oldCache.size;
|
|
19712
|
+
}
|
|
19713
|
+
let oldCacheSize = 0;
|
|
19714
|
+
for (const key of this.#oldCache.keys()) {
|
|
19715
|
+
if (!this.#cache.has(key)) {
|
|
19716
|
+
oldCacheSize++;
|
|
19717
|
+
}
|
|
19718
|
+
}
|
|
19719
|
+
return Math.min(this.#size + oldCacheSize, this.#maxSize);
|
|
19720
|
+
}
|
|
19721
|
+
get maxSize() {
|
|
19722
|
+
return this.#maxSize;
|
|
19723
|
+
}
|
|
19724
|
+
get maxAge() {
|
|
19725
|
+
return this.#maxAge;
|
|
19726
|
+
}
|
|
19727
|
+
entries() {
|
|
19728
|
+
return this.entriesAscending();
|
|
19729
|
+
}
|
|
19730
|
+
forEach(callbackFunction, thisArgument = this) {
|
|
19731
|
+
for (const [key, value] of this.entriesAscending()) {
|
|
19732
|
+
callbackFunction.call(thisArgument, value, key, this);
|
|
19733
|
+
}
|
|
19734
|
+
}
|
|
19735
|
+
get [Symbol.toStringTag]() {
|
|
19736
|
+
return "QuickLRU";
|
|
19737
|
+
}
|
|
19738
|
+
toString() {
|
|
19739
|
+
return `QuickLRU(${this.size}/${this.maxSize})`;
|
|
19740
|
+
}
|
|
19741
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
19742
|
+
return this.toString();
|
|
19743
|
+
}
|
|
19744
|
+
}
|
|
19745
|
+
|
|
19746
|
+
// src/config/index.ts
|
|
19747
|
+
init_evidence_schema();
|
|
19748
|
+
init_plan_schema();
|
|
19749
|
+
|
|
19750
|
+
// src/config/spec-schema.ts
|
|
19751
|
+
init_zod();
|
|
19752
|
+
var ObligationSchema = exports_external.enum(["MUST", "SHALL", "SHOULD", "MAY"]);
|
|
19753
|
+
var SpecRequirementSchema = exports_external.object({
|
|
19754
|
+
id: exports_external.string().regex(/^FR-(?!000)\d{3}$/, "Requirement ID must match FR-### pattern (e.g., FR-001)"),
|
|
19755
|
+
obligation: ObligationSchema,
|
|
19756
|
+
text: exports_external.string().min(1)
|
|
19757
|
+
});
|
|
19758
|
+
var SpecScenarioSchema = exports_external.object({
|
|
19759
|
+
name: exports_external.string().min(1),
|
|
19760
|
+
given: exports_external.array(exports_external.string()).optional().default([]),
|
|
19761
|
+
when: exports_external.array(exports_external.string()).min(1, 'Scenario must have at least one "when" clause'),
|
|
19762
|
+
thenClauses: exports_external.array(exports_external.string()).min(1, 'Scenario must have at least one "then" clause')
|
|
19763
|
+
});
|
|
19764
|
+
var SpecSectionSchema = exports_external.object({
|
|
19765
|
+
name: exports_external.string().min(1),
|
|
19766
|
+
requirements: exports_external.array(SpecRequirementSchema).default([])
|
|
19767
|
+
});
|
|
19768
|
+
var SwarmSpecSchema = exports_external.object({
|
|
19769
|
+
title: exports_external.string().min(1),
|
|
19770
|
+
purpose: exports_external.string().min(1),
|
|
19771
|
+
sections: exports_external.array(SpecSectionSchema).min(1, "Spec must have at least one section")
|
|
19772
|
+
});
|
|
19773
|
+
var SpecDeltaSchema = exports_external.object({
|
|
19774
|
+
added: exports_external.array(SpecRequirementSchema).default([]),
|
|
19775
|
+
modified: exports_external.array(SpecRequirementSchema).default([]),
|
|
19776
|
+
removed: exports_external.array(SpecRequirementSchema).default([])
|
|
19777
|
+
});
|
|
19778
|
+
var DeltaSpecSchema = exports_external.union([
|
|
19779
|
+
SwarmSpecSchema,
|
|
19780
|
+
SpecDeltaSchema
|
|
19781
|
+
]);
|
|
19782
|
+
// src/agents/index.ts
|
|
19783
|
+
var warnedAgents = new Set;
|
|
19784
|
+
|
|
19785
|
+
// src/hooks/guardrails.ts
|
|
19786
|
+
init_manager();
|
|
19787
|
+
init_telemetry();
|
|
19788
|
+
init_utils();
|
|
19789
|
+
|
|
19790
|
+
// src/hooks/conflict-resolution.ts
|
|
19791
|
+
init_telemetry();
|
|
19792
|
+
|
|
19793
|
+
// src/hooks/extractors.ts
|
|
19794
|
+
function extractCurrentPhase(planContent) {
|
|
19795
|
+
if (!planContent) {
|
|
19796
|
+
return null;
|
|
19797
|
+
}
|
|
19798
|
+
const lines = planContent.split(`
|
|
19799
|
+
`);
|
|
19800
|
+
for (let i = 0;i < Math.min(20, lines.length); i++) {
|
|
19801
|
+
const line = lines[i].trim();
|
|
19802
|
+
const progressMatch = line.match(/^## Phase (\d+):?\s*(.*?)\s*\[IN PROGRESS\]/i);
|
|
19803
|
+
if (progressMatch) {
|
|
19804
|
+
const phaseNum = progressMatch[1];
|
|
19805
|
+
const description = progressMatch[2]?.trim() || "";
|
|
19806
|
+
return `Phase ${phaseNum}: ${description} [IN PROGRESS]`;
|
|
19807
|
+
}
|
|
19808
|
+
}
|
|
19809
|
+
for (let i = 0;i < Math.min(3, lines.length); i++) {
|
|
19810
|
+
const line = lines[i].trim();
|
|
19811
|
+
const phaseMatch = line.match(/Phase:\s*(\d+)/i);
|
|
19812
|
+
if (phaseMatch) {
|
|
19813
|
+
const phaseNum = phaseMatch[1];
|
|
19814
|
+
return `Phase ${phaseNum} [PENDING]`;
|
|
19815
|
+
}
|
|
19816
|
+
}
|
|
19817
|
+
return null;
|
|
19818
|
+
}
|
|
19819
|
+
function extractCurrentPhaseFromPlan(plan) {
|
|
19820
|
+
const phase = plan.phases.find((p) => p.id === plan.current_phase);
|
|
19821
|
+
if (!phase)
|
|
19822
|
+
return null;
|
|
19823
|
+
const statusMap = {
|
|
19824
|
+
pending: "PENDING",
|
|
19825
|
+
in_progress: "IN PROGRESS",
|
|
19826
|
+
complete: "COMPLETE",
|
|
19827
|
+
blocked: "BLOCKED"
|
|
19828
|
+
};
|
|
19829
|
+
const statusText = statusMap[phase.status] || "PENDING";
|
|
19830
|
+
return `Phase ${phase.id}: ${phase.name} [${statusText}]`;
|
|
19831
|
+
}
|
|
19832
|
+
|
|
19833
|
+
// src/hooks/model-limits.ts
|
|
19834
|
+
init_utils();
|
|
19835
|
+
var loggedFirstCalls = new Set;
|
|
19836
|
+
|
|
19837
|
+
// src/hooks/guardrails.ts
|
|
19838
|
+
var storedInputArgs = new Map;
|
|
19839
|
+
var toolCallsSinceLastWrite = new Map;
|
|
19840
|
+
var noOpWarningIssued = new Set;
|
|
19841
|
+
var consecutiveNoToolTurns = new Map;
|
|
19842
|
+
var DC_SAFE_TARGETS = new Set([
|
|
19843
|
+
"node_modules",
|
|
19844
|
+
".git",
|
|
19845
|
+
"dist",
|
|
19846
|
+
"build",
|
|
19847
|
+
"coverage",
|
|
19848
|
+
".next",
|
|
19849
|
+
".turbo",
|
|
19850
|
+
".cache",
|
|
19851
|
+
".venv",
|
|
19852
|
+
"venv",
|
|
19853
|
+
"__pycache__",
|
|
19854
|
+
"target",
|
|
19855
|
+
"out",
|
|
19856
|
+
".parcel-cache",
|
|
19857
|
+
".svelte-kit",
|
|
19858
|
+
".nuxt",
|
|
19859
|
+
".output",
|
|
19860
|
+
".angular",
|
|
19861
|
+
".gradle",
|
|
19862
|
+
"vendor"
|
|
19863
|
+
]);
|
|
19864
|
+
var DC_FS_ROOTS = new Set(["/", "C:\\", "C:/", "D:\\", "D:/", "E:\\", "E:/"]);
|
|
19865
|
+
var pathNormalizationCache = new QuickLRU({
|
|
19866
|
+
maxSize: 500
|
|
19867
|
+
});
|
|
19868
|
+
var globMatcherCache = new QuickLRU({
|
|
19869
|
+
maxSize: 200
|
|
19870
|
+
});
|
|
19871
|
+
|
|
19872
|
+
// src/hooks/delegation-gate.ts
|
|
19873
|
+
init_utils2();
|
|
19874
|
+
var pendingCoderScopeByTaskId = new Map;
|
|
19875
|
+
function clearPendingCoderScope() {
|
|
19876
|
+
pendingCoderScopeByTaskId.clear();
|
|
19877
|
+
}
|
|
19878
|
+
|
|
19879
|
+
// src/state.ts
|
|
19467
19880
|
init_telemetry();
|
|
19468
19881
|
var _rehydrationCache = null;
|
|
19469
19882
|
var swarmState = {
|
|
@@ -19496,6 +19909,7 @@ function resetSwarmState() {
|
|
|
19496
19909
|
_rehydrationCache = null;
|
|
19497
19910
|
swarmState.fullAutoEnabledInConfig = false;
|
|
19498
19911
|
swarmState.environmentProfiles.clear();
|
|
19912
|
+
clearPendingCoderScope();
|
|
19499
19913
|
}
|
|
19500
19914
|
function getAgentSession(sessionId) {
|
|
19501
19915
|
return swarmState.agentSessions.get(sessionId);
|
|
@@ -32178,43 +32592,6 @@ function tool(input) {
|
|
|
32178
32592
|
return input;
|
|
32179
32593
|
}
|
|
32180
32594
|
tool.schema = exports_external2;
|
|
32181
|
-
|
|
32182
|
-
// src/config/index.ts
|
|
32183
|
-
init_evidence_schema();
|
|
32184
|
-
init_plan_schema();
|
|
32185
|
-
|
|
32186
|
-
// src/config/spec-schema.ts
|
|
32187
|
-
init_zod();
|
|
32188
|
-
var ObligationSchema = exports_external.enum(["MUST", "SHALL", "SHOULD", "MAY"]);
|
|
32189
|
-
var SpecRequirementSchema = exports_external.object({
|
|
32190
|
-
id: exports_external.string().regex(/^FR-(?!000)\d{3}$/, "Requirement ID must match FR-### pattern (e.g., FR-001)"),
|
|
32191
|
-
obligation: ObligationSchema,
|
|
32192
|
-
text: exports_external.string().min(1)
|
|
32193
|
-
});
|
|
32194
|
-
var SpecScenarioSchema = exports_external.object({
|
|
32195
|
-
name: exports_external.string().min(1),
|
|
32196
|
-
given: exports_external.array(exports_external.string()).optional().default([]),
|
|
32197
|
-
when: exports_external.array(exports_external.string()).min(1, 'Scenario must have at least one "when" clause'),
|
|
32198
|
-
thenClauses: exports_external.array(exports_external.string()).min(1, 'Scenario must have at least one "then" clause')
|
|
32199
|
-
});
|
|
32200
|
-
var SpecSectionSchema = exports_external.object({
|
|
32201
|
-
name: exports_external.string().min(1),
|
|
32202
|
-
requirements: exports_external.array(SpecRequirementSchema).default([])
|
|
32203
|
-
});
|
|
32204
|
-
var SwarmSpecSchema = exports_external.object({
|
|
32205
|
-
title: exports_external.string().min(1),
|
|
32206
|
-
purpose: exports_external.string().min(1),
|
|
32207
|
-
sections: exports_external.array(SpecSectionSchema).min(1, "Spec must have at least one section")
|
|
32208
|
-
});
|
|
32209
|
-
var SpecDeltaSchema = exports_external.object({
|
|
32210
|
-
added: exports_external.array(SpecRequirementSchema).default([]),
|
|
32211
|
-
modified: exports_external.array(SpecRequirementSchema).default([]),
|
|
32212
|
-
removed: exports_external.array(SpecRequirementSchema).default([])
|
|
32213
|
-
});
|
|
32214
|
-
var DeltaSpecSchema = exports_external.union([
|
|
32215
|
-
SwarmSpecSchema,
|
|
32216
|
-
SpecDeltaSchema
|
|
32217
|
-
]);
|
|
32218
32595
|
// src/tools/create-tool.ts
|
|
32219
32596
|
function classifyToolError(error93) {
|
|
32220
32597
|
const msg = (error93 instanceof Error ? error93.message ?? "" : String(error93)).toLowerCase();
|
|
@@ -37537,7 +37914,7 @@ function validatePlanPhases(plan) {
|
|
|
37537
37914
|
}
|
|
37538
37915
|
return true;
|
|
37539
37916
|
}
|
|
37540
|
-
function
|
|
37917
|
+
function extractCurrentPhaseFromPlan2(plan) {
|
|
37541
37918
|
if (!plan) {
|
|
37542
37919
|
return { currentPhase: null, currentTask: null, incompleteTasks: [] };
|
|
37543
37920
|
}
|
|
@@ -37685,7 +38062,7 @@ async function getHandoffData(directory) {
|
|
|
37685
38062
|
const sessionContent = await readSwarmFileAsync(directory, "session/state.json");
|
|
37686
38063
|
const sessionState = parseSessionState(sessionContent);
|
|
37687
38064
|
const plan = await loadPlanJsonOnly(directory);
|
|
37688
|
-
const planInfo =
|
|
38065
|
+
const planInfo = extractCurrentPhaseFromPlan2(plan);
|
|
37689
38066
|
if (!plan) {
|
|
37690
38067
|
const planMdContent = await readSwarmFileAsync(directory, "plan.md");
|
|
37691
38068
|
if (planMdContent) {
|
|
@@ -43524,46 +43901,6 @@ async function handleSpecifyCommand(_directory, args) {
|
|
|
43524
43901
|
return "[MODE: SPECIFY] Please enter MODE: SPECIFY and generate a spec for this project.";
|
|
43525
43902
|
}
|
|
43526
43903
|
|
|
43527
|
-
// src/hooks/extractors.ts
|
|
43528
|
-
function extractCurrentPhase(planContent) {
|
|
43529
|
-
if (!planContent) {
|
|
43530
|
-
return null;
|
|
43531
|
-
}
|
|
43532
|
-
const lines = planContent.split(`
|
|
43533
|
-
`);
|
|
43534
|
-
for (let i = 0;i < Math.min(20, lines.length); i++) {
|
|
43535
|
-
const line = lines[i].trim();
|
|
43536
|
-
const progressMatch = line.match(/^## Phase (\d+):?\s*(.*?)\s*\[IN PROGRESS\]/i);
|
|
43537
|
-
if (progressMatch) {
|
|
43538
|
-
const phaseNum = progressMatch[1];
|
|
43539
|
-
const description = progressMatch[2]?.trim() || "";
|
|
43540
|
-
return `Phase ${phaseNum}: ${description} [IN PROGRESS]`;
|
|
43541
|
-
}
|
|
43542
|
-
}
|
|
43543
|
-
for (let i = 0;i < Math.min(3, lines.length); i++) {
|
|
43544
|
-
const line = lines[i].trim();
|
|
43545
|
-
const phaseMatch = line.match(/Phase:\s*(\d+)/i);
|
|
43546
|
-
if (phaseMatch) {
|
|
43547
|
-
const phaseNum = phaseMatch[1];
|
|
43548
|
-
return `Phase ${phaseNum} [PENDING]`;
|
|
43549
|
-
}
|
|
43550
|
-
}
|
|
43551
|
-
return null;
|
|
43552
|
-
}
|
|
43553
|
-
function extractCurrentPhaseFromPlan2(plan) {
|
|
43554
|
-
const phase = plan.phases.find((p) => p.id === plan.current_phase);
|
|
43555
|
-
if (!phase)
|
|
43556
|
-
return null;
|
|
43557
|
-
const statusMap = {
|
|
43558
|
-
pending: "PENDING",
|
|
43559
|
-
in_progress: "IN PROGRESS",
|
|
43560
|
-
complete: "COMPLETE",
|
|
43561
|
-
blocked: "BLOCKED"
|
|
43562
|
-
};
|
|
43563
|
-
const statusText = statusMap[phase.status] || "PENDING";
|
|
43564
|
-
return `Phase ${phase.id}: ${phase.name} [${statusText}]`;
|
|
43565
|
-
}
|
|
43566
|
-
|
|
43567
43904
|
// src/services/status-service.ts
|
|
43568
43905
|
init_utils2();
|
|
43569
43906
|
init_manager();
|
|
@@ -43623,7 +43960,7 @@ var DEFAULT_CONTEXT_BUDGET_CONFIG = {
|
|
|
43623
43960
|
async function getStatusData(directory, agents) {
|
|
43624
43961
|
const plan = await loadPlan(directory);
|
|
43625
43962
|
if (plan && plan.migration_status !== "migration_failed") {
|
|
43626
|
-
const currentPhase2 =
|
|
43963
|
+
const currentPhase2 = extractCurrentPhaseFromPlan(plan) || "Unknown";
|
|
43627
43964
|
let completedTasks2 = 0;
|
|
43628
43965
|
let totalTasks2 = 0;
|
|
43629
43966
|
for (const phase of plan.phases) {
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -331,6 +331,8 @@ export declare const GuardrailsConfigSchema: z.ZodObject<{
|
|
|
331
331
|
idle_timeout_minutes: z.ZodOptional<z.ZodNumber>;
|
|
332
332
|
}, z.core.$strip>>>;
|
|
333
333
|
block_destructive_commands: z.ZodDefault<z.ZodBoolean>;
|
|
334
|
+
interpreter_allowed_agents: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
335
|
+
shell_audit_log: z.ZodDefault<z.ZodBoolean>;
|
|
334
336
|
}, z.core.$strip>;
|
|
335
337
|
export type GuardrailsConfig = z.infer<typeof GuardrailsConfigSchema>;
|
|
336
338
|
export declare const WatchdogConfigSchema: z.ZodObject<{
|
|
@@ -509,6 +511,7 @@ export declare const AuthorityConfigSchema: z.ZodObject<{
|
|
|
509
511
|
blockedGlobs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
510
512
|
allowedGlobs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
511
513
|
}, z.core.$strip>>>;
|
|
514
|
+
universal_deny_prefixes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
512
515
|
}, z.core.$strip>;
|
|
513
516
|
export type AuthorityConfig = z.infer<typeof AuthorityConfigSchema>;
|
|
514
517
|
export declare const CouncilConfigSchema: z.ZodObject<{
|
|
@@ -666,6 +669,8 @@ export declare const PluginConfigSchema: z.ZodObject<{
|
|
|
666
669
|
idle_timeout_minutes: z.ZodOptional<z.ZodNumber>;
|
|
667
670
|
}, z.core.$strip>>>;
|
|
668
671
|
block_destructive_commands: z.ZodDefault<z.ZodBoolean>;
|
|
672
|
+
interpreter_allowed_agents: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
673
|
+
shell_audit_log: z.ZodDefault<z.ZodBoolean>;
|
|
669
674
|
}, z.core.$strip>>;
|
|
670
675
|
watchdog: z.ZodOptional<z.ZodObject<{
|
|
671
676
|
scope_guard: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -699,6 +704,7 @@ export declare const PluginConfigSchema: z.ZodObject<{
|
|
|
699
704
|
blockedGlobs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
700
705
|
allowedGlobs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
701
706
|
}, z.core.$strip>>>;
|
|
707
|
+
universal_deny_prefixes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
702
708
|
}, z.core.$strip>>;
|
|
703
709
|
plan_cursor: z.ZodOptional<z.ZodObject<{
|
|
704
710
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -11,8 +11,19 @@ import type { DelegationEnvelope, EnvelopeValidationResult } from '../types/dele
|
|
|
11
11
|
* When messagesTransform sets declaredCoderScope on the architect session,
|
|
12
12
|
* the coder session may not exist yet. This map allows scope-guard to look up
|
|
13
13
|
* the scope by taskId when the session's declaredCoderScope is null.
|
|
14
|
+
*
|
|
15
|
+
* v6.70.0 gap-closure: this map is module-scoped (not inside `swarmState`) and
|
|
16
|
+
* is cleared by `resetSwarmState` via `clearPendingCoderScope()` below. Without
|
|
17
|
+
* that cleanup, a `/swarm close` followed by a new session with a colliding
|
|
18
|
+
* taskId (e.g. "1.1") would inherit stale scope from the previous swarm.
|
|
14
19
|
*/
|
|
15
20
|
export declare const pendingCoderScopeByTaskId: Map<string, string[]>;
|
|
21
|
+
/**
|
|
22
|
+
* v6.70.0 gap-closure: clears the pending coder-scope map. Exported as a
|
|
23
|
+
* helper (rather than importing the map directly from state.ts) to avoid the
|
|
24
|
+
* circular import `state.ts ↔ delegation-gate.ts`. Called by `resetSwarmState`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function clearPendingCoderScope(): void;
|
|
16
27
|
/**
|
|
17
28
|
* Parses a string to extract a DelegationEnvelope.
|
|
18
29
|
* Returns null if no valid envelope is found.
|