@tea-agent/loop-agent 0.44.0-next.6 → 0.44.0-next.8
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/CHANGELOG.md +288 -454
- package/dist/build-stamp.json +3 -3
- package/dist/executors/dag-pi/guards.js +4 -0
- package/dist/executors/dag-pi/model-config.js +30 -0
- package/dist/{workflows/dag/frontend-plan-completeness.js → executors/dag-pi/plan/facts.js} +25 -41
- package/dist/executors/dag-pi/plan/ledger-contract.js +55 -0
- package/dist/executors/dag-pi/tools/contract-tools.js +515 -0
- package/dist/executors/dag-pi/tools/design-terminal-tools.js +156 -0
- package/dist/executors/dag-pi/tools/plan-decision-tools.js +519 -0
- package/dist/executors/dag-pi/tools/review-terminal-tools.js +156 -0
- package/dist/executors/dag-pi/tools/scout-evidence-tools.js +270 -0
- package/dist/executors/dag-pi-executor.js +64 -1907
- package/dist/shared/git-workspace-status.js +2 -0
- package/dist/task/frontend-preflight.js +1 -1
- package/dist/task/source-prepare/semantic-intake.js +1 -1
- package/dist/task/source-prepare/source-fidelity-pi.js +1 -1
- package/dist/worker/console/chat/assistant-content.js +5 -34
- package/dist/worker/console/chat/chat-event-store.js +27 -10
- package/dist/worker/console/chat/db-connections.js +72 -8
- package/dist/worker/console/chat/pi-runtime/custom-tools/sql-tools.js +52 -24
- package/dist/worker/console/chat/pi-runtime.js +34 -0
- package/dist/worker/console/chat/routes.js +138 -9
- package/dist/worker/console/chat/session-store.js +147 -19
- package/dist/worker/console/chat/turn-process.js +69 -23
- package/dist/worker/console/chat/user-turn-outline.js +19 -0
- package/dist/worker/console/static/assets/{abnfDiagram-N423BO3Z-Brn2sPzL.js → abnfDiagram-N423BO3Z-r1NAPU_5.js} +1 -1
- package/dist/worker/console/static/assets/{arc-BIMNTG0W.js → arc-dT5T4sVL.js} +1 -1
- package/dist/worker/console/static/assets/{architectureDiagram-T3A2C74G--WtcgR_A.js → architectureDiagram-T3A2C74G-CP_cOq46.js} +1 -1
- package/dist/worker/console/static/assets/{blockDiagram-VBNYF7ZC-BT_Ztog1.js → blockDiagram-VBNYF7ZC-sToEZxEf.js} +1 -1
- package/dist/worker/console/static/assets/{c4Diagram-5PPSVZJV-C5hbVr-l.js → c4Diagram-5PPSVZJV-DSxwwi2m.js} +1 -1
- package/dist/worker/console/static/assets/channel-CyBY_yGk.js +1 -0
- package/dist/worker/console/static/assets/{chunk-2GRJ4B5K-BKKnyR9Z.js → chunk-2GRJ4B5K-B9fh0IkF.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-2Q5K7J3B-BHs6biqA.js → chunk-2Q5K7J3B-CAUNl-A6.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-5RXB4S5H-BdSFy_vP.js → chunk-5RXB4S5H-BomeqbNX.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-5VM5RSS4-BpJIdTKV.js → chunk-5VM5RSS4-BNAuTOLE.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-6Q2QTUOP-C_iWJhkT.js → chunk-6Q2QTUOP-DfzjRD5y.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-GF5L2VYU-BTbmx3-k.js → chunk-GF5L2VYU-C3uE-yc2.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-JWPE2WC7-D4Ee6DmP.js → chunk-JWPE2WC7-C3sQMMYr.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-KBJHAD2P-B487SORR.js → chunk-KBJHAD2P-D_AtEYQL.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-RYQCIY6F-BKYHjNrr.js → chunk-RYQCIY6F-DW4TwhKv.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-XXDRQBXY-DrTdoYZG.js → chunk-XXDRQBXY-CTQDmJcp.js} +1 -1
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-D5lN4E_E.js +1 -0
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-D5lN4E_E.js +1 -0
- package/dist/worker/console/static/assets/{cose-bilkent-JH36ORCC-CttUY_Jo.js → cose-bilkent-JH36ORCC-iMqPuBsL.js} +1 -1
- package/dist/worker/console/static/assets/{cynefin-VYW2F7L2-B4Rm5gnR.js → cynefin-VYW2F7L2-DktIuDWs.js} +1 -1
- package/dist/worker/console/static/assets/{cynefinDiagram-MW4NZA55-ByxHBq_S.js → cynefinDiagram-MW4NZA55-BgVnjyEs.js} +1 -1
- package/dist/worker/console/static/assets/{dagre-VZM6K2ZE-DGrfNFA0.js → dagre-VZM6K2ZE-CR25E4bu.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-7IWD3JNH-KjrUPquv.js → diagram-7IWD3JNH-CPM2h5HY.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-B4RE2ZJO-VS4mlm75.js → diagram-B4RE2ZJO-DqF0x2g1.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-LBJQPF4R-BLXYmFTM.js → diagram-LBJQPF4R-G8BYp2eb.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-Q27KOJAE-C6xoFAqH.js → diagram-Q27KOJAE-BbC4kT_D.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-UB23O5K3-C478dCe7.js → diagram-UB23O5K3-CKZwZ-G5.js} +1 -1
- package/dist/worker/console/static/assets/{ebnfDiagram-BXEA7PRR-DHEpW5zN.js → ebnfDiagram-BXEA7PRR-kJDmheia.js} +1 -1
- package/dist/worker/console/static/assets/{erDiagram-JOGREHBK-CA5GKfo9.js → erDiagram-JOGREHBK-DFTVHyxB.js} +1 -1
- package/dist/worker/console/static/assets/{flowDiagram-UKHOOZJN-zysi0Fl-.js → flowDiagram-UKHOOZJN-BqdN5_os.js} +1 -1
- package/dist/worker/console/static/assets/{ganttDiagram-PKOTCBZU-DGzcKA8Y.js → ganttDiagram-PKOTCBZU-SYDjVakh.js} +1 -1
- package/dist/worker/console/static/assets/{gitGraphDiagram-DS77QQ5N-CHsuIG1w.js → gitGraphDiagram-DS77QQ5N-Bf8bNpGA.js} +1 -1
- package/dist/worker/console/static/assets/index-B28Onmfy.css +1 -0
- package/dist/worker/console/static/assets/index-CTMZsDmh.js +486 -0
- package/dist/worker/console/static/assets/{infoDiagram-6WML65LV-BexZHPCp.js → infoDiagram-6WML65LV-DIeAmJ45.js} +1 -1
- package/dist/worker/console/static/assets/{ishikawaDiagram-WSZJBQD7-Gkx8q-DB.js → ishikawaDiagram-WSZJBQD7-oikqUAlo.js} +1 -1
- package/dist/worker/console/static/assets/{journeyDiagram-NVQOT4AX-XDW3qrJ7.js → journeyDiagram-NVQOT4AX-mKEF_xYT.js} +1 -1
- package/dist/worker/console/static/assets/{kanban-definition-27J2QSJJ-DJ07eEaN.js → kanban-definition-27J2QSJJ-BdWJHPnN.js} +1 -1
- package/dist/worker/console/static/assets/{linear-DL-zeqOn.js → linear-DGRlieMH.js} +1 -1
- package/dist/worker/console/static/assets/{mermaid.core-C0HdXtOf.js → mermaid.core-4P9yPC9c.js} +5 -5
- package/dist/worker/console/static/assets/{mindmap-definition-FAOFIHXS-CqRX0lrt.js → mindmap-definition-FAOFIHXS-5PTSkos6.js} +1 -1
- package/dist/worker/console/static/assets/{pegDiagram-VL7TDLO6-BVM9JZ2H.js → pegDiagram-VL7TDLO6-DONIFpG5.js} +1 -1
- package/dist/worker/console/static/assets/{pieDiagram-7S7Q4E2Y-BA3ozdKk.js → pieDiagram-7S7Q4E2Y-D_Z4S70M.js} +1 -1
- package/dist/worker/console/static/assets/{quadrantDiagram-CIZ2JOQS-B-0_p9_4.js → quadrantDiagram-CIZ2JOQS-CAsjh8iY.js} +1 -1
- package/dist/worker/console/static/assets/{railroadDiagram-AXF67PYL-DHRzPWFc.js → railroadDiagram-AXF67PYL-Cx4Dd6ac.js} +1 -1
- package/dist/worker/console/static/assets/{requirementDiagram-LRYGKXZP-9BEC_PcW.js → requirementDiagram-LRYGKXZP-cQb7mwyH.js} +1 -1
- package/dist/worker/console/static/assets/{sankeyDiagram-W5VNT64P-DMxeW4rN.js → sankeyDiagram-W5VNT64P-Cd-DhUdf.js} +1 -1
- package/dist/worker/console/static/assets/{sequenceDiagram-SI44F4Z6-DixP6LIU.js → sequenceDiagram-SI44F4Z6-AlKYRgIk.js} +1 -1
- package/dist/worker/console/static/assets/{sizeCapture-X5ZJPWSS-B_EifJBo.js → sizeCapture-X5ZJPWSS-CUy_ET4e.js} +1 -1
- package/dist/worker/console/static/assets/{stateDiagram-OKZ733FA-BwikwWbX.js → stateDiagram-OKZ733FA-CTuVe6Sa.js} +1 -1
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-BsWhs8O7.js +1 -0
- package/dist/worker/console/static/assets/{swimlanes-SLNWSIFB-C162l9o1.js → swimlanes-SLNWSIFB-ChFLJb-v.js} +2 -2
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-CJcioYGH.js +8 -0
- package/dist/worker/console/static/assets/{timeline-definition-Z64GVDOM-mpe_u1i4.js → timeline-definition-Z64GVDOM-DZZeiAPr.js} +1 -1
- package/dist/worker/console/static/assets/{vennDiagram-T6HMQDX7-DyUk54HX.js → vennDiagram-T6HMQDX7-t4O91cZU.js} +1 -1
- package/dist/worker/console/static/assets/{wardleyDiagram-T6FBY63Y-HYyMkzfm.js → wardleyDiagram-T6FBY63Y-CV5qGHZu.js} +1 -1
- package/dist/worker/console/static/assets/{xychartDiagram-ELKLHX3M-DRoh7skR.js → xychartDiagram-ELKLHX3M-DyXbytUI.js} +1 -1
- package/dist/worker/console/static/index.html +2 -2
- package/dist/worker/console/static-src/operator-chat/chat-link.js +20 -0
- package/dist/worker/console/static-src/operator-chat/chat-sse-events.js +58 -3
- package/dist/worker/console/static-src/operator-chat/process-label.js +19 -6
- package/dist/worker/console/static-src/operator-chat/transcript-mode.js +21 -0
- package/dist/worker/console/static-src/operator-chat/turn-group-equality.js +2 -0
- package/dist/worker/console/static-src/operator-chat/turn-process-disclosure.js +13 -5
- package/dist/worker/console/static-src/operator-chat/turn-state-projection.js +166 -0
- package/dist/worker/console/static-src/operator-chat/turn-stream-controller.js +56 -2
- package/dist/worker/console/static-src/operator-chat/useChatSessions.js +202 -43
- package/dist/worker/console/static-src/operator-chat/useChatStream.js +78 -23
- package/dist/worker/console/static-src/operator-chat/useChatThread.js +55 -18
- package/dist/worker/console/static-src/operator-chat/useRepoBrowser.js +5 -2
- package/dist/worker/scheduler/scheduled-goal-dispatch.js +3 -2
- package/dist/worker/scheduler/scheduled-goal-evidence.js +6 -1
- package/package.json +1 -1
- package/dist/worker/console/static/assets/channel-DNWB4hpR.js +0 -1
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-COhFgJji.js +0 -1
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-COhFgJji.js +0 -1
- package/dist/worker/console/static/assets/index-CJh6pVLm.js +0 -482
- package/dist/worker/console/static/assets/index-C_kvKmFM.css +0 -1
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-S2ZHMo1c.js +0 -1
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-BZm4ByfV.js +0 -8
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/** DAG Pi design terminal 工具工厂:M8 committed typed design 终审工具,禁止反向依赖执行器入口。 */
|
|
2
|
+
import { createFrontendReviewScopeProtocol } from "../../../workflows/dag/frontend-review-scopes.js";
|
|
3
|
+
import { createDurableFrontendTools } from "../../../workflows/dag/frontend-durable-tools.js";
|
|
4
|
+
import { randomUUID } from "node:crypto";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
/**
|
|
7
|
+
* M8: build the two committed typed design terminal tools (approve_design /
|
|
8
|
+
* request_design_changes). Each tool validates its parameters with the design
|
|
9
|
+
* fact zod schemas, stages + adopts a terminal fact into the typed event
|
|
10
|
+
* store, and returns a structured receipt. Terminal conflicts are caught
|
|
11
|
+
* inside execute and returned as an error receipt rather than crashing the
|
|
12
|
+
* node.
|
|
13
|
+
*/
|
|
14
|
+
export async function createFrontendDesignTerminalTools(input) {
|
|
15
|
+
const [{ Type }, { defineTool }] = await Promise.all([
|
|
16
|
+
import("typebox"),
|
|
17
|
+
import("@earendil-works/pi-coding-agent"),
|
|
18
|
+
]);
|
|
19
|
+
const { approveDesignFactSchema, readCommittedEvents, requestDesignChangesFactSchema, writeTypedEventStoreJsonl, } = await import("../../../workflows/dag/frontend-typed-event-store.js");
|
|
20
|
+
const { adoptTypedEventFact, stageTypedEventFact } = await import("../../../workflows/dag/frontend-typed-event-transaction.js");
|
|
21
|
+
let store = input.store;
|
|
22
|
+
const attemptId = input.attemptId;
|
|
23
|
+
const findingSchema = Type.Object({
|
|
24
|
+
severity: Type.Enum({ Critical: "Critical", Important: "Important", Minor: "Minor", Info: "Info" }),
|
|
25
|
+
file: Type.Optional(Type.String({ minLength: 1 })),
|
|
26
|
+
line: Type.Optional(Type.Integer({ minimum: 1 })),
|
|
27
|
+
issue: Type.String({ minLength: 1 }),
|
|
28
|
+
requiredChange: Type.Optional(Type.String({ minLength: 1 })),
|
|
29
|
+
}, { additionalProperties: false });
|
|
30
|
+
const scopeProtocol = createFrontendReviewScopeProtocol({ phase: "design", inventory: input.inventory, getStore: () => store, attemptId });
|
|
31
|
+
const savedFindings = () => [...new Map(readCommittedEvents(store, attemptId).filter(r => r.fact.kind === "design-finding").map(r => [r.fact.id, r.fact.finding])).values()];
|
|
32
|
+
const allFindings = (direct) => [...new Map([...savedFindings(), ...(Array.isArray(direct) ? direct : [])].map(finding => [JSON.stringify(finding), finding])).values()];
|
|
33
|
+
const recordFindingTool = defineTool({
|
|
34
|
+
name: "record_design_finding", label: "record_design_finding",
|
|
35
|
+
description: "Save one finding with a stable id. Submit findings incrementally, then finalize without repeating the findings array. Saved blocking findings cannot be omitted from approval; correct a finding explicitly with replace:true.",
|
|
36
|
+
parameters: Type.Object({ id: Type.String({ minLength: 1 }), finding: findingSchema }, { additionalProperties: false }),
|
|
37
|
+
async execute(_callId, params) {
|
|
38
|
+
const fact = { kind: "design-finding", id: params.id, finding: params.finding };
|
|
39
|
+
const requestId = `${attemptId}:finding:${randomUUID()}`;
|
|
40
|
+
const staged = stageTypedEventFact({ store, requestId, attemptId, fact });
|
|
41
|
+
const adopted = await adoptTypedEventFact({ store, requestId, attemptId, fact, eventId: staged.eventId, expectedRevision: store.revision });
|
|
42
|
+
const details = { ok: true, eventId: adopted.eventId, revision: adopted.revision };
|
|
43
|
+
return { content: [{ type: "text", text: JSON.stringify(details) }], details };
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
const approveParameters = Type.Object({
|
|
47
|
+
findings: Type.Optional(Type.Array(findingSchema, {
|
|
48
|
+
description: "Optional informational findings (Minor/Info only; no Critical/Important on approval)",
|
|
49
|
+
})),
|
|
50
|
+
}, { additionalProperties: false });
|
|
51
|
+
const requestParameters = Type.Object({
|
|
52
|
+
issueCategory: Type.Enum({
|
|
53
|
+
"implementation-mismatch": "implementation-mismatch",
|
|
54
|
+
"approved-design-defect": "approved-design-defect",
|
|
55
|
+
"target-surface-defect": "target-surface-defect",
|
|
56
|
+
"contract-requirement-gap": "contract-requirement-gap",
|
|
57
|
+
"unknown": "unknown",
|
|
58
|
+
}, { description: "Typed issue category (five-value enum)" }),
|
|
59
|
+
evidenceRefs: Type.Array(Type.String({ minLength: 1 }), {
|
|
60
|
+
description: "Evidence refs (paths or artifact ids); at least one", minItems: 1,
|
|
61
|
+
}),
|
|
62
|
+
findings: Type.Optional(Type.Array(findingSchema, {
|
|
63
|
+
description: "At least one finding", minItems: 1,
|
|
64
|
+
})),
|
|
65
|
+
}, { additionalProperties: false });
|
|
66
|
+
async function adoptDesignFact(kind, fact) {
|
|
67
|
+
const requestId = randomUUID();
|
|
68
|
+
try {
|
|
69
|
+
scopeProtocol.assertComplete();
|
|
70
|
+
const parsed = kind === "approve_design"
|
|
71
|
+
? approveDesignFactSchema.parse(fact)
|
|
72
|
+
: requestDesignChangesFactSchema.parse(fact);
|
|
73
|
+
const staged = stageTypedEventFact({
|
|
74
|
+
store,
|
|
75
|
+
requestId,
|
|
76
|
+
attemptId,
|
|
77
|
+
fact: parsed,
|
|
78
|
+
});
|
|
79
|
+
const adopted = await adoptTypedEventFact({
|
|
80
|
+
store,
|
|
81
|
+
requestId,
|
|
82
|
+
attemptId,
|
|
83
|
+
fact: parsed,
|
|
84
|
+
eventId: staged.eventId,
|
|
85
|
+
expectedRevision: store.revision,
|
|
86
|
+
});
|
|
87
|
+
return {
|
|
88
|
+
content: [
|
|
89
|
+
{
|
|
90
|
+
type: "text",
|
|
91
|
+
text: JSON.stringify({
|
|
92
|
+
ok: true,
|
|
93
|
+
kind,
|
|
94
|
+
eventId: adopted.eventId,
|
|
95
|
+
revision: adopted.revision,
|
|
96
|
+
}),
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
details: {
|
|
100
|
+
ok: true,
|
|
101
|
+
kind,
|
|
102
|
+
eventId: adopted.eventId,
|
|
103
|
+
revision: adopted.revision,
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
const code = error?.code;
|
|
109
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
110
|
+
return {
|
|
111
|
+
content: [
|
|
112
|
+
{
|
|
113
|
+
type: "text",
|
|
114
|
+
text: JSON.stringify({ ok: false, kind, code, error: message }),
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
details: { ok: false, kind, code, error: message },
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const approveDesignTool = defineTool({
|
|
122
|
+
name: "approve_design",
|
|
123
|
+
label: "approve_design",
|
|
124
|
+
description: "Commit the authoritative approve_design terminal fact. Use only when the plan passes design review with no Critical/Important findings.",
|
|
125
|
+
promptSnippet: "Commit the authoritative approve_design terminal verdict (no Critical/Important findings).",
|
|
126
|
+
parameters: approveParameters,
|
|
127
|
+
async execute(_toolCallId, params) {
|
|
128
|
+
return adoptDesignFact("approve_design", {
|
|
129
|
+
kind: "approve_design",
|
|
130
|
+
verdict: "approve_design",
|
|
131
|
+
findings: allFindings(params?.findings),
|
|
132
|
+
});
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
const requestDesignChangesTool = defineTool({
|
|
136
|
+
name: "request_design_changes",
|
|
137
|
+
label: "request_design_changes",
|
|
138
|
+
description: "Commit the authoritative request_design_changes terminal fact. Requires a typed issueCategory, at least one evidenceRef, and non-empty findings.",
|
|
139
|
+
promptSnippet: "Commit the authoritative request_design_changes terminal verdict (issueCategory + evidenceRefs + findings required).",
|
|
140
|
+
parameters: requestParameters,
|
|
141
|
+
async execute(_toolCallId, params) {
|
|
142
|
+
return adoptDesignFact("request_design_changes", {
|
|
143
|
+
kind: "request_design_changes",
|
|
144
|
+
verdict: "request_design_changes",
|
|
145
|
+
issueCategory: params?.issueCategory,
|
|
146
|
+
evidenceRefs: params?.evidenceRefs,
|
|
147
|
+
findings: allFindings(params?.findings),
|
|
148
|
+
});
|
|
149
|
+
},
|
|
150
|
+
});
|
|
151
|
+
const durable = await createDurableFrontendTools({
|
|
152
|
+
file: path.join(input.runDir, input.nodeId, "design-typed-facts.jsonl"), attemptId, store: input.store,
|
|
153
|
+
binding: { inputDigest: input.inputDigest, scopeDigest: input.inventory?.digest }, setWorkingStore: next => { store = next; }, tools: [...scopeProtocol.customTools, recordFindingTool, approveDesignTool, requestDesignChangesTool], validateRestored: async () => { await input.inventory?.validate(); },
|
|
154
|
+
});
|
|
155
|
+
return { ...durable, scopeProtocol };
|
|
156
|
+
}
|