@ggui-ai/ui-gen 0.5.0-rc.2 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/base.js +1 -0
- package/dist/adapters/base.js.map +1 -1
- package/dist/adapters/generation-dispatch.d.ts +1 -1
- package/dist/adapters/generation-dispatch.js +286 -168
- package/dist/adapters/generation-dispatch.js.map +1 -1
- package/dist/adapters/index.js +13 -2
- package/dist/adapters/index.js.map +1 -1
- package/dist/advanced/index.d.ts +2 -2
- package/dist/advanced/index.js +287 -168
- package/dist/advanced/index.js.map +1 -1
- package/dist/blueprint-validator.js +1 -1
- package/dist/blueprint-validator.js.map +1 -1
- package/dist/boilerplate.js +13 -24
- package/dist/boilerplate.js.map +1 -1
- package/dist/check/index.d.ts +3 -3
- package/dist/check/index.js.map +1 -1
- package/dist/classifier/index.d.ts +14 -17
- package/dist/classifier/index.js +3 -7
- package/dist/classifier/index.js.map +1 -1
- package/dist/{create-ui-generator-CQiyjb5D.d.ts → create-ui-generator-GX7tvbyH.d.ts} +1 -1
- package/dist/{dispatch-CzRfy1J7.d.ts → dispatch-Deo9qzrG.d.ts} +1 -1
- package/dist/evaluation/axis-checks/index.d.ts +3 -3
- package/dist/evaluation/axis-checks/registry.d.ts +1 -1
- package/dist/evaluation/index.d.ts +2 -2
- package/dist/evaluation/index.js +12 -4
- package/dist/evaluation/index.js.map +1 -1
- package/dist/harness/check/runtime-render/index.d.ts +1 -1
- package/dist/harness/check/runtime-render/index.js.map +1 -1
- package/dist/harness/index.d.ts +1 -1
- package/dist/harness/index.js +25 -28
- package/dist/harness/index.js.map +1 -1
- package/dist/harness/result-types.d.ts +1 -1
- package/dist/harness/runtime.d.ts +1 -1
- package/dist/harness/runtime.js +14 -25
- package/dist/harness/runtime.js.map +1 -1
- package/dist/harness/types-public.d.ts +1 -1
- package/dist/harness/types-public.js +13 -24
- package/dist/harness/types-public.js.map +1 -1
- package/dist/harness/validator-trace-sink.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +288 -168
- package/dist/index.js.map +1 -1
- package/dist/patch.d.ts +1 -1
- package/dist/provider-adapter-contract.js +61 -44
- package/dist/provider-adapter-contract.js.map +1 -1
- package/dist/providers/index.d.ts +2 -2
- package/dist/providers/index.js.map +1 -1
- package/dist/{types-public-D9swfbNi.d.ts → types-public-C36k1q6s.d.ts} +1 -1
- package/dist/validation/index.d.ts +1 -1
- package/dist/validation/index.js +5 -0
- package/dist/validation/index.js.map +1 -1
- package/dist/workflows.d.ts +1 -1
- package/package.json +12 -12
- package/src/blueprint-validator.ts +1 -1
- package/src/boilerplate/generate.ts +20 -31
- package/src/boilerplate/system-prompt.ts +2 -2
- package/src/check/extract-wire-calls.ts +2 -2
- package/src/classifier/axes.ts +2 -2
- package/src/classifier/classifier.ts +2 -2
- package/src/classifier/infer-layout.ts +1 -1
- package/src/classifier/infer-render.ts +1 -1
- package/src/classifier/infer-tooling.ts +1 -1
- package/src/classifier/infer-trigger.ts +3 -12
- package/src/classifier/inspect.ts +7 -7
- package/src/coding-agent/self-check.ts +1 -1
- package/src/evaluation/cost-tracker.ts +39 -11
- package/src/harness/check/runtime-render/render-check.ts +4 -4
- package/src/harness/llm-router.ts +2 -2
- package/src/providers/bedrock.ts +2 -2
- package/src/tools/get-wire.ts +1 -1
- package/src/validation/primitives.ts +2 -0
package/dist/advanced/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import * as esbuild2 from 'esbuild';
|
|
3
3
|
import { build } from 'esbuild';
|
|
4
4
|
import Anthropic from '@anthropic-ai/sdk';
|
|
5
|
-
import { classifyUi, DANGEROUS_PATTERNS as DANGEROUS_PATTERNS$1, listContractGadgets, HOOK_NAME_RE, STDLIB_GADGETS_PACKAGE, resolveAppGadgets } from '@ggui-ai/protocol';
|
|
5
|
+
import { classifyUi, MODEL_REGISTRY, DANGEROUS_PATTERNS as DANGEROUS_PATTERNS$1, listContractGadgets, HOOK_NAME_RE, STDLIB_GADGETS_PACKAGE, resolveAppGadgets } from '@ggui-ai/protocol';
|
|
6
6
|
import fs, { mkdirSync, writeFileSync, unlinkSync, readFileSync, existsSync, rm, createReadStream, createWriteStream } from 'fs';
|
|
7
7
|
import { contentHash } from '@ggui-ai/protocol/content-hash';
|
|
8
8
|
import ts7 from 'typescript';
|
|
@@ -32,11 +32,20 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
32
32
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
33
33
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
34
34
|
});
|
|
35
|
-
var __esm = (fn, res) => function __init() {
|
|
36
|
-
|
|
35
|
+
var __esm = (fn, res, err) => function __init() {
|
|
36
|
+
if (err) throw err[0];
|
|
37
|
+
try {
|
|
38
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
39
|
+
} catch (e) {
|
|
40
|
+
throw err = [e], e;
|
|
41
|
+
}
|
|
37
42
|
};
|
|
38
43
|
var __commonJS = (cb, mod) => function __require2() {
|
|
39
|
-
|
|
44
|
+
try {
|
|
45
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
46
|
+
} catch (e) {
|
|
47
|
+
throw mod = 0, e;
|
|
48
|
+
}
|
|
40
49
|
};
|
|
41
50
|
var __export = (target, all) => {
|
|
42
51
|
for (var name in all)
|
|
@@ -76,6 +85,7 @@ var init_base = __esm({
|
|
|
76
85
|
constructor(config) {
|
|
77
86
|
this.config = config;
|
|
78
87
|
}
|
|
88
|
+
config;
|
|
79
89
|
/**
|
|
80
90
|
* Map a LiteLLM-format model ID to this SDK's native format.
|
|
81
91
|
* Default: strips the provider prefix (e.g., 'anthropic/claude-sonnet-4-6' -> 'claude-sonnet-4-6').
|
|
@@ -1147,6 +1157,8 @@ var init_types = __esm({
|
|
|
1147
1157
|
this.code = code;
|
|
1148
1158
|
this.name = "OpenRouterError";
|
|
1149
1159
|
}
|
|
1160
|
+
status;
|
|
1161
|
+
code;
|
|
1150
1162
|
get isTransient() {
|
|
1151
1163
|
return this.status === 408 || this.status === 429 || this.status === 502 || this.status === 503;
|
|
1152
1164
|
}
|
|
@@ -1175,6 +1187,7 @@ var init_client2 = __esm({
|
|
|
1175
1187
|
"X-Title": config.siteName ?? process.env.OPENROUTER_SITE_NAME ?? "ggui"
|
|
1176
1188
|
};
|
|
1177
1189
|
}
|
|
1190
|
+
config;
|
|
1178
1191
|
baseUrl;
|
|
1179
1192
|
headers;
|
|
1180
1193
|
/**
|
|
@@ -1438,6 +1451,8 @@ var init_primitives = __esm({
|
|
|
1438
1451
|
"EmptyState",
|
|
1439
1452
|
"Stat",
|
|
1440
1453
|
"Stepper",
|
|
1454
|
+
"Markdown",
|
|
1455
|
+
"MarkdownInline",
|
|
1441
1456
|
"Header",
|
|
1442
1457
|
"Sidebar",
|
|
1443
1458
|
"CardGrid",
|
|
@@ -1884,6 +1899,7 @@ var init_ui_compiler = __esm({
|
|
|
1884
1899
|
this.validation = validation;
|
|
1885
1900
|
this.name = "UiValidationError";
|
|
1886
1901
|
}
|
|
1902
|
+
validation;
|
|
1887
1903
|
};
|
|
1888
1904
|
UiBundleSizeError = class extends Error {
|
|
1889
1905
|
constructor(size, limit) {
|
|
@@ -1892,6 +1908,8 @@ var init_ui_compiler = __esm({
|
|
|
1892
1908
|
this.limit = limit;
|
|
1893
1909
|
this.name = "UiBundleSizeError";
|
|
1894
1910
|
}
|
|
1911
|
+
size;
|
|
1912
|
+
limit;
|
|
1895
1913
|
};
|
|
1896
1914
|
}
|
|
1897
1915
|
});
|
|
@@ -4093,7 +4111,7 @@ function errorSummary(e) {
|
|
|
4093
4111
|
}
|
|
4094
4112
|
function interactionText(interaction) {
|
|
4095
4113
|
let text = "";
|
|
4096
|
-
for (const step of interaction.steps) {
|
|
4114
|
+
for (const step of interaction.steps ?? []) {
|
|
4097
4115
|
if (step.type === "model_output") {
|
|
4098
4116
|
for (const content of step.content ?? []) {
|
|
4099
4117
|
if (content.type === "text") {
|
|
@@ -4105,7 +4123,7 @@ function interactionText(interaction) {
|
|
|
4105
4123
|
return text;
|
|
4106
4124
|
}
|
|
4107
4125
|
function functionCallSteps(interaction) {
|
|
4108
|
-
return interaction.steps.filter(
|
|
4126
|
+
return (interaction.steps ?? []).filter(
|
|
4109
4127
|
(s) => s.type === "function_call"
|
|
4110
4128
|
);
|
|
4111
4129
|
}
|
|
@@ -6049,28 +6067,35 @@ var init_llm_evaluator = __esm({
|
|
|
6049
6067
|
// src/evaluation/cost-tracker.ts
|
|
6050
6068
|
var cost_tracker_exports = {};
|
|
6051
6069
|
__export(cost_tracker_exports, {
|
|
6052
|
-
CostTracker: () => CostTracker
|
|
6070
|
+
CostTracker: () => CostTracker,
|
|
6071
|
+
pricePer1k: () => pricePer1k
|
|
6053
6072
|
});
|
|
6054
|
-
|
|
6073
|
+
function resolveRegistryId(model) {
|
|
6074
|
+
const keys = Object.keys(MODEL_REGISTRY);
|
|
6075
|
+
if (keys.includes(model)) return model;
|
|
6076
|
+
const bySuffix = keys.find((id) => id.endsWith(`/${model}`));
|
|
6077
|
+
if (bySuffix) return bySuffix;
|
|
6078
|
+
const undated = model.replace(/-\d{8}$/, "");
|
|
6079
|
+
return keys.find((id) => id.endsWith(`/${undated}`)) ?? null;
|
|
6080
|
+
}
|
|
6081
|
+
function pricePer1k(model) {
|
|
6082
|
+
const id = resolveRegistryId(model);
|
|
6083
|
+
if (id === null) return FALLBACK_PER_1K;
|
|
6084
|
+
const { costs } = MODEL_REGISTRY[id];
|
|
6085
|
+
return { input: costs.inputPer1M / 1e3, output: costs.outputPer1M / 1e3 };
|
|
6086
|
+
}
|
|
6087
|
+
var FALLBACK_PER_1K, CostTracker;
|
|
6055
6088
|
var init_cost_tracker = __esm({
|
|
6056
6089
|
"src/evaluation/cost-tracker.ts"() {
|
|
6057
|
-
|
|
6058
|
-
"claude-sonnet-4-6": { input: 3e-3, output: 0.015 },
|
|
6059
|
-
"claude-haiku-4-5-20251001": { input: 8e-4, output: 4e-3 },
|
|
6060
|
-
"gemini-3-flash-preview": { input: 1e-4, output: 4e-4 },
|
|
6061
|
-
// Gemini 3.5 Flash-Lite — $0.30/$2.50 per MTok (ai.google.dev/gemini-api/docs/pricing).
|
|
6062
|
-
"gemini-3.5-flash-lite": { input: 3e-4, output: 25e-4 },
|
|
6063
|
-
"gpt-5.4-mini": { input: 3e-4, output: 12e-4 },
|
|
6064
|
-
// $1.00 in / $6.00 out per MTok (OpenAI list, 2026-07) → per-1K.
|
|
6065
|
-
"gpt-5.6-luna": { input: 1e-3, output: 6e-3 }
|
|
6066
|
-
};
|
|
6090
|
+
FALLBACK_PER_1K = { input: 3e-3, output: 0.015 };
|
|
6067
6091
|
CostTracker = class {
|
|
6068
6092
|
constructor(maxBudget) {
|
|
6069
6093
|
this.maxBudget = maxBudget;
|
|
6070
6094
|
}
|
|
6095
|
+
maxBudget;
|
|
6071
6096
|
totalCost = 0;
|
|
6072
6097
|
record(model, inputTokens, outputTokens) {
|
|
6073
|
-
const prices =
|
|
6098
|
+
const prices = pricePer1k(model);
|
|
6074
6099
|
const cost = inputTokens / 1e3 * prices.input + outputTokens / 1e3 * prices.output;
|
|
6075
6100
|
this.totalCost += cost;
|
|
6076
6101
|
return cost;
|
|
@@ -6092,7 +6117,7 @@ var init_cost_tracker = __esm({
|
|
|
6092
6117
|
|
|
6093
6118
|
// ../../node_modules/ms/index.js
|
|
6094
6119
|
var require_ms = __commonJS({
|
|
6095
|
-
"../../node_modules/ms/index.js"(exports
|
|
6120
|
+
"../../node_modules/ms/index.js"(exports, module) {
|
|
6096
6121
|
var s = 1e3;
|
|
6097
6122
|
var m = s * 60;
|
|
6098
6123
|
var h = m * 60;
|
|
@@ -6208,7 +6233,7 @@ var require_ms = __commonJS({
|
|
|
6208
6233
|
|
|
6209
6234
|
// ../../node_modules/debug/src/common.js
|
|
6210
6235
|
var require_common = __commonJS({
|
|
6211
|
-
"../../node_modules/debug/src/common.js"(exports
|
|
6236
|
+
"../../node_modules/debug/src/common.js"(exports, module) {
|
|
6212
6237
|
function setup(env) {
|
|
6213
6238
|
createDebug.debug = createDebug;
|
|
6214
6239
|
createDebug.default = createDebug;
|
|
@@ -6385,13 +6410,13 @@ var require_common = __commonJS({
|
|
|
6385
6410
|
|
|
6386
6411
|
// ../../node_modules/debug/src/browser.js
|
|
6387
6412
|
var require_browser = __commonJS({
|
|
6388
|
-
"../../node_modules/debug/src/browser.js"(exports
|
|
6389
|
-
exports
|
|
6390
|
-
exports
|
|
6391
|
-
exports
|
|
6392
|
-
exports
|
|
6393
|
-
exports
|
|
6394
|
-
exports
|
|
6413
|
+
"../../node_modules/debug/src/browser.js"(exports, module) {
|
|
6414
|
+
exports.formatArgs = formatArgs;
|
|
6415
|
+
exports.save = save;
|
|
6416
|
+
exports.load = load;
|
|
6417
|
+
exports.useColors = useColors;
|
|
6418
|
+
exports.storage = localstorage();
|
|
6419
|
+
exports.destroy = /* @__PURE__ */ (() => {
|
|
6395
6420
|
let warned = false;
|
|
6396
6421
|
return () => {
|
|
6397
6422
|
if (!warned) {
|
|
@@ -6400,7 +6425,7 @@ var require_browser = __commonJS({
|
|
|
6400
6425
|
}
|
|
6401
6426
|
};
|
|
6402
6427
|
})();
|
|
6403
|
-
exports
|
|
6428
|
+
exports.colors = [
|
|
6404
6429
|
"#0000CC",
|
|
6405
6430
|
"#0000FF",
|
|
6406
6431
|
"#0033CC",
|
|
@@ -6512,14 +6537,14 @@ var require_browser = __commonJS({
|
|
|
6512
6537
|
});
|
|
6513
6538
|
args.splice(lastC, 0, c);
|
|
6514
6539
|
}
|
|
6515
|
-
exports
|
|
6540
|
+
exports.log = console.debug || console.log || (() => {
|
|
6516
6541
|
});
|
|
6517
6542
|
function save(namespaces) {
|
|
6518
6543
|
try {
|
|
6519
6544
|
if (namespaces) {
|
|
6520
|
-
exports
|
|
6545
|
+
exports.storage.setItem("debug", namespaces);
|
|
6521
6546
|
} else {
|
|
6522
|
-
exports
|
|
6547
|
+
exports.storage.removeItem("debug");
|
|
6523
6548
|
}
|
|
6524
6549
|
} catch (error) {
|
|
6525
6550
|
}
|
|
@@ -6527,7 +6552,7 @@ var require_browser = __commonJS({
|
|
|
6527
6552
|
function load() {
|
|
6528
6553
|
let r;
|
|
6529
6554
|
try {
|
|
6530
|
-
r = exports
|
|
6555
|
+
r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
|
|
6531
6556
|
} catch (error) {
|
|
6532
6557
|
}
|
|
6533
6558
|
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
@@ -6541,7 +6566,7 @@ var require_browser = __commonJS({
|
|
|
6541
6566
|
} catch (error) {
|
|
6542
6567
|
}
|
|
6543
6568
|
}
|
|
6544
|
-
module.exports = require_common()(exports
|
|
6569
|
+
module.exports = require_common()(exports);
|
|
6545
6570
|
var { formatters } = module.exports;
|
|
6546
6571
|
formatters.j = function(v) {
|
|
6547
6572
|
try {
|
|
@@ -6555,7 +6580,7 @@ var require_browser = __commonJS({
|
|
|
6555
6580
|
|
|
6556
6581
|
// ../../node_modules/has-flag/index.js
|
|
6557
6582
|
var require_has_flag = __commonJS({
|
|
6558
|
-
"../../node_modules/has-flag/index.js"(exports
|
|
6583
|
+
"../../node_modules/has-flag/index.js"(exports, module) {
|
|
6559
6584
|
module.exports = (flag, argv = process.argv) => {
|
|
6560
6585
|
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
6561
6586
|
const position = argv.indexOf(prefix + flag);
|
|
@@ -6567,7 +6592,7 @@ var require_has_flag = __commonJS({
|
|
|
6567
6592
|
|
|
6568
6593
|
// ../../node_modules/supports-color/index.js
|
|
6569
6594
|
var require_supports_color = __commonJS({
|
|
6570
|
-
"../../node_modules/supports-color/index.js"(exports
|
|
6595
|
+
"../../node_modules/supports-color/index.js"(exports, module) {
|
|
6571
6596
|
var os = __require("os");
|
|
6572
6597
|
var tty = __require("tty");
|
|
6573
6598
|
var hasFlag = require_has_flag();
|
|
@@ -6668,25 +6693,25 @@ var require_supports_color = __commonJS({
|
|
|
6668
6693
|
|
|
6669
6694
|
// ../../node_modules/debug/src/node.js
|
|
6670
6695
|
var require_node = __commonJS({
|
|
6671
|
-
"../../node_modules/debug/src/node.js"(exports
|
|
6696
|
+
"../../node_modules/debug/src/node.js"(exports, module) {
|
|
6672
6697
|
var tty = __require("tty");
|
|
6673
6698
|
var util = __require("util");
|
|
6674
|
-
exports
|
|
6675
|
-
exports
|
|
6676
|
-
exports
|
|
6677
|
-
exports
|
|
6678
|
-
exports
|
|
6679
|
-
exports
|
|
6680
|
-
exports
|
|
6699
|
+
exports.init = init;
|
|
6700
|
+
exports.log = log;
|
|
6701
|
+
exports.formatArgs = formatArgs;
|
|
6702
|
+
exports.save = save;
|
|
6703
|
+
exports.load = load;
|
|
6704
|
+
exports.useColors = useColors;
|
|
6705
|
+
exports.destroy = util.deprecate(
|
|
6681
6706
|
() => {
|
|
6682
6707
|
},
|
|
6683
6708
|
"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."
|
|
6684
6709
|
);
|
|
6685
|
-
exports
|
|
6710
|
+
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
6686
6711
|
try {
|
|
6687
6712
|
const supportsColor = require_supports_color();
|
|
6688
6713
|
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
6689
|
-
exports
|
|
6714
|
+
exports.colors = [
|
|
6690
6715
|
20,
|
|
6691
6716
|
21,
|
|
6692
6717
|
26,
|
|
@@ -6767,7 +6792,7 @@ var require_node = __commonJS({
|
|
|
6767
6792
|
}
|
|
6768
6793
|
} catch (error) {
|
|
6769
6794
|
}
|
|
6770
|
-
exports
|
|
6795
|
+
exports.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
6771
6796
|
return /^debug_/i.test(key);
|
|
6772
6797
|
}).reduce((obj, key) => {
|
|
6773
6798
|
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
|
|
@@ -6787,7 +6812,7 @@ var require_node = __commonJS({
|
|
|
6787
6812
|
return obj;
|
|
6788
6813
|
}, {});
|
|
6789
6814
|
function useColors() {
|
|
6790
|
-
return "colors" in exports
|
|
6815
|
+
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
6791
6816
|
}
|
|
6792
6817
|
function formatArgs(args) {
|
|
6793
6818
|
const { namespace: name, useColors: useColors2 } = this;
|
|
@@ -6802,13 +6827,13 @@ var require_node = __commonJS({
|
|
|
6802
6827
|
}
|
|
6803
6828
|
}
|
|
6804
6829
|
function getDate() {
|
|
6805
|
-
if (exports
|
|
6830
|
+
if (exports.inspectOpts.hideDate) {
|
|
6806
6831
|
return "";
|
|
6807
6832
|
}
|
|
6808
6833
|
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
6809
6834
|
}
|
|
6810
6835
|
function log(...args) {
|
|
6811
|
-
return process.stderr.write(util.formatWithOptions(exports
|
|
6836
|
+
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + "\n");
|
|
6812
6837
|
}
|
|
6813
6838
|
function save(namespaces) {
|
|
6814
6839
|
if (namespaces) {
|
|
@@ -6822,12 +6847,12 @@ var require_node = __commonJS({
|
|
|
6822
6847
|
}
|
|
6823
6848
|
function init(debug) {
|
|
6824
6849
|
debug.inspectOpts = {};
|
|
6825
|
-
const keys = Object.keys(exports
|
|
6850
|
+
const keys = Object.keys(exports.inspectOpts);
|
|
6826
6851
|
for (let i = 0; i < keys.length; i++) {
|
|
6827
|
-
debug.inspectOpts[keys[i]] = exports
|
|
6852
|
+
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
6828
6853
|
}
|
|
6829
6854
|
}
|
|
6830
|
-
module.exports = require_common()(exports
|
|
6855
|
+
module.exports = require_common()(exports);
|
|
6831
6856
|
var { formatters } = module.exports;
|
|
6832
6857
|
formatters.o = function(v) {
|
|
6833
6858
|
this.inspectOpts.colors = this.useColors;
|
|
@@ -6842,7 +6867,7 @@ var require_node = __commonJS({
|
|
|
6842
6867
|
|
|
6843
6868
|
// ../../node_modules/debug/src/index.js
|
|
6844
6869
|
var require_src = __commonJS({
|
|
6845
|
-
"../../node_modules/debug/src/index.js"(exports
|
|
6870
|
+
"../../node_modules/debug/src/index.js"(exports, module) {
|
|
6846
6871
|
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
|
|
6847
6872
|
module.exports = require_browser();
|
|
6848
6873
|
} else {
|
|
@@ -6853,7 +6878,7 @@ var require_src = __commonJS({
|
|
|
6853
6878
|
|
|
6854
6879
|
// ../../node_modules/follow-redirects/debug.js
|
|
6855
6880
|
var require_debug = __commonJS({
|
|
6856
|
-
"../../node_modules/follow-redirects/debug.js"(exports
|
|
6881
|
+
"../../node_modules/follow-redirects/debug.js"(exports, module) {
|
|
6857
6882
|
var debug;
|
|
6858
6883
|
module.exports = function() {
|
|
6859
6884
|
if (!debug) {
|
|
@@ -6873,7 +6898,7 @@ var require_debug = __commonJS({
|
|
|
6873
6898
|
|
|
6874
6899
|
// ../../node_modules/follow-redirects/index.js
|
|
6875
6900
|
var require_follow_redirects = __commonJS({
|
|
6876
|
-
"../../node_modules/follow-redirects/index.js"(exports
|
|
6901
|
+
"../../node_modules/follow-redirects/index.js"(exports, module) {
|
|
6877
6902
|
var url = __require("url");
|
|
6878
6903
|
var URL2 = url.URL;
|
|
6879
6904
|
var http = __require("http");
|
|
@@ -7384,14 +7409,14 @@ var require_follow_redirects = __commonJS({
|
|
|
7384
7409
|
|
|
7385
7410
|
// ../../node_modules/events-universal/default.js
|
|
7386
7411
|
var require_default = __commonJS({
|
|
7387
|
-
"../../node_modules/events-universal/default.js"(exports
|
|
7412
|
+
"../../node_modules/events-universal/default.js"(exports, module) {
|
|
7388
7413
|
module.exports = __require("events");
|
|
7389
7414
|
}
|
|
7390
7415
|
});
|
|
7391
7416
|
|
|
7392
7417
|
// ../../node_modules/fast-fifo/fixed-size.js
|
|
7393
7418
|
var require_fixed_size = __commonJS({
|
|
7394
|
-
"../../node_modules/fast-fifo/fixed-size.js"(exports
|
|
7419
|
+
"../../node_modules/fast-fifo/fixed-size.js"(exports, module) {
|
|
7395
7420
|
module.exports = class FixedFIFO {
|
|
7396
7421
|
constructor(hwm) {
|
|
7397
7422
|
if (!(hwm > 0) || (hwm - 1 & hwm) !== 0) throw new Error("Max size for a FixedFIFO should be a power of two");
|
|
@@ -7431,7 +7456,7 @@ var require_fixed_size = __commonJS({
|
|
|
7431
7456
|
|
|
7432
7457
|
// ../../node_modules/fast-fifo/index.js
|
|
7433
7458
|
var require_fast_fifo = __commonJS({
|
|
7434
|
-
"../../node_modules/fast-fifo/index.js"(exports
|
|
7459
|
+
"../../node_modules/fast-fifo/index.js"(exports, module) {
|
|
7435
7460
|
var FixedFIFO = require_fixed_size();
|
|
7436
7461
|
module.exports = class FastFIFO {
|
|
7437
7462
|
constructor(hwm) {
|
|
@@ -7478,7 +7503,7 @@ var require_fast_fifo = __commonJS({
|
|
|
7478
7503
|
|
|
7479
7504
|
// ../../node_modules/b4a/index.js
|
|
7480
7505
|
var require_b4a = __commonJS({
|
|
7481
|
-
"../../node_modules/b4a/index.js"(exports
|
|
7506
|
+
"../../node_modules/b4a/index.js"(exports, module) {
|
|
7482
7507
|
function isBuffer(value) {
|
|
7483
7508
|
return Buffer.isBuffer(value) || value instanceof Uint8Array;
|
|
7484
7509
|
}
|
|
@@ -7635,7 +7660,7 @@ var require_b4a = __commonJS({
|
|
|
7635
7660
|
|
|
7636
7661
|
// ../../node_modules/text-decoder/lib/pass-through-decoder.js
|
|
7637
7662
|
var require_pass_through_decoder = __commonJS({
|
|
7638
|
-
"../../node_modules/text-decoder/lib/pass-through-decoder.js"(exports
|
|
7663
|
+
"../../node_modules/text-decoder/lib/pass-through-decoder.js"(exports, module) {
|
|
7639
7664
|
var b4a = require_b4a();
|
|
7640
7665
|
module.exports = class PassThroughDecoder {
|
|
7641
7666
|
constructor(encoding) {
|
|
@@ -7656,7 +7681,7 @@ var require_pass_through_decoder = __commonJS({
|
|
|
7656
7681
|
|
|
7657
7682
|
// ../../node_modules/text-decoder/lib/utf8-decoder.js
|
|
7658
7683
|
var require_utf8_decoder = __commonJS({
|
|
7659
|
-
"../../node_modules/text-decoder/lib/utf8-decoder.js"(exports
|
|
7684
|
+
"../../node_modules/text-decoder/lib/utf8-decoder.js"(exports, module) {
|
|
7660
7685
|
var b4a = require_b4a();
|
|
7661
7686
|
module.exports = class UTF8Decoder {
|
|
7662
7687
|
constructor() {
|
|
@@ -7803,7 +7828,7 @@ var require_utf8_decoder = __commonJS({
|
|
|
7803
7828
|
|
|
7804
7829
|
// ../../node_modules/text-decoder/index.js
|
|
7805
7830
|
var require_text_decoder = __commonJS({
|
|
7806
|
-
"../../node_modules/text-decoder/index.js"(exports
|
|
7831
|
+
"../../node_modules/text-decoder/index.js"(exports, module) {
|
|
7807
7832
|
var PassThroughDecoder = require_pass_through_decoder();
|
|
7808
7833
|
var UTF8Decoder = require_utf8_decoder();
|
|
7809
7834
|
module.exports = class TextDecoder {
|
|
@@ -7863,14 +7888,55 @@ var require_text_decoder = __commonJS({
|
|
|
7863
7888
|
}
|
|
7864
7889
|
});
|
|
7865
7890
|
|
|
7891
|
+
// ../../node_modules/streamx/lib/errors.js
|
|
7892
|
+
var require_errors = __commonJS({
|
|
7893
|
+
"../../node_modules/streamx/lib/errors.js"(exports, module) {
|
|
7894
|
+
module.exports = class StreamError extends Error {
|
|
7895
|
+
constructor(msg, code, fn = StreamError) {
|
|
7896
|
+
super(msg);
|
|
7897
|
+
this.code = code;
|
|
7898
|
+
if (Error.captureStackTrace) {
|
|
7899
|
+
Error.captureStackTrace(this, fn);
|
|
7900
|
+
}
|
|
7901
|
+
}
|
|
7902
|
+
static isStreamDestroyed(err) {
|
|
7903
|
+
return err && err.code === "STREAM_DESTROYED";
|
|
7904
|
+
}
|
|
7905
|
+
static isPrematureClose(err) {
|
|
7906
|
+
return err && err.code === "PREMATURE_CLOSE";
|
|
7907
|
+
}
|
|
7908
|
+
static isAborted(err) {
|
|
7909
|
+
return err && err.code === "ABORTED";
|
|
7910
|
+
}
|
|
7911
|
+
static isBadArgument(err) {
|
|
7912
|
+
return err && err.code === "BAD_ARGUMENT";
|
|
7913
|
+
}
|
|
7914
|
+
get name() {
|
|
7915
|
+
return "StreamError";
|
|
7916
|
+
}
|
|
7917
|
+
static STREAM_DESTROYED() {
|
|
7918
|
+
return new StreamError("Stream was destroyed", "STREAM_DESTROYED", StreamError.STREAM_DESTROYED);
|
|
7919
|
+
}
|
|
7920
|
+
static PREMATURE_CLOSE(msg = "Premature close") {
|
|
7921
|
+
return new StreamError(msg, "PREMATURE_CLOSE", StreamError.PREMATURE_CLOSE);
|
|
7922
|
+
}
|
|
7923
|
+
static ABORTED() {
|
|
7924
|
+
return new StreamError("Stream aborted", "ABORTED", StreamError.ABORTED);
|
|
7925
|
+
}
|
|
7926
|
+
static BAD_ARGUMENT(msg = "Bad argument") {
|
|
7927
|
+
return new StreamError(msg, "BAD_ARGUMENT", StreamError.BAD_ARGUMENT);
|
|
7928
|
+
}
|
|
7929
|
+
};
|
|
7930
|
+
}
|
|
7931
|
+
});
|
|
7932
|
+
|
|
7866
7933
|
// ../../node_modules/streamx/index.js
|
|
7867
7934
|
var require_streamx = __commonJS({
|
|
7868
|
-
"../../node_modules/streamx/index.js"(exports
|
|
7935
|
+
"../../node_modules/streamx/index.js"(exports, module) {
|
|
7869
7936
|
var { EventEmitter } = require_default();
|
|
7870
|
-
var STREAM_DESTROYED = new Error("Stream was destroyed");
|
|
7871
|
-
var PREMATURE_CLOSE = new Error("Premature close");
|
|
7872
7937
|
var FIFO = require_fast_fifo();
|
|
7873
7938
|
var TextDecoder2 = require_text_decoder();
|
|
7939
|
+
var StreamError = require_errors();
|
|
7874
7940
|
var qmt = typeof queueMicrotask === "undefined" ? (fn) => global.process.nextTick(fn) : queueMicrotask;
|
|
7875
7941
|
var MAX = (1 << 29) - 1;
|
|
7876
7942
|
var OPENING = 1;
|
|
@@ -7998,8 +8064,11 @@ var require_streamx = __commonJS({
|
|
|
7998
8064
|
return data;
|
|
7999
8065
|
}
|
|
8000
8066
|
end(data) {
|
|
8001
|
-
if (typeof data === "function")
|
|
8002
|
-
|
|
8067
|
+
if (typeof data === "function") {
|
|
8068
|
+
this.stream.once("finish", data);
|
|
8069
|
+
} else if (data !== void 0 && data !== null) {
|
|
8070
|
+
this.push(data);
|
|
8071
|
+
}
|
|
8003
8072
|
this.stream._duplexState = (this.stream._duplexState | WRITE_FINISHING) & WRITE_NON_PRIMARY;
|
|
8004
8073
|
}
|
|
8005
8074
|
autoBatch(data, cb) {
|
|
@@ -8050,8 +8119,11 @@ var require_streamx = __commonJS({
|
|
|
8050
8119
|
return true;
|
|
8051
8120
|
}
|
|
8052
8121
|
updateCallback() {
|
|
8053
|
-
if ((this.stream._duplexState & WRITE_UPDATE_SYNC_STATUS) === WRITE_PRIMARY)
|
|
8054
|
-
|
|
8122
|
+
if ((this.stream._duplexState & WRITE_UPDATE_SYNC_STATUS) === WRITE_PRIMARY) {
|
|
8123
|
+
this.update();
|
|
8124
|
+
} else {
|
|
8125
|
+
this.updateNextTick();
|
|
8126
|
+
}
|
|
8055
8127
|
}
|
|
8056
8128
|
updateNextTick() {
|
|
8057
8129
|
if ((this.stream._duplexState & WRITE_NEXT_TICK) !== 0) return;
|
|
@@ -8081,7 +8153,7 @@ var require_streamx = __commonJS({
|
|
|
8081
8153
|
return (this.stream._duplexState & READ_DONE) !== 0;
|
|
8082
8154
|
}
|
|
8083
8155
|
pipe(pipeTo, cb) {
|
|
8084
|
-
if (this.pipeTo !== null) throw
|
|
8156
|
+
if (this.pipeTo !== null) throw StreamError.BAD_ARGUMENT("Can only pipe to one destination");
|
|
8085
8157
|
if (typeof cb !== "function") cb = null;
|
|
8086
8158
|
this.stream._duplexState |= READ_PIPE_DRAINED;
|
|
8087
8159
|
this.pipeTo = pipeTo;
|
|
@@ -8124,7 +8196,9 @@ var require_streamx = __commonJS({
|
|
|
8124
8196
|
shift() {
|
|
8125
8197
|
const data = this.queue.shift();
|
|
8126
8198
|
this.buffered -= this.byteLength(data);
|
|
8127
|
-
if (this.buffered === 0)
|
|
8199
|
+
if (this.buffered === 0) {
|
|
8200
|
+
this.stream._duplexState &= READ_NOT_QUEUED;
|
|
8201
|
+
}
|
|
8128
8202
|
return data;
|
|
8129
8203
|
}
|
|
8130
8204
|
unshift(data) {
|
|
@@ -8141,9 +8215,12 @@ var require_streamx = __commonJS({
|
|
|
8141
8215
|
const stream = this.stream;
|
|
8142
8216
|
if ((stream._duplexState & READ_STATUS) === READ_QUEUED) {
|
|
8143
8217
|
const data = this.shift();
|
|
8144
|
-
if (this.pipeTo !== null && this.pipeTo.write(data) === false)
|
|
8218
|
+
if (this.pipeTo !== null && this.pipeTo.write(data) === false) {
|
|
8145
8219
|
stream._duplexState &= READ_PIPE_NOT_DRAINED;
|
|
8146
|
-
|
|
8220
|
+
}
|
|
8221
|
+
if ((stream._duplexState & READ_EMIT_DATA) !== 0) {
|
|
8222
|
+
stream.emit("data", data);
|
|
8223
|
+
}
|
|
8147
8224
|
return data;
|
|
8148
8225
|
}
|
|
8149
8226
|
if (this.readAhead === false) {
|
|
@@ -8156,9 +8233,12 @@ var require_streamx = __commonJS({
|
|
|
8156
8233
|
const stream = this.stream;
|
|
8157
8234
|
while ((stream._duplexState & READ_STATUS) === READ_QUEUED && (stream._duplexState & READ_FLOWING) !== 0) {
|
|
8158
8235
|
const data = this.shift();
|
|
8159
|
-
if (this.pipeTo !== null && this.pipeTo.write(data) === false)
|
|
8236
|
+
if (this.pipeTo !== null && this.pipeTo.write(data) === false) {
|
|
8160
8237
|
stream._duplexState &= READ_PIPE_NOT_DRAINED;
|
|
8161
|
-
|
|
8238
|
+
}
|
|
8239
|
+
if ((stream._duplexState & READ_EMIT_DATA) !== 0) {
|
|
8240
|
+
stream.emit("data", data);
|
|
8241
|
+
}
|
|
8162
8242
|
}
|
|
8163
8243
|
}
|
|
8164
8244
|
update() {
|
|
@@ -8175,7 +8255,9 @@ var require_streamx = __commonJS({
|
|
|
8175
8255
|
stream._duplexState |= READ_EMITTED_READABLE;
|
|
8176
8256
|
stream.emit("readable");
|
|
8177
8257
|
}
|
|
8178
|
-
if ((stream._duplexState & READ_PRIMARY_AND_ACTIVE) === 0)
|
|
8258
|
+
if ((stream._duplexState & READ_PRIMARY_AND_ACTIVE) === 0) {
|
|
8259
|
+
this.updateNonPrimary();
|
|
8260
|
+
}
|
|
8179
8261
|
} while (this.continueUpdate() === true);
|
|
8180
8262
|
stream._duplexState &= READ_NOT_UPDATING;
|
|
8181
8263
|
}
|
|
@@ -8184,8 +8266,12 @@ var require_streamx = __commonJS({
|
|
|
8184
8266
|
if ((stream._duplexState & READ_ENDING_STATUS) === READ_ENDING) {
|
|
8185
8267
|
stream._duplexState = (stream._duplexState | READ_DONE) & READ_NOT_ENDING;
|
|
8186
8268
|
stream.emit("end");
|
|
8187
|
-
if ((stream._duplexState & AUTO_DESTROY) === DONE)
|
|
8188
|
-
|
|
8269
|
+
if ((stream._duplexState & AUTO_DESTROY) === DONE) {
|
|
8270
|
+
stream._duplexState |= DESTROYING;
|
|
8271
|
+
}
|
|
8272
|
+
if (this.pipeTo !== null) {
|
|
8273
|
+
this.pipeTo.end();
|
|
8274
|
+
}
|
|
8189
8275
|
}
|
|
8190
8276
|
if ((stream._duplexState & DESTROY_STATUS) === DESTROYING) {
|
|
8191
8277
|
if ((stream._duplexState & ACTIVE_OR_TICKING) === 0) {
|
|
@@ -8205,8 +8291,11 @@ var require_streamx = __commonJS({
|
|
|
8205
8291
|
return true;
|
|
8206
8292
|
}
|
|
8207
8293
|
updateCallback() {
|
|
8208
|
-
if ((this.stream._duplexState & READ_UPDATE_SYNC_STATUS) === READ_PRIMARY)
|
|
8209
|
-
|
|
8294
|
+
if ((this.stream._duplexState & READ_UPDATE_SYNC_STATUS) === READ_PRIMARY) {
|
|
8295
|
+
this.update();
|
|
8296
|
+
} else {
|
|
8297
|
+
this.updateNextTick();
|
|
8298
|
+
}
|
|
8210
8299
|
}
|
|
8211
8300
|
updateNextTickIfOpen() {
|
|
8212
8301
|
if ((this.stream._duplexState & READ_NEXT_TICK_OR_OPENING) !== 0) return;
|
|
@@ -8243,7 +8332,7 @@ var require_streamx = __commonJS({
|
|
|
8243
8332
|
this.to = null;
|
|
8244
8333
|
if (this.from !== null) {
|
|
8245
8334
|
if ((this.from._duplexState & READ_DONE) === 0 || !this.pipeToFinished) {
|
|
8246
|
-
this.from.destroy(this.error ||
|
|
8335
|
+
this.from.destroy(this.error || StreamError.PREMATURE_CLOSE("Writable stream closed"));
|
|
8247
8336
|
}
|
|
8248
8337
|
return;
|
|
8249
8338
|
}
|
|
@@ -8252,7 +8341,7 @@ var require_streamx = __commonJS({
|
|
|
8252
8341
|
this.from = null;
|
|
8253
8342
|
if (this.to !== null) {
|
|
8254
8343
|
if ((stream._duplexState & READ_DONE) === 0) {
|
|
8255
|
-
this.to.destroy(this.error ||
|
|
8344
|
+
this.to.destroy(this.error || StreamError.PREMATURE_CLOSE("Readable stream closed"));
|
|
8256
8345
|
}
|
|
8257
8346
|
return;
|
|
8258
8347
|
}
|
|
@@ -8276,21 +8365,30 @@ var require_streamx = __commonJS({
|
|
|
8276
8365
|
stream._duplexState |= DESTROYING;
|
|
8277
8366
|
}
|
|
8278
8367
|
stream._duplexState &= WRITE_NOT_FINISHING;
|
|
8279
|
-
if ((stream._duplexState & WRITE_UPDATING) === 0)
|
|
8280
|
-
|
|
8368
|
+
if ((stream._duplexState & WRITE_UPDATING) === 0) {
|
|
8369
|
+
this.update();
|
|
8370
|
+
} else {
|
|
8371
|
+
this.updateNextTick();
|
|
8372
|
+
}
|
|
8281
8373
|
}
|
|
8282
8374
|
function afterDestroy(err) {
|
|
8283
8375
|
const stream = this.stream;
|
|
8284
|
-
if (!err && this.error
|
|
8376
|
+
if (!err && !StreamError.isStreamDestroyed(this.error)) err = this.error;
|
|
8285
8377
|
if (err) stream.emit("error", err);
|
|
8286
8378
|
stream._duplexState |= DESTROYED;
|
|
8287
8379
|
stream.emit("close");
|
|
8288
8380
|
const rs = stream._readableState;
|
|
8289
8381
|
const ws = stream._writableState;
|
|
8290
|
-
if (rs !== null && rs.pipeline !== null)
|
|
8382
|
+
if (rs !== null && rs.pipeline !== null) {
|
|
8383
|
+
rs.pipeline.done(stream, err);
|
|
8384
|
+
}
|
|
8291
8385
|
if (ws !== null) {
|
|
8292
|
-
while (ws.drains !== null && ws.drains.length > 0)
|
|
8293
|
-
|
|
8386
|
+
while (ws.drains !== null && ws.drains.length > 0) {
|
|
8387
|
+
ws.drains.shift().resolve(false);
|
|
8388
|
+
}
|
|
8389
|
+
if (ws.pipeline !== null) {
|
|
8390
|
+
ws.pipeline.done(stream, err);
|
|
8391
|
+
}
|
|
8294
8392
|
}
|
|
8295
8393
|
}
|
|
8296
8394
|
function afterWrite(err) {
|
|
@@ -8309,8 +8407,9 @@ var require_streamx = __commonJS({
|
|
|
8309
8407
|
function afterRead(err) {
|
|
8310
8408
|
if (err) this.stream.destroy(err);
|
|
8311
8409
|
this.stream._duplexState &= READ_NOT_ACTIVE;
|
|
8312
|
-
if (this.readAhead === false && (this.stream._duplexState & READ_RESUMED) === 0)
|
|
8410
|
+
if (this.readAhead === false && (this.stream._duplexState & READ_RESUMED) === 0) {
|
|
8313
8411
|
this.stream._duplexState &= READ_NO_READ_AHEAD;
|
|
8412
|
+
}
|
|
8314
8413
|
this.updateCallback();
|
|
8315
8414
|
}
|
|
8316
8415
|
function updateReadNT() {
|
|
@@ -8337,8 +8436,12 @@ var require_streamx = __commonJS({
|
|
|
8337
8436
|
const stream = this.stream;
|
|
8338
8437
|
if (err) stream.destroy(err);
|
|
8339
8438
|
if ((stream._duplexState & DESTROYING) === 0) {
|
|
8340
|
-
if ((stream._duplexState & READ_PRIMARY_STATUS) === 0)
|
|
8341
|
-
|
|
8439
|
+
if ((stream._duplexState & READ_PRIMARY_STATUS) === 0) {
|
|
8440
|
+
stream._duplexState |= READ_PRIMARY;
|
|
8441
|
+
}
|
|
8442
|
+
if ((stream._duplexState & WRITE_PRIMARY_STATUS) === 0) {
|
|
8443
|
+
stream._duplexState |= WRITE_PRIMARY;
|
|
8444
|
+
}
|
|
8342
8445
|
stream.emit("open");
|
|
8343
8446
|
}
|
|
8344
8447
|
stream._duplexState &= NOT_ACTIVE;
|
|
@@ -8381,9 +8484,7 @@ var require_streamx = __commonJS({
|
|
|
8381
8484
|
if (opts.open) this._open = opts.open;
|
|
8382
8485
|
if (opts.destroy) this._destroy = opts.destroy;
|
|
8383
8486
|
if (opts.predestroy) this._predestroy = opts.predestroy;
|
|
8384
|
-
if (opts.signal)
|
|
8385
|
-
opts.signal.addEventListener("abort", abort.bind(this));
|
|
8386
|
-
}
|
|
8487
|
+
if (opts.signal) opts.signal.addEventListener("abort", abort.bind(this));
|
|
8387
8488
|
}
|
|
8388
8489
|
this.on("newListener", newListener);
|
|
8389
8490
|
}
|
|
@@ -8409,7 +8510,7 @@ var require_streamx = __commonJS({
|
|
|
8409
8510
|
}
|
|
8410
8511
|
destroy(err) {
|
|
8411
8512
|
if ((this._duplexState & DESTROY_STATUS) === 0) {
|
|
8412
|
-
if (!err) err = STREAM_DESTROYED;
|
|
8513
|
+
if (!err) err = StreamError.STREAM_DESTROYED();
|
|
8413
8514
|
this._duplexState = (this._duplexState | DESTROYING) & NON_PRIMARY;
|
|
8414
8515
|
if (this._readableState !== null) {
|
|
8415
8516
|
this._readableState.highWaterMark = 0;
|
|
@@ -8422,8 +8523,12 @@ var require_streamx = __commonJS({
|
|
|
8422
8523
|
this._duplexState |= PREDESTROYING;
|
|
8423
8524
|
this._predestroy();
|
|
8424
8525
|
this._duplexState &= NOT_PREDESTROYING;
|
|
8425
|
-
if (this._readableState !== null)
|
|
8426
|
-
|
|
8526
|
+
if (this._readableState !== null) {
|
|
8527
|
+
this._readableState.updateNextTick();
|
|
8528
|
+
}
|
|
8529
|
+
if (this._writableState !== null) {
|
|
8530
|
+
this._writableState.updateNextTick();
|
|
8531
|
+
}
|
|
8427
8532
|
}
|
|
8428
8533
|
}
|
|
8429
8534
|
};
|
|
@@ -8439,6 +8544,15 @@ var require_streamx = __commonJS({
|
|
|
8439
8544
|
if (opts.encoding) this.setEncoding(opts.encoding);
|
|
8440
8545
|
}
|
|
8441
8546
|
}
|
|
8547
|
+
static deferred(fn, opts) {
|
|
8548
|
+
const out = new PassThrough(opts);
|
|
8549
|
+
fn().then((src) => {
|
|
8550
|
+
if (src === null) return out.end();
|
|
8551
|
+
if (out.destroying) return;
|
|
8552
|
+
pipeline(src, out, noop);
|
|
8553
|
+
}).catch((err) => out.destroy(err));
|
|
8554
|
+
return out;
|
|
8555
|
+
}
|
|
8442
8556
|
setEncoding(encoding) {
|
|
8443
8557
|
const dec = new TextDecoder2(encoding);
|
|
8444
8558
|
const map = this._readableState.map || echo;
|
|
@@ -8556,10 +8670,13 @@ var require_streamx = __commonJS({
|
|
|
8556
8670
|
}
|
|
8557
8671
|
function ondata(data) {
|
|
8558
8672
|
if (promiseReject === null) return;
|
|
8559
|
-
if (error)
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8673
|
+
if (error) {
|
|
8674
|
+
promiseReject(error);
|
|
8675
|
+
} else if (data === null && (stream._duplexState & READ_DONE) === 0) {
|
|
8676
|
+
promiseReject(StreamError.STREAM_DESTROYED());
|
|
8677
|
+
} else {
|
|
8678
|
+
promiseResolve({ value: data, done: data === null });
|
|
8679
|
+
}
|
|
8563
8680
|
promiseReject = promiseResolve = null;
|
|
8564
8681
|
}
|
|
8565
8682
|
function destroy(err) {
|
|
@@ -8728,7 +8845,7 @@ var require_streamx = __commonJS({
|
|
|
8728
8845
|
function pipeline(stream, ...streams) {
|
|
8729
8846
|
const all = Array.isArray(stream) ? [...stream, ...streams] : [stream, ...streams];
|
|
8730
8847
|
const done = all.length && typeof all[all.length - 1] === "function" ? all.pop() : null;
|
|
8731
|
-
if (all.length < 2) throw
|
|
8848
|
+
if (all.length < 2) throw StreamError.BAD_ARGUMENT("Pipeline requires at least 2 streams");
|
|
8732
8849
|
let src = all[0];
|
|
8733
8850
|
let dest = null;
|
|
8734
8851
|
let error = null;
|
|
@@ -8753,7 +8870,7 @@ var require_streamx = __commonJS({
|
|
|
8753
8870
|
if (!autoDestroy) done(error);
|
|
8754
8871
|
});
|
|
8755
8872
|
if (autoDestroy) {
|
|
8756
|
-
dest.on("close", () => done(error || (fin ? null : PREMATURE_CLOSE)));
|
|
8873
|
+
dest.on("close", () => done(error || (fin ? null : StreamError.PREMATURE_CLOSE())));
|
|
8757
8874
|
}
|
|
8758
8875
|
}
|
|
8759
8876
|
return dest;
|
|
@@ -8761,8 +8878,12 @@ var require_streamx = __commonJS({
|
|
|
8761
8878
|
s.on("error", onerror2);
|
|
8762
8879
|
s.on("close", onclose);
|
|
8763
8880
|
function onclose() {
|
|
8764
|
-
if (s._readableState && !s._readableState.ended)
|
|
8765
|
-
|
|
8881
|
+
if (s._readableState && !s._readableState.ended) {
|
|
8882
|
+
return onerror2(StreamError.PREMATURE_CLOSE());
|
|
8883
|
+
}
|
|
8884
|
+
if (wr && s._writableState && !s._writableState.ended) {
|
|
8885
|
+
return onerror2(StreamError.PREMATURE_CLOSE());
|
|
8886
|
+
}
|
|
8766
8887
|
}
|
|
8767
8888
|
}
|
|
8768
8889
|
function onerror(err) {
|
|
@@ -8796,7 +8917,7 @@ var require_streamx = __commonJS({
|
|
|
8796
8917
|
}
|
|
8797
8918
|
function getStreamError(stream, opts = {}) {
|
|
8798
8919
|
const err = stream._readableState && stream._readableState.error || stream._writableState && stream._writableState.error;
|
|
8799
|
-
return !opts.all && err
|
|
8920
|
+
return !opts.all && StreamError.isStreamDestroyed(err) ? null : err;
|
|
8800
8921
|
}
|
|
8801
8922
|
function isReadStreamx(stream) {
|
|
8802
8923
|
return isStreamx(stream) && stream.readable;
|
|
@@ -8813,7 +8934,7 @@ var require_streamx = __commonJS({
|
|
|
8813
8934
|
function noop() {
|
|
8814
8935
|
}
|
|
8815
8936
|
function abort() {
|
|
8816
|
-
this.destroy(
|
|
8937
|
+
this.destroy(StreamError.ABORTED());
|
|
8817
8938
|
}
|
|
8818
8939
|
function isWritev(s) {
|
|
8819
8940
|
return s._writev !== Writable.prototype._writev && s._writev !== Duplex.prototype._writev;
|
|
@@ -8842,7 +8963,7 @@ var require_streamx = __commonJS({
|
|
|
8842
8963
|
|
|
8843
8964
|
// ../../node_modules/tar-fs/node_modules/tar-stream/headers.js
|
|
8844
8965
|
var require_headers = __commonJS({
|
|
8845
|
-
"../../node_modules/tar-fs/node_modules/tar-stream/headers.js"(exports
|
|
8966
|
+
"../../node_modules/tar-fs/node_modules/tar-stream/headers.js"(exports) {
|
|
8846
8967
|
var b4a = require_b4a();
|
|
8847
8968
|
var ZEROS = "0000000000000000000";
|
|
8848
8969
|
var SEVENS = "7777777777777777777";
|
|
@@ -8854,10 +8975,10 @@ var require_headers = __commonJS({
|
|
|
8854
8975
|
var MASK = 4095;
|
|
8855
8976
|
var MAGIC_OFFSET = 257;
|
|
8856
8977
|
var VERSION_OFFSET = 263;
|
|
8857
|
-
exports
|
|
8978
|
+
exports.decodeLongPath = function decodeLongPath(buf, encoding) {
|
|
8858
8979
|
return decodeStr(buf, 0, buf.length, encoding);
|
|
8859
8980
|
};
|
|
8860
|
-
exports
|
|
8981
|
+
exports.encodePax = function encodePax(opts) {
|
|
8861
8982
|
let result = "";
|
|
8862
8983
|
if (opts.name) result += addLength(" path=" + opts.name + "\n");
|
|
8863
8984
|
if (opts.linkname) result += addLength(" linkpath=" + opts.linkname + "\n");
|
|
@@ -8869,7 +8990,7 @@ var require_headers = __commonJS({
|
|
|
8869
8990
|
}
|
|
8870
8991
|
return b4a.from(result);
|
|
8871
8992
|
};
|
|
8872
|
-
exports
|
|
8993
|
+
exports.decodePax = function decodePax(buf) {
|
|
8873
8994
|
const result = {};
|
|
8874
8995
|
while (buf.length) {
|
|
8875
8996
|
let i = 0;
|
|
@@ -8884,7 +9005,7 @@ var require_headers = __commonJS({
|
|
|
8884
9005
|
}
|
|
8885
9006
|
return result;
|
|
8886
9007
|
};
|
|
8887
|
-
exports
|
|
9008
|
+
exports.encode = function encode(opts) {
|
|
8888
9009
|
const buf = b4a.alloc(512);
|
|
8889
9010
|
let name = opts.name;
|
|
8890
9011
|
let prefix = "";
|
|
@@ -8916,7 +9037,7 @@ var require_headers = __commonJS({
|
|
|
8916
9037
|
b4a.write(buf, encodeOct(cksum(buf), 6), 148);
|
|
8917
9038
|
return buf;
|
|
8918
9039
|
};
|
|
8919
|
-
exports
|
|
9040
|
+
exports.decode = function decode(buf, filenameEncoding, allowUnknownFormat) {
|
|
8920
9041
|
let typeflag = buf[156] === 0 ? 0 : buf[156] - ZERO_OFFSET;
|
|
8921
9042
|
let name = decodeStr(buf, 0, 100, filenameEncoding);
|
|
8922
9043
|
const mode = decodeOct(buf, 100, 8);
|
|
@@ -9102,7 +9223,7 @@ var require_headers = __commonJS({
|
|
|
9102
9223
|
|
|
9103
9224
|
// ../../node_modules/tar-fs/node_modules/tar-stream/extract.js
|
|
9104
9225
|
var require_extract = __commonJS({
|
|
9105
|
-
"../../node_modules/tar-fs/node_modules/tar-stream/extract.js"(exports
|
|
9226
|
+
"../../node_modules/tar-fs/node_modules/tar-stream/extract.js"(exports, module) {
|
|
9106
9227
|
var { Writable, Readable, getStreamError } = require_streamx();
|
|
9107
9228
|
var FIFO = require_fast_fifo();
|
|
9108
9229
|
var b4a = require_b4a();
|
|
@@ -9436,7 +9557,7 @@ var require_extract = __commonJS({
|
|
|
9436
9557
|
|
|
9437
9558
|
// ../../node_modules/tar-fs/node_modules/tar-stream/constants.js
|
|
9438
9559
|
var require_constants = __commonJS({
|
|
9439
|
-
"../../node_modules/tar-fs/node_modules/tar-stream/constants.js"(exports
|
|
9560
|
+
"../../node_modules/tar-fs/node_modules/tar-stream/constants.js"(exports, module) {
|
|
9440
9561
|
var constants = {
|
|
9441
9562
|
// just for envs without fs
|
|
9442
9563
|
S_IFMT: 61440,
|
|
@@ -9456,7 +9577,7 @@ var require_constants = __commonJS({
|
|
|
9456
9577
|
|
|
9457
9578
|
// ../../node_modules/tar-fs/node_modules/tar-stream/pack.js
|
|
9458
9579
|
var require_pack = __commonJS({
|
|
9459
|
-
"../../node_modules/tar-fs/node_modules/tar-stream/pack.js"(exports
|
|
9580
|
+
"../../node_modules/tar-fs/node_modules/tar-stream/pack.js"(exports, module) {
|
|
9460
9581
|
var { Readable, Writable, getStreamError } = require_streamx();
|
|
9461
9582
|
var b4a = require_b4a();
|
|
9462
9583
|
var constants = require_constants();
|
|
@@ -9690,15 +9811,15 @@ var require_pack = __commonJS({
|
|
|
9690
9811
|
|
|
9691
9812
|
// ../../node_modules/tar-fs/node_modules/tar-stream/index.js
|
|
9692
9813
|
var require_tar_stream = __commonJS({
|
|
9693
|
-
"../../node_modules/tar-fs/node_modules/tar-stream/index.js"(exports
|
|
9694
|
-
exports
|
|
9695
|
-
exports
|
|
9814
|
+
"../../node_modules/tar-fs/node_modules/tar-stream/index.js"(exports) {
|
|
9815
|
+
exports.extract = require_extract();
|
|
9816
|
+
exports.pack = require_pack();
|
|
9696
9817
|
}
|
|
9697
9818
|
});
|
|
9698
9819
|
|
|
9699
9820
|
// ../../node_modules/wrappy/wrappy.js
|
|
9700
9821
|
var require_wrappy = __commonJS({
|
|
9701
|
-
"../../node_modules/wrappy/wrappy.js"(exports
|
|
9822
|
+
"../../node_modules/wrappy/wrappy.js"(exports, module) {
|
|
9702
9823
|
module.exports = wrappy;
|
|
9703
9824
|
function wrappy(fn, cb) {
|
|
9704
9825
|
if (fn && cb) return wrappy(fn)(cb);
|
|
@@ -9728,7 +9849,7 @@ var require_wrappy = __commonJS({
|
|
|
9728
9849
|
|
|
9729
9850
|
// ../../node_modules/once/once.js
|
|
9730
9851
|
var require_once = __commonJS({
|
|
9731
|
-
"../../node_modules/once/once.js"(exports
|
|
9852
|
+
"../../node_modules/once/once.js"(exports, module) {
|
|
9732
9853
|
var wrappy = require_wrappy();
|
|
9733
9854
|
module.exports = wrappy(once);
|
|
9734
9855
|
module.exports.strict = wrappy(onceStrict);
|
|
@@ -9772,7 +9893,7 @@ var require_once = __commonJS({
|
|
|
9772
9893
|
|
|
9773
9894
|
// ../../node_modules/end-of-stream/index.js
|
|
9774
9895
|
var require_end_of_stream = __commonJS({
|
|
9775
|
-
"../../node_modules/end-of-stream/index.js"(exports
|
|
9896
|
+
"../../node_modules/end-of-stream/index.js"(exports, module) {
|
|
9776
9897
|
var once = require_once();
|
|
9777
9898
|
var noop = function() {
|
|
9778
9899
|
};
|
|
@@ -9855,7 +9976,7 @@ var require_end_of_stream = __commonJS({
|
|
|
9855
9976
|
|
|
9856
9977
|
// ../../node_modules/pump/index.js
|
|
9857
9978
|
var require_pump = __commonJS({
|
|
9858
|
-
"../../node_modules/pump/index.js"(exports
|
|
9979
|
+
"../../node_modules/pump/index.js"(exports, module) {
|
|
9859
9980
|
var once = require_once();
|
|
9860
9981
|
var eos = require_end_of_stream();
|
|
9861
9982
|
var fs2;
|
|
@@ -9930,13 +10051,13 @@ var require_pump = __commonJS({
|
|
|
9930
10051
|
|
|
9931
10052
|
// ../../node_modules/tar-fs/index.js
|
|
9932
10053
|
var require_tar_fs = __commonJS({
|
|
9933
|
-
"../../node_modules/tar-fs/index.js"(exports
|
|
10054
|
+
"../../node_modules/tar-fs/index.js"(exports) {
|
|
9934
10055
|
var tar = require_tar_stream();
|
|
9935
10056
|
var pump = require_pump();
|
|
9936
10057
|
var fs2 = __require("fs");
|
|
9937
10058
|
var path2 = __require("path");
|
|
9938
10059
|
var win32 = (global.Bare ? global.Bare.platform : process.platform) === "win32";
|
|
9939
|
-
exports
|
|
10060
|
+
exports.pack = function pack(cwd, opts) {
|
|
9940
10061
|
if (!cwd) cwd = ".";
|
|
9941
10062
|
if (!opts) opts = {};
|
|
9942
10063
|
const xfs = opts.fs || fs2;
|
|
@@ -10023,7 +10144,7 @@ var require_tar_fs = __commonJS({
|
|
|
10023
10144
|
function processUmask() {
|
|
10024
10145
|
return !global.Bare && process.umask ? process.umask() : 0;
|
|
10025
10146
|
}
|
|
10026
|
-
exports
|
|
10147
|
+
exports.extract = function extract3(cwd, opts) {
|
|
10027
10148
|
if (!cwd) cwd = ".";
|
|
10028
10149
|
if (!opts) opts = {};
|
|
10029
10150
|
cwd = path2.resolve(cwd);
|
|
@@ -10096,6 +10217,7 @@ var require_tar_fs = __commonJS({
|
|
|
10096
10217
|
});
|
|
10097
10218
|
function stat(err) {
|
|
10098
10219
|
if (err) return next(err);
|
|
10220
|
+
if (path2.join(name, ".") === path2.join(cwd, ".")) return next();
|
|
10099
10221
|
utimes(name, header, function(err2) {
|
|
10100
10222
|
if (err2) return next(err2);
|
|
10101
10223
|
if (win32) return next();
|
|
@@ -10106,7 +10228,7 @@ var require_tar_fs = __commonJS({
|
|
|
10106
10228
|
if (win32) return next();
|
|
10107
10229
|
xfs.unlink(name, function() {
|
|
10108
10230
|
const dst = path2.resolve(path2.dirname(name), header.linkname);
|
|
10109
|
-
if (!inCwd(dst) && validateSymLinks) return next(new Error(name + " is not a valid symlink"));
|
|
10231
|
+
if (!inCwd(dst) && (validateSymLinks || opts.strip)) return next(new Error(name + " is not a valid symlink"));
|
|
10110
10232
|
validateNotSymlink(xfs, dst, path2.join(cwd, "."), function(err, valid) {
|
|
10111
10233
|
if (err) return next(err);
|
|
10112
10234
|
if (!valid && validateSymLinks) return next(new Error(name + " is not a valid symlink"));
|
|
@@ -10134,15 +10256,22 @@ var require_tar_fs = __commonJS({
|
|
|
10134
10256
|
return dst === cwd || dst.startsWith(cwd + path2.sep);
|
|
10135
10257
|
}
|
|
10136
10258
|
function onfile() {
|
|
10137
|
-
|
|
10138
|
-
|
|
10139
|
-
|
|
10140
|
-
rs.destroy(err);
|
|
10259
|
+
xfs.lstat(name, function(err, st) {
|
|
10260
|
+
if (!err && st.isSymbolicLink()) return xfs.unlink(name, onwrite);
|
|
10261
|
+
onwrite();
|
|
10141
10262
|
});
|
|
10142
|
-
|
|
10263
|
+
function onwrite(err) {
|
|
10143
10264
|
if (err) return next(err);
|
|
10144
|
-
ws.
|
|
10145
|
-
|
|
10265
|
+
const ws = xfs.createWriteStream(name);
|
|
10266
|
+
const rs = mapStream(stream, header);
|
|
10267
|
+
ws.on("error", function(err2) {
|
|
10268
|
+
rs.destroy(err2);
|
|
10269
|
+
});
|
|
10270
|
+
pump(rs, ws, function(err2) {
|
|
10271
|
+
if (err2) return next(err2);
|
|
10272
|
+
ws.on("close", stat);
|
|
10273
|
+
});
|
|
10274
|
+
}
|
|
10146
10275
|
}
|
|
10147
10276
|
}
|
|
10148
10277
|
function utimesParent(name, cb) {
|
|
@@ -10165,7 +10294,7 @@ var require_tar_fs = __commonJS({
|
|
|
10165
10294
|
const chmod = link ? xfs.lchmod : xfs.chmod;
|
|
10166
10295
|
const chown = link ? xfs.lchown : xfs.chown;
|
|
10167
10296
|
if (!chmod) return cb();
|
|
10168
|
-
const mode = (header.mode | (header.type === "directory" ? dmode : fmode)) & umask;
|
|
10297
|
+
const mode = (header.mode | (header.type === "directory" ? dmode : fmode)) & umask & 511;
|
|
10169
10298
|
if (chown && own) chown.call(xfs, name, header.uid, header.gid, onchown);
|
|
10170
10299
|
else onchown(null);
|
|
10171
10300
|
function onchown(err) {
|
|
@@ -10202,6 +10331,9 @@ var require_tar_fs = __commonJS({
|
|
|
10202
10331
|
cb(null, false);
|
|
10203
10332
|
});
|
|
10204
10333
|
}
|
|
10334
|
+
function inside(root, name) {
|
|
10335
|
+
return name === root || name.startsWith(root + path2.sep);
|
|
10336
|
+
}
|
|
10205
10337
|
function noop() {
|
|
10206
10338
|
}
|
|
10207
10339
|
function echo(name) {
|
|
@@ -10213,10 +10345,12 @@ var require_tar_fs = __commonJS({
|
|
|
10213
10345
|
function statAll(fs3, stat, cwd, ignore, entries, sort) {
|
|
10214
10346
|
if (!entries) entries = ["."];
|
|
10215
10347
|
const queue = entries.slice(0);
|
|
10348
|
+
const root = path2.resolve(cwd);
|
|
10216
10349
|
return function loop(callback) {
|
|
10217
10350
|
if (!queue.length) return callback(null);
|
|
10218
10351
|
const next = queue.shift();
|
|
10219
10352
|
const nextAbs = path2.join(cwd, next);
|
|
10353
|
+
if (!inside(root, path2.resolve(cwd, next))) return callback(new Error(next + " is not a valid path"));
|
|
10220
10354
|
stat.call(fs3, nextAbs, function(err, stat2) {
|
|
10221
10355
|
if (err) return callback(entries.indexOf(next) === -1 && err.code === "ENOENT" ? null : err);
|
|
10222
10356
|
if (!stat2.isDirectory()) return callback(null, next, stat2);
|
|
@@ -12368,7 +12502,7 @@ function inspect(contract) {
|
|
|
12368
12502
|
);
|
|
12369
12503
|
actions.push({
|
|
12370
12504
|
name,
|
|
12371
|
-
|
|
12505
|
+
nextStep: a?.nextStep,
|
|
12372
12506
|
example: a?.example,
|
|
12373
12507
|
scalarKeys,
|
|
12374
12508
|
allKeys,
|
|
@@ -12615,14 +12749,10 @@ function inferLayout(s, prompt, blueprint) {
|
|
|
12615
12749
|
var DRAG_RX = /\b(drag|drop|dragging|draggable)\b/i;
|
|
12616
12750
|
var SWIPE_RX = /\b(swipe|swipes|gesture\s*stack)\b/i;
|
|
12617
12751
|
var KEYBOARD_RX = /\b(keyboard\s*shortcut|hotkey|keystroke|kbd)\b/i;
|
|
12618
|
-
function inferWriteTrigger(s, prompt
|
|
12752
|
+
function inferWriteTrigger(s, prompt) {
|
|
12619
12753
|
if (s.actions.length === 0) {
|
|
12620
12754
|
return { value: "click", source: "default" };
|
|
12621
12755
|
}
|
|
12622
|
-
if (blueprint?.mechanic === "drag")
|
|
12623
|
-
return { value: "drag", source: "blueprint" };
|
|
12624
|
-
if (blueprint?.mechanic === "swipe")
|
|
12625
|
-
return { value: "swipe", source: "blueprint" };
|
|
12626
12756
|
if (DRAG_RX.test(prompt)) return { value: "drag", source: "prompt" };
|
|
12627
12757
|
if (SWIPE_RX.test(prompt)) return { value: "swipe", source: "prompt" };
|
|
12628
12758
|
if (KEYBOARD_RX.test(prompt)) return { value: "keystroke", source: "prompt" };
|
|
@@ -12663,7 +12793,7 @@ function classifyAxes(input) {
|
|
|
12663
12793
|
const fetch2 = inferFetch(s);
|
|
12664
12794
|
const render = inferRender(s, prompt, blueprint);
|
|
12665
12795
|
const layout = inferLayout(s, prompt, blueprint);
|
|
12666
|
-
const writeTrigger = inferWriteTrigger(s, prompt
|
|
12796
|
+
const writeTrigger = inferWriteTrigger(s, prompt);
|
|
12667
12797
|
const tooling = inferTooling(s);
|
|
12668
12798
|
const vector = {
|
|
12669
12799
|
render: render.value,
|
|
@@ -13485,28 +13615,17 @@ function inferTypeFromExample(example) {
|
|
|
13485
13615
|
}
|
|
13486
13616
|
function generateBoilerplate(_userPrompt, contract, shellType, screen, composedSections, appGadgets) {
|
|
13487
13617
|
const propsFields = [];
|
|
13488
|
-
const
|
|
13489
|
-
const
|
|
13490
|
-
|
|
13491
|
-
|
|
13492
|
-
|
|
13493
|
-
|
|
13494
|
-
|
|
13495
|
-
|
|
13496
|
-
|
|
13497
|
-
|
|
13498
|
-
|
|
13499
|
-
jsonSchemaTypeToTs(schema)
|
|
13500
|
-
) : "unknown";
|
|
13501
|
-
const fullType = nullable ? `${tsType} | null` : tsType;
|
|
13502
|
-
const parts = [];
|
|
13503
|
-
if (spec.description) parts.push(String(spec.description));
|
|
13504
|
-
if (spec.default !== void 0) parts.push(`(default: ${JSON.stringify(spec.default)})`);
|
|
13505
|
-
const desc = parts.length > 0 ? ` // ${parts.join(" ")}` : "";
|
|
13506
|
-
propsFields.push(` ${key}${required ? "" : "?"}: ${fullType};${desc}`);
|
|
13507
|
-
} else {
|
|
13508
|
-
propsFields.push(` ${key}: ${typeof value === "string" ? value : "unknown"};`);
|
|
13509
|
-
}
|
|
13618
|
+
const propsProperties = contract?.propsSpec?.properties ?? {};
|
|
13619
|
+
for (const [key, entry] of Object.entries(propsProperties)) {
|
|
13620
|
+
const required = entry.required !== false;
|
|
13621
|
+
const nullable = entry.schema.nullable === true;
|
|
13622
|
+
const tsType = jsonSchemaTypeToTs(entry.schema);
|
|
13623
|
+
const fullType = nullable ? `${tsType} | null` : tsType;
|
|
13624
|
+
const parts = [];
|
|
13625
|
+
if (entry.description) parts.push(entry.description);
|
|
13626
|
+
if (entry.default !== void 0) parts.push(`(default: ${JSON.stringify(entry.default)})`);
|
|
13627
|
+
const desc = parts.length > 0 ? ` // ${parts.join(" ")}` : "";
|
|
13628
|
+
propsFields.push(` ${key}${required ? "" : "?"}: ${fullType};${desc}`);
|
|
13510
13629
|
}
|
|
13511
13630
|
const actionTypeAliases = [];
|
|
13512
13631
|
const actionHookCalls = [];
|
|
@@ -14063,10 +14182,10 @@ A \`DataContract\` declares everything a GguiSession exchanges with the outside
|
|
|
14063
14182
|
|
|
14064
14183
|
Props arrive via \`ggui_update\` and may be partial on first render. Stream channels start empty and fill over time. Context slots start at their declared default (often \`null\`). **Never assume a field exists before you read it.**
|
|
14065
14184
|
|
|
14066
|
-
- **Array iteration**: always default to \`[]\` before \`.map\`/\`.filter\`/\`.length\`. Use \`(props.items ?? []).map(...)\` not \`props.items.map(...)\`. Same for stream.
|
|
14185
|
+
- **Array iteration**: always default to \`[]\` before \`.map\`/\`.filter\`/\`.length\`. Use \`(props.items ?? []).map(...)\` not \`props.items.map(...)\`. Same for stream.all, stream.latest, etc.
|
|
14067
14186
|
- **Object access**: optional-chain through nested fields. \`props.user?.name ?? 'Anonymous'\` not \`props.user.name\`.
|
|
14068
14187
|
- **Number ops**: default before arithmetic. \`(props.count ?? 0) + 1\` not \`props.count + 1\`.
|
|
14069
|
-
- **Stream latest**: \`useStream\` returns \`{latest: T |
|
|
14188
|
+
- **Stream latest**: \`useStream\` returns \`{latest: T | null, all: T[], isComplete: boolean}\`. The default \`all\` is \`[]\` so it's safe to map; \`latest\` is null until the first frame arrives \u2014 guard before reading \`.foo\`.
|
|
14070
14189
|
- **Stream reconciliation**: when a stream event carries an \`action\` discriminant (e.g. \`create | move | edit | delete\`), the channel is a CRUD feed \u2014 your handler MUST branch on EVERY value: append on \`create\`, drop on \`delete\`, replace-by-id on \`move\` / \`edit\`. Merging only the "edit" case silently loses created and deleted items. Reconcile into the SAME state that seeds from \`props\` (e.g. \`useState(() => props.tasks ?? [])\`) so the seed data and the live feed render as one list \u2014 and handle an event whose id is not yet present (a \`create\` for an unknown item) by inserting it, not ignoring it.
|
|
14071
14190
|
- **Loading state**: while data is still absent, render \`<Skeleton>\` placeholders \u2014 never a blank screen. \`<Skeleton variant="text" />\` for a text line, \`variant="circle"\` for an avatar slot, default \`rect\` for a block.
|
|
14072
14191
|
- **Empty state**: when a list or results array is empty, render \`<EmptyState title="\u2026" description="\u2026" />\` \u2014 a region that renders nothing when empty looks broken to the user.
|
|
@@ -14963,7 +15082,7 @@ init_policy2();
|
|
|
14963
15082
|
init_validation();
|
|
14964
15083
|
|
|
14965
15084
|
// src/tools/get-wire.ts
|
|
14966
|
-
var WIRE_DOCUMENTATION = "# ggui Wire Hooks Reference\n\n> Wire hooks connect generated UI components to agent communication.\n> They are pre-imported in the boilerplate \u2014 use them directly.\n> All hooks must be called inside a GguiWireProvider (handled automatically by the renderer).\n\nImport: `import { useAction, useStream } from '@ggui-ai/wire'`\n\n## Communication Hooks\n\n\n\nThese are the wire primitives for component-agent communication. `useWiredTool` retired 2026-05-11 \u2014
|
|
15085
|
+
var WIRE_DOCUMENTATION = "# ggui Wire Hooks Reference\n\n> Wire hooks connect generated UI components to agent communication.\n> They are pre-imported in the boilerplate \u2014 use them directly.\n> All hooks must be called inside a GguiWireProvider (handled automatically by the renderer).\n\nImport: `import { useAction, useStream } from '@ggui-ai/wire'`\n\n## Communication Hooks\n\n\n\nThese are the wire primitives for component-agent communication. `useWiredTool` retired 2026-05-11 \u2014 agentCapabilities.tools is a catalog the AGENT invokes, not a component hook surface; user gestures use `useAction(name)` and the optional `nextStep` field on the action entry names the tool the agent SHOULD invoke next.\n\n### useAction\n\nFire an action to the agent. Fire-and-forget \u2014 no response, no pending state.\n\nEvery action is an event: it lands on the GguiSession's consume buffer and\nthe agent receives it on its next turn (via `ggui_consume`). The action\nentry's optional `nextStep` names the tool the agent SHOULD invoke in\nresponse \u2014 advisory only; the agent owns the call decision. Component code\nis identical either way: call `useAction(name)(payload)` and treat\n`nextStep` as informational (use it to inform button labels, icons, copy).\n\nRUNTIME DEDUP (backstop, not a feature). Same-`(name, payload)` calls within\none event-loop task are coalesced \u2014 the first wins, subsequent duplicates\nare suppressed. This is the structural defense against LLM-generated\nnested-interactive components where a Checkbox `onChange` and an outer\n`Card as={Clickable}` `onClick` both wire to the same `useAction` binding;\nthe inner gesture bubbles to the outer handler, so without dedup one user\nclick would fire the action twice (a toggle would run back-to-back and the\nuser's change would disappear). **Do not rely on this as a feature** \u2014 wire\neach `useAction` callback to exactly ONE interactive surface; the dedup\nexists only because the LLM's source code can be wrong in subtle ways and\nthe runtime is the only place that can see the actual event-bubble path.\nSee `dispatch-dedup.ts` for the full failure-mode rationale.\n\nNEVER SILENT. When the dedup fires, a `console.warn` is emitted in BOTH dev\nand prod with the full diagnostic. The suppression is always visible in\nbrowser DevTools; operators investigating a \"the second click does nothing\"\nreport see the warning immediately. A structured observer also exists as\n`WireConfig.onDispatchSuppressed`, but the first-party renderers never set\nit \u2014 it is reachable only from a hand-built `WireConfig` (see its\ndocstring), so the console signal is what operators get in practice.\n\n**Signature:** `useAction<T = unknown>(actionName: string): (data: T) => void`\n\n**Parameters:**\n\n| Param | Type | Description |\n|-------|------|-------------|\n| actionName | `string` | Action name from the action contract |\n\n**Returns:** `(data: T) => void`\n\n**Example:**\n```tsx\nconst submitForm = useAction<{name: string; email: string}>('formSubmit');\n\n// In JSX:\n<Button onClick={() => submitForm({ name, email })}>Submit</Button>\n```\n\n\n### useStream\n\nSubscribe to deliveries on a named stream channel.\n\nHonors the channel's per-delivery `mode` ('append' vs 'replace')\nand the optional `complete` terminal marker. Channels declared\n`mode: 'replace'` on the spec typically emit every delivery with\n`mode: 'replace'` \u2014 this hook folds them into a single-latest\nvalue without accumulating history.\n\n**Signature:** `useStream<T = unknown>(channelName: string): StreamResult<T>`\n\n**Parameters:**\n\n| Param | Type | Description |\n|-------|------|-------------|\n| channelName | `string` | Channel name from the GguiSession's streamSpec |\n\n**Returns:** `StreamResult<T>`\n\n| Property | Type | Description |\n|----------|------|-------------|\n| latest | `T \\| null` | Most recent payload delivered on this channel, or null if none received yet. |\n| all | `T[]` | All payloads accumulated on this channel. - `mode: 'append'` deliveries are pushed to the tail (continuous stream). - `mode: 'replace'` deliveries collapse `all` to a single-element array containing the latest payload \u2014 matching the channel's \"full replacement\" semantics. |\n| isComplete | `boolean` | Truthy after the channel has delivered an envelope with `complete: true`. Subscribers flip into a \"channel closed\" rendering state based on this signal; further deliveries on a completed channel are still accumulated, since the underlying wire doesn't enforce quiescence. |\n\n**Example:**\n```tsx\nconst progress = useStream<{ percent: number; message: string }>('progress');\n\n// In JSX:\n{progress.latest && (\n <Progress value={progress.latest.percent} />\n)}\n<Text>{progress.all.length} updates received</Text>\n```\n\n\n## Context Hooks\n\n\n\nRead-only access to render, app, and auth context.\n\n### useAuth\n\nRead-only auth context. Token excluded \u2014 auth is added server-side.\n\n**Signature:** `useAuth(): AuthInfo`\n\n**Returns:** `AuthInfo`\n\n| Property | Type | Description |\n|----------|------|-------------|\n| userId | `string` | userId |\n| isAuthenticated | `boolean` | isAuthenticated |\n\n**Example:**\n```tsx\nconst auth = useAuth();\n\n// In JSX:\n{auth.isAuthenticated\n ? <Text>Welcome, user {auth.userId}</Text>\n : <Text>Please sign in</Text>\n}\n```\n\n\n### useApp\n\nRead-only app metadata.\n\n**Signature:** `useApp(): AppInfo`\n\n**Returns:** `AppInfo`\n\n| Property | Type | Description |\n|----------|------|-------------|\n| appId | `string` | appId |\n| appName | `string` | appName |\n| appDescription | `string` | appDescription |\n| appIcon | `string` | appIcon |\n\n**Example:**\n```tsx\nconst app = useApp();\n\n// In JSX:\n<Heading>{app.appName}</Heading>\n{app.appDescription && <Text>{app.appDescription}</Text>}\n```\n\n\n### useRender\n\nRead-only render context with connection status.\n\n**Signature:** `useRender(): GguiSessionInfo`\n\n**Returns:** `GguiSessionInfo`\n\n| Property | Type | Description |\n|----------|------|-------------|\n| sessionId | `string` | sessionId |\n| isConnected | `boolean` | isConnected |\n\n**Example:**\n```tsx\nconst render = useRender();\n\n// In JSX:\n<Badge variant={render.isConnected ? 'success' : 'error'}>\n {render.isConnected ? 'Connected' : 'Disconnected'}\n</Badge>\n```\n\n\n## Provider\n\n\n\nThe provider is set up automatically by the renderer. Generated components do not need to wrap themselves in a provider.\n\n### GguiWireProvider\n\nReact context provider that injects WireConfig for all wire hooks.\n\n**Props:**\n\n| Prop | Type | Description |\n|------|------|-------------|\n| config | `WireConfig` | config |\n| children | `ReactNode` | children |\n\n**Example:**\n```tsx\n<GguiWireProvider config={wireConfig}>\n <YourComponent />\n</GguiWireProvider>\n```\n\n\n## Internal: WireConfig\n\n\n\nThis is the configuration object passed to GguiWireProvider. Generated components do not interact with this directly \u2014 it is provided by the renderer.\n\n### WireConfig\n\nConfiguration injected by the provider \u2014 the renderer inside the\niframe.\n\nEvery method is typed against the contract generic `T` so typed\ncallers get compile-time enforcement:\n - `dispatch(name, data)` \u2014 `name` MUST be a declared actionSpec\n key; `data` MUST satisfy that action's schema.\n - `subscribe(channel, handler)` \u2014 same discipline for streamSpec.\n\nUntyped callers (`T = DataContract` default) degrade to the broad\nshape via the conditional `WireDispatchData` / `WireStreamPayload`\naliases \u2014 no call-site break.\n\nThe contract's `agentCapabilities.tools` catalog declares tools the AGENT\ninvokes (not the component); user gestures fire via\n`dispatch(name, data)` and the optional `nextStep` field on the\naction entry names the tool the agent SHOULD invoke next.\n\nThe renderer mounts exactly ONE GguiSession per iframe \u2014 `render.sessionId`\nis the stable identity the WireProvider was constructed with. No\nper-item scoping factory; with a one-GguiSession-per-mount lifecycle,\n\"scope\" collapses to identity.\n\n| Property | Type | Description |\n|----------|------|-------------|\n| app | `{ readonly appId: string; readonly appName: string; readonly appDescription?: string; readonly appIcon?: string; }` | app |\n| render | `{ readonly sessionId: string; readonly isConnected: boolean; }` | render |\n| auth | `{ readonly userId?: string; readonly isAuthenticated: boolean; }` | auth |\n| dispatch | `<N extends string>( actionName: N, data: WireDispatchData<T, N>, ) => void` | Fire an action to the agent (fire-and-forget over WS). Typed callers get compile-time checked `name` + `data`; untyped callers (`T = DataContract`) keep the broad shape. |\n| subscribe | `<N extends string>( channelName: N, handler: (delivery: StreamDelivery<WireStreamPayload<T, N>>) => void, ) => () => void` | Subscribe to deliveries on a named stream channel. |\n| onDispatchSuppressed | `(info: DispatchSuppressedInfo) => void` | Optional structured observability for `useAction`'s task-scoped duplicate-dispatch suppression. Fires alongside the always-on `console.warn` whenever the runtime coalesces a same-(name, payload) re-dispatch within one event-loop task \u2014 the nested- interactive double-fire backstop. Reachability constraint: the first-party renderers do NOT set this field \u2014 `buildRootWireConfig` (`@ggui-ai/iframe-runtime`) and `<GguiRender>`'s internal config both omit it. It fires only when a host hand-builds a complete `WireConfig` and mounts `GguiWireProvider` itself. On every first-party render path the `console.warn` is the sole suppression signal. |\n";
|
|
14967
15086
|
|
|
14968
15087
|
// src/harness/pitfalls.ts
|
|
14969
15088
|
var PITFALLS = [
|