@a1hvdy/cc-openclaw 0.5.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/command-router/cc-handler.js +72 -0
- package/dist/src/command-router/cc-handler.js.map +1 -1
- package/dist/src/constants.d.ts +9 -0
- package/dist/src/constants.js +10 -0
- package/dist/src/constants.js.map +1 -1
- package/dist/src/engines/persistent-session.d.ts +2 -0
- package/dist/src/engines/persistent-session.js +41 -11
- package/dist/src/engines/persistent-session.js.map +1 -1
- package/dist/src/lib/config.d.ts +2 -0
- package/dist/src/lib/config.js +19 -0
- package/dist/src/lib/config.js.map +1 -1
- package/dist/src/lib/sysprompt-strip.js +12 -12
- package/dist/src/lib/sysprompt-strip.js.map +1 -1
- package/dist/src/lib/trajectory.d.ts +1 -1
- package/dist/src/lib/trajectory.js.map +1 -1
- package/dist/src/lib/vendor-paths.d.ts +6 -4
- package/dist/src/lib/vendor-paths.js +21 -14
- package/dist/src/lib/vendor-paths.js.map +1 -1
- package/dist/src/openai-compat/openai-compat.d.ts +7 -1
- package/dist/src/openai-compat/openai-compat.js +8 -1
- package/dist/src/openai-compat/openai-compat.js.map +1 -1
- package/dist/src/openai-compat/sse-translator.d.ts +23 -3
- package/dist/src/openai-compat/sse-translator.js +45 -6
- package/dist/src/openai-compat/sse-translator.js.map +1 -1
- package/dist/src/session-bootstrap/cwd-patch.js +59 -28
- package/dist/src/session-bootstrap/cwd-patch.js.map +1 -1
- package/dist/src/types.d.ts +1 -0
- package/package.json +2 -3
- package/vendor/base-oneshot-session.d.ts +0 -87
- package/vendor/base-oneshot-session.js +0 -227
- package/vendor/base-oneshot-session.js.map +0 -1
- package/vendor/circuit-breaker.d.ts +0 -21
- package/vendor/circuit-breaker.js +0 -47
- package/vendor/circuit-breaker.js.map +0 -1
- package/vendor/consensus.d.ts +0 -20
- package/vendor/consensus.js +0 -52
- package/vendor/consensus.js.map +0 -1
- package/vendor/constants.d.ts +0 -130
- package/vendor/constants.js +0 -139
- package/vendor/constants.js.map +0 -1
- package/vendor/council.d.ts +0 -67
- package/vendor/council.js +0 -913
- package/vendor/council.js.map +0 -1
- package/vendor/embedded-server.d.ts +0 -25
- package/vendor/embedded-server.js +0 -373
- package/vendor/embedded-server.js.map +0 -1
- package/vendor/inbox-manager.d.ts +0 -38
- package/vendor/inbox-manager.js +0 -111
- package/vendor/inbox-manager.js.map +0 -1
- package/vendor/index.d.ts +0 -63
- package/vendor/index.js +0 -705
- package/vendor/index.js.map +0 -1
- package/vendor/logger.d.ts +0 -16
- package/vendor/logger.js +0 -44
- package/vendor/logger.js.map +0 -1
- package/vendor/models.d.ts +0 -69
- package/vendor/models.js +0 -289
- package/vendor/models.js.map +0 -1
- package/vendor/openai-compat.d.ts +0 -197
- package/vendor/openai-compat.js +0 -765
- package/vendor/openai-compat.js.map +0 -1
- package/vendor/persistent-codex-session.d.ts +0 -16
- package/vendor/persistent-codex-session.js +0 -105
- package/vendor/persistent-codex-session.js.map +0 -1
- package/vendor/persistent-cursor-session.d.ts +0 -21
- package/vendor/persistent-cursor-session.js +0 -241
- package/vendor/persistent-cursor-session.js.map +0 -1
- package/vendor/persistent-custom-session.d.ts +0 -78
- package/vendor/persistent-custom-session.js +0 -937
- package/vendor/persistent-custom-session.js.map +0 -1
- package/vendor/persistent-gemini-session.d.ts +0 -21
- package/vendor/persistent-gemini-session.js +0 -216
- package/vendor/persistent-gemini-session.js.map +0 -1
- package/vendor/persistent-session.d.ts +0 -74
- package/vendor/persistent-session.js +0 -684
- package/vendor/persistent-session.js.map +0 -1
- package/vendor/proxy/anthropic-adapter.d.ts +0 -136
- package/vendor/proxy/anthropic-adapter.js +0 -392
- package/vendor/proxy/anthropic-adapter.js.map +0 -1
- package/vendor/proxy/handler.d.ts +0 -39
- package/vendor/proxy/handler.js +0 -323
- package/vendor/proxy/handler.js.map +0 -1
- package/vendor/proxy/schema-cleaner.d.ts +0 -11
- package/vendor/proxy/schema-cleaner.js +0 -34
- package/vendor/proxy/schema-cleaner.js.map +0 -1
- package/vendor/proxy/thought-cache.d.ts +0 -19
- package/vendor/proxy/thought-cache.js +0 -53
- package/vendor/proxy/thought-cache.js.map +0 -1
- package/vendor/session-manager.d.ts +0 -211
- package/vendor/session-manager.js +0 -1345
- package/vendor/session-manager.js.map +0 -1
- package/vendor/skill-resolver.js +0 -107
- package/vendor/types.d.ts +0 -466
- package/vendor/types.js +0 -8
- package/vendor/types.js.map +0 -1
- package/vendor/validation.d.ts +0 -31
- package/vendor/validation.js +0 -104
- package/vendor/validation.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-oneshot-session.js","sourceRoot":"","sources":["../../src/base-oneshot-session.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EASL,eAAe,IAAI,oBAAoB,GACxC,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAqBzF,8EAA8E;AAE9E,MAAM,OAAgB,kBAAmB,SAAQ,YAAY;IACjD,OAAO,CAAgB;IACvB,SAAS,CAAS;IAClB,SAAS,CAAsB;IAEjC,QAAQ,GAAG,KAAK,CAAC;IACjB,SAAS,GAAG,KAAK,CAAC;IAClB,OAAO,GAAG,KAAK,CAAC;IACd,WAAW,GAAwB,IAAI,CAAC;IAC1C,gBAAgB,GAAG,CAAC,CAAC;IACrB,UAAU,GAAkB,IAAI,CAAC;IACjC,QAAQ,GAA0D,EAAE,CAAC;IAEtE,SAAS,CAAU;IAChB,MAAM,GAAG;QACjB,KAAK,EAAE,CAAC;QACR,SAAS,EAAE,C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YAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACtE,CAAC;IAES,WAAW;QACnB,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxC,IAAI,IAAI,CAAC,SAAS,CAAC,oBAAoB,EAAE,CAAC;YACxC,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;YACxC,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACjF,IAAI,CAAC,MAAM,CAAC,OAAO;gBACjB,CAAC,WAAW,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC,KAAK;oBACzC,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,SAAS,CAAC,GAAG,WAAW;oBACpD,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;QACzD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,CAAC,OAAO;gBACjB,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;QAC9G,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Circuit breaker for engine failure tracking.
|
|
3
|
-
*
|
|
4
|
-
* Opens after CIRCUIT_BREAKER_THRESHOLD consecutive failures per engine,
|
|
5
|
-
* with exponential backoff capped at CIRCUIT_BREAKER_MAX_BACKOFF_MS.
|
|
6
|
-
* Resets on a successful engine start.
|
|
7
|
-
*/
|
|
8
|
-
export declare class CircuitBreaker {
|
|
9
|
-
private breakers;
|
|
10
|
-
/** Throws if the engine circuit is open and backoff has not yet expired. */
|
|
11
|
-
check(engine: string): void;
|
|
12
|
-
/** Record a failure — increments count and sets exponential backoff. */
|
|
13
|
-
recordFailure(engine: string): void;
|
|
14
|
-
/** Reset (clear) the breaker for an engine after a successful start. */
|
|
15
|
-
reset(engine: string): void;
|
|
16
|
-
/** Get status snapshot for health() reporting. */
|
|
17
|
-
getStatus(): Record<string, {
|
|
18
|
-
failures: number;
|
|
19
|
-
backoffUntil: string | null;
|
|
20
|
-
}>;
|
|
21
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Circuit breaker for engine failure tracking.
|
|
3
|
-
*
|
|
4
|
-
* Opens after CIRCUIT_BREAKER_THRESHOLD consecutive failures per engine,
|
|
5
|
-
* with exponential backoff capped at CIRCUIT_BREAKER_MAX_BACKOFF_MS.
|
|
6
|
-
* Resets on a successful engine start.
|
|
7
|
-
*/
|
|
8
|
-
import { CIRCUIT_BREAKER_THRESHOLD, CIRCUIT_BREAKER_BACKOFF_BASE_MS, CIRCUIT_BREAKER_MAX_BACKOFF_MS, } from './constants.js';
|
|
9
|
-
export class CircuitBreaker {
|
|
10
|
-
breakers = new Map();
|
|
11
|
-
/** Throws if the engine circuit is open and backoff has not yet expired. */
|
|
12
|
-
check(engine) {
|
|
13
|
-
const breaker = this.breakers.get(engine);
|
|
14
|
-
if (!breaker)
|
|
15
|
-
return;
|
|
16
|
-
if (breaker.count >= CIRCUIT_BREAKER_THRESHOLD && Date.now() < breaker.backoffUntil) {
|
|
17
|
-
const remaining = Math.ceil((breaker.backoffUntil - Date.now()) / 1000);
|
|
18
|
-
throw new Error(`Engine '${engine}' circuit breaker open after ${breaker.count} consecutive failures. ` +
|
|
19
|
-
`Retry in ${remaining}s.`);
|
|
20
|
-
}
|
|
21
|
-
// If backoff has expired, allow the attempt (will reset on success)
|
|
22
|
-
}
|
|
23
|
-
/** Record a failure — increments count and sets exponential backoff. */
|
|
24
|
-
recordFailure(engine) {
|
|
25
|
-
const existing = this.breakers.get(engine) || { count: 0, lastFailure: 0, backoffUntil: 0 };
|
|
26
|
-
existing.count++;
|
|
27
|
-
existing.lastFailure = Date.now();
|
|
28
|
-
const backoff = Math.min(CIRCUIT_BREAKER_BACKOFF_BASE_MS * Math.pow(2, existing.count - 1), CIRCUIT_BREAKER_MAX_BACKOFF_MS);
|
|
29
|
-
existing.backoffUntil = Date.now() + backoff;
|
|
30
|
-
this.breakers.set(engine, existing);
|
|
31
|
-
}
|
|
32
|
-
/** Reset (clear) the breaker for an engine after a successful start. */
|
|
33
|
-
reset(engine) {
|
|
34
|
-
this.breakers.delete(engine);
|
|
35
|
-
}
|
|
36
|
-
/** Get status snapshot for health() reporting. */
|
|
37
|
-
getStatus() {
|
|
38
|
-
return Object.fromEntries([...this.breakers].map(([engine, state]) => [
|
|
39
|
-
engine,
|
|
40
|
-
{
|
|
41
|
-
failures: state.count,
|
|
42
|
-
backoffUntil: state.backoffUntil > Date.now() ? new Date(state.backoffUntil).toISOString() : null,
|
|
43
|
-
},
|
|
44
|
-
]));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=circuit-breaker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"circuit-breaker.js","sourceRoot":"","sources":["../../src/circuit-breaker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,yBAAyB,EACzB,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,gBAAgB,CAAC;AAQxB,MAAM,OAAO,cAAc;IACjB,QAAQ,GAAG,IAAI,GAAG,EAAwB,CAAC;IAEnD,4EAA4E;IAC5E,KAAK,CAAC,MAAc;QAClB,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,OAAO;YAAE,OAAO;QACrB,IAAI,OAAO,CAAC,KAAK,IAAI,yBAAyB,IAAI,IAAI,CAAC,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E,CAAC;YAC1C,MAAM;YACN;gBACE,QAAQ,EAAE,KAAK,CAAC,KAAK;gBACrB,YAAY,EAAE,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI;aAClG;SACF,CAAC,CACH,CAAC;IACJ,CAAC;CACF"}
|
package/vendor/consensus.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Consensus vote parsing utilities
|
|
3
|
-
*
|
|
4
|
-
* Ported from three-minds — detects [CONSENSUS: YES/NO] tags in agent
|
|
5
|
-
* responses with multiple fallback patterns for variant formats.
|
|
6
|
-
*/
|
|
7
|
-
/** Remove all [CONSENSUS: YES/NO] tags from text */
|
|
8
|
-
export declare function stripConsensusTags(text: string): string;
|
|
9
|
-
/** Check whether text contains any consensus vote marker */
|
|
10
|
-
export declare function hasConsensusMarker(text: string): boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Parse a consensus vote from agent response text.
|
|
13
|
-
*
|
|
14
|
-
* Priority chain:
|
|
15
|
-
* 1. Strict format: [CONSENSUS: YES] / [CONSENSUS: NO]
|
|
16
|
-
* 2. Common variants: consensus: yes, **consensus**: no, CONSENSUS=YES, etc.
|
|
17
|
-
* 3. Tail fallback: analyse last 8 lines for positive/negative signals
|
|
18
|
-
* 4. Default: false (no consensus)
|
|
19
|
-
*/
|
|
20
|
-
export declare function parseConsensus(content: string): boolean;
|
package/vendor/consensus.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Consensus vote parsing utilities
|
|
3
|
-
*
|
|
4
|
-
* Ported from three-minds — detects [CONSENSUS: YES/NO] tags in agent
|
|
5
|
-
* responses with multiple fallback patterns for variant formats.
|
|
6
|
-
*/
|
|
7
|
-
/** Remove all [CONSENSUS: YES/NO] tags from text */
|
|
8
|
-
export function stripConsensusTags(text) {
|
|
9
|
-
return text.replace(/\[\s*CONSENSUS\s*[::]\s*(?:YES|NO)\s*\]/gi, '').trim();
|
|
10
|
-
}
|
|
11
|
-
/** Check whether text contains any consensus vote marker */
|
|
12
|
-
export function hasConsensusMarker(text) {
|
|
13
|
-
return (/\[\s*CONSENSUS\s*[::]\s*(?:YES|NO)\s*\]/i.test(text) ||
|
|
14
|
-
/consensus[:\s]+(yes|no)/i.test(text) ||
|
|
15
|
-
/共识投票[::\s]+(YES|NO)/i.test(text));
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Parse a consensus vote from agent response text.
|
|
19
|
-
*
|
|
20
|
-
* Priority chain:
|
|
21
|
-
* 1. Strict format: [CONSENSUS: YES] / [CONSENSUS: NO]
|
|
22
|
-
* 2. Common variants: consensus: yes, **consensus**: no, CONSENSUS=YES, etc.
|
|
23
|
-
* 3. Tail fallback: analyse last 8 lines for positive/negative signals
|
|
24
|
-
* 4. Default: false (no consensus)
|
|
25
|
-
*/
|
|
26
|
-
export function parseConsensus(content) {
|
|
27
|
-
// Strict format (supports Chinese colon) — take the LAST match
|
|
28
|
-
const strictMatches = [...content.matchAll(/\[\s*CONSENSUS\s*[::]\s*(YES|NO)\s*\]/gi)];
|
|
29
|
-
if (strictMatches.length > 0) {
|
|
30
|
-
return strictMatches[strictMatches.length - 1][1].toUpperCase() === 'YES';
|
|
31
|
-
}
|
|
32
|
-
// Fallback: common variants — also take the last match
|
|
33
|
-
const variantPatterns = [
|
|
34
|
-
/consensus[:\s]+(yes|no)/gi,
|
|
35
|
-
/\*\*consensus\*\*[:\s]+(yes|no)/gi,
|
|
36
|
-
/CONSENSUS=(YES|NO)/gi,
|
|
37
|
-
/共识投票[::\s]+(YES|NO)/gi,
|
|
38
|
-
/\[CONSENSUS\][:\s]+(YES|NO)/gi,
|
|
39
|
-
];
|
|
40
|
-
for (const pattern of variantPatterns) {
|
|
41
|
-
const matches = [...content.matchAll(pattern)];
|
|
42
|
-
if (matches.length > 0) {
|
|
43
|
-
return matches[matches.length - 1][1].toUpperCase() === 'YES';
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
// No explicit consensus tag found — default to NO.
|
|
47
|
-
// The previous tail-fallback heuristic was removed because it caused false
|
|
48
|
-
// positives when agents echoed back prompt instructions containing consensus
|
|
49
|
-
// keywords without actually voting.
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=consensus.js.map
|
package/vendor/consensus.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"consensus.js","sourceRoot":"","sources":["../../src/consensus.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,oDAAoD;AACpD,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,2CAA2C,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AAC9E,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO,CACL,0CAA0C,CAAC,IAAI,CAAC,IAAI,CAAC;QACrD,0BAA0B,CAAC,IAAI,CAAC,IAAI,CAAC;QACrC,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,CAClC,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe;IAC5C,+DAA+D;IAC/D,MAAM,aAAa,GAAG,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,yCAAyC,CAAC,CAAC,CAAC;IACvF,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7B,OAAO,aAAa,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC;IAC5E,CAAC;IAED,uDAAuD;IACvD,MAAM,eAAe,GAAG;QACtB,2BAA2B;QAC3B,mCAAmC;QACnC,sBAAsB;QACtB,uBAAuB;QACvB,+BAA+B;KAChC,CAAC;IACF,KAAK,MAAM,OAAO,IAAI,eAAe,EAAE,CAAC;QACtC,MAAM,OAAO,GAAG,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/C,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC;QAChE,CAAC;IACH,CAAC;IAED,mDAAmD;IACnD,2EAA2E;IAC3E,6EAA6E;IAC7E,oCAAoC;IACpC,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/vendor/constants.d.ts
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared constants — consolidates magic numbers scattered across the codebase.
|
|
3
|
-
*
|
|
4
|
-
* Grouped by domain. Import what you need rather than using inline numbers.
|
|
5
|
-
*/
|
|
6
|
-
/** Token threshold that triggers the onContextHigh hook */
|
|
7
|
-
export declare const CONTEXT_HIGH_THRESHOLD = 140000;
|
|
8
|
-
/** Max history entries kept in memory per session (oldest evicted via shift) */
|
|
9
|
-
export declare const MAX_HISTORY_ITEMS = 100;
|
|
10
|
-
/** Default number of history entries returned by getHistory() */
|
|
11
|
-
export declare const DEFAULT_HISTORY_LIMIT = 50;
|
|
12
|
-
/** Number of history entries fetched for grep operations */
|
|
13
|
-
export declare const GREP_HISTORY_FETCH = 500;
|
|
14
|
-
/** Wait for session init/ready event after spawn */
|
|
15
|
-
export declare const SESSION_READY_TIMEOUT_MS = 30000;
|
|
16
|
-
/** Fallback delay before checking if proc is alive (resume path) */
|
|
17
|
-
export declare const SESSION_READY_FALLBACK_MS = 2000;
|
|
18
|
-
/** Default timeout for a send() / turn completion */
|
|
19
|
-
export declare const TURN_TIMEOUT_MS = 300000;
|
|
20
|
-
/** Timeout for compact / context summary operations */
|
|
21
|
-
export declare const COMPACT_TIMEOUT_MS = 60000;
|
|
22
|
-
/** Delay before SIGKILL after initial SIGTERM on stop() */
|
|
23
|
-
export declare const STOP_SIGKILL_DELAY_MS = 3000;
|
|
24
|
-
/** Timeout for most git CLI operations (branch, checkout, log, diff) */
|
|
25
|
-
export declare const GIT_CMD_TIMEOUT_MS = 5000;
|
|
26
|
-
/** Timeout for git worktree add/remove (heavier operations) */
|
|
27
|
-
export declare const WORKTREE_CMD_TIMEOUT_MS = 10000;
|
|
28
|
-
/** Default per-agent timeout in council */
|
|
29
|
-
export declare const DEFAULT_AGENT_TIMEOUT_MS = 1800000;
|
|
30
|
-
/** Delay between council rounds */
|
|
31
|
-
export declare const INTER_ROUND_DELAY_MS = 3000;
|
|
32
|
-
/** Delay before retrying on empty agent response */
|
|
33
|
-
export declare const EMPTY_RESPONSE_RETRY_DELAY_MS = 5000;
|
|
34
|
-
/** Timeout for council follow-up prompts */
|
|
35
|
-
export declare const FOLLOWUP_TIMEOUT_MS = 60000;
|
|
36
|
-
/** Timeout for team list operations */
|
|
37
|
-
export declare const TEAM_LIST_TIMEOUT_MS = 30000;
|
|
38
|
-
/** Timeout for team send operations */
|
|
39
|
-
export declare const TEAM_SEND_TIMEOUT_MS = 120000;
|
|
40
|
-
/** Timeout for ultraplan sessions */
|
|
41
|
-
export declare const ULTRAPLAN_TIMEOUT_MS = 1800000;
|
|
42
|
-
/** How long completed results remain queryable */
|
|
43
|
-
export declare const RESULT_TTL_MS = 1800000;
|
|
44
|
-
/** Session TTL cleanup check interval */
|
|
45
|
-
export declare const CLEANUP_INTERVAL_MS = 60000;
|
|
46
|
-
/** Debounce delay for persisted session writes */
|
|
47
|
-
export declare const DEBOUNCED_SAVE_MS = 5000;
|
|
48
|
-
/** Persisted sessions disk TTL (7 days) */
|
|
49
|
-
export declare const PERSIST_DISK_TTL_MS: number;
|
|
50
|
-
/** Fetch timeout for proxy forward requests */
|
|
51
|
-
export declare const FETCH_TIMEOUT_MS = 600000;
|
|
52
|
-
/** Ultrareview polling interval */
|
|
53
|
-
export declare const ULTRAREVIEW_POLL_INTERVAL_MS = 5000;
|
|
54
|
-
/** Default port for the embedded HTTP server */
|
|
55
|
-
export declare const DEFAULT_SERVER_PORT = 18796;
|
|
56
|
-
/** Maximum request body size (5 MB) */
|
|
57
|
-
export declare const MAX_BODY_SIZE = 5242880;
|
|
58
|
-
/** Rate limit: max requests per window per IP */
|
|
59
|
-
export declare const RATE_LIMIT_MAX_REQUESTS = 300;
|
|
60
|
-
/** Rate limit: sliding window duration */
|
|
61
|
-
export declare const RATE_LIMIT_WINDOW_MS = 60000;
|
|
62
|
-
/** Minimum task description length */
|
|
63
|
-
export declare const MIN_TASK_LENGTH = 5;
|
|
64
|
-
/** Max retries for empty agent responses */
|
|
65
|
-
export declare const EMPTY_RESPONSE_MAX_RETRIES = 2;
|
|
66
|
-
/** Minimum response length to consider complete */
|
|
67
|
-
export declare const MIN_COMPLETE_RESPONSE_LENGTH = 100;
|
|
68
|
-
/** Max follow-up retries per agent */
|
|
69
|
-
export declare const FOLLOWUP_MAX_RETRIES = 2;
|
|
70
|
-
/** Character limit for history preview in council prompts */
|
|
71
|
-
export declare const HISTORY_PREVIEW_CHARS = 1500;
|
|
72
|
-
/** Character limit for agent summary in review */
|
|
73
|
-
export declare const SUMMARY_PREVIEW_CHARS = 500;
|
|
74
|
-
/** Character limit for short summary in transcript */
|
|
75
|
-
export declare const SUMMARY_SHORT_CHARS = 400;
|
|
76
|
-
/** Character limit for compact context */
|
|
77
|
-
export declare const COMPACT_CONTEXT_CHARS = 300;
|
|
78
|
-
/** Default max rounds in council collaboration */
|
|
79
|
-
export declare const DEFAULT_MAX_ROUNDS = 15;
|
|
80
|
-
/** Default max turns per agent */
|
|
81
|
-
export declare const DEFAULT_MAX_TURNS_PER_AGENT = 50;
|
|
82
|
-
/** Git log depth for council review */
|
|
83
|
-
export declare const GIT_LOG_DEPTH = 50;
|
|
84
|
-
/** Max messages per session inbox */
|
|
85
|
-
export declare const MAX_INBOX_SIZE = 200;
|
|
86
|
-
/** Consecutive failures before circuit opens */
|
|
87
|
-
export declare const CIRCUIT_BREAKER_THRESHOLD = 3;
|
|
88
|
-
/** Base backoff delay (doubles each failure) */
|
|
89
|
-
export declare const CIRCUIT_BREAKER_BACKOFF_BASE_MS = 1000;
|
|
90
|
-
/** Maximum backoff duration cap */
|
|
91
|
-
export declare const CIRCUIT_BREAKER_MAX_BACKOFF_MS = 300000;
|
|
92
|
-
export declare const SESSION_EVENT: {
|
|
93
|
-
readonly READY: "ready";
|
|
94
|
-
readonly INIT: "init";
|
|
95
|
-
readonly TEXT: "text";
|
|
96
|
-
readonly TOOL_USE: "tool_use";
|
|
97
|
-
readonly TOOL_RESULT: "tool_result";
|
|
98
|
-
readonly RESULT: "result";
|
|
99
|
-
readonly TURN_COMPLETE: "turn_complete";
|
|
100
|
-
readonly ERROR: "error";
|
|
101
|
-
readonly LOG: "log";
|
|
102
|
-
readonly CLOSE: "close";
|
|
103
|
-
readonly PAUSED: "paused";
|
|
104
|
-
readonly RESUMED: "resumed";
|
|
105
|
-
readonly SYSTEM: "system";
|
|
106
|
-
readonly STREAM_EVENT: "stream_event";
|
|
107
|
-
readonly USER_ECHO: "user_echo";
|
|
108
|
-
readonly ASSISTANT: "assistant";
|
|
109
|
-
readonly EVENT: "event";
|
|
110
|
-
};
|
|
111
|
-
export type SessionEventName = (typeof SESSION_EVENT)[keyof typeof SESSION_EVENT];
|
|
112
|
-
/** Default model when the OpenAI-compat request omits `model` */
|
|
113
|
-
export declare const OPENAI_COMPAT_DEFAULT_MODEL = "claude-sonnet-4-6";
|
|
114
|
-
/** Context utilization % threshold for auto-compact */
|
|
115
|
-
export declare const OPENAI_COMPAT_AUTO_COMPACT_THRESHOLD = 80;
|
|
116
|
-
/** Session name prefix for OpenAI-compat sessions */
|
|
117
|
-
export declare const OPENAI_COMPAT_SESSION_PREFIX = "openai-";
|
|
118
|
-
/**
|
|
119
|
-
* Default for the legacy new-conversation heuristic gate.
|
|
120
|
-
*
|
|
121
|
-
* When env var `OPENAI_COMPAT_NEW_CONVO_HEURISTIC=1` is set, the old
|
|
122
|
-
* "system + single user ⇒ new conversation" rule is restored for webchat
|
|
123
|
-
* frontends (ChatGPT-Next-Web, Open WebUI, etc) that re-send the full
|
|
124
|
-
* transcript every turn. Default off: assumes upstream clients forward
|
|
125
|
-
* only the latest turn (OpenClaw main agent loop, cron jobs, subagents).
|
|
126
|
-
*
|
|
127
|
-
* The constant exists as a documentation anchor; openai-compat.ts reads
|
|
128
|
-
* the env var directly so the value can be flipped without restart.
|
|
129
|
-
*/
|
|
130
|
-
export declare const OPENAI_COMPAT_NEW_CONVO_HEURISTIC_DEFAULT = false;
|
package/vendor/constants.js
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared constants — consolidates magic numbers scattered across the codebase.
|
|
3
|
-
*
|
|
4
|
-
* Grouped by domain. Import what you need rather than using inline numbers.
|
|
5
|
-
*/
|
|
6
|
-
// ─── Context & Token Limits ────────────────────────────────────────────────
|
|
7
|
-
/** Token threshold that triggers the onContextHigh hook */
|
|
8
|
-
export const CONTEXT_HIGH_THRESHOLD = 140_000;
|
|
9
|
-
// ─── History ────────────────────────────────────────────────────────────────
|
|
10
|
-
/** Max history entries kept in memory per session (oldest evicted via shift) */
|
|
11
|
-
export const MAX_HISTORY_ITEMS = 100;
|
|
12
|
-
/** Default number of history entries returned by getHistory() */
|
|
13
|
-
export const DEFAULT_HISTORY_LIMIT = 50;
|
|
14
|
-
/** Number of history entries fetched for grep operations */
|
|
15
|
-
export const GREP_HISTORY_FETCH = 500;
|
|
16
|
-
// ─── Timeouts ───────────────────────────────────────────────────────────────
|
|
17
|
-
/** Wait for session init/ready event after spawn */
|
|
18
|
-
export const SESSION_READY_TIMEOUT_MS = 30_000;
|
|
19
|
-
/** Fallback delay before checking if proc is alive (resume path) */
|
|
20
|
-
export const SESSION_READY_FALLBACK_MS = 2_000;
|
|
21
|
-
/** Default timeout for a send() / turn completion */
|
|
22
|
-
export const TURN_TIMEOUT_MS = 300_000;
|
|
23
|
-
/** Timeout for compact / context summary operations */
|
|
24
|
-
export const COMPACT_TIMEOUT_MS = 60_000;
|
|
25
|
-
/** Delay before SIGKILL after initial SIGTERM on stop() */
|
|
26
|
-
export const STOP_SIGKILL_DELAY_MS = 3_000;
|
|
27
|
-
/** Timeout for most git CLI operations (branch, checkout, log, diff) */
|
|
28
|
-
export const GIT_CMD_TIMEOUT_MS = 5_000;
|
|
29
|
-
/** Timeout for git worktree add/remove (heavier operations) */
|
|
30
|
-
export const WORKTREE_CMD_TIMEOUT_MS = 10_000;
|
|
31
|
-
/** Default per-agent timeout in council */
|
|
32
|
-
export const DEFAULT_AGENT_TIMEOUT_MS = 1_800_000;
|
|
33
|
-
/** Delay between council rounds */
|
|
34
|
-
export const INTER_ROUND_DELAY_MS = 3_000;
|
|
35
|
-
/** Delay before retrying on empty agent response */
|
|
36
|
-
export const EMPTY_RESPONSE_RETRY_DELAY_MS = 5_000;
|
|
37
|
-
/** Timeout for council follow-up prompts */
|
|
38
|
-
export const FOLLOWUP_TIMEOUT_MS = 60_000;
|
|
39
|
-
/** Timeout for team list operations */
|
|
40
|
-
export const TEAM_LIST_TIMEOUT_MS = 30_000;
|
|
41
|
-
/** Timeout for team send operations */
|
|
42
|
-
export const TEAM_SEND_TIMEOUT_MS = 120_000;
|
|
43
|
-
/** Timeout for ultraplan sessions */
|
|
44
|
-
export const ULTRAPLAN_TIMEOUT_MS = 1_800_000;
|
|
45
|
-
/** How long completed results remain queryable */
|
|
46
|
-
export const RESULT_TTL_MS = 1_800_000;
|
|
47
|
-
/** Session TTL cleanup check interval */
|
|
48
|
-
export const CLEANUP_INTERVAL_MS = 60_000;
|
|
49
|
-
/** Debounce delay for persisted session writes */
|
|
50
|
-
export const DEBOUNCED_SAVE_MS = 5_000;
|
|
51
|
-
/** Persisted sessions disk TTL (7 days) */
|
|
52
|
-
export const PERSIST_DISK_TTL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
53
|
-
/** Fetch timeout for proxy forward requests */
|
|
54
|
-
export const FETCH_TIMEOUT_MS = 600_000;
|
|
55
|
-
/** Ultrareview polling interval */
|
|
56
|
-
export const ULTRAREVIEW_POLL_INTERVAL_MS = 5_000;
|
|
57
|
-
// ─── Server ─────────────────────────────────────────────────────────────────
|
|
58
|
-
/** Default port for the embedded HTTP server */
|
|
59
|
-
export const DEFAULT_SERVER_PORT = 18_796;
|
|
60
|
-
/** Maximum request body size (5 MB) */
|
|
61
|
-
export const MAX_BODY_SIZE = 5_242_880;
|
|
62
|
-
/** Rate limit: max requests per window per IP */
|
|
63
|
-
export const RATE_LIMIT_MAX_REQUESTS = 300;
|
|
64
|
-
/** Rate limit: sliding window duration */
|
|
65
|
-
export const RATE_LIMIT_WINDOW_MS = 60_000;
|
|
66
|
-
// ─── Council ────────────────────────────────────────────────────────────────
|
|
67
|
-
/** Minimum task description length */
|
|
68
|
-
export const MIN_TASK_LENGTH = 5;
|
|
69
|
-
/** Max retries for empty agent responses */
|
|
70
|
-
export const EMPTY_RESPONSE_MAX_RETRIES = 2;
|
|
71
|
-
/** Minimum response length to consider complete */
|
|
72
|
-
export const MIN_COMPLETE_RESPONSE_LENGTH = 100;
|
|
73
|
-
/** Max follow-up retries per agent */
|
|
74
|
-
export const FOLLOWUP_MAX_RETRIES = 2;
|
|
75
|
-
/** Character limit for history preview in council prompts */
|
|
76
|
-
export const HISTORY_PREVIEW_CHARS = 1_500;
|
|
77
|
-
/** Character limit for agent summary in review */
|
|
78
|
-
export const SUMMARY_PREVIEW_CHARS = 500;
|
|
79
|
-
/** Character limit for short summary in transcript */
|
|
80
|
-
export const SUMMARY_SHORT_CHARS = 400;
|
|
81
|
-
/** Character limit for compact context */
|
|
82
|
-
export const COMPACT_CONTEXT_CHARS = 300;
|
|
83
|
-
/** Default max rounds in council collaboration */
|
|
84
|
-
export const DEFAULT_MAX_ROUNDS = 15;
|
|
85
|
-
/** Default max turns per agent */
|
|
86
|
-
export const DEFAULT_MAX_TURNS_PER_AGENT = 50;
|
|
87
|
-
/** Git log depth for council review */
|
|
88
|
-
export const GIT_LOG_DEPTH = 50;
|
|
89
|
-
// ─── Session Manager Limits ─────────────────────────────────────────────────
|
|
90
|
-
/** Max messages per session inbox */
|
|
91
|
-
export const MAX_INBOX_SIZE = 200;
|
|
92
|
-
// ─── Circuit Breaker ────────────────────────────────────────────────────────
|
|
93
|
-
/** Consecutive failures before circuit opens */
|
|
94
|
-
export const CIRCUIT_BREAKER_THRESHOLD = 3;
|
|
95
|
-
/** Base backoff delay (doubles each failure) */
|
|
96
|
-
export const CIRCUIT_BREAKER_BACKOFF_BASE_MS = 1_000;
|
|
97
|
-
/** Maximum backoff duration cap */
|
|
98
|
-
export const CIRCUIT_BREAKER_MAX_BACKOFF_MS = 300_000;
|
|
99
|
-
// ─── Session Events ─────────────────────────────────────────────────────────
|
|
100
|
-
export const SESSION_EVENT = {
|
|
101
|
-
READY: 'ready',
|
|
102
|
-
INIT: 'init',
|
|
103
|
-
TEXT: 'text',
|
|
104
|
-
TOOL_USE: 'tool_use',
|
|
105
|
-
TOOL_RESULT: 'tool_result',
|
|
106
|
-
RESULT: 'result',
|
|
107
|
-
TURN_COMPLETE: 'turn_complete',
|
|
108
|
-
ERROR: 'error',
|
|
109
|
-
LOG: 'log',
|
|
110
|
-
CLOSE: 'close',
|
|
111
|
-
PAUSED: 'paused',
|
|
112
|
-
RESUMED: 'resumed',
|
|
113
|
-
SYSTEM: 'system',
|
|
114
|
-
STREAM_EVENT: 'stream_event',
|
|
115
|
-
USER_ECHO: 'user_echo',
|
|
116
|
-
ASSISTANT: 'assistant',
|
|
117
|
-
EVENT: 'event',
|
|
118
|
-
};
|
|
119
|
-
// ─── OpenAI Compat ───────────────────────────────────────────────────────────
|
|
120
|
-
/** Default model when the OpenAI-compat request omits `model` */
|
|
121
|
-
export const OPENAI_COMPAT_DEFAULT_MODEL = 'claude-sonnet-4-6';
|
|
122
|
-
/** Context utilization % threshold for auto-compact */
|
|
123
|
-
export const OPENAI_COMPAT_AUTO_COMPACT_THRESHOLD = 80;
|
|
124
|
-
/** Session name prefix for OpenAI-compat sessions */
|
|
125
|
-
export const OPENAI_COMPAT_SESSION_PREFIX = 'openai-';
|
|
126
|
-
/**
|
|
127
|
-
* Default for the legacy new-conversation heuristic gate.
|
|
128
|
-
*
|
|
129
|
-
* When env var `OPENAI_COMPAT_NEW_CONVO_HEURISTIC=1` is set, the old
|
|
130
|
-
* "system + single user ⇒ new conversation" rule is restored for webchat
|
|
131
|
-
* frontends (ChatGPT-Next-Web, Open WebUI, etc) that re-send the full
|
|
132
|
-
* transcript every turn. Default off: assumes upstream clients forward
|
|
133
|
-
* only the latest turn (OpenClaw main agent loop, cron jobs, subagents).
|
|
134
|
-
*
|
|
135
|
-
* The constant exists as a documentation anchor; openai-compat.ts reads
|
|
136
|
-
* the env var directly so the value can be flipped without restart.
|
|
137
|
-
*/
|
|
138
|
-
export const OPENAI_COMPAT_NEW_CONVO_HEURISTIC_DEFAULT = false;
|
|
139
|
-
//# sourceMappingURL=constants.js.map
|
package/vendor/constants.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,8EAA8E;AAE9E,2DAA2D;AAC3D,MAAM,CAAC,MAAM,sBAAsB,GAAG,OAAO,CAAC;AAE9C,+EAA+E;AAE/E,gFAAgF;AAChF,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AACrC,iEAAiE;AACjE,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACxC,4DAA4D;AAC5D,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAEtC,+EAA+E;AAE/E,oDAAoD;AACpD,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,C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AC,CAAC;AAC3C,gDAAgD;AAChD,MAAM,CAAC,MAAM,+BAA+B,GAAG,KAAK,CAAC;AACrD,mCAAmC;AACnC,MAAM,CAAC,MAAM,8BAA8B,GAAG,OAAO,CAAC;AAEtD,+EAA+E;AAE/E,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;IACpB,WAAW,EAAE,aAAa;IAC1B,MAAM,EAAE,QAAQ;IAChB,aAAa,EAAE,eAAe;IAC9B,KAAK,EAAE,OAAO;IACd,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,YAAY,EAAE,cAAc;IAC5B,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,OAAO;CACN,CAAC;AAIX,gFAAgF;AAEhF,iEAAiE;AACjE,MAAM,CAAC,MAAM,2BAA2B,GAAG,mBAAmB,CAAC;AAC/D,uDAAuD;AACvD,MAAM,CAAC,MAAM,oCAAoC,GAAG,EAAE,CAAC;AACvD,qDAAqD;AACrD,MAAM,CAAC,MAAM,4BAA4B,GAAG,SAAS,CAAC;AACtD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,yCAAyC,GAAG,KAAK,CAAC"}
|
package/vendor/council.d.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Council — Multi-agent collaboration engine
|
|
3
|
-
*
|
|
4
|
-
* Ported from three-minds and adapted to use SessionManager + ISession
|
|
5
|
-
* directly (no HTTP/SSE to external services).
|
|
6
|
-
*
|
|
7
|
-
* Key patterns:
|
|
8
|
-
* - Git worktree isolation per agent
|
|
9
|
-
* - Two-phase protocol: planning round → execution rounds
|
|
10
|
-
* - Consensus voting: all agents vote YES to complete
|
|
11
|
-
* - Parallel execution via Promise.allSettled
|
|
12
|
-
* - Engine-agnostic: agents can use Claude, Codex, or any ISession engine
|
|
13
|
-
*/
|
|
14
|
-
import { EventEmitter } from 'node:events';
|
|
15
|
-
import { type CouncilConfig, type CouncilSession, type CouncilReviewResult, type CouncilAcceptResult, type CouncilRejectResult, type SessionConfig, type SessionInfo, type SendOptions, type SendResult } from './types.js';
|
|
16
|
-
import { type Logger } from './logger.js';
|
|
17
|
-
interface SessionManagerLike {
|
|
18
|
-
startSession(config: Partial<SessionConfig> & {
|
|
19
|
-
name?: string;
|
|
20
|
-
}): Promise<SessionInfo>;
|
|
21
|
-
sendMessage(name: string, message: string, options?: Partial<SendOptions>): Promise<SendResult>;
|
|
22
|
-
stopSession(name: string): Promise<void>;
|
|
23
|
-
}
|
|
24
|
-
export declare class Council extends EventEmitter {
|
|
25
|
-
private config;
|
|
26
|
-
private manager;
|
|
27
|
-
private agentTimeoutMs;
|
|
28
|
-
private _aborted;
|
|
29
|
-
private _activeSessions;
|
|
30
|
-
private _session;
|
|
31
|
-
private _pendingInjection;
|
|
32
|
-
private logger;
|
|
33
|
-
constructor(config: CouncilConfig, manager: SessionManagerLike, logger?: Logger);
|
|
34
|
-
getSession(): CouncilSession | undefined;
|
|
35
|
-
injectMessage(message: string): void;
|
|
36
|
-
abort(): void;
|
|
37
|
-
private emitEvent;
|
|
38
|
-
private runSingleAgent;
|
|
39
|
-
init(task: string): CouncilSession;
|
|
40
|
-
run(task?: string): Promise<CouncilSession>;
|
|
41
|
-
private generateSummary;
|
|
42
|
-
private generateCompactContext;
|
|
43
|
-
private saveTranscript;
|
|
44
|
-
/**
|
|
45
|
-
* Produce a structured review of the council's output.
|
|
46
|
-
* Lists all changed files, branches, worktrees, plan.md status, and agent summaries.
|
|
47
|
-
* Does NOT modify any state — purely informational.
|
|
48
|
-
*/
|
|
49
|
-
review(): Promise<CouncilReviewResult>;
|
|
50
|
-
/**
|
|
51
|
-
* Internal cleanup helper — removes worktrees, branches, plan.md, and reviews/.
|
|
52
|
-
* Each cleanup step is independently gated by the `options` flags.
|
|
53
|
-
*/
|
|
54
|
-
private _cleanup;
|
|
55
|
-
/**
|
|
56
|
-
* Accept the council's work: clean up worktrees, branches, plan.md, and reviews/.
|
|
57
|
-
* Should only be called after reviewing via `review()`.
|
|
58
|
-
*/
|
|
59
|
-
accept(): Promise<CouncilAcceptResult>;
|
|
60
|
-
/**
|
|
61
|
-
* Reject the council's work: rewrite plan.md with feedback.
|
|
62
|
-
* Does NOT delete any worktrees or branches — the council can retry.
|
|
63
|
-
*/
|
|
64
|
-
reject(feedback: string): Promise<CouncilRejectResult>;
|
|
65
|
-
}
|
|
66
|
-
export declare function getDefaultCouncilConfig(projectDir: string): CouncilConfig;
|
|
67
|
-
export {};
|