@qilin-agent/experimental-webworker-runtime 3.1.7 → 3.1.8

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/lib/index.js CHANGED
@@ -938,6 +938,8 @@ var Transformer = class {
938
938
  moduleRequests = /* @__PURE__ */ new Set();
939
939
  metaResolveRequests = /* @__PURE__ */ new Set();
940
940
  createRequireBindings = /* @__PURE__ */ new Set();
941
+ /** `yield*` nodes already lowered by their owning statement, never re-visited. */
942
+ loweredDelegations = /* @__PURE__ */ new Set();
941
943
  constructor(source, path) {
942
944
  this.path = path;
943
945
  this.source = source.startsWith("#!") ? `//${source.slice(2)}` : source;
@@ -1067,6 +1069,12 @@ var Transformer = class {
1067
1069
  exportDefault(node) {
1068
1070
  this.moduleSyntax = true;
1069
1071
  const declaration = node.declaration;
1072
+ const identifier = declaration.id;
1073
+ if ((declaration.type === "ClassDeclaration" || declaration.type === "FunctionDeclaration") && identifier !== null) {
1074
+ this.replace(node.start, declaration.start, "");
1075
+ this.insert(node.end, `;exports.default=${nameOf(identifier)};`);
1076
+ return;
1077
+ }
1070
1078
  this.replace(node.start, declaration.start, "exports.default = ");
1071
1079
  }
1072
1080
  exportAll(node) {
@@ -1118,9 +1126,9 @@ var Transformer = class {
1118
1126
  /**
1119
1127
  * `yield` resumes with whatever the consumer sent, so the snapshot is taken
1120
1128
  * before suspending and restored when the call completes. `yield*` delegates,
1121
- * which has no expression form here: it is desugared as a statement, and a
1122
- * consumer's `throw()` is not forwarded into the inner iterator (`next` and
1123
- * `return` are).
1129
+ * which has no general expression form here: it is desugared as a statement or
1130
+ * as `return yield* operand` (see {@link returnDelegate}), and a consumer's
1131
+ * `throw()` is not forwarded into the inner iterator (`next` and `return` are).
1124
1132
  */
1125
1133
  yieldExpression(node, statement) {
1126
1134
  if (node.delegate !== true) {
@@ -1145,6 +1153,29 @@ var Transformer = class {
1145
1153
  `finally{if(!${exhausted})${ALS}.resume(await ${ALS}.pause(${ALS}.close(${iterator})))}}`
1146
1154
  ].join(""));
1147
1155
  }
1156
+ /**
1157
+ * `return yield* operand` hands the inner iterator's completion value to the
1158
+ * caller: the same forwarding loop as the statement form, with its done branch
1159
+ * returning instead of falling out of the block. The `finally` close still runs
1160
+ * on an abrupt exit from the loop; the done branch marks the iterator exhausted
1161
+ * so the close is skipped for a normal delegation end.
1162
+ * @param node - the owning `return` statement, replaced as a whole.
1163
+ * @param operand - the delegated iterator expression.
1164
+ */
1165
+ returnDelegate(node, operand) {
1166
+ const iterator = this.alsTemp();
1167
+ const step = this.alsTemp();
1168
+ const sent = this.alsTemp();
1169
+ const exhausted = this.alsTemp();
1170
+ this.structural(node.start, node.end, (inner) => [
1171
+ `{const ${iterator}=${ALS}.iterator(${inner(operand.start, operand.end)});`,
1172
+ `let ${sent};let ${exhausted}=false;`,
1173
+ `try{for(;;){const ${step}=${ALS}.resume(await ${ALS}.pause(${iterator}.next(${sent})));`,
1174
+ `if(${step}.done){${exhausted}=true;return ${step}.value}`,
1175
+ `${sent}=${ALS}.afterYield(${ALS}.snapshot(),yield ${step}.value)}}`,
1176
+ `finally{if(!${exhausted})${ALS}.resume(await ${ALS}.pause(${ALS}.close(${iterator})))}}`
1177
+ ].join(""));
1178
+ }
1148
1179
  visit(node, context) {
1149
1180
  if (node === null || typeof node !== "object") return;
1150
1181
  if (Array.isArray(node)) {
@@ -1211,8 +1242,16 @@ var Transformer = class {
1211
1242
  if (body.type === "ForOfStatement" && body.await === true) this.fail("a labeled for-await loop is not supported", record.start);
1212
1243
  break;
1213
1244
  }
1245
+ case "ReturnStatement": {
1246
+ const operand = record.argument;
1247
+ if (context.asyncGenerator && operand !== null && operand.type === "YieldExpression" && operand.delegate === true && operand.argument !== null) {
1248
+ this.returnDelegate(record, operand.argument);
1249
+ this.loweredDelegations.add(operand.start);
1250
+ }
1251
+ break;
1252
+ }
1214
1253
  case "YieldExpression":
1215
- if (context.asyncGenerator) this.yieldExpression(record, context.statement);
1254
+ if (context.asyncGenerator && !this.loweredDelegations.has(record.start)) this.yieldExpression(record, context.statement);
1216
1255
  break;
1217
1256
  case "FunctionDeclaration":
1218
1257
  case "FunctionExpression":
@@ -19,6 +19,15 @@ export declare function requestListener(): RequestListener | undefined;
19
19
  * @returns a promise resolved with the listener as soon as it is captured.
20
20
  */
21
21
  export declare function whenRequestListener(): Promise<RequestListener>;
22
+ /**
23
+ * Connection pool placeholder. Node's `http.Agent` is the base class of the
24
+ * proxy agents `got`'s HTTP/2 connection cache builds at module scope; a worker
25
+ * never opens a pooled connection, so the pool is inert.
26
+ */
27
+ export declare class Agent {
28
+ /** Release the pool (nothing to release). */
29
+ destroy(): void;
30
+ }
22
31
  /** Fake Server: event registrations are stored and never emitted. */
23
32
  declare class FakeServer {
24
33
  private readonly listeners;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * `node:https` for the worker. The preview deployment never serves TLS — the
3
+ * webserver imports `createServer` from this module at load time, and only the
4
+ * plain-http fake server carries the tunnel's synthesized requests — so the
5
+ * secure surface mirrors that one implementation.
6
+ */
7
+ export { Agent, createServer, Server, ServerResponse, STATUS_CODES, request, get, } from './http.ts';
8
+ //# sourceMappingURL=https.d.ts.map
@@ -0,0 +1,39 @@
1
+ /**
2
+ * `assert` for the worker. Dependencies such as `http2-wrapper` use it for
3
+ * protocol invariants; the module is the assertion function itself (Node's
4
+ * shape), with the handful of members those callers reach for.
5
+ */
6
+ /** Assertion failure carrying the message the assertion was given. */
7
+ export declare class AssertionError extends Error {
8
+ /**
9
+ * @param message - the failure text.
10
+ */
11
+ constructor(message?: string);
12
+ }
13
+ /**
14
+ * Throw unless the value is truthy.
15
+ * @param value - the asserted value.
16
+ * @param message - optional failure text.
17
+ */
18
+ export declare function assert(value: unknown, message?: string): void;
19
+ /**
20
+ * Compare with `===`.
21
+ * @param actual - observed value.
22
+ * @param expected - required value.
23
+ * @param message - optional failure text.
24
+ */
25
+ export declare function strictEqual(actual: unknown, expected: unknown, message?: string): void;
26
+ /**
27
+ * Compare with `==`.
28
+ * @param actual - observed value.
29
+ * @param expected - required value.
30
+ * @param message - optional failure text.
31
+ */
32
+ export declare function equal(actual: unknown, expected: unknown, message?: string): void;
33
+ /** {@link assert} under its Node alias. */
34
+ export declare const ok: typeof assert;
35
+ /** CommonJS interop marker: the worker loader hands `default` to default imports. */
36
+ export declare const __esModule = true;
37
+ /** CommonJS default export: Node's `assert` module is the assertion function itself. */
38
+ export default assert;
39
+ //# sourceMappingURL=assert.d.ts.map
@@ -0,0 +1,31 @@
1
+ /**
2
+ * `node:diagnostics_channel` stub. `got` opens its telemetry channels at module
3
+ * scope and publishes only when a subscriber exists; the worker has no
4
+ * subscribers, so channels report none and publishing is inert.
5
+ */
6
+ /** One named diagnostics channel. */
7
+ declare class Channel {
8
+ /** The worker has no diagnostics subscribers, so this is always false. */
9
+ readonly hasSubscribers = false;
10
+ /** @param _message - the payload a real subscriber would receive. */
11
+ publish(_message: unknown): void;
12
+ /** @param _listener - the subscriber a real channel would retain. */
13
+ subscribe(_listener: (...args: unknown[]) => void): void;
14
+ /** @param _listener - the subscriber a real channel would drop. */
15
+ unsubscribe(_listener: (...args: unknown[]) => void): void;
16
+ }
17
+ /**
18
+ * Return the channel registered under one name.
19
+ * @param name - channel name, e.g. `got:request:start`.
20
+ * @returns the shared channel.
21
+ */
22
+ export declare function channel(name: string): Channel;
23
+ /** CommonJS interop marker: the worker loader hands `default` to default imports. */
24
+ export declare const __esModule = true;
25
+ /** CommonJS default export: the members `require()` hands a caller of this module. */
26
+ declare const _default: {
27
+ channel: typeof channel;
28
+ Channel: typeof Channel;
29
+ };
30
+ export default _default;
31
+ //# sourceMappingURL=diagnostics_channel.d.ts.map
@@ -0,0 +1,26 @@
1
+ /** getaddrinfo flag: map IPv4 addresses to IPv6 (Node parity). */
2
+ export declare const V4MAPPED = 8;
3
+ /** getaddrinfo flag: return all addresses (Node parity). */
4
+ export declare const ALL = 16;
5
+ /** getaddrinfo flag: honor the host's address configuration (Node parity). */
6
+ export declare const ADDRCONFIG = 32;
7
+ /** DNS lookup (unavailable in the worker host). */
8
+ export declare const lookup: (...args: never[]) => never;
9
+ /** Promise-shaped resolver face, as `node:dns/promises` carries it. */
10
+ export declare const promises: {
11
+ Resolver: (...args: never[]) => never;
12
+ };
13
+ /** CommonJS interop marker: the worker loader hands `default` to default imports. */
14
+ export declare const __esModule = true;
15
+ /** CommonJS default export: the members `require()` hands a caller of this module. */
16
+ declare const _default: {
17
+ V4MAPPED: number;
18
+ ALL: number;
19
+ ADDRCONFIG: number;
20
+ lookup: (...args: never[]) => never;
21
+ promises: {
22
+ Resolver: (...args: never[]) => never;
23
+ };
24
+ };
25
+ export default _default;
26
+ //# sourceMappingURL=dns.d.ts.map
@@ -0,0 +1,22 @@
1
+ /** HTTP/2 client session (unavailable). */
2
+ export declare const connect: (...args: never[]) => never;
3
+ /** Cleartext HTTP/2 server (unavailable). */
4
+ export declare const createServer: (...args: never[]) => never;
5
+ /** Secure HTTP/2 server (unavailable). */
6
+ export declare const createSecureServer: (...args: never[]) => never;
7
+ /**
8
+ * Protocol constants. The connection cache destructures them at module scope;
9
+ * the values are only read on a real HTTP/2 handshake, which never happens here.
10
+ */
11
+ export declare const constants: {};
12
+ /** CommonJS interop marker: the worker loader hands `default` to default imports. */
13
+ export declare const __esModule = true;
14
+ /** CommonJS default export: the members `require()` hands a caller of this module. */
15
+ declare const _default: {
16
+ connect: (...args: never[]) => never;
17
+ createServer: (...args: never[]) => never;
18
+ createSecureServer: (...args: never[]) => never;
19
+ constants: {};
20
+ };
21
+ export default _default;
22
+ //# sourceMappingURL=http2.d.ts.map
@@ -0,0 +1,23 @@
1
+ /**
2
+ * A TLS socket. `http2-wrapper` builds its stream-socket wrapper at module
3
+ * scope from Node's own internals — `new TLSSocket(passThrough)._handle._parentWrap`
4
+ * — so the stub exposes that one private member with a constructible class.
5
+ * A socket never connects, so nothing else about it is exercised on the boot path.
6
+ */
7
+ export declare class TLSSocket {
8
+ /** Node's private socket internals, as the wrapper reads them. */
9
+ readonly _handle: {
10
+ _parentWrap: {
11
+ constructor: {
12
+ new (): {};
13
+ };
14
+ };
15
+ };
16
+ }
17
+ /** Certificate validation hook (unavailable). */
18
+ export declare const checkServerIdentity: (...args: never[]) => never;
19
+ /** TLS connection (unavailable). */
20
+ export declare const connect: (...args: never[]) => never;
21
+ /** TLS server (unavailable). */
22
+ export declare const createServer: (...args: never[]) => never;
23
+ //# sourceMappingURL=tls.d.ts.map
@@ -26,6 +26,21 @@ export declare function getBuiltinProviders(): string[];
26
26
  * @returns no models.
27
27
  */
28
28
  export declare function getBuiltinModels(): unknown[];
29
+ /**
30
+ * Every model of one installed catalog provider, chat and non-chat alike.
31
+ * `llm-pi-ai` reads it while it activates to decide whether a provider ships a
32
+ * chat model; this deployment ships none, so the empty collection is the truth.
33
+ * @returns no models.
34
+ */
35
+ export declare function getAllBuiltinModels(): unknown[];
36
+ /**
37
+ * The mutable models collection `llm-pi-ai` builds its routes from. The
38
+ * collection starts empty and every mutation is accepted, so activation reads
39
+ * an empty catalog; streaming is the only member on a request path and stays
40
+ * loud.
41
+ * @returns an empty mutable models collection.
42
+ */
43
+ export declare function builtinModels(): Record<string, unknown>;
29
44
  /** Anthropic messages API binding (unavailable). */
30
45
  export declare const anthropicMessagesApi: (...args: never[]) => never;
31
46
  /** OpenAI completions API binding (unavailable). */
@@ -42,6 +57,8 @@ declare const _default: {
42
57
  isContextOverflow: (...args: never[]) => never;
43
58
  builtinProviders: typeof builtinProviders;
44
59
  getBuiltinModels: typeof getBuiltinModels;
60
+ getAllBuiltinModels: typeof getAllBuiltinModels;
61
+ builtinModels: typeof builtinModels;
45
62
  getBuiltinProviders: typeof getBuiltinProviders;
46
63
  anthropicMessagesApi: (...args: never[]) => never;
47
64
  openAICompletionsApi: (...args: never[]) => never;
package/lib/worker.js CHANGED
@@ -4391,7 +4391,7 @@ function installBase64UrlEncoding(Buffer) {
4391
4391
  var buffer_exports = /* @__PURE__ */ __exportAll({
4392
4392
  Buffer: () => import_buffer.Buffer,
4393
4393
  __esModule: () => true,
4394
- constants: () => constants$4,
4394
+ constants: () => constants$5,
4395
4395
  default: () => buffer_default,
4396
4396
  kMaxLength: () => import_buffer.kMaxLength
4397
4397
  });
@@ -4405,14 +4405,14 @@ Object.defineProperty(globalThis, "Buffer", {
4405
4405
  * Size limits, as `node:buffer` publishes them. The npm package exposes only
4406
4406
  * `kMaxLength`, so the string bound is Node's own value for a 64-bit build.
4407
4407
  */
4408
- const constants$4 = {
4408
+ const constants$5 = {
4409
4409
  MAX_LENGTH: import_buffer.kMaxLength,
4410
4410
  MAX_STRING_LENGTH: 536870888
4411
4411
  };
4412
4412
  /** CommonJS default export: the members `require()` hands a caller of this module. */
4413
4413
  var buffer_default = {
4414
4414
  Buffer: import_buffer.Buffer,
4415
- constants: constants$4,
4415
+ constants: constants$5,
4416
4416
  kMaxLength: import_buffer.kMaxLength
4417
4417
  };
4418
4418
  //#endregion
@@ -4883,6 +4883,49 @@ function installAsyncContextHooks() {
4883
4883
  });
4884
4884
  }
4885
4885
  //#endregion
4886
+ //#region src/node/builtin_modules/mock/assert.ts
4887
+ /**
4888
+ * `assert` for the worker. Dependencies such as `http2-wrapper` use it for
4889
+ * protocol invariants; the module is the assertion function itself (Node's
4890
+ * shape), with the handful of members those callers reach for.
4891
+ */
4892
+ /** Assertion failure carrying the message the assertion was given. */
4893
+ var AssertionError = class extends Error {
4894
+ /**
4895
+ * @param message - the failure text.
4896
+ */
4897
+ constructor(message) {
4898
+ super(message ?? "assertion failed");
4899
+ this.name = "AssertionError";
4900
+ }
4901
+ };
4902
+ /**
4903
+ * Throw unless the value is truthy.
4904
+ * @param value - the asserted value.
4905
+ * @param message - optional failure text.
4906
+ */
4907
+ function assert(value, message) {
4908
+ if (!value) throw new AssertionError(message);
4909
+ }
4910
+ /**
4911
+ * Compare with `===`.
4912
+ * @param actual - observed value.
4913
+ * @param expected - required value.
4914
+ * @param message - optional failure text.
4915
+ */
4916
+ function strictEqual(actual, expected, message) {
4917
+ if (actual !== expected) throw new AssertionError(message);
4918
+ }
4919
+ /**
4920
+ * Compare with `==`.
4921
+ * @param actual - observed value.
4922
+ * @param expected - required value.
4923
+ * @param message - optional failure text.
4924
+ */
4925
+ function equal(actual, expected, message) {
4926
+ if (actual != expected) throw new AssertionError(message);
4927
+ }
4928
+ //#endregion
4886
4929
  //#region ../../../node_modules/.pnpm/@noble+hashes@2.3.0/node_modules/@noble/hashes/_u64.js
4887
4930
  const U32_MASK64 = /* @__PURE__ */ (() => BigInt(2 ** 32 - 1))();
4888
4931
  const _32n = /* @__PURE__ */ BigInt(32);
@@ -6013,6 +6056,77 @@ var crypto_default = {
6013
6056
  webcrypto
6014
6057
  };
6015
6058
  //#endregion
6059
+ //#region src/node/builtin_modules/mock/diagnostics_channel.ts
6060
+ var diagnostics_channel_exports = /* @__PURE__ */ __exportAll({
6061
+ __esModule: () => true,
6062
+ channel: () => channel,
6063
+ default: () => diagnostics_channel_default
6064
+ });
6065
+ /**
6066
+ * `node:diagnostics_channel` stub. `got` opens its telemetry channels at module
6067
+ * scope and publishes only when a subscriber exists; the worker has no
6068
+ * subscribers, so channels report none and publishing is inert.
6069
+ */
6070
+ /** One named diagnostics channel. */
6071
+ var Channel = class {
6072
+ /** The worker has no diagnostics subscribers, so this is always false. */
6073
+ hasSubscribers = false;
6074
+ /** @param _message - the payload a real subscriber would receive. */
6075
+ publish(_message) {}
6076
+ /** @param _listener - the subscriber a real channel would retain. */
6077
+ subscribe(_listener) {}
6078
+ /** @param _listener - the subscriber a real channel would drop. */
6079
+ unsubscribe(_listener) {}
6080
+ };
6081
+ const channels = /* @__PURE__ */ new Map();
6082
+ /**
6083
+ * Return the channel registered under one name.
6084
+ * @param name - channel name, e.g. `got:request:start`.
6085
+ * @returns the shared channel.
6086
+ */
6087
+ function channel(name) {
6088
+ const existing = channels.get(name);
6089
+ if (existing !== void 0) return existing;
6090
+ const created = new Channel();
6091
+ channels.set(name, created);
6092
+ return created;
6093
+ }
6094
+ /** CommonJS default export: the members `require()` hands a caller of this module. */
6095
+ var diagnostics_channel_default = {
6096
+ channel,
6097
+ Channel
6098
+ };
6099
+ //#endregion
6100
+ //#region src/node/builtin_modules/mock/dns.ts
6101
+ /**
6102
+ * `node:dns` stub. The preview deployment resolves nothing itself — the tunnel
6103
+ * carries every request and the worker never opens an outbound socket — so the
6104
+ * resolver surface `got`'s connection cache imports exists but fails loud when
6105
+ * a request path actually asks for it.
6106
+ */
6107
+ var dns_exports = /* @__PURE__ */ __exportAll({
6108
+ ADDRCONFIG: () => 32,
6109
+ ALL: () => 16,
6110
+ V4MAPPED: () => 8,
6111
+ __esModule: () => true,
6112
+ default: () => dns_default,
6113
+ lookup: () => lookup$1,
6114
+ promises: () => promises$2
6115
+ });
6116
+ const MODULE$13 = "node:dns";
6117
+ /** DNS lookup (unavailable in the worker host). */
6118
+ const lookup$1 = notImplementedFail(MODULE$13, "lookup");
6119
+ /** Promise-shaped resolver face, as `node:dns/promises` carries it. */
6120
+ const promises$2 = { Resolver: notImplementedFail(MODULE$13, "Resolver") };
6121
+ /** CommonJS default export: the members `require()` hands a caller of this module. */
6122
+ var dns_default = {
6123
+ V4MAPPED: 8,
6124
+ ALL: 16,
6125
+ ADDRCONFIG: 32,
6126
+ lookup: lookup$1,
6127
+ promises: promises$2
6128
+ };
6129
+ //#endregion
6016
6130
  //#region src/node/builtin_modules/mock/dns/promises.ts
6017
6131
  /**
6018
6132
  * `node:dns/promises` stub. The static WebWorker preview has no DNS resolver;
@@ -6030,11 +6144,6 @@ const lookup = notImplementedFail("node:dns/promises", "lookup");
6030
6144
  var promises_default$2 = { lookup };
6031
6145
  //#endregion
6032
6146
  //#region src/node/builtin_modules/implemented/events.ts
6033
- var events_exports = /* @__PURE__ */ __exportAll({
6034
- EventEmitter: () => EventEmitter,
6035
- __esModule: () => true,
6036
- default: () => events_default
6037
- });
6038
6147
  /** The `node:events` subset the harness registers on: add, remove, and emit. */
6039
6148
  var EventEmitter = class {
6040
6149
  registry = /* @__PURE__ */ new Map();
@@ -6149,8 +6258,6 @@ var EventEmitter = class {
6149
6258
  return this;
6150
6259
  }
6151
6260
  };
6152
- /** CommonJS default export: the members `require()` hands a caller of this module. */
6153
- var events_default = { EventEmitter };
6154
6261
  //#endregion
6155
6262
  //#region ../../../node_modules/.pnpm/readable-stream@4.7.0/node_modules/readable-stream/lib/ours/primordials.js
6156
6263
  var require_primordials = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -12092,7 +12199,7 @@ var fs_exports = /* @__PURE__ */ __exportAll({
12092
12199
  appendFileSync: () => appendFileSync,
12093
12200
  chmodSync: () => chmodSync,
12094
12201
  closeSync: () => closeSync,
12095
- constants: () => constants$3,
12202
+ constants: () => constants$4,
12096
12203
  createReadStream: () => createReadStream,
12097
12204
  createWriteStream: () => createWriteStream,
12098
12205
  default: () => fs_default,
@@ -12178,7 +12285,7 @@ var Dirent = class {
12178
12285
  }
12179
12286
  };
12180
12287
  /** Access-mode constants; the VFS has no permission model, so all bits pass. */
12181
- const constants$3 = {
12288
+ const constants$4 = {
12182
12289
  F_OK: 0,
12183
12290
  R_OK: 4,
12184
12291
  W_OK: 2,
@@ -12796,11 +12903,11 @@ const promises = {
12796
12903
  vfs().truncateSync(asPath(path), length);
12797
12904
  },
12798
12905
  watch: watchAsync,
12799
- constants: constants$3
12906
+ constants: constants$4
12800
12907
  };
12801
12908
  /** CommonJS default export: the members `require()` hands a caller of this module. */
12802
12909
  var fs_default = {
12803
- constants: constants$3,
12910
+ constants: constants$4,
12804
12911
  promises,
12805
12912
  Dirent,
12806
12913
  FSWatcher,
@@ -12852,7 +12959,7 @@ var promises_exports$1 = /* @__PURE__ */ __exportAll({
12852
12959
  access: () => access,
12853
12960
  appendFile: () => appendFile,
12854
12961
  chmod: () => chmod,
12855
- constants: () => constants$2,
12962
+ constants: () => constants$3,
12856
12963
  cp: () => cp$1,
12857
12964
  default: () => promises_default$1,
12858
12965
  link: () => link,
@@ -12873,16 +12980,17 @@ var promises_exports$1 = /* @__PURE__ */ __exportAll({
12873
12980
  writeFile: () => writeFile
12874
12981
  });
12875
12982
  /** The promise members of the VFS bridge, as `node:fs/promises` names them. */
12876
- const { readFile, writeFile, appendFile, mkdir: mkdir$1, mkdtemp, readdir, stat: stat$1, lstat, realpath, rm: rm$1, unlink, rename, access, chmod, cp: cp$1, link, open: open$1, opendir, truncate, watch, constants: constants$2 } = promises;
12983
+ const { readFile, writeFile, appendFile, mkdir: mkdir$1, mkdtemp, readdir, stat: stat$1, lstat, realpath, rm: rm$1, unlink, rename, access, chmod, cp: cp$1, link, open: open$1, opendir, truncate, watch, constants: constants$3 } = promises;
12877
12984
  var promises_default$1 = promises;
12878
12985
  //#endregion
12879
12986
  //#region src/node/builtin_modules/implemented/http.ts
12880
12987
  var http_exports = /* @__PURE__ */ __exportAll({
12988
+ Agent: () => Agent,
12881
12989
  STATUS_CODES: () => STATUS_CODES,
12882
12990
  Server: () => FakeServer,
12883
12991
  ServerResponse: () => ServerResponse,
12884
12992
  __esModule: () => true,
12885
- createServer: () => createServer$1,
12993
+ createServer: () => createServer$3,
12886
12994
  default: () => http_default,
12887
12995
  get: () => get,
12888
12996
  request: () => request,
@@ -12908,6 +13016,15 @@ async function whenRequestListener() {
12908
13016
  if (captured !== void 0) return captured;
12909
13017
  return await new Promise((resolve) => waiting.add(resolve));
12910
13018
  }
13019
+ /**
13020
+ * Connection pool placeholder. Node's `http.Agent` is the base class of the
13021
+ * proxy agents `got`'s HTTP/2 connection cache builds at module scope; a worker
13022
+ * never opens a pooled connection, so the pool is inert.
13023
+ */
13024
+ var Agent = class {
13025
+ /** Release the pool (nothing to release). */
13026
+ destroy() {}
13027
+ };
12911
13028
  /** Fake Server: event registrations are stored and never emitted. */
12912
13029
  var FakeServer = class {
12913
13030
  listeners = /* @__PURE__ */ new Map();
@@ -12993,7 +13110,7 @@ var ServerResponse = class {};
12993
13110
  * @param listener - the request listener when options come first.
12994
13111
  * @returns the fake Server.
12995
13112
  */
12996
- function createServer$1(optionsOrListener, listener) {
13113
+ function createServer$3(optionsOrListener, listener) {
12997
13114
  const requestListener = typeof optionsOrListener === "function" ? optionsOrListener : listener;
12998
13115
  if (requestListener !== void 0) {
12999
13116
  captured = requestListener;
@@ -13033,7 +13150,7 @@ const STATUS_CODES = {
13033
13150
  };
13034
13151
  /** CommonJS default export: the members `require()` hands a caller of this module. */
13035
13152
  var http_default = {
13036
- createServer: createServer$1,
13153
+ createServer: createServer$3,
13037
13154
  request,
13038
13155
  get,
13039
13156
  STATUS_CODES,
@@ -13041,6 +13158,83 @@ var http_default = {
13041
13158
  ServerResponse
13042
13159
  };
13043
13160
  //#endregion
13161
+ //#region src/node/builtin_modules/mock/http2.ts
13162
+ /**
13163
+ * `node:http2` stub. The preview deployment speaks HTTP/1.1 through the
13164
+ * tunnel's fake server and never opens an HTTP/2 session; the package exists so
13165
+ * `got`'s HTTP/2 connection cache can be imported, and every connection symbol
13166
+ * fails loud if a request path ever negotiates it.
13167
+ */
13168
+ var http2_exports = /* @__PURE__ */ __exportAll({
13169
+ __esModule: () => true,
13170
+ connect: () => connect$2,
13171
+ constants: () => constants$2,
13172
+ createSecureServer: () => createSecureServer,
13173
+ createServer: () => createServer$2,
13174
+ default: () => http2_default
13175
+ });
13176
+ const MODULE$11 = "node:http2";
13177
+ /** HTTP/2 client session (unavailable). */
13178
+ const connect$2 = notImplementedFail(MODULE$11, "connect");
13179
+ /** Cleartext HTTP/2 server (unavailable). */
13180
+ const createServer$2 = notImplementedFail(MODULE$11, "createServer");
13181
+ /** Secure HTTP/2 server (unavailable). */
13182
+ const createSecureServer = notImplementedFail(MODULE$11, "createSecureServer");
13183
+ /**
13184
+ * Protocol constants. The connection cache destructures them at module scope;
13185
+ * the values are only read on a real HTTP/2 handshake, which never happens here.
13186
+ */
13187
+ const constants$2 = {};
13188
+ /** CommonJS default export: the members `require()` hands a caller of this module. */
13189
+ var http2_default = {
13190
+ connect: connect$2,
13191
+ createServer: createServer$2,
13192
+ createSecureServer,
13193
+ constants: constants$2
13194
+ };
13195
+ //#endregion
13196
+ //#region src/node/builtin_modules/implemented/https.ts
13197
+ var https_exports = /* @__PURE__ */ __exportAll({
13198
+ Agent: () => Agent,
13199
+ STATUS_CODES: () => STATUS_CODES,
13200
+ Server: () => FakeServer,
13201
+ ServerResponse: () => ServerResponse,
13202
+ createServer: () => createServer$3,
13203
+ get: () => get,
13204
+ request: () => request
13205
+ });
13206
+ //#endregion
13207
+ //#region src/node/builtin_modules/mock/tls.ts
13208
+ /**
13209
+ * `node:tls` for the worker: the preview deployment never opens a TLS socket —
13210
+ * the tunnel feeds synthesized plain-http requests into the same route table —
13211
+ * so the certificate callback is named, and TLS operations fail loud if a
13212
+ * request path ever reaches them.
13213
+ */
13214
+ var tls_exports = /* @__PURE__ */ __exportAll({
13215
+ TLSSocket: () => TLSSocket,
13216
+ checkServerIdentity: () => checkServerIdentity,
13217
+ connect: () => connect$1,
13218
+ createServer: () => createServer$1
13219
+ });
13220
+ const MODULE$10 = "node:tls";
13221
+ /**
13222
+ * A TLS socket. `http2-wrapper` builds its stream-socket wrapper at module
13223
+ * scope from Node's own internals — `new TLSSocket(passThrough)._handle._parentWrap`
13224
+ * — so the stub exposes that one private member with a constructible class.
13225
+ * A socket never connects, so nothing else about it is exercised on the boot path.
13226
+ */
13227
+ var TLSSocket = class {
13228
+ /** Node's private socket internals, as the wrapper reads them. */
13229
+ _handle = { _parentWrap: { constructor: class JsStreamSocket {} } };
13230
+ };
13231
+ /** Certificate validation hook (unavailable). */
13232
+ const checkServerIdentity = notImplementedFail(MODULE$10, "checkServerIdentity");
13233
+ /** TLS connection (unavailable). */
13234
+ const connect$1 = notImplementedFail(MODULE$10, "connect");
13235
+ /** TLS server (unavailable). */
13236
+ const createServer$1 = notImplementedFail(MODULE$10, "createServer");
13237
+ //#endregion
13044
13238
  //#region src/node/builtin_modules/implemented/module.ts
13045
13239
  /**
13046
13240
  * `node:module` for the worker: `createRequire` hands out the worker module
@@ -21696,10 +21890,12 @@ const execa = notImplementedFail("execa", "execa");
21696
21890
  var pi_ai_exports = /* @__PURE__ */ __exportAll({
21697
21891
  __esModule: () => true,
21698
21892
  anthropicMessagesApi: () => anthropicMessagesApi,
21893
+ builtinModels: () => builtinModels,
21699
21894
  builtinProviders: () => builtinProviders,
21700
21895
  createModels: () => createModels,
21701
21896
  createProvider: () => createProvider,
21702
21897
  default: () => pi_ai_default,
21898
+ getAllBuiltinModels: () => getAllBuiltinModels,
21703
21899
  getBuiltinModels: () => getBuiltinModels,
21704
21900
  getBuiltinProviders: () => getBuiltinProviders,
21705
21901
  getSupportedThinkingLevels: () => getSupportedThinkingLevels,
@@ -21790,6 +21986,35 @@ function getBuiltinProviders() {
21790
21986
  function getBuiltinModels() {
21791
21987
  return [];
21792
21988
  }
21989
+ /**
21990
+ * Every model of one installed catalog provider, chat and non-chat alike.
21991
+ * `llm-pi-ai` reads it while it activates to decide whether a provider ships a
21992
+ * chat model; this deployment ships none, so the empty collection is the truth.
21993
+ * @returns no models.
21994
+ */
21995
+ function getAllBuiltinModels() {
21996
+ return [];
21997
+ }
21998
+ /**
21999
+ * The mutable models collection `llm-pi-ai` builds its routes from. The
22000
+ * collection starts empty and every mutation is accepted, so activation reads
22001
+ * an empty catalog; streaming is the only member on a request path and stays
22002
+ * loud.
22003
+ * @returns an empty mutable models collection.
22004
+ */
22005
+ function builtinModels() {
22006
+ const none = [];
22007
+ return {
22008
+ clearProviders() {},
22009
+ addProvider() {},
22010
+ setProvider() {},
22011
+ removeProvider() {},
22012
+ listProviders: () => none,
22013
+ getModels: () => none,
22014
+ getModel: () => void 0,
22015
+ streamSimple: notImplementedFail(MODULE$1, "streamSimple")
22016
+ };
22017
+ }
21793
22018
  /** Anthropic messages API binding (unavailable). */
21794
22019
  const anthropicMessagesApi = notImplementedFail(MODULE$1, "anthropicMessagesApi");
21795
22020
  /** OpenAI completions API binding (unavailable). */
@@ -21804,6 +22029,8 @@ var pi_ai_default = {
21804
22029
  isContextOverflow,
21805
22030
  builtinProviders,
21806
22031
  getBuiltinModels,
22032
+ getAllBuiltinModels,
22033
+ builtinModels,
21807
22034
  getBuiltinProviders,
21808
22035
  anthropicMessagesApi,
21809
22036
  openAICompletionsApi,
@@ -21938,17 +22165,46 @@ const REPLACED_EXTERNAL_PACKAGES = [
21938
22165
  * other import. Deferring a shim's own start-up cost therefore belongs inside
21939
22166
  * that shim, on the path that first needs it.
21940
22167
  */
22168
+ /**
22169
+ * Node's `events` module IS the EventEmitter class, carrying itself on
22170
+ * `.EventEmitter`; CommonJS dependencies such as `http2-wrapper` write
22171
+ * `class Agent extends require('events')`, so the static module must answer the
22172
+ * class rather than our module namespace.
22173
+ */
22174
+ const eventsModule = Object.assign(EventEmitter, {
22175
+ EventEmitter,
22176
+ default: EventEmitter,
22177
+ __esModule: true
22178
+ });
22179
+ /**
22180
+ * Node's `assert` module IS the assertion function; the properties below keep the
22181
+ * named members a CommonJS dependency may also destructure.
22182
+ */
22183
+ const assertModule = Object.assign(assert, {
22184
+ ok: assert,
22185
+ equal,
22186
+ strictEqual,
22187
+ AssertionError,
22188
+ default: assert,
22189
+ __esModule: true
22190
+ });
21941
22191
  /** Builtin modules, keyed with and without the `node:` prefix. */
21942
22192
  const BUILTINS = {
22193
+ assert: () => assertModule,
21943
22194
  async_hooks: () => async_hooks_exports,
21944
22195
  buffer: () => buffer_exports,
21945
22196
  child_process: () => child_process_exports,
21946
22197
  crypto: () => crypto_exports,
22198
+ diagnostics_channel: () => diagnostics_channel_exports,
22199
+ dns: () => dns_exports,
21947
22200
  "dns/promises": () => promises_exports$2,
21948
- events: () => events_exports,
22201
+ events: () => eventsModule,
21949
22202
  fs: () => fs_exports,
21950
22203
  "fs/promises": () => promises_exports$1,
21951
22204
  http: () => http_exports,
22205
+ http2: () => http2_exports,
22206
+ https: () => https_exports,
22207
+ tls: () => tls_exports,
21952
22208
  module: () => module_exports,
21953
22209
  net: () => net_exports,
21954
22210
  os: () => os_exports,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qilin-agent/experimental-webworker-runtime",
3
3
  "description": "Browser-only harness runtime: in-memory VFS, module transform and loader, postMessage tunnel, and the dedicated Web Worker assembly, with the Node-compatibility layer that lets the host tree run unchanged",
4
- "version": "3.1.7",
4
+ "version": "3.1.8",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -31,43 +31,43 @@
31
31
  },
32
32
  "license": "MIT",
33
33
  "dependencies": {
34
+ "@qilin-agent/util-crypto": "3.1.8",
34
35
  "@noble/hashes": "^2.3.0",
35
36
  "@yarnpkg/parsers": "^3.1.0",
36
37
  "acorn": "^8.17.0",
37
38
  "buffer": "^6.0.3",
38
39
  "picomatch": "^4.0.4",
39
40
  "readable-stream": "^4.7.0",
40
- "@qilin-agent/util-crypto": "3.1.7",
41
- "@qilin-agent/client-web": "3.1.7"
41
+ "@qilin-agent/client-web": "3.1.8"
42
42
  },
43
43
  "peerDependencies": {
44
- "@qilin-agent/kylin": "~4.0.5",
45
- "@qilin-agent/kylin-plugin-loader": "~1.0.6",
46
- "@qilin-agent/client-modules": "3.1.7",
47
- "@qilin-agent/host-webserver": "3.1.7",
48
- "@qilin-agent/client-connection": "3.1.7"
44
+ "@qilin-agent/kylin": "~4.0.6-alpha.2",
45
+ "@qilin-agent/kylin-plugin-loader": "~1.0.7-alpha.2",
46
+ "@qilin-agent/client-connection": "3.1.8",
47
+ "@qilin-agent/client-modules": "3.1.8",
48
+ "@qilin-agent/host-webserver": "3.1.8"
49
49
  },
50
50
  "devDependencies": {
51
+ "@qilin-agent/api-gateway": "3.1.8",
52
+ "@qilin-agent/bash-sandbox": "3.1.8",
53
+ "@qilin-agent/client-connection": "3.1.8",
54
+ "@qilin-agent/client-file-upload": "3.1.8",
55
+ "@qilin-agent/client-modules": "3.1.8",
56
+ "@qilin-agent/host-webserver": "3.1.8",
57
+ "@qilin-agent/kylin": "~4.0.6-alpha.2",
58
+ "@qilin-agent/kylin-plugin-loader": "~1.0.7-alpha.2",
59
+ "@qilin-agent/node-addon-system": "~0.1.2",
60
+ "@qilin-agent/sandbox-local": "3.1.8",
61
+ "@qilin-agent/sandbox-policy": "3.1.8",
62
+ "@qilin-agent/schedule": "3.1.8",
63
+ "@qilin-agent/session": "3.1.8",
64
+ "@qilin-agent/session-persistence-jsonl": "3.1.8",
65
+ "@qilin-agent/session-projection": "3.1.8",
66
+ "@qilin-agent/subagent": "3.1.8",
67
+ "@qilin-agent/subprocess-local": "3.1.8",
51
68
  "@types/picomatch": "^3.0.2",
52
69
  "@types/readable-stream": "^4.0.24",
53
- "chokidar": "^5.0.0",
54
- "@qilin-agent/bash-sandbox": "3.1.7",
55
- "@qilin-agent/client-connection": "3.1.7",
56
- "@qilin-agent/client-file-upload": "3.1.7",
57
- "@qilin-agent/client-modules": "3.1.7",
58
- "@qilin-agent/api-gateway": "3.1.7",
59
- "@qilin-agent/host-webserver": "3.1.7",
60
- "@qilin-agent/kylin": "~4.0.5",
61
- "@qilin-agent/kylin-plugin-loader": "~1.0.6",
62
- "@qilin-agent/node-addon-system": "~0.1.2",
63
- "@qilin-agent/sandbox-local": "3.1.7",
64
- "@qilin-agent/schedule": "3.1.7",
65
- "@qilin-agent/sandbox-policy": "3.1.7",
66
- "@qilin-agent/session": "3.1.7",
67
- "@qilin-agent/session-persistence-jsonl": "3.1.7",
68
- "@qilin-agent/subprocess-local": "3.1.7",
69
- "@qilin-agent/subagent": "3.1.7",
70
- "@qilin-agent/session-projection": "3.1.7"
70
+ "chokidar": "^5.0.0"
71
71
  },
72
72
  "files": [
73
73
  "lib/index.js",