pi2dsh 0.12.2 → 0.12.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/README.md +37 -7
- package/README.zh.md +32 -6
- package/dist/{analyzer-CEjVQKXA.mjs → analyzer-2Nx5XYOA.mjs} +2 -2
- package/dist/{analyzer-CEjVQKXA.mjs.map → analyzer-2Nx5XYOA.mjs.map} +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/client.js +139 -0
- package/dist/host.mjs +1 -1
- package/dist/index.d.mts +16 -4
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/{mcp-config-DHkfjdvX.mjs → mcp-config-Cjae0vot.mjs} +167 -108
- package/dist/mcp-config-Cjae0vot.mjs.map +1 -0
- package/dist/{runtime-DsPaznXJ.mjs → runtime-B_Ig28og.mjs} +146 -5
- package/dist/runtime-B_Ig28og.mjs.map +1 -0
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +1 -1
- package/package.json +15 -4
- package/dist/mcp-config-DHkfjdvX.mjs.map +0 -1
- package/dist/runtime-DsPaznXJ.mjs.map +0 -1
package/dist/client.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "pi2dsh",
|
|
3
|
+
factory: (require) => {
|
|
4
|
+
var module = { exports: {} };
|
|
5
|
+
var exports = module.exports;
|
|
6
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
+
let react = require("react");
|
|
8
|
+
//#region src/client.ts
|
|
9
|
+
/** Services this half needs before it can take a seat. */
|
|
10
|
+
const inject = ["slots"];
|
|
11
|
+
const POLL_MS = 1e3;
|
|
12
|
+
const styles = {
|
|
13
|
+
panel: {
|
|
14
|
+
position: "fixed",
|
|
15
|
+
right: "20px",
|
|
16
|
+
bottom: "108px",
|
|
17
|
+
zIndex: 40,
|
|
18
|
+
width: "340px",
|
|
19
|
+
maxHeight: "48vh",
|
|
20
|
+
display: "flex",
|
|
21
|
+
flexDirection: "column",
|
|
22
|
+
pointerEvents: "auto",
|
|
23
|
+
overflow: "hidden",
|
|
24
|
+
borderRadius: "12px",
|
|
25
|
+
border: "1px solid rgba(120,120,130,0.28)",
|
|
26
|
+
background: "var(--dsh-color-bg-elevated, rgba(24,24,27,0.96))",
|
|
27
|
+
color: "var(--dsh-color-text, #fafafa)",
|
|
28
|
+
boxShadow: "0 12px 32px rgba(0,0,0,0.32)",
|
|
29
|
+
font: "400 13px/1.55 system-ui, -apple-system, sans-serif"
|
|
30
|
+
},
|
|
31
|
+
header: {
|
|
32
|
+
display: "flex",
|
|
33
|
+
alignItems: "center",
|
|
34
|
+
justifyContent: "space-between",
|
|
35
|
+
gap: "8px",
|
|
36
|
+
padding: "10px 12px",
|
|
37
|
+
borderBottom: "1px solid rgba(120,120,130,0.22)",
|
|
38
|
+
fontWeight: 500,
|
|
39
|
+
fontSize: "12px",
|
|
40
|
+
letterSpacing: "0.01em"
|
|
41
|
+
},
|
|
42
|
+
badge: {
|
|
43
|
+
opacity: .6,
|
|
44
|
+
fontWeight: 400
|
|
45
|
+
},
|
|
46
|
+
body: {
|
|
47
|
+
padding: "10px 12px",
|
|
48
|
+
overflowY: "auto",
|
|
49
|
+
display: "flex",
|
|
50
|
+
flexDirection: "column",
|
|
51
|
+
gap: "10px"
|
|
52
|
+
},
|
|
53
|
+
role: {
|
|
54
|
+
fontSize: "11px",
|
|
55
|
+
textTransform: "uppercase",
|
|
56
|
+
letterSpacing: "0.06em",
|
|
57
|
+
opacity: .55
|
|
58
|
+
},
|
|
59
|
+
text: {
|
|
60
|
+
whiteSpace: "pre-wrap",
|
|
61
|
+
wordBreak: "break-word"
|
|
62
|
+
},
|
|
63
|
+
close: {
|
|
64
|
+
cursor: "pointer",
|
|
65
|
+
opacity: .55,
|
|
66
|
+
background: "none",
|
|
67
|
+
border: "none",
|
|
68
|
+
color: "inherit",
|
|
69
|
+
font: "inherit"
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* The panel: one card per live side thread of the session on screen.
|
|
74
|
+
*
|
|
75
|
+
* The current session comes from the framework's own global seat
|
|
76
|
+
* (`useSessions().current`), not from the address bar — the app keeps the open
|
|
77
|
+
* conversation in its state, so the URL never names it.
|
|
78
|
+
* @param props - the global standard kit every root slot component receives.
|
|
79
|
+
*/
|
|
80
|
+
function SidePanel({ useSessions }) {
|
|
81
|
+
const session = useSessions((state) => state.current);
|
|
82
|
+
const [threads, setThreads] = (0, react.useState)([]);
|
|
83
|
+
const [dismissed, setDismissed] = (0, react.useState)([]);
|
|
84
|
+
(0, react.useEffect)(() => {
|
|
85
|
+
let alive = true;
|
|
86
|
+
const poll = async () => {
|
|
87
|
+
if (session === void 0 || session === "") {
|
|
88
|
+
if (alive) setThreads([]);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
const response = await fetch(`/pi2dsh/side-panel?session=${encodeURIComponent(session)}`);
|
|
93
|
+
if (!response.ok) return;
|
|
94
|
+
const payload = await response.json();
|
|
95
|
+
if (alive) setThreads(Array.isArray(payload.threads) ? payload.threads : []);
|
|
96
|
+
} catch {}
|
|
97
|
+
};
|
|
98
|
+
poll();
|
|
99
|
+
const timer = window.setInterval(() => {
|
|
100
|
+
poll();
|
|
101
|
+
}, POLL_MS);
|
|
102
|
+
return () => {
|
|
103
|
+
alive = false;
|
|
104
|
+
window.clearInterval(timer);
|
|
105
|
+
};
|
|
106
|
+
}, [session]);
|
|
107
|
+
const shown = threads.filter((thread) => !dismissed.includes(thread.id));
|
|
108
|
+
if (shown.length === 0) return null;
|
|
109
|
+
return (0, react.createElement)("div", {
|
|
110
|
+
"data-pi2dsh": "side-panel",
|
|
111
|
+
style: styles.panel
|
|
112
|
+
}, ...shown.map((thread) => (0, react.createElement)("div", {
|
|
113
|
+
key: thread.id,
|
|
114
|
+
style: { display: "contents" }
|
|
115
|
+
}, (0, react.createElement)("div", { style: styles.header }, (0, react.createElement)("span", null, thread.label), (0, react.createElement)("span", { style: styles.badge }, thread.running ? "running" : `${thread.messages.length} msg`), (0, react.createElement)("button", {
|
|
116
|
+
style: styles.close,
|
|
117
|
+
title: "Hide",
|
|
118
|
+
onClick: () => setDismissed((list) => [...list, thread.id])
|
|
119
|
+
}, "×")), (0, react.createElement)("div", { style: styles.body }, ...thread.messages.map((message, index) => (0, react.createElement)("div", { key: index }, (0, react.createElement)("div", { style: styles.role }, message.role), (0, react.createElement)("div", { style: styles.text }, message.text)))))));
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Client plugin body: take the frame-wide overlay seat.
|
|
123
|
+
* @param ctx - client root context.
|
|
124
|
+
*/
|
|
125
|
+
function apply(ctx) {
|
|
126
|
+
ctx.inject(["slots"], (scope) => {
|
|
127
|
+
scope.slots.inject("shell.overlay", () => scope.slots.register({
|
|
128
|
+
name: "shell.overlay",
|
|
129
|
+
id: "pi2dsh-side-panel",
|
|
130
|
+
order: 1
|
|
131
|
+
}, SidePanel));
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
135
|
+
exports.apply = apply;
|
|
136
|
+
exports.inject = inject;
|
|
137
|
+
return module.exports;
|
|
138
|
+
}
|
|
139
|
+
});
|
package/dist/host.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { r as registerVisionCompanions, t as applyPiPackage } from "./runtime-
|
|
2
|
+
import { r as registerVisionCompanions, t as applyPiPackage } from "./runtime-B_Ig28og.mjs";
|
|
3
3
|
import { t as resolvePiPackage } from "./source-0sA5z08z.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { readFile } from "node:fs/promises";
|
package/dist/index.d.mts
CHANGED
|
@@ -42,15 +42,27 @@ declare function apply(ctx: Context, config?: EngineConfig): Promise<void>;
|
|
|
42
42
|
interface Rule {
|
|
43
43
|
level: CompatibilityLevel;
|
|
44
44
|
detail: string;
|
|
45
|
+
/** How the mapping is built — the DSH seam or service that carries it. */
|
|
46
|
+
design?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A Pi extension surface. `design` is REQUIRED here and optional on Rule: an
|
|
50
|
+
* imported symbol is served by a shim family the docs describe once, but every
|
|
51
|
+
* surface a package can call has to name the DSH mechanism behind it, or the
|
|
52
|
+
* documentation degrades into a list of verdicts nobody can act on. Adding a
|
|
53
|
+
* surface without one is a type error, which is the point.
|
|
54
|
+
*/
|
|
55
|
+
interface SurfaceRule extends Rule {
|
|
56
|
+
design: string;
|
|
45
57
|
}
|
|
46
58
|
declare const PI_CODING_AGENT_PACKAGES: readonly ["@earendil-works/pi-coding-agent", "@mariozechner/pi-coding-agent"];
|
|
47
59
|
declare const PI_TUI_PACKAGES: readonly ["@earendil-works/pi-tui", "@mariozechner/pi-tui"];
|
|
48
60
|
declare const PI_AI_PACKAGES: readonly ["@earendil-works/pi-ai", "@mariozechner/pi-ai"];
|
|
49
61
|
declare const HOST_IMPORT_RULES: Readonly<Record<string, Readonly<Record<string, Rule>>>>;
|
|
50
|
-
declare const CONTEXT_RULES: Readonly<Record<string,
|
|
51
|
-
declare const UI_CONTEXT_RULES: Readonly<Record<string,
|
|
52
|
-
declare const API_RULES: Readonly<Record<string,
|
|
53
|
-
declare const EVENT_RULES: Readonly<Record<string,
|
|
62
|
+
declare const CONTEXT_RULES: Readonly<Record<string, SurfaceRule>>;
|
|
63
|
+
declare const UI_CONTEXT_RULES: Readonly<Record<string, SurfaceRule>>;
|
|
64
|
+
declare const API_RULES: Readonly<Record<string, SurfaceRule>>;
|
|
65
|
+
declare const EVENT_RULES: Readonly<Record<string, SurfaceRule>>;
|
|
54
66
|
declare function ruleForApi(method: string): Rule | undefined;
|
|
55
67
|
declare function ruleForEvent(event: string): Rule;
|
|
56
68
|
declare function ruleForHostImport(packageName: string, importedName: string): Rule | undefined;
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/engine.ts","../src/compatibility.ts","../src/mcp-config.ts","../src/source.ts","../src/index.ts"],"mappings":";;;;;UA6BiB;;EAEf;;EAEA;;;;;;;;EAQA,2BAA2B;;;iBAIb,gBAAgB;UAUtB;EACR;EACA;;;;;;;;iBAgBoB,0BACpB,qBACA;EAAW;EAAoB,QAAQ;IACtC,QAAQ;;cA4CE;cACA;iBAES,MAAM,KAAK,SAAS,SAAQ,eAAoB;;;UCzH5D;EACR,OAAO;EACP;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/engine.ts","../src/compatibility.ts","../src/mcp-config.ts","../src/source.ts","../src/index.ts"],"mappings":";;;;;UA6BiB;;EAEf;;EAEA;;;;;;;;EAQA,2BAA2B;;;iBAIb,gBAAgB;UAUtB;EACR;EACA;;;;;;;;iBAgBoB,0BACpB,qBACA;EAAW;EAAoB,QAAQ;IACtC,QAAQ;;cA4CE;cACA;iBAES,MAAM,KAAK,SAAS,SAAQ,eAAoB;;;UCzH5D;EACR,OAAO;EACP;;EAEA;;;;;;;;;UAUQ,oBAAoB;EAC5B;;cAQW;cAKA;cAKA;cAWA,mBAAmB,SAAS,eAAe,SAAS,eAAe;cAmNnE,eAAe,SAAS,eAAe;cA4BvC,kBAAkB,SAAS,eAAe;cA+B1C,WAAW,SAAS,eAAe;cA6InC,aAAa,SAAS,eAAe;iBAgHlC,WAAW,iBAAiB;iBAI5B,aAAa,gBAAgB;iBAO7B,kBAAkB,qBAAqB,uBAAuB;iBAS9D,uBAAuB,mBAAmB;iBAI1C,yBAAyB,mBAAmB;;;KCpkBvD,gBAAgB;UAEJ;EACf;EACA;EACA;EACA;EACA;EACA,MAAM;EACN;EACA;EACA,UAAU;EACV;;UAGe;EACf;EACA;;UAGe;EACf,SAAS;EACT,SAAS;EACT,UAAU;EACV;;iBA6Cc,oBAAoB,aAAa;EAA8B,SAAS,YAAY;EAAc;;iBAoElG,mBAAmB,aAAa,wBAA4B;;iBAsD5D,eAAe,QAAQ;;;iBC5EjB,iBAAiB,gBAAgB,eAAsB,QAAQ;;;;;;;;iBChH/D,eAAe,KAAK,oBAAoB,QAAQ"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import { r as registerVisionCompanions } from "./runtime-
|
|
2
|
+
import { r as registerVisionCompanions } from "./runtime-B_Ig28og.mjs";
|
|
3
3
|
import { t as resolvePiPackage } from "./source-0sA5z08z.mjs";
|
|
4
4
|
import { applyPiHost, manifestForInstalled } from "./host.mjs";
|
|
5
|
-
import { a as CONTEXT_RULES, c as PI_AI_PACKAGES, d as UI_CONTEXT_RULES, f as ruleForApi, g as ruleForUiContextProperty, h as ruleForHostImport, i as API_RULES, l as PI_CODING_AGENT_PACKAGES, m as ruleForEvent, n as convertPiMcpConfig, o as EVENT_RULES, p as ruleForContextProperty, r as renderMcpPatch, s as HOST_IMPORT_RULES, t as collectPiMcpServers, u as PI_TUI_PACKAGES } from "./mcp-config-
|
|
5
|
+
import { a as CONTEXT_RULES, c as PI_AI_PACKAGES, d as UI_CONTEXT_RULES, f as ruleForApi, g as ruleForUiContextProperty, h as ruleForHostImport, i as API_RULES, l as PI_CODING_AGENT_PACKAGES, m as ruleForEvent, n as convertPiMcpConfig, o as EVENT_RULES, p as ruleForContextProperty, r as renderMcpPatch, s as HOST_IMPORT_RULES, t as collectPiMcpServers, u as PI_TUI_PACKAGES } from "./mcp-config-Cjae0vot.mjs";
|
|
6
6
|
import { readFile } from "node:fs/promises";
|
|
7
7
|
import { existsSync } from "node:fs";
|
|
8
8
|
import { dirname, join } from "node:path";
|
|
@@ -114,7 +114,7 @@ async function apply(ctx, config = {}) {
|
|
|
114
114
|
* @returns the compatibility report.
|
|
115
115
|
*/
|
|
116
116
|
async function analyzePackage(pkg) {
|
|
117
|
-
const { analyzePackage: run } = await import("./analyzer-
|
|
117
|
+
const { analyzePackage: run } = await import("./analyzer-2Nx5XYOA.mjs");
|
|
118
118
|
return run(pkg);
|
|
119
119
|
}
|
|
120
120
|
//#endregion
|