@prismshadow/penguin-server 0.2.15 → 0.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/types.d.ts +86 -40
- package/dist/api/types.js +1 -1
- package/dist/auth-token.d.ts +1 -1
- package/dist/auth-token.js +2 -2
- package/dist/{chunk-NVWAYYRX.js → chunk-3SFJKLQU.js} +38 -3
- package/dist/{chunk-NVWAYYRX.js.map → chunk-3SFJKLQU.js.map} +1 -1
- package/dist/{chunk-5Z4UCHDB.js → chunk-D3JNA6ZI.js} +69 -6
- package/dist/chunk-D3JNA6ZI.js.map +1 -0
- package/dist/{chunk-TOOTEEM4.js → chunk-G7GY7PJU.js} +1 -1
- package/dist/chunk-G7GY7PJU.js.map +1 -0
- package/dist/{chunk-JKJXQTHH.js → chunk-W7JNIJ25.js} +1 -1
- package/dist/chunk-W7JNIJ25.js.map +1 -0
- package/dist/index.js +3413 -2500
- package/dist/index.js.map +1 -1
- package/dist/machine-status.js +1 -1
- package/dist/plugin/index.d.ts +28 -20
- package/dist/reset-admin-password.js +3 -4
- package/dist/reset-admin-password.js.map +1 -1
- package/package.json +5 -9
- package/web-dist/assets/{abnfDiagram-VCTEODGH-CKWh4hoA.js → abnfDiagram-VCTEODGH-0AKFiyig.js} +1 -1
- package/web-dist/assets/{addon-clipboard-DxLqat7q.js → addon-clipboard-BovFnNVg.js} +1 -1
- package/web-dist/assets/{addon-fit-B8oPGPkW.js → addon-fit-B1npgxQk.js} +1 -1
- package/web-dist/assets/{addon-web-links-C0W5TcK0.js → addon-web-links-D88QHj7A.js} +1 -1
- package/web-dist/assets/{arc-Dp9EkaAH.js → arc-Beox1Cgf.js} +1 -1
- package/web-dist/assets/{architectureDiagram-5GKGNRK7-BQ3LUcle.js → architectureDiagram-5GKGNRK7-CC1sLMY1.js} +1 -1
- package/web-dist/assets/{blockDiagram-I7D4REHJ-CZzyU0Jj.js → blockDiagram-I7D4REHJ-B8BY1PkZ.js} +1 -1
- package/web-dist/assets/{c4Diagram-7LVT6UL2-Qps3jeAu.js → c4Diagram-7LVT6UL2-yjY0BkxQ.js} +1 -1
- package/web-dist/assets/channel-mfsAVJLE.js +1 -0
- package/web-dist/assets/{chunk-2Q5K7J3B-CQMntzuX.js → chunk-2Q5K7J3B-DdgIvETg.js} +1 -1
- package/web-dist/assets/{chunk-5VM5RSS4-2H2ZJAte.js → chunk-5VM5RSS4-BE38k1Rs.js} +1 -1
- package/web-dist/assets/{chunk-F27PBJKO-B30xCNBv.js → chunk-F27PBJKO-D4YXmaqQ.js} +1 -1
- package/web-dist/assets/{chunk-IMKFNOWR-Cyfx4zDs.js → chunk-IMKFNOWR-CyJFdThc.js} +1 -1
- package/web-dist/assets/{chunk-JWPE2WC7-DADUytTh.js → chunk-JWPE2WC7-BAM_oEUU.js} +1 -1
- package/web-dist/assets/{chunk-POPQ4Y6H-9bjsAxLS.js → chunk-POPQ4Y6H-BP3D0FVi.js} +1 -1
- package/web-dist/assets/{chunk-SVP7TREG-B9xO1VpN.js → chunk-SVP7TREG-Clk8PdKZ.js} +1 -1
- package/web-dist/assets/{chunk-TICWLB2K-B6oDkrep.js → chunk-TICWLB2K-EvWPnEGg.js} +1 -1
- package/web-dist/assets/{chunk-XXDRQBXY-BbU8DR4B.js → chunk-XXDRQBXY-6p5D0UB1.js} +1 -1
- package/web-dist/assets/classDiagram-ZZMXUADV-BPVO1m8i.js +1 -0
- package/web-dist/assets/classDiagram-v2-VYDZK3BY-BPVO1m8i.js +1 -0
- package/web-dist/assets/{cose-bilkent-JH36ORCC-pkbuyec-.js → cose-bilkent-JH36ORCC-bpkI-tLJ.js} +1 -1
- package/web-dist/assets/{cynefin-OW5HDTMX-DU9YQQnc.js → cynefin-OW5HDTMX-srLaqJ4e.js} +1 -1
- package/web-dist/assets/{cynefinDiagram-5FMLGOSQ-3a3XuhQq.js → cynefinDiagram-5FMLGOSQ-BPfpHSPc.js} +1 -1
- package/web-dist/assets/{dagre-GXQ25YYZ-BfZ9C5CZ.js → dagre-GXQ25YYZ-C4fF5-j7.js} +1 -1
- package/web-dist/assets/{diagram-S7CK7UJ4-BoGhVBMn.js → diagram-S7CK7UJ4-BzBLb_9-.js} +1 -1
- package/web-dist/assets/{diagram-UQ7AKVKN-zE67quty.js → diagram-UQ7AKVKN-BJuJ1o_T.js} +1 -1
- package/web-dist/assets/{diagram-VSXAHHWV-NihoXeXm.js → diagram-VSXAHHWV-DFelN9i9.js} +1 -1
- package/web-dist/assets/{diagram-VX7I27RA-1627np0S.js → diagram-VX7I27RA-BgrEoPyp.js} +1 -1
- package/web-dist/assets/{diagram-Z3DM3KII-Ddg_bUan.js → diagram-Z3DM3KII-C71KiMiX.js} +1 -1
- package/web-dist/assets/{ebnfDiagram-PWID7BFC-CmPUOM4j.js → ebnfDiagram-PWID7BFC-EYteyp1b.js} +1 -1
- package/web-dist/assets/{erDiagram-RLTQ6QDP-DiTnEK72.js → erDiagram-RLTQ6QDP-B6n6-sz6.js} +1 -1
- package/web-dist/assets/{flowDiagram-HODETNUW-mGQ38tRM.js → flowDiagram-HODETNUW-BtoMTdyT.js} +1 -1
- package/web-dist/assets/{ganttDiagram-EL5Y4UJY-DU7MlzpW.js → ganttDiagram-EL5Y4UJY-CbOAa3vS.js} +1 -1
- package/web-dist/assets/{gitGraphDiagram-WWUBYQGX-CRE_3vjl.js → gitGraphDiagram-WWUBYQGX-B7-8sszH.js} +1 -1
- package/web-dist/assets/{highlighter-CzfXQ6yd.js → highlighter-Bj5l2XH_.js} +2 -2
- package/web-dist/assets/{highlighter-core-B5CvXcEK.js → highlighter-core-CMXoD8ze.js} +1 -1
- package/web-dist/assets/index-BOCqRT4e.css +1 -0
- package/web-dist/assets/index-BrMpjp2s.js +1286 -0
- package/web-dist/assets/{infoDiagram-27XIBGKW-Cdo6Ar-a.js → infoDiagram-27XIBGKW-BBjf6pkP.js} +1 -1
- package/web-dist/assets/{ishikawaDiagram-5VMMS53U-C27pgect.js → ishikawaDiagram-5VMMS53U-BBSvCv45.js} +1 -1
- package/web-dist/assets/{journeyDiagram-3NMN7TZE-CVxtKpLG.js → journeyDiagram-3NMN7TZE-CuHHl5zk.js} +1 -1
- package/web-dist/assets/{kanban-definition-UXKFOSKX-DWA31Da7.js → kanban-definition-UXKFOSKX-DJyP4Myw.js} +1 -1
- package/web-dist/assets/{layout-DWKCU9PO.js → layout-Bqqhdwtt.js} +1 -1
- package/web-dist/assets/{linear-BwCthj_k.js → linear-BZfUSIf8.js} +1 -1
- package/web-dist/assets/{mermaid.core-BcTrmPOv.js → mermaid.core-BlUspEsI.js} +6 -6
- package/web-dist/assets/{mindmap-definition-YA3MSWOX-BLEDhbn1.js → mindmap-definition-YA3MSWOX-BtyMD4wz.js} +1 -1
- package/web-dist/assets/{pegDiagram-XKGWAZYB-CLEM1SDU.js → pegDiagram-XKGWAZYB-BUF_GJ0B.js} +1 -1
- package/web-dist/assets/{pieDiagram-E7YTZNPT-B__g6eF0.js → pieDiagram-E7YTZNPT-nweubbsU.js} +1 -1
- package/web-dist/assets/{quadrantDiagram-AXDQQJYC-C7VQ2LMY.js → quadrantDiagram-AXDQQJYC-B_r4Wkxy.js} +1 -1
- package/web-dist/assets/{railroadDiagram-O6MQD6OU-eWNnzjwS.js → railroadDiagram-O6MQD6OU-Dn7nm0MX.js} +1 -1
- package/web-dist/assets/{requirementDiagram-BXWQKSXE-Bi5qeD4b.js → requirementDiagram-BXWQKSXE-DaagYJ49.js} +1 -1
- package/web-dist/assets/{sankeyDiagram-P5KCCOFB-DG1VOpXX.js → sankeyDiagram-P5KCCOFB-CqEX6H-B.js} +1 -1
- package/web-dist/assets/{sequenceDiagram-WJ2MYXX4-Fhkw73Th.js → sequenceDiagram-WJ2MYXX4-BzLfQO55.js} +1 -1
- package/web-dist/assets/{sizeCapture-INFHLROL-D9E_17SF.js → sizeCapture-INFHLROL-BcUuVH2L.js} +1 -1
- package/web-dist/assets/{stateDiagram-D77RDMKH-Cs5Y0xhW.js → stateDiagram-D77RDMKH-BO3LWLvT.js} +1 -1
- package/web-dist/assets/stateDiagram-v2-MP3YSRHH-B-EuucjM.js +1 -0
- package/web-dist/assets/{swimlanes-42K2YHIH-t-EocvKZ.js → swimlanes-42K2YHIH-etP_hkIB.js} +1 -1
- package/web-dist/assets/swimlanesDiagram-VR7AAH4N-0JbFdDbQ.js +8 -0
- package/web-dist/assets/{timeline-definition-24CTP7MA-CozGCxuA.js → timeline-definition-24CTP7MA-CTLt2XCT.js} +1 -1
- package/web-dist/assets/{vennDiagram-4TSXK5OY-ewU8ycSa.js → vennDiagram-4TSXK5OY-DPO6ZSvH.js} +1 -1
- package/web-dist/assets/{wardleyDiagram-VM6X3IG4-DuAhDu-0.js → wardleyDiagram-VM6X3IG4-DFofGg8b.js} +1 -1
- package/web-dist/assets/{xterm-v5e56GC9.js → xterm-RdyTuaAH.js} +1 -1
- package/web-dist/assets/{xychartDiagram-S5SC5T6Z-BxGuZO23.js → xychartDiagram-S5SC5T6Z-Bgtb34Gu.js} +1 -1
- package/web-dist/index.html +8 -3
- package/web-dist/{workflow-ui.css → workbench-ui.css} +72 -67
- package/dist/benchmark-package.d.ts +0 -39
- package/dist/benchmark-package.js +0 -97
- package/dist/benchmark-package.js.map +0 -1
- package/dist/chunk-54E64LWB.js +0 -63
- package/dist/chunk-54E64LWB.js.map +0 -1
- package/dist/chunk-5Z4UCHDB.js.map +0 -1
- package/dist/chunk-JKJXQTHH.js.map +0 -1
- package/dist/chunk-Q4ON2L6E.js +0 -52
- package/dist/chunk-Q4ON2L6E.js.map +0 -1
- package/dist/chunk-TOOTEEM4.js.map +0 -1
- package/web-dist/assets/channel--PblgLlC.js +0 -1
- package/web-dist/assets/classDiagram-ZZMXUADV-mn8tbuqa.js +0 -1
- package/web-dist/assets/classDiagram-v2-VYDZK3BY-mn8tbuqa.js +0 -1
- package/web-dist/assets/index-BdG4qRyI.js +0 -1275
- package/web-dist/assets/index-W-xYFoIm.css +0 -1
- package/web-dist/assets/stateDiagram-v2-MP3YSRHH-CEM51fAf.js +0 -1
- package/web-dist/assets/swimlanesDiagram-VR7AAH4N-BrR66vrK.js +0 -8
package/dist/machine-status.js
CHANGED
package/dist/plugin/index.d.ts
CHANGED
|
@@ -23,8 +23,10 @@ interface UserRow {
|
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* "desktop" and "setup" may set a password without the old one (theirs is random and was never
|
|
26
|
-
* shown); desktop-only routes open to "desktop" alone. "token" is the local API token's
|
|
27
|
-
*
|
|
26
|
+
* shown); desktop-only routes open to "desktop" alone. "token" is the local API token's
|
|
27
|
+
* authority, whether presented as a Bearer header or exchanged for a Remote cookie.
|
|
28
|
+
* Exchanging the credential must not grant the person's privileges. Anything else reads as
|
|
29
|
+
* "password".
|
|
28
30
|
*/
|
|
29
31
|
type SessionVia = "password" | "desktop" | "setup" | "token";
|
|
30
32
|
|
|
@@ -475,7 +477,7 @@ interface SessionRow {
|
|
|
475
477
|
* the CLI, or adopted from a Trace a legacy CLI-direct run left behind), "org" (opened by
|
|
476
478
|
* the organization runtime — a desk or a ticket session — or spawned as a sub-session of
|
|
477
479
|
* one, which inherits the stamp at registration), "api" (created by an Agent API run — the
|
|
478
|
-
* only rows the API may continue); NULL = legacy row from before the column existed,
|
|
480
|
+
* only rows the API may continue), "workbench" (created by the Workbench host); NULL = legacy row from before the column existed,
|
|
479
481
|
* treated as web. Free text in SQLite, so a new value needs no migration.
|
|
480
482
|
* Provenance that outlives its organization: development mode's list is the one reader
|
|
481
483
|
* that filters on it (through the list's `excludeOrg`), and it hides "org" rows whether or
|
|
@@ -484,7 +486,7 @@ interface SessionRow {
|
|
|
484
486
|
* (runtime/session-sources.ts); `client` is a separate, DB-only axis that meta never
|
|
485
487
|
* records.
|
|
486
488
|
*/
|
|
487
|
-
client?: "web" | "cli" | "org" | "api" | null;
|
|
489
|
+
client?: "web" | "cli" | "org" | "api" | "workbench" | null;
|
|
488
490
|
/** Cache: a Trace record exists (set at task start / adoption / subagent registration; backfilled by list hydration). */
|
|
489
491
|
hasTrace?: boolean;
|
|
490
492
|
/**
|
|
@@ -1079,8 +1081,8 @@ declare class SessionService {
|
|
|
1079
1081
|
/**
|
|
1080
1082
|
* The approval mode a Session created without one starts with. An organization's Session
|
|
1081
1083
|
* keeps `allow-all`: its runtime names the mode it wants, and nobody is there to answer an
|
|
1082
|
-
* ask a preset might bring. The other unattended creators — a scheduled run, a
|
|
1083
|
-
* pass `allow-all` themselves (scheduler.ts,
|
|
1084
|
+
* ask a preset might bring. The other unattended creators — a scheduled run, a workbench —
|
|
1085
|
+
* pass `allow-all` themselves (scheduler.ts, workbenches/service.ts).
|
|
1084
1086
|
*/
|
|
1085
1087
|
private startApproval;
|
|
1086
1088
|
/** A Session's policy: its snapshot, or — for a row from before snapshots — the settings. */
|
|
@@ -1247,6 +1249,7 @@ declare class SessionService {
|
|
|
1247
1249
|
/** The provider group for `modelId`; always paired with modelId, never inferred. */
|
|
1248
1250
|
provider?: string;
|
|
1249
1251
|
workspace?: string;
|
|
1252
|
+
thinkingLevel?: ThinkingLevelName;
|
|
1250
1253
|
approvalMode?: ApprovalMode;
|
|
1251
1254
|
/** The composer's sandbox picks; omitted halves take the server's settings. */
|
|
1252
1255
|
sandbox?: Partial<SessionSandbox>;
|
|
@@ -1266,7 +1269,7 @@ declare class SessionService {
|
|
|
1266
1269
|
* are the only callers that pass them, so no request can claim either provenance for
|
|
1267
1270
|
* itself ("api" is what lets the Agent API continue a Session).
|
|
1268
1271
|
*/
|
|
1269
|
-
client?: "web" | "cli" | "org" | "api";
|
|
1272
|
+
client?: "web" | "cli" | "org" | "api" | "workbench";
|
|
1270
1273
|
}): Promise<SessionInfo>;
|
|
1271
1274
|
/** A new Session's snapshot: the settings, with the creator's picks (checked) on top. */
|
|
1272
1275
|
private snapshotSandbox;
|
|
@@ -1438,9 +1441,9 @@ interface RuntimeSession {
|
|
|
1438
1441
|
skipReconnectWait(): boolean;
|
|
1439
1442
|
/**
|
|
1440
1443
|
* Whether a run with empty input would send anything (core `Session.hasPendingInput`): the
|
|
1441
|
-
*
|
|
1442
|
-
* restart — or a compaction summary waiting for the next run.
|
|
1443
|
-
* it, reading as nothing held.
|
|
1444
|
+
* input of a turn that failed or was stopped, held as carry-over — in process, or rebuilt
|
|
1445
|
+
* from the Trace after a restart — or a compaction summary waiting for the next run.
|
|
1446
|
+
* Optional: test fakes may omit it, reading as nothing held.
|
|
1444
1447
|
*/
|
|
1445
1448
|
hasPendingInput?(): boolean;
|
|
1446
1449
|
/**
|
|
@@ -1860,13 +1863,14 @@ declare class SessionManager {
|
|
|
1860
1863
|
queued: boolean;
|
|
1861
1864
|
}>;
|
|
1862
1865
|
/**
|
|
1863
|
-
* Retry a failed run (`POST /retry`): a Task started with EMPTY input, so core
|
|
1864
|
-
* input of the turn that
|
|
1865
|
-
* up reconnecting
|
|
1866
|
+
* Retry a failed or stopped run (`POST /retry`): a Task started with EMPTY input, so core
|
|
1867
|
+
* sends the input of the turn that did not finish — held as carry-over since the run ended
|
|
1868
|
+
* `fatal`, gave up reconnecting or was stopped by the user, with whatever the model had
|
|
1869
|
+
* already written — and nothing else. No user message is published or recorded, and with no
|
|
1866
1870
|
* Prompt there is no user_prompt consult. Gated like startTask (busy is the same 409) but
|
|
1867
1871
|
* never queued, and refused with 409 `nothing_to_retry` when nothing is held — the user's
|
|
1868
|
-
* next message already resent that input, or no run
|
|
1869
|
-
* once and the client would watch a Task start and stop with nothing sent. Not a person's
|
|
1872
|
+
* next message already resent that input, or no run was cut short — since the run would end
|
|
1873
|
+
* at once and the client would watch a Task start and stop with nothing sent. Not a person's
|
|
1870
1874
|
* input for company mode's hop accounting: the turn it resends was counted, or not, when
|
|
1871
1875
|
* it was first sent.
|
|
1872
1876
|
*/
|
|
@@ -2355,6 +2359,8 @@ interface AgentListItem {
|
|
|
2355
2359
|
vaultKeyCount: number;
|
|
2356
2360
|
/** Number of scheduled tasks (count of .toml files under schedule/, including invalid ones). */
|
|
2357
2361
|
scheduleCount: number;
|
|
2362
|
+
/** Workbench folders with a manifest, including ones with a load error. */
|
|
2363
|
+
workbenchCount: number;
|
|
2358
2364
|
/** Number of installed Skills (count of skills/<name>/ directories that contain a SKILL.md). */
|
|
2359
2365
|
skillCount: number;
|
|
2360
2366
|
/** Number of installed hook packages (hooks/<name>/ directories with a hooks.json). */
|
|
@@ -2372,6 +2378,8 @@ declare class AgentService implements AgentLifecycle {
|
|
|
2372
2378
|
private readonly snapshots;
|
|
2373
2379
|
/** Union of DB index ∪ directory scan; unmanaged directory Agents are backfilled into the DB. */
|
|
2374
2380
|
listAgents(projectId: string): Promise<AgentListItem[]>;
|
|
2381
|
+
/** Count installed folders without compiling or walking their UI/runtime assets. */
|
|
2382
|
+
private workbenchCount;
|
|
2375
2383
|
/**
|
|
2376
2384
|
* Every id `createAgent` refuses as taken, as names only: the index rows and every entry under
|
|
2377
2385
|
* `agents/`. Unlike `listAgents`, this includes a folder with no `system_config.yaml`, and it
|
|
@@ -3320,13 +3328,13 @@ declare abstract class Http {
|
|
|
3320
3328
|
}
|
|
3321
3329
|
interface HttpSlots {
|
|
3322
3330
|
/**
|
|
3323
|
-
* A route group. `auth: "user"`
|
|
3324
|
-
*
|
|
3325
|
-
* code half is the
|
|
3331
|
+
* A route group. `auth: "user"` accepts a cookie or the local API token; `"token"` accepts
|
|
3332
|
+
* only the local API token, without renewing cookies; `"none"` is public. `order` is the
|
|
3333
|
+
* mount position (a stable number, since Hono matches in order). The code half is the Hono app.
|
|
3326
3334
|
*/
|
|
3327
3335
|
routes: Slot<{
|
|
3328
3336
|
prefix: string;
|
|
3329
|
-
auth: "user" | "none";
|
|
3337
|
+
auth: "user" | "token" | "none";
|
|
3330
3338
|
order: number;
|
|
3331
3339
|
}, Opaque<"Hono", Hono<AppEnv>>>;
|
|
3332
3340
|
}
|
|
@@ -3364,7 +3372,7 @@ interface WebShellSlots {
|
|
|
3364
3372
|
renderer: RendererRef;
|
|
3365
3373
|
};
|
|
3366
3374
|
/**
|
|
3367
|
-
* A tab beside a Session's chat. A
|
|
3375
|
+
* A tab beside a Session's chat. A workbench contributes here too, from its own tree, where
|
|
3368
3376
|
* the host publishes this slot under this module's name and scopes the tab to its Agent.
|
|
3369
3377
|
*/
|
|
3370
3378
|
sessionTabs: {
|
|
@@ -2,8 +2,7 @@ import {
|
|
|
2
2
|
ADMIN_USER_ID,
|
|
3
3
|
generateInitialAdminPassword,
|
|
4
4
|
hashPassword
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-Q4ON2L6E.js";
|
|
5
|
+
} from "./chunk-D3JNA6ZI.js";
|
|
7
6
|
import {
|
|
8
7
|
liveServerLock
|
|
9
8
|
} from "./chunk-GOO5VUAB.js";
|
|
@@ -13,10 +12,10 @@ import {
|
|
|
13
12
|
import {
|
|
14
13
|
AuthSessionsRepo,
|
|
15
14
|
UsersRepo
|
|
16
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-G7GY7PJU.js";
|
|
17
16
|
import {
|
|
18
17
|
openDatabase
|
|
19
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-3SFJKLQU.js";
|
|
20
19
|
import "./chunk-B5IP37ZQ.js";
|
|
21
20
|
|
|
22
21
|
// src/reset-admin-password.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/reset-admin-password.ts"],"sourcesContent":["/**\n * Offline rescue for a forgotten admin password — nobody can reset the admin from the web UI,\n * so this does it from the machine that owns the data root (local filesystem access IS the\n * authorization). The account goes back to unclaimed and the next start prints a first-login\n * link, so no plaintext is produced for anyone to write down. Refuses while a server is live,\n * web.db being single-writer. Exported as `@prismshadow/penguin-server/reset-admin-password`\n * so the CLI need not import the package entry, which starts listening.\n */\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { hashPassword } from \"./auth/password.js\";\nimport { ADMIN_USER_ID, generateInitialAdminPassword } from \"./auth/service.js\";\nimport { openDatabase } from \"./db/database.js\";\nimport { UsersRepo } from \"./db/repos/users.js\";\nimport { AuthSessionsRepo } from \"./db/repos/auth-sessions.js\";\nimport { clearInitialAdminPassword } from \"./initial-password.js\";\nimport { liveServerLock } from \"./lock.js\";\nimport type { ServerLock } from \"./lock.js\";\nimport { wire } from \"@prismshadow/penguin-core/kernel\";\n\nexport type ResetAdminPasswordResult =\n /** Refused: a live server owns this data root (stop it first — web.db is single-writer). */\n | { outcome: \"server_running\"; lock: ServerLock }\n /** Nothing to reset: the root has no Web database (the server has never run here). */\n | { outcome: \"no_database\"; dbPath: string }\n /** Nothing to reset: the database exists but the admin was never seeded. */\n | { outcome: \"no_admin\" }\n /** Returned to the unclaimed state: start the server and open the first-login link it prints. */\n | { outcome: \"reset\" };\n\n/** `dbPath` may be elsewhere (PENGUIN_WEB_DB); `root` stays the root, which the sweep needs. */\nexport async function resetAdminPassword(\n root: string,\n dbPath: string = path.join(root, \"web.db\"),\n): Promise<ResetAdminPasswordResult> {\n const lock = await liveServerLock(root);\n if (lock !== null) return { outcome: \"server_running\", lock };\n // Existence check before openDatabase, which would otherwise CREATE an empty database\n // (and the root directory) on a root the server has never used.\n if (!fs.existsSync(dbPath)) return { outcome: \"no_database\", dbPath };\n const db = openDatabase(dbPath);\n try {\n const users = wire(UsersRepo, { db: db });\n if (users.findById(ADMIN_USER_ID) === null) return { outcome: \"no_admin\" };\n // Discarded unread: a value nobody holds cannot be typed, phished, or left in a buffer.\n const password = generateInitialAdminPassword();\n users.updatePassword(ADMIN_USER_ID, await hashPassword(password), true);\n wire(AuthSessionsRepo, { db: db }).deleteByUser(ADMIN_USER_ID);\n clearInitialAdminPassword(root);\n return { outcome: \"reset\" };\n } finally {\n db.close();\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/reset-admin-password.ts"],"sourcesContent":["/**\n * Offline rescue for a forgotten admin password — nobody can reset the admin from the web UI,\n * so this does it from the machine that owns the data root (local filesystem access IS the\n * authorization). The account goes back to unclaimed and the next start prints a first-login\n * link, so no plaintext is produced for anyone to write down. Refuses while a server is live,\n * web.db being single-writer. Exported as `@prismshadow/penguin-server/reset-admin-password`\n * so the CLI need not import the package entry, which starts listening.\n */\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { hashPassword } from \"./auth/password.js\";\nimport { ADMIN_USER_ID, generateInitialAdminPassword } from \"./auth/service.js\";\nimport { openDatabase } from \"./db/database.js\";\nimport { UsersRepo } from \"./db/repos/users.js\";\nimport { AuthSessionsRepo } from \"./db/repos/auth-sessions.js\";\nimport { clearInitialAdminPassword } from \"./initial-password.js\";\nimport { liveServerLock } from \"./lock.js\";\nimport type { ServerLock } from \"./lock.js\";\nimport { wire } from \"@prismshadow/penguin-core/kernel\";\n\nexport type ResetAdminPasswordResult =\n /** Refused: a live server owns this data root (stop it first — web.db is single-writer). */\n | { outcome: \"server_running\"; lock: ServerLock }\n /** Nothing to reset: the root has no Web database (the server has never run here). */\n | { outcome: \"no_database\"; dbPath: string }\n /** Nothing to reset: the database exists but the admin was never seeded. */\n | { outcome: \"no_admin\" }\n /** Returned to the unclaimed state: start the server and open the first-login link it prints. */\n | { outcome: \"reset\" };\n\n/** `dbPath` may be elsewhere (PENGUIN_WEB_DB); `root` stays the root, which the sweep needs. */\nexport async function resetAdminPassword(\n root: string,\n dbPath: string = path.join(root, \"web.db\"),\n): Promise<ResetAdminPasswordResult> {\n const lock = await liveServerLock(root);\n if (lock !== null) return { outcome: \"server_running\", lock };\n // Existence check before openDatabase, which would otherwise CREATE an empty database\n // (and the root directory) on a root the server has never used.\n if (!fs.existsSync(dbPath)) return { outcome: \"no_database\", dbPath };\n const db = openDatabase(dbPath);\n try {\n const users = wire(UsersRepo, { db: db });\n if (users.findById(ADMIN_USER_ID) === null) return { outcome: \"no_admin\" };\n // Discarded unread: a value nobody holds cannot be typed, phished, or left in a buffer.\n const password = generateInitialAdminPassword();\n users.updatePassword(ADMIN_USER_ID, await hashPassword(password), true);\n wire(AuthSessionsRepo, { db: db }).deleteByUser(ADMIN_USER_ID);\n clearInitialAdminPassword(root);\n return { outcome: \"reset\" };\n } finally {\n db.close();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAQA,OAAO,QAAQ;AACf,OAAO,UAAU;AASjB,SAAS,YAAY;AAarB,eAAsB,mBACpB,MACA,SAAiB,KAAK,KAAK,MAAM,QAAQ,GACN;AACnC,QAAM,OAAO,MAAM,eAAe,IAAI;AACtC,MAAI,SAAS,KAAM,QAAO,EAAE,SAAS,kBAAkB,KAAK;AAG5D,MAAI,CAAC,GAAG,WAAW,MAAM,EAAG,QAAO,EAAE,SAAS,eAAe,OAAO;AACpE,QAAM,KAAK,aAAa,MAAM;AAC9B,MAAI;AACF,UAAM,QAAQ,KAAK,WAAW,EAAE,GAAO,CAAC;AACxC,QAAI,MAAM,SAAS,aAAa,MAAM,KAAM,QAAO,EAAE,SAAS,WAAW;AAEzE,UAAM,WAAW,6BAA6B;AAC9C,UAAM,eAAe,eAAe,MAAM,aAAa,QAAQ,GAAG,IAAI;AACtE,SAAK,kBAAkB,EAAE,GAAO,CAAC,EAAE,aAAa,aAAa;AAC7D,8BAA0B,IAAI;AAC9B,WAAO,EAAE,SAAS,QAAQ;AAAA,EAC5B,UAAE;AACA,OAAG,MAAM;AAAA,EACX;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismshadow/penguin-server",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.16",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "PenguinHarness web server: multi-user authentication and authorization, Session execution with SSE streaming, and usage accounting, built on @prismshadow/penguin-core.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -50,10 +50,6 @@
|
|
|
50
50
|
"types": "./dist/secret-file.d.ts",
|
|
51
51
|
"import": "./dist/secret-file.js"
|
|
52
52
|
},
|
|
53
|
-
"./benchmark-package": {
|
|
54
|
-
"types": "./dist/benchmark-package.d.ts",
|
|
55
|
-
"import": "./dist/benchmark-package.js"
|
|
56
|
-
},
|
|
57
53
|
"./plugin": {
|
|
58
54
|
"types": "./dist/plugin/index.d.ts",
|
|
59
55
|
"import": "./dist/plugin/index.js"
|
|
@@ -81,8 +77,8 @@
|
|
|
81
77
|
"unified": "^11.0.5",
|
|
82
78
|
"ws": "^8.18.3",
|
|
83
79
|
"yaml": "^2.5.0",
|
|
84
|
-
"@prismshadow/amsp": "0.2.
|
|
85
|
-
"@prismshadow/penguin-core": "0.2.
|
|
80
|
+
"@prismshadow/amsp": "0.2.16",
|
|
81
|
+
"@prismshadow/penguin-core": "0.2.16"
|
|
86
82
|
},
|
|
87
83
|
"devDependencies": {
|
|
88
84
|
"@types/mdast": "^4.0.4",
|
|
@@ -92,7 +88,7 @@
|
|
|
92
88
|
"tsup": "^8.3.0",
|
|
93
89
|
"tsx": "^4.20.0",
|
|
94
90
|
"vitest": "^3.2.6",
|
|
95
|
-
"@prismshadow/penguin-hmr": "0.2.
|
|
91
|
+
"@prismshadow/penguin-hmr": "0.2.16"
|
|
96
92
|
},
|
|
97
93
|
"files": [
|
|
98
94
|
"dist",
|
|
@@ -103,7 +99,7 @@
|
|
|
103
99
|
"access": "public"
|
|
104
100
|
},
|
|
105
101
|
"scripts": {
|
|
106
|
-
"dev": "node ../../scripts/dev-prebuild.mjs && node ../../scripts/run-with-env.mjs --unset=PENGUIN_CLI_ENTRY PENGUIN_HOME=~/.penguin/dev-data PENGUIN_PROFILE=dev PORT=7368 --
|
|
102
|
+
"dev": "node ../../scripts/dev-prebuild.mjs && node ../../scripts/run-with-env.mjs --unset=PENGUIN_CLI_ENTRY PENGUIN_HOME=~/.penguin/dev-data PENGUIN_PROFILE=dev PORT=7368 -- node ../../scripts/dev-server.mjs src/index.ts",
|
|
107
103
|
"start": "node --disable-warning=ExperimentalWarning dist/index.js",
|
|
108
104
|
"typecheck": "pnpm gen:ifaces && tsc --noEmit -p tsconfig.json",
|
|
109
105
|
"gen:ifaces": "node ../../scripts/gen-ifaces.mjs --project tsconfig.json --out src/ifaces.json",
|
package/web-dist/assets/{abnfDiagram-VCTEODGH-CKWh4hoA.js → abnfDiagram-VCTEODGH-0AKFiyig.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as p,r as u,d as a}from"./chunk-SVP7TREG-
|
|
1
|
+
import{g as p,r as u,d as a}from"./chunk-SVP7TREG-Clk8PdKZ.js";import{p as f}from"./chunk-JWPE2WC7-BAM_oEUU.js";import{_ as n,l as o}from"./mermaid.core-BlUspEsI.js";import{M as c,b as d}from"./cynefin-OW5HDTMX-srLaqJ4e.js";import"./index-BrMpjp2s.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{g as nr}from"./index-
|
|
1
|
+
import{g as nr}from"./index-BrMpjp2s.js";function or(v,F){for(var y=0;y<F.length;y++){const c=F[y];if(typeof c!="string"&&!Array.isArray(c)){for(const f in c)if(f!=="default"&&!(f in v)){const x=Object.getOwnPropertyDescriptor(c,f);x&&Object.defineProperty(v,f,x.get?x:{enumerable:!0,get:()=>c[f]})}}}return Object.freeze(Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}))}var R={exports:{}},Q;function ir(){return Q||(Q=1,(function(v,F){(function(y,c){v.exports=c()})(self,(()=>(()=>{var y={575:function(i,l,s){typeof self<"u"||typeof window<"u"||s.g!==void 0&&s.g,i.exports=(function(){var g,u="3.7.7",t=u,n=typeof Buffer=="function",C=typeof TextDecoder=="function"?new TextDecoder:void 0,B=typeof TextEncoder=="function"?new TextEncoder:void 0,p=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),h=(g={},p.forEach((function(r,e){return g[r]=e})),g),U=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,o=String.fromCharCode.bind(String),D=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(r){return new Uint8Array(Array.prototype.slice.call(r,0))},z=function(r){return r.replace(/=/g,"").replace(/[+\/]/g,(function(e){return e=="+"?"-":"_"}))},Z=function(r){return r.replace(/[^A-Za-z0-9\+\/]/g,"")},$=function(r){for(var e,a,b,m,d="",E=r.length%3,T=0;T<r.length;){if((a=r.charCodeAt(T++))>255||(b=r.charCodeAt(T++))>255||(m=r.charCodeAt(T++))>255)throw new TypeError("invalid character found");d+=p[(e=a<<16|b<<8|m)>>18&63]+p[e>>12&63]+p[e>>6&63]+p[63&e]}return E?d.slice(0,E-3)+"===".substring(E):d},P=typeof btoa=="function"?function(r){return btoa(r)}:n?function(r){return Buffer.from(r,"binary").toString("base64")}:$,O=n?function(r){return Buffer.from(r).toString("base64")}:function(r){for(var e=[],a=0,b=r.length;a<b;a+=4096)e.push(o.apply(null,r.subarray(a,a+4096)));return P(e.join(""))},w=function(r,e){return e===void 0&&(e=!1),e?z(O(r)):O(r)},X=function(r){if(r.length<2)return(e=r.charCodeAt(0))<128?r:e<2048?o(192|e>>>6)+o(128|63&e):o(224|e>>>12&15)+o(128|e>>>6&63)+o(128|63&e);var e=65536+1024*(r.charCodeAt(0)-55296)+(r.charCodeAt(1)-56320);return o(240|e>>>18&7)+o(128|e>>>12&63)+o(128|e>>>6&63)+o(128|63&e)},Y=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,I=function(r){return r.replace(Y,X)},L=n?function(r){return Buffer.from(r,"utf8").toString("base64")}:B?function(r){return O(B.encode(r))}:function(r){return P(I(r))},A=function(r,e){return e===void 0&&(e=!1),e?z(L(r)):L(r)},V=function(r){return A(r,!0)},rr=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,er=function(r){switch(r.length){case 4:var e=((7&r.charCodeAt(0))<<18|(63&r.charCodeAt(1))<<12|(63&r.charCodeAt(2))<<6|63&r.charCodeAt(3))-65536;return o(55296+(e>>>10))+o(56320+(1023&e));case 3:return o((15&r.charCodeAt(0))<<12|(63&r.charCodeAt(1))<<6|63&r.charCodeAt(2));default:return o((31&r.charCodeAt(0))<<6|63&r.charCodeAt(1))}},k=function(r){return r.replace(rr,er)},q=function(r){if(r=r.replace(/\s+/g,""),!U.test(r))throw new TypeError("malformed base64.");r+="==".slice(2-(3&r.length));for(var e,a,b,m="",d=0;d<r.length;)e=h[r.charAt(d++)]<<18|h[r.charAt(d++)]<<12|(a=h[r.charAt(d++)])<<6|(b=h[r.charAt(d++)]),m+=a===64?o(e>>16&255):b===64?o(e>>16&255,e>>8&255):o(e>>16&255,e>>8&255,255&e);return m},j=typeof atob=="function"?function(r){return atob(Z(r))}:n?function(r){return Buffer.from(r,"base64").toString("binary")}:q,M=n?function(r){return D(Buffer.from(r,"base64"))}:function(r){return D(j(r).split("").map((function(e){return e.charCodeAt(0)})))},N=function(r){return M(H(r))},tr=n?function(r){return Buffer.from(r,"base64").toString("utf8")}:C?function(r){return C.decode(M(r))}:function(r){return k(j(r))},H=function(r){return Z(r.replace(/[-_]/g,(function(e){return e=="-"?"+":"/"})))},S=function(r){return tr(H(r))},G=function(r){return{value:r,enumerable:!1,writable:!0,configurable:!0}},J=function(){var r=function(e,a){return Object.defineProperty(String.prototype,e,G(a))};r("fromBase64",(function(){return S(this)})),r("toBase64",(function(e){return A(this,e)})),r("toBase64URI",(function(){return A(this,!0)})),r("toBase64URL",(function(){return A(this,!0)})),r("toUint8Array",(function(){return N(this)}))},K=function(){var r=function(e,a){return Object.defineProperty(Uint8Array.prototype,e,G(a))};r("toBase64",(function(e){return w(this,e)})),r("toBase64URI",(function(){return w(this,!0)})),r("toBase64URL",(function(){return w(this,!0)}))},_={version:u,VERSION:t,atob:j,atobPolyfill:q,btoa:P,btoaPolyfill:$,fromBase64:S,toBase64:A,encode:A,encodeURI:V,encodeURL:V,utob:I,btou:k,decode:S,isValid:function(r){if(typeof r!="string")return!1;var e=r.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},fromUint8Array:w,toUint8Array:N,extendString:J,extendUint8Array:K,extendBuiltins:function(){J(),K()},Base64:{}};return Object.keys(_).forEach((function(r){return _.Base64[r]=_[r]})),_})()}},c={};function f(i){var l=c[i];if(l!==void 0)return l.exports;var s=c[i]={exports:{}};return y[i].call(s.exports,s,s.exports,f),s.exports}f.g=(function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}})();var x={};return(()=>{var i=x;Object.defineProperty(i,"__esModule",{value:!0}),i.Base64=i.BrowserClipboardProvider=i.ClipboardAddon=void 0;const l=f(575);i.ClipboardAddon=class{constructor(u=new g,t=new s){this._base64=u,this._provider=t}activate(u){this._terminal=u,this._disposable=u.parser.registerOscHandler(52,(t=>this._setOrReportClipboard(t)))}dispose(){return this._disposable?.dispose()}_readText(u,t){const n=this._base64.encodeText(t);this._terminal?.input(`\x1B]52;${u};${n}\x07`,!1)}_setOrReportClipboard(u){const t=u.split(";");if(t.length<2)return!0;const n=t[0],C=t[1];if(C==="?"){const h=this._provider.readText(n);return h instanceof Promise?h.then((U=>(this._readText(n,U),!0))):(this._readText(n,h),!0)}let B="";try{B=this._base64.decodeText(C)}catch{}const p=this._provider.writeText(n,B);return!(p instanceof Promise)||p.then((()=>!0))}};class s{async readText(t){return t!=="c"?Promise.resolve(""):navigator.clipboard.readText()}async writeText(t,n){return t!=="c"?Promise.resolve():navigator.clipboard.writeText(n)}}i.BrowserClipboardProvider=s;class g{encodeText(t){return l.Base64.encode(t)}decodeText(t){const n=l.Base64.decode(t);return l.Base64.isValid(t)&&l.Base64.encode(n)===t?n:""}}i.Base64=g})(),x})()))})(R)),R.exports}var W=ir();const ar=nr(W),cr=or({__proto__:null,default:ar},[W]);export{cr as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g}from"./index-
|
|
1
|
+
import{g}from"./index-BrMpjp2s.js";function _(i,s){for(var o=0;o<s.length;o++){const t=s[o];if(typeof t!="string"&&!Array.isArray(t)){for(const e in t)if(e!=="default"&&!(e in i)){const r=Object.getOwnPropertyDescriptor(t,e);r&&Object.defineProperty(i,e,r.get?r:{enumerable:!0,get:()=>t[e]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}var a={exports:{}},d;function y(){return d||(d=1,(function(i,s){(function(o,t){i.exports=t()})(self,(()=>(()=>{var o={};return(()=>{var t=o;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const r=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(r._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core,r=e._renderService.dimensions;if(r.css.cell.width===0||r.css.cell.height===0)return;const c=this._terminal.options.scrollback===0?0:e.viewport.scrollBarWidth,l=window.getComputedStyle(this._terminal.element.parentElement),m=parseInt(l.getPropertyValue("height")),u=Math.max(0,parseInt(l.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),h=m-(parseInt(n.getPropertyValue("padding-top"))+parseInt(n.getPropertyValue("padding-bottom"))),f=u-(parseInt(n.getPropertyValue("padding-right"))+parseInt(n.getPropertyValue("padding-left")))-c;return{cols:Math.max(2,Math.floor(f/r.css.cell.width)),rows:Math.max(1,Math.floor(h/r.css.cell.height))}}}})(),o})()))})(a)),a.exports}var p=y();const w=g(p),x=_({__proto__:null,default:w},[p]);export{x as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as O}from"./index-
|
|
1
|
+
import{g as O}from"./index-BrMpjp2s.js";function j(b,k){for(var _=0;_<k.length;_++){const l=k[_];if(typeof l!="string"&&!Array.isArray(l)){for(const u in l)if(u!=="default"&&!(u in b)){const L=Object.getOwnPropertyDescriptor(l,u);L&&Object.defineProperty(b,u,L.get?L:{enumerable:!0,get:()=>l[u]})}}}return Object.freeze(Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}))}var w={exports:{}},C;function A(){return C||(C=1,(function(b,k){(function(_,l){b.exports=l()})(self,(()=>(()=>{var _={6:(p,d)=>{function h(s){try{const e=new URL(s),t=e.password&&e.username?`${e.protocol}//${e.username}:${e.password}@${e.host}`:e.username?`${e.protocol}//${e.username}@${e.host}`:`${e.protocol}//${e.host}`;return s.toLocaleLowerCase().startsWith(t.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(d,"__esModule",{value:!0}),d.LinkComputer=d.WebLinkProvider=void 0,d.WebLinkProvider=class{constructor(s,e,t,r={}){this._terminal=s,this._regex=e,this._handler=t,this._options=r}provideLinks(s,e){const t=f.computeLink(s,this._regex,this._terminal,this._handler);e(this._addCallbacks(t))}_addCallbacks(s){return s.map((e=>(e.leave=this._options.leave,e.hover=(t,r)=>{if(this._options.hover){const{range:c}=e;this._options.hover(t,r,c)}},e)))}};class f{static computeLink(e,t,r,c){const g=new RegExp(t.source,(t.flags||"")+"g"),[n,o]=f._getWindowedLineStrings(e-1,r),i=n.join("");let a;const x=[];for(;a=g.exec(i);){const v=a[0];if(!h(v))continue;const[m,W]=f._mapStrIdx(r,o,0,a.index),[y,P]=f._mapStrIdx(r,m,W,v.length);if(m===-1||W===-1||y===-1||P===-1)continue;const $={start:{x:W+1,y:m+1},end:{x:P,y:y+1}};x.push({range:$,text:v,activate:c})}return x}static _getWindowedLineStrings(e,t){let r,c=e,g=e,n=0,o="";const i=[];if(r=t.buffer.active.getLine(e)){const a=r.translateToString(!0);if(r.isWrapped&&a[0]!==" "){for(n=0;(r=t.buffer.active.getLine(--c))&&n<2048&&(o=r.translateToString(!0),n+=o.length,i.push(o),r.isWrapped&&o.indexOf(" ")===-1););i.reverse()}for(i.push(a),n=0;(r=t.buffer.active.getLine(++g))&&r.isWrapped&&n<2048&&(o=r.translateToString(!0),n+=o.length,i.push(o),o.indexOf(" ")===-1););}return[i,c]}static _mapStrIdx(e,t,r,c){const g=e.buffer.active,n=g.getNullCell();let o=r;for(;c;){const i=g.getLine(t);if(!i)return[-1,-1];for(let a=o;a<i.length;++a){i.getCell(a,n);const x=n.getChars();if(n.getWidth()&&(c-=x.length||1,a===i.length-1&&x==="")){const v=g.getLine(t+1);v&&v.isWrapped&&(v.getCell(0,n),n.getWidth()===2&&(c+=1))}if(c<0)return[t,a]}t++,o=0}return[t,o]}}d.LinkComputer=f}},l={};function u(p){var d=l[p];if(d!==void 0)return d.exports;var h=l[p]={exports:{}};return _[p](h,h.exports,u),h.exports}var L={};return(()=>{var p=L;Object.defineProperty(p,"__esModule",{value:!0}),p.WebLinksAddon=void 0;const d=u(6),h=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function f(s,e){const t=window.open();if(t){try{t.opener=null}catch{}t.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}p.WebLinksAddon=class{constructor(s=f,e={}){this._handler=s,this._options=e}activate(s){this._terminal=s;const e=this._options,t=e.urlRegex||h;this._linkProvider=this._terminal.registerLinkProvider(new d.WebLinkProvider(this._terminal,t,this._handler,e))}dispose(){this._linkProvider?.dispose()}}})(),L})()))})(w)),w.exports}var S=A();const T=O(S),E=j({__proto__:null,default:T},[S]);export{E as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{H as ln,I as un,J as Q,K as I,L as K,M as an,N as y,O as tn,P as j,Q as _,R as rn,S as o,T as on,V as sn,W as fn}from"./mermaid.core-
|
|
1
|
+
import{H as ln,I as un,J as Q,K as I,L as K,M as an,N as y,O as tn,P as j,Q as _,R as rn,S as o,T as on,V as sn,W as fn}from"./mermaid.core-BlUspEsI.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,q,O,v,R,L,u){var D=q-l,i=O-h,n=L-v,d=u-R,a=d*D-n*i;if(!(a*a<y))return a=(n*(h-R)-d*(l-v))/a,[l+a*D,h+a*i]}function U(l,h,q,O,v,R,L){var u=l-q,D=h-O,i=(L?R:-R)/j(u*u+D*D),n=i*D,d=-i*u,a=l+n,s=h+d,f=q+n,c=O+d,M=(a+f)/2,t=(s+c)/2,m=f-a,g=c-s,A=m*m+g*g,T=v-R,P=a*c-f*s,E=(g<0?-1:1)*j(on(0,T*T*A-P*P)),H=(P*g-m*E)/A,J=(-P*m-g*E)/A,w=(P*g+m*E)/A,p=(-P*m+g*E)/A,x=H-M,e=J-t,r=w-M,N=p-t;return x*x+e*e>r*r+N*N&&(H=w,J=p),{cx:H,cy:J,x01:-n,y01:-d,x11:H*(v/T-1),y11:J*(v/T-1)}}function hn(){var l=cn,h=yn,q=K(0),O=null,v=gn,R=dn,L=mn,u=null,D=ln(i);function i(){var n,d,a=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=R.apply(this,arguments)-an,M=rn(c-f),t=c>f;if(u||(u=n=D()),s<a&&(d=s,s=a,a=d),!(s>y))u.moveTo(0,0);else if(M>tn-y)u.moveTo(s*Q(f),s*I(f)),u.arc(0,0,s,f,c,!t),a>y&&(u.moveTo(a*Q(c),a*I(c)),u.arc(0,0,a,c,f,t));else{var m=f,g=c,A=f,T=c,P=M,E=M,H=L.apply(this,arguments)/2,J=H>y&&(O?+O.apply(this,arguments):j(a*a+s*s)),w=_(rn(s-a)/2,+q.apply(this,arguments)),p=w,x=w,e,r;if(J>y){var N=sn(J/a*I(H)),z=sn(J/s*I(H));(P-=N*2)>y?(N*=t?1:-1,A+=N,T-=N):(P=0,A=T=(f+c)/2),(E-=z*2)>y?(z*=t?1:-1,m+=z,g-=z):(E=0,m=g=(f+c)/2)}var V=s*Q(m),W=s*I(m),B=a*Q(T),C=a*I(T);if(w>y){var F=s*Q(g),G=s*I(g),X=a*Q(A),Y=a*I(A),S;if(M<un)if(S=pn(V,W,X,Y,F,G,B,C)){var Z=V-S[0],$=W-S[1],k=F-S[0],b=G-S[1],nn=1/I(fn((Z*k+$*b)/(j(Z*Z+$*$)*j(k*k+b*b)))/2),en=j(S[0]*S[0]+S[1]*S[1]);p=_(w,(a-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}E>y?x>y?(e=U(X,Y,V,W,s,x,t),r=U(F,G,B,C,s,x,t),u.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?u.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(u.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),u.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),u.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(u.moveTo(V,W),u.arc(0,0,s,m,g,!t)):u.moveTo(V,W),!(a>y)||!(P>y)?u.lineTo(B,C):p>y?(e=U(B,C,F,G,a,-p,t),r=U(V,W,X,Y,a,-p,t),u.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?u.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(u.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),u.arc(0,0,a,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),u.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):u.arc(0,0,a,T,A,t)}if(u.closePath(),n)return u=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +R.apply(this,arguments))/2-un/2;return[Q(d)*n,I(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:K(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:K(+n),i):h},i.cornerRadius=function(n){return arguments.length?(q=typeof n=="function"?n:K(+n),i):q},i.padRadius=function(n){return arguments.length?(O=n==null?null:typeof n=="function"?n:K(+n),i):O},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:K(+n),i):v},i.endAngle=function(n){return arguments.length?(R=typeof n=="function"?n:K(+n),i):R},i.padAngle=function(n){return arguments.length?(L=typeof n=="function"?n:K(+n),i):L},i.context=function(n){return arguments.length?(u=n??null,i):u},i}export{hn as d};
|