repoburg 1.3.238 → 1.3.239
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/agent-pane/backend/dist/index.js +184 -48
- package/agent-pane/backend/dist/server.js +184 -48
- package/agent-pane/frontend/dist/assets/{index-DzSfNOM7.js → index-CBTsbWig.js} +100 -82
- package/agent-pane/frontend/dist/assets/{index-DoOFz9GF.css → index-DNe6bagG.css} +1 -1
- package/agent-pane/frontend/dist/index.html +2 -2
- package/miniapp-typesafe-verified.png +0 -0
- package/package.json +1 -1
|
@@ -76,7 +76,7 @@ var require_queue = __commonJS({
|
|
|
76
76
|
if (!(_concurrency >= 1)) {
|
|
77
77
|
throw new Error("fastqueue concurrency must be equal to or greater than 1");
|
|
78
78
|
}
|
|
79
|
-
var
|
|
79
|
+
var cache3 = reusify(Task);
|
|
80
80
|
var queueHead = null;
|
|
81
81
|
var queueTail = null;
|
|
82
82
|
var _running = 0;
|
|
@@ -155,7 +155,7 @@ var require_queue = __commonJS({
|
|
|
155
155
|
return _running === 0 && self.length() === 0;
|
|
156
156
|
}
|
|
157
157
|
function push(value, done) {
|
|
158
|
-
var current =
|
|
158
|
+
var current = cache3.get();
|
|
159
159
|
current.context = context;
|
|
160
160
|
current.release = release;
|
|
161
161
|
current.value = value;
|
|
@@ -176,7 +176,7 @@ var require_queue = __commonJS({
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
function unshift(value, done) {
|
|
179
|
-
var current =
|
|
179
|
+
var current = cache3.get();
|
|
180
180
|
current.context = context;
|
|
181
181
|
current.release = release;
|
|
182
182
|
current.value = value;
|
|
@@ -198,7 +198,7 @@ var require_queue = __commonJS({
|
|
|
198
198
|
}
|
|
199
199
|
function release(holder) {
|
|
200
200
|
if (holder) {
|
|
201
|
-
|
|
201
|
+
cache3.release(holder);
|
|
202
202
|
}
|
|
203
203
|
var next = queueHead;
|
|
204
204
|
if (next && _running <= _concurrency) {
|
|
@@ -3985,7 +3985,7 @@ var require_content_type = __commonJS({
|
|
|
3985
3985
|
var quotedPairReg = /\\([\t\u0020-\u00ff])/gu;
|
|
3986
3986
|
var typeNameReg = /^[\w!#$%&'*+.^`|~-]+$/;
|
|
3987
3987
|
var subtypeNameReg = /^[\w!#$%&'*+.^`|~-]+\s*$/;
|
|
3988
|
-
var
|
|
3988
|
+
var cache3 = new Lru(100);
|
|
3989
3989
|
var ContentType = class _ContentType {
|
|
3990
3990
|
#valid = false;
|
|
3991
3991
|
#empty = true;
|
|
@@ -3999,7 +3999,7 @@ var require_content_type = __commonJS({
|
|
|
3999
3999
|
* @type {Lru<ContentType>}
|
|
4000
4000
|
*/
|
|
4001
4001
|
static get cache() {
|
|
4002
|
-
return
|
|
4002
|
+
return cache3;
|
|
4003
4003
|
}
|
|
4004
4004
|
/**
|
|
4005
4005
|
* Create a ContentType instance from a header value. If the value has been
|
|
@@ -4008,10 +4008,10 @@ var require_content_type = __commonJS({
|
|
|
4008
4008
|
* @returns {ContentType | undefined}
|
|
4009
4009
|
*/
|
|
4010
4010
|
static from(headerValue) {
|
|
4011
|
-
let contentType =
|
|
4011
|
+
let contentType = cache3.get(headerValue);
|
|
4012
4012
|
if (contentType !== void 0) return contentType;
|
|
4013
4013
|
contentType = new _ContentType(headerValue);
|
|
4014
|
-
|
|
4014
|
+
cache3.set(headerValue, contentType);
|
|
4015
4015
|
return contentType;
|
|
4016
4016
|
}
|
|
4017
4017
|
constructor(headerValue) {
|
|
@@ -8982,12 +8982,12 @@ var require_levels = __commonJS({
|
|
|
8982
8982
|
function genLsCache(instance2) {
|
|
8983
8983
|
const formatter = instance2[formattersSym].level;
|
|
8984
8984
|
const { labels } = instance2.levels;
|
|
8985
|
-
const
|
|
8985
|
+
const cache3 = {};
|
|
8986
8986
|
for (const label in labels) {
|
|
8987
8987
|
const level = formatter(labels[label], Number(label));
|
|
8988
|
-
|
|
8988
|
+
cache3[label] = JSON.stringify(level).slice(0, -1);
|
|
8989
8989
|
}
|
|
8990
|
-
instance2[lsCacheSym] =
|
|
8990
|
+
instance2[lsCacheSym] = cache3;
|
|
8991
8991
|
return instance2;
|
|
8992
8992
|
}
|
|
8993
8993
|
function isStandardLevel(level, useOnlyCustomLevels) {
|
|
@@ -15405,8 +15405,8 @@ var require_dataType = __commonJS({
|
|
|
15405
15405
|
return types;
|
|
15406
15406
|
}
|
|
15407
15407
|
exports.getSchemaTypes = getSchemaTypes;
|
|
15408
|
-
function getJSONTypes(
|
|
15409
|
-
const types = Array.isArray(
|
|
15408
|
+
function getJSONTypes(ts2) {
|
|
15409
|
+
const types = Array.isArray(ts2) ? ts2 : ts2 ? [ts2] : [];
|
|
15410
15410
|
if (types.every(rules_1.isJSONType))
|
|
15411
15411
|
return types;
|
|
15412
15412
|
throw new Error("type must be JSONType or JSONType[]: " + types.join(","));
|
|
@@ -16448,18 +16448,18 @@ var require_validate = __commonJS({
|
|
|
16448
16448
|
});
|
|
16449
16449
|
narrowSchemaTypes(it, types);
|
|
16450
16450
|
}
|
|
16451
|
-
function checkMultipleTypes(it,
|
|
16452
|
-
if (
|
|
16451
|
+
function checkMultipleTypes(it, ts2) {
|
|
16452
|
+
if (ts2.length > 1 && !(ts2.length === 2 && ts2.includes("null"))) {
|
|
16453
16453
|
strictTypesError(it, "use allowUnionTypes to allow union type keyword");
|
|
16454
16454
|
}
|
|
16455
16455
|
}
|
|
16456
|
-
function checkKeywordTypes(it,
|
|
16456
|
+
function checkKeywordTypes(it, ts2) {
|
|
16457
16457
|
const rules = it.self.RULES.all;
|
|
16458
16458
|
for (const keyword in rules) {
|
|
16459
16459
|
const rule = rules[keyword];
|
|
16460
16460
|
if (typeof rule == "object" && (0, applicability_1.shouldUseRule)(it.schema, rule)) {
|
|
16461
16461
|
const { type } = rule.definition;
|
|
16462
|
-
if (type.length && !type.some((t) => hasApplicableType(
|
|
16462
|
+
if (type.length && !type.some((t) => hasApplicableType(ts2, t))) {
|
|
16463
16463
|
strictTypesError(it, `missing type "${type.join(",")}" for keyword "${keyword}"`);
|
|
16464
16464
|
}
|
|
16465
16465
|
}
|
|
@@ -16468,18 +16468,18 @@ var require_validate = __commonJS({
|
|
|
16468
16468
|
function hasApplicableType(schTs, kwdT) {
|
|
16469
16469
|
return schTs.includes(kwdT) || kwdT === "number" && schTs.includes("integer");
|
|
16470
16470
|
}
|
|
16471
|
-
function includesType(
|
|
16472
|
-
return
|
|
16471
|
+
function includesType(ts2, t) {
|
|
16472
|
+
return ts2.includes(t) || t === "integer" && ts2.includes("number");
|
|
16473
16473
|
}
|
|
16474
16474
|
function narrowSchemaTypes(it, withTypes) {
|
|
16475
|
-
const
|
|
16475
|
+
const ts2 = [];
|
|
16476
16476
|
for (const t of it.dataTypes) {
|
|
16477
16477
|
if (includesType(withTypes, t))
|
|
16478
|
-
|
|
16478
|
+
ts2.push(t);
|
|
16479
16479
|
else if (withTypes.includes("integer") && t === "number")
|
|
16480
|
-
|
|
16480
|
+
ts2.push("integer");
|
|
16481
16481
|
}
|
|
16482
|
-
it.dataTypes =
|
|
16482
|
+
it.dataTypes = ts2;
|
|
16483
16483
|
}
|
|
16484
16484
|
function strictTypesError(it, msg) {
|
|
16485
16485
|
const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;
|
|
@@ -28885,7 +28885,7 @@ var require_range = __commonJS({
|
|
|
28885
28885
|
range = range.replace(BUILDSTRIPRE, "");
|
|
28886
28886
|
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
|
28887
28887
|
const memoKey = memoOpts + ":" + range;
|
|
28888
|
-
const cached =
|
|
28888
|
+
const cached = cache3.get(memoKey);
|
|
28889
28889
|
if (cached) {
|
|
28890
28890
|
return cached;
|
|
28891
28891
|
}
|
|
@@ -28919,7 +28919,7 @@ var require_range = __commonJS({
|
|
|
28919
28919
|
rangeMap.delete("");
|
|
28920
28920
|
}
|
|
28921
28921
|
const result = [...rangeMap.values()];
|
|
28922
|
-
|
|
28922
|
+
cache3.set(memoKey, result);
|
|
28923
28923
|
return result;
|
|
28924
28924
|
}
|
|
28925
28925
|
intersects(range, options) {
|
|
@@ -28958,7 +28958,7 @@ var require_range = __commonJS({
|
|
|
28958
28958
|
};
|
|
28959
28959
|
module.exports = Range;
|
|
28960
28960
|
var LRU = require_lrucache();
|
|
28961
|
-
var
|
|
28961
|
+
var cache3 = new LRU();
|
|
28962
28962
|
var parseOptions = require_parse_options();
|
|
28963
28963
|
var Comparator = require_comparator();
|
|
28964
28964
|
var debug = require_debug2();
|
|
@@ -29908,12 +29908,12 @@ var require_plugin_utils = __commonJS({
|
|
|
29908
29908
|
if (display) {
|
|
29909
29909
|
return display;
|
|
29910
29910
|
}
|
|
29911
|
-
const
|
|
29912
|
-
if (
|
|
29913
|
-
const keys = Object.keys(
|
|
29911
|
+
const cache3 = __require.cache;
|
|
29912
|
+
if (cache3) {
|
|
29913
|
+
const keys = Object.keys(cache3);
|
|
29914
29914
|
for (let i = 0; i < keys.length; i++) {
|
|
29915
29915
|
const key = keys[i];
|
|
29916
|
-
if (
|
|
29916
|
+
if (cache3[key].exports === func) {
|
|
29917
29917
|
return key;
|
|
29918
29918
|
}
|
|
29919
29919
|
}
|
|
@@ -43560,7 +43560,15 @@ Each subdirectory of this folder is one mini app:
|
|
|
43560
43560
|
manifest.json - { "title": string, "description"?: string, "icon"?: string,
|
|
43561
43561
|
"tools"?: [{ "name", "description", "inputSchema" }] }
|
|
43562
43562
|
index.html - markup only (full HTML document); do NOT reference app.js
|
|
43563
|
-
app.
|
|
43563
|
+
app.ts - app logic (TypeScript, PREFERRED); injected automatically
|
|
43564
|
+
into the page as compiled JS
|
|
43565
|
+
app.js - legacy plain-JS logic; used only when app.ts is absent
|
|
43566
|
+
|
|
43567
|
+
The pane compiles app.ts on every change (strict mode, lib dom). Compile and
|
|
43568
|
+
type errors are shown in the app tab \u2014 check them after every edit and fix
|
|
43569
|
+
them before finishing. window.AgentPane is typed via ambient declarations
|
|
43570
|
+
(getState/setState/createSession/submitTurn/onToolCall/...); no import
|
|
43571
|
+
needed.
|
|
43564
43572
|
|
|
43565
43573
|
App state does NOT live in this folder \u2014 it is stored in the pane database
|
|
43566
43574
|
(app_instances table) and reached with getState()/setState().
|
|
@@ -43724,7 +43732,126 @@ function deleteAppInstances(appId) {
|
|
|
43724
43732
|
import fs3 from "node:fs";
|
|
43725
43733
|
|
|
43726
43734
|
// src/apps/headless-runtime.ts
|
|
43735
|
+
import vm2 from "node:vm";
|
|
43736
|
+
|
|
43737
|
+
// src/apps/app-compile.ts
|
|
43727
43738
|
import vm from "node:vm";
|
|
43739
|
+
import ts from "typescript";
|
|
43740
|
+
var APP_TS = "app.ts";
|
|
43741
|
+
var BRIDGE_DTS_FILE = "agentpane.d.ts";
|
|
43742
|
+
var BRIDGE_DTS = `/** AgentPane bridge \u2014 typed contract for mini apps (ambient, no import). */
|
|
43743
|
+
interface AgentPaneAppInfo { id: string; title?: string }
|
|
43744
|
+
interface AgentPaneState { pinned: boolean; data: Record<string, unknown> | null }
|
|
43745
|
+
interface AgentPaneSessionInfo { id: string; title?: string | null }
|
|
43746
|
+
interface AgentPaneCreateSessionOptions { title?: string; runtime_type?: string; model?: string; cwd?: string }
|
|
43747
|
+
interface AgentPaneTurnPayload { turnId?: string; response?: string | null; error?: string }
|
|
43748
|
+
interface AgentPaneDeltaPayload { sessionId?: string; turnId?: string; itemId?: string; delta?: string }
|
|
43749
|
+
interface AgentPaneToolCallPayload { callId: string; tool: string; name: string; args: Record<string, unknown> }
|
|
43750
|
+
|
|
43751
|
+
declare const AgentPane: {
|
|
43752
|
+
getApp(): Promise<AgentPaneAppInfo>;
|
|
43753
|
+
getState(): Promise<AgentPaneState>;
|
|
43754
|
+
setState(data: Record<string, unknown> | null): Promise<AgentPaneState>;
|
|
43755
|
+
createSession(opts?: AgentPaneCreateSessionOptions): Promise<AgentPaneSessionInfo>;
|
|
43756
|
+
submitTurn(sessionId: string, prompt: string): Promise<unknown>;
|
|
43757
|
+
onTurnCompleted(cb: (event: 'turn:completed' | 'turn:failed', payload: AgentPaneTurnPayload | null) => void): void;
|
|
43758
|
+
onTurnDelta(cb: (payload: AgentPaneDeltaPayload) => void): void;
|
|
43759
|
+
onToolCall(cb: (payload: AgentPaneToolCallPayload) => void): void;
|
|
43760
|
+
onStateChanged(cb: (payload: unknown) => void): void;
|
|
43761
|
+
resolveToolCall(callId: string, result?: unknown): Promise<{ ok: boolean }>;
|
|
43762
|
+
};
|
|
43763
|
+
`;
|
|
43764
|
+
var cache = /* @__PURE__ */ new Map();
|
|
43765
|
+
function invalidateCompiledApp(appId) {
|
|
43766
|
+
if (!appId) cache.clear();
|
|
43767
|
+
else cache.delete(appId);
|
|
43768
|
+
}
|
|
43769
|
+
function tsDiagnosticToFile(file, d) {
|
|
43770
|
+
if (!d.file) return null;
|
|
43771
|
+
const pos = d.file.getLineAndCharacterOfPosition(d.start ?? 0);
|
|
43772
|
+
return {
|
|
43773
|
+
severity: d.category === ts.DiagnosticCategory.Error ? "error" : "warning",
|
|
43774
|
+
file,
|
|
43775
|
+
line: pos.line + 1,
|
|
43776
|
+
column: pos.character + 1,
|
|
43777
|
+
message: ts.flattenDiagnosticMessageText(d.messageText, "\n")
|
|
43778
|
+
};
|
|
43779
|
+
}
|
|
43780
|
+
function typeCheckAppTs(source) {
|
|
43781
|
+
const options = {
|
|
43782
|
+
noEmit: true,
|
|
43783
|
+
target: ts.ScriptTarget.ES2020,
|
|
43784
|
+
module: ts.ModuleKind.None,
|
|
43785
|
+
lib: ["lib.es2020.d.ts", "lib.dom.d.ts"],
|
|
43786
|
+
strict: true,
|
|
43787
|
+
skipLibCheck: true
|
|
43788
|
+
};
|
|
43789
|
+
const host = ts.createCompilerHost(options);
|
|
43790
|
+
const origReadFile = host.readFile.bind(host);
|
|
43791
|
+
const origFileExists = host.fileExists.bind(host);
|
|
43792
|
+
host.readFile = (fname) => {
|
|
43793
|
+
if (fname === APP_TS) return source;
|
|
43794
|
+
if (fname === BRIDGE_DTS_FILE) return BRIDGE_DTS;
|
|
43795
|
+
return origReadFile(fname);
|
|
43796
|
+
};
|
|
43797
|
+
host.fileExists = (fname) => fname === APP_TS || fname === BRIDGE_DTS_FILE ? true : origFileExists(fname);
|
|
43798
|
+
host.writeFile = () => {
|
|
43799
|
+
};
|
|
43800
|
+
const program = ts.createProgram([APP_TS, BRIDGE_DTS_FILE], options, host);
|
|
43801
|
+
const appFile = program.getSourceFile(APP_TS);
|
|
43802
|
+
if (!appFile) return [];
|
|
43803
|
+
return [...program.getSyntacticDiagnostics(appFile), ...program.getSemanticDiagnostics(appFile)].map((d) => tsDiagnosticToFile(APP_TS, d)).filter((d) => d !== null);
|
|
43804
|
+
}
|
|
43805
|
+
function checkJsSyntax(js) {
|
|
43806
|
+
try {
|
|
43807
|
+
new vm.Script(js, { filename: "app.js" });
|
|
43808
|
+
return [];
|
|
43809
|
+
} catch (err) {
|
|
43810
|
+
const stack = err.stack ?? "";
|
|
43811
|
+
const m = stack.match(/app\.js:(\d+)/);
|
|
43812
|
+
return [
|
|
43813
|
+
{
|
|
43814
|
+
severity: "error",
|
|
43815
|
+
file: "app.js",
|
|
43816
|
+
line: m ? Number(m[1]) : 0,
|
|
43817
|
+
column: 0,
|
|
43818
|
+
message: err.message
|
|
43819
|
+
}
|
|
43820
|
+
];
|
|
43821
|
+
}
|
|
43822
|
+
}
|
|
43823
|
+
function compileAppJs(appId) {
|
|
43824
|
+
const cached = cache.get(appId);
|
|
43825
|
+
if (cached) return cached;
|
|
43826
|
+
const tsSource = readAppFile(appId, APP_TS);
|
|
43827
|
+
let result;
|
|
43828
|
+
if (tsSource.trim()) {
|
|
43829
|
+
const transpiled = ts.transpileModule(tsSource, {
|
|
43830
|
+
compilerOptions: { target: ts.ScriptTarget.ES2020, module: ts.ModuleKind.None },
|
|
43831
|
+
reportDiagnostics: true,
|
|
43832
|
+
fileName: APP_TS
|
|
43833
|
+
});
|
|
43834
|
+
const syntaxDiags = (transpiled.diagnostics ?? []).map((d) => tsDiagnosticToFile(APP_TS, d)).filter((d) => d !== null);
|
|
43835
|
+
const blocked = syntaxDiags.some((d) => d.severity === "error");
|
|
43836
|
+
result = {
|
|
43837
|
+
js: blocked ? "" : transpiled.outputText,
|
|
43838
|
+
sourceFile: "app.ts",
|
|
43839
|
+
diagnostics: blocked ? syntaxDiags : [...syntaxDiags, ...typeCheckAppTs(tsSource)]
|
|
43840
|
+
};
|
|
43841
|
+
} else {
|
|
43842
|
+
const js = readAppFile(appId, "app.js");
|
|
43843
|
+
if (!js.trim()) {
|
|
43844
|
+
result = { js: "", sourceFile: null, diagnostics: [] };
|
|
43845
|
+
} else {
|
|
43846
|
+
const syntaxDiags = checkJsSyntax(js);
|
|
43847
|
+
result = { js: syntaxDiags.length ? "" : js, sourceFile: "app.js", diagnostics: syntaxDiags };
|
|
43848
|
+
}
|
|
43849
|
+
}
|
|
43850
|
+
cache.set(appId, result);
|
|
43851
|
+
return result;
|
|
43852
|
+
}
|
|
43853
|
+
|
|
43854
|
+
// src/apps/headless-runtime.ts
|
|
43728
43855
|
var HEADLESS_TOOL_TIMEOUT_MS = Number(process.env.AGENT_PANE_TOOL_TIMEOUT_MS ?? 3e4);
|
|
43729
43856
|
function stub() {
|
|
43730
43857
|
const fn = function stub2() {
|
|
@@ -43752,7 +43879,7 @@ function getHeadlessToolHandler(appId, workspace = "") {
|
|
|
43752
43879
|
const key = runtimeKey(appId, workspace);
|
|
43753
43880
|
const cached = runtimes.get(key);
|
|
43754
43881
|
if (cached) return cached.handler;
|
|
43755
|
-
const js =
|
|
43882
|
+
const js = compileAppJs(appId).js;
|
|
43756
43883
|
if (!js.trim()) return null;
|
|
43757
43884
|
const manifest = readManifest(appId);
|
|
43758
43885
|
let handler = null;
|
|
@@ -43807,8 +43934,8 @@ function getHeadlessToolHandler(appId, workspace = "") {
|
|
|
43807
43934
|
sandbox.window = windowObj;
|
|
43808
43935
|
sandbox.self = windowObj;
|
|
43809
43936
|
try {
|
|
43810
|
-
const context =
|
|
43811
|
-
|
|
43937
|
+
const context = vm2.createContext(sandbox);
|
|
43938
|
+
vm2.runInContext(js, context, { filename: `${appId}/app.js` });
|
|
43812
43939
|
} catch (err) {
|
|
43813
43940
|
console.warn(`[headless:${appId}] app.js load failed: ${err.message}`);
|
|
43814
43941
|
return null;
|
|
@@ -43851,6 +43978,7 @@ function resolveHeadlessToolCall(callId, result) {
|
|
|
43851
43978
|
return true;
|
|
43852
43979
|
}
|
|
43853
43980
|
function invalidateHeadlessRuntime(appId) {
|
|
43981
|
+
invalidateCompiledApp(appId);
|
|
43854
43982
|
if (!appId) {
|
|
43855
43983
|
runtimes.clear();
|
|
43856
43984
|
return;
|
|
@@ -43955,19 +44083,24 @@ var SKELETON_HTML = `<!DOCTYPE html>
|
|
|
43955
44083
|
</body>
|
|
43956
44084
|
</html>
|
|
43957
44085
|
`;
|
|
43958
|
-
var
|
|
44086
|
+
var SKELETON_TS = `// Skeleton mini app (TypeScript). window.AgentPane is the typed pane bridge:
|
|
43959
44087
|
// getState() / setState(data) persistent state (survives reloads)
|
|
43960
44088
|
// createSession / submitTurn talk to an agent session
|
|
43961
44089
|
// onTurnCompleted / onToolCall react to agent events
|
|
43962
|
-
|
|
44090
|
+
interface Ui {
|
|
44091
|
+
ready: boolean;
|
|
44092
|
+
data: Record<string, unknown>;
|
|
44093
|
+
}
|
|
44094
|
+
|
|
44095
|
+
const ui: Ui = { ready: false, data: {} };
|
|
43963
44096
|
|
|
43964
|
-
function render() {
|
|
43965
|
-
document.getElementById('out')
|
|
43966
|
-
|
|
44097
|
+
function render(): void {
|
|
44098
|
+
const out = document.getElementById('out');
|
|
44099
|
+
if (out) out.textContent = ui.ready ? 'State: ' + JSON.stringify(ui.data) : 'Loading\u2026';
|
|
43967
44100
|
}
|
|
43968
44101
|
|
|
43969
|
-
(async function init() {
|
|
43970
|
-
|
|
44102
|
+
(async function init(): Promise<void> {
|
|
44103
|
+
const state = await AgentPane.getState();
|
|
43971
44104
|
ui.data = (state && state.data) || {};
|
|
43972
44105
|
ui.ready = true;
|
|
43973
44106
|
render();
|
|
@@ -44079,7 +44212,7 @@ async function registerAppRoutes(fastify, opts) {
|
|
|
44079
44212
|
)
|
|
44080
44213
|
);
|
|
44081
44214
|
fs4.writeFileSync(path5.join(dir, "index.html"), SKELETON_HTML.replaceAll("__TITLE__", cleanTitle2));
|
|
44082
|
-
fs4.writeFileSync(path5.join(dir, "app.
|
|
44215
|
+
fs4.writeFileSync(path5.join(dir, "app.ts"), SKELETON_TS);
|
|
44083
44216
|
return { ok: true, id };
|
|
44084
44217
|
}
|
|
44085
44218
|
);
|
|
@@ -44175,10 +44308,13 @@ async function registerAppRoutes(fastify, opts) {
|
|
|
44175
44308
|
if (!APP_ID_RE.test(id)) return reply.code(400).send({ error: "Invalid app id" });
|
|
44176
44309
|
const manifest = readManifest(id);
|
|
44177
44310
|
if (!manifest) return reply.code(404).send({ error: "App not found" });
|
|
44311
|
+
const compiled = compileAppJs(id);
|
|
44178
44312
|
return {
|
|
44179
44313
|
manifest,
|
|
44180
44314
|
html: readAppFile(id, "index.html"),
|
|
44181
|
-
js:
|
|
44315
|
+
js: compiled.js,
|
|
44316
|
+
sourceFile: compiled.sourceFile,
|
|
44317
|
+
diagnostics: compiled.diagnostics
|
|
44182
44318
|
};
|
|
44183
44319
|
});
|
|
44184
44320
|
fastify.get(
|
|
@@ -46283,7 +46419,7 @@ async function startService(daemon, projectPath) {
|
|
|
46283
46419
|
throw new Error(`Daemon failed to start backend for ${projectPath}: ${daemonErrorMessage(err)}`);
|
|
46284
46420
|
}
|
|
46285
46421
|
}
|
|
46286
|
-
function
|
|
46422
|
+
function cache2(absPath, service) {
|
|
46287
46423
|
const resolved = {
|
|
46288
46424
|
baseUrl: serviceBaseUrl(service),
|
|
46289
46425
|
port: service.port,
|
|
@@ -46316,22 +46452,22 @@ async function resolveBackendUrl(projectPath, opts = {}) {
|
|
|
46316
46452
|
const match = coveringService(services, absPath);
|
|
46317
46453
|
if (match && match.status === "running") {
|
|
46318
46454
|
if (await backendHealthy(serviceBaseUrl(match), match.path)) {
|
|
46319
|
-
return
|
|
46455
|
+
return cache2(absPath, match);
|
|
46320
46456
|
}
|
|
46321
46457
|
if (!autoStart) return null;
|
|
46322
46458
|
await restartService(daemon, match.name);
|
|
46323
46459
|
await waitForHealthy(serviceBaseUrl(match), match.name, match.path);
|
|
46324
|
-
return
|
|
46460
|
+
return cache2(absPath, match);
|
|
46325
46461
|
}
|
|
46326
46462
|
if (!autoStart) return null;
|
|
46327
46463
|
if (match) {
|
|
46328
46464
|
await restartService(daemon, match.name);
|
|
46329
46465
|
await waitForHealthy(serviceBaseUrl(match), match.name, match.path);
|
|
46330
|
-
return
|
|
46466
|
+
return cache2(absPath, match);
|
|
46331
46467
|
}
|
|
46332
46468
|
const service = await startService(daemon, absPath);
|
|
46333
46469
|
await waitForHealthy(serviceBaseUrl(service), service.name, absPath);
|
|
46334
|
-
return
|
|
46470
|
+
return cache2(absPath, service);
|
|
46335
46471
|
}
|
|
46336
46472
|
|
|
46337
46473
|
// src/repoburg/action-mapping.ts
|