@tea-agent/loop-agent 0.43.0-next.17 → 0.43.0-next.3
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 +9 -140
- package/dist/application/task-lifecycle/advance.js +4 -17
- package/dist/application/task-lifecycle/observe.js +29 -43
- package/dist/application/task-lifecycle/plan-transitions.js +4 -5
- package/dist/build-stamp.json +3 -3
- package/dist/commands/client-recovery.js +55 -20
- package/dist/commands/new-task.js +5 -0
- package/dist/commands/status.js +57 -0
- package/dist/commands/task-contract.js +269 -0
- package/dist/executors/dag-pi-executor.js +230 -269
- package/dist/executors/pi-executor.js +0 -2
- package/dist/executors/pi-sdk-executor.js +39 -77
- package/dist/executors/shell-executor.js +2 -3
- package/dist/executors/shell-write-guard.js +32 -27
- package/dist/shared/pi-context-pressure/extension.js +16 -26
- package/dist/shared/pi-retry-settings.js +0 -40
- package/dist/shared/prompts.js +26 -0
- package/dist/task/config.js +2 -0
- package/dist/task/contract/validate-draft.js +106 -0
- package/dist/task/goal.js +3 -0
- package/dist/task/index.js +12 -0
- package/dist/task/lifecycle.js +1 -0
- package/dist/task/operator/capabilities.js +6 -0
- package/dist/task/operator/envelope.js +2 -0
- package/dist/task/operator/index.js +5 -0
- package/dist/task/operator/registry.js +2 -0
- package/dist/task/operator/types.js +1 -0
- package/dist/task/paths.js +1 -0
- package/dist/task/source-prepare/source-fidelity-pi.js +2 -2
- package/dist/task/source-references.js +23 -48
- package/dist/task/source-state.js +1 -0
- package/dist/task/subagent-guidance.js +1 -0
- package/dist/worker/console/chat/assistant-content.js +2 -23
- package/dist/worker/console/chat/explore-tools.js +0 -13
- package/dist/worker/console/chat/pi-runtime.js +1182 -221
- package/dist/worker/console/chat/routes.js +71 -213
- package/dist/worker/console/chat/sdd-data-alignment.js +9 -65
- package/dist/worker/console/chat/session-catalog.js +0 -32
- package/dist/worker/console/chat/session-store.js +6 -22
- package/dist/worker/console/chat/shortcuts.js +0 -6
- package/dist/worker/console/chat/sift-bridge.js +1 -0
- package/dist/worker/console/chat/tool-preview.js +0 -11
- package/dist/worker/console/chat/tools.js +0 -6
- package/dist/worker/console/console-update-and-init.js +19 -1
- package/dist/worker/console/console-update-runtime.js +20 -5
- package/dist/worker/console/index.js +20 -0
- package/dist/worker/console/operator-actions.js +1 -13
- package/dist/worker/console/routes.js +0 -8
- package/dist/worker/console/server.js +29 -11
- package/dist/worker/console/static/assets/{abnfDiagram-N423BO3Z-C4NXyedy.js → abnfDiagram-N423BO3Z-hUmM_GRf.js} +1 -1
- package/dist/worker/console/static/assets/{arc-NZ3qXvBI.js → arc-Bt-xuieW.js} +1 -1
- package/dist/worker/console/static/assets/{architectureDiagram-T3A2C74G-COZSRvml.js → architectureDiagram-T3A2C74G-DTqkL4DJ.js} +1 -1
- package/dist/worker/console/static/assets/{blockDiagram-VBNYF7ZC-Ck0Gxi9C.js → blockDiagram-VBNYF7ZC-Cy0MNnzV.js} +1 -1
- package/dist/worker/console/static/assets/{c4Diagram-5PPSVZJV-BX5HQ4Ox.js → c4Diagram-5PPSVZJV-DDdlT0Pd.js} +1 -1
- package/dist/worker/console/static/assets/channel-BpzRnZmU.js +1 -0
- package/dist/worker/console/static/assets/{chunk-2GRJ4B5K-CoviemSL.js → chunk-2GRJ4B5K-3JawwNZ6.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-2Q5K7J3B-DbOdOkbZ.js → chunk-2Q5K7J3B-DoTp7Cri.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-5RXB4S5H-BsG2pmdQ.js → chunk-5RXB4S5H-CcirhZaS.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-5VM5RSS4-DGdvrNm8.js → chunk-5VM5RSS4-VrG21gnP.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-6Q2QTUOP-BAy7Yd6y.js → chunk-6Q2QTUOP-DDOgIS70.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-GF5L2VYU-D9UA7hUb.js → chunk-GF5L2VYU-CBjmgvJ_.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-JWPE2WC7-DPz7SZ8V.js → chunk-JWPE2WC7-CCQSht8M.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-KBJHAD2P-BmuEOIh7.js → chunk-KBJHAD2P-BpGMkUUV.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-RYQCIY6F-CIhBWnd8.js → chunk-RYQCIY6F-DNDT41QL.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-XXDRQBXY-CScR6mDD.js → chunk-XXDRQBXY-euXnDFbn.js} +1 -1
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-BhlMVqCc.js +1 -0
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-BhlMVqCc.js +1 -0
- package/dist/worker/console/static/assets/{cose-bilkent-JH36ORCC-BjpfWaUr.js → cose-bilkent-JH36ORCC-BJ6NAeql.js} +1 -1
- package/dist/worker/console/static/assets/{cynefin-VYW2F7L2-BFQohJgT.js → cynefin-VYW2F7L2-F5JKIvIq.js} +1 -1
- package/dist/worker/console/static/assets/{cynefinDiagram-MW4NZA55-D3gzRJnS.js → cynefinDiagram-MW4NZA55-Cwmkl_Gi.js} +1 -1
- package/dist/worker/console/static/assets/{dagre-VZM6K2ZE-5eojkhoA.js → dagre-VZM6K2ZE-BmCZ8815.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-7IWD3JNH-CpD8LWu_.js → diagram-7IWD3JNH-zWA3hUnX.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-B4RE2ZJO-B8_4qJ2a.js → diagram-B4RE2ZJO-BzA-888F.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-LBJQPF4R-HOsXf0eu.js → diagram-LBJQPF4R-tPNheoch.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-Q27KOJAE-BqwRwiWP.js → diagram-Q27KOJAE-Cdi7Fyqp.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-UB23O5K3-BRVCNZe1.js → diagram-UB23O5K3-DFK9VBf1.js} +1 -1
- package/dist/worker/console/static/assets/{ebnfDiagram-BXEA7PRR-Cvb1TgGh.js → ebnfDiagram-BXEA7PRR-xCUr1kpg.js} +1 -1
- package/dist/worker/console/static/assets/{erDiagram-JOGREHBK-DS0O0qG9.js → erDiagram-JOGREHBK-BANQHY_A.js} +1 -1
- package/dist/worker/console/static/assets/{flowDiagram-UKHOOZJN-BHIRvRr3.js → flowDiagram-UKHOOZJN-VHJYEMkP.js} +1 -1
- package/dist/worker/console/static/assets/{ganttDiagram-PKOTCBZU-DcCJ1JWx.js → ganttDiagram-PKOTCBZU-DiyZQ0C6.js} +1 -1
- package/dist/worker/console/static/assets/{gitGraphDiagram-DS77QQ5N-B9ia5ony.js → gitGraphDiagram-DS77QQ5N-CZtIeBBa.js} +1 -1
- package/dist/worker/console/static/assets/index-BlN6ytLr.css +1 -0
- package/dist/worker/console/static/assets/index-CA-jfWlE.js +449 -0
- package/dist/worker/console/static/assets/{infoDiagram-6WML65LV-3ogpgegn.js → infoDiagram-6WML65LV-BuSspC0X.js} +1 -1
- package/dist/worker/console/static/assets/{ishikawaDiagram-WSZJBQD7-4tgpQ5SL.js → ishikawaDiagram-WSZJBQD7-DRJZyPFy.js} +1 -1
- package/dist/worker/console/static/assets/{journeyDiagram-NVQOT4AX-DNfgHqFx.js → journeyDiagram-NVQOT4AX-DIfXIVuE.js} +1 -1
- package/dist/worker/console/static/assets/{kanban-definition-27J2QSJJ-Dz7ngC8z.js → kanban-definition-27J2QSJJ-CT10_7Lt.js} +1 -1
- package/dist/worker/console/static/assets/{linear-DI7Jv62E.js → linear-ufemj74H.js} +1 -1
- package/dist/worker/console/static/assets/{mermaid.core-CQA4Nzmo.js → mermaid.core-DEQe8-_m.js} +5 -5
- package/dist/worker/console/static/assets/{mindmap-definition-FAOFIHXS-CtsMc8Mf.js → mindmap-definition-FAOFIHXS-BRLUrbrC.js} +1 -1
- package/dist/worker/console/static/assets/{pegDiagram-VL7TDLO6-ByppE9yH.js → pegDiagram-VL7TDLO6-BgibKtiF.js} +1 -1
- package/dist/worker/console/static/assets/{pieDiagram-7S7Q4E2Y-B5PtgFgt.js → pieDiagram-7S7Q4E2Y-D3eyfdV9.js} +1 -1
- package/dist/worker/console/static/assets/{quadrantDiagram-CIZ2JOQS-Cq4p0k2K.js → quadrantDiagram-CIZ2JOQS-DXeTk5Px.js} +1 -1
- package/dist/worker/console/static/assets/{railroadDiagram-AXF67PYL-DjfkyljN.js → railroadDiagram-AXF67PYL-BgXdFEe7.js} +1 -1
- package/dist/worker/console/static/assets/{requirementDiagram-LRYGKXZP-DzynNRSl.js → requirementDiagram-LRYGKXZP-CseC2A7R.js} +1 -1
- package/dist/worker/console/static/assets/{sankeyDiagram-W5VNT64P-Cj7TCpTJ.js → sankeyDiagram-W5VNT64P-D80PFzfJ.js} +1 -1
- package/dist/worker/console/static/assets/{sequenceDiagram-SI44F4Z6-C73C6ykA.js → sequenceDiagram-SI44F4Z6-BWzHW7LS.js} +1 -1
- package/dist/worker/console/static/assets/{sizeCapture-X5ZJPWSS-BiNLgN2x.js → sizeCapture-X5ZJPWSS-xWQYTLAn.js} +1 -1
- package/dist/worker/console/static/assets/{stateDiagram-OKZ733FA-UwvjS64-.js → stateDiagram-OKZ733FA-CLxtpZeL.js} +1 -1
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-CiVoq4G-.js +1 -0
- package/dist/worker/console/static/assets/{swimlanes-SLNWSIFB-CC7DH98r.js → swimlanes-SLNWSIFB-DwugtmWV.js} +2 -2
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-BkdgdpfR.js +8 -0
- package/dist/worker/console/static/assets/{timeline-definition-Z64GVDOM-LSBXTR70.js → timeline-definition-Z64GVDOM-DHEOwHIe.js} +1 -1
- package/dist/worker/console/static/assets/{vennDiagram-T6HMQDX7-BAuxWwGP.js → vennDiagram-T6HMQDX7-pmbZKlBK.js} +1 -1
- package/dist/worker/console/static/assets/{wardleyDiagram-T6FBY63Y--E5_gjZx.js → wardleyDiagram-T6FBY63Y-CivHoM5q.js} +1 -1
- package/dist/worker/console/static/assets/{xychartDiagram-ELKLHX3M-dJWNmyzF.js → xychartDiagram-ELKLHX3M-BfHIE7o6.js} +1 -1
- package/dist/worker/console/static/index.html +2 -2
- package/dist/worker/console/static-src/operator-chat/chat-sse-events.js +10 -122
- package/dist/worker/console/static-src/operator-chat/compaction-message.js +0 -7
- package/dist/worker/console/static-src/operator-chat/pending-user-message.js +15 -35
- package/dist/worker/console/static-src/operator-chat/useChatSessions.js +62 -136
- package/dist/worker/console/static-src/operator-chat/useChatStream.js +68 -159
- package/dist/worker/console/static-src/operator-chat/useChatThread.js +56 -75
- package/dist/worker/console/static-src/operator-chat/useComposer.js +78 -206
- package/dist/worker/console/workspace-context.js +1 -21
- package/dist/worker/observe/static/router.js +1 -1
- package/dist/worker/observe/static/styles.css +4 -7
- package/dist/worker/observe/static/views/dag-inspector.js +19 -12
- package/dist/worker/observe/static/views/dag.js +2 -2
- package/dist/worker/scheduler/index.js +25 -0
- package/dist/workflows/dag/facts.js +4 -0
- package/dist/workflows/dag/frontend-closeout.js +1 -1
- package/dist/workflows/dag/frontend-design-policy.js +1 -2
- package/dist/workflows/dag/frontend-implementation-contract.js +4 -8
- package/dist/workflows/dag/frontend-prewrite-gate.js +3 -3
- package/dist/workflows/dag/frontend-repair.js +76 -55
- package/dist/workflows/dag/frontend-review-context.js +1 -2
- package/dist/workflows/dag/frontend-review-scopes.js +12 -34
- package/dist/workflows/dag/frontend-shape-facts.js +2 -12
- package/dist/workflows/dag/frontend-verification-trace.js +42 -8
- package/dist/workflows/dag/index.js +6 -0
- package/dist/workflows/dag/init-hybrid.js +160 -97
- package/dist/workflows/dynamic/index.js +7 -0
- package/docs/architecture/runtime-boundaries.md +3 -3
- package/docs/templates/frontend-implementation-dag.json +8 -9
- package/package.json +3 -7
- package/skills/frontend-bounded-implement/SKILL.md +3 -4
- package/skills/frontend-bounded-implement/references/code-standards.md +3 -3
- package/skills/frontend-contract/references/contract-protocol.md +1 -3
- package/skills/frontend-design-review/SKILL.md +7 -12
- package/skills/frontend-design-review/references/review-checklist.md +7 -7
- package/skills/frontend-plan/SKILL.md +0 -19
- package/skills/frontend-plan/references/decision-contract.md +19 -26
- package/skills/frontend-review/SKILL.md +18 -12
- package/skills/frontend-review/references/review-findings.md +43 -24
- package/dist/shared/pi-provider-recovery.js +0 -182
- package/dist/worker/console/chat/browser-automation.js +0 -363
- package/dist/worker/console/chat/browser-policy.js +0 -113
- package/dist/worker/console/chat/browser-routes.js +0 -162
- package/dist/worker/console/chat/pi-runtime/custom-tools/ask-user-question.js +0 -44
- package/dist/worker/console/chat/pi-runtime/custom-tools/browser-tools.js +0 -89
- package/dist/worker/console/chat/pi-runtime/custom-tools/explore-tools.js +0 -202
- package/dist/worker/console/chat/pi-runtime/custom-tools/goal-tools.js +0 -79
- package/dist/worker/console/chat/pi-runtime/custom-tools/operator-tools.js +0 -86
- package/dist/worker/console/chat/pi-runtime/custom-tools/todo-write.js +0 -38
- package/dist/worker/console/chat/pi-runtime/inspection-types.js +0 -28
- package/dist/worker/console/chat/pi-runtime/inspection.js +0 -439
- package/dist/worker/console/chat/pi-runtime/sdk-bindings.js +0 -153
- package/dist/worker/console/chat/pi-runtime/sdk-session.js +0 -5
- package/dist/worker/console/chat/scm-routes.js +0 -217
- package/dist/worker/console/chat/scm-service.js +0 -283
- package/dist/worker/console/chat/scm-tools.js +0 -111
- package/dist/worker/console/chat/session-mode-view.js +0 -49
- package/dist/worker/console/chat/session-mode.js +0 -220
- package/dist/worker/console/chat/terminal-routes.js +0 -216
- package/dist/worker/console/chat/terminal-sessions.js +0 -348
- package/dist/worker/console/chat/terminal-tools.js +0 -211
- package/dist/worker/console/static/assets/channel-BxdTlb_5.js +0 -1
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-_ByA1Nf8.js +0 -1
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-_ByA1Nf8.js +0 -1
- package/dist/worker/console/static/assets/index-B9goN3S5.css +0 -1
- package/dist/worker/console/static/assets/index-wXlQohNs.js +0 -469
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-nLgMZ0D3.js +0 -1
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-BcYqTady.js +0 -8
- package/dist/worker/console/static-src/operator-chat/active-turn-tail.js +0 -10
- package/dist/worker/console/static-src/operator-chat/chat-link.js +0 -94
- package/dist/worker/console/static-src/operator-chat/chat-scroll-position.js +0 -24
- package/dist/worker/console/static-src/operator-chat/composer-session-ledger.js +0 -192
- package/dist/worker/console/static-src/operator-chat/process-label.js +0 -41
- package/dist/worker/console/static-src/operator-chat/turn-group-equality.js +0 -13
- package/dist/worker/console/static-src/operator-chat/turn-process-disclosure.js +0 -10
- package/dist/worker/console/static-src/operator-chat/use-searchable-hidden.js +0 -51
- package/dist/worker/console/static-src/operator-chat/user-turn-anchor-equality.js +0 -21
- package/dist/worker/console/workspace-initialization.js +0 -209
- package/dist/workflows/dag/frontend-capacity.js +0 -9
- package/dist/workflows/dag/frontend-plan-completeness.js +0 -186
- package/dist/workflows/dag/frontend-plan-recovery-policy.js +0 -18
|
@@ -15,7 +15,6 @@ import { readdir, rm } from "node:fs/promises";
|
|
|
15
15
|
import { readJsonIfExists, writeSecureJson, } from "../../../infrastructure/console/app-data.js";
|
|
16
16
|
import { dispatchOperatorAction } from "../operator-actions.js";
|
|
17
17
|
import { authorizeOperatorChatTool } from "./tools.js";
|
|
18
|
-
import { authorizeChatSessionTool, DEFAULT_CONSOLE_CHAT_SESSION_MODE, readStoredSessionMode, } from "./session-mode.js";
|
|
19
18
|
import { projectOperationForChat } from "./chat-event-store.js";
|
|
20
19
|
import { scrubSecrets } from "./explore-tools.js";
|
|
21
20
|
import { hashDeferredTurnPayload, parseDeferredTurns, } from "./deferred-turn.js";
|
|
@@ -107,7 +106,6 @@ export class ChatSessionStore {
|
|
|
107
106
|
...(typeof raw.workspaceId === "string" && raw.workspaceId
|
|
108
107
|
? { workspaceId: raw.workspaceId }
|
|
109
108
|
: {}),
|
|
110
|
-
sessionMode: readStoredSessionMode(raw.sessionMode),
|
|
111
109
|
deferredTurns: normalizedDeferredTurns,
|
|
112
110
|
...(normalizedDeferredTurns[0] ? { deferredTurn: normalizedDeferredTurns[0] } : {}),
|
|
113
111
|
deferredQueueRevision: Number.isSafeInteger(raw.deferredQueueRevision) && (raw.deferredQueueRevision ?? 0) >= 0
|
|
@@ -145,17 +143,7 @@ export class ChatSessionStore {
|
|
|
145
143
|
}
|
|
146
144
|
const records = await Promise.all(names
|
|
147
145
|
.filter((name) => name.endsWith(".json"))
|
|
148
|
-
.map(
|
|
149
|
-
try {
|
|
150
|
-
return await this.get(name.slice(0, -".json".length));
|
|
151
|
-
}
|
|
152
|
-
catch (error) {
|
|
153
|
-
// Skip corrupt records (e.g. unknown sessionMode) but stay
|
|
154
|
-
// diagnosable: silent disappearance is untraceable otherwise.
|
|
155
|
-
process.stderr.write(`[console] chat session record skipped in list: ${name.slice(0, -".json".length)}: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
156
|
-
return undefined;
|
|
157
|
-
}
|
|
158
|
-
}));
|
|
146
|
+
.map((name) => this.get(name.slice(0, -".json".length))));
|
|
159
147
|
return records
|
|
160
148
|
.filter((record) => Boolean(record) && (options?.includeArchived || record.state === "active"))
|
|
161
149
|
.sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
|
|
@@ -184,7 +172,6 @@ export class ChatSessionStore {
|
|
|
184
172
|
updatedAt: now,
|
|
185
173
|
modelProvider: input.modelProvider,
|
|
186
174
|
modelId: input.modelId,
|
|
187
|
-
sessionMode: input.sessionMode ?? DEFAULT_CONSOLE_CHAT_SESSION_MODE,
|
|
188
175
|
messages: [],
|
|
189
176
|
toolInvocations: [],
|
|
190
177
|
};
|
|
@@ -510,10 +497,9 @@ export class ChatSessionStore {
|
|
|
510
497
|
/**
|
|
511
498
|
* Dispatch a Chat tool invocation into the operator action layer.
|
|
512
499
|
*
|
|
513
|
-
* Gate 3 (per-call):
|
|
514
|
-
*
|
|
515
|
-
*
|
|
516
|
-
* action runs (V12 / V15).
|
|
500
|
+
* Gate 3 (per-call): authorizeOperatorChatTool is re-checked here. Even if a
|
|
501
|
+
* malicious or drifted session somehow requested a denied tool, this gate
|
|
502
|
+
* refuses before any operator action runs (V12 / V15).
|
|
517
503
|
*
|
|
518
504
|
* High-risk actions (contractApply / runDag / etc.) are NOT registered as
|
|
519
505
|
* tools, so they never reach here; but we still deny defensively.
|
|
@@ -528,10 +514,8 @@ function redactHumanGateToken(value) {
|
|
|
528
514
|
delete clone.humanGateToken;
|
|
529
515
|
return clone;
|
|
530
516
|
}
|
|
531
|
-
export async function dispatchChatToolCall(ctx, toolName, args, clientRequestId
|
|
532
|
-
const decision =
|
|
533
|
-
? authorizeOperatorChatTool(toolName)
|
|
534
|
-
: authorizeChatSessionTool(toolName, sessionMode);
|
|
517
|
+
export async function dispatchChatToolCall(ctx, toolName, args, clientRequestId) {
|
|
518
|
+
const decision = authorizeOperatorChatTool(toolName);
|
|
535
519
|
if (!decision.ok) {
|
|
536
520
|
return {
|
|
537
521
|
ok: false,
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* prompt / skill commands are merged via mergeSlashCommands with conflict
|
|
6
6
|
* priority: operator/web > extension > skill > prompt.
|
|
7
7
|
*/
|
|
8
|
-
import { isWorkflowExclusiveSlashAction } from "./session-mode-view.js";
|
|
9
8
|
export const SHORTCUTS = [
|
|
10
9
|
{
|
|
11
10
|
command: "/task",
|
|
@@ -139,10 +138,7 @@ export function mergeSlashCommands(dynamic = [], capabilities = {}) {
|
|
|
139
138
|
byName.set(key, { ...item, command: key });
|
|
140
139
|
}
|
|
141
140
|
};
|
|
142
|
-
const hideWorkflow = capabilities.sessionMode === "pi";
|
|
143
141
|
for (const item of SHORTCUTS) {
|
|
144
|
-
if (hideWorkflow && isWorkflowExclusiveSlashAction(item.action))
|
|
145
|
-
continue;
|
|
146
142
|
upsert({
|
|
147
143
|
command: item.command,
|
|
148
144
|
label: item.label,
|
|
@@ -152,8 +148,6 @@ export function mergeSlashCommands(dynamic = [], capabilities = {}) {
|
|
|
152
148
|
});
|
|
153
149
|
}
|
|
154
150
|
for (const item of WEB_SLASH_COMMANDS) {
|
|
155
|
-
if (hideWorkflow && isWorkflowExclusiveSlashAction(item.action))
|
|
156
|
-
continue;
|
|
157
151
|
upsert({
|
|
158
152
|
command: item.command,
|
|
159
153
|
label: item.label,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createSiftBridgeState, parseSiftBridgeConfig, compressProviderPayload, executeSiftRetrieve, housekeepSiftStash, createSiftRetrieveToolDefinition, SIFT_RETRIEVE_TOOL_NAME, SIFT_POLICY_VERSION, } from "../../../shared/pi-context-pressure/sift-bridge.js";
|
|
@@ -193,17 +193,6 @@ export function getToolPresentation(toolName) {
|
|
|
193
193
|
}
|
|
194
194
|
return { kind: "tool", label: raw };
|
|
195
195
|
}
|
|
196
|
-
/** A tool call that failed on its own. A call interrupted by Stop carries
|
|
197
|
-
* `interrupted: true` and must never render (or count) as a failure — every
|
|
198
|
-
* error affordance goes through this single predicate (2026-09-08). */
|
|
199
|
-
export function isToolFailure(entry) {
|
|
200
|
-
return entry.status === "error" && entry.interrupted !== true;
|
|
201
|
-
}
|
|
202
|
-
/** Built-in subagent delegations surface as the `Agent` tool. DSH counts them
|
|
203
|
-
* in a separate「N 个 subagent」bucket instead of the tool-call bucket. */
|
|
204
|
-
export function isSubagentTool(toolName) {
|
|
205
|
-
return (toolName ?? "").trim().toLowerCase() === "agent";
|
|
206
|
-
}
|
|
207
196
|
/** Section labels for ToolCard expand body. */
|
|
208
197
|
export function getToolSectionLabels(toolName) {
|
|
209
198
|
const name = (toolName ?? "").toLowerCase();
|
|
@@ -23,12 +23,6 @@ const EXECUTABLE_GATE_ONLY = new Set(EXECUTABLE_GATE_ONLY_ACTIONS);
|
|
|
23
23
|
/** Built-in Chat custom tools that are not operator registry actions. */
|
|
24
24
|
export const OPERATOR_CHAT_BUILTIN_CUSTOM_TOOLS = Object.freeze([
|
|
25
25
|
OPERATOR_CHAT_AGENT_TOOL_NAME,
|
|
26
|
-
"terminal",
|
|
27
|
-
"scm",
|
|
28
|
-
"browser_navigate",
|
|
29
|
-
"browser_search",
|
|
30
|
-
"browser_inspect",
|
|
31
|
-
"browser_act",
|
|
32
26
|
]);
|
|
33
27
|
/**
|
|
34
28
|
* Actions the model MAY invoke. Derived from the registry but filtered by the
|
|
@@ -67,11 +67,29 @@ 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
|
+
};
|
|
70
78
|
if (!packageChanged) {
|
|
71
|
-
return {
|
|
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
|
+
};
|
|
72
89
|
}
|
|
73
90
|
const handoff = await deps.requestHandoff({
|
|
74
91
|
targetVersion: target.version,
|
|
92
|
+
initResult,
|
|
75
93
|
});
|
|
76
94
|
if (!handoff.ok) {
|
|
77
95
|
maintenance.handoff = {
|
|
@@ -28,13 +28,14 @@ export function createConsoleUpdateExecutor(input) {
|
|
|
28
28
|
return performConsoleUpdateAndInit({
|
|
29
29
|
currentVersion,
|
|
30
30
|
preflight: async () => {
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
const [activity, operations] = await Promise.all([
|
|
32
|
+
readInitRuntimeActivity(input.repoRoot),
|
|
33
|
+
input.operations.list(),
|
|
34
|
+
]);
|
|
35
|
+
if (activity.workerProjectionError ||
|
|
35
36
|
activity.activeDagRunIds.length > 0 ||
|
|
36
37
|
activity.activeWorkerTasks > 0 ||
|
|
37
|
-
activity.activeWorkerBatches > 0)
|
|
38
|
+
activity.activeWorkerBatches > 0) {
|
|
38
39
|
return {
|
|
39
40
|
ok: false,
|
|
40
41
|
code: "ACTIVE_RUNTIME",
|
|
@@ -63,6 +64,20 @@ export function createConsoleUpdateExecutor(input) {
|
|
|
63
64
|
canAutoInstall: () => npm.canAutoInstall(),
|
|
64
65
|
installExact: (version, selectedChannel) => npm.installExact(version, selectedChannel),
|
|
65
66
|
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
|
+
},
|
|
66
81
|
requestHandoff: async ({ targetVersion }) => input.requestHandoff(targetVersion),
|
|
67
82
|
}, channel);
|
|
68
83
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { createConsoleServer, defaultConsoleStaticDir } from "./server.js";
|
|
2
|
+
export { buildOperatorSurfaceHealthV1 } from "./operator-surface-health.js";
|
|
3
|
+
export { runConsoleDoctor, formatConsoleDoctorHuman } from "./doctor.js";
|
|
4
|
+
export { isLoopbackHost } from "./loopback.js";
|
|
5
|
+
export { shouldOpenConsoleBrowser, normalizeConsoleBrowserUrl, openSystemBrowser, maybeOpenConsoleBrowser, } from "./open-browser.js";
|
|
6
|
+
export { repoFingerprintV1, normalizeWorktreeRealpath, } from "../../infrastructure/console/repo-fingerprint.js";
|
|
7
|
+
export { buildObserveDeepLink } from "./observe-link.js";
|
|
8
|
+
export { classifyObserveHealth, probeAndClassifyObserve, capabilityForObserveTarget, OBSERVE_START_COMMAND, DEFAULT_OBSERVE_BASE_URL, } from "./observe-health-match.js";
|
|
9
|
+
export { allowedRecoveryCtas, classifyRecoveryFact, partitionRecoveryCtas, recoveryMatrixInvariants, } from "./recovery-cta.js";
|
|
10
|
+
export { createClosedResourceLoader, createInterviewResourceLoader, tryActivateTool, assertOfficialToolAllowed, listOfficialTools, OFFICIAL_DENIED_TOOL_IDS, INTERVIEW_ALLOWED_TOOLS, INTERVIEW_DENIED_TOOLS, authorizeInterviewTool, } from "./resource-loader.js";
|
|
11
|
+
export { resolveSiblingLoopAgentBin } from "./sibling-controller.js";
|
|
12
|
+
export { openConsoleAppData, defaultConsoleAppDataRoot } from "../../infrastructure/console/app-data.js";
|
|
13
|
+
export { OperationStore } from "../../infrastructure/console/operation-store.js";
|
|
14
|
+
export { createFrontendSplitOperationAdapter } from "./frontend-split-operation-adapter.js";
|
|
15
|
+
export { createFrontendHumanDecisionAdapter } from "./frontend-human-decision-adapter.js";
|
|
16
|
+
export { FrontendSplitTaskMaterializer } from "../materialize/frontend-split-task-materializer.js";
|
|
17
|
+
export { createOperationEventStore } from "./operation-sse.js";
|
|
18
|
+
export { DagConfirmationStore } from "./dag-confirmation.js";
|
|
19
|
+
export { DraftStore } from "./draft-store.js";
|
|
20
|
+
export { probePiReadiness, classifyPiReadiness, isActionBlockedByReadiness, } from "./pi-readiness.js";
|
|
@@ -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, npm ${channel}, and safe initialization`,
|
|
776
776
|
});
|
|
777
777
|
try {
|
|
778
778
|
const result = await ctx.consoleUpdateExecutor(channel);
|
|
@@ -849,18 +849,6 @@ 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
|
-
}
|
|
864
852
|
if (action === "consoleUpdateAndInit") {
|
|
865
853
|
if (req.source !== "human-ui") {
|
|
866
854
|
return {
|
|
@@ -1130,14 +1130,6 @@ 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
|
-
}
|
|
1141
1133
|
if (method === "GET" && pathname === "/api/operator/v1/readiness") {
|
|
1142
1134
|
await handleReadiness(req, res, ctx);
|
|
1143
1135
|
return true;
|
|
@@ -9,9 +9,8 @@ import { DAG_ABSOLUTE_MAX_WALL_CLOCK_MS } from "../../shared/timeout-policy.js";
|
|
|
9
9
|
import { openConsoleAppData } from "../../infrastructure/console/app-data.js";
|
|
10
10
|
import { isLoopbackHost } from "./loopback.js";
|
|
11
11
|
import { ChatSessionStore } from "./chat/session-store.js";
|
|
12
|
-
import { ChatSessionCatalog
|
|
12
|
+
import { ChatSessionCatalog } from "./chat/session-catalog.js";
|
|
13
13
|
import { matchRepoHtmlPreviewRoute } from "./chat/repo-browser.js";
|
|
14
|
-
import { OperationStore } from "../../infrastructure/console/operation-store.js";
|
|
15
14
|
import { handleConsoleHealthRequest, handleWorkspaceRoutes, sendJson, serveConsoleStatic, } from "./routes.js";
|
|
16
15
|
import { issueBootCapabilityToken, injectConfirmationTokenScript, } from "./security.js";
|
|
17
16
|
import { resolvePackageRootFromConsole } from "./sibling-controller.js";
|
|
@@ -236,12 +235,6 @@ export async function createConsoleServer(options) {
|
|
|
236
235
|
packageRoot: resolvePackageRootFromConsole(),
|
|
237
236
|
client: startup.client,
|
|
238
237
|
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
|
-
},
|
|
245
238
|
activeChatTurnCount: () => [...workspaceContexts.values()].reduce((total, context) => total + (context.chatRouteDeps.turnExecutions?.size() ?? 0), 0),
|
|
246
239
|
requestHandoff: requestConsoleHandoff,
|
|
247
240
|
});
|
|
@@ -437,7 +430,33 @@ export async function createConsoleServer(options) {
|
|
|
437
430
|
.get(entry.workspaceId)
|
|
438
431
|
?.chatRouteDeps.events.getActiveTurn(entry.sessionId)
|
|
439
432
|
: undefined;
|
|
440
|
-
return
|
|
433
|
+
return {
|
|
434
|
+
sessionId: entry.sessionId,
|
|
435
|
+
...(entry.workspaceId ? { workspaceId: entry.workspaceId } : {}),
|
|
436
|
+
state: entry.state,
|
|
437
|
+
createdAt: entry.createdAt,
|
|
438
|
+
updatedAt: entry.updatedAt,
|
|
439
|
+
...(entry.title !== undefined ? { title: entry.title } : {}),
|
|
440
|
+
...(entry.displayTitle !== undefined
|
|
441
|
+
? { displayTitle: entry.displayTitle }
|
|
442
|
+
: {}),
|
|
443
|
+
...(entry.modelProvider !== undefined
|
|
444
|
+
? { modelProvider: entry.modelProvider }
|
|
445
|
+
: {}),
|
|
446
|
+
...(entry.modelId !== undefined ? { modelId: entry.modelId } : {}),
|
|
447
|
+
...(entry.thinkingLevel !== undefined
|
|
448
|
+
? { thinkingLevel: entry.thinkingLevel }
|
|
449
|
+
: {}),
|
|
450
|
+
activeTurnId: active?.turnId,
|
|
451
|
+
turnPhase: active?.abortRequestedAt
|
|
452
|
+
? "stopping"
|
|
453
|
+
: active
|
|
454
|
+
? "running"
|
|
455
|
+
: "idle",
|
|
456
|
+
deferredTurn: entry.deferredTurn,
|
|
457
|
+
deferredTurns: entry.deferredTurns,
|
|
458
|
+
isBlank: entry.isBlank && !active,
|
|
459
|
+
};
|
|
441
460
|
});
|
|
442
461
|
sendJson(res, 200, {
|
|
443
462
|
ok: true,
|
|
@@ -651,7 +670,7 @@ export async function createConsoleServer(options) {
|
|
|
651
670
|
}
|
|
652
671
|
resolution.context.actionContext.readiness =
|
|
653
672
|
resolution.context.getReadiness();
|
|
654
|
-
await dispatchChat(req, res, resolution.context.chatRouteDeps, pathname,
|
|
673
|
+
await dispatchChat(req, res, resolution.context.chatRouteDeps, pathname, undefined);
|
|
655
674
|
}
|
|
656
675
|
async function handleOperatorDispatch(req, res, pathname, url, method) {
|
|
657
676
|
const { handleConsoleOperatorRequest } = await import("./routes.js");
|
|
@@ -694,7 +713,6 @@ export async function createConsoleServer(options) {
|
|
|
694
713
|
if ((method === "GET" &&
|
|
695
714
|
(pathname === "/api/operator/v1/readiness" ||
|
|
696
715
|
pathname === "/api/operator/v1/recovery/candidates" ||
|
|
697
|
-
pathname === "/api/operator/v1/workspace-initialization" ||
|
|
698
716
|
pathname === "/api/operator/v1/night-aux-ticker")) ||
|
|
699
717
|
(method === "POST" &&
|
|
700
718
|
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-DDOgIS70.js";import{p as f}from"./chunk-JWPE2WC7-CCQSht8M.js";import{_ as n,l as o}from"./mermaid.core-DEQe8-_m.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-F5JKIvIq.js";import"./index-CA-jfWlE.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-DEQe8-_m.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};
|