@pellux/goodvibes-sdk 0.21.36 → 0.23.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/_internal/contracts/artifacts/operator-contract.json +3308 -3741
- package/dist/_internal/contracts/generated/foundation-metadata.d.ts +3 -3
- package/dist/_internal/contracts/generated/foundation-metadata.js +3 -3
- package/dist/_internal/contracts/generated/operator-contract.d.ts.map +1 -1
- package/dist/_internal/contracts/generated/operator-contract.js +3308 -3741
- package/dist/_internal/contracts/generated/operator-method-ids.d.ts +1 -1
- package/dist/_internal/contracts/generated/operator-method-ids.d.ts.map +1 -1
- package/dist/_internal/contracts/generated/operator-method-ids.js +8 -0
- package/dist/_internal/contracts/generated/peer-contract.d.ts.map +1 -1
- package/dist/_internal/platform/agents/completion-report.d.ts +21 -6
- package/dist/_internal/platform/agents/completion-report.d.ts.map +1 -1
- package/dist/_internal/platform/agents/completion-report.js +40 -8
- package/dist/_internal/platform/agents/orchestrator-prompts.d.ts.map +1 -1
- package/dist/_internal/platform/agents/orchestrator-prompts.js +4 -0
- package/dist/_internal/platform/agents/wrfc-controller.d.ts +2 -0
- package/dist/_internal/platform/agents/wrfc-controller.d.ts.map +1 -1
- package/dist/_internal/platform/agents/wrfc-controller.js +105 -6
- package/dist/_internal/platform/agents/wrfc-prompt-addenda.d.ts +22 -0
- package/dist/_internal/platform/agents/wrfc-prompt-addenda.d.ts.map +1 -0
- package/dist/_internal/platform/agents/wrfc-prompt-addenda.js +103 -0
- package/dist/_internal/platform/agents/wrfc-reporting.d.ts +3 -3
- package/dist/_internal/platform/agents/wrfc-reporting.d.ts.map +1 -1
- package/dist/_internal/platform/agents/wrfc-reporting.js +49 -4
- package/dist/_internal/platform/agents/wrfc-runtime-events.d.ts +6 -0
- package/dist/_internal/platform/agents/wrfc-runtime-events.d.ts.map +1 -1
- package/dist/_internal/platform/agents/wrfc-runtime-events.js +8 -1
- package/dist/_internal/platform/agents/wrfc-types.d.ts +18 -1
- package/dist/_internal/platform/agents/wrfc-types.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/emitters/workflows.d.ts +13 -0
- package/dist/_internal/platform/runtime/emitters/workflows.d.ts.map +1 -1
- package/dist/_internal/platform/runtime/emitters/workflows.js +7 -0
- package/dist/_internal/platform/runtime/events/workflows.d.ts +13 -0
- package/dist/_internal/platform/runtime/events/workflows.d.ts.map +1 -1
- package/dist/_internal/platform/tools/agent/manager.d.ts +2 -0
- package/dist/_internal/platform/tools/agent/manager.d.ts.map +1 -1
- package/dist/_internal/platform/version.js +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const OPERATOR_METHOD_IDS: readonly ["accounts.snapshot", "approvals.approve", "approvals.cancel", "approvals.claim", "approvals.deny", "approvals.list", "artifacts.content.get", "artifacts.create", "artifacts.get", "artifacts.list", "automation.heartbeat.list", "automation.heartbeat.run", "automation.integration.snapshot", "automation.jobs.create", "automation.jobs.delete", "automation.jobs.disable", "automation.jobs.enable", "automation.jobs.list", "automation.jobs.patch", "automation.jobs.pause", "automation.jobs.resume", "automation.jobs.run", "automation.runs.cancel", "automation.runs.get", "automation.runs.list", "automation.runs.retry", "channels.accounts.action.default", "channels.accounts.action.named", "channels.accounts.get", "channels.accounts.list", "channels.accounts.surface.list", "channels.actions.invoke", "channels.actions.list", "channels.actions.surface.list", "channels.agent_tools.list", "channels.agent_tools.surface.list", "channels.allowlist.edit", "channels.allowlist.resolve", "channels.authorize", "channels.capabilities.list", "channels.capabilities.surface.list", "channels.directory.query", "channels.doctor.get", "channels.lifecycle.get", "channels.lifecycle.migrate", "channels.policies.audit", "channels.policies.list", "channels.policies.update", "channels.repairs.list", "channels.setup.get", "channels.status", "channels.targets.resolve", "channels.tools.invoke", "channels.tools.list", "channels.tools.surface.list", "config.get", "config.set", "continuity.snapshot", "control.auth.current", "control.auth.login", "control.clients.list", "control.contract", "control.events.catalog", "control.events.stream", "control.messages.list", "control.methods.get", "control.methods.list", "control.snapshot", "control.status", "control.web", "deliveries.get", "deliveries.list", "health.snapshot", "intelligence.snapshot", "knowledge.candidate.decide", "knowledge.candidate.get", "knowledge.candidates.list", "knowledge.connector.doctor", "knowledge.connector.get", "knowledge.connectors.list", "knowledge.extraction.get", "knowledge.extractions.list", "knowledge.graphql.execute", "knowledge.graphql.schema", "knowledge.ingest.artifact", "knowledge.ingest.bookmarks", "knowledge.ingest.connector", "knowledge.ingest.url", "knowledge.ingest.urls", "knowledge.issues.list", "knowledge.item.get", "knowledge.job-runs.list", "knowledge.job.get", "knowledge.job.run", "knowledge.jobs.list", "knowledge.lint", "knowledge.nodes.list", "knowledge.packet", "knowledge.projection.materialize", "knowledge.projection.render", "knowledge.projections.list", "knowledge.reindex", "knowledge.report.get", "knowledge.reports.list", "knowledge.schedule.delete", "knowledge.schedule.enable", "knowledge.schedule.get", "knowledge.schedule.save", "knowledge.schedules.list", "knowledge.search", "knowledge.source.extraction.get", "knowledge.sources.list", "knowledge.status", "knowledge.usage.list", "local_auth.bootstrap.delete", "local_auth.sessions.delete", "local_auth.status", "local_auth.users.create", "local_auth.users.delete", "local_auth.users.password.rotate", "media.analyze", "media.generate", "media.providers.list", "media.transform", "memory.doctor", "memory.embeddings.default.set", "memory.vector.rebuild", "memory.vector.stats", "multimodal.analyze", "multimodal.packet", "multimodal.providers.list", "multimodal.status", "multimodal.writeback", "panels.list", "panels.open", "providers.get", "providers.list", "providers.usage.get", "remote.node_host.contract", "remote.pair.requests.approve", "remote.pair.requests.list", "remote.pair.requests.reject", "remote.peers.disconnect", "remote.peers.invoke", "remote.peers.list", "remote.peers.token.revoke", "remote.peers.token.rotate", "remote.snapshot", "remote.work.cancel", "remote.work.list", "review.snapshot", "routes.bindings.create", "routes.bindings.delete", "routes.bindings.list", "routes.bindings.patch", "routes.snapshot", "schedules.create", "schedules.delete", "schedules.disable", "schedules.enable", "schedules.list", "schedules.run", "services.install", "services.restart", "services.start", "services.status", "services.stop", "services.uninstall", "sessions.close", "sessions.create", "sessions.followUp", "sessions.get", "sessions.inputs.cancel", "sessions.inputs.list", "sessions.integration.snapshot", "sessions.list", "sessions.messages.create", "sessions.messages.list", "sessions.reopen", "sessions.steer", "settings.snapshot", "surfaces.list", "tasks.cancel", "tasks.create", "tasks.get", "tasks.list", "tasks.retry", "tasks.status", "telemetry.errors.list", "telemetry.events.list", "telemetry.metrics.get", "telemetry.otlp.logs", "telemetry.otlp.metrics", "telemetry.otlp.traces", "telemetry.snapshot", "telemetry.stream", "telemetry.traces.list", "voice.providers.list", "voice.realtime.session", "voice.status", "voice.stt", "voice.tts", "voice.voices.list", "watchers.create", "watchers.delete", "watchers.list", "watchers.patch", "watchers.run", "watchers.start", "watchers.stop", "web_search.providers.list", "web_search.query", "worktrees.snapshot"];
|
|
1
|
+
export declare const OPERATOR_METHOD_IDS: readonly ["accounts.snapshot", "approvals.approve", "approvals.cancel", "approvals.claim", "approvals.deny", "approvals.list", "artifacts.content.get", "artifacts.create", "artifacts.get", "artifacts.list", "automation.heartbeat.list", "automation.heartbeat.run", "automation.integration.snapshot", "automation.jobs.create", "automation.jobs.delete", "automation.jobs.disable", "automation.jobs.enable", "automation.jobs.list", "automation.jobs.patch", "automation.jobs.pause", "automation.jobs.resume", "automation.jobs.run", "automation.runs.cancel", "automation.runs.get", "automation.runs.list", "automation.runs.retry", "channels.accounts.action.default", "channels.accounts.action.named", "channels.accounts.get", "channels.accounts.list", "channels.accounts.surface.list", "channels.actions.invoke", "channels.actions.list", "channels.actions.surface.list", "channels.agent_tools.list", "channels.agent_tools.surface.list", "channels.allowlist.edit", "channels.allowlist.resolve", "channels.authorize", "channels.capabilities.list", "channels.capabilities.surface.list", "channels.directory.query", "channels.doctor.get", "channels.lifecycle.get", "channels.lifecycle.migrate", "channels.policies.audit", "channels.policies.list", "channels.policies.update", "channels.repairs.list", "channels.setup.get", "channels.status", "channels.targets.resolve", "channels.tools.invoke", "channels.tools.list", "channels.tools.surface.list", "companion.chat.events.stream", "companion.chat.messages.create", "companion.chat.messages.list", "companion.chat.sessions.create", "companion.chat.sessions.delete", "companion.chat.sessions.get", "config.get", "config.set", "continuity.snapshot", "control.auth.current", "control.auth.login", "control.clients.list", "control.contract", "control.events.catalog", "control.events.stream", "control.messages.list", "control.methods.get", "control.methods.list", "control.snapshot", "control.status", "control.web", "deliveries.get", "deliveries.list", "health.snapshot", "intelligence.snapshot", "knowledge.candidate.decide", "knowledge.candidate.get", "knowledge.candidates.list", "knowledge.connector.doctor", "knowledge.connector.get", "knowledge.connectors.list", "knowledge.extraction.get", "knowledge.extractions.list", "knowledge.graphql.execute", "knowledge.graphql.schema", "knowledge.ingest.artifact", "knowledge.ingest.bookmarks", "knowledge.ingest.connector", "knowledge.ingest.url", "knowledge.ingest.urls", "knowledge.issues.list", "knowledge.item.get", "knowledge.job-runs.list", "knowledge.job.get", "knowledge.job.run", "knowledge.jobs.list", "knowledge.lint", "knowledge.nodes.list", "knowledge.packet", "knowledge.projection.materialize", "knowledge.projection.render", "knowledge.projections.list", "knowledge.reindex", "knowledge.report.get", "knowledge.reports.list", "knowledge.schedule.delete", "knowledge.schedule.enable", "knowledge.schedule.get", "knowledge.schedule.save", "knowledge.schedules.list", "knowledge.search", "knowledge.source.extraction.get", "knowledge.sources.list", "knowledge.status", "knowledge.usage.list", "local_auth.bootstrap.delete", "local_auth.sessions.delete", "local_auth.status", "local_auth.users.create", "local_auth.users.delete", "local_auth.users.password.rotate", "media.analyze", "media.generate", "media.providers.list", "media.transform", "memory.doctor", "memory.embeddings.default.set", "memory.vector.rebuild", "memory.vector.stats", "multimodal.analyze", "multimodal.packet", "multimodal.providers.list", "multimodal.status", "multimodal.writeback", "panels.list", "panels.open", "providers.get", "providers.list", "providers.usage.get", "remote.node_host.contract", "remote.pair.requests.approve", "remote.pair.requests.list", "remote.pair.requests.reject", "remote.peers.disconnect", "remote.peers.invoke", "remote.peers.list", "remote.peers.token.revoke", "remote.peers.token.rotate", "remote.snapshot", "remote.work.cancel", "remote.work.list", "review.snapshot", "routes.bindings.create", "routes.bindings.delete", "routes.bindings.list", "routes.bindings.patch", "routes.snapshot", "scheduler.capacity", "schedules.create", "schedules.delete", "schedules.disable", "schedules.enable", "schedules.list", "schedules.run", "services.install", "services.restart", "services.start", "services.status", "services.stop", "services.uninstall", "sessions.close", "sessions.create", "sessions.followUp", "sessions.get", "sessions.inputs.cancel", "sessions.inputs.create", "sessions.inputs.list", "sessions.integration.snapshot", "sessions.list", "sessions.messages.create", "sessions.messages.list", "sessions.reopen", "sessions.steer", "settings.snapshot", "surfaces.list", "tasks.cancel", "tasks.create", "tasks.get", "tasks.list", "tasks.retry", "tasks.status", "telemetry.errors.list", "telemetry.events.list", "telemetry.metrics.get", "telemetry.otlp.logs", "telemetry.otlp.metrics", "telemetry.otlp.traces", "telemetry.snapshot", "telemetry.stream", "telemetry.traces.list", "voice.providers.list", "voice.realtime.session", "voice.status", "voice.stt", "voice.tts", "voice.voices.list", "watchers.create", "watchers.delete", "watchers.list", "watchers.patch", "watchers.run", "watchers.start", "watchers.stop", "web_search.providers.list", "web_search.query", "worktrees.snapshot"];
|
|
2
2
|
export type OperatorMethodId = typeof OPERATOR_METHOD_IDS[number];
|
|
3
3
|
//# sourceMappingURL=operator-method-ids.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operator-method-ids.d.ts","sourceRoot":"","sources":["../../../../src/_internal/contracts/generated/operator-method-ids.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"operator-method-ids.d.ts","sourceRoot":"","sources":["../../../../src/_internal/contracts/generated/operator-method-ids.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,mBAAmB,6qKA8NtB,CAAC;AACX,MAAM,MAAM,gBAAgB,GAAG,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -55,6 +55,12 @@ export const OPERATOR_METHOD_IDS = [
|
|
|
55
55
|
"channels.tools.invoke",
|
|
56
56
|
"channels.tools.list",
|
|
57
57
|
"channels.tools.surface.list",
|
|
58
|
+
"companion.chat.events.stream",
|
|
59
|
+
"companion.chat.messages.create",
|
|
60
|
+
"companion.chat.messages.list",
|
|
61
|
+
"companion.chat.sessions.create",
|
|
62
|
+
"companion.chat.sessions.delete",
|
|
63
|
+
"companion.chat.sessions.get",
|
|
58
64
|
"config.get",
|
|
59
65
|
"config.set",
|
|
60
66
|
"continuity.snapshot",
|
|
@@ -156,6 +162,7 @@ export const OPERATOR_METHOD_IDS = [
|
|
|
156
162
|
"routes.bindings.list",
|
|
157
163
|
"routes.bindings.patch",
|
|
158
164
|
"routes.snapshot",
|
|
165
|
+
"scheduler.capacity",
|
|
159
166
|
"schedules.create",
|
|
160
167
|
"schedules.delete",
|
|
161
168
|
"schedules.disable",
|
|
@@ -173,6 +180,7 @@ export const OPERATOR_METHOD_IDS = [
|
|
|
173
180
|
"sessions.followUp",
|
|
174
181
|
"sessions.get",
|
|
175
182
|
"sessions.inputs.cancel",
|
|
183
|
+
"sessions.inputs.create",
|
|
176
184
|
"sessions.inputs.list",
|
|
177
185
|
"sessions.integration.snapshot",
|
|
178
186
|
"sessions.list",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer-contract.d.ts","sourceRoot":"","sources":["../../../../src/_internal/contracts/generated/peer-contract.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,eAAO,MAAM,aAAa,EAAE,oBA+
|
|
1
|
+
{"version":3,"file":"peer-contract.d.ts","sourceRoot":"","sources":["../../../../src/_internal/contracts/generated/peer-contract.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,eAAO,MAAM,aAAa,EAAE,oBA+0ElB,CAAC"}
|
|
@@ -10,6 +10,23 @@ export interface BaseCompletionReport {
|
|
|
10
10
|
summary: string;
|
|
11
11
|
wrfcId?: string;
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* A single constraint extracted from the task prompt or inherited from a parent chain.
|
|
15
|
+
*/
|
|
16
|
+
export interface Constraint {
|
|
17
|
+
id: string;
|
|
18
|
+
text: string;
|
|
19
|
+
source: 'prompt' | 'inherited';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A reviewer's finding about whether a specific constraint was satisfied.
|
|
23
|
+
*/
|
|
24
|
+
export interface ConstraintFinding {
|
|
25
|
+
constraintId: string;
|
|
26
|
+
satisfied: boolean;
|
|
27
|
+
evidence: string;
|
|
28
|
+
severity?: 'critical' | 'major' | 'minor';
|
|
29
|
+
}
|
|
13
30
|
/** Engineer agent completion report. */
|
|
14
31
|
export interface EngineerReport extends BaseCompletionReport {
|
|
15
32
|
archetype: 'engineer';
|
|
@@ -25,6 +42,8 @@ export interface EngineerReport extends BaseCompletionReport {
|
|
|
25
42
|
}>;
|
|
26
43
|
issues: string[];
|
|
27
44
|
uncertainties: string[];
|
|
45
|
+
/** Constraints enumerated from the task prompt (or inherited from parent chain). Defaults to [] when absent. */
|
|
46
|
+
constraints?: Constraint[];
|
|
28
47
|
}
|
|
29
48
|
/** Reviewer agent completion report. */
|
|
30
49
|
export interface ReviewerReport extends BaseCompletionReport {
|
|
@@ -44,6 +63,8 @@ export interface ReviewerReport extends BaseCompletionReport {
|
|
|
44
63
|
line?: number;
|
|
45
64
|
pointValue: number;
|
|
46
65
|
}>;
|
|
66
|
+
/** Per-constraint satisfaction findings from the reviewer. Defaults to [] when absent. */
|
|
67
|
+
constraintFindings?: ConstraintFinding[];
|
|
47
68
|
}
|
|
48
69
|
/** Tester agent completion report. */
|
|
49
70
|
export interface TesterReport extends BaseCompletionReport {
|
|
@@ -68,11 +89,5 @@ export interface GenericReport extends BaseCompletionReport {
|
|
|
68
89
|
result: string;
|
|
69
90
|
}
|
|
70
91
|
export type CompletionReport = EngineerReport | ReviewerReport | TesterReport | GenericReport;
|
|
71
|
-
/**
|
|
72
|
-
* Parse a completion report from raw LLM output.
|
|
73
|
-
* Looks for a JSON block delimited by ```json\n{...}\n``` or a bare JSON object
|
|
74
|
-
* with a "version": 1 field.
|
|
75
|
-
* Returns null if no valid report found.
|
|
76
|
-
*/
|
|
77
92
|
export declare function parseCompletionReport(rawOutput: string): CompletionReport | null;
|
|
78
93
|
//# sourceMappingURL=completion-report.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion-report.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/agents/completion-report.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF;;;GAGG;AAEH,oDAAoD;AACpD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,CAAC,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wCAAwC;AACxC,MAAM,WAAW,cAAe,SAAQ,oBAAoB;IAC1D,SAAS,EAAE,UAAU,CAAC;IACtB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChD,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"completion-report.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/agents/completion-report.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAErF;;;GAGG;AAEH,oDAAoD;AACpD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,CAAC,C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|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
/** Returns true if a Constraint entry is well-formed. */
|
|
3
|
+
function isWellFormedConstraint(c) {
|
|
4
|
+
if (typeof c !== 'object' || c === null)
|
|
5
|
+
return false;
|
|
6
|
+
const obj = c;
|
|
7
|
+
return (typeof obj['id'] === 'string' && obj['id'].length > 0 &&
|
|
8
|
+
typeof obj['text'] === 'string' && obj['text'].length > 0 &&
|
|
9
|
+
(obj['source'] === 'prompt' || obj['source'] === 'inherited'));
|
|
10
|
+
}
|
|
11
|
+
/** Returns true if a ConstraintFinding entry is well-formed. */
|
|
12
|
+
function isWellFormedConstraintFinding(f) {
|
|
13
|
+
if (typeof f !== 'object' || f === null)
|
|
14
|
+
return false;
|
|
15
|
+
const obj = f;
|
|
16
|
+
return (typeof obj['constraintId'] === 'string' && obj['constraintId'].length > 0 &&
|
|
17
|
+
typeof obj['satisfied'] === 'boolean' &&
|
|
18
|
+
typeof obj['evidence'] === 'string' && obj['evidence'].length > 0);
|
|
19
|
+
}
|
|
8
20
|
export function parseCompletionReport(rawOutput) {
|
|
9
21
|
// Strategy 1: Find ```json ... ``` block
|
|
10
22
|
const jsonBlockMatch = rawOutput.match(/```json\s*\n(\{[\s\S]*?\})\s*\n```/);
|
|
@@ -12,7 +24,7 @@ export function parseCompletionReport(rawOutput) {
|
|
|
12
24
|
try {
|
|
13
25
|
const parsed = JSON.parse(jsonBlockMatch[1]);
|
|
14
26
|
if (parsed.version === 1 && parsed.archetype)
|
|
15
|
-
return parsed;
|
|
27
|
+
return applyConstraintDefaults(parsed);
|
|
16
28
|
}
|
|
17
29
|
catch { /* fall through */ }
|
|
18
30
|
}
|
|
@@ -48,7 +60,7 @@ export function parseCompletionReport(rawOutput) {
|
|
|
48
60
|
try {
|
|
49
61
|
const parsed = JSON.parse(candidate);
|
|
50
62
|
if (parsed.version === 1 && parsed.archetype)
|
|
51
|
-
return parsed;
|
|
63
|
+
return applyConstraintDefaults(parsed);
|
|
52
64
|
}
|
|
53
65
|
catch { /* fall through */ }
|
|
54
66
|
}
|
|
@@ -56,3 +68,23 @@ export function parseCompletionReport(rawOutput) {
|
|
|
56
68
|
}
|
|
57
69
|
return null;
|
|
58
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Normalize constraint-related fields on a parsed report:
|
|
73
|
+
* - defaults `constraints` and `constraintFindings` to []
|
|
74
|
+
* - silently filters out malformed entries
|
|
75
|
+
*
|
|
76
|
+
* Pure: returns a new object rather than mutating the input, so callers can
|
|
77
|
+
* share references without surprise writes.
|
|
78
|
+
*/
|
|
79
|
+
function applyConstraintDefaults(parsed) {
|
|
80
|
+
const next = { ...parsed };
|
|
81
|
+
if (next['archetype'] === 'engineer') {
|
|
82
|
+
const raw = next['constraints'];
|
|
83
|
+
next['constraints'] = Array.isArray(raw) ? raw.filter(isWellFormedConstraint) : [];
|
|
84
|
+
}
|
|
85
|
+
if (next['archetype'] === 'reviewer') {
|
|
86
|
+
const raw = next['constraintFindings'];
|
|
87
|
+
next['constraintFindings'] = Array.isArray(raw) ? raw.filter(isWellFormedConstraintFinding) : [];
|
|
88
|
+
}
|
|
89
|
+
return next;
|
|
90
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator-prompts.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/agents/orchestrator-prompts.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAG3D,KAAK,iBAAiB,GAAG;IACvB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,gBAAgB,CAAC,EAAE;QAC1B,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAAC;KACpF,CAAC;IACF,QAAQ,CAAC,cAAc,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MAAM,CAAC,EACxB,IAAI,CAAC,EAAE,iBAAiB,GACvB,MAAM,CA8LR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oCAAoC,CAClD,MAAM,EAAE,WAAW,EACnB,eAAe,EAAE,MAAM,EACvB,IAAI,CAAC,EAAE,iBAAiB,GACvB,MAAM,CAwCR"}
|
|
@@ -267,6 +267,10 @@ The report format depends on your role:
|
|
|
267
267
|
}
|
|
268
268
|
// --- Layer 5: Task ---
|
|
269
269
|
parts.push(`## Task\n${record.task}`);
|
|
270
|
+
// --- Layer 6: System prompt addendum (WRFC constraint injection) ---
|
|
271
|
+
if (record.systemPromptAddendum) {
|
|
272
|
+
parts.push(record.systemPromptAddendum);
|
|
273
|
+
}
|
|
270
274
|
return parts.join('\n\n');
|
|
271
275
|
}
|
|
272
276
|
/**
|
|
@@ -15,6 +15,8 @@ export declare class WrfcController {
|
|
|
15
15
|
private unsubscribers;
|
|
16
16
|
private activeChainCount;
|
|
17
17
|
private readonly pendingParentChainIds;
|
|
18
|
+
/** Constraints to inherit when a gate-retry child chain is created via the pending path. */
|
|
19
|
+
private readonly pendingParentConstraints;
|
|
18
20
|
private readonly sessionId;
|
|
19
21
|
private readonly workmap;
|
|
20
22
|
private readonly projectRoot;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrfc-controller.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/agents/wrfc-controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AASnD,OAAO,KAAK,EAAkC,SAAS,EAAa,MAAM,iBAAiB,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAG3D,O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3B,OAAO,CAAC,QAAQ;YA0DF,QAAQ;YAuBR,kBAAkB;IAkGhC,OAAO,CAAC,oBAAoB;YAQd,sBAAsB;YAqCtB,UAAU;IAuCxB,OAAO,CAAC,SAAS;YA2BH,WAAW;IAyBzB,OAAO,CAAC,kBAAkB;IAO1B,OAAO,CAAC,cAAc;IAEtB,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,eAAe;IAgCvB,OAAO,CAAC,wBAAwB;IAqBhC,OAAO,CAAC,qBAAqB;IAiB7B,OAAO,CAAC,wBAAwB;IAoDhC,OAAO,CAAC,cAAc;IAuBtB,OAAO,CAAC,qBAAqB;IAS7B,OAAO,CAAC,eAAe;CAKxB"}
|
|
@@ -10,7 +10,8 @@ import { logger } from '../utils/logger.js';
|
|
|
10
10
|
import { summarizeError } from '../utils/error-display.js';
|
|
11
11
|
import { emitWorkflowChainFailed, emitWorkflowFixAttempted, emitWorkflowReviewCompleted, } from '../runtime/emitters/index.js';
|
|
12
12
|
import { getWrfcAutoCommit, getWrfcMaxFixAttempts, getWrfcScoreThreshold, } from './wrfc-config.js';
|
|
13
|
-
import {
|
|
13
|
+
import { buildEngineerConstraintAddendum, } from './wrfc-prompt-addenda.js';
|
|
14
|
+
import { completeWrfcOrchestrationNode, createWrfcWorkflowContext, emitWrfcAutoCommitted, emitWrfcCascadeAbort, emitWrfcChainCreated, emitWrfcChainPassed, emitWrfcConstraintsEnumerated, emitWrfcGraphCreated, emitWrfcStateChanged, failWrfcOrchestrationNode, startWrfcOrchestrationNode, } from './wrfc-runtime-events.js';
|
|
14
15
|
import { runWrfcGateChecks } from './wrfc-gate-runtime.js';
|
|
15
16
|
export { extractScoreFromText, extractPassedFromText, extractIssuesFromText } from './wrfc-reporting.js';
|
|
16
17
|
const VALID_TRANSITIONS = {
|
|
@@ -30,6 +31,8 @@ export class WrfcController {
|
|
|
30
31
|
unsubscribers = [];
|
|
31
32
|
activeChainCount = 0;
|
|
32
33
|
pendingParentChainIds = new Map();
|
|
34
|
+
/** Constraints to inherit when a gate-retry child chain is created via the pending path. */
|
|
35
|
+
pendingParentConstraints = new Map();
|
|
33
36
|
sessionId;
|
|
34
37
|
workmap;
|
|
35
38
|
projectRoot;
|
|
@@ -166,7 +169,19 @@ export class WrfcController {
|
|
|
166
169
|
}
|
|
167
170
|
startReview(chain, report) {
|
|
168
171
|
this.transition(chain, 'reviewing');
|
|
169
|
-
|
|
172
|
+
// Prepend any synthetic issues from the controller (e.g. fixer constraint-continuity
|
|
173
|
+
// violations) to the review task body, then clear them so they fire only once.
|
|
174
|
+
let reviewTask = buildReviewTask(chain.id, report, getWrfcScoreThreshold(this.configManager), chain.constraints);
|
|
175
|
+
if (chain.syntheticIssues && chain.syntheticIssues.length > 0) {
|
|
176
|
+
const syntheticBlock = [
|
|
177
|
+
`## Synthetic issues from controller`,
|
|
178
|
+
``,
|
|
179
|
+
...chain.syntheticIssues.map((issue) => `- [${issue.severity.toUpperCase()}] ${issue.description}`),
|
|
180
|
+
].join('\n');
|
|
181
|
+
reviewTask = syntheticBlock + '\n\n---\n\n' + reviewTask;
|
|
182
|
+
chain.syntheticIssues = [];
|
|
183
|
+
}
|
|
184
|
+
const reviewerRecord = this.spawnWrfcAgent(chain, 'reviewer', reviewTask, true);
|
|
170
185
|
chain.reviewerAgentId = reviewerRecord.id;
|
|
171
186
|
chain.allAgentIds.push(reviewerRecord.id);
|
|
172
187
|
reviewerRecord.wrfcId = chain.id;
|
|
@@ -183,11 +198,24 @@ export class WrfcController {
|
|
|
183
198
|
}
|
|
184
199
|
async processReview(chain, review) {
|
|
185
200
|
const threshold = getWrfcScoreThreshold(this.configManager);
|
|
186
|
-
|
|
201
|
+
const allFindings = review.constraintFindings ?? [];
|
|
202
|
+
const unsatisfied = allFindings.filter((f) => !f.satisfied);
|
|
203
|
+
const constraintsSatisfied = allFindings.filter((f) => f.satisfied).length;
|
|
204
|
+
const constraintsTotal = allFindings.length;
|
|
205
|
+
const constraintFailure = unsatisfied.length > 0;
|
|
206
|
+
const passed = review.score >= threshold && !constraintFailure;
|
|
207
|
+
this.completeCurrentNode(chain, `Score ${review.score}/10${passed ? ' passed' : ' needs fixes'}`);
|
|
187
208
|
emitWorkflowReviewCompleted(this.runtimeBus, createWrfcWorkflowContext(this.sessionId, chain.id), {
|
|
188
209
|
chainId: chain.id,
|
|
189
210
|
score: review.score,
|
|
190
|
-
passed
|
|
211
|
+
passed,
|
|
212
|
+
...(chain.constraints.length > 0
|
|
213
|
+
? {
|
|
214
|
+
constraintsSatisfied,
|
|
215
|
+
constraintsTotal,
|
|
216
|
+
unsatisfiedConstraintIds: unsatisfied.map((f) => f.constraintId),
|
|
217
|
+
}
|
|
218
|
+
: {}),
|
|
191
219
|
});
|
|
192
220
|
this.workmap.append({
|
|
193
221
|
ts: new Date().toISOString(),
|
|
@@ -207,9 +235,11 @@ export class WrfcController {
|
|
|
207
235
|
score: review.score,
|
|
208
236
|
threshold,
|
|
209
237
|
fixAttempts: chain.fixAttempts,
|
|
238
|
+
constraintFailure,
|
|
239
|
+
unsatisfiedCount: unsatisfied.length,
|
|
210
240
|
});
|
|
211
241
|
chain.reviewScores.push(review.score);
|
|
212
|
-
if (
|
|
242
|
+
if (passed) {
|
|
213
243
|
this.transition(chain, 'awaiting_gates');
|
|
214
244
|
await this.checkAndRunGatesForAll();
|
|
215
245
|
return;
|
|
@@ -238,7 +268,7 @@ export class WrfcController {
|
|
|
238
268
|
attempt: chain.fixAttempts,
|
|
239
269
|
maxAttempts,
|
|
240
270
|
});
|
|
241
|
-
const fixerRecord = this.spawnWrfcAgent(chain, 'engineer', buildFixTask(chain.id, review, getWrfcScoreThreshold(this.configManager), chain.fixAttempts), true);
|
|
271
|
+
const fixerRecord = this.spawnWrfcAgent(chain, 'engineer', buildFixTask(chain.id, review, getWrfcScoreThreshold(this.configManager), chain.fixAttempts, chain.constraints, review.constraintFindings ?? []), true);
|
|
242
272
|
chain.fixerAgentId = fixerRecord.id;
|
|
243
273
|
chain.allAgentIds.push(fixerRecord.id);
|
|
244
274
|
fixerRecord.wrfcId = chain.id;
|
|
@@ -324,9 +354,29 @@ export class WrfcController {
|
|
|
324
354
|
const followUpChain = this.findChainByAgentId(followUpRecord.id);
|
|
325
355
|
if (followUpChain) {
|
|
326
356
|
followUpChain.parentChainId = chain.id;
|
|
357
|
+
// Inherit constraints from the parent chain as source: 'inherited'.
|
|
358
|
+
// Phase 4 limitation: the child engineer's returned constraints are ignored
|
|
359
|
+
// (constraintsEnumerated starts true), so the child cannot ADD new constraints
|
|
360
|
+
// from a different prompt. The inherited list is treated as authoritative.
|
|
361
|
+
if (chain.constraints.length > 0) {
|
|
362
|
+
followUpChain.constraints = chain.constraints.map((c) => ({
|
|
363
|
+
id: c.id,
|
|
364
|
+
text: c.text,
|
|
365
|
+
source: 'inherited',
|
|
366
|
+
}));
|
|
367
|
+
followUpChain.constraintsEnumerated = true;
|
|
368
|
+
}
|
|
327
369
|
}
|
|
328
370
|
else {
|
|
329
371
|
this.pendingParentChainIds.set(followUpRecord.id, chain.id);
|
|
372
|
+
// Store parent constraints for inheritance when the child chain is registered later.
|
|
373
|
+
if (chain.constraints.length > 0) {
|
|
374
|
+
this.pendingParentConstraints.set(followUpRecord.id, chain.constraints.map((c) => ({
|
|
375
|
+
id: c.id,
|
|
376
|
+
text: c.text,
|
|
377
|
+
source: 'inherited',
|
|
378
|
+
})));
|
|
379
|
+
}
|
|
330
380
|
}
|
|
331
381
|
logger.debug('WrfcController.processGateResults: gate failure — spawned follow-up agent', {
|
|
332
382
|
parentChainId: chain.id,
|
|
@@ -473,6 +523,10 @@ export class WrfcController {
|
|
|
473
523
|
chain.currentNodeId = undefined;
|
|
474
524
|
}
|
|
475
525
|
createBaseChain(engineerRecord) {
|
|
526
|
+
// Inject the engineer constraint addendum before the runner reads the system prompt.
|
|
527
|
+
// createBaseChain is called synchronously inside manager.spawn() before
|
|
528
|
+
// executor.runAgent(record), so the field is visible to the runner.
|
|
529
|
+
engineerRecord.systemPromptAddendum = '\n\n---\n\n' + buildEngineerConstraintAddendum();
|
|
476
530
|
const chain = {
|
|
477
531
|
id: this.generateWrfcId(),
|
|
478
532
|
state: 'pending',
|
|
@@ -483,6 +537,8 @@ export class WrfcController {
|
|
|
483
537
|
reviewCycles: 0,
|
|
484
538
|
gateRetryDepth: 0,
|
|
485
539
|
reviewScores: [],
|
|
540
|
+
constraints: [],
|
|
541
|
+
constraintsEnumerated: false,
|
|
486
542
|
createdAt: Date.now(),
|
|
487
543
|
};
|
|
488
544
|
this.chains.set(chain.id, chain);
|
|
@@ -506,6 +562,15 @@ export class WrfcController {
|
|
|
506
562
|
chain.gateRetryDepth = parent.gateRetryDepth + (parent.gateFailureFingerprint ? 1 : 0);
|
|
507
563
|
}
|
|
508
564
|
this.pendingParentChainIds.delete(agentId);
|
|
565
|
+
// Inherit constraints from parent when they were queued via the pending path.
|
|
566
|
+
// Phase 4 limitation: constraintsEnumerated is set true so the child engineer's
|
|
567
|
+
// returned constraints are ignored — the inherited list is authoritative.
|
|
568
|
+
const inherited = this.pendingParentConstraints.get(agentId);
|
|
569
|
+
if (inherited && inherited.length > 0) {
|
|
570
|
+
chain.constraints = inherited;
|
|
571
|
+
chain.constraintsEnumerated = true;
|
|
572
|
+
}
|
|
573
|
+
this.pendingParentConstraints.delete(agentId);
|
|
509
574
|
}
|
|
510
575
|
startEngineeringChain(chain, emitCreated) {
|
|
511
576
|
this.activeChainCount += 1;
|
|
@@ -527,6 +592,40 @@ export class WrfcController {
|
|
|
527
592
|
task: chain.task,
|
|
528
593
|
});
|
|
529
594
|
}
|
|
595
|
+
// Capture constraints from the engineer report and emit the enumeration event.
|
|
596
|
+
// Only emit once per chain — the initial engineer completion, not fixer re-runs.
|
|
597
|
+
//
|
|
598
|
+
// Note on narrowing: EngineerReport.archetype is the literal 'engineer', but
|
|
599
|
+
// GenericReport.archetype is a wide `string`. A bare `report.archetype === 'engineer'`
|
|
600
|
+
// check does NOT narrow away GenericReport under strict TS because 'engineer'
|
|
601
|
+
// is assignable to `string`. We use a type predicate to force the narrow.
|
|
602
|
+
const isEngineerReportShape = (r) => r.archetype === 'engineer';
|
|
603
|
+
if (!chain.constraintsEnumerated) {
|
|
604
|
+
chain.constraints = isEngineerReportShape(report) ? (report.constraints ?? []) : [];
|
|
605
|
+
chain.constraintsEnumerated = true;
|
|
606
|
+
emitWrfcConstraintsEnumerated(this.runtimeBus, this.sessionId, chain.id, chain.constraints);
|
|
607
|
+
}
|
|
608
|
+
else {
|
|
609
|
+
// Fixer continuity validation: verify the fixer returned the same constraint id-set.
|
|
610
|
+
// If it diverged, inject a synthetic critical issue for the next review pass.
|
|
611
|
+
const fixerConstraints = isEngineerReportShape(report) ? (report.constraints ?? []) : [];
|
|
612
|
+
const expectedIds = new Set(chain.constraints.map((c) => c.id));
|
|
613
|
+
const actualIds = new Set(fixerConstraints.map((c) => c.id));
|
|
614
|
+
const missing = [...expectedIds].filter((id) => !actualIds.has(id));
|
|
615
|
+
const extra = [...actualIds].filter((id) => !expectedIds.has(id));
|
|
616
|
+
if (missing.length > 0 || extra.length > 0) {
|
|
617
|
+
const description = `Fixer regressed constraint continuity: missing=[${missing.join(',')}] extra=[${extra.join(',')}]`;
|
|
618
|
+
logger.warn('WrfcController: fixer constraint-continuity violation', {
|
|
619
|
+
chainId: chain.id,
|
|
620
|
+
missing,
|
|
621
|
+
extra,
|
|
622
|
+
});
|
|
623
|
+
chain.syntheticIssues ??= [];
|
|
624
|
+
chain.syntheticIssues.push({ severity: 'critical', description });
|
|
625
|
+
}
|
|
626
|
+
// The authoritative constraint list is NOT overwritten — chain.constraints remains the
|
|
627
|
+
// original enumeration from the initial engineer turn.
|
|
628
|
+
}
|
|
530
629
|
this.startReview(chain, report);
|
|
531
630
|
}
|
|
532
631
|
spawnWrfcAgent(chain, template, task, dangerouslyDisableWrfc) {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** SDK-owned platform module. This implementation is maintained in goodvibes-sdk. */
|
|
2
|
+
export declare function buildEngineerConstraintAddendum(): string;
|
|
3
|
+
/**
|
|
4
|
+
* Addendum appended to the reviewer system prompt in every WRFC chain.
|
|
5
|
+
*
|
|
6
|
+
* Instructs the reviewer to verify each enumerated constraint from the
|
|
7
|
+
* engineer's report independently of the 10-dimension rubric.
|
|
8
|
+
*
|
|
9
|
+
* Memoized — the string is static and built once per process.
|
|
10
|
+
*/
|
|
11
|
+
export declare function buildReviewerConstraintAddendum(): string;
|
|
12
|
+
/**
|
|
13
|
+
* Addendum appended to fixer spawns in WRFC chains with non-empty constraints.
|
|
14
|
+
*
|
|
15
|
+
* Instructs the fixer to preserve every satisfied constraint and satisfy any
|
|
16
|
+
* unsatisfied ones, while avoiding silent regressions. Also mandates that the
|
|
17
|
+
* returned EngineerReport carries the exact same constraints[] list.
|
|
18
|
+
*
|
|
19
|
+
* Memoized — the string is static and built once per process.
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildFixerConstraintAddendum(): string;
|
|
22
|
+
//# sourceMappingURL=wrfc-prompt-addenda.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrfc-prompt-addenda.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/agents/wrfc-prompt-addenda.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAmBrF,wBAAgB,+BAA+B,IAAI,MAAM,CAwBxD;AAGD;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,IAAI,MAAM,CAqBxD;AAGD;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,IAAI,MAAM,CAgBrD"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/** SDK-owned platform module. This implementation is maintained in goodvibes-sdk. */
|
|
2
|
+
/**
|
|
3
|
+
* System-prompt addenda injected into WRFC agent spawns.
|
|
4
|
+
*
|
|
5
|
+
* Phase 2 wires `buildEngineerConstraintAddendum` into engineer spawns.
|
|
6
|
+
* Reviewer (Phase 3) and fixer (Phase 4) addenda are declared here for
|
|
7
|
+
* module-shape stability but throw at call time until their phase lands.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Addendum appended to the engineer system prompt in every WRFC chain.
|
|
11
|
+
*
|
|
12
|
+
* Instructs the engineer to enumerate explicit constraints from the task
|
|
13
|
+
* prompt as self-declared acceptance criteria before beginning GATHER.
|
|
14
|
+
*
|
|
15
|
+
* Memoized — the string is static and built once per process.
|
|
16
|
+
*/
|
|
17
|
+
let _engineerAddendumCache = null;
|
|
18
|
+
export function buildEngineerConstraintAddendum() {
|
|
19
|
+
if (_engineerAddendumCache !== null)
|
|
20
|
+
return _engineerAddendumCache;
|
|
21
|
+
_engineerAddendumCache = `## Constraint enumeration (pre-work step)
|
|
22
|
+
|
|
23
|
+
Before you begin GATHER, read the user's task prompt once and decide: **does this prompt contain explicit build instructions with constraints worth enumerating?**
|
|
24
|
+
|
|
25
|
+
A **build task with constraints** looks like: size limits ("under 200 lines"), feature inclusions/exclusions ("must support X but not Y"), style rules ("no \`any\` types", "prefer functional"), performance targets, naming conventions, API shape requirements, explicit scope boundaries, or any specific behavioral requirement the user stated.
|
|
26
|
+
|
|
27
|
+
A **non-build or unconstrained prompt** looks like: a question, a conversational exchange, a request for explanation, exploratory research, a one-shot utility, or a build request that delegates all decisions to your judgment ("make it nice", "fix the bug", "implement whatever makes sense").
|
|
28
|
+
|
|
29
|
+
**Decision:**
|
|
30
|
+
- If the prompt is non-build or unconstrained, emit \`"constraints": []\` in your EngineerReport. Do NOT fabricate constraints. Do NOT convert soft preferences, politeness, or task description into constraints. Proceed with normal GATHER/PLAN/APPLY.
|
|
31
|
+
- If the prompt contains explicit constraints, enumerate them as \`{ id, text, source: "prompt" }\`. Use the user's words, quoted or minimally paraphrased. Assign ids \`c1\`, \`c2\`, … in order of appearance. Do NOT add constraints that are merely your own best practices. Do NOT split a single requirement into multiple ids for bulk. Do NOT summarize the task goal itself as a constraint — constraints are the *shape* of the work, the task is the *what*.
|
|
32
|
+
|
|
33
|
+
**Calibration examples (follow the spirit, not the literal phrasing):**
|
|
34
|
+
- \`"Write a function that adds two numbers"\` → \`constraints: []\` (no shape declared beyond the task itself).
|
|
35
|
+
- \`"Write a function that adds two numbers, must be pure, no external deps, under 20 lines"\` → three constraints.
|
|
36
|
+
- \`"What does this code do?"\` → \`constraints: []\` (not a build task).
|
|
37
|
+
- \`"Refactor this file to use hooks, keep public exports identical"\` → two constraints.
|
|
38
|
+
|
|
39
|
+
**Hard cap: at most ~16 constraints.** If you find more, you are over-enumerating — consolidate. Real user prompts almost never produce more than 5-10.
|
|
40
|
+
|
|
41
|
+
These constraints become your self-declared acceptance criteria. The reviewer will verify each one independently. If you cannot satisfy a constraint, record it under \`issues[]\` with an explanation — do not silently drop it.`;
|
|
42
|
+
return _engineerAddendumCache;
|
|
43
|
+
}
|
|
44
|
+
let _reviewerAddendumCache = null;
|
|
45
|
+
/**
|
|
46
|
+
* Addendum appended to the reviewer system prompt in every WRFC chain.
|
|
47
|
+
*
|
|
48
|
+
* Instructs the reviewer to verify each enumerated constraint from the
|
|
49
|
+
* engineer's report independently of the 10-dimension rubric.
|
|
50
|
+
*
|
|
51
|
+
* Memoized — the string is static and built once per process.
|
|
52
|
+
*/
|
|
53
|
+
export function buildReviewerConstraintAddendum() {
|
|
54
|
+
if (_reviewerAddendumCache !== null)
|
|
55
|
+
return _reviewerAddendumCache;
|
|
56
|
+
_reviewerAddendumCache = `## Constraint verification (runs alongside the 10-dimension rubric, NOT instead of it)
|
|
57
|
+
|
|
58
|
+
The engineer's \`EngineerReport.constraints\` is the authoritative list of user-declared requirements for this task. In the review task payload you will receive this list explicitly — verify it against the applied changes.
|
|
59
|
+
|
|
60
|
+
**For each constraint:**
|
|
61
|
+
1. Judge whether the applied changes satisfy it (\`satisfied: true\` / \`false\`).
|
|
62
|
+
2. Cite concrete evidence — a file and line, a diff observation, or a test behavior. "Looks fine" is not evidence.
|
|
63
|
+
3. Emit a \`constraintFindings[]\` entry referencing \`constraintId\`.
|
|
64
|
+
|
|
65
|
+
**Severity rules for unsatisfied constraints**:
|
|
66
|
+
- A violated hard limit (size, perf target, explicitly forbidden API) → **critical**.
|
|
67
|
+
- A violated explicit user rule (style rules, naming conventions, required features) → **major**.
|
|
68
|
+
- An ambiguous or partially-satisfied constraint → **minor** with evidence explaining the partial satisfaction.
|
|
69
|
+
- If the constraint phrasing is ambiguous enough that verification is impossible, emit \`satisfied: false, severity: 'minor', evidence: 'constraint ambiguous, cannot verify'\` — surfaces the issue without failing the chain on a technicality.
|
|
70
|
+
|
|
71
|
+
**If the constraint list is empty** (non-build prompt → engineer emitted \`[]\`), emit \`constraintFindings: []\` and skip this section entirely. Do NOT invent findings. Do NOT penalize the score for "missing constraints".
|
|
72
|
+
|
|
73
|
+
**Constraint findings are INDEPENDENT of the rubric dimensions.** A run can score 10/10 on the rubric and still fail because a constraint is unsatisfied. Conversely, all constraints can be satisfied while the rubric flags quality issues elsewhere.`;
|
|
74
|
+
return _reviewerAddendumCache;
|
|
75
|
+
}
|
|
76
|
+
let _fixerAddendumCache = null;
|
|
77
|
+
/**
|
|
78
|
+
* Addendum appended to fixer spawns in WRFC chains with non-empty constraints.
|
|
79
|
+
*
|
|
80
|
+
* Instructs the fixer to preserve every satisfied constraint and satisfy any
|
|
81
|
+
* unsatisfied ones, while avoiding silent regressions. Also mandates that the
|
|
82
|
+
* returned EngineerReport carries the exact same constraints[] list.
|
|
83
|
+
*
|
|
84
|
+
* Memoized — the string is static and built once per process.
|
|
85
|
+
*/
|
|
86
|
+
export function buildFixerConstraintAddendum() {
|
|
87
|
+
if (_fixerAddendumCache !== null)
|
|
88
|
+
return _fixerAddendumCache;
|
|
89
|
+
_fixerAddendumCache = `## Constraint preservation during fix
|
|
90
|
+
|
|
91
|
+
The chain's authoritative constraint list is fixed — the engineer declared it on the first turn and it does not change across fix iterations. Every constraint that was declared is still binding on your fix.
|
|
92
|
+
|
|
93
|
+
**Your job is to resolve the reviewer's issues WITHOUT regressing any satisfied constraint, and to satisfy any constraints the reviewer marked unsatisfied.**
|
|
94
|
+
|
|
95
|
+
**Before APPLY, for each constraint in the list:**
|
|
96
|
+
- If the reviewer marked it \`satisfied: true\`, your fix must keep it satisfied. Do not change code in ways that break it.
|
|
97
|
+
- If the reviewer marked it \`satisfied: false\`, your fix must satisfy it AND resolve whichever rubric issues the reviewer flagged.
|
|
98
|
+
- If the reviewer marked it \`UNVERIFIED\` (no finding was recorded), treat it as a constraint you must verify and satisfy before returning.
|
|
99
|
+
- If a reviewer issue can only be resolved by violating a constraint, STOP. Record the conflict under \`issues[]\` with both the \`constraintId\` and the reviewer issue id/description. Do NOT silently regress the constraint.
|
|
100
|
+
|
|
101
|
+
**Return protocol:** Your output must be an \`EngineerReport\` carrying the exact same \`constraints[]\` array you received — same ids, same text, same order. The controller will verify continuity. Renaming, dropping, reordering, or adding constraints will be treated as a regression and surface as a synthetic critical issue in the next review cycle.`;
|
|
102
|
+
return _fixerAddendumCache;
|
|
103
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { CompletionReport, ReviewerReport } from './completion-report.js';
|
|
1
|
+
import type { CompletionReport, Constraint, ConstraintFinding, ReviewerReport } from './completion-report.js';
|
|
2
2
|
import type { QualityGateResult } from './wrfc-types.js';
|
|
3
3
|
export declare function extractScoreFromText(text: string): number | null;
|
|
4
4
|
export declare function extractPassedFromText(text: string, score: number, threshold: number): boolean;
|
|
5
5
|
export declare function extractIssuesFromText(text: string): ReviewerReport['issues'];
|
|
6
6
|
export declare function parseEngineerCompletionReport(rawOutput: string, _template?: string): CompletionReport;
|
|
7
7
|
export declare function parseReviewerCompletionReport(chainId: string, rawOutput: string, threshold: number): ReviewerReport;
|
|
8
|
-
export declare function buildReviewTask(chainId: string, report: CompletionReport, threshold: number): string;
|
|
9
|
-
export declare function buildFixTask(chainId: string, review: ReviewerReport, threshold: number, fixAttempts: number): string;
|
|
8
|
+
export declare function buildReviewTask(chainId: string, report: CompletionReport, threshold: number, constraints?: Constraint[]): string;
|
|
9
|
+
export declare function buildFixTask(chainId: string, review: ReviewerReport, threshold: number, fixAttempts: number, constraints?: Constraint[], constraintFindings?: ConstraintFinding[]): string;
|
|
10
10
|
export declare function buildGateFailureTask(chainId: string, task: string, failedGates: readonly QualityGateResult[]): string;
|
|
11
11
|
//# sourceMappingURL=wrfc-reporting.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrfc-reporting.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/agents/wrfc-reporting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAkB,cAAc,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"wrfc-reporting.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/agents/wrfc-reporting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,iBAAiB,EAAkB,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG9H,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAOzD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAuBhE;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAK7F;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAAC,QAAQ,CAAC,CAa5E;AAED,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAiBrG;AAED,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,cAAc,CA6BhB;AAID,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,g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