@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Anthropic from '@anthropic-ai/sdk';
|
|
2
2
|
import 'zod';
|
|
3
|
-
import { classifyUi, DANGEROUS_PATTERNS as DANGEROUS_PATTERNS$1, listContractGadgets, HOOK_NAME_RE, STDLIB_GADGETS_PACKAGE, resolveAppGadgets } from '@ggui-ai/protocol';
|
|
3
|
+
import { classifyUi, MODEL_REGISTRY, DANGEROUS_PATTERNS as DANGEROUS_PATTERNS$1, listContractGadgets, HOOK_NAME_RE, STDLIB_GADGETS_PACKAGE, resolveAppGadgets } from '@ggui-ai/protocol';
|
|
4
4
|
import * as esbuild from 'esbuild';
|
|
5
5
|
import { build } from 'esbuild';
|
|
6
6
|
import fs, { mkdirSync, writeFileSync, unlinkSync, readFileSync, existsSync, rm, createReadStream, createWriteStream } from 'fs';
|
|
@@ -30,11 +30,20 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
30
30
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
31
31
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
32
32
|
});
|
|
33
|
-
var __esm = (fn, res) => function __init() {
|
|
34
|
-
|
|
33
|
+
var __esm = (fn, res, err) => function __init() {
|
|
34
|
+
if (err) throw err[0];
|
|
35
|
+
try {
|
|
36
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
37
|
+
} catch (e) {
|
|
38
|
+
throw err = [e], e;
|
|
39
|
+
}
|
|
35
40
|
};
|
|
36
41
|
var __commonJS = (cb, mod) => function __require2() {
|
|
37
|
-
|
|
42
|
+
try {
|
|
43
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
44
|
+
} catch (e) {
|
|
45
|
+
throw mod = 0, e;
|
|
46
|
+
}
|
|
38
47
|
};
|
|
39
48
|
var __export = (target, all) => {
|
|
40
49
|
for (var name in all)
|
|
@@ -546,6 +555,8 @@ var init_types = __esm({
|
|
|
546
555
|
this.code = code;
|
|
547
556
|
this.name = "OpenRouterError";
|
|
548
557
|
}
|
|
558
|
+
status;
|
|
559
|
+
code;
|
|
549
560
|
get isTransient() {
|
|
550
561
|
return this.status === 408 || this.status === 429 || this.status === 502 || this.status === 503;
|
|
551
562
|
}
|
|
@@ -574,6 +585,7 @@ var init_client2 = __esm({
|
|
|
574
585
|
"X-Title": config.siteName ?? process.env.OPENROUTER_SITE_NAME ?? "ggui"
|
|
575
586
|
};
|
|
576
587
|
}
|
|
588
|
+
config;
|
|
577
589
|
baseUrl;
|
|
578
590
|
headers;
|
|
579
591
|
/**
|
|
@@ -677,7 +689,7 @@ function errorSummary(e) {
|
|
|
677
689
|
}
|
|
678
690
|
function interactionText(interaction) {
|
|
679
691
|
let text = "";
|
|
680
|
-
for (const step of interaction.steps) {
|
|
692
|
+
for (const step of interaction.steps ?? []) {
|
|
681
693
|
if (step.type === "model_output") {
|
|
682
694
|
for (const content of step.content ?? []) {
|
|
683
695
|
if (content.type === "text") {
|
|
@@ -689,7 +701,7 @@ function interactionText(interaction) {
|
|
|
689
701
|
return text;
|
|
690
702
|
}
|
|
691
703
|
function functionCallSteps(interaction) {
|
|
692
|
-
return interaction.steps.filter(
|
|
704
|
+
return (interaction.steps ?? []).filter(
|
|
693
705
|
(s) => s.type === "function_call"
|
|
694
706
|
);
|
|
695
707
|
}
|
|
@@ -1790,6 +1802,8 @@ var init_primitives = __esm({
|
|
|
1790
1802
|
"EmptyState",
|
|
1791
1803
|
"Stat",
|
|
1792
1804
|
"Stepper",
|
|
1805
|
+
"Markdown",
|
|
1806
|
+
"MarkdownInline",
|
|
1793
1807
|
"Header",
|
|
1794
1808
|
"Sidebar",
|
|
1795
1809
|
"CardGrid",
|
|
@@ -2236,6 +2250,7 @@ var init_ui_compiler = __esm({
|
|
|
2236
2250
|
this.validation = validation;
|
|
2237
2251
|
this.name = "UiValidationError";
|
|
2238
2252
|
}
|
|
2253
|
+
validation;
|
|
2239
2254
|
};
|
|
2240
2255
|
UiBundleSizeError = class extends Error {
|
|
2241
2256
|
constructor(size, limit) {
|
|
@@ -2244,6 +2259,8 @@ var init_ui_compiler = __esm({
|
|
|
2244
2259
|
this.limit = limit;
|
|
2245
2260
|
this.name = "UiBundleSizeError";
|
|
2246
2261
|
}
|
|
2262
|
+
size;
|
|
2263
|
+
limit;
|
|
2247
2264
|
};
|
|
2248
2265
|
}
|
|
2249
2266
|
});
|
|
@@ -4755,28 +4772,35 @@ var init_llm_evaluator = __esm({
|
|
|
4755
4772
|
// src/evaluation/cost-tracker.ts
|
|
4756
4773
|
var cost_tracker_exports = {};
|
|
4757
4774
|
__export(cost_tracker_exports, {
|
|
4758
|
-
CostTracker: () => CostTracker
|
|
4775
|
+
CostTracker: () => CostTracker,
|
|
4776
|
+
pricePer1k: () => pricePer1k
|
|
4759
4777
|
});
|
|
4760
|
-
|
|
4778
|
+
function resolveRegistryId(model) {
|
|
4779
|
+
const keys = Object.keys(MODEL_REGISTRY);
|
|
4780
|
+
if (keys.includes(model)) return model;
|
|
4781
|
+
const bySuffix = keys.find((id) => id.endsWith(`/${model}`));
|
|
4782
|
+
if (bySuffix) return bySuffix;
|
|
4783
|
+
const undated = model.replace(/-\d{8}$/, "");
|
|
4784
|
+
return keys.find((id) => id.endsWith(`/${undated}`)) ?? null;
|
|
4785
|
+
}
|
|
4786
|
+
function pricePer1k(model) {
|
|
4787
|
+
const id = resolveRegistryId(model);
|
|
4788
|
+
if (id === null) return FALLBACK_PER_1K;
|
|
4789
|
+
const { costs } = MODEL_REGISTRY[id];
|
|
4790
|
+
return { input: costs.inputPer1M / 1e3, output: costs.outputPer1M / 1e3 };
|
|
4791
|
+
}
|
|
4792
|
+
var FALLBACK_PER_1K, CostTracker;
|
|
4761
4793
|
var init_cost_tracker = __esm({
|
|
4762
4794
|
"src/evaluation/cost-tracker.ts"() {
|
|
4763
|
-
|
|
4764
|
-
"claude-sonnet-4-6": { input: 3e-3, output: 0.015 },
|
|
4765
|
-
"claude-haiku-4-5-20251001": { input: 8e-4, output: 4e-3 },
|
|
4766
|
-
"gemini-3-flash-preview": { input: 1e-4, output: 4e-4 },
|
|
4767
|
-
// Gemini 3.5 Flash-Lite — $0.30/$2.50 per MTok (ai.google.dev/gemini-api/docs/pricing).
|
|
4768
|
-
"gemini-3.5-flash-lite": { input: 3e-4, output: 25e-4 },
|
|
4769
|
-
"gpt-5.4-mini": { input: 3e-4, output: 12e-4 },
|
|
4770
|
-
// $1.00 in / $6.00 out per MTok (OpenAI list, 2026-07) → per-1K.
|
|
4771
|
-
"gpt-5.6-luna": { input: 1e-3, output: 6e-3 }
|
|
4772
|
-
};
|
|
4795
|
+
FALLBACK_PER_1K = { input: 3e-3, output: 0.015 };
|
|
4773
4796
|
CostTracker = class {
|
|
4774
4797
|
constructor(maxBudget) {
|
|
4775
4798
|
this.maxBudget = maxBudget;
|
|
4776
4799
|
}
|
|
4800
|
+
maxBudget;
|
|
4777
4801
|
totalCost = 0;
|
|
4778
4802
|
record(model, inputTokens, outputTokens) {
|
|
4779
|
-
const prices =
|
|
4803
|
+
const prices = pricePer1k(model);
|
|
4780
4804
|
const cost = inputTokens / 1e3 * prices.input + outputTokens / 1e3 * prices.output;
|
|
4781
4805
|
this.totalCost += cost;
|
|
4782
4806
|
return cost;
|
|
@@ -4798,7 +4822,7 @@ var init_cost_tracker = __esm({
|
|
|
4798
4822
|
|
|
4799
4823
|
// ../../node_modules/ms/index.js
|
|
4800
4824
|
var require_ms = __commonJS({
|
|
4801
|
-
"../../node_modules/ms/index.js"(exports
|
|
4825
|
+
"../../node_modules/ms/index.js"(exports, module) {
|
|
4802
4826
|
var s = 1e3;
|
|
4803
4827
|
var m = s * 60;
|
|
4804
4828
|
var h = m * 60;
|
|
@@ -4914,7 +4938,7 @@ var require_ms = __commonJS({
|
|
|
4914
4938
|
|
|
4915
4939
|
// ../../node_modules/debug/src/common.js
|
|
4916
4940
|
var require_common = __commonJS({
|
|
4917
|
-
"../../node_modules/debug/src/common.js"(exports
|
|
4941
|
+
"../../node_modules/debug/src/common.js"(exports, module) {
|
|
4918
4942
|
function setup(env) {
|
|
4919
4943
|
createDebug.debug = createDebug;
|
|
4920
4944
|
createDebug.default = createDebug;
|
|
@@ -5091,13 +5115,13 @@ var require_common = __commonJS({
|
|
|
5091
5115
|
|
|
5092
5116
|
// ../../node_modules/debug/src/browser.js
|
|
5093
5117
|
var require_browser = __commonJS({
|
|
5094
|
-
"../../node_modules/debug/src/browser.js"(exports
|
|
5095
|
-
exports
|
|
5096
|
-
exports
|
|
5097
|
-
exports
|
|
5098
|
-
exports
|
|
5099
|
-
exports
|
|
5100
|
-
exports
|
|
5118
|
+
"../../node_modules/debug/src/browser.js"(exports, module) {
|
|
5119
|
+
exports.formatArgs = formatArgs;
|
|
5120
|
+
exports.save = save;
|
|
5121
|
+
exports.load = load;
|
|
5122
|
+
exports.useColors = useColors;
|
|
5123
|
+
exports.storage = localstorage();
|
|
5124
|
+
exports.destroy = /* @__PURE__ */ (() => {
|
|
5101
5125
|
let warned = false;
|
|
5102
5126
|
return () => {
|
|
5103
5127
|
if (!warned) {
|
|
@@ -5106,7 +5130,7 @@ var require_browser = __commonJS({
|
|
|
5106
5130
|
}
|
|
5107
5131
|
};
|
|
5108
5132
|
})();
|
|
5109
|
-
exports
|
|
5133
|
+
exports.colors = [
|
|
5110
5134
|
"#0000CC",
|
|
5111
5135
|
"#0000FF",
|
|
5112
5136
|
"#0033CC",
|
|
@@ -5218,14 +5242,14 @@ var require_browser = __commonJS({
|
|
|
5218
5242
|
});
|
|
5219
5243
|
args.splice(lastC, 0, c);
|
|
5220
5244
|
}
|
|
5221
|
-
exports
|
|
5245
|
+
exports.log = console.debug || console.log || (() => {
|
|
5222
5246
|
});
|
|
5223
5247
|
function save(namespaces) {
|
|
5224
5248
|
try {
|
|
5225
5249
|
if (namespaces) {
|
|
5226
|
-
exports
|
|
5250
|
+
exports.storage.setItem("debug", namespaces);
|
|
5227
5251
|
} else {
|
|
5228
|
-
exports
|
|
5252
|
+
exports.storage.removeItem("debug");
|
|
5229
5253
|
}
|
|
5230
5254
|
} catch (error) {
|
|
5231
5255
|
}
|
|
@@ -5233,7 +5257,7 @@ var require_browser = __commonJS({
|
|
|
5233
5257
|
function load() {
|
|
5234
5258
|
let r;
|
|
5235
5259
|
try {
|
|
5236
|
-
r = exports
|
|
5260
|
+
r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
|
|
5237
5261
|
} catch (error) {
|
|
5238
5262
|
}
|
|
5239
5263
|
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
@@ -5247,7 +5271,7 @@ var require_browser = __commonJS({
|
|
|
5247
5271
|
} catch (error) {
|
|
5248
5272
|
}
|
|
5249
5273
|
}
|
|
5250
|
-
module.exports = require_common()(exports
|
|
5274
|
+
module.exports = require_common()(exports);
|
|
5251
5275
|
var { formatters } = module.exports;
|
|
5252
5276
|
formatters.j = function(v) {
|
|
5253
5277
|
try {
|
|
@@ -5261,7 +5285,7 @@ var require_browser = __commonJS({
|
|
|
5261
5285
|
|
|
5262
5286
|
// ../../node_modules/has-flag/index.js
|
|
5263
5287
|
var require_has_flag = __commonJS({
|
|
5264
|
-
"../../node_modules/has-flag/index.js"(exports
|
|
5288
|
+
"../../node_modules/has-flag/index.js"(exports, module) {
|
|
5265
5289
|
module.exports = (flag, argv = process.argv) => {
|
|
5266
5290
|
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
5267
5291
|
const position = argv.indexOf(prefix + flag);
|
|
@@ -5273,7 +5297,7 @@ var require_has_flag = __commonJS({
|
|
|
5273
5297
|
|
|
5274
5298
|
// ../../node_modules/supports-color/index.js
|
|
5275
5299
|
var require_supports_color = __commonJS({
|
|
5276
|
-
"../../node_modules/supports-color/index.js"(exports
|
|
5300
|
+
"../../node_modules/supports-color/index.js"(exports, module) {
|
|
5277
5301
|
var os = __require("os");
|
|
5278
5302
|
var tty = __require("tty");
|
|
5279
5303
|
var hasFlag = require_has_flag();
|
|
@@ -5374,25 +5398,25 @@ var require_supports_color = __commonJS({
|
|
|
5374
5398
|
|
|
5375
5399
|
// ../../node_modules/debug/src/node.js
|
|
5376
5400
|
var require_node = __commonJS({
|
|
5377
|
-
"../../node_modules/debug/src/node.js"(exports
|
|
5401
|
+
"../../node_modules/debug/src/node.js"(exports, module) {
|
|
5378
5402
|
var tty = __require("tty");
|
|
5379
5403
|
var util = __require("util");
|
|
5380
|
-
exports
|
|
5381
|
-
exports
|
|
5382
|
-
exports
|
|
5383
|
-
exports
|
|
5384
|
-
exports
|
|
5385
|
-
exports
|
|
5386
|
-
exports
|
|
5404
|
+
exports.init = init;
|
|
5405
|
+
exports.log = log;
|
|
5406
|
+
exports.formatArgs = formatArgs;
|
|
5407
|
+
exports.save = save;
|
|
5408
|
+
exports.load = load;
|
|
5409
|
+
exports.useColors = useColors;
|
|
5410
|
+
exports.destroy = util.deprecate(
|
|
5387
5411
|
() => {
|
|
5388
5412
|
},
|
|
5389
5413
|
"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."
|
|
5390
5414
|
);
|
|
5391
|
-
exports
|
|
5415
|
+
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
5392
5416
|
try {
|
|
5393
5417
|
const supportsColor = require_supports_color();
|
|
5394
5418
|
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
5395
|
-
exports
|
|
5419
|
+
exports.colors = [
|
|
5396
5420
|
20,
|
|
5397
5421
|
21,
|
|
5398
5422
|
26,
|
|
@@ -5473,7 +5497,7 @@ var require_node = __commonJS({
|
|
|
5473
5497
|
}
|
|
5474
5498
|
} catch (error) {
|
|
5475
5499
|
}
|
|
5476
|
-
exports
|
|
5500
|
+
exports.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
5477
5501
|
return /^debug_/i.test(key);
|
|
5478
5502
|
}).reduce((obj, key) => {
|
|
5479
5503
|
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
|
|
@@ -5493,7 +5517,7 @@ var require_node = __commonJS({
|
|
|
5493
5517
|
return obj;
|
|
5494
5518
|
}, {});
|
|
5495
5519
|
function useColors() {
|
|
5496
|
-
return "colors" in exports
|
|
5520
|
+
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
5497
5521
|
}
|
|
5498
5522
|
function formatArgs(args) {
|
|
5499
5523
|
const { namespace: name, useColors: useColors2 } = this;
|
|
@@ -5508,13 +5532,13 @@ var require_node = __commonJS({
|
|
|
5508
5532
|
}
|
|
5509
5533
|
}
|
|
5510
5534
|
function getDate() {
|
|
5511
|
-
if (exports
|
|
5535
|
+
if (exports.inspectOpts.hideDate) {
|
|
5512
5536
|
return "";
|
|
5513
5537
|
}
|
|
5514
5538
|
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
5515
5539
|
}
|
|
5516
5540
|
function log(...args) {
|
|
5517
|
-
return process.stderr.write(util.formatWithOptions(exports
|
|
5541
|
+
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + "\n");
|
|
5518
5542
|
}
|
|
5519
5543
|
function save(namespaces) {
|
|
5520
5544
|
if (namespaces) {
|
|
@@ -5528,12 +5552,12 @@ var require_node = __commonJS({
|
|
|
5528
5552
|
}
|
|
5529
5553
|
function init(debug) {
|
|
5530
5554
|
debug.inspectOpts = {};
|
|
5531
|
-
const keys = Object.keys(exports
|
|
5555
|
+
const keys = Object.keys(exports.inspectOpts);
|
|
5532
5556
|
for (let i = 0; i < keys.length; i++) {
|
|
5533
|
-
debug.inspectOpts[keys[i]] = exports
|
|
5557
|
+
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
5534
5558
|
}
|
|
5535
5559
|
}
|
|
5536
|
-
module.exports = require_common()(exports
|
|
5560
|
+
module.exports = require_common()(exports);
|
|
5537
5561
|
var { formatters } = module.exports;
|
|
5538
5562
|
formatters.o = function(v) {
|
|
5539
5563
|
this.inspectOpts.colors = this.useColors;
|
|
@@ -5548,7 +5572,7 @@ var require_node = __commonJS({
|
|
|
5548
5572
|
|
|
5549
5573
|
// ../../node_modules/debug/src/index.js
|
|
5550
5574
|
var require_src = __commonJS({
|
|
5551
|
-
"../../node_modules/debug/src/index.js"(exports
|
|
5575
|
+
"../../node_modules/debug/src/index.js"(exports, module) {
|
|
5552
5576
|
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
|
|
5553
5577
|
module.exports = require_browser();
|
|
5554
5578
|
} else {
|
|
@@ -5559,7 +5583,7 @@ var require_src = __commonJS({
|
|
|
5559
5583
|
|
|
5560
5584
|
// ../../node_modules/follow-redirects/debug.js
|
|
5561
5585
|
var require_debug = __commonJS({
|
|
5562
|
-
"../../node_modules/follow-redirects/debug.js"(exports
|
|
5586
|
+
"../../node_modules/follow-redirects/debug.js"(exports, module) {
|
|
5563
5587
|
var debug;
|
|
5564
5588
|
module.exports = function() {
|
|
5565
5589
|
if (!debug) {
|
|
@@ -5579,7 +5603,7 @@ var require_debug = __commonJS({
|
|
|
5579
5603
|
|
|
5580
5604
|
// ../../node_modules/follow-redirects/index.js
|
|
5581
5605
|
var require_follow_redirects = __commonJS({
|
|
5582
|
-
"../../node_modules/follow-redirects/index.js"(exports
|
|
5606
|
+
"../../node_modules/follow-redirects/index.js"(exports, module) {
|
|
5583
5607
|
var url = __require("url");
|
|
5584
5608
|
var URL2 = url.URL;
|
|
5585
5609
|
var http = __require("http");
|
|
@@ -6090,14 +6114,14 @@ var require_follow_redirects = __commonJS({
|
|
|
6090
6114
|
|
|
6091
6115
|
// ../../node_modules/events-universal/default.js
|
|
6092
6116
|
var require_default = __commonJS({
|
|
6093
|
-
"../../node_modules/events-universal/default.js"(exports
|
|
6117
|
+
"../../node_modules/events-universal/default.js"(exports, module) {
|
|
6094
6118
|
module.exports = __require("events");
|
|
6095
6119
|
}
|
|
6096
6120
|
});
|
|
6097
6121
|
|
|
6098
6122
|
// ../../node_modules/fast-fifo/fixed-size.js
|
|
6099
6123
|
var require_fixed_size = __commonJS({
|
|
6100
|
-
"../../node_modules/fast-fifo/fixed-size.js"(exports
|
|
6124
|
+
"../../node_modules/fast-fifo/fixed-size.js"(exports, module) {
|
|
6101
6125
|
module.exports = class FixedFIFO {
|
|
6102
6126
|
constructor(hwm) {
|
|
6103
6127
|
if (!(hwm > 0) || (hwm - 1 & hwm) !== 0) throw new Error("Max size for a FixedFIFO should be a power of two");
|
|
@@ -6137,7 +6161,7 @@ var require_fixed_size = __commonJS({
|
|
|
6137
6161
|
|
|
6138
6162
|
// ../../node_modules/fast-fifo/index.js
|
|
6139
6163
|
var require_fast_fifo = __commonJS({
|
|
6140
|
-
"../../node_modules/fast-fifo/index.js"(exports
|
|
6164
|
+
"../../node_modules/fast-fifo/index.js"(exports, module) {
|
|
6141
6165
|
var FixedFIFO = require_fixed_size();
|
|
6142
6166
|
module.exports = class FastFIFO {
|
|
6143
6167
|
constructor(hwm) {
|
|
@@ -6184,7 +6208,7 @@ var require_fast_fifo = __commonJS({
|
|
|
6184
6208
|
|
|
6185
6209
|
// ../../node_modules/b4a/index.js
|
|
6186
6210
|
var require_b4a = __commonJS({
|
|
6187
|
-
"../../node_modules/b4a/index.js"(exports
|
|
6211
|
+
"../../node_modules/b4a/index.js"(exports, module) {
|
|
6188
6212
|
function isBuffer(value) {
|
|
6189
6213
|
return Buffer.isBuffer(value) || value instanceof Uint8Array;
|
|
6190
6214
|
}
|
|
@@ -6341,7 +6365,7 @@ var require_b4a = __commonJS({
|
|
|
6341
6365
|
|
|
6342
6366
|
// ../../node_modules/text-decoder/lib/pass-through-decoder.js
|
|
6343
6367
|
var require_pass_through_decoder = __commonJS({
|
|
6344
|
-
"../../node_modules/text-decoder/lib/pass-through-decoder.js"(exports
|
|
6368
|
+
"../../node_modules/text-decoder/lib/pass-through-decoder.js"(exports, module) {
|
|
6345
6369
|
var b4a = require_b4a();
|
|
6346
6370
|
module.exports = class PassThroughDecoder {
|
|
6347
6371
|
constructor(encoding) {
|
|
@@ -6362,7 +6386,7 @@ var require_pass_through_decoder = __commonJS({
|
|
|
6362
6386
|
|
|
6363
6387
|
// ../../node_modules/text-decoder/lib/utf8-decoder.js
|
|
6364
6388
|
var require_utf8_decoder = __commonJS({
|
|
6365
|
-
"../../node_modules/text-decoder/lib/utf8-decoder.js"(exports
|
|
6389
|
+
"../../node_modules/text-decoder/lib/utf8-decoder.js"(exports, module) {
|
|
6366
6390
|
var b4a = require_b4a();
|
|
6367
6391
|
module.exports = class UTF8Decoder {
|
|
6368
6392
|
constructor() {
|
|
@@ -6509,7 +6533,7 @@ var require_utf8_decoder = __commonJS({
|
|
|
6509
6533
|
|
|
6510
6534
|
// ../../node_modules/text-decoder/index.js
|
|
6511
6535
|
var require_text_decoder = __commonJS({
|
|
6512
|
-
"../../node_modules/text-decoder/index.js"(exports
|
|
6536
|
+
"../../node_modules/text-decoder/index.js"(exports, module) {
|
|
6513
6537
|
var PassThroughDecoder = require_pass_through_decoder();
|
|
6514
6538
|
var UTF8Decoder = require_utf8_decoder();
|
|
6515
6539
|
module.exports = class TextDecoder {
|
|
@@ -6569,14 +6593,55 @@ var require_text_decoder = __commonJS({
|
|
|
6569
6593
|
}
|
|
6570
6594
|
});
|
|
6571
6595
|
|
|
6596
|
+
// ../../node_modules/streamx/lib/errors.js
|
|
6597
|
+
var require_errors = __commonJS({
|
|
6598
|
+
"../../node_modules/streamx/lib/errors.js"(exports, module) {
|
|
6599
|
+
module.exports = class StreamError extends Error {
|
|
6600
|
+
constructor(msg, code, fn = StreamError) {
|
|
6601
|
+
super(msg);
|
|
6602
|
+
this.code = code;
|
|
6603
|
+
if (Error.captureStackTrace) {
|
|
6604
|
+
Error.captureStackTrace(this, fn);
|
|
6605
|
+
}
|
|
6606
|
+
}
|
|
6607
|
+
static isStreamDestroyed(err) {
|
|
6608
|
+
return err && err.code === "STREAM_DESTROYED";
|
|
6609
|
+
}
|
|
6610
|
+
static isPrematureClose(err) {
|
|
6611
|
+
return err && err.code === "PREMATURE_CLOSE";
|
|
6612
|
+
}
|
|
6613
|
+
static isAborted(err) {
|
|
6614
|
+
return err && err.code === "ABORTED";
|
|
6615
|
+
}
|
|
6616
|
+
static isBadArgument(err) {
|
|
6617
|
+
return err && err.code === "BAD_ARGUMENT";
|
|
6618
|
+
}
|
|
6619
|
+
get name() {
|
|
6620
|
+
return "StreamError";
|
|
6621
|
+
}
|
|
6622
|
+
static STREAM_DESTROYED() {
|
|
6623
|
+
return new StreamError("Stream was destroyed", "STREAM_DESTROYED", StreamError.STREAM_DESTROYED);
|
|
6624
|
+
}
|
|
6625
|
+
static PREMATURE_CLOSE(msg = "Premature close") {
|
|
6626
|
+
return new StreamError(msg, "PREMATURE_CLOSE", StreamError.PREMATURE_CLOSE);
|
|
6627
|
+
}
|
|
6628
|
+
static ABORTED() {
|
|
6629
|
+
return new StreamError("Stream aborted", "ABORTED", StreamError.ABORTED);
|
|
6630
|
+
}
|
|
6631
|
+
static BAD_ARGUMENT(msg = "Bad argument") {
|
|
6632
|
+
return new StreamError(msg, "BAD_ARGUMENT", StreamError.BAD_ARGUMENT);
|
|
6633
|
+
}
|
|
6634
|
+
};
|
|
6635
|
+
}
|
|
6636
|
+
});
|
|
6637
|
+
|
|
6572
6638
|
// ../../node_modules/streamx/index.js
|
|
6573
6639
|
var require_streamx = __commonJS({
|
|
6574
|
-
"../../node_modules/streamx/index.js"(exports
|
|
6640
|
+
"../../node_modules/streamx/index.js"(exports, module) {
|
|
6575
6641
|
var { EventEmitter } = require_default();
|
|
6576
|
-
var STREAM_DESTROYED = new Error("Stream was destroyed");
|
|
6577
|
-
var PREMATURE_CLOSE = new Error("Premature close");
|
|
6578
6642
|
var FIFO = require_fast_fifo();
|
|
6579
6643
|
var TextDecoder2 = require_text_decoder();
|
|
6644
|
+
var StreamError = require_errors();
|
|
6580
6645
|
var qmt = typeof queueMicrotask === "undefined" ? (fn) => global.process.nextTick(fn) : queueMicrotask;
|
|
6581
6646
|
var MAX = (1 << 29) - 1;
|
|
6582
6647
|
var OPENING = 1;
|
|
@@ -6704,8 +6769,11 @@ var require_streamx = __commonJS({
|
|
|
6704
6769
|
return data;
|
|
6705
6770
|
}
|
|
6706
6771
|
end(data) {
|
|
6707
|
-
if (typeof data === "function")
|
|
6708
|
-
|
|
6772
|
+
if (typeof data === "function") {
|
|
6773
|
+
this.stream.once("finish", data);
|
|
6774
|
+
} else if (data !== void 0 && data !== null) {
|
|
6775
|
+
this.push(data);
|
|
6776
|
+
}
|
|
6709
6777
|
this.stream._duplexState = (this.stream._duplexState | WRITE_FINISHING) & WRITE_NON_PRIMARY;
|
|
6710
6778
|
}
|
|
6711
6779
|
autoBatch(data, cb) {
|
|
@@ -6756,8 +6824,11 @@ var require_streamx = __commonJS({
|
|
|
6756
6824
|
return true;
|
|
6757
6825
|
}
|
|
6758
6826
|
updateCallback() {
|
|
6759
|
-
if ((this.stream._duplexState & WRITE_UPDATE_SYNC_STATUS) === WRITE_PRIMARY)
|
|
6760
|
-
|
|
6827
|
+
if ((this.stream._duplexState & WRITE_UPDATE_SYNC_STATUS) === WRITE_PRIMARY) {
|
|
6828
|
+
this.update();
|
|
6829
|
+
} else {
|
|
6830
|
+
this.updateNextTick();
|
|
6831
|
+
}
|
|
6761
6832
|
}
|
|
6762
6833
|
updateNextTick() {
|
|
6763
6834
|
if ((this.stream._duplexState & WRITE_NEXT_TICK) !== 0) return;
|
|
@@ -6787,7 +6858,7 @@ var require_streamx = __commonJS({
|
|
|
6787
6858
|
return (this.stream._duplexState & READ_DONE) !== 0;
|
|
6788
6859
|
}
|
|
6789
6860
|
pipe(pipeTo, cb) {
|
|
6790
|
-
if (this.pipeTo !== null) throw
|
|
6861
|
+
if (this.pipeTo !== null) throw StreamError.BAD_ARGUMENT("Can only pipe to one destination");
|
|
6791
6862
|
if (typeof cb !== "function") cb = null;
|
|
6792
6863
|
this.stream._duplexState |= READ_PIPE_DRAINED;
|
|
6793
6864
|
this.pipeTo = pipeTo;
|
|
@@ -6830,7 +6901,9 @@ var require_streamx = __commonJS({
|
|
|
6830
6901
|
shift() {
|
|
6831
6902
|
const data = this.queue.shift();
|
|
6832
6903
|
this.buffered -= this.byteLength(data);
|
|
6833
|
-
if (this.buffered === 0)
|
|
6904
|
+
if (this.buffered === 0) {
|
|
6905
|
+
this.stream._duplexState &= READ_NOT_QUEUED;
|
|
6906
|
+
}
|
|
6834
6907
|
return data;
|
|
6835
6908
|
}
|
|
6836
6909
|
unshift(data) {
|
|
@@ -6847,9 +6920,12 @@ var require_streamx = __commonJS({
|
|
|
6847
6920
|
const stream = this.stream;
|
|
6848
6921
|
if ((stream._duplexState & READ_STATUS) === READ_QUEUED) {
|
|
6849
6922
|
const data = this.shift();
|
|
6850
|
-
if (this.pipeTo !== null && this.pipeTo.write(data) === false)
|
|
6923
|
+
if (this.pipeTo !== null && this.pipeTo.write(data) === false) {
|
|
6851
6924
|
stream._duplexState &= READ_PIPE_NOT_DRAINED;
|
|
6852
|
-
|
|
6925
|
+
}
|
|
6926
|
+
if ((stream._duplexState & READ_EMIT_DATA) !== 0) {
|
|
6927
|
+
stream.emit("data", data);
|
|
6928
|
+
}
|
|
6853
6929
|
return data;
|
|
6854
6930
|
}
|
|
6855
6931
|
if (this.readAhead === false) {
|
|
@@ -6862,9 +6938,12 @@ var require_streamx = __commonJS({
|
|
|
6862
6938
|
const stream = this.stream;
|
|
6863
6939
|
while ((stream._duplexState & READ_STATUS) === READ_QUEUED && (stream._duplexState & READ_FLOWING) !== 0) {
|
|
6864
6940
|
const data = this.shift();
|
|
6865
|
-
if (this.pipeTo !== null && this.pipeTo.write(data) === false)
|
|
6941
|
+
if (this.pipeTo !== null && this.pipeTo.write(data) === false) {
|
|
6866
6942
|
stream._duplexState &= READ_PIPE_NOT_DRAINED;
|
|
6867
|
-
|
|
6943
|
+
}
|
|
6944
|
+
if ((stream._duplexState & READ_EMIT_DATA) !== 0) {
|
|
6945
|
+
stream.emit("data", data);
|
|
6946
|
+
}
|
|
6868
6947
|
}
|
|
6869
6948
|
}
|
|
6870
6949
|
update() {
|
|
@@ -6881,7 +6960,9 @@ var require_streamx = __commonJS({
|
|
|
6881
6960
|
stream._duplexState |= READ_EMITTED_READABLE;
|
|
6882
6961
|
stream.emit("readable");
|
|
6883
6962
|
}
|
|
6884
|
-
if ((stream._duplexState & READ_PRIMARY_AND_ACTIVE) === 0)
|
|
6963
|
+
if ((stream._duplexState & READ_PRIMARY_AND_ACTIVE) === 0) {
|
|
6964
|
+
this.updateNonPrimary();
|
|
6965
|
+
}
|
|
6885
6966
|
} while (this.continueUpdate() === true);
|
|
6886
6967
|
stream._duplexState &= READ_NOT_UPDATING;
|
|
6887
6968
|
}
|
|
@@ -6890,8 +6971,12 @@ var require_streamx = __commonJS({
|
|
|
6890
6971
|
if ((stream._duplexState & READ_ENDING_STATUS) === READ_ENDING) {
|
|
6891
6972
|
stream._duplexState = (stream._duplexState | READ_DONE) & READ_NOT_ENDING;
|
|
6892
6973
|
stream.emit("end");
|
|
6893
|
-
if ((stream._duplexState & AUTO_DESTROY) === DONE)
|
|
6894
|
-
|
|
6974
|
+
if ((stream._duplexState & AUTO_DESTROY) === DONE) {
|
|
6975
|
+
stream._duplexState |= DESTROYING;
|
|
6976
|
+
}
|
|
6977
|
+
if (this.pipeTo !== null) {
|
|
6978
|
+
this.pipeTo.end();
|
|
6979
|
+
}
|
|
6895
6980
|
}
|
|
6896
6981
|
if ((stream._duplexState & DESTROY_STATUS) === DESTROYING) {
|
|
6897
6982
|
if ((stream._duplexState & ACTIVE_OR_TICKING) === 0) {
|
|
@@ -6911,8 +6996,11 @@ var require_streamx = __commonJS({
|
|
|
6911
6996
|
return true;
|
|
6912
6997
|
}
|
|
6913
6998
|
updateCallback() {
|
|
6914
|
-
if ((this.stream._duplexState & READ_UPDATE_SYNC_STATUS) === READ_PRIMARY)
|
|
6915
|
-
|
|
6999
|
+
if ((this.stream._duplexState & READ_UPDATE_SYNC_STATUS) === READ_PRIMARY) {
|
|
7000
|
+
this.update();
|
|
7001
|
+
} else {
|
|
7002
|
+
this.updateNextTick();
|
|
7003
|
+
}
|
|
6916
7004
|
}
|
|
6917
7005
|
updateNextTickIfOpen() {
|
|
6918
7006
|
if ((this.stream._duplexState & READ_NEXT_TICK_OR_OPENING) !== 0) return;
|
|
@@ -6949,7 +7037,7 @@ var require_streamx = __commonJS({
|
|
|
6949
7037
|
this.to = null;
|
|
6950
7038
|
if (this.from !== null) {
|
|
6951
7039
|
if ((this.from._duplexState & READ_DONE) === 0 || !this.pipeToFinished) {
|
|
6952
|
-
this.from.destroy(this.error ||
|
|
7040
|
+
this.from.destroy(this.error || StreamError.PREMATURE_CLOSE("Writable stream closed"));
|
|
6953
7041
|
}
|
|
6954
7042
|
return;
|
|
6955
7043
|
}
|
|
@@ -6958,7 +7046,7 @@ var require_streamx = __commonJS({
|
|
|
6958
7046
|
this.from = null;
|
|
6959
7047
|
if (this.to !== null) {
|
|
6960
7048
|
if ((stream._duplexState & READ_DONE) === 0) {
|
|
6961
|
-
this.to.destroy(this.error ||
|
|
7049
|
+
this.to.destroy(this.error || StreamError.PREMATURE_CLOSE("Readable stream closed"));
|
|
6962
7050
|
}
|
|
6963
7051
|
return;
|
|
6964
7052
|
}
|
|
@@ -6982,21 +7070,30 @@ var require_streamx = __commonJS({
|
|
|
6982
7070
|
stream._duplexState |= DESTROYING;
|
|
6983
7071
|
}
|
|
6984
7072
|
stream._duplexState &= WRITE_NOT_FINISHING;
|
|
6985
|
-
if ((stream._duplexState & WRITE_UPDATING) === 0)
|
|
6986
|
-
|
|
7073
|
+
if ((stream._duplexState & WRITE_UPDATING) === 0) {
|
|
7074
|
+
this.update();
|
|
7075
|
+
} else {
|
|
7076
|
+
this.updateNextTick();
|
|
7077
|
+
}
|
|
6987
7078
|
}
|
|
6988
7079
|
function afterDestroy(err) {
|
|
6989
7080
|
const stream = this.stream;
|
|
6990
|
-
if (!err && this.error
|
|
7081
|
+
if (!err && !StreamError.isStreamDestroyed(this.error)) err = this.error;
|
|
6991
7082
|
if (err) stream.emit("error", err);
|
|
6992
7083
|
stream._duplexState |= DESTROYED;
|
|
6993
7084
|
stream.emit("close");
|
|
6994
7085
|
const rs = stream._readableState;
|
|
6995
7086
|
const ws = stream._writableState;
|
|
6996
|
-
if (rs !== null && rs.pipeline !== null)
|
|
7087
|
+
if (rs !== null && rs.pipeline !== null) {
|
|
7088
|
+
rs.pipeline.done(stream, err);
|
|
7089
|
+
}
|
|
6997
7090
|
if (ws !== null) {
|
|
6998
|
-
while (ws.drains !== null && ws.drains.length > 0)
|
|
6999
|
-
|
|
7091
|
+
while (ws.drains !== null && ws.drains.length > 0) {
|
|
7092
|
+
ws.drains.shift().resolve(false);
|
|
7093
|
+
}
|
|
7094
|
+
if (ws.pipeline !== null) {
|
|
7095
|
+
ws.pipeline.done(stream, err);
|
|
7096
|
+
}
|
|
7000
7097
|
}
|
|
7001
7098
|
}
|
|
7002
7099
|
function afterWrite(err) {
|
|
@@ -7015,8 +7112,9 @@ var require_streamx = __commonJS({
|
|
|
7015
7112
|
function afterRead(err) {
|
|
7016
7113
|
if (err) this.stream.destroy(err);
|
|
7017
7114
|
this.stream._duplexState &= READ_NOT_ACTIVE;
|
|
7018
|
-
if (this.readAhead === false && (this.stream._duplexState & READ_RESUMED) === 0)
|
|
7115
|
+
if (this.readAhead === false && (this.stream._duplexState & READ_RESUMED) === 0) {
|
|
7019
7116
|
this.stream._duplexState &= READ_NO_READ_AHEAD;
|
|
7117
|
+
}
|
|
7020
7118
|
this.updateCallback();
|
|
7021
7119
|
}
|
|
7022
7120
|
function updateReadNT() {
|
|
@@ -7043,8 +7141,12 @@ var require_streamx = __commonJS({
|
|
|
7043
7141
|
const stream = this.stream;
|
|
7044
7142
|
if (err) stream.destroy(err);
|
|
7045
7143
|
if ((stream._duplexState & DESTROYING) === 0) {
|
|
7046
|
-
if ((stream._duplexState & READ_PRIMARY_STATUS) === 0)
|
|
7047
|
-
|
|
7144
|
+
if ((stream._duplexState & READ_PRIMARY_STATUS) === 0) {
|
|
7145
|
+
stream._duplexState |= READ_PRIMARY;
|
|
7146
|
+
}
|
|
7147
|
+
if ((stream._duplexState & WRITE_PRIMARY_STATUS) === 0) {
|
|
7148
|
+
stream._duplexState |= WRITE_PRIMARY;
|
|
7149
|
+
}
|
|
7048
7150
|
stream.emit("open");
|
|
7049
7151
|
}
|
|
7050
7152
|
stream._duplexState &= NOT_ACTIVE;
|
|
@@ -7087,9 +7189,7 @@ var require_streamx = __commonJS({
|
|
|
7087
7189
|
if (opts.open) this._open = opts.open;
|
|
7088
7190
|
if (opts.destroy) this._destroy = opts.destroy;
|
|
7089
7191
|
if (opts.predestroy) this._predestroy = opts.predestroy;
|
|
7090
|
-
if (opts.signal)
|
|
7091
|
-
opts.signal.addEventListener("abort", abort.bind(this));
|
|
7092
|
-
}
|
|
7192
|
+
if (opts.signal) opts.signal.addEventListener("abort", abort.bind(this));
|
|
7093
7193
|
}
|
|
7094
7194
|
this.on("newListener", newListener);
|
|
7095
7195
|
}
|
|
@@ -7115,7 +7215,7 @@ var require_streamx = __commonJS({
|
|
|
7115
7215
|
}
|
|
7116
7216
|
destroy(err) {
|
|
7117
7217
|
if ((this._duplexState & DESTROY_STATUS) === 0) {
|
|
7118
|
-
if (!err) err = STREAM_DESTROYED;
|
|
7218
|
+
if (!err) err = StreamError.STREAM_DESTROYED();
|
|
7119
7219
|
this._duplexState = (this._duplexState | DESTROYING) & NON_PRIMARY;
|
|
7120
7220
|
if (this._readableState !== null) {
|
|
7121
7221
|
this._readableState.highWaterMark = 0;
|
|
@@ -7128,8 +7228,12 @@ var require_streamx = __commonJS({
|
|
|
7128
7228
|
this._duplexState |= PREDESTROYING;
|
|
7129
7229
|
this._predestroy();
|
|
7130
7230
|
this._duplexState &= NOT_PREDESTROYING;
|
|
7131
|
-
if (this._readableState !== null)
|
|
7132
|
-
|
|
7231
|
+
if (this._readableState !== null) {
|
|
7232
|
+
this._readableState.updateNextTick();
|
|
7233
|
+
}
|
|
7234
|
+
if (this._writableState !== null) {
|
|
7235
|
+
this._writableState.updateNextTick();
|
|
7236
|
+
}
|
|
7133
7237
|
}
|
|
7134
7238
|
}
|
|
7135
7239
|
};
|
|
@@ -7145,6 +7249,15 @@ var require_streamx = __commonJS({
|
|
|
7145
7249
|
if (opts.encoding) this.setEncoding(opts.encoding);
|
|
7146
7250
|
}
|
|
7147
7251
|
}
|
|
7252
|
+
static deferred(fn, opts) {
|
|
7253
|
+
const out = new PassThrough(opts);
|
|
7254
|
+
fn().then((src) => {
|
|
7255
|
+
if (src === null) return out.end();
|
|
7256
|
+
if (out.destroying) return;
|
|
7257
|
+
pipeline(src, out, noop);
|
|
7258
|
+
}).catch((err) => out.destroy(err));
|
|
7259
|
+
return out;
|
|
7260
|
+
}
|
|
7148
7261
|
setEncoding(encoding) {
|
|
7149
7262
|
const dec = new TextDecoder2(encoding);
|
|
7150
7263
|
const map = this._readableState.map || echo;
|
|
@@ -7262,10 +7375,13 @@ var require_streamx = __commonJS({
|
|
|
7262
7375
|
}
|
|
7263
7376
|
function ondata(data) {
|
|
7264
7377
|
if (promiseReject === null) return;
|
|
7265
|
-
if (error)
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
7378
|
+
if (error) {
|
|
7379
|
+
promiseReject(error);
|
|
7380
|
+
} else if (data === null && (stream._duplexState & READ_DONE) === 0) {
|
|
7381
|
+
promiseReject(StreamError.STREAM_DESTROYED());
|
|
7382
|
+
} else {
|
|
7383
|
+
promiseResolve({ value: data, done: data === null });
|
|
7384
|
+
}
|
|
7269
7385
|
promiseReject = promiseResolve = null;
|
|
7270
7386
|
}
|
|
7271
7387
|
function destroy(err) {
|
|
@@ -7434,7 +7550,7 @@ var require_streamx = __commonJS({
|
|
|
7434
7550
|
function pipeline(stream, ...streams) {
|
|
7435
7551
|
const all = Array.isArray(stream) ? [...stream, ...streams] : [stream, ...streams];
|
|
7436
7552
|
const done = all.length && typeof all[all.length - 1] === "function" ? all.pop() : null;
|
|
7437
|
-
if (all.length < 2) throw
|
|
7553
|
+
if (all.length < 2) throw StreamError.BAD_ARGUMENT("Pipeline requires at least 2 streams");
|
|
7438
7554
|
let src = all[0];
|
|
7439
7555
|
let dest = null;
|
|
7440
7556
|
let error = null;
|
|
@@ -7459,7 +7575,7 @@ var require_streamx = __commonJS({
|
|
|
7459
7575
|
if (!autoDestroy) done(error);
|
|
7460
7576
|
});
|
|
7461
7577
|
if (autoDestroy) {
|
|
7462
|
-
dest.on("close", () => done(error || (fin ? null : PREMATURE_CLOSE)));
|
|
7578
|
+
dest.on("close", () => done(error || (fin ? null : StreamError.PREMATURE_CLOSE())));
|
|
7463
7579
|
}
|
|
7464
7580
|
}
|
|
7465
7581
|
return dest;
|
|
@@ -7467,8 +7583,12 @@ var require_streamx = __commonJS({
|
|
|
7467
7583
|
s.on("error", onerror2);
|
|
7468
7584
|
s.on("close", onclose);
|
|
7469
7585
|
function onclose() {
|
|
7470
|
-
if (s._readableState && !s._readableState.ended)
|
|
7471
|
-
|
|
7586
|
+
if (s._readableState && !s._readableState.ended) {
|
|
7587
|
+
return onerror2(StreamError.PREMATURE_CLOSE());
|
|
7588
|
+
}
|
|
7589
|
+
if (wr && s._writableState && !s._writableState.ended) {
|
|
7590
|
+
return onerror2(StreamError.PREMATURE_CLOSE());
|
|
7591
|
+
}
|
|
7472
7592
|
}
|
|
7473
7593
|
}
|
|
7474
7594
|
function onerror(err) {
|
|
@@ -7502,7 +7622,7 @@ var require_streamx = __commonJS({
|
|
|
7502
7622
|
}
|
|
7503
7623
|
function getStreamError(stream, opts = {}) {
|
|
7504
7624
|
const err = stream._readableState && stream._readableState.error || stream._writableState && stream._writableState.error;
|
|
7505
|
-
return !opts.all && err
|
|
7625
|
+
return !opts.all && StreamError.isStreamDestroyed(err) ? null : err;
|
|
7506
7626
|
}
|
|
7507
7627
|
function isReadStreamx(stream) {
|
|
7508
7628
|
return isStreamx(stream) && stream.readable;
|
|
@@ -7519,7 +7639,7 @@ var require_streamx = __commonJS({
|
|
|
7519
7639
|
function noop() {
|
|
7520
7640
|
}
|
|
7521
7641
|
function abort() {
|
|
7522
|
-
this.destroy(
|
|
7642
|
+
this.destroy(StreamError.ABORTED());
|
|
7523
7643
|
}
|
|
7524
7644
|
function isWritev(s) {
|
|
7525
7645
|
return s._writev !== Writable.prototype._writev && s._writev !== Duplex.prototype._writev;
|
|
@@ -7548,7 +7668,7 @@ var require_streamx = __commonJS({
|
|
|
7548
7668
|
|
|
7549
7669
|
// ../../node_modules/tar-fs/node_modules/tar-stream/headers.js
|
|
7550
7670
|
var require_headers = __commonJS({
|
|
7551
|
-
"../../node_modules/tar-fs/node_modules/tar-stream/headers.js"(exports
|
|
7671
|
+
"../../node_modules/tar-fs/node_modules/tar-stream/headers.js"(exports) {
|
|
7552
7672
|
var b4a = require_b4a();
|
|
7553
7673
|
var ZEROS = "0000000000000000000";
|
|
7554
7674
|
var SEVENS = "7777777777777777777";
|
|
@@ -7560,10 +7680,10 @@ var require_headers = __commonJS({
|
|
|
7560
7680
|
var MASK = 4095;
|
|
7561
7681
|
var MAGIC_OFFSET = 257;
|
|
7562
7682
|
var VERSION_OFFSET = 263;
|
|
7563
|
-
exports
|
|
7683
|
+
exports.decodeLongPath = function decodeLongPath(buf, encoding) {
|
|
7564
7684
|
return decodeStr(buf, 0, buf.length, encoding);
|
|
7565
7685
|
};
|
|
7566
|
-
exports
|
|
7686
|
+
exports.encodePax = function encodePax(opts) {
|
|
7567
7687
|
let result = "";
|
|
7568
7688
|
if (opts.name) result += addLength(" path=" + opts.name + "\n");
|
|
7569
7689
|
if (opts.linkname) result += addLength(" linkpath=" + opts.linkname + "\n");
|
|
@@ -7575,7 +7695,7 @@ var require_headers = __commonJS({
|
|
|
7575
7695
|
}
|
|
7576
7696
|
return b4a.from(result);
|
|
7577
7697
|
};
|
|
7578
|
-
exports
|
|
7698
|
+
exports.decodePax = function decodePax(buf) {
|
|
7579
7699
|
const result = {};
|
|
7580
7700
|
while (buf.length) {
|
|
7581
7701
|
let i = 0;
|
|
@@ -7590,7 +7710,7 @@ var require_headers = __commonJS({
|
|
|
7590
7710
|
}
|
|
7591
7711
|
return result;
|
|
7592
7712
|
};
|
|
7593
|
-
exports
|
|
7713
|
+
exports.encode = function encode(opts) {
|
|
7594
7714
|
const buf = b4a.alloc(512);
|
|
7595
7715
|
let name = opts.name;
|
|
7596
7716
|
let prefix = "";
|
|
@@ -7622,7 +7742,7 @@ var require_headers = __commonJS({
|
|
|
7622
7742
|
b4a.write(buf, encodeOct(cksum(buf), 6), 148);
|
|
7623
7743
|
return buf;
|
|
7624
7744
|
};
|
|
7625
|
-
exports
|
|
7745
|
+
exports.decode = function decode(buf, filenameEncoding, allowUnknownFormat) {
|
|
7626
7746
|
let typeflag = buf[156] === 0 ? 0 : buf[156] - ZERO_OFFSET;
|
|
7627
7747
|
let name = decodeStr(buf, 0, 100, filenameEncoding);
|
|
7628
7748
|
const mode = decodeOct(buf, 100, 8);
|
|
@@ -7808,7 +7928,7 @@ var require_headers = __commonJS({
|
|
|
7808
7928
|
|
|
7809
7929
|
// ../../node_modules/tar-fs/node_modules/tar-stream/extract.js
|
|
7810
7930
|
var require_extract = __commonJS({
|
|
7811
|
-
"../../node_modules/tar-fs/node_modules/tar-stream/extract.js"(exports
|
|
7931
|
+
"../../node_modules/tar-fs/node_modules/tar-stream/extract.js"(exports, module) {
|
|
7812
7932
|
var { Writable, Readable, getStreamError } = require_streamx();
|
|
7813
7933
|
var FIFO = require_fast_fifo();
|
|
7814
7934
|
var b4a = require_b4a();
|
|
@@ -8142,7 +8262,7 @@ var require_extract = __commonJS({
|
|
|
8142
8262
|
|
|
8143
8263
|
// ../../node_modules/tar-fs/node_modules/tar-stream/constants.js
|
|
8144
8264
|
var require_constants = __commonJS({
|
|
8145
|
-
"../../node_modules/tar-fs/node_modules/tar-stream/constants.js"(exports
|
|
8265
|
+
"../../node_modules/tar-fs/node_modules/tar-stream/constants.js"(exports, module) {
|
|
8146
8266
|
var constants = {
|
|
8147
8267
|
// just for envs without fs
|
|
8148
8268
|
S_IFMT: 61440,
|
|
@@ -8162,7 +8282,7 @@ var require_constants = __commonJS({
|
|
|
8162
8282
|
|
|
8163
8283
|
// ../../node_modules/tar-fs/node_modules/tar-stream/pack.js
|
|
8164
8284
|
var require_pack = __commonJS({
|
|
8165
|
-
"../../node_modules/tar-fs/node_modules/tar-stream/pack.js"(exports
|
|
8285
|
+
"../../node_modules/tar-fs/node_modules/tar-stream/pack.js"(exports, module) {
|
|
8166
8286
|
var { Readable, Writable, getStreamError } = require_streamx();
|
|
8167
8287
|
var b4a = require_b4a();
|
|
8168
8288
|
var constants = require_constants();
|
|
@@ -8396,15 +8516,15 @@ var require_pack = __commonJS({
|
|
|
8396
8516
|
|
|
8397
8517
|
// ../../node_modules/tar-fs/node_modules/tar-stream/index.js
|
|
8398
8518
|
var require_tar_stream = __commonJS({
|
|
8399
|
-
"../../node_modules/tar-fs/node_modules/tar-stream/index.js"(exports
|
|
8400
|
-
exports
|
|
8401
|
-
exports
|
|
8519
|
+
"../../node_modules/tar-fs/node_modules/tar-stream/index.js"(exports) {
|
|
8520
|
+
exports.extract = require_extract();
|
|
8521
|
+
exports.pack = require_pack();
|
|
8402
8522
|
}
|
|
8403
8523
|
});
|
|
8404
8524
|
|
|
8405
8525
|
// ../../node_modules/wrappy/wrappy.js
|
|
8406
8526
|
var require_wrappy = __commonJS({
|
|
8407
|
-
"../../node_modules/wrappy/wrappy.js"(exports
|
|
8527
|
+
"../../node_modules/wrappy/wrappy.js"(exports, module) {
|
|
8408
8528
|
module.exports = wrappy;
|
|
8409
8529
|
function wrappy(fn, cb) {
|
|
8410
8530
|
if (fn && cb) return wrappy(fn)(cb);
|
|
@@ -8434,7 +8554,7 @@ var require_wrappy = __commonJS({
|
|
|
8434
8554
|
|
|
8435
8555
|
// ../../node_modules/once/once.js
|
|
8436
8556
|
var require_once = __commonJS({
|
|
8437
|
-
"../../node_modules/once/once.js"(exports
|
|
8557
|
+
"../../node_modules/once/once.js"(exports, module) {
|
|
8438
8558
|
var wrappy = require_wrappy();
|
|
8439
8559
|
module.exports = wrappy(once);
|
|
8440
8560
|
module.exports.strict = wrappy(onceStrict);
|
|
@@ -8478,7 +8598,7 @@ var require_once = __commonJS({
|
|
|
8478
8598
|
|
|
8479
8599
|
// ../../node_modules/end-of-stream/index.js
|
|
8480
8600
|
var require_end_of_stream = __commonJS({
|
|
8481
|
-
"../../node_modules/end-of-stream/index.js"(exports
|
|
8601
|
+
"../../node_modules/end-of-stream/index.js"(exports, module) {
|
|
8482
8602
|
var once = require_once();
|
|
8483
8603
|
var noop = function() {
|
|
8484
8604
|
};
|
|
@@ -8561,7 +8681,7 @@ var require_end_of_stream = __commonJS({
|
|
|
8561
8681
|
|
|
8562
8682
|
// ../../node_modules/pump/index.js
|
|
8563
8683
|
var require_pump = __commonJS({
|
|
8564
|
-
"../../node_modules/pump/index.js"(exports
|
|
8684
|
+
"../../node_modules/pump/index.js"(exports, module) {
|
|
8565
8685
|
var once = require_once();
|
|
8566
8686
|
var eos = require_end_of_stream();
|
|
8567
8687
|
var fs2;
|
|
@@ -8636,13 +8756,13 @@ var require_pump = __commonJS({
|
|
|
8636
8756
|
|
|
8637
8757
|
// ../../node_modules/tar-fs/index.js
|
|
8638
8758
|
var require_tar_fs = __commonJS({
|
|
8639
|
-
"../../node_modules/tar-fs/index.js"(exports
|
|
8759
|
+
"../../node_modules/tar-fs/index.js"(exports) {
|
|
8640
8760
|
var tar = require_tar_stream();
|
|
8641
8761
|
var pump = require_pump();
|
|
8642
8762
|
var fs2 = __require("fs");
|
|
8643
8763
|
var path2 = __require("path");
|
|
8644
8764
|
var win32 = (global.Bare ? global.Bare.platform : process.platform) === "win32";
|
|
8645
|
-
exports
|
|
8765
|
+
exports.pack = function pack(cwd, opts) {
|
|
8646
8766
|
if (!cwd) cwd = ".";
|
|
8647
8767
|
if (!opts) opts = {};
|
|
8648
8768
|
const xfs = opts.fs || fs2;
|
|
@@ -8729,7 +8849,7 @@ var require_tar_fs = __commonJS({
|
|
|
8729
8849
|
function processUmask() {
|
|
8730
8850
|
return !global.Bare && process.umask ? process.umask() : 0;
|
|
8731
8851
|
}
|
|
8732
|
-
exports
|
|
8852
|
+
exports.extract = function extract3(cwd, opts) {
|
|
8733
8853
|
if (!cwd) cwd = ".";
|
|
8734
8854
|
if (!opts) opts = {};
|
|
8735
8855
|
cwd = path2.resolve(cwd);
|
|
@@ -8802,6 +8922,7 @@ var require_tar_fs = __commonJS({
|
|
|
8802
8922
|
});
|
|
8803
8923
|
function stat(err) {
|
|
8804
8924
|
if (err) return next(err);
|
|
8925
|
+
if (path2.join(name, ".") === path2.join(cwd, ".")) return next();
|
|
8805
8926
|
utimes(name, header, function(err2) {
|
|
8806
8927
|
if (err2) return next(err2);
|
|
8807
8928
|
if (win32) return next();
|
|
@@ -8812,7 +8933,7 @@ var require_tar_fs = __commonJS({
|
|
|
8812
8933
|
if (win32) return next();
|
|
8813
8934
|
xfs.unlink(name, function() {
|
|
8814
8935
|
const dst = path2.resolve(path2.dirname(name), header.linkname);
|
|
8815
|
-
if (!inCwd(dst) && validateSymLinks) return next(new Error(name + " is not a valid symlink"));
|
|
8936
|
+
if (!inCwd(dst) && (validateSymLinks || opts.strip)) return next(new Error(name + " is not a valid symlink"));
|
|
8816
8937
|
validateNotSymlink(xfs, dst, path2.join(cwd, "."), function(err, valid) {
|
|
8817
8938
|
if (err) return next(err);
|
|
8818
8939
|
if (!valid && validateSymLinks) return next(new Error(name + " is not a valid symlink"));
|
|
@@ -8840,15 +8961,22 @@ var require_tar_fs = __commonJS({
|
|
|
8840
8961
|
return dst === cwd || dst.startsWith(cwd + path2.sep);
|
|
8841
8962
|
}
|
|
8842
8963
|
function onfile() {
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
rs.destroy(err);
|
|
8964
|
+
xfs.lstat(name, function(err, st) {
|
|
8965
|
+
if (!err && st.isSymbolicLink()) return xfs.unlink(name, onwrite);
|
|
8966
|
+
onwrite();
|
|
8847
8967
|
});
|
|
8848
|
-
|
|
8968
|
+
function onwrite(err) {
|
|
8849
8969
|
if (err) return next(err);
|
|
8850
|
-
ws.
|
|
8851
|
-
|
|
8970
|
+
const ws = xfs.createWriteStream(name);
|
|
8971
|
+
const rs = mapStream(stream, header);
|
|
8972
|
+
ws.on("error", function(err2) {
|
|
8973
|
+
rs.destroy(err2);
|
|
8974
|
+
});
|
|
8975
|
+
pump(rs, ws, function(err2) {
|
|
8976
|
+
if (err2) return next(err2);
|
|
8977
|
+
ws.on("close", stat);
|
|
8978
|
+
});
|
|
8979
|
+
}
|
|
8852
8980
|
}
|
|
8853
8981
|
}
|
|
8854
8982
|
function utimesParent(name, cb) {
|
|
@@ -8871,7 +8999,7 @@ var require_tar_fs = __commonJS({
|
|
|
8871
8999
|
const chmod = link ? xfs.lchmod : xfs.chmod;
|
|
8872
9000
|
const chown = link ? xfs.lchown : xfs.chown;
|
|
8873
9001
|
if (!chmod) return cb();
|
|
8874
|
-
const mode = (header.mode | (header.type === "directory" ? dmode : fmode)) & umask;
|
|
9002
|
+
const mode = (header.mode | (header.type === "directory" ? dmode : fmode)) & umask & 511;
|
|
8875
9003
|
if (chown && own) chown.call(xfs, name, header.uid, header.gid, onchown);
|
|
8876
9004
|
else onchown(null);
|
|
8877
9005
|
function onchown(err) {
|
|
@@ -8908,6 +9036,9 @@ var require_tar_fs = __commonJS({
|
|
|
8908
9036
|
cb(null, false);
|
|
8909
9037
|
});
|
|
8910
9038
|
}
|
|
9039
|
+
function inside(root, name) {
|
|
9040
|
+
return name === root || name.startsWith(root + path2.sep);
|
|
9041
|
+
}
|
|
8911
9042
|
function noop() {
|
|
8912
9043
|
}
|
|
8913
9044
|
function echo(name) {
|
|
@@ -8919,10 +9050,12 @@ var require_tar_fs = __commonJS({
|
|
|
8919
9050
|
function statAll(fs3, stat, cwd, ignore, entries, sort) {
|
|
8920
9051
|
if (!entries) entries = ["."];
|
|
8921
9052
|
const queue = entries.slice(0);
|
|
9053
|
+
const root = path2.resolve(cwd);
|
|
8922
9054
|
return function loop(callback) {
|
|
8923
9055
|
if (!queue.length) return callback(null);
|
|
8924
9056
|
const next = queue.shift();
|
|
8925
9057
|
const nextAbs = path2.join(cwd, next);
|
|
9058
|
+
if (!inside(root, path2.resolve(cwd, next))) return callback(new Error(next + " is not a valid path"));
|
|
8926
9059
|
stat.call(fs3, nextAbs, function(err, stat2) {
|
|
8927
9060
|
if (err) return callback(entries.indexOf(next) === -1 && err.code === "ENOENT" ? null : err);
|
|
8928
9061
|
if (!stat2.isDirectory()) return callback(null, next, stat2);
|
|
@@ -10071,7 +10204,7 @@ function inspect(contract) {
|
|
|
10071
10204
|
);
|
|
10072
10205
|
actions.push({
|
|
10073
10206
|
name,
|
|
10074
|
-
|
|
10207
|
+
nextStep: a?.nextStep,
|
|
10075
10208
|
example: a?.example,
|
|
10076
10209
|
scalarKeys,
|
|
10077
10210
|
allKeys,
|
|
@@ -10318,14 +10451,10 @@ function inferLayout(s, prompt, blueprint) {
|
|
|
10318
10451
|
var DRAG_RX = /\b(drag|drop|dragging|draggable)\b/i;
|
|
10319
10452
|
var SWIPE_RX = /\b(swipe|swipes|gesture\s*stack)\b/i;
|
|
10320
10453
|
var KEYBOARD_RX = /\b(keyboard\s*shortcut|hotkey|keystroke|kbd)\b/i;
|
|
10321
|
-
function inferWriteTrigger(s, prompt
|
|
10454
|
+
function inferWriteTrigger(s, prompt) {
|
|
10322
10455
|
if (s.actions.length === 0) {
|
|
10323
10456
|
return { value: "click", source: "default" };
|
|
10324
10457
|
}
|
|
10325
|
-
if (blueprint?.mechanic === "drag")
|
|
10326
|
-
return { value: "drag", source: "blueprint" };
|
|
10327
|
-
if (blueprint?.mechanic === "swipe")
|
|
10328
|
-
return { value: "swipe", source: "blueprint" };
|
|
10329
10458
|
if (DRAG_RX.test(prompt)) return { value: "drag", source: "prompt" };
|
|
10330
10459
|
if (SWIPE_RX.test(prompt)) return { value: "swipe", source: "prompt" };
|
|
10331
10460
|
if (KEYBOARD_RX.test(prompt)) return { value: "keystroke", source: "prompt" };
|
|
@@ -10366,7 +10495,7 @@ function classifyAxes(input) {
|
|
|
10366
10495
|
const fetch2 = inferFetch(s);
|
|
10367
10496
|
const render = inferRender(s, prompt, blueprint);
|
|
10368
10497
|
const layout = inferLayout(s, prompt, blueprint);
|
|
10369
|
-
const writeTrigger = inferWriteTrigger(s, prompt
|
|
10498
|
+
const writeTrigger = inferWriteTrigger(s, prompt);
|
|
10370
10499
|
const tooling = inferTooling(s);
|
|
10371
10500
|
const vector = {
|
|
10372
10501
|
render: render.value,
|
|
@@ -11188,28 +11317,17 @@ function inferTypeFromExample(example) {
|
|
|
11188
11317
|
}
|
|
11189
11318
|
function generateBoilerplate(_userPrompt, contract, shellType, screen, composedSections, appGadgets) {
|
|
11190
11319
|
const propsFields = [];
|
|
11191
|
-
const
|
|
11192
|
-
const
|
|
11193
|
-
|
|
11194
|
-
|
|
11195
|
-
|
|
11196
|
-
|
|
11197
|
-
|
|
11198
|
-
|
|
11199
|
-
|
|
11200
|
-
|
|
11201
|
-
|
|
11202
|
-
jsonSchemaTypeToTs(schema)
|
|
11203
|
-
) : "unknown";
|
|
11204
|
-
const fullType = nullable ? `${tsType} | null` : tsType;
|
|
11205
|
-
const parts = [];
|
|
11206
|
-
if (spec.description) parts.push(String(spec.description));
|
|
11207
|
-
if (spec.default !== void 0) parts.push(`(default: ${JSON.stringify(spec.default)})`);
|
|
11208
|
-
const desc = parts.length > 0 ? ` // ${parts.join(" ")}` : "";
|
|
11209
|
-
propsFields.push(` ${key}${required ? "" : "?"}: ${fullType};${desc}`);
|
|
11210
|
-
} else {
|
|
11211
|
-
propsFields.push(` ${key}: ${typeof value === "string" ? value : "unknown"};`);
|
|
11212
|
-
}
|
|
11320
|
+
const propsProperties = contract?.propsSpec?.properties ?? {};
|
|
11321
|
+
for (const [key, entry] of Object.entries(propsProperties)) {
|
|
11322
|
+
const required = entry.required !== false;
|
|
11323
|
+
const nullable = entry.schema.nullable === true;
|
|
11324
|
+
const tsType = jsonSchemaTypeToTs(entry.schema);
|
|
11325
|
+
const fullType = nullable ? `${tsType} | null` : tsType;
|
|
11326
|
+
const parts = [];
|
|
11327
|
+
if (entry.description) parts.push(entry.description);
|
|
11328
|
+
if (entry.default !== void 0) parts.push(`(default: ${JSON.stringify(entry.default)})`);
|
|
11329
|
+
const desc = parts.length > 0 ? ` // ${parts.join(" ")}` : "";
|
|
11330
|
+
propsFields.push(` ${key}${required ? "" : "?"}: ${fullType};${desc}`);
|
|
11213
11331
|
}
|
|
11214
11332
|
const actionTypeAliases = [];
|
|
11215
11333
|
const actionHookCalls = [];
|
|
@@ -11766,10 +11884,10 @@ A \`DataContract\` declares everything a GguiSession exchanges with the outside
|
|
|
11766
11884
|
|
|
11767
11885
|
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.**
|
|
11768
11886
|
|
|
11769
|
-
- **Array iteration**: always default to \`[]\` before \`.map\`/\`.filter\`/\`.length\`. Use \`(props.items ?? []).map(...)\` not \`props.items.map(...)\`. Same for stream.
|
|
11887
|
+
- **Array iteration**: always default to \`[]\` before \`.map\`/\`.filter\`/\`.length\`. Use \`(props.items ?? []).map(...)\` not \`props.items.map(...)\`. Same for stream.all, stream.latest, etc.
|
|
11770
11888
|
- **Object access**: optional-chain through nested fields. \`props.user?.name ?? 'Anonymous'\` not \`props.user.name\`.
|
|
11771
11889
|
- **Number ops**: default before arithmetic. \`(props.count ?? 0) + 1\` not \`props.count + 1\`.
|
|
11772
|
-
- **Stream latest**: \`useStream\` returns \`{latest: T |
|
|
11890
|
+
- **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\`.
|
|
11773
11891
|
- **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.
|
|
11774
11892
|
- **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.
|
|
11775
11893
|
- **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.
|
|
@@ -12990,7 +13108,7 @@ tighter on display sizes).
|
|
|
12990
13108
|
init_validation();
|
|
12991
13109
|
|
|
12992
13110
|
// src/tools/get-wire.ts
|
|
12993
|
-
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
|
|
13111
|
+
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";
|
|
12994
13112
|
|
|
12995
13113
|
// src/harness/pitfalls.ts
|
|
12996
13114
|
var PITFALLS = [
|