@dotobokuri/fleet-console 1.5.0 → 1.5.1
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/AGENTS.md +1 -1
- package/dist/cli-bin.mjs +54 -21
- package/dist/cli.mjs +54 -21
- package/dist/client/assets/{_baseUniq-Bx4tjoo0.js → _baseUniq-Cj5iZsnm.js} +1 -1
- package/dist/client/assets/{arc-D2VjIIjy.js → arc-Jbxpc55P.js} +1 -1
- package/dist/client/assets/{architectureDiagram-Q4EWVU46-BZwp8oQE.js → architectureDiagram-Q4EWVU46-C2AL37ZH.js} +1 -1
- package/dist/client/assets/{blockDiagram-DXYQGD6D-BFOEZdvM.js → blockDiagram-DXYQGD6D-Z33MGAR0.js} +1 -1
- package/dist/client/assets/{c4Diagram-AHTNJAMY-CSR3Fk7i.js → c4Diagram-AHTNJAMY-DTyyZjbr.js} +1 -1
- package/dist/client/assets/channel-C7CS_KI3.js +1 -0
- package/dist/client/assets/{chunk-4BX2VUAB-CS98Xbj0.js → chunk-4BX2VUAB-MhU_yYsg.js} +1 -1
- package/dist/client/assets/{chunk-4TB4RGXK-CS16wI2h.js → chunk-4TB4RGXK-rush3WYT.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-CIO8gXOu.js → chunk-55IACEB6-2q7GyaDY.js} +1 -1
- package/dist/client/assets/{chunk-EDXVE4YY-Dp62WKTv.js → chunk-EDXVE4YY-BNJul5Gb.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-P-iX66To.js → chunk-FMBD7UC4-RLF-A4M2.js} +1 -1
- package/dist/client/assets/{chunk-OYMX7WX6-KYR0A13Y.js → chunk-OYMX7WX6-O3WaO8eP.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-Bxf_1qP2.js → chunk-QZHKN3VN-VmMF7Q4N.js} +1 -1
- package/dist/client/assets/{chunk-YZCP3GAM-fOywdyl7.js → chunk-YZCP3GAM-Bh6gYhu2.js} +1 -1
- package/dist/client/assets/classDiagram-6PBFFD2Q-DNK0Ad4c.js +1 -0
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-DNK0Ad4c.js +1 -0
- package/dist/client/assets/clone-DOhXj8NM.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-CFVfzokO.js → cose-bilkent-S5V4N54A-D3DS835d.js} +1 -1
- package/dist/client/assets/{dagre-KV5264BT-CfFJpw9h.js → dagre-KV5264BT-Ciubq0vM.js} +1 -1
- package/dist/client/assets/{diagram-5BDNPKRD-ULNbraD0.js → diagram-5BDNPKRD-BZZIvHWa.js} +1 -1
- package/dist/client/assets/{diagram-G4DWMVQ6-BbMRdy0R.js → diagram-G4DWMVQ6-BtXUzyHa.js} +1 -1
- package/dist/client/assets/{diagram-MMDJMWI5-xMtFUvhH.js → diagram-MMDJMWI5-DCUsuoWB.js} +1 -1
- package/dist/client/assets/{diagram-TYMM5635-zoxhe65u.js → diagram-TYMM5635-B4qobpfh.js} +1 -1
- package/dist/client/assets/{erDiagram-SMLLAGMA-Bsi2YaEX.js → erDiagram-SMLLAGMA-By9AUj2W.js} +1 -1
- package/dist/client/assets/{flowDiagram-DWJPFMVM-CJi0VEgQ.js → flowDiagram-DWJPFMVM-BwnN5h7R.js} +1 -1
- package/dist/client/assets/{ganttDiagram-T4ZO3ILL-C6zhjR-p.js → ganttDiagram-T4ZO3ILL-CXKwXiMU.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-UUTBAWPF-BWwF6PIg.js → gitGraphDiagram-UUTBAWPF-DNT5RSum.js} +1 -1
- package/dist/client/assets/{graph-B_LOrVuH.js → graph-CjPVI8l2.js} +1 -1
- package/dist/client/assets/index-B2Ok0q13.css +1 -0
- package/dist/client/assets/{index-CUwIAcWy.js → index-BULfWUw5.js} +126 -126
- package/dist/client/assets/{infoDiagram-42DDH7IO-lGXnGt9J.js → infoDiagram-42DDH7IO-U_AT1-iD.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-UXIWVN3A-BOLdpalb.js → ishikawaDiagram-UXIWVN3A-Qex4lNxT.js} +1 -1
- package/dist/client/assets/{journeyDiagram-VCZTEJTY-BL3YNELi.js → journeyDiagram-VCZTEJTY-DzQ-n2Dr.js} +1 -1
- package/dist/client/assets/{kanban-definition-6JOO6SKY-hr-sYeeB.js → kanban-definition-6JOO6SKY-Nca0w4w_.js} +1 -1
- package/dist/client/assets/{layout-BZ-MMmoc.js → layout-CSAtztCW.js} +1 -1
- package/dist/client/assets/{linear-DC89C5fp.js → linear-DCMai7XD.js} +1 -1
- package/dist/client/assets/{mermaid.core-CwFfQIZ3.js → mermaid.core-DgeiljBl.js} +4 -4
- package/dist/client/assets/{min-CQCIo8ng.js → min-CXx0Defw.js} +1 -1
- package/dist/client/assets/{mindmap-definition-QFDTVHPH-DST5EYZ1.js → mindmap-definition-QFDTVHPH-3eAEbAuc.js} +1 -1
- package/dist/client/assets/{pieDiagram-DEJITSTG-B1cKU1RL.js → pieDiagram-DEJITSTG-QzP0SY9Q.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-34T5L4WZ-BAoS3KE9.js → quadrantDiagram-34T5L4WZ-BESlSjcj.js} +1 -1
- package/dist/client/assets/{requirementDiagram-MS252O5E-1Dy-goiy.js → requirementDiagram-MS252O5E-C_Epj4-C.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-XADWPNL6-BiGdJMmS.js → sankeyDiagram-XADWPNL6-Djw1Duzy.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-FGHM5R23-BF2eGtl0.js → sequenceDiagram-FGHM5R23-Dx1GQsBc.js} +1 -1
- package/dist/client/assets/{stateDiagram-FHFEXIEX-Bbe8i846.js → stateDiagram-FHFEXIEX-CFbPjyzN.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-CqOKCF9r.js +1 -0
- package/dist/client/assets/{timeline-definition-GMOUNBTQ-C57TZcAM.js → timeline-definition-GMOUNBTQ-eL6NFeHV.js} +1 -1
- package/dist/client/assets/{vennDiagram-DHZGUBPP-CCLKJVMf.js → vennDiagram-DHZGUBPP-DWTRRBRv.js} +1 -1
- package/dist/client/assets/{wardley-RL74JXVD-CkN25AoB.js → wardley-RL74JXVD-lzn8v7--.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-NUSXRM2D-D7-EokFc.js → wardleyDiagram-NUSXRM2D-CeSqsVbB.js} +1 -1
- package/dist/client/assets/{xychartDiagram-5P7HB3ND-Dr1PKcCW.js → xychartDiagram-5P7HB3ND-CVYHXTp8.js} +1 -1
- package/dist/client/index.html +2 -2
- package/package.json +1 -1
- package/dist/client/assets/channel-DEE95baa.js +0 -1
- package/dist/client/assets/classDiagram-6PBFFD2Q-C48o24xA.js +0 -1
- package/dist/client/assets/classDiagram-v2-HSJHXN6E-C48o24xA.js +0 -1
- package/dist/client/assets/clone-UUGnmCaX.js +0 -1
- package/dist/client/assets/index-qy_LXUbN.css +0 -1
- package/dist/client/assets/stateDiagram-v2-QKLJ7IA2-C5NCIJbi.js +0 -1
package/AGENTS.md
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
|
|
47
47
|
## Layout
|
|
48
48
|
|
|
49
|
-
- `src/` — Node-side backend and CLI lifecycle: the HTTP server (`server.ts`), bearer auth and security headers, static serving (`static-console.ts`), the register-ingest and observer routes (including `/observer/theaters*` Theater registry and session launch), the SSE helper, `codex/` (Fleet Wiki/Codex API gateway and workspace registration), `theaters.ts` (console-level in-memory TheaterRegistry), `theater.ts` (Theater id hash, realpath canonicalization, and label helpers), `terminal/` (PTY ticket/session/ws transport; console terminal sessions launch `fleet-cli --headless --native` so the child Agent CLI owns the PTY while registering with the console), the lifecycle modules (`lock.ts`, `paths.ts`, `health.ts`, `stale.ts`), and the CLI (`cli.ts`, `cli-bin.ts`, `browser.ts`, `help-style.ts`). Built by tsup to `dist/cli.mjs` and `dist/cli-bin.mjs`. Depends on `@dotobokuri/core-agent` for the shared register data contract; must **not** depend on the retired gateway package. `help-style.ts` is a CLI-help-only **self-hosted** style helper shared by the console and Codex compatibility CLIs; it must not import from `fleet-cli`, `packages/*` (beyond the core-agent contract), or `client/`, and changes to the shared banner/SGR vocabulary require manual sync across those copies.
|
|
49
|
+
- `src/` — Node-side backend and CLI lifecycle: the HTTP server (`server.ts`), bearer auth and security headers, static serving (`static-console.ts`), the register-ingest and observer routes (including `/observer/theaters*` Theater registry and session launch), the SSE helper, `codex/` (Fleet Wiki/Codex API gateway and workspace registration), `theaters.ts` (console-level in-memory TheaterRegistry), `theater.ts` (Theater id hash, realpath canonicalization, and label helpers), `terminal/` (PTY ticket/session/ws transport; console terminal sessions launch `fleet-cli --headless --native` so the child Agent CLI owns the PTY while registering with the console; closing the browser view or switching Operations does not terminate the PTY — sessions persist until the child process exits, an operator explicitly terminates the session, or the server stops), the lifecycle modules (`lock.ts`, `paths.ts`, `health.ts`, `stale.ts`), and the CLI (`cli.ts`, `cli-bin.ts`, `browser.ts`, `help-style.ts`). Built by tsup to `dist/cli.mjs` and `dist/cli-bin.mjs`. Depends on `@dotobokuri/core-agent` for the shared register data contract; must **not** depend on the retired gateway package. `help-style.ts` is a CLI-help-only **self-hosted** style helper shared by the console and Codex compatibility CLIs; it must not import from `fleet-cli`, `packages/*` (beyond the core-agent contract), or `client/`, and changes to the shared banner/SGR vocabulary require manual sync across those copies.
|
|
50
50
|
- `client/` — the Vite React SPA (`client/src/`, `client/index.html`, `client/vite.config.ts`). Must not import Node-only modules or the console backend (`src/`).
|
|
51
51
|
- `tests/` — vitest suites for the reducer, SSE parser, store, register-ingest, terminal, and CLI lifecycle.
|
|
52
52
|
|
package/dist/cli-bin.mjs
CHANGED
|
@@ -33482,6 +33482,10 @@ function writeAggregateObserverEvents(req, res, workspaces, store2, resolveWorks
|
|
|
33482
33482
|
}
|
|
33483
33483
|
const unsubscribers = options.subscribeAll ? [
|
|
33484
33484
|
store2.subscribeAll((event) => {
|
|
33485
|
+
if (isSessionUpdatedEvent(event)) {
|
|
33486
|
+
writeEvent(res, 0, event.type, { session: event.session });
|
|
33487
|
+
return;
|
|
33488
|
+
}
|
|
33485
33489
|
writeEvent(res, event.id, event.type, { tenant: resolvedWorkspaceSnapshot(resolveWorkspace, event.tenantId), event });
|
|
33486
33490
|
})
|
|
33487
33491
|
] : workspaces.map(
|
|
@@ -33504,6 +33508,9 @@ function writeEvent(res, id, event, data) {
|
|
|
33504
33508
|
|
|
33505
33509
|
`);
|
|
33506
33510
|
}
|
|
33511
|
+
function isSessionUpdatedEvent(event) {
|
|
33512
|
+
return event.type === "session:updated" && "session" in event;
|
|
33513
|
+
}
|
|
33507
33514
|
function workspaceSnapshot(workspace) {
|
|
33508
33515
|
return {
|
|
33509
33516
|
tenantId: workspace.tenantId,
|
|
@@ -33539,6 +33546,7 @@ function createConsoleObservabilityStore(deps = {}) {
|
|
|
33539
33546
|
const truncationByTenant = /* @__PURE__ */ new Map();
|
|
33540
33547
|
const jobsByTenant = /* @__PURE__ */ new Map();
|
|
33541
33548
|
const terminalSessionsById = /* @__PURE__ */ new Map();
|
|
33549
|
+
const terminalSequenceByTheater = /* @__PURE__ */ new Map();
|
|
33542
33550
|
const listenersByTenant = /* @__PURE__ */ new Map();
|
|
33543
33551
|
const allListeners = /* @__PURE__ */ new Set();
|
|
33544
33552
|
let nextObservedId = 1;
|
|
@@ -33702,13 +33710,18 @@ function createConsoleObservabilityStore(deps = {}) {
|
|
|
33702
33710
|
function createPendingTerminalSession(input) {
|
|
33703
33711
|
if (!path9__default.isAbsolute(input.cwd)) throw new Error("Terminal session cwd must be absolute");
|
|
33704
33712
|
const createdAt = input.createdAt ?? now();
|
|
33713
|
+
const canonicalCwd = canonicalizeTheaterPathSync(input.cwd);
|
|
33714
|
+
const theaterId = workspaceHash(canonicalCwd);
|
|
33715
|
+
const sequence = (terminalSequenceByTheater.get(theaterId) ?? 0) + 1;
|
|
33716
|
+
terminalSequenceByTheater.set(theaterId, sequence);
|
|
33705
33717
|
const state = {
|
|
33706
33718
|
sessionId: input.sessionId,
|
|
33707
33719
|
cwd: input.cwd,
|
|
33708
|
-
canonicalCwd
|
|
33720
|
+
canonicalCwd,
|
|
33709
33721
|
cwdLabel: path9__default.basename(input.cwd) || input.cwd,
|
|
33722
|
+
sequence,
|
|
33710
33723
|
createdAt,
|
|
33711
|
-
theaterId
|
|
33724
|
+
theaterId,
|
|
33712
33725
|
terminalSessionId: input.sessionId,
|
|
33713
33726
|
status: "starting"
|
|
33714
33727
|
};
|
|
@@ -33724,6 +33737,21 @@ function createConsoleObservabilityStore(deps = {}) {
|
|
|
33724
33737
|
session.status = status;
|
|
33725
33738
|
return toTerminalSessionInfo(session);
|
|
33726
33739
|
}
|
|
33740
|
+
function renameTerminalSession(sessionId, rawLabel) {
|
|
33741
|
+
const session = terminalSessionsById.get(sessionId);
|
|
33742
|
+
if (!session) return null;
|
|
33743
|
+
const label = rawLabel.trim().slice(0, 200);
|
|
33744
|
+
if (label.length === 0) {
|
|
33745
|
+
delete session.label;
|
|
33746
|
+
} else {
|
|
33747
|
+
session.label = label;
|
|
33748
|
+
}
|
|
33749
|
+
return toTerminalSessionInfo(session);
|
|
33750
|
+
}
|
|
33751
|
+
function notifySessionUpdated(session) {
|
|
33752
|
+
const event = { type: "session:updated", session };
|
|
33753
|
+
for (const listener of allListeners) listener(event);
|
|
33754
|
+
}
|
|
33727
33755
|
function removeTerminalSession(sessionId) {
|
|
33728
33756
|
return terminalSessionsById.delete(sessionId);
|
|
33729
33757
|
}
|
|
@@ -33735,6 +33763,7 @@ function createConsoleObservabilityStore(deps = {}) {
|
|
|
33735
33763
|
truncationByTenant.clear();
|
|
33736
33764
|
jobsByTenant.clear();
|
|
33737
33765
|
terminalSessionsById.clear();
|
|
33766
|
+
terminalSequenceByTheater.clear();
|
|
33738
33767
|
listenersByTenant.clear();
|
|
33739
33768
|
allListeners.clear();
|
|
33740
33769
|
}
|
|
@@ -33754,6 +33783,8 @@ function createConsoleObservabilityStore(deps = {}) {
|
|
|
33754
33783
|
pushEvents,
|
|
33755
33784
|
register,
|
|
33756
33785
|
createPendingTerminalSession,
|
|
33786
|
+
notifySessionUpdated,
|
|
33787
|
+
renameTerminalSession,
|
|
33757
33788
|
subscribe,
|
|
33758
33789
|
subscribeAll,
|
|
33759
33790
|
updateTerminalSessionStatus,
|
|
@@ -33835,6 +33866,8 @@ function toTerminalSessionInfo(state) {
|
|
|
33835
33866
|
sessionId: state.sessionId,
|
|
33836
33867
|
terminalSessionId: state.terminalSessionId,
|
|
33837
33868
|
cwdLabel: state.cwdLabel,
|
|
33869
|
+
sequence: state.sequence,
|
|
33870
|
+
label: state.label,
|
|
33838
33871
|
status: state.status,
|
|
33839
33872
|
createdAt: state.createdAt,
|
|
33840
33873
|
theaterId: state.theaterId,
|
|
@@ -34245,15 +34278,11 @@ function buildShellLaunchEnv(env) {
|
|
|
34245
34278
|
// src/terminal/session-manager.ts
|
|
34246
34279
|
var DEFAULT_COLS = 80;
|
|
34247
34280
|
var DEFAULT_ROWS = 24;
|
|
34248
|
-
var DEFAULT_GRACE_MS = 18e4;
|
|
34249
34281
|
var DEFAULT_SCROLLBACK_LIMIT = 512;
|
|
34250
34282
|
var WS_OPEN_STATE = 1;
|
|
34251
34283
|
function createTerminalSessionManager(deps) {
|
|
34252
34284
|
const startShell = deps.startShell ?? startTerminalShell;
|
|
34253
|
-
const graceMs = deps.graceMs ?? DEFAULT_GRACE_MS;
|
|
34254
34285
|
const scrollbackLimit = deps.scrollbackLimit ?? DEFAULT_SCROLLBACK_LIMIT;
|
|
34255
|
-
const setTimeoutImpl = deps.setTimeout ?? setTimeout;
|
|
34256
|
-
const clearTimeoutImpl = deps.clearTimeout ?? clearTimeout;
|
|
34257
34286
|
const sessions = /* @__PURE__ */ new Map();
|
|
34258
34287
|
function canAttach() {
|
|
34259
34288
|
return true;
|
|
@@ -34263,10 +34292,6 @@ function createTerminalSessionManager(deps) {
|
|
|
34263
34292
|
if (session.activeSocket && session.activeSocket !== socket) {
|
|
34264
34293
|
session.activeSocket.close(4e3, "terminal_replaced");
|
|
34265
34294
|
}
|
|
34266
|
-
if (session.graceTimer) {
|
|
34267
|
-
clearTimeoutImpl(session.graceTimer);
|
|
34268
|
-
session.graceTimer = null;
|
|
34269
|
-
}
|
|
34270
34295
|
session.activeSocket = socket;
|
|
34271
34296
|
session.pty.resize(session.cols, session.rows);
|
|
34272
34297
|
replayScrollback(session, socket);
|
|
@@ -34298,7 +34323,6 @@ function createTerminalSessionManager(deps) {
|
|
|
34298
34323
|
disposables: [],
|
|
34299
34324
|
scrollback: [],
|
|
34300
34325
|
activeSocket: null,
|
|
34301
|
-
graceTimer: null,
|
|
34302
34326
|
cols: DEFAULT_COLS,
|
|
34303
34327
|
rows: DEFAULT_ROWS
|
|
34304
34328
|
};
|
|
@@ -34338,7 +34362,6 @@ function createTerminalSessionManager(deps) {
|
|
|
34338
34362
|
function detachSocket(session, socket) {
|
|
34339
34363
|
if (session.activeSocket !== socket) return;
|
|
34340
34364
|
session.activeSocket = null;
|
|
34341
|
-
session.graceTimer = setTimeoutImpl(() => removeSession(session), graceMs);
|
|
34342
34365
|
}
|
|
34343
34366
|
function replayScrollback(session, socket) {
|
|
34344
34367
|
for (const chunk of session.scrollback) {
|
|
@@ -34354,10 +34377,6 @@ function createTerminalSessionManager(deps) {
|
|
|
34354
34377
|
}
|
|
34355
34378
|
function killSession(session, options = {}) {
|
|
34356
34379
|
const killPty = options.killPty ?? true;
|
|
34357
|
-
if (session.graceTimer) {
|
|
34358
|
-
clearTimeoutImpl(session.graceTimer);
|
|
34359
|
-
session.graceTimer = null;
|
|
34360
|
-
}
|
|
34361
34380
|
session.activeSocket?.close(4001, "terminal_closed");
|
|
34362
34381
|
session.activeSocket = null;
|
|
34363
34382
|
for (const disposable of session.disposables) disposable.dispose();
|
|
@@ -34499,7 +34518,7 @@ var MAX_BODY_BYTES = 1024 * 1024;
|
|
|
34499
34518
|
function createConsoleServer(deps = {}) {
|
|
34500
34519
|
const host = deps.host ?? DEFAULT_HOST;
|
|
34501
34520
|
const port = deps.port ?? DEFAULT_PORT;
|
|
34502
|
-
const version2 = deps.version ?? (
|
|
34521
|
+
const version2 = deps.version ?? readFleetConsoleRelease().version;
|
|
34503
34522
|
const channel = readConsoleChannel();
|
|
34504
34523
|
const carrierRegistry = createCarrierRegistry();
|
|
34505
34524
|
registerDefaultCarriers(carrierRegistry);
|
|
@@ -34519,7 +34538,6 @@ function createConsoleServer(deps = {}) {
|
|
|
34519
34538
|
const terminalSessions = createTerminalSessionManager({
|
|
34520
34539
|
launch: deps.terminalLaunch ?? createDefaultTerminalLaunchResolver(),
|
|
34521
34540
|
startShell: deps.terminalStartShell,
|
|
34522
|
-
graceMs: deps.terminalGraceMs,
|
|
34523
34541
|
maxSessions: deps.maxTerminalSessions,
|
|
34524
34542
|
// PTY가 종료되면(예: fleet-cli 종료) 콘솔 세션 목록에서도 제거해 잔존/재실행을 막는다.
|
|
34525
34543
|
onSessionExit: (sessionId) => observability.removeTerminalSession(sessionId)
|
|
@@ -34580,7 +34598,7 @@ function createConsoleServer(deps = {}) {
|
|
|
34580
34598
|
}
|
|
34581
34599
|
const terminalSessionItemMatch = pathname.match(/^\/terminal\/sessions\/([^/]+)$/);
|
|
34582
34600
|
if (terminalSessionItemMatch) {
|
|
34583
|
-
handleTerminalSessionItem(req, res, decodeURIComponent(terminalSessionItemMatch[1] ?? ""));
|
|
34601
|
+
runAsyncHandler(handleTerminalSessionItem(req, res, decodeURIComponent(terminalSessionItemMatch[1] ?? "")), res);
|
|
34584
34602
|
return;
|
|
34585
34603
|
}
|
|
34586
34604
|
if (pathname === "/observer/theaters") {
|
|
@@ -34776,8 +34794,8 @@ function createConsoleServer(deps = {}) {
|
|
|
34776
34794
|
}
|
|
34777
34795
|
await createTerminalSessionForCwd(cwd, res);
|
|
34778
34796
|
}
|
|
34779
|
-
function handleTerminalSessionItem(req, res, sessionId) {
|
|
34780
|
-
if (req.method !== "DELETE") {
|
|
34797
|
+
async function handleTerminalSessionItem(req, res, sessionId) {
|
|
34798
|
+
if (req.method !== "DELETE" && req.method !== "PATCH") {
|
|
34781
34799
|
writeJson(res, 405, { error: "Method not allowed" });
|
|
34782
34800
|
return;
|
|
34783
34801
|
}
|
|
@@ -34785,6 +34803,21 @@ function createConsoleServer(deps = {}) {
|
|
|
34785
34803
|
writeJson(res, 401, { error: "unauthorized" });
|
|
34786
34804
|
return;
|
|
34787
34805
|
}
|
|
34806
|
+
if (req.method === "PATCH") {
|
|
34807
|
+
const body = await readJsonBody(req);
|
|
34808
|
+
if (!body || body.label !== void 0 && typeof body.label !== "string") {
|
|
34809
|
+
writeJson(res, 400, { error: "invalid_session_label" });
|
|
34810
|
+
return;
|
|
34811
|
+
}
|
|
34812
|
+
const updated = observability.renameTerminalSession(sessionId, body.label ?? "");
|
|
34813
|
+
if (!updated) {
|
|
34814
|
+
writeJson(res, 404, { error: "session_not_found" });
|
|
34815
|
+
return;
|
|
34816
|
+
}
|
|
34817
|
+
observability.notifySessionUpdated(updated);
|
|
34818
|
+
writeJson(res, 200, updated);
|
|
34819
|
+
return;
|
|
34820
|
+
}
|
|
34788
34821
|
terminalSessions.terminate(sessionId);
|
|
34789
34822
|
observability.removeTerminalSession(sessionId);
|
|
34790
34823
|
writeJson(res, 200, { ok: true });
|
package/dist/cli.mjs
CHANGED
|
@@ -33482,6 +33482,10 @@ function writeAggregateObserverEvents(req, res, workspaces, store2, resolveWorks
|
|
|
33482
33482
|
}
|
|
33483
33483
|
const unsubscribers = options.subscribeAll ? [
|
|
33484
33484
|
store2.subscribeAll((event) => {
|
|
33485
|
+
if (isSessionUpdatedEvent(event)) {
|
|
33486
|
+
writeEvent(res, 0, event.type, { session: event.session });
|
|
33487
|
+
return;
|
|
33488
|
+
}
|
|
33485
33489
|
writeEvent(res, event.id, event.type, { tenant: resolvedWorkspaceSnapshot(resolveWorkspace, event.tenantId), event });
|
|
33486
33490
|
})
|
|
33487
33491
|
] : workspaces.map(
|
|
@@ -33504,6 +33508,9 @@ function writeEvent(res, id, event, data) {
|
|
|
33504
33508
|
|
|
33505
33509
|
`);
|
|
33506
33510
|
}
|
|
33511
|
+
function isSessionUpdatedEvent(event) {
|
|
33512
|
+
return event.type === "session:updated" && "session" in event;
|
|
33513
|
+
}
|
|
33507
33514
|
function workspaceSnapshot(workspace) {
|
|
33508
33515
|
return {
|
|
33509
33516
|
tenantId: workspace.tenantId,
|
|
@@ -33539,6 +33546,7 @@ function createConsoleObservabilityStore(deps = {}) {
|
|
|
33539
33546
|
const truncationByTenant = /* @__PURE__ */ new Map();
|
|
33540
33547
|
const jobsByTenant = /* @__PURE__ */ new Map();
|
|
33541
33548
|
const terminalSessionsById = /* @__PURE__ */ new Map();
|
|
33549
|
+
const terminalSequenceByTheater = /* @__PURE__ */ new Map();
|
|
33542
33550
|
const listenersByTenant = /* @__PURE__ */ new Map();
|
|
33543
33551
|
const allListeners = /* @__PURE__ */ new Set();
|
|
33544
33552
|
let nextObservedId = 1;
|
|
@@ -33702,13 +33710,18 @@ function createConsoleObservabilityStore(deps = {}) {
|
|
|
33702
33710
|
function createPendingTerminalSession(input) {
|
|
33703
33711
|
if (!path9__default.isAbsolute(input.cwd)) throw new Error("Terminal session cwd must be absolute");
|
|
33704
33712
|
const createdAt = input.createdAt ?? now();
|
|
33713
|
+
const canonicalCwd = canonicalizeTheaterPathSync(input.cwd);
|
|
33714
|
+
const theaterId = workspaceHash(canonicalCwd);
|
|
33715
|
+
const sequence = (terminalSequenceByTheater.get(theaterId) ?? 0) + 1;
|
|
33716
|
+
terminalSequenceByTheater.set(theaterId, sequence);
|
|
33705
33717
|
const state = {
|
|
33706
33718
|
sessionId: input.sessionId,
|
|
33707
33719
|
cwd: input.cwd,
|
|
33708
|
-
canonicalCwd
|
|
33720
|
+
canonicalCwd,
|
|
33709
33721
|
cwdLabel: path9__default.basename(input.cwd) || input.cwd,
|
|
33722
|
+
sequence,
|
|
33710
33723
|
createdAt,
|
|
33711
|
-
theaterId
|
|
33724
|
+
theaterId,
|
|
33712
33725
|
terminalSessionId: input.sessionId,
|
|
33713
33726
|
status: "starting"
|
|
33714
33727
|
};
|
|
@@ -33724,6 +33737,21 @@ function createConsoleObservabilityStore(deps = {}) {
|
|
|
33724
33737
|
session.status = status;
|
|
33725
33738
|
return toTerminalSessionInfo(session);
|
|
33726
33739
|
}
|
|
33740
|
+
function renameTerminalSession(sessionId, rawLabel) {
|
|
33741
|
+
const session = terminalSessionsById.get(sessionId);
|
|
33742
|
+
if (!session) return null;
|
|
33743
|
+
const label = rawLabel.trim().slice(0, 200);
|
|
33744
|
+
if (label.length === 0) {
|
|
33745
|
+
delete session.label;
|
|
33746
|
+
} else {
|
|
33747
|
+
session.label = label;
|
|
33748
|
+
}
|
|
33749
|
+
return toTerminalSessionInfo(session);
|
|
33750
|
+
}
|
|
33751
|
+
function notifySessionUpdated(session) {
|
|
33752
|
+
const event = { type: "session:updated", session };
|
|
33753
|
+
for (const listener of allListeners) listener(event);
|
|
33754
|
+
}
|
|
33727
33755
|
function removeTerminalSession(sessionId) {
|
|
33728
33756
|
return terminalSessionsById.delete(sessionId);
|
|
33729
33757
|
}
|
|
@@ -33735,6 +33763,7 @@ function createConsoleObservabilityStore(deps = {}) {
|
|
|
33735
33763
|
truncationByTenant.clear();
|
|
33736
33764
|
jobsByTenant.clear();
|
|
33737
33765
|
terminalSessionsById.clear();
|
|
33766
|
+
terminalSequenceByTheater.clear();
|
|
33738
33767
|
listenersByTenant.clear();
|
|
33739
33768
|
allListeners.clear();
|
|
33740
33769
|
}
|
|
@@ -33754,6 +33783,8 @@ function createConsoleObservabilityStore(deps = {}) {
|
|
|
33754
33783
|
pushEvents,
|
|
33755
33784
|
register,
|
|
33756
33785
|
createPendingTerminalSession,
|
|
33786
|
+
notifySessionUpdated,
|
|
33787
|
+
renameTerminalSession,
|
|
33757
33788
|
subscribe,
|
|
33758
33789
|
subscribeAll,
|
|
33759
33790
|
updateTerminalSessionStatus,
|
|
@@ -33835,6 +33866,8 @@ function toTerminalSessionInfo(state) {
|
|
|
33835
33866
|
sessionId: state.sessionId,
|
|
33836
33867
|
terminalSessionId: state.terminalSessionId,
|
|
33837
33868
|
cwdLabel: state.cwdLabel,
|
|
33869
|
+
sequence: state.sequence,
|
|
33870
|
+
label: state.label,
|
|
33838
33871
|
status: state.status,
|
|
33839
33872
|
createdAt: state.createdAt,
|
|
33840
33873
|
theaterId: state.theaterId,
|
|
@@ -34245,15 +34278,11 @@ function buildShellLaunchEnv(env) {
|
|
|
34245
34278
|
// src/terminal/session-manager.ts
|
|
34246
34279
|
var DEFAULT_COLS = 80;
|
|
34247
34280
|
var DEFAULT_ROWS = 24;
|
|
34248
|
-
var DEFAULT_GRACE_MS = 18e4;
|
|
34249
34281
|
var DEFAULT_SCROLLBACK_LIMIT = 512;
|
|
34250
34282
|
var WS_OPEN_STATE = 1;
|
|
34251
34283
|
function createTerminalSessionManager(deps) {
|
|
34252
34284
|
const startShell = deps.startShell ?? startTerminalShell;
|
|
34253
|
-
const graceMs = deps.graceMs ?? DEFAULT_GRACE_MS;
|
|
34254
34285
|
const scrollbackLimit = deps.scrollbackLimit ?? DEFAULT_SCROLLBACK_LIMIT;
|
|
34255
|
-
const setTimeoutImpl = deps.setTimeout ?? setTimeout;
|
|
34256
|
-
const clearTimeoutImpl = deps.clearTimeout ?? clearTimeout;
|
|
34257
34286
|
const sessions = /* @__PURE__ */ new Map();
|
|
34258
34287
|
function canAttach() {
|
|
34259
34288
|
return true;
|
|
@@ -34263,10 +34292,6 @@ function createTerminalSessionManager(deps) {
|
|
|
34263
34292
|
if (session.activeSocket && session.activeSocket !== socket) {
|
|
34264
34293
|
session.activeSocket.close(4e3, "terminal_replaced");
|
|
34265
34294
|
}
|
|
34266
|
-
if (session.graceTimer) {
|
|
34267
|
-
clearTimeoutImpl(session.graceTimer);
|
|
34268
|
-
session.graceTimer = null;
|
|
34269
|
-
}
|
|
34270
34295
|
session.activeSocket = socket;
|
|
34271
34296
|
session.pty.resize(session.cols, session.rows);
|
|
34272
34297
|
replayScrollback(session, socket);
|
|
@@ -34298,7 +34323,6 @@ function createTerminalSessionManager(deps) {
|
|
|
34298
34323
|
disposables: [],
|
|
34299
34324
|
scrollback: [],
|
|
34300
34325
|
activeSocket: null,
|
|
34301
|
-
graceTimer: null,
|
|
34302
34326
|
cols: DEFAULT_COLS,
|
|
34303
34327
|
rows: DEFAULT_ROWS
|
|
34304
34328
|
};
|
|
@@ -34338,7 +34362,6 @@ function createTerminalSessionManager(deps) {
|
|
|
34338
34362
|
function detachSocket(session, socket) {
|
|
34339
34363
|
if (session.activeSocket !== socket) return;
|
|
34340
34364
|
session.activeSocket = null;
|
|
34341
|
-
session.graceTimer = setTimeoutImpl(() => removeSession(session), graceMs);
|
|
34342
34365
|
}
|
|
34343
34366
|
function replayScrollback(session, socket) {
|
|
34344
34367
|
for (const chunk of session.scrollback) {
|
|
@@ -34354,10 +34377,6 @@ function createTerminalSessionManager(deps) {
|
|
|
34354
34377
|
}
|
|
34355
34378
|
function killSession(session, options = {}) {
|
|
34356
34379
|
const killPty = options.killPty ?? true;
|
|
34357
|
-
if (session.graceTimer) {
|
|
34358
|
-
clearTimeoutImpl(session.graceTimer);
|
|
34359
|
-
session.graceTimer = null;
|
|
34360
|
-
}
|
|
34361
34380
|
session.activeSocket?.close(4001, "terminal_closed");
|
|
34362
34381
|
session.activeSocket = null;
|
|
34363
34382
|
for (const disposable of session.disposables) disposable.dispose();
|
|
@@ -34499,7 +34518,7 @@ var MAX_BODY_BYTES = 1024 * 1024;
|
|
|
34499
34518
|
function createConsoleServer(deps = {}) {
|
|
34500
34519
|
const host = deps.host ?? DEFAULT_HOST;
|
|
34501
34520
|
const port = deps.port ?? DEFAULT_PORT;
|
|
34502
|
-
const version2 = deps.version ?? (
|
|
34521
|
+
const version2 = deps.version ?? readFleetConsoleRelease().version;
|
|
34503
34522
|
const channel = readConsoleChannel();
|
|
34504
34523
|
const carrierRegistry = createCarrierRegistry();
|
|
34505
34524
|
registerDefaultCarriers(carrierRegistry);
|
|
@@ -34519,7 +34538,6 @@ function createConsoleServer(deps = {}) {
|
|
|
34519
34538
|
const terminalSessions = createTerminalSessionManager({
|
|
34520
34539
|
launch: deps.terminalLaunch ?? createDefaultTerminalLaunchResolver(),
|
|
34521
34540
|
startShell: deps.terminalStartShell,
|
|
34522
|
-
graceMs: deps.terminalGraceMs,
|
|
34523
34541
|
maxSessions: deps.maxTerminalSessions,
|
|
34524
34542
|
// PTY가 종료되면(예: fleet-cli 종료) 콘솔 세션 목록에서도 제거해 잔존/재실행을 막는다.
|
|
34525
34543
|
onSessionExit: (sessionId) => observability.removeTerminalSession(sessionId)
|
|
@@ -34580,7 +34598,7 @@ function createConsoleServer(deps = {}) {
|
|
|
34580
34598
|
}
|
|
34581
34599
|
const terminalSessionItemMatch = pathname.match(/^\/terminal\/sessions\/([^/]+)$/);
|
|
34582
34600
|
if (terminalSessionItemMatch) {
|
|
34583
|
-
handleTerminalSessionItem(req, res, decodeURIComponent(terminalSessionItemMatch[1] ?? ""));
|
|
34601
|
+
runAsyncHandler(handleTerminalSessionItem(req, res, decodeURIComponent(terminalSessionItemMatch[1] ?? "")), res);
|
|
34584
34602
|
return;
|
|
34585
34603
|
}
|
|
34586
34604
|
if (pathname === "/observer/theaters") {
|
|
@@ -34776,8 +34794,8 @@ function createConsoleServer(deps = {}) {
|
|
|
34776
34794
|
}
|
|
34777
34795
|
await createTerminalSessionForCwd(cwd, res);
|
|
34778
34796
|
}
|
|
34779
|
-
function handleTerminalSessionItem(req, res, sessionId) {
|
|
34780
|
-
if (req.method !== "DELETE") {
|
|
34797
|
+
async function handleTerminalSessionItem(req, res, sessionId) {
|
|
34798
|
+
if (req.method !== "DELETE" && req.method !== "PATCH") {
|
|
34781
34799
|
writeJson(res, 405, { error: "Method not allowed" });
|
|
34782
34800
|
return;
|
|
34783
34801
|
}
|
|
@@ -34785,6 +34803,21 @@ function createConsoleServer(deps = {}) {
|
|
|
34785
34803
|
writeJson(res, 401, { error: "unauthorized" });
|
|
34786
34804
|
return;
|
|
34787
34805
|
}
|
|
34806
|
+
if (req.method === "PATCH") {
|
|
34807
|
+
const body = await readJsonBody(req);
|
|
34808
|
+
if (!body || body.label !== void 0 && typeof body.label !== "string") {
|
|
34809
|
+
writeJson(res, 400, { error: "invalid_session_label" });
|
|
34810
|
+
return;
|
|
34811
|
+
}
|
|
34812
|
+
const updated = observability.renameTerminalSession(sessionId, body.label ?? "");
|
|
34813
|
+
if (!updated) {
|
|
34814
|
+
writeJson(res, 404, { error: "session_not_found" });
|
|
34815
|
+
return;
|
|
34816
|
+
}
|
|
34817
|
+
observability.notifySessionUpdated(updated);
|
|
34818
|
+
writeJson(res, 200, updated);
|
|
34819
|
+
return;
|
|
34820
|
+
}
|
|
34788
34821
|
terminalSessions.terminate(sessionId);
|
|
34789
34822
|
observability.removeTerminalSession(sessionId);
|
|
34790
34823
|
writeJson(res, 200, { ok: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aW as L,bs as ln,aG as A,aU as P,aF as W,bt as gn,bu as dn,bv as hn,bw as z,bx as pn,bn as An,by as m,aX as N,b0 as U,b3 as T,bz as _n,a_ as on,bA as wn,bq as On,aH as V,bo as vn,bB as I}from"./mermaid.core-
|
|
1
|
+
import{aW as L,bs as ln,aG as A,aU as P,aF as W,bt as gn,bu as dn,bv as hn,bw as z,bx as pn,bn as An,by as m,aX as N,b0 as U,b3 as T,bz as _n,a_ as on,bA as wn,bq as On,aH as V,bo as vn,bB as I}from"./mermaid.core-DgeiljBl.js";var Pn="[object Symbol]";function x(n){return typeof n=="symbol"||L(n)&&ln(n)==Pn}function yn(n,r){for(var e=-1,i=n==null?0:n.length,f=Array(i);++e<i;)f[e]=r(n[e],e,n);return f}var B=P?P.prototype:void 0,H=B?B.toString:void 0;function k(n){if(typeof n=="string")return n;if(A(n))return yn(n,k)+"";if(x(n))return H?H.call(n):"";var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function bn(){}function En(n,r){for(var e=-1,i=n==null?0:n.length;++e<i&&r(n[e],e,n)!==!1;);return n}function cn(n,r,e,i){for(var f=n.length,t=e+-1;++t<f;)if(r(n[t],t,n))return t;return-1}function Tn(n){return n!==n}function Rn(n,r,e){for(var i=e-1,f=n.length;++i<f;)if(n[i]===r)return i;return-1}function In(n,r,e){return r===r?Rn(n,r,e):cn(n,Tn,e)}function Sn(n,r){var e=n==null?0:n.length;return!!e&&In(n,r,0)>-1}function M(n){return W(n)?gn(n):dn(n)}var Ln=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,xn=/^\w*$/;function $(n,r){if(A(n))return!1;var e=typeof n;return e=="number"||e=="symbol"||e=="boolean"||n==null||x(n)?!0:xn.test(n)||!Ln.test(n)||r!=null&&n in Object(r)}var Mn=500;function $n(n){var r=hn(n,function(i){return e.size===Mn&&e.clear(),i}),e=r.cache;return r}var Cn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Fn=/\\(\\)?/g,Gn=$n(function(n){var r=[];return n.charCodeAt(0)===46&&r.push(""),n.replace(Cn,function(e,i,f,t){r.push(f?t.replace(Fn,"$1"):i||e)}),r});function Dn(n){return n==null?"":k(n)}function j(n,r){return A(n)?n:$(n,r)?[n]:Gn(Dn(n))}function R(n){if(typeof n=="string"||x(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}function nn(n,r){r=j(r,n);for(var e=0,i=r.length;n!=null&&e<i;)n=n[R(r[e++])];return e&&e==i?n:void 0}function mn(n,r,e){var i=n==null?void 0:nn(n,r);return i===void 0?e:i}function rn(n,r){for(var e=-1,i=r.length,f=n.length;++e<i;)n[f+e]=r[e];return n}var K=P?P.isConcatSpreadable:void 0;function Nn(n){return A(n)||z(n)||!!(K&&n&&n[K])}function Kr(n,r,e,i,f){var t=-1,s=n.length;for(e||(e=Nn),f||(f=[]);++t<s;){var u=n[t];e(u)?rn(f,u):i||(f[f.length]=u)}return f}function Un(n,r,e,i){var f=-1,t=n==null?0:n.length;for(i&&t&&(e=n[++f]);++f<t;)e=r(e,n[f],f,n);return e}function en(n,r){for(var e=-1,i=n==null?0:n.length,f=0,t=[];++e<i;){var s=n[e];r(s,e,n)&&(t[f++]=s)}return t}function Bn(){return[]}var Hn=Object.prototype,Kn=Hn.propertyIsEnumerable,q=Object.getOwnPropertySymbols,qn=q?function(n){return n==null?[]:(n=Object(n),en(q(n),function(r){return Kn.call(n,r)}))}:Bn;function Zn(n,r,e){var i=r(n);return A(n)?i:rn(i,e(n))}function Z(n){return Zn(n,M,qn)}var Xn="__lodash_hash_undefined__";function Yn(n){return this.__data__.set(n,Xn),this}function Jn(n){return this.__data__.has(n)}function y(n){var r=-1,e=n==null?0:n.length;for(this.__data__=new pn;++r<e;)this.add(n[r])}y.prototype.add=y.prototype.push=Yn;y.prototype.has=Jn;function Qn(n,r){for(var e=-1,i=n==null?0:n.length;++e<i;)if(r(n[e],e,n))return!0;return!1}function tn(n,r){return n.has(r)}var Wn=1,zn=2;function fn(n,r,e,i,f,t){var s=e&Wn,u=n.length,a=r.length;if(u!=a&&!(s&&a>u))return!1;var h=t.get(n),g=t.get(r);if(h&&g)return h==r&&g==n;var l=-1,d=!0,o=e&zn?new y:void 0;for(t.set(n,r),t.set(r,n);++l<u;){var p=n[l],_=r[l];if(i)var w=s?i(_,p,l,r,n,t):i(p,_,l,n,r,t);if(w!==void 0){if(w)continue;d=!1;break}if(o){if(!Qn(r,function(O,v){if(!tn(o,v)&&(p===O||f(p,O,e,i,t)))return o.push(v)})){d=!1;break}}else if(!(p===_||f(p,_,e,i,t))){d=!1;break}}return t.delete(n),t.delete(r),d}function Vn(n){var r=-1,e=Array(n.size);return n.forEach(function(i,f){e[++r]=[f,i]}),e}function C(n){var r=-1,e=Array(n.size);return n.forEach(function(i){e[++r]=i}),e}var kn=1,jn=2,nr="[object Boolean]",rr="[object Date]",er="[object Error]",ir="[object Map]",tr="[object Number]",fr="[object RegExp]",sr="[object Set]",ur="[object String]",ar="[object Symbol]",lr="[object ArrayBuffer]",gr="[object DataView]",X=P?P.prototype:void 0,S=X?X.valueOf:void 0;function dr(n,r,e,i,f,t,s){switch(e){case gr:if(n.byteLength!=r.byteLength||n.byteOffset!=r.byteOffset)return!1;n=n.buffer,r=r.buffer;case lr:return!(n.byteLength!=r.byteLength||!t(new m(n),new m(r)));case nr:case rr:case tr:return An(+n,+r);case er:return n.name==r.name&&n.message==r.message;case fr:case ur:return n==r+"";case ir:var u=Vn;case sr:var a=i&kn;if(u||(u=C),n.size!=r.size&&!a)return!1;var h=s.get(n);if(h)return h==r;i|=jn,s.set(n,r);var g=fn(u(n),u(r),i,f,t,s);return s.delete(n),g;case ar:if(S)return S.call(n)==S.call(r)}return!1}var hr=1,pr=Object.prototype,Ar=pr.hasOwnProperty;function _r(n,r,e,i,f,t){var s=e&hr,u=Z(n),a=u.length,h=Z(r),g=h.length;if(a!=g&&!s)return!1;for(var l=a;l--;){var d=u[l];if(!(s?d in r:Ar.call(r,d)))return!1}var o=t.get(n),p=t.get(r);if(o&&p)return o==r&&p==n;var _=!0;t.set(n,r),t.set(r,n);for(var w=s;++l<a;){d=u[l];var O=n[d],v=r[d];if(i)var D=s?i(v,O,d,r,n,t):i(O,v,d,n,r,t);if(!(D===void 0?O===v||f(O,v,e,i,t):D)){_=!1;break}w||(w=d=="constructor")}if(_&&!w){var b=n.constructor,E=r.constructor;b!=E&&"constructor"in n&&"constructor"in r&&!(typeof b=="function"&&b instanceof b&&typeof E=="function"&&E instanceof E)&&(_=!1)}return t.delete(n),t.delete(r),_}var or=1,Y="[object Arguments]",J="[object Array]",c="[object Object]",wr=Object.prototype,Q=wr.hasOwnProperty;function Or(n,r,e,i,f,t){var s=A(n),u=A(r),a=s?J:N(n),h=u?J:N(r);a=a==Y?c:a,h=h==Y?c:h;var g=a==c,l=h==c,d=a==h;if(d&&U(n)){if(!U(r))return!1;s=!0,g=!1}if(d&&!g)return t||(t=new T),s||_n(n)?fn(n,r,e,i,f,t):dr(n,r,a,e,i,f,t);if(!(e&or)){var o=g&&Q.call(n,"__wrapped__"),p=l&&Q.call(r,"__wrapped__");if(o||p){var _=o?n.value():n,w=p?r.value():r;return t||(t=new T),f(_,w,e,i,t)}}return d?(t||(t=new T),_r(n,r,e,i,f,t)):!1}function F(n,r,e,i,f){return n===r?!0:n==null||r==null||!L(n)&&!L(r)?n!==n&&r!==r:Or(n,r,e,i,F,f)}var vr=1,Pr=2;function yr(n,r,e,i){var f=e.length,t=f;if(n==null)return!t;for(n=Object(n);f--;){var s=e[f];if(s[2]?s[1]!==n[s[0]]:!(s[0]in n))return!1}for(;++f<t;){s=e[f];var u=s[0],a=n[u],h=s[1];if(s[2]){if(a===void 0&&!(u in n))return!1}else{var g=new T,l;if(!(l===void 0?F(h,a,vr|Pr,i,g):l))return!1}}return!0}function sn(n){return n===n&&!on(n)}function br(n){for(var r=M(n),e=r.length;e--;){var i=r[e],f=n[i];r[e]=[i,f,sn(f)]}return r}function un(n,r){return function(e){return e==null?!1:e[n]===r&&(r!==void 0||n in Object(e))}}function Er(n){var r=br(n);return r.length==1&&r[0][2]?un(r[0][0],r[0][1]):function(e){return e===n||yr(e,n,r)}}function cr(n,r){return n!=null&&r in Object(n)}function Tr(n,r,e){r=j(r,n);for(var i=-1,f=r.length,t=!1;++i<f;){var s=R(r[i]);if(!(t=n!=null&&e(n,s)))break;n=n[s]}return t||++i!=f?t:(f=n==null?0:n.length,!!f&&wn(f)&&On(s,f)&&(A(n)||z(n)))}function Rr(n,r){return n!=null&&Tr(n,r,cr)}var Ir=1,Sr=2;function Lr(n,r){return $(n)&&sn(r)?un(R(n),r):function(e){var i=mn(e,n);return i===void 0&&i===r?Rr(e,n):F(r,i,Ir|Sr)}}function xr(n){return function(r){return r?.[n]}}function Mr(n){return function(r){return nn(r,n)}}function $r(n){return $(n)?xr(R(n)):Mr(n)}function an(n){return typeof n=="function"?n:n==null?V:typeof n=="object"?A(n)?Lr(n[0],n[1]):Er(n):$r(n)}function Cr(n,r){return n&&vn(n,r,M)}function Fr(n,r){return function(e,i){if(e==null)return e;if(!W(e))return n(e,i);for(var f=e.length,t=-1,s=Object(e);++t<f&&i(s[t],t,s)!==!1;);return e}}var G=Fr(Cr);function Gr(n){return typeof n=="function"?n:V}function qr(n,r){var e=A(n)?En:G;return e(n,Gr(r))}function Dr(n,r){var e=[];return G(n,function(i,f,t){r(i,f,t)&&e.push(i)}),e}function Zr(n,r){var e=A(n)?en:Dr;return e(n,an(r))}function mr(n,r,e,i,f){return f(n,function(t,s,u){e=i?(i=!1,t):r(e,t,s,u)}),e}function Xr(n,r,e){var i=A(n)?Un:mr,f=arguments.length<3;return i(n,an(r),e,f,G)}var Nr=1/0,Ur=I&&1/C(new I([,-0]))[1]==Nr?function(n){return new I(n)}:bn,Br=200;function Yr(n,r,e){var i=-1,f=Sn,t=n.length,s=!0,u=[],a=u;if(t>=Br){var h=r?null:Ur(n);if(h)return C(h);s=!1,f=tn,a=new y}else a=r?[]:u;n:for(;++i<t;){var g=n[i],l=r?r(g):g;if(g=g!==0?g:0,s&&l===l){for(var d=a.length;d--;)if(a[d]===l)continue n;r&&a.push(l),u.push(g)}else f(a,l,e)||(a!==u&&a.push(l),u.push(g))}return u}export{G as a,Kr as b,an as c,yn as d,rn as e,Zn as f,qn as g,En as h,x as i,Z as j,M as k,Yr as l,Zr as m,qr as n,cn as o,Gr as p,Cr as q,Xr as r,Bn as s,Tr as t,j as u,R as v,nn as w,Rr as x,Dn as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as ln,a0 as an,a1 as G,a2 as q,a3 as z,a4 as un,a5 as y,a6 as tn,a7 as K,a8 as _,a9 as rn,aa as o,ab as on,ac as sn,ad as fn}from"./mermaid.core-
|
|
1
|
+
import{$ as ln,a0 as an,a1 as G,a2 as q,a3 as z,a4 as un,a5 as y,a6 as tn,a7 as K,a8 as _,a9 as rn,aa as o,ab as on,ac as sn,ad as fn}from"./mermaid.core-DgeiljBl.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,B,a){var O=I-l,i=D-h,n=B-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 V(l,h,I,D,v,A,B){var a=l-I,O=h-D,i=(B?A:-A)/K(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,C=(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)*K(on(0,T*T*R-P*P)),$=(P*g-m*S)/R,j=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=$-C,e=j-t,r=w-C,F=p-t;return x*x+e*e>r*r+F*F&&($=w,j=p),{cx:$,cy:j,x01:-n,y01:-d,x11:$*(v/T-1),y11:j*(v/T-1)}}function hn(){var l=cn,h=yn,I=z(0),D=null,v=gn,A=dn,B=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,C=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(C>tn-y)a.moveTo(s*G(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*G(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=C,S=C,$=B.apply(this,arguments)/2,j=$>y&&(D?+D.apply(this,arguments):K(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if(j>y){var F=sn(j/u*q($)),L=sn(j/s*q($));(P-=F*2)>y?(F*=t?1:-1,R+=F,T-=F):(P=0,R=T=(f+c)/2),(S-=L*2)>y?(L*=t?1:-1,m+=L,g-=L):(S=0,m=g=(f+c)/2)}var H=s*G(m),J=s*q(m),M=u*G(T),N=u*q(T);if(w>y){var Q=s*G(g),U=s*q(g),W=u*G(R),X=u*q(R),E;if(C<an)if(E=pn(H,J,W,X,Q,U,M,N)){var Y=H-E[0],Z=J-E[1],b=Q-E[0],k=U-E[1],nn=1/q(fn((Y*b+Z*k)/(K(Y*Y+Z*Z)*K(b*b+k*k)))/2),en=K(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=V(W,X,H,J,s,x,t),r=V(Q,U,M,N,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(H,J),a.arc(0,0,s,m,g,!t)):a.moveTo(H,J),!(u>y)||!(P>y)?a.lineTo(M,N):p>y?(e=V(M,N,Q,U,u,-p,t),r=V(H,J,W,X,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[G(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:z(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:z(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:z(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:z(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:z(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:z(+n),i):A},i.padAngle=function(n){return arguments.length?(B=typeof n=="function"?n:z(+n),i):B},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
|