@zelari/core 2.33.0 → 2.34.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/README.md +1 -1
- package/dist/agents/council/chairmanDelivery.d.ts +92 -0
- package/dist/agents/council/chairmanDelivery.d.ts.map +1 -0
- package/dist/agents/council/chairmanDelivery.js +226 -0
- package/dist/agents/council/chairmanDelivery.js.map +1 -0
- package/dist/agents/council/chairmanFixLoop.d.ts +47 -0
- package/dist/agents/council/chairmanFixLoop.d.ts.map +1 -0
- package/dist/agents/council/chairmanFixLoop.js +127 -0
- package/dist/agents/council/chairmanFixLoop.js.map +1 -0
- package/dist/agents/council/memberMessages.d.ts +32 -0
- package/dist/agents/council/memberMessages.d.ts.map +1 -0
- package/dist/agents/council/memberMessages.js +95 -0
- package/dist/agents/council/memberMessages.js.map +1 -0
- package/dist/agents/council/outputCleaning.d.ts +37 -0
- package/dist/agents/council/outputCleaning.d.ts.map +1 -0
- package/dist/agents/council/outputCleaning.js +150 -0
- package/dist/agents/council/outputCleaning.js.map +1 -0
- package/dist/agents/council/retryTurn.d.ts +128 -0
- package/dist/agents/council/retryTurn.d.ts.map +1 -0
- package/dist/agents/council/retryTurn.js +200 -0
- package/dist/agents/council/retryTurn.js.map +1 -0
- package/dist/agents/council/toolEmission.d.ts +61 -0
- package/dist/agents/council/toolEmission.d.ts.map +1 -0
- package/dist/agents/council/toolEmission.js +110 -0
- package/dist/agents/council/toolEmission.js.map +1 -0
- package/dist/agents/council/types.d.ts +184 -0
- package/dist/agents/council/types.d.ts.map +1 -0
- package/dist/agents/council/types.js +15 -0
- package/dist/agents/council/types.js.map +1 -0
- package/dist/agents/councilApi.d.ts +11 -526
- package/dist/agents/councilApi.d.ts.map +1 -1
- package/dist/agents/councilApi.js +19 -893
- package/dist/agents/councilApi.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* toolEmission — post-condition tool-emission checks (v0.7.6), extracted
|
|
3
|
+
* verbatim from agents/councilApi.ts. Pure functions, zero module deps.
|
|
4
|
+
*/
|
|
5
|
+
export interface ToolEmissionRequirement {
|
|
6
|
+
/** Tool name, e.g. 'createDocument'. */
|
|
7
|
+
name: string;
|
|
8
|
+
/** Minimum number of times this tool must have been emitted. */
|
|
9
|
+
min: number;
|
|
10
|
+
}
|
|
11
|
+
export interface ToolEmissionCheckResult {
|
|
12
|
+
/** True when every requirement is satisfied. */
|
|
13
|
+
ok: boolean;
|
|
14
|
+
/** Human-readable list of unmet requirements (empty when ok=true). */
|
|
15
|
+
missing: string[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Pure helper: given the list of tool names a member emitted during its
|
|
19
|
+
* turn, and a list of requirements, return whether all requirements are
|
|
20
|
+
* met.
|
|
21
|
+
*/
|
|
22
|
+
export declare function checkMemberToolEmissions(_memberId: string, emittedToolNames: string[], requirements: ToolEmissionRequirement[]): ToolEmissionCheckResult;
|
|
23
|
+
/**
|
|
24
|
+
* v0.7.8 — Per-member tool-emission requirement SETS for the design-phase
|
|
25
|
+
* council run. The outer array is an OR of alternatives: the member's turn
|
|
26
|
+
* is complete when ANY one set is fully satisfied. The FIRST set is the
|
|
27
|
+
* preferred contract — its unmet requirements drive the warning message
|
|
28
|
+
* and the forced-retry tool list.
|
|
29
|
+
*
|
|
30
|
+
* Nettuno has two ways to satisfy its contract:
|
|
31
|
+
* 1. (preferred) ONE `createPlan` batch call — phases + nested tasks +
|
|
32
|
+
* milestone in a single emission. Retry budget: 1 call, which
|
|
33
|
+
* composer-2.5 handles reliably (same shape as the Minosse/Lucifero
|
|
34
|
+
* retries that already work).
|
|
35
|
+
* 2. (legacy) the itemized trio — kept so stronger models (e.g. Opus)
|
|
36
|
+
* that emit createPhase/createTask/createMilestone directly are not
|
|
37
|
+
* flagged or retried.
|
|
38
|
+
*/
|
|
39
|
+
export declare const DESIGN_PHASE_REQUIREMENT_SETS: Record<string, ToolEmissionRequirement[][]>;
|
|
40
|
+
/**
|
|
41
|
+
* Preferred (first) requirement set per member — kept as the flat map the
|
|
42
|
+
* council loops pass to `applyRetryIfMissing` for the retry budget. For
|
|
43
|
+
* Nettuno this is `createPlan min 1`, so the forced retry advertises ONE
|
|
44
|
+
* tool with a 1-call budget instead of the old 13+-call itemized contract.
|
|
45
|
+
*/
|
|
46
|
+
export declare const DESIGN_PHASE_REQUIREMENTS: Record<string, ToolEmissionRequirement[]>;
|
|
47
|
+
/**
|
|
48
|
+
* Pure helper: OR-of-sets variant of {@link checkMemberToolEmissions}.
|
|
49
|
+
* Returns ok when ANY set is fully satisfied. When none is, the missing
|
|
50
|
+
* list reflects the FIRST (preferred) set so the warning and the retry
|
|
51
|
+
* point the model at the cheapest way to comply.
|
|
52
|
+
*/
|
|
53
|
+
export declare function checkMemberToolEmissionSets(memberId: string, emittedToolNames: string[], sets: ToolEmissionRequirement[][]): ToolEmissionCheckResult;
|
|
54
|
+
/**
|
|
55
|
+
* Run the post-condition check for a member and emit a console.warn when
|
|
56
|
+
* any required tool was not emitted the minimum number of times. Returns
|
|
57
|
+
* the check result so callers can act on it (Pass 3 may add automatic
|
|
58
|
+
* retry; for now we only warn).
|
|
59
|
+
*/
|
|
60
|
+
export declare function enforceDesignPhaseToolEmissions(memberId: string, emittedToolNames: string[]): ToolEmissionCheckResult;
|
|
61
|
+
//# sourceMappingURL=toolEmission.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolEmission.d.ts","sourceRoot":"","sources":["../../../src/agents/council/toolEmission.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiBH,MAAM,WAAW,uBAAuB;IACtC,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,uBAAuB;IACtC,gDAAgD;IAChD,EAAE,EAAE,OAAO,CAAC;IACZ,sEAAsE;IACtE,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,MAAM,EAAE,EAC1B,YAAY,EAAE,uBAAuB,EAAE,GACtC,uBAAuB,CAiBzB;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,6BAA6B,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,EAAE,EAAE,CAqBrF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,EAAE,CAG7E,CAAC;AAEJ;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,EAAE,EAC1B,IAAI,EAAE,uBAAuB,EAAE,EAAE,GAChC,uBAAuB,CASzB;AAED;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,EAAE,GACzB,uBAAuB,CAgBzB"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* toolEmission — post-condition tool-emission checks (v0.7.6), extracted
|
|
3
|
+
* verbatim from agents/councilApi.ts. Pure functions, zero module deps.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Pure helper: given the list of tool names a member emitted during its
|
|
7
|
+
* turn, and a list of requirements, return whether all requirements are
|
|
8
|
+
* met.
|
|
9
|
+
*/
|
|
10
|
+
export function checkMemberToolEmissions(_memberId, emittedToolNames, requirements) {
|
|
11
|
+
if (requirements.length === 0) {
|
|
12
|
+
return { ok: true, missing: [] };
|
|
13
|
+
}
|
|
14
|
+
// Tally emitted counts once for all requirements.
|
|
15
|
+
const counts = new Map();
|
|
16
|
+
for (const name of emittedToolNames) {
|
|
17
|
+
counts.set(name, (counts.get(name) ?? 0) + 1);
|
|
18
|
+
}
|
|
19
|
+
const missing = [];
|
|
20
|
+
for (const req of requirements) {
|
|
21
|
+
const got = counts.get(req.name) ?? 0;
|
|
22
|
+
if (got < req.min) {
|
|
23
|
+
missing.push(`${req.name} (got ${got}, need >= ${req.min})`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return { ok: missing.length === 0, missing };
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* v0.7.8 — Per-member tool-emission requirement SETS for the design-phase
|
|
30
|
+
* council run. The outer array is an OR of alternatives: the member's turn
|
|
31
|
+
* is complete when ANY one set is fully satisfied. The FIRST set is the
|
|
32
|
+
* preferred contract — its unmet requirements drive the warning message
|
|
33
|
+
* and the forced-retry tool list.
|
|
34
|
+
*
|
|
35
|
+
* Nettuno has two ways to satisfy its contract:
|
|
36
|
+
* 1. (preferred) ONE `createPlan` batch call — phases + nested tasks +
|
|
37
|
+
* milestone in a single emission. Retry budget: 1 call, which
|
|
38
|
+
* composer-2.5 handles reliably (same shape as the Minosse/Lucifero
|
|
39
|
+
* retries that already work).
|
|
40
|
+
* 2. (legacy) the itemized trio — kept so stronger models (e.g. Opus)
|
|
41
|
+
* that emit createPhase/createTask/createMilestone directly are not
|
|
42
|
+
* flagged or retried.
|
|
43
|
+
*/
|
|
44
|
+
export const DESIGN_PHASE_REQUIREMENT_SETS = {
|
|
45
|
+
nettun: [
|
|
46
|
+
[{ name: 'createPlan', min: 1 }],
|
|
47
|
+
[
|
|
48
|
+
{ name: 'createPhase', min: 3 },
|
|
49
|
+
{ name: 'createTask', min: 6 },
|
|
50
|
+
{ name: 'createMilestone', min: 1 },
|
|
51
|
+
],
|
|
52
|
+
],
|
|
53
|
+
geryon: [
|
|
54
|
+
[{ name: 'createDocument', min: 3 }],
|
|
55
|
+
],
|
|
56
|
+
pluton: [
|
|
57
|
+
[{ name: 'createDocument', min: 1 }],
|
|
58
|
+
],
|
|
59
|
+
minos: [
|
|
60
|
+
[{ name: 'createDocument', min: 1 }],
|
|
61
|
+
],
|
|
62
|
+
lucifer: [
|
|
63
|
+
[{ name: 'createDocument', min: 1 }],
|
|
64
|
+
],
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Preferred (first) requirement set per member — kept as the flat map the
|
|
68
|
+
* council loops pass to `applyRetryIfMissing` for the retry budget. For
|
|
69
|
+
* Nettuno this is `createPlan min 1`, so the forced retry advertises ONE
|
|
70
|
+
* tool with a 1-call budget instead of the old 13+-call itemized contract.
|
|
71
|
+
*/
|
|
72
|
+
export const DESIGN_PHASE_REQUIREMENTS = Object.fromEntries(Object.entries(DESIGN_PHASE_REQUIREMENT_SETS).map(([id, sets]) => [id, sets[0]]));
|
|
73
|
+
/**
|
|
74
|
+
* Pure helper: OR-of-sets variant of {@link checkMemberToolEmissions}.
|
|
75
|
+
* Returns ok when ANY set is fully satisfied. When none is, the missing
|
|
76
|
+
* list reflects the FIRST (preferred) set so the warning and the retry
|
|
77
|
+
* point the model at the cheapest way to comply.
|
|
78
|
+
*/
|
|
79
|
+
export function checkMemberToolEmissionSets(memberId, emittedToolNames, sets) {
|
|
80
|
+
if (sets.length === 0) {
|
|
81
|
+
return { ok: true, missing: [] };
|
|
82
|
+
}
|
|
83
|
+
const results = sets.map((set) => checkMemberToolEmissions(memberId, emittedToolNames, set));
|
|
84
|
+
if (results.some((r) => r.ok)) {
|
|
85
|
+
return { ok: true, missing: [] };
|
|
86
|
+
}
|
|
87
|
+
return results[0];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Run the post-condition check for a member and emit a console.warn when
|
|
91
|
+
* any required tool was not emitted the minimum number of times. Returns
|
|
92
|
+
* the check result so callers can act on it (Pass 3 may add automatic
|
|
93
|
+
* retry; for now we only warn).
|
|
94
|
+
*/
|
|
95
|
+
export function enforceDesignPhaseToolEmissions(memberId, emittedToolNames) {
|
|
96
|
+
const sets = DESIGN_PHASE_REQUIREMENT_SETS[memberId];
|
|
97
|
+
if (!sets || sets.length === 0) {
|
|
98
|
+
return { ok: true, missing: [] };
|
|
99
|
+
}
|
|
100
|
+
const result = checkMemberToolEmissionSets(memberId, emittedToolNames, sets);
|
|
101
|
+
if (!result.ok) {
|
|
102
|
+
// eslint-disable-next-line no-console
|
|
103
|
+
console.warn(`[council] member "${memberId}" did not emit required tools: ${result.missing.join(', ')}. ` +
|
|
104
|
+
`The downstream .zelari/ deliverable may be incomplete. ` +
|
|
105
|
+
`(A forced retry turn scoped to the missing tools follows; the deterministic ` +
|
|
106
|
+
`complete-design fallback covers any remaining gap.)`);
|
|
107
|
+
}
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=toolEmission.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolEmission.js","sourceRoot":"","sources":["../../../src/agents/council/toolEmission.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA+BH;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CACtC,SAAiB,EACjB,gBAA0B,EAC1B,YAAuC;IAEvC,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACnC,CAAC;IACD,kDAAkD;IAClD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzC,KAAK,MAAM,IAAI,IAAI,gBAAgB,EAAE,CAAC;QACpC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAChD,CAAC;IACD,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;QAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,GAAG,GAAG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xD,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* types — council run configuration and callback contracts, extracted
|
|
3
|
+
* verbatim from agents/councilApi.ts.
|
|
4
|
+
*/
|
|
5
|
+
import type { AgentRole } from '../../types/index.js';
|
|
6
|
+
import type { ParsedToolCall } from '../toolSchemas.js';
|
|
7
|
+
import type { ProviderStreamFn } from '../../core/AgentHarness.js';
|
|
8
|
+
import type { SystemPromptConfig } from '../../types/systemTypes.js';
|
|
9
|
+
import type { ToolRegistry } from '../../core/tools/registry.js';
|
|
10
|
+
import type { CouncilRunMode } from '../../council/runMode.js';
|
|
11
|
+
import type { ClarificationRequest } from './outputCleaning.js';
|
|
12
|
+
/**
|
|
13
|
+
* Council members whose tool-emission retry is DISABLED.
|
|
14
|
+
*
|
|
15
|
+
* v0.7.7 Opzione B put 'nettun' here because its contract (12 createTask
|
|
16
|
+
* + 1 createMilestone = 13+ sequential calls) exceeded what composer-2.5
|
|
17
|
+
* could persist in the 240s budget, making the retry a pure waste.
|
|
18
|
+
*
|
|
19
|
+
* v0.7.8 removes 'nettun': the plan contract is now satisfiable with a
|
|
20
|
+
* SINGLE `createPlan` batch call (phases + nested tasks + milestone in
|
|
21
|
+
* one emission), so the forced retry has the same 1-call budget that
|
|
22
|
+
* already works reliably for Minosse and Lucifero. The set stays
|
|
23
|
+
* exported as the opt-out mechanism for future members.
|
|
24
|
+
*/
|
|
25
|
+
export declare const NON_RETRY_AGENTS: ReadonlySet<string>;
|
|
26
|
+
/**
|
|
27
|
+
* Minimal structural interface for a feedback store — matches the
|
|
28
|
+
* `FeedbackStore` class in `electron/cli/councilFeedback.ts` without
|
|
29
|
+
* importing it (keeps the core free of CLI-side deps).
|
|
30
|
+
*
|
|
31
|
+
* Used by `runCouncilPure` to opt-in to feedback-driven specialist ordering
|
|
32
|
+
* via the `.ranked()` method (Task: council integration, v3-I deferred).
|
|
33
|
+
*/
|
|
34
|
+
export interface FeedbackStoreLike {
|
|
35
|
+
/**
|
|
36
|
+
* Return a NEW array sorted by feedback score, descending.
|
|
37
|
+
* Members with no feedback are placed last, ordered by id ascending.
|
|
38
|
+
*/
|
|
39
|
+
ranked<T extends {
|
|
40
|
+
id: string;
|
|
41
|
+
}>(items: T[]): T[];
|
|
42
|
+
}
|
|
43
|
+
export interface PureCouncilConfig {
|
|
44
|
+
apiKey: string;
|
|
45
|
+
glmApiKey?: string;
|
|
46
|
+
provider?: string;
|
|
47
|
+
model: string;
|
|
48
|
+
councilSize: number;
|
|
49
|
+
debateMode: boolean;
|
|
50
|
+
ragContext: string;
|
|
51
|
+
workspaceContext: string;
|
|
52
|
+
completedAgentIds?: string[];
|
|
53
|
+
existingOutputs?: {
|
|
54
|
+
name: string;
|
|
55
|
+
role: string;
|
|
56
|
+
content: string;
|
|
57
|
+
}[];
|
|
58
|
+
aiConfig?: SystemPromptConfig;
|
|
59
|
+
agentModels?: Record<string, {
|
|
60
|
+
providerId: string;
|
|
61
|
+
model: string;
|
|
62
|
+
}>;
|
|
63
|
+
customProviders?: Array<{
|
|
64
|
+
id: string;
|
|
65
|
+
baseUrl: string;
|
|
66
|
+
authStyle: 'openai' | 'anthropic';
|
|
67
|
+
models: string[];
|
|
68
|
+
}>;
|
|
69
|
+
providerApiKeys?: Record<string, string>;
|
|
70
|
+
/**
|
|
71
|
+
* Optional per-call member remap (Task I.3 close-out).
|
|
72
|
+
*
|
|
73
|
+
* When set (non-empty), `swapMembers(agents, memberSwap)` is applied
|
|
74
|
+
* immediately after `getCouncilAgents()` and BEFORE filtering into
|
|
75
|
+
* specialists / oracle / chairman. Useful for replacing `oracle` with a
|
|
76
|
+
* custom critic on the fly. Throws `UnknownMemberError` on typo in either
|
|
77
|
+
* side of the mapping.
|
|
78
|
+
*
|
|
79
|
+
* Backward-compat: when omitted, behavior is identical to pre-integration.
|
|
80
|
+
*
|
|
81
|
+
* @see swapMembers in src/agents/roles.ts
|
|
82
|
+
*/
|
|
83
|
+
memberSwap?: Record<string, string>;
|
|
84
|
+
/**
|
|
85
|
+
* Optional feedback store for specialist ordering (Task I.2 close-out).
|
|
86
|
+
*
|
|
87
|
+
* When set, `feedbackStore.ranked(specialists)` is applied AFTER the swap
|
|
88
|
+
* filter and BEFORE the specialists loop. Only specialists are ranked —
|
|
89
|
+
* oracle (debate-mode review) and chairman (synthesis) keep their fixed
|
|
90
|
+
* positions. This preserves the existing semantics of the council while
|
|
91
|
+
* letting good-rated specialists go first.
|
|
92
|
+
*
|
|
93
|
+
* Backward-compat: when omitted, specialists run in their default order.
|
|
94
|
+
*/
|
|
95
|
+
feedbackStore?: FeedbackStoreLike;
|
|
96
|
+
/** Provider stream function (injected for testability). MUST yield ProviderDelta. */
|
|
97
|
+
providerStream: ProviderStreamFn;
|
|
98
|
+
/** Optional event bus for emitting BrainEvents alongside the returned iterable. */
|
|
99
|
+
eventBus?: import('../../shared/eventBus.js').EventBus;
|
|
100
|
+
/** Optional session id. Defaults to a UUID. */
|
|
101
|
+
sessionId?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Optional tool registry. When provided, each council member (specialist
|
|
104
|
+
* and oracle) is given access to the registry via AgentHarness — tool_call
|
|
105
|
+
* deltas trigger real tool execution and emit tool_execution_end events.
|
|
106
|
+
* Without it, the council is text-only (legacy behavior).
|
|
107
|
+
*
|
|
108
|
+
* @see electron/main/core/AgentHarness.ts — `toolRegistry` field
|
|
109
|
+
* @see electron/cli/toolRegistry.ts — `createBuiltinToolRegistry()`
|
|
110
|
+
*/
|
|
111
|
+
tools?: ToolRegistry;
|
|
112
|
+
/**
|
|
113
|
+
* Max tool calls per member per turn. Enforced by truncating extra
|
|
114
|
+
* tool_execution_start events to `tool_call_skipped` after this limit.
|
|
115
|
+
* Default: 5. Set to 0 to disable tools entirely (overrides `tools`).
|
|
116
|
+
*/
|
|
117
|
+
maxToolCallsPerTurn?: number;
|
|
118
|
+
/**
|
|
119
|
+
* Override the tool-call budget for the chairman (Lucifero) only. Zelari-mode
|
|
120
|
+
* raises this for long autonomous implementation runs while leaving the
|
|
121
|
+
* specialists and oracle on the shared `maxToolCallsPerTurn`. Falls back to
|
|
122
|
+
* `maxToolCallsPerTurn`, then 5.
|
|
123
|
+
*/
|
|
124
|
+
maxToolCallsChairman?: number;
|
|
125
|
+
/**
|
|
126
|
+
* Soft max observe→reason→act cycles per member harness run.
|
|
127
|
+
* Forwarded to AgentHarness; default is the harness default (30) when unset.
|
|
128
|
+
* CLI wires this from `ZELARI_MAX_TOOL_LOOP_ITERATIONS`.
|
|
129
|
+
*/
|
|
130
|
+
maxToolLoopIterations?: number;
|
|
131
|
+
/**
|
|
132
|
+
* Hard ceiling on tool-loop iterations per member. `0`/unset → harness
|
|
133
|
+
* computes max(soft×3, soft+60). CLI: `ZELARI_MAX_TOOL_LOOP_HARD`.
|
|
134
|
+
*/
|
|
135
|
+
maxToolLoopHardCap?: number;
|
|
136
|
+
/**
|
|
137
|
+
* When true, skip all specialists (Caronte…Plutone). Only Minosse (oracle)
|
|
138
|
+
* and Lucifero (chairman) run. Used by Zelari mission implementer-retry
|
|
139
|
+
* slices (implementation 2+) so fix/verify loops do not re-pay a full
|
|
140
|
+
* 6-member council. Default false — full roster.
|
|
141
|
+
*/
|
|
142
|
+
skipSpecialists?: boolean;
|
|
143
|
+
/** Council run mode. Default: `implementation`. */
|
|
144
|
+
runMode?: CouncilRunMode;
|
|
145
|
+
}
|
|
146
|
+
export interface PureCouncilCallbacks {
|
|
147
|
+
/** Status lines surfaced in the TUI (delivery retries, verify passes). */
|
|
148
|
+
onCouncilStatus?: (message: string) => void;
|
|
149
|
+
onAgentStart?: (agent: AgentRole) => void;
|
|
150
|
+
onAgentChunk?: (agent: AgentRole, chunk: string) => void;
|
|
151
|
+
onAgentDone?: (agent: AgentRole, content: string, thinking?: string) => void;
|
|
152
|
+
onSynthesisStart?: () => void;
|
|
153
|
+
onSynthesisChunk?: (chunk: string) => void;
|
|
154
|
+
onSynthesisDone?: (content: string, toolCalls?: ParsedToolCall[], thinking?: string) => void;
|
|
155
|
+
/**
|
|
156
|
+
* Fired after every council member (specialist, oracle, chairman) completes
|
|
157
|
+
* its run, with the accumulated cost for that member (Task I.1, v3-I).
|
|
158
|
+
* The same payload is also yielded as a `member_cost` BrainEvent in the
|
|
159
|
+
* main event stream so JSONL sidecars and live consumers stay consistent.
|
|
160
|
+
*
|
|
161
|
+
* When the provider does not send `usage` (some don't honor
|
|
162
|
+
* `stream_options.include_usage`), the token fields are 0. Tool calls
|
|
163
|
+
* are counted from `tool_execution_start` events. Duration is wall-clock
|
|
164
|
+
* around the member's AgentHarness run.
|
|
165
|
+
*/
|
|
166
|
+
onMemberCost?: (cost: {
|
|
167
|
+
memberId: string;
|
|
168
|
+
name: string;
|
|
169
|
+
promptTokens: number;
|
|
170
|
+
completionTokens: number;
|
|
171
|
+
totalTokens: number;
|
|
172
|
+
durationMs: number;
|
|
173
|
+
toolCalls: number;
|
|
174
|
+
errored: boolean;
|
|
175
|
+
}) => void;
|
|
176
|
+
/**
|
|
177
|
+
* v1.8.0: when a member emits a structured ---QUESTION--- with choices,
|
|
178
|
+
* the CLI may pause and ask the user (SelectList). Return the chosen
|
|
179
|
+
* answer (or null if cancelled / free-text will follow later). Injected
|
|
180
|
+
* into agentOutputs so subsequent members see the reply.
|
|
181
|
+
*/
|
|
182
|
+
onClarification?: (req: ClarificationRequest) => Promise<string | null | undefined>;
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/agents/council/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B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AM,KAAK,IAAI,CAAC;IAC7E,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,cAAc,EAAE,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7F;;;;;;;;;;OAUG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,YAAY,EAAE,MAAM,CAAC;QACrB,gBAAgB,EAAE,MAAM,CAAC;QACzB,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,OAAO,CAAC;KAClB,KAAK,IAAI,CAAC;IACX;;;;;OAKG;IACH,eAAe,CAAC,EAAE,CAChB,GAAG,EAAE,oBAAoB,KACtB,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;CACzC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Council members whose tool-emission retry is DISABLED.
|
|
3
|
+
*
|
|
4
|
+
* v0.7.7 Opzione B put 'nettun' here because its contract (12 createTask
|
|
5
|
+
* + 1 createMilestone = 13+ sequential calls) exceeded what composer-2.5
|
|
6
|
+
* could persist in the 240s budget, making the retry a pure waste.
|
|
7
|
+
*
|
|
8
|
+
* v0.7.8 removes 'nettun': the plan contract is now satisfiable with a
|
|
9
|
+
* SINGLE `createPlan` batch call (phases + nested tasks + milestone in
|
|
10
|
+
* one emission), so the forced retry has the same 1-call budget that
|
|
11
|
+
* already works reliably for Minosse and Lucifero. The set stays
|
|
12
|
+
* exported as the opt-out mechanism for future members.
|
|
13
|
+
*/
|
|
14
|
+
export const NON_RETRY_AGENTS = new Set([]);
|
|
15
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/agents/council/types.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAwB,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC"}
|