@tea-agent/loop-agent 0.43.0-next.13 → 0.43.0-next.15
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 +5 -0
- package/dist/build-stamp.json +3 -3
- package/dist/worker/console/chat/browser-automation.js +363 -0
- package/dist/worker/console/chat/browser-routes.js +36 -14
- package/dist/worker/console/chat/pi-runtime/custom-tools/browser-tools.js +89 -0
- package/dist/worker/console/chat/pi-runtime.js +9 -1
- package/dist/worker/console/chat/routes.js +6 -1
- package/dist/worker/console/chat/session-mode.js +1 -0
- package/dist/worker/console/chat/tools.js +4 -0
- package/dist/worker/console/console-update-and-init.js +1 -19
- package/dist/worker/console/console-update-runtime.js +5 -20
- package/dist/worker/console/operator-actions.js +13 -1
- package/dist/worker/console/routes.js +8 -0
- package/dist/worker/console/server.js +9 -1
- package/dist/worker/console/static/assets/{abnfDiagram-N423BO3Z-BEg5712w.js → abnfDiagram-N423BO3Z-CQE0d0CU.js} +1 -1
- package/dist/worker/console/static/assets/{arc-CkQvaBGZ.js → arc-BFYYG0Wz.js} +1 -1
- package/dist/worker/console/static/assets/{architectureDiagram-T3A2C74G-BrdwFNJ7.js → architectureDiagram-T3A2C74G-B0YlJL9r.js} +1 -1
- package/dist/worker/console/static/assets/{blockDiagram-VBNYF7ZC-M_LjP2kx.js → blockDiagram-VBNYF7ZC-DN9kD3TO.js} +1 -1
- package/dist/worker/console/static/assets/{c4Diagram-5PPSVZJV-Bwr5Dtjc.js → c4Diagram-5PPSVZJV-ChK60XBH.js} +1 -1
- package/dist/worker/console/static/assets/channel-BF5AdCat.js +1 -0
- package/dist/worker/console/static/assets/{chunk-2GRJ4B5K-CDc44stW.js → chunk-2GRJ4B5K-D4AjoNa-.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-2Q5K7J3B-DZELwsTt.js → chunk-2Q5K7J3B-B2HEK_D9.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-5RXB4S5H-D7YI6SWX.js → chunk-5RXB4S5H-DXfZkTa0.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-5VM5RSS4-Bc46bEyj.js → chunk-5VM5RSS4-DC1FyC_o.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-6Q2QTUOP-Bj4vc-Dp.js → chunk-6Q2QTUOP-U2E9RJkG.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-GF5L2VYU-DRi-0nDX.js → chunk-GF5L2VYU-BeMabzLg.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-JWPE2WC7-Dr-wFY60.js → chunk-JWPE2WC7-CWvf3gKN.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-KBJHAD2P-CqIHE_D7.js → chunk-KBJHAD2P-BQE1P4so.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-RYQCIY6F-C-Dl8wzk.js → chunk-RYQCIY6F-DobDWQXh.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-XXDRQBXY-CV4Mydz3.js → chunk-XXDRQBXY-IQe7Y7EH.js} +1 -1
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-BFdnxKyb.js +1 -0
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-BFdnxKyb.js +1 -0
- package/dist/worker/console/static/assets/{cose-bilkent-JH36ORCC-C3MamSMJ.js → cose-bilkent-JH36ORCC-CyDcJU1F.js} +1 -1
- package/dist/worker/console/static/assets/{cynefin-VYW2F7L2-zo_Jy2sf.js → cynefin-VYW2F7L2-CDt8Uivk.js} +1 -1
- package/dist/worker/console/static/assets/{cynefinDiagram-MW4NZA55-BB2PN1AG.js → cynefinDiagram-MW4NZA55-BmFT7svy.js} +1 -1
- package/dist/worker/console/static/assets/{dagre-VZM6K2ZE-BimYueoi.js → dagre-VZM6K2ZE-hRf4KDfM.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-7IWD3JNH-Di1ObJRS.js → diagram-7IWD3JNH-CaDSdUs-.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-B4RE2ZJO-C83l-IJx.js → diagram-B4RE2ZJO-Dw13MbVk.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-LBJQPF4R-B3S3fOpm.js → diagram-LBJQPF4R-TLaO5F4A.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-Q27KOJAE-urW_Zhe7.js → diagram-Q27KOJAE-B-YdjvlA.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-UB23O5K3-nvIbCwF6.js → diagram-UB23O5K3-DHR7IqG6.js} +1 -1
- package/dist/worker/console/static/assets/{ebnfDiagram-BXEA7PRR-DG6O3KpP.js → ebnfDiagram-BXEA7PRR-C5v-LKCD.js} +1 -1
- package/dist/worker/console/static/assets/{erDiagram-JOGREHBK-DpXdtdsj.js → erDiagram-JOGREHBK-7tPJ992C.js} +1 -1
- package/dist/worker/console/static/assets/{flowDiagram-UKHOOZJN-DvXWHrND.js → flowDiagram-UKHOOZJN-CdeV10q2.js} +1 -1
- package/dist/worker/console/static/assets/{ganttDiagram-PKOTCBZU-6F7SbvUS.js → ganttDiagram-PKOTCBZU-Nuod51KB.js} +1 -1
- package/dist/worker/console/static/assets/{gitGraphDiagram-DS77QQ5N-D1tZnFec.js → gitGraphDiagram-DS77QQ5N-CiHmujkA.js} +1 -1
- package/dist/worker/console/static/assets/{index-SAANIK8g.css → index-BXrp_jW4.css} +1 -1
- package/dist/worker/console/static/assets/{index-CWarwRqc.js → index-BnZTkOuj.js} +96 -96
- package/dist/worker/console/static/assets/{infoDiagram-6WML65LV-HN4qwJ2M.js → infoDiagram-6WML65LV-BsbKAEaZ.js} +1 -1
- package/dist/worker/console/static/assets/{ishikawaDiagram-WSZJBQD7-OJ4qwDRo.js → ishikawaDiagram-WSZJBQD7-BMg44jAM.js} +1 -1
- package/dist/worker/console/static/assets/{journeyDiagram-NVQOT4AX-CJZ6giQk.js → journeyDiagram-NVQOT4AX-B2HydpC5.js} +1 -1
- package/dist/worker/console/static/assets/{kanban-definition-27J2QSJJ-co60m19S.js → kanban-definition-27J2QSJJ-Dym8tKBH.js} +1 -1
- package/dist/worker/console/static/assets/{linear-D1KeFqZY.js → linear-C2XLUUy6.js} +1 -1
- package/dist/worker/console/static/assets/{mermaid.core-i7dDGqov.js → mermaid.core-CWKyfsl6.js} +5 -5
- package/dist/worker/console/static/assets/{mindmap-definition-FAOFIHXS-1SkQxBh1.js → mindmap-definition-FAOFIHXS-D1kp3mJa.js} +1 -1
- package/dist/worker/console/static/assets/{pegDiagram-VL7TDLO6-B10dhI-Y.js → pegDiagram-VL7TDLO6-yChJn9Q6.js} +1 -1
- package/dist/worker/console/static/assets/{pieDiagram-7S7Q4E2Y-CiUKUo6j.js → pieDiagram-7S7Q4E2Y-BL0gor4I.js} +1 -1
- package/dist/worker/console/static/assets/{quadrantDiagram-CIZ2JOQS-C5vH4LXZ.js → quadrantDiagram-CIZ2JOQS-BQlU54QR.js} +1 -1
- package/dist/worker/console/static/assets/{railroadDiagram-AXF67PYL-5nlWOCEj.js → railroadDiagram-AXF67PYL-CFaiPP19.js} +1 -1
- package/dist/worker/console/static/assets/{requirementDiagram-LRYGKXZP-CILd6QS3.js → requirementDiagram-LRYGKXZP-3ZmKxDyQ.js} +1 -1
- package/dist/worker/console/static/assets/{sankeyDiagram-W5VNT64P-Dfp18ZO2.js → sankeyDiagram-W5VNT64P-C6ZDqbFT.js} +1 -1
- package/dist/worker/console/static/assets/{sequenceDiagram-SI44F4Z6-B9pkswBi.js → sequenceDiagram-SI44F4Z6-DdB0hg2W.js} +1 -1
- package/dist/worker/console/static/assets/{sizeCapture-X5ZJPWSS-C1-eSgx4.js → sizeCapture-X5ZJPWSS-BdaLiAnv.js} +1 -1
- package/dist/worker/console/static/assets/{stateDiagram-OKZ733FA-COJsOoAF.js → stateDiagram-OKZ733FA-D75bWtSk.js} +1 -1
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-BBtfTPWx.js +1 -0
- package/dist/worker/console/static/assets/{swimlanes-SLNWSIFB-Dv5NXJUM.js → swimlanes-SLNWSIFB-BPhv358R.js} +2 -2
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-Cso4j_rK.js +8 -0
- package/dist/worker/console/static/assets/{timeline-definition-Z64GVDOM-DRdrZ7eR.js → timeline-definition-Z64GVDOM-hrXh6Jie.js} +1 -1
- package/dist/worker/console/static/assets/{vennDiagram-T6HMQDX7-0-2TlwCj.js → vennDiagram-T6HMQDX7-CxjAfZu8.js} +1 -1
- package/dist/worker/console/static/assets/{wardleyDiagram-T6FBY63Y-3-o3q92P.js → wardleyDiagram-T6FBY63Y-C4cHKlnQ.js} +1 -1
- package/dist/worker/console/static/assets/{xychartDiagram-ELKLHX3M-DSgOgdUi.js → xychartDiagram-ELKLHX3M-388ITGyq.js} +1 -1
- package/dist/worker/console/static/index.html +2 -2
- package/dist/worker/console/static-src/operator-chat/chat-scroll-position.js +24 -0
- package/dist/worker/console/static-src/operator-chat/useChatSessions.js +14 -3
- package/dist/worker/console/static-src/operator-chat/useChatThread.js +36 -50
- package/dist/worker/console/workspace-context.js +6 -0
- package/dist/worker/console/workspace-initialization.js +174 -0
- package/package.json +1 -3
- package/dist/commands/new-task.js +0 -5
- package/dist/commands/status.js +0 -57
- package/dist/commands/task-contract.js +0 -269
- package/dist/shared/prompts.js +0 -26
- package/dist/task/config.js +0 -2
- package/dist/task/contract/validate-draft.js +0 -106
- package/dist/task/goal.js +0 -3
- package/dist/task/index.js +0 -12
- package/dist/task/lifecycle.js +0 -1
- package/dist/task/operator/capabilities.js +0 -6
- package/dist/task/operator/envelope.js +0 -2
- package/dist/task/operator/index.js +0 -5
- package/dist/task/operator/registry.js +0 -2
- package/dist/task/operator/types.js +0 -1
- package/dist/task/paths.js +0 -1
- package/dist/task/source-state.js +0 -1
- package/dist/task/subagent-guidance.js +0 -1
- package/dist/worker/console/chat/sift-bridge.js +0 -1
- package/dist/worker/console/index.js +0 -20
- package/dist/worker/console/static/assets/channel-CKmyKgY-.js +0 -1
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-D8Wc3jJP.js +0 -1
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-D8Wc3jJP.js +0 -1
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-Bpfb0q5s.js +0 -1
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-BEwGGabW.js +0 -8
- package/dist/worker/scheduler/index.js +0 -25
- package/dist/workflows/dag/facts.js +0 -4
- package/dist/workflows/dag/index.js +0 -6
- package/dist/workflows/dynamic/index.js +0 -7
|
@@ -67,29 +67,11 @@ export async function performConsoleUpdateAndInit(deps, channel = "latest") {
|
|
|
67
67
|
return failed("INSTALL_VERIFICATION_FAILED", verified.reason, maintenance);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
const initResult = await deps.applySafeInit();
|
|
71
|
-
maintenance.initialization = initResult.ok
|
|
72
|
-
? { status: "clean", pendingPaths: initResult.pendingPaths }
|
|
73
|
-
: {
|
|
74
|
-
status: "needs-reconcile",
|
|
75
|
-
pendingPaths: initResult.pendingPaths,
|
|
76
|
-
message: initResult.message,
|
|
77
|
-
};
|
|
78
70
|
if (!packageChanged) {
|
|
79
|
-
return {
|
|
80
|
-
state: initResult.ok ? "succeeded" : "needs-reconcile",
|
|
81
|
-
maintenance,
|
|
82
|
-
...(initResult.ok
|
|
83
|
-
? {}
|
|
84
|
-
: {
|
|
85
|
-
errorCode: "INIT_NEEDS_RECONCILE",
|
|
86
|
-
errorMessage: initResult.message,
|
|
87
|
-
}),
|
|
88
|
-
};
|
|
71
|
+
return { state: "succeeded", maintenance };
|
|
89
72
|
}
|
|
90
73
|
const handoff = await deps.requestHandoff({
|
|
91
74
|
targetVersion: target.version,
|
|
92
|
-
initResult,
|
|
93
75
|
});
|
|
94
76
|
if (!handoff.ok) {
|
|
95
77
|
maintenance.handoff = {
|
|
@@ -28,14 +28,13 @@ export function createConsoleUpdateExecutor(input) {
|
|
|
28
28
|
return performConsoleUpdateAndInit({
|
|
29
29
|
currentVersion,
|
|
30
30
|
preflight: async () => {
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (activity.workerProjectionError ||
|
|
31
|
+
const scopes = await input.workspaceActivity?.() ?? [input];
|
|
32
|
+
const activities = await Promise.all(scopes.map(scope => readInitRuntimeActivity(scope.repoRoot)));
|
|
33
|
+
const operations = (await Promise.all(scopes.map(scope => scope.operations.list()))).flat();
|
|
34
|
+
if (activities.some(activity => activity.workerProjectionError ||
|
|
36
35
|
activity.activeDagRunIds.length > 0 ||
|
|
37
36
|
activity.activeWorkerTasks > 0 ||
|
|
38
|
-
activity.activeWorkerBatches > 0) {
|
|
37
|
+
activity.activeWorkerBatches > 0)) {
|
|
39
38
|
return {
|
|
40
39
|
ok: false,
|
|
41
40
|
code: "ACTIVE_RUNTIME",
|
|
@@ -64,20 +63,6 @@ export function createConsoleUpdateExecutor(input) {
|
|
|
64
63
|
canAutoInstall: () => npm.canAutoInstall(),
|
|
65
64
|
installExact: (version, selectedChannel) => npm.installExact(version, selectedChannel),
|
|
66
65
|
verifyInstalled: (version) => npm.verifyInstalled(version),
|
|
67
|
-
applySafeInit: async () => {
|
|
68
|
-
const result = await input.client.runExternal("loop-agent", ["init", "update", "--apply-safe", "--repo-root", input.repoRoot], {
|
|
69
|
-
cwd: input.repoRoot,
|
|
70
|
-
artifactName: "console-update-safe-init",
|
|
71
|
-
timeoutMs: 120_000,
|
|
72
|
-
});
|
|
73
|
-
return result.ok
|
|
74
|
-
? { ok: true, pendingPaths: [] }
|
|
75
|
-
: {
|
|
76
|
-
ok: false,
|
|
77
|
-
message: result.stderr || result.stdout || "safe initialization failed",
|
|
78
|
-
pendingPaths: [],
|
|
79
|
-
};
|
|
80
|
-
},
|
|
81
66
|
requestHandoff: async ({ targetVersion }) => input.requestHandoff(targetVersion),
|
|
82
67
|
}, channel);
|
|
83
68
|
};
|
|
@@ -772,7 +772,7 @@ async function acceptConsoleUpdateAndInit(ctx, clientRequestId, channel) {
|
|
|
772
772
|
at: new Date().toISOString(),
|
|
773
773
|
kind: "state",
|
|
774
774
|
state: "running",
|
|
775
|
-
message: `checking runtime
|
|
775
|
+
message: `checking runtime and npm ${channel}`,
|
|
776
776
|
});
|
|
777
777
|
try {
|
|
778
778
|
const result = await ctx.consoleUpdateExecutor(channel);
|
|
@@ -849,6 +849,18 @@ export async function dispatchOperatorAction(ctx, req) {
|
|
|
849
849
|
};
|
|
850
850
|
}
|
|
851
851
|
const p = paramsOf(req);
|
|
852
|
+
if (action === "workspaceInitialize") {
|
|
853
|
+
if (req.source !== "human-ui")
|
|
854
|
+
return { kind: "error", status: 403, body: operatorFailed({ command: action, outcome: "blocked", code: "HUMAN_UI_REQUIRED", message: "工作区初始化需要从界面显式发起" }) };
|
|
855
|
+
if (!req.clientRequestId?.trim() || Object.keys(p).some(key => key !== "model") || (p.model !== undefined && (typeof p.model !== "string" || p.model.length > 300)))
|
|
856
|
+
return invalid(action, "只接受 clientRequestId 和可选模型引用");
|
|
857
|
+
if (!ctx.workspaceInitialization)
|
|
858
|
+
return invalid(action, "工作区初始化服务不可用");
|
|
859
|
+
const created = await ctx.workspaceInitialization.start(req.clientRequestId, p.model);
|
|
860
|
+
if (created.kind === "conflict")
|
|
861
|
+
return { kind: "error", status: 409, body: operatorFailed({ command: action, outcome: "conflict", code: "REQUEST_ID_REUSE_CONFLICT", message: created.message }) };
|
|
862
|
+
return { kind: "accepted", status: 202, body: { operationId: created.operation.operationId, state: created.operation.state, clientRequestId: created.operation.clientRequestId, action } };
|
|
863
|
+
}
|
|
852
864
|
if (action === "consoleUpdateAndInit") {
|
|
853
865
|
if (req.source !== "human-ui") {
|
|
854
866
|
return {
|
|
@@ -1130,6 +1130,14 @@ export async function handleConsoleOperatorRequest(req, res, ctx) {
|
|
|
1130
1130
|
!pathname.startsWith("/api/session/")) {
|
|
1131
1131
|
return false;
|
|
1132
1132
|
}
|
|
1133
|
+
if (method === "GET" && pathname === "/api/operator/v1/workspace-initialization") {
|
|
1134
|
+
const service = ctx.operator?.actionContext.workspaceInitialization;
|
|
1135
|
+
if (!service)
|
|
1136
|
+
sendJson(res, 503, { ok: false, error: { code: "UNAVAILABLE", message: "工作区配置服务不可用" } });
|
|
1137
|
+
else
|
|
1138
|
+
sendJson(res, 200, { ok: true, initialization: await service.check(url.searchParams.get("refresh") === "1") });
|
|
1139
|
+
return true;
|
|
1140
|
+
}
|
|
1133
1141
|
if (method === "GET" && pathname === "/api/operator/v1/readiness") {
|
|
1134
1142
|
await handleReadiness(req, res, ctx);
|
|
1135
1143
|
return true;
|
|
@@ -11,6 +11,7 @@ import { isLoopbackHost } from "./loopback.js";
|
|
|
11
11
|
import { ChatSessionStore } from "./chat/session-store.js";
|
|
12
12
|
import { ChatSessionCatalog, projectChatSessionCatalogListItem, } from "./chat/session-catalog.js";
|
|
13
13
|
import { matchRepoHtmlPreviewRoute } from "./chat/repo-browser.js";
|
|
14
|
+
import { OperationStore } from "../../infrastructure/console/operation-store.js";
|
|
14
15
|
import { handleConsoleHealthRequest, handleWorkspaceRoutes, sendJson, serveConsoleStatic, } from "./routes.js";
|
|
15
16
|
import { issueBootCapabilityToken, injectConfirmationTokenScript, } from "./security.js";
|
|
16
17
|
import { resolvePackageRootFromConsole } from "./sibling-controller.js";
|
|
@@ -235,6 +236,12 @@ export async function createConsoleServer(options) {
|
|
|
235
236
|
packageRoot: resolvePackageRootFromConsole(),
|
|
236
237
|
client: startup.client,
|
|
237
238
|
operations: startup.operations,
|
|
239
|
+
workspaceActivity: async () => {
|
|
240
|
+
const records = new Map((await registry.snapshotVisible()).workspaces.map(record => [record.workspaceId, record]));
|
|
241
|
+
for (const context of workspaceContexts.values())
|
|
242
|
+
records.set(context.workspaceId, context.record);
|
|
243
|
+
return [...records.values()].map(record => ({ repoRoot: record.repoRoot, operations: workspaceContexts.get(record.workspaceId)?.operations ?? new OperationStore(openConsoleAppData({ repoRoot: record.repoRoot, appDataRoot: options.appDataRoot })) }));
|
|
244
|
+
},
|
|
238
245
|
activeChatTurnCount: () => [...workspaceContexts.values()].reduce((total, context) => total + (context.chatRouteDeps.turnExecutions?.size() ?? 0), 0),
|
|
239
246
|
requestHandoff: requestConsoleHandoff,
|
|
240
247
|
});
|
|
@@ -644,7 +651,7 @@ export async function createConsoleServer(options) {
|
|
|
644
651
|
}
|
|
645
652
|
resolution.context.actionContext.readiness =
|
|
646
653
|
resolution.context.getReadiness();
|
|
647
|
-
await dispatchChat(req, res, resolution.context.chatRouteDeps, pathname,
|
|
654
|
+
await dispatchChat(req, res, resolution.context.chatRouteDeps, pathname, resolution.context.workspaceId);
|
|
648
655
|
}
|
|
649
656
|
async function handleOperatorDispatch(req, res, pathname, url, method) {
|
|
650
657
|
const { handleConsoleOperatorRequest } = await import("./routes.js");
|
|
@@ -687,6 +694,7 @@ export async function createConsoleServer(options) {
|
|
|
687
694
|
if ((method === "GET" &&
|
|
688
695
|
(pathname === "/api/operator/v1/readiness" ||
|
|
689
696
|
pathname === "/api/operator/v1/recovery/candidates" ||
|
|
697
|
+
pathname === "/api/operator/v1/workspace-initialization" ||
|
|
690
698
|
pathname === "/api/operator/v1/night-aux-ticker")) ||
|
|
691
699
|
(method === "POST" &&
|
|
692
700
|
pathname === "/api/operator/v1/night-aux-ticker")) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as p,r as u,d as a}from"./chunk-6Q2QTUOP-
|
|
1
|
+
import{g as p,r as u,d as a}from"./chunk-6Q2QTUOP-U2E9RJkG.js";import{p as f}from"./chunk-JWPE2WC7-CWvf3gKN.js";import{_ as n,l as o}from"./mermaid.core-CWKyfsl6.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-CDt8Uivk.js";import"./index-BnZTkOuj.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},B={parser:R,db:a,renderer:u,styles:p};export{B as diagram};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Y as ln,$ as an,a0 as F,a1 as q,a2 as j,a3 as un,a4 as y,a5 as tn,a6 as J,a7 as _,a8 as rn,a9 as o,aa as on,ab as sn,ac as fn}from"./mermaid.core-
|
|
1
|
+
import{Y as ln,$ as an,a0 as F,a1 as q,a2 as j,a3 as un,a4 as y,a5 as tn,a6 as J,a7 as _,a8 as rn,a9 as o,aa as on,ab as sn,ac as fn}from"./mermaid.core-CWKyfsl6.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,z,a){var O=I-l,i=D-h,n=z-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function U(l,h,I,D,v,A,z){var a=l-I,O=h-D,i=(z?A:-A)/J(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,B=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*J(on(0,T*T*R-P*P)),Y=(P*g-m*S)/R,$=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=Y-B,e=$-t,r=w-B,C=p-t;return x*x+e*e>r*r+C*C&&(Y=w,$=p),{cx:Y,cy:$,x01:-n,y01:-d,x11:Y*(v/T-1),y11:$*(v/T-1)}}function hn(){var l=cn,h=yn,I=j(0),D=null,v=gn,A=dn,z=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,B=rn(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(B>tn-y)a.moveTo(s*F(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*F(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=B,S=B,Y=z.apply(this,arguments)/2,$=Y>y&&(D?+D.apply(this,arguments):J(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if($>y){var C=sn($/u*q(Y)),K=sn($/s*q(Y));(P-=C*2)>y?(C*=t?1:-1,R+=C,T-=C):(P=0,R=T=(f+c)/2),(S-=K*2)>y?(K*=t?1:-1,m+=K,g-=K):(S=0,m=g=(f+c)/2)}var G=s*F(m),H=s*q(m),L=u*F(T),M=u*q(T);if(w>y){var N=s*F(g),Q=s*q(g),V=u*F(R),W=u*q(R),E;if(B<an)if(E=pn(G,H,V,W,N,Q,L,M)){var X=G-E[0],Z=H-E[1],b=N-E[0],k=Q-E[1],nn=1/q(fn((X*b+Z*k)/(J(X*X+Z*Z)*J(b*b+k*k)))/2),en=J(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=U(V,W,G,H,s,x,t),r=U(N,Q,L,M,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(G,H),a.arc(0,0,s,m,g,!t)):a.moveTo(G,H),!(u>y)||!(P>y)?a.lineTo(L,M):p>y?(e=U(L,M,N,Q,u,-p,t),r=U(G,H,V,W,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-an/2;return[F(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:j(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:j(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:j(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:j(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:j(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:j(+n),i):A},i.padAngle=function(n){return arguments.length?(z=typeof n=="function"?n:j(+n),i):z},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
|