aihand 0.0.1 → 0.1.0
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 +136 -2
- package/dist/chunk-2NTK7H4W.js +10 -0
- package/dist/chunk-3X4FTHLC.cjs +369 -0
- package/dist/chunk-BXVNR4E2.js +399 -0
- package/dist/chunk-C7DGE6MY.cjs +1456 -0
- package/dist/chunk-DUUCVLC3.cjs +254 -0
- package/dist/chunk-FAHI53KO.cjs +125 -0
- package/dist/chunk-G7KVJ7NF.js +369 -0
- package/dist/chunk-GNEUSRGP.js +52 -0
- package/dist/chunk-IGNEAOLT.cjs +130 -0
- package/dist/chunk-IS5XFUDB.js +125 -0
- package/dist/chunk-JLYC76XL.js +2448 -0
- package/dist/chunk-KQOABC2O.cjs +52 -0
- package/dist/chunk-OVMK33AC.cjs +104 -0
- package/dist/chunk-OWYK2IGV.js +250 -0
- package/dist/chunk-PQSQN4CN.js +126 -0
- package/dist/chunk-QF6AG3M5.cjs +410 -0
- package/dist/chunk-QSAMLXML.js +1456 -0
- package/dist/chunk-VEKYRKPF.cjs +399 -0
- package/dist/chunk-Y6H7W7PI.cjs +2451 -0
- package/dist/chunk-YKSYW77R.js +410 -0
- package/dist/chunk-Z2Y65YOY.cjs +7 -0
- package/dist/chunk-ZJQRNIK7.js +104 -0
- package/dist/cli-FDS2C2CZ.cjs +651 -0
- package/dist/cli-HHRGYPSM.js +649 -0
- package/dist/cli-JQEIE7RQ.js +120 -0
- package/dist/cli-K3OS2QQH.cjs +122 -0
- package/dist/cli-OSYG6LJD.cjs +89 -0
- package/dist/cli-TXRW5PG6.js +89 -0
- package/dist/cli.cjs +81 -0
- package/dist/cli.js +81 -0
- package/dist/config-5KEQLN6L.cjs +13 -0
- package/dist/config-PJPYKDLQ.js +13 -0
- package/dist/graph-IH56SCPK.js +8 -0
- package/dist/graph-ZUXXCJ5A.cjs +8 -0
- package/dist/index.cjs +481 -0
- package/dist/index.d.cts +461 -0
- package/dist/index.d.ts +461 -0
- package/dist/index.js +479 -0
- package/dist/locate-5XFSXJ5J.cjs +15 -0
- package/dist/locate-NKSUGL3A.js +15 -0
- package/dist/refactor-5FWSZIBN.cjs +19 -0
- package/dist/refactor-BOB3SZSA.js +19 -0
- package/dist/scan-4R7GQG2W.cjs +9 -0
- package/dist/scan-VF54GAAX.js +9 -0
- package/dist/ui/probe/server.cjs +505 -0
- package/dist/ui/probe/server.js +507 -0
- package/dist/vite.cjs +12 -0
- package/dist/vite.d.cts +12 -0
- package/dist/vite.d.ts +12 -0
- package/dist/vite.js +12 -0
- package/package.json +82 -9
- package/src/cli.ts +107 -0
- package/src/index.ts +54 -0
- package/src/read/cli.ts +650 -0
- package/src/read/compact.ts +286 -0
- package/src/read/config.ts +62 -0
- package/src/read/graph.ts +182 -0
- package/src/read/index.ts +12 -0
- package/src/read/inject.ts +121 -0
- package/src/read/locate.ts +104 -0
- package/src/read/panel.ts +335 -0
- package/src/read/pipeline.ts +78 -0
- package/src/read/refactor.ts +576 -0
- package/src/read/render.ts +1118 -0
- package/src/read/scan.ts +61 -0
- package/src/read/seam.ts +0 -0
- package/src/read/security.ts +171 -0
- package/src/read/signals.ts +333 -0
- package/src/read/state.ts +71 -0
- package/src/read/stategraph.ts +205 -0
- package/src/read/types.ts +162 -0
- package/src/read/vite.ts +77 -0
- package/src/ui/babel/line-profiler.ts +197 -0
- package/src/ui/babel/source-loc.ts +68 -0
- package/src/ui/bridge/cdp-bridge.ts +138 -0
- package/src/ui/bridge/compile-probe.ts +80 -0
- package/src/ui/bridge/transport.ts +26 -0
- package/src/ui/bridge/vite-bridge.ts +116 -0
- package/src/ui/client/client-patch.ts +899 -0
- package/src/ui/client/client.ts +2562 -0
- package/src/ui/core/action.ts +747 -0
- package/src/ui/core/candidates.ts +348 -0
- package/src/ui/core/canvas.ts +305 -0
- package/src/ui/core/check.ts +34 -0
- package/src/ui/core/compact.ts +314 -0
- package/src/ui/core/detail.ts +244 -0
- package/src/ui/core/diff.ts +253 -0
- package/src/ui/core/emit.ts +198 -0
- package/src/ui/core/knob-exec.ts +137 -0
- package/src/ui/core/perf.ts +254 -0
- package/src/ui/core/types.ts +164 -0
- package/src/ui/core/util.ts +221 -0
- package/src/ui/index.ts +5 -0
- package/src/ui/probe/cli.ts +139 -0
- package/src/ui/probe/server.ts +468 -0
- package/src/ui/self/act.ts +47 -0
- package/src/ui/self/discover.ts +101 -0
- package/src/ui/self/grow.ts +121 -0
- package/src/ui/self/install.ts +100 -0
- package/src/ui/self/probe.ts +105 -0
- package/src/ui/self/screen-hook.ts +44 -0
- package/src/ui/self/self.ts +48 -0
- package/src/ui/self/store-refs.ts +123 -0
- package/src/ui/self/store-schema.ts +65 -0
- package/src/ui/self/synth.ts +37 -0
- package/src/ui/server/cli.ts +102 -0
- package/src/ui/server/dispatch.ts +276 -0
- package/src/ui/server/help-text.ts +237 -0
- package/src/ui/server/knob-schema.ts +87 -0
- package/src/ui/server/plugin.ts +1151 -0
- package/src/vite.ts +39 -0
- package/index.js +0 -2
package/dist/index.js
ADDED
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
import {
|
|
2
|
+
moveFile,
|
|
3
|
+
moveSymbol,
|
|
4
|
+
renameSymbol
|
|
5
|
+
} from "./chunk-BXVNR4E2.js";
|
|
6
|
+
import {
|
|
7
|
+
allocate,
|
|
8
|
+
buildBlocks,
|
|
9
|
+
buildClassifier,
|
|
10
|
+
buildImportGraph,
|
|
11
|
+
buildState,
|
|
12
|
+
computeCentrality,
|
|
13
|
+
computeRecency,
|
|
14
|
+
ensureMarkers,
|
|
15
|
+
expandByBudget,
|
|
16
|
+
formatState,
|
|
17
|
+
formatTree,
|
|
18
|
+
formatXml,
|
|
19
|
+
injectAll,
|
|
20
|
+
injectFile,
|
|
21
|
+
scanSecrets
|
|
22
|
+
} from "./chunk-QSAMLXML.js";
|
|
23
|
+
import {
|
|
24
|
+
aihand,
|
|
25
|
+
check,
|
|
26
|
+
diffState,
|
|
27
|
+
discover,
|
|
28
|
+
emitCheck,
|
|
29
|
+
emitDiff,
|
|
30
|
+
emitSummary,
|
|
31
|
+
storeSchema
|
|
32
|
+
} from "./chunk-JLYC76XL.js";
|
|
33
|
+
import {
|
|
34
|
+
buildPanel,
|
|
35
|
+
buildStateGraph,
|
|
36
|
+
classify,
|
|
37
|
+
extractKnobs,
|
|
38
|
+
extractStoreFields,
|
|
39
|
+
fmtTransitions,
|
|
40
|
+
growFromDecl,
|
|
41
|
+
openProject
|
|
42
|
+
} from "./chunk-G7KVJ7NF.js";
|
|
43
|
+
import "./chunk-YKSYW77R.js";
|
|
44
|
+
import {
|
|
45
|
+
DEFAULT_CONFIG,
|
|
46
|
+
configTemplate,
|
|
47
|
+
defineConfig
|
|
48
|
+
} from "./chunk-PQSQN4CN.js";
|
|
49
|
+
import {
|
|
50
|
+
scan
|
|
51
|
+
} from "./chunk-GNEUSRGP.js";
|
|
52
|
+
import {
|
|
53
|
+
buildCallGraph
|
|
54
|
+
} from "./chunk-IS5XFUDB.js";
|
|
55
|
+
import {
|
|
56
|
+
IMPORT_QUERY,
|
|
57
|
+
SEPARATOR,
|
|
58
|
+
TS_QUERY,
|
|
59
|
+
cleanFnSignature,
|
|
60
|
+
compact,
|
|
61
|
+
extractImports,
|
|
62
|
+
getLang
|
|
63
|
+
} from "./chunk-OWYK2IGV.js";
|
|
64
|
+
import {
|
|
65
|
+
fetchRuntimeKnobs,
|
|
66
|
+
fileOfInspPath,
|
|
67
|
+
joinPanel,
|
|
68
|
+
locate,
|
|
69
|
+
parseInspPath,
|
|
70
|
+
renderLocate,
|
|
71
|
+
sourcePanelHtml,
|
|
72
|
+
symbolAtLine
|
|
73
|
+
} from "./chunk-ZJQRNIK7.js";
|
|
74
|
+
import "./chunk-2NTK7H4W.js";
|
|
75
|
+
|
|
76
|
+
// src/ui/babel/line-profiler.ts
|
|
77
|
+
import { types as t } from "@babel/core";
|
|
78
|
+
import path from "path";
|
|
79
|
+
function lineProfilerPlugin() {
|
|
80
|
+
return {
|
|
81
|
+
name: "aihand-line-profiler",
|
|
82
|
+
visitor: {
|
|
83
|
+
VariableDeclaration(nodePath, state) {
|
|
84
|
+
if (shouldSkip(nodePath, state)) return;
|
|
85
|
+
const decl = nodePath.node.declarations[0];
|
|
86
|
+
if (!decl?.init) return;
|
|
87
|
+
if (hasAwaitOrYield(decl.init)) return;
|
|
88
|
+
const label = makeLabel(nodePath, state, decl.id.type === "Identifier" ? decl.id.name : void 0);
|
|
89
|
+
const wrapped = wrapExpr(decl.init, label);
|
|
90
|
+
decl.init = wrapped;
|
|
91
|
+
},
|
|
92
|
+
ExpressionStatement(nodePath, state) {
|
|
93
|
+
if (shouldSkip(nodePath, state)) return;
|
|
94
|
+
if (hasAwaitOrYield(nodePath.node.expression)) return;
|
|
95
|
+
const label = makeLabel(nodePath, state);
|
|
96
|
+
const wrapped = wrapExpr(nodePath.node.expression, label);
|
|
97
|
+
nodePath.node.expression = wrapped;
|
|
98
|
+
},
|
|
99
|
+
ReturnStatement(nodePath, state) {
|
|
100
|
+
if (shouldSkip(nodePath, state)) return;
|
|
101
|
+
if (!nodePath.node.argument) return;
|
|
102
|
+
if (hasAwaitOrYield(nodePath.node.argument)) return;
|
|
103
|
+
const label = makeLabel(nodePath, state);
|
|
104
|
+
const wrapped = wrapExpr(nodePath.node.argument, label);
|
|
105
|
+
nodePath.node.argument = wrapped;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function shouldSkip(nodePath, state) {
|
|
111
|
+
const filename = state.file?.opts?.filename ?? "";
|
|
112
|
+
if (filename.includes("node_modules")) return true;
|
|
113
|
+
if (filename.includes("packages/aidev/")) return true;
|
|
114
|
+
const node = nodePath.node;
|
|
115
|
+
if (t.isImportDeclaration(node)) return true;
|
|
116
|
+
if (t.isExportNamedDeclaration(node)) return true;
|
|
117
|
+
if (t.isExportDefaultDeclaration(node)) return true;
|
|
118
|
+
if (t.isExportAllDeclaration(node)) return true;
|
|
119
|
+
if (t.isExpressionStatement(node) && t.isCallExpression(node.expression)) {
|
|
120
|
+
const callee = node.expression.callee;
|
|
121
|
+
if (t.isIdentifier(callee) && callee.name === "__line") return true;
|
|
122
|
+
}
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
function makeLabel(nodePath, state, varName) {
|
|
126
|
+
const filename = state.file.opts.filename ?? "unknown";
|
|
127
|
+
const basename = path.basename(filename);
|
|
128
|
+
const line = resolveLine(nodePath);
|
|
129
|
+
if (varName) {
|
|
130
|
+
return `${basename}:${line}:${varName}`;
|
|
131
|
+
}
|
|
132
|
+
return `${basename}:${line}`;
|
|
133
|
+
}
|
|
134
|
+
function resolveLine(nodePath) {
|
|
135
|
+
if (nodePath.node.loc) return nodePath.node.loc.start.line;
|
|
136
|
+
const descend = firstLocLine(nodePath.node);
|
|
137
|
+
if (descend != null) return descend;
|
|
138
|
+
let p = nodePath.parentPath;
|
|
139
|
+
while (p) {
|
|
140
|
+
if (p.node.loc) return p.node.loc.start.line;
|
|
141
|
+
p = p.parentPath;
|
|
142
|
+
}
|
|
143
|
+
return 0;
|
|
144
|
+
}
|
|
145
|
+
function firstLocLine(node) {
|
|
146
|
+
for (const key of t.VISITOR_KEYS[node.type] ?? []) {
|
|
147
|
+
const child = node[key];
|
|
148
|
+
const children = Array.isArray(child) ? child : [child];
|
|
149
|
+
for (const c of children) {
|
|
150
|
+
if (!c || typeof c.type !== "string") continue;
|
|
151
|
+
if (c.loc) return c.loc.start.line;
|
|
152
|
+
const deeper = firstLocLine(c);
|
|
153
|
+
if (deeper != null) return deeper;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
function wrapExpr(expr, label) {
|
|
159
|
+
const runtime = t.logicalExpression(
|
|
160
|
+
"||",
|
|
161
|
+
t.memberExpression(t.identifier("globalThis"), t.identifier("__line")),
|
|
162
|
+
t.arrowFunctionExpression(
|
|
163
|
+
[t.identifier("_l"), t.identifier("f")],
|
|
164
|
+
t.callExpression(t.identifier("f"), [])
|
|
165
|
+
)
|
|
166
|
+
);
|
|
167
|
+
return t.callExpression(
|
|
168
|
+
runtime,
|
|
169
|
+
[
|
|
170
|
+
t.stringLiteral(label),
|
|
171
|
+
t.arrowFunctionExpression([], expr)
|
|
172
|
+
]
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
function hasAwaitOrYield(node) {
|
|
176
|
+
if (!node || typeof node !== "object") return false;
|
|
177
|
+
if (t.isAwaitExpression(node) || t.isYieldExpression(node)) return true;
|
|
178
|
+
if (t.isFunctionExpression(node) || t.isArrowFunctionExpression(node) || t.isFunctionDeclaration(node) || t.isObjectMethod(node) || t.isClassMethod(node)) return false;
|
|
179
|
+
for (const key of Object.keys(node)) {
|
|
180
|
+
if (key === "loc" || key === "start" || key === "end" || key === "leadingComments" || key === "trailingComments") continue;
|
|
181
|
+
const child = node[key];
|
|
182
|
+
if (Array.isArray(child)) {
|
|
183
|
+
for (const c of child) {
|
|
184
|
+
if (c && typeof c.type === "string" && hasAwaitOrYield(c)) return true;
|
|
185
|
+
}
|
|
186
|
+
} else if (child && typeof child.type === "string") {
|
|
187
|
+
if (hasAwaitOrYield(child)) return true;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// src/ui/self/act.ts
|
|
194
|
+
function stringifyDomain(v) {
|
|
195
|
+
if (v === null || v === void 0)
|
|
196
|
+
return String(v);
|
|
197
|
+
if (typeof v === "object")
|
|
198
|
+
return JSON.stringify(v).slice(0, 80);
|
|
199
|
+
return String(v).slice(0, 80);
|
|
200
|
+
}
|
|
201
|
+
function act(before, after) {
|
|
202
|
+
const lines = [];
|
|
203
|
+
if (after.view !== before.view)
|
|
204
|
+
lines.push(`view: ${before.view} \u2192 ${after.view}`);
|
|
205
|
+
if (after.modal !== before.modal) {
|
|
206
|
+
if (after.modal === null)
|
|
207
|
+
lines.push(`modal: closed (${before.modal})`);
|
|
208
|
+
else if (before.modal === null)
|
|
209
|
+
lines.push(`modal: opened ${after.modal}`);
|
|
210
|
+
else
|
|
211
|
+
lines.push(`modal: ${before.modal} \u2192 ${after.modal}`);
|
|
212
|
+
}
|
|
213
|
+
if (after.focus !== before.focus)
|
|
214
|
+
lines.push(`focus: ${after.focus}`);
|
|
215
|
+
for (const key of /* @__PURE__ */ new Set([...Object.keys(before.state), ...Object.keys(after.state)])) {
|
|
216
|
+
const b = stringifyDomain(before.state[key]);
|
|
217
|
+
const a = stringifyDomain(after.state[key]);
|
|
218
|
+
if (b !== a)
|
|
219
|
+
lines.push(`${key}: ${b} \u2192 ${a}`);
|
|
220
|
+
}
|
|
221
|
+
return lines;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// src/ui/self/grow.ts
|
|
225
|
+
import { createRequire } from "module";
|
|
226
|
+
import { dirname, join } from "path";
|
|
227
|
+
import { Language, Parser } from "web-tree-sitter";
|
|
228
|
+
var langPromise = null;
|
|
229
|
+
function loadLang() {
|
|
230
|
+
if (!langPromise) {
|
|
231
|
+
langPromise = (async () => {
|
|
232
|
+
const req = createRequire(import.meta.url);
|
|
233
|
+
const wasmDir = dirname(req.resolve("@repomix/tree-sitter-wasms/out/tree-sitter-tsx.wasm"));
|
|
234
|
+
await Parser.init();
|
|
235
|
+
return Language.load(join(wasmDir, "tree-sitter-tsx.wasm"));
|
|
236
|
+
})();
|
|
237
|
+
}
|
|
238
|
+
return langPromise;
|
|
239
|
+
}
|
|
240
|
+
function typeOf(value) {
|
|
241
|
+
if (value.type === "as_expression") {
|
|
242
|
+
const typeNode = value.namedChild(value.namedChildCount - 1);
|
|
243
|
+
if (!typeNode)
|
|
244
|
+
return { type: "unknown", domain: [] };
|
|
245
|
+
const literals = typeNode.descendantsOfType("literal_type");
|
|
246
|
+
const domain = literals.map((l) => l.descendantsOfType("string_fragment")[0]?.text).filter((s) => !!s);
|
|
247
|
+
return { type: typeNode.text, domain };
|
|
248
|
+
}
|
|
249
|
+
if (value.type === "true" || value.type === "false")
|
|
250
|
+
return { type: "boolean", domain: [] };
|
|
251
|
+
if (value.type === "number")
|
|
252
|
+
return { type: "number", domain: [] };
|
|
253
|
+
if (value.type === "string")
|
|
254
|
+
return { type: "string", domain: [] };
|
|
255
|
+
if (value.type === "array")
|
|
256
|
+
return { type: "array", domain: [] };
|
|
257
|
+
if (value.type === "null")
|
|
258
|
+
return { type: "null", domain: [] };
|
|
259
|
+
return { type: value.type, domain: [] };
|
|
260
|
+
}
|
|
261
|
+
async function grow(code, file) {
|
|
262
|
+
const lang = await loadLang();
|
|
263
|
+
const parser = new Parser();
|
|
264
|
+
parser.setLanguage(lang);
|
|
265
|
+
const tree = parser.parse(code);
|
|
266
|
+
const root = tree?.rootNode;
|
|
267
|
+
if (!root)
|
|
268
|
+
return [];
|
|
269
|
+
const out = [];
|
|
270
|
+
for (const decl of root.descendantsOfType("variable_declarator")) {
|
|
271
|
+
const nameNode = decl.namedChild(0);
|
|
272
|
+
const valueNode = decl.childForFieldName("value");
|
|
273
|
+
if (!nameNode || nameNode.type !== "identifier" || valueNode?.type !== "call_expression")
|
|
274
|
+
continue;
|
|
275
|
+
const callee = valueNode.namedChild(0);
|
|
276
|
+
if (callee?.type !== "identifier" || callee.text !== "create")
|
|
277
|
+
continue;
|
|
278
|
+
const args = valueNode.childForFieldName("arguments");
|
|
279
|
+
const stateObj = args?.namedChildren.find((c) => c?.type === "object");
|
|
280
|
+
if (!stateObj)
|
|
281
|
+
continue;
|
|
282
|
+
const fields = [];
|
|
283
|
+
for (const pair of stateObj.namedChildren) {
|
|
284
|
+
if (pair?.type !== "pair")
|
|
285
|
+
continue;
|
|
286
|
+
const key = pair.childForFieldName("key");
|
|
287
|
+
const value = pair.childForFieldName("value");
|
|
288
|
+
if (!key || !value)
|
|
289
|
+
continue;
|
|
290
|
+
const { type, domain } = typeOf(value);
|
|
291
|
+
fields.push({ name: key.text, type, domain, line: key.startPosition.row + 1 });
|
|
292
|
+
}
|
|
293
|
+
out.push({
|
|
294
|
+
store: nameNode.text,
|
|
295
|
+
anchor: `${file}:${decl.startPosition.row + 1}`,
|
|
296
|
+
fields
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
return out;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// src/ui/self/self.ts
|
|
303
|
+
function screen(self) {
|
|
304
|
+
return self;
|
|
305
|
+
}
|
|
306
|
+
function log(seq, entry) {
|
|
307
|
+
return [...seq, entry];
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// src/ui/self/install.ts
|
|
311
|
+
function emit(sink, channel, detail) {
|
|
312
|
+
sink.seq = log(sink.seq, { channel, detail, ts: sink.now() });
|
|
313
|
+
}
|
|
314
|
+
function installSelfLog(win, sink) {
|
|
315
|
+
const restores = [];
|
|
316
|
+
const levels = ["log", "info", "warn", "error", "debug"];
|
|
317
|
+
for (const level of levels) {
|
|
318
|
+
const orig = win.console[level];
|
|
319
|
+
win.console[level] = (...args) => {
|
|
320
|
+
emit(sink, "console", `[${level}] ${args.map(String).join(" ")}`);
|
|
321
|
+
orig.apply(win.console, args);
|
|
322
|
+
};
|
|
323
|
+
restores.push(() => {
|
|
324
|
+
win.console[level] = orig;
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
const origFetch = win.fetch;
|
|
328
|
+
win.fetch = async (input, init) => {
|
|
329
|
+
const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
|
|
330
|
+
const method = init?.method || "GET";
|
|
331
|
+
try {
|
|
332
|
+
const res = await origFetch(input, init);
|
|
333
|
+
emit(sink, "fetch", `${method} ${url} ${res.status}`);
|
|
334
|
+
return res;
|
|
335
|
+
} catch (e) {
|
|
336
|
+
emit(sink, "fetch", `${method} ${url} failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
337
|
+
throw e;
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
restores.push(() => {
|
|
341
|
+
win.fetch = origFetch;
|
|
342
|
+
});
|
|
343
|
+
const XHRProto = win.XMLHttpRequest.prototype;
|
|
344
|
+
const origOpen = XHRProto.open;
|
|
345
|
+
const origSend = XHRProto.send;
|
|
346
|
+
XHRProto.open = function(method, url, ...rest) {
|
|
347
|
+
this.__m = method;
|
|
348
|
+
this.__u = typeof url === "string" ? url : url.toString();
|
|
349
|
+
return origOpen.call(this, method, url, ...rest);
|
|
350
|
+
};
|
|
351
|
+
XHRProto.send = function(...args) {
|
|
352
|
+
this.addEventListener("loadend", () => {
|
|
353
|
+
emit(sink, "xhr", `${this.__m ?? "GET"} ${this.__u ?? ""} ${this.status}`);
|
|
354
|
+
});
|
|
355
|
+
return origSend.apply(this, args);
|
|
356
|
+
};
|
|
357
|
+
restores.push(() => {
|
|
358
|
+
XHRProto.open = origOpen;
|
|
359
|
+
XHRProto.send = origSend;
|
|
360
|
+
});
|
|
361
|
+
const onError = (e) => emit(sink, "error", e.message || String(e.error));
|
|
362
|
+
const onRejection = (e) => emit(sink, "error", `unhandled rejection: ${String(e.reason)}`);
|
|
363
|
+
win.addEventListener("error", onError);
|
|
364
|
+
win.addEventListener("unhandledrejection", onRejection);
|
|
365
|
+
restores.push(() => {
|
|
366
|
+
win.removeEventListener("error", onError);
|
|
367
|
+
win.removeEventListener("unhandledrejection", onRejection);
|
|
368
|
+
});
|
|
369
|
+
const OrigES = win.EventSource;
|
|
370
|
+
if (OrigES) {
|
|
371
|
+
win.EventSource = new Proxy(OrigES, {
|
|
372
|
+
construct(Target, cArgs) {
|
|
373
|
+
const es = new Target(...cArgs);
|
|
374
|
+
const url = String(cArgs[0]);
|
|
375
|
+
es.addEventListener("error", () => emit(sink, "sse", `${url} error (readyState ${es.readyState})`));
|
|
376
|
+
return es;
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
restores.push(() => {
|
|
380
|
+
win.EventSource = OrigES;
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
return () => {
|
|
384
|
+
for (const r of restores) r();
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// src/ui/self/screen-hook.ts
|
|
389
|
+
function screenHook(stores) {
|
|
390
|
+
const domain = {};
|
|
391
|
+
let view = "";
|
|
392
|
+
for (const { schema, snapshot } of stores) {
|
|
393
|
+
for (const f of schema.fields) {
|
|
394
|
+
domain[`${schema.store}.${f.name}`] = snapshot[f.name];
|
|
395
|
+
if (!view && f.domain.length > 0)
|
|
396
|
+
view = String(snapshot[f.name] ?? "");
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
return { view, domain };
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// src/ui/self/synth.ts
|
|
403
|
+
function synth(schema, snapshot) {
|
|
404
|
+
const viewField = schema.fields.find((f) => f.domain.length > 0);
|
|
405
|
+
const state = {};
|
|
406
|
+
for (const f of schema.fields)
|
|
407
|
+
state[f.name] = snapshot[f.name];
|
|
408
|
+
return {
|
|
409
|
+
view: viewField ? String(snapshot[viewField.name] ?? "") : "",
|
|
410
|
+
modal: null,
|
|
411
|
+
focus: null,
|
|
412
|
+
state,
|
|
413
|
+
anchor: schema.anchor
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
export {
|
|
417
|
+
DEFAULT_CONFIG,
|
|
418
|
+
IMPORT_QUERY,
|
|
419
|
+
SEPARATOR,
|
|
420
|
+
TS_QUERY,
|
|
421
|
+
act,
|
|
422
|
+
aihand,
|
|
423
|
+
allocate,
|
|
424
|
+
buildBlocks,
|
|
425
|
+
buildCallGraph,
|
|
426
|
+
buildClassifier,
|
|
427
|
+
buildImportGraph,
|
|
428
|
+
buildPanel,
|
|
429
|
+
buildState,
|
|
430
|
+
buildStateGraph,
|
|
431
|
+
check,
|
|
432
|
+
classify,
|
|
433
|
+
cleanFnSignature,
|
|
434
|
+
compact,
|
|
435
|
+
computeCentrality,
|
|
436
|
+
computeRecency,
|
|
437
|
+
configTemplate,
|
|
438
|
+
defineConfig,
|
|
439
|
+
diffState,
|
|
440
|
+
discover,
|
|
441
|
+
emitCheck,
|
|
442
|
+
emitDiff,
|
|
443
|
+
emitSummary,
|
|
444
|
+
ensureMarkers,
|
|
445
|
+
expandByBudget,
|
|
446
|
+
extractImports,
|
|
447
|
+
extractKnobs,
|
|
448
|
+
extractStoreFields,
|
|
449
|
+
fetchRuntimeKnobs,
|
|
450
|
+
fileOfInspPath,
|
|
451
|
+
fmtTransitions,
|
|
452
|
+
formatState,
|
|
453
|
+
formatTree,
|
|
454
|
+
formatXml,
|
|
455
|
+
getLang,
|
|
456
|
+
grow,
|
|
457
|
+
growFromDecl,
|
|
458
|
+
injectAll,
|
|
459
|
+
injectFile,
|
|
460
|
+
installSelfLog,
|
|
461
|
+
joinPanel,
|
|
462
|
+
lineProfilerPlugin,
|
|
463
|
+
locate,
|
|
464
|
+
log,
|
|
465
|
+
moveFile,
|
|
466
|
+
moveSymbol,
|
|
467
|
+
openProject,
|
|
468
|
+
parseInspPath,
|
|
469
|
+
renameSymbol,
|
|
470
|
+
renderLocate,
|
|
471
|
+
scan,
|
|
472
|
+
scanSecrets,
|
|
473
|
+
screen,
|
|
474
|
+
screenHook,
|
|
475
|
+
sourcePanelHtml,
|
|
476
|
+
storeSchema,
|
|
477
|
+
symbolAtLine,
|
|
478
|
+
synth
|
|
479
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkOVMK33ACcjs = require('./chunk-OVMK33AC.cjs');
|
|
8
|
+
require('./chunk-Z2Y65YOY.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
exports.locate = _chunkOVMK33ACcjs.locate; exports.parseInspPath = _chunkOVMK33ACcjs.parseInspPath; exports.renderLocate = _chunkOVMK33ACcjs.renderLocate; exports.sourcePanelHtml = _chunkOVMK33ACcjs.sourcePanelHtml; exports.symbolAtLine = _chunkOVMK33ACcjs.symbolAtLine;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkVEKYRKPFcjs = require('./chunk-VEKYRKPF.cjs');
|
|
10
|
+
require('./chunk-Z2Y65YOY.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
exports.moveFile = _chunkVEKYRKPFcjs.moveFile; exports.moveInProject = _chunkVEKYRKPFcjs.moveInProject; exports.moveSymbol = _chunkVEKYRKPFcjs.moveSymbol; exports.moveSymbolInProject = _chunkVEKYRKPFcjs.moveSymbolInProject; exports.renameInProject = _chunkVEKYRKPFcjs.renameInProject; exports.renameSymbol = _chunkVEKYRKPFcjs.renameSymbol; exports.toAlias = _chunkVEKYRKPFcjs.toAlias;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
moveFile,
|
|
3
|
+
moveInProject,
|
|
4
|
+
moveSymbol,
|
|
5
|
+
moveSymbolInProject,
|
|
6
|
+
renameInProject,
|
|
7
|
+
renameSymbol,
|
|
8
|
+
toAlias
|
|
9
|
+
} from "./chunk-BXVNR4E2.js";
|
|
10
|
+
import "./chunk-2NTK7H4W.js";
|
|
11
|
+
export {
|
|
12
|
+
moveFile,
|
|
13
|
+
moveInProject,
|
|
14
|
+
moveSymbol,
|
|
15
|
+
moveSymbolInProject,
|
|
16
|
+
renameInProject,
|
|
17
|
+
renameSymbol,
|
|
18
|
+
toAlias
|
|
19
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkKQOABC2Ocjs = require('./chunk-KQOABC2O.cjs');
|
|
5
|
+
require('./chunk-Z2Y65YOY.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
exports.filterAndSort = _chunkKQOABC2Ocjs.filterAndSort; exports.scan = _chunkKQOABC2Ocjs.scan;
|