@moxxy/cli 0.28.1 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +678 -322
- package/package.json +2 -2
package/dist/bin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { z as z$1, definePlugin, defineProvider, defineTool, MoxxyError, asTurnId, defineMode, defineCommand, defineChannel, defineWorkflowExecutor, asPluginId, createMutex, defineTunnelProvider, classifyHttpStatus, estimateTextTokens, toFriendlyError, runReactLoop, defineCompactor, defineCacheStrategy, defineEmbedder, zodToJsonSchema, fileDiffSummary, toolResultBytes, denyByDefaultResolver, runManualCompaction, renderFrontmatter, createAllowListResolver, parseFrontmatterFile, aggregateCapabilitySpecs, EXIT_AFTER_PAIR_FLAG, isFirstPartyPackage, skillFrontmatterSchema, asSkillId, startChannelWith, SESSION_SOURCES, createDeferredPermissionResolver, getInstallHint, moxxyPackageSchema, encodeLoginPrompt, sleepWithAbort, createJsonFileStore, ISOLATION_RANK, isSelectableMode, parseFrontmatter, createCallbackResolver, countNodes, autoAllowResolver, addModelTotals, asSessionId, asToolCallId, migrateModeName, defineViewRenderer, DEFAULT_VIEW_TAGS, classifyNetworkError, isSafeViewUrl, evaluateToolRule, MOXXY_PCM16_24KHZ_MIME, isFileDiffDisplay, summarizeSessionTokensFromEvents, summarizeTokensByModel, toDiffRows, diffGutterNo, fileDiffVerb, computeElisionState, toolResultStubbed, toolResultStub, conversationalStubbed, conversationalStub, asEventId } from '@moxxy/sdk';
|
|
3
|
+
import { z as z$1, definePlugin, defineProvider, defineTool, MoxxyError, asTurnId, defineMode, defineCommand, assertDefined, defineChannel, defineWorkflowExecutor, asPluginId, createMutex, defineTunnelProvider, classifyHttpStatus, estimateTextTokens, toFriendlyError, runReactLoop, defineCompactor, defineCacheStrategy, defineEmbedder, zodToJsonSchema, fileDiffSummary, toolResultBytes, denyByDefaultResolver, runManualCompaction, renderFrontmatter, createAllowListResolver, parseFrontmatterFile, aggregateCapabilitySpecs, EXIT_AFTER_PAIR_FLAG, isFirstPartyPackage, skillFrontmatterSchema, asSkillId, startChannelWith, SESSION_SOURCES, createDeferredPermissionResolver, getInstallHint, moxxyPackageSchema, encodeLoginPrompt, sleepWithAbort, createJsonFileStore, ISOLATION_RANK, isSelectableMode, parseFrontmatter, createCallbackResolver, countNodes, autoAllowResolver, addModelTotals, asSessionId, asToolCallId, migrateModeName, defineViewRenderer, DEFAULT_VIEW_TAGS, classifyNetworkError, isSafeViewUrl, evaluateToolRule, MOXXY_PCM16_24KHZ_MIME, isFileDiffDisplay, summarizeSessionTokensFromEvents, summarizeTokensByModel, toDiffRows, diffGutterNo, fileDiffVerb, computeElisionState, toolResultStubbed, toolResultStub, conversationalStubbed, conversationalStub, asEventId } from '@moxxy/sdk';
|
|
4
4
|
import * as fs32 from 'fs';
|
|
5
5
|
import fs32__default, { existsSync, promises, readFileSync, ReadStream, mkdirSync, writeFileSync, rmSync, statSync, readdirSync, openSync, closeSync, unlinkSync, renameSync, realpathSync, lstatSync, constants as constants$1, watch, createReadStream } from 'fs';
|
|
6
6
|
import * as path3 from 'path';
|
|
@@ -18532,6 +18532,14 @@ var init_catalog = __esm({
|
|
|
18532
18532
|
installSpec: "@moxxy/plugin-channel-discord",
|
|
18533
18533
|
provides: [{ category: "channel", name: "discord" }]
|
|
18534
18534
|
},
|
|
18535
|
+
{
|
|
18536
|
+
id: "imessage",
|
|
18537
|
+
label: "iMessage channel",
|
|
18538
|
+
description: "iMessage via a BlueBubbles server on a dedicated runner (macOS only; moxxy imessage).",
|
|
18539
|
+
packageName: "@moxxy/plugin-channel-imessage",
|
|
18540
|
+
installSpec: "@moxxy/plugin-channel-imessage",
|
|
18541
|
+
provides: [{ category: "channel", name: "imessage" }]
|
|
18542
|
+
},
|
|
18535
18543
|
{
|
|
18536
18544
|
id: "stt-whisper",
|
|
18537
18545
|
label: "Whisper voice input",
|
|
@@ -63721,6 +63729,22 @@ var init_types = __esm({
|
|
|
63721
63729
|
}
|
|
63722
63730
|
});
|
|
63723
63731
|
|
|
63732
|
+
// ../chat-model/dist/assert.js
|
|
63733
|
+
function invariant(condition, message) {
|
|
63734
|
+
if (!condition) {
|
|
63735
|
+
throw new Error(`Invariant violation: ${message}`);
|
|
63736
|
+
}
|
|
63737
|
+
}
|
|
63738
|
+
function assertDefined8(value, message) {
|
|
63739
|
+
if (value === null || value === void 0) {
|
|
63740
|
+
throw new Error(`Expected a defined value: ${message}`);
|
|
63741
|
+
}
|
|
63742
|
+
}
|
|
63743
|
+
var init_assert = __esm({
|
|
63744
|
+
"../chat-model/dist/assert.js"() {
|
|
63745
|
+
}
|
|
63746
|
+
});
|
|
63747
|
+
|
|
63724
63748
|
// ../chat-model/dist/format.js
|
|
63725
63749
|
function stringify(v3) {
|
|
63726
63750
|
if (typeof v3 === "string")
|
|
@@ -64265,8 +64289,11 @@ function mixEventId(h3, id) {
|
|
|
64265
64289
|
}
|
|
64266
64290
|
function hashEventIds(events, upto) {
|
|
64267
64291
|
let h3 = FNV_BASIS;
|
|
64268
|
-
for (let i2 = 0; i2 < upto; i2 += 1)
|
|
64269
|
-
|
|
64292
|
+
for (let i2 = 0; i2 < upto; i2 += 1) {
|
|
64293
|
+
const event = events[i2];
|
|
64294
|
+
assertDefined8(event, "event index within bounds (upto <= events.length)");
|
|
64295
|
+
h3 = mixEventId(h3, event.id);
|
|
64296
|
+
}
|
|
64270
64297
|
return h3 >>> 0;
|
|
64271
64298
|
}
|
|
64272
64299
|
function isSettled(block) {
|
|
@@ -64308,7 +64335,11 @@ function blocksEquivalent(a2, b3) {
|
|
|
64308
64335
|
if (a2.agents.length !== b3.agents.length)
|
|
64309
64336
|
return false;
|
|
64310
64337
|
for (let i2 = 0; i2 < a2.agents.length; i2 += 1) {
|
|
64311
|
-
|
|
64338
|
+
const aAgent = a2.agents[i2];
|
|
64339
|
+
const bAgent = b3.agents[i2];
|
|
64340
|
+
invariant(aAgent !== void 0, "agent index within bounds");
|
|
64341
|
+
invariant(bAgent !== void 0, "agent index within bounds (equal lengths checked)");
|
|
64342
|
+
if (!blocksEquivalent(aAgent, bAgent))
|
|
64312
64343
|
return false;
|
|
64313
64344
|
}
|
|
64314
64345
|
return true;
|
|
@@ -64319,7 +64350,11 @@ function blocksEquivalent(a2, b3) {
|
|
|
64319
64350
|
if (a2.children.length !== b3.children.length)
|
|
64320
64351
|
return false;
|
|
64321
64352
|
for (let i2 = 0; i2 < a2.children.length; i2 += 1) {
|
|
64322
|
-
|
|
64353
|
+
const aChild = a2.children[i2];
|
|
64354
|
+
const bChild = b3.children[i2];
|
|
64355
|
+
invariant(aChild !== void 0, "child index within bounds");
|
|
64356
|
+
invariant(bChild !== void 0, "child index within bounds (equal lengths checked)");
|
|
64357
|
+
if (!blocksEquivalent(aChild, bChild))
|
|
64323
64358
|
return false;
|
|
64324
64359
|
}
|
|
64325
64360
|
return true;
|
|
@@ -64333,9 +64368,13 @@ function blocksEquivalent(a2, b3) {
|
|
|
64333
64368
|
if (a2.calls.length !== b3.calls.length)
|
|
64334
64369
|
return false;
|
|
64335
64370
|
for (let i2 = 0; i2 < a2.calls.length; i2 += 1) {
|
|
64336
|
-
|
|
64371
|
+
const aCall = a2.calls[i2];
|
|
64372
|
+
const bCall = b3.calls[i2];
|
|
64373
|
+
invariant(aCall !== void 0, "call index within bounds");
|
|
64374
|
+
invariant(bCall !== void 0, "call index within bounds (equal lengths checked)");
|
|
64375
|
+
if (aCall.outcome !== bCall.outcome)
|
|
64337
64376
|
return false;
|
|
64338
|
-
if (
|
|
64377
|
+
if (aCall.request !== bCall.request)
|
|
64339
64378
|
return false;
|
|
64340
64379
|
}
|
|
64341
64380
|
return true;
|
|
@@ -64361,6 +64400,7 @@ function countToolCalls(blocks) {
|
|
|
64361
64400
|
var SUBAGENT_PLUGIN_ID2, COLLAB_PLUGIN_ID2, FILE_DIFF_TOOL_NAMES, EMPTY_COMPACT_MAP, FOLD_DEV_CHECKS, FNV_BASIS, FNV_PRIME, IncrementalFold;
|
|
64362
64401
|
var init_pair_events = __esm({
|
|
64363
64402
|
"../chat-model/dist/pair-events.js"() {
|
|
64403
|
+
init_assert();
|
|
64364
64404
|
init_format();
|
|
64365
64405
|
SUBAGENT_PLUGIN_ID2 = "@moxxy/subagents";
|
|
64366
64406
|
COLLAB_PLUGIN_ID2 = "@moxxy/mode-collaborative";
|
|
@@ -64439,8 +64479,11 @@ var init_pair_events = __esm({
|
|
|
64439
64479
|
*/
|
|
64440
64480
|
syncTo(events) {
|
|
64441
64481
|
if (this.canExtend(events)) {
|
|
64442
|
-
for (let i2 = this.prefixLength; i2 < events.length; i2 += 1)
|
|
64443
|
-
|
|
64482
|
+
for (let i2 = this.prefixLength; i2 < events.length; i2 += 1) {
|
|
64483
|
+
const event = events[i2];
|
|
64484
|
+
assertDefined8(event, "event index within bounds");
|
|
64485
|
+
this.push(event);
|
|
64486
|
+
}
|
|
64444
64487
|
return this.state.root;
|
|
64445
64488
|
}
|
|
64446
64489
|
this.reset();
|
|
@@ -64484,9 +64527,12 @@ var init_pair_events = __esm({
|
|
|
64484
64527
|
return true;
|
|
64485
64528
|
if (events.length < this.prefixLength)
|
|
64486
64529
|
return false;
|
|
64487
|
-
|
|
64530
|
+
const first = events[0];
|
|
64531
|
+
assertDefined8(first, "events is non-empty when prefixLength >= 1");
|
|
64532
|
+
if (first.id !== this.headId)
|
|
64488
64533
|
return false;
|
|
64489
64534
|
const tail = events[this.prefixLength - 1];
|
|
64535
|
+
assertDefined8(tail, "tail event within bounds (events.length >= prefixLength >= 1)");
|
|
64490
64536
|
if (tail.id !== this.tailId)
|
|
64491
64537
|
return false;
|
|
64492
64538
|
if (this.tailEvent !== null && tail !== this.tailEvent)
|
|
@@ -64504,6 +64550,7 @@ var init_pair_events = __esm({
|
|
|
64504
64550
|
// ../chat-model/dist/log.js
|
|
64505
64551
|
var init_log2 = __esm({
|
|
64506
64552
|
"../chat-model/dist/log.js"() {
|
|
64553
|
+
init_assert();
|
|
64507
64554
|
}
|
|
64508
64555
|
});
|
|
64509
64556
|
|
|
@@ -64537,13 +64584,18 @@ function parseBlocks(src) {
|
|
|
64537
64584
|
let i2 = 0;
|
|
64538
64585
|
while (i2 < lines.length) {
|
|
64539
64586
|
const line = lines[i2];
|
|
64587
|
+
assertDefined8(line, "line index within bounds");
|
|
64540
64588
|
const fence = /^```(\w*)\s*$/.exec(line);
|
|
64541
64589
|
if (fence) {
|
|
64542
64590
|
const lang = fence[1] || null;
|
|
64543
64591
|
const body = [];
|
|
64544
64592
|
i2++;
|
|
64545
|
-
while (i2 < lines.length
|
|
64546
|
-
|
|
64593
|
+
while (i2 < lines.length) {
|
|
64594
|
+
const bodyLine = lines[i2];
|
|
64595
|
+
assertDefined8(bodyLine, "line index within bounds");
|
|
64596
|
+
if (/^```/.test(bodyLine))
|
|
64597
|
+
break;
|
|
64598
|
+
body.push(bodyLine);
|
|
64547
64599
|
i2++;
|
|
64548
64600
|
}
|
|
64549
64601
|
i2++;
|
|
@@ -64552,13 +64604,18 @@ function parseBlocks(src) {
|
|
|
64552
64604
|
}
|
|
64553
64605
|
if (line.trim().startsWith("|") && i2 + 1 < lines.length) {
|
|
64554
64606
|
const sep6 = lines[i2 + 1];
|
|
64607
|
+
assertDefined8(sep6, "separator line present when i + 1 < lines.length");
|
|
64555
64608
|
if (isTableSeparator(sep6)) {
|
|
64556
64609
|
const header = parseTableCells(line);
|
|
64557
64610
|
const aligns = parseTableAligns(sep6);
|
|
64558
64611
|
const rows = [];
|
|
64559
64612
|
i2 += 2;
|
|
64560
|
-
while (i2 < lines.length
|
|
64561
|
-
const
|
|
64613
|
+
while (i2 < lines.length) {
|
|
64614
|
+
const row = lines[i2];
|
|
64615
|
+
assertDefined8(row, "line index within bounds");
|
|
64616
|
+
if (!row.trim().startsWith("|"))
|
|
64617
|
+
break;
|
|
64618
|
+
const cells = parseTableCells(row);
|
|
64562
64619
|
if (cells.length === 0)
|
|
64563
64620
|
break;
|
|
64564
64621
|
while (cells.length < header.length)
|
|
@@ -64572,8 +64629,12 @@ function parseBlocks(src) {
|
|
|
64572
64629
|
}
|
|
64573
64630
|
const heading = /^(#{1,6})\s+(.*)$/.exec(line);
|
|
64574
64631
|
if (heading) {
|
|
64575
|
-
const
|
|
64576
|
-
|
|
64632
|
+
const hashes = heading[1];
|
|
64633
|
+
assertDefined8(hashes, "heading hash group is captured when the heading matches");
|
|
64634
|
+
const text = heading[2];
|
|
64635
|
+
assertDefined8(text, "heading text group is captured when the heading matches");
|
|
64636
|
+
const level = Math.min(6, Math.max(1, hashes.length));
|
|
64637
|
+
blocks.push({ kind: "heading", level, text: text.trim() });
|
|
64577
64638
|
i2++;
|
|
64578
64639
|
continue;
|
|
64579
64640
|
}
|
|
@@ -64581,10 +64642,14 @@ function parseBlocks(src) {
|
|
|
64581
64642
|
const ordered = /^\s*\d+\.\s+/.test(line);
|
|
64582
64643
|
const items = [];
|
|
64583
64644
|
while (i2 < lines.length) {
|
|
64584
|
-
const
|
|
64645
|
+
const cur = lines[i2];
|
|
64646
|
+
assertDefined8(cur, "line index within bounds");
|
|
64647
|
+
const m3 = ordered ? /^\s*\d+\.\s+(.*)$/.exec(cur) : /^\s*[-*+]\s+(.*)$/.exec(cur);
|
|
64585
64648
|
if (!m3)
|
|
64586
64649
|
break;
|
|
64587
|
-
|
|
64650
|
+
const item = m3[1];
|
|
64651
|
+
assertDefined8(item, "list item capture group is present when the item matches");
|
|
64652
|
+
items.push(item.trim());
|
|
64588
64653
|
i2++;
|
|
64589
64654
|
}
|
|
64590
64655
|
blocks.push({ kind: "list", ordered, items });
|
|
@@ -64596,12 +64661,16 @@ function parseBlocks(src) {
|
|
|
64596
64661
|
continue;
|
|
64597
64662
|
}
|
|
64598
64663
|
const paraLines = [];
|
|
64599
|
-
while (i2 < lines.length
|
|
64664
|
+
while (i2 < lines.length) {
|
|
64600
64665
|
const next = lines[i2];
|
|
64666
|
+
assertDefined8(next, "line index within bounds");
|
|
64667
|
+
if (next.trim() === "")
|
|
64668
|
+
break;
|
|
64601
64669
|
if (/^```/.test(next) || /^#{1,6}\s+/.test(next) || /^\s*[-*+]\s+/.test(next) || /^\s*\d+\.\s+/.test(next)) {
|
|
64602
64670
|
break;
|
|
64603
64671
|
}
|
|
64604
|
-
|
|
64672
|
+
const nextLine = i2 + 1 < lines.length ? lines[i2 + 1] : void 0;
|
|
64673
|
+
if (next.trim().startsWith("|") && nextLine !== void 0 && isTableSeparator(nextLine)) {
|
|
64605
64674
|
break;
|
|
64606
64675
|
}
|
|
64607
64676
|
paraLines.push(next);
|
|
@@ -64650,6 +64719,7 @@ function parseTableAligns(sep6) {
|
|
|
64650
64719
|
}
|
|
64651
64720
|
var init_parse_blocks = __esm({
|
|
64652
64721
|
"../chat-model/dist/markdown/parse-blocks.js"() {
|
|
64722
|
+
init_assert();
|
|
64653
64723
|
}
|
|
64654
64724
|
});
|
|
64655
64725
|
|
|
@@ -64666,11 +64736,19 @@ function tokenizeInline(input) {
|
|
|
64666
64736
|
if (match[1]) {
|
|
64667
64737
|
out.push({ kind: "code", value: match[1].slice(1, -1) });
|
|
64668
64738
|
} else if (match[2]) {
|
|
64669
|
-
|
|
64739
|
+
const value = match[3];
|
|
64740
|
+
assertDefined8(value, "bold inner group is captured when the bold group matches");
|
|
64741
|
+
out.push({ kind: "bold", value });
|
|
64670
64742
|
} else if (match[4]) {
|
|
64671
|
-
|
|
64743
|
+
const value = match[5];
|
|
64744
|
+
assertDefined8(value, "italic inner group is captured when the italic group matches");
|
|
64745
|
+
out.push({ kind: "italic", value });
|
|
64672
64746
|
} else if (match[6]) {
|
|
64673
|
-
|
|
64747
|
+
const label3 = match[7];
|
|
64748
|
+
const url2 = match[8];
|
|
64749
|
+
assertDefined8(label3, "link label group is captured when the link group matches");
|
|
64750
|
+
assertDefined8(url2, "link url group is captured when the link group matches");
|
|
64751
|
+
out.push({ kind: "link", label: label3, url: url2 });
|
|
64674
64752
|
}
|
|
64675
64753
|
lastIdx = match.index + match[0].length;
|
|
64676
64754
|
}
|
|
@@ -64684,6 +64762,7 @@ function stripInline(s2) {
|
|
|
64684
64762
|
}
|
|
64685
64763
|
var init_inline = __esm({
|
|
64686
64764
|
"../chat-model/dist/markdown/inline.js"() {
|
|
64765
|
+
init_assert();
|
|
64687
64766
|
}
|
|
64688
64767
|
});
|
|
64689
64768
|
|
|
@@ -80791,7 +80870,9 @@ async function setServerDisabled(name, disabled) {
|
|
|
80791
80870
|
const idx = cfg.servers.findIndex((s2) => s2.name === name);
|
|
80792
80871
|
if (idx < 0)
|
|
80793
80872
|
return { next: cfg, result: null };
|
|
80794
|
-
const
|
|
80873
|
+
const existing = cfg.servers[idx];
|
|
80874
|
+
assertDefined(existing, `mcp server at index ${idx} must exist (findIndex matched name "${name}")`);
|
|
80875
|
+
const updated = { ...existing, disabled };
|
|
80795
80876
|
const nextServers = [...cfg.servers];
|
|
80796
80877
|
nextServers[idx] = updated;
|
|
80797
80878
|
return { next: { servers: nextServers }, result: updated };
|
|
@@ -80887,8 +80968,11 @@ function createMcpRuntime(registry, options = {}) {
|
|
|
80887
80968
|
const attachServerLazy = (server) => {
|
|
80888
80969
|
if (!registry)
|
|
80889
80970
|
return { toolNames: [] };
|
|
80890
|
-
if (runtimes.has(server.name))
|
|
80891
|
-
|
|
80971
|
+
if (runtimes.has(server.name)) {
|
|
80972
|
+
const existing = runtimes.get(server.name);
|
|
80973
|
+
assertDefined(existing, `runtime for "${server.name}" must exist (has() returned true)`);
|
|
80974
|
+
return { toolNames: existing.toolNames };
|
|
80975
|
+
}
|
|
80892
80976
|
const descriptors = server.cachedTools ?? [];
|
|
80893
80977
|
if (descriptors.length === 0) {
|
|
80894
80978
|
return { toolNames: [] };
|
|
@@ -81393,9 +81477,10 @@ function buildMcpAdminPluginInternal(opts) {
|
|
|
81393
81477
|
try {
|
|
81394
81478
|
return await runtime.refreshServerCache(server);
|
|
81395
81479
|
} catch (err) {
|
|
81396
|
-
log?.warn
|
|
81397
|
-
|
|
81398
|
-
|
|
81480
|
+
if (log?.warn)
|
|
81481
|
+
log.warn(`mcp: failed to refresh cache for "${server.name}"`, {
|
|
81482
|
+
err: err instanceof Error ? err.message : String(err)
|
|
81483
|
+
});
|
|
81399
81484
|
return null;
|
|
81400
81485
|
}
|
|
81401
81486
|
}));
|
|
@@ -81405,9 +81490,10 @@ function buildMcpAdminPluginInternal(opts) {
|
|
|
81405
81490
|
try {
|
|
81406
81491
|
runtime.attachServerLazy(entry);
|
|
81407
81492
|
} catch (err) {
|
|
81408
|
-
log?.warn
|
|
81409
|
-
|
|
81410
|
-
|
|
81493
|
+
if (log?.warn)
|
|
81494
|
+
log.warn(`mcp: failed to attach lazy stubs for "${entry.name}"`, {
|
|
81495
|
+
err: err instanceof Error ? err.message : String(err)
|
|
81496
|
+
});
|
|
81411
81497
|
}
|
|
81412
81498
|
}
|
|
81413
81499
|
},
|
|
@@ -94541,8 +94627,6 @@ async function buildSession(args) {
|
|
|
94541
94627
|
// src/setup/builtins.ts
|
|
94542
94628
|
init_dist();
|
|
94543
94629
|
init_dist3();
|
|
94544
|
-
|
|
94545
|
-
// ../plugin-scheduler/dist/cron.js
|
|
94546
94630
|
var FIELD_RANGES = {
|
|
94547
94631
|
minute: { min: 0, max: 59 },
|
|
94548
94632
|
hour: { min: 0, max: 23 },
|
|
@@ -94567,6 +94651,8 @@ function parseField(raw, range, fieldName) {
|
|
|
94567
94651
|
hi = range.max;
|
|
94568
94652
|
} else if (rangePart.includes("-")) {
|
|
94569
94653
|
const [a2, b3] = rangePart.split("-");
|
|
94654
|
+
assertDefined(a2, 'range lower bound (rangePart contains "-")');
|
|
94655
|
+
assertDefined(b3, 'range upper bound (rangePart contains "-")');
|
|
94570
94656
|
lo = toIntStrict(a2, fieldName);
|
|
94571
94657
|
hi = toIntStrict(b3, fieldName);
|
|
94572
94658
|
} else {
|
|
@@ -94727,11 +94813,13 @@ function decomposeInZone(d2, timeZone) {
|
|
|
94727
94813
|
for (const part of fmt2.formatToParts(d2))
|
|
94728
94814
|
parts[part.type] = part.value;
|
|
94729
94815
|
const weekdayMap = { Sun: 0, Mon: 1, Tue: 2, Wed: 3, Thu: 4, Fri: 5, Sat: 6 };
|
|
94816
|
+
const weekday = parts.weekday;
|
|
94817
|
+
assertDefined(weekday, "formatToParts includes weekday (formatter sets weekday: short)");
|
|
94730
94818
|
return {
|
|
94731
94819
|
year: Number(parts.year),
|
|
94732
94820
|
month: Number(parts.month),
|
|
94733
94821
|
dom: Number(parts.day),
|
|
94734
|
-
dow: weekdayMap[
|
|
94822
|
+
dow: weekdayMap[weekday] ?? 0,
|
|
94735
94823
|
hour: Number(parts.hour) % 24,
|
|
94736
94824
|
minute: Number(parts.minute)
|
|
94737
94825
|
};
|
|
@@ -94980,18 +95068,24 @@ var SchedulerPoller = class _SchedulerPoller {
|
|
|
94980
95068
|
try {
|
|
94981
95069
|
await syncSkillSchedules(this.opts.skills, this.opts.store);
|
|
94982
95070
|
} catch (err) {
|
|
94983
|
-
this.opts.logger
|
|
94984
|
-
|
|
94985
|
-
|
|
95071
|
+
const log = this.opts.logger;
|
|
95072
|
+
if (log?.warn) {
|
|
95073
|
+
log.warn("scheduler: skill sync during tick failed", {
|
|
95074
|
+
err: err instanceof Error ? err.message : String(err)
|
|
95075
|
+
});
|
|
95076
|
+
}
|
|
94986
95077
|
}
|
|
94987
95078
|
}
|
|
94988
95079
|
let schedules;
|
|
94989
95080
|
try {
|
|
94990
95081
|
schedules = await this.opts.store.list();
|
|
94991
95082
|
} catch (err) {
|
|
94992
|
-
this.opts.logger
|
|
94993
|
-
|
|
94994
|
-
|
|
95083
|
+
const log = this.opts.logger;
|
|
95084
|
+
if (log?.error) {
|
|
95085
|
+
log.error("scheduler: failed to read store", {
|
|
95086
|
+
err: err instanceof Error ? err.message : String(err)
|
|
95087
|
+
});
|
|
95088
|
+
}
|
|
94995
95089
|
return 0;
|
|
94996
95090
|
}
|
|
94997
95091
|
let attempted = 0;
|
|
@@ -95000,10 +95094,13 @@ var SchedulerPoller = class _SchedulerPoller {
|
|
|
95000
95094
|
try {
|
|
95001
95095
|
due = isDue(entry, now);
|
|
95002
95096
|
} catch (err) {
|
|
95003
|
-
this.opts.logger
|
|
95004
|
-
|
|
95005
|
-
|
|
95006
|
-
|
|
95097
|
+
const log = this.opts.logger;
|
|
95098
|
+
if (log?.warn) {
|
|
95099
|
+
log.warn("scheduler: isDue failed; skipping entry", {
|
|
95100
|
+
schedule: entry.name,
|
|
95101
|
+
err: err instanceof Error ? err.message : String(err)
|
|
95102
|
+
});
|
|
95103
|
+
}
|
|
95007
95104
|
continue;
|
|
95008
95105
|
}
|
|
95009
95106
|
if (!due)
|
|
@@ -95020,10 +95117,13 @@ var SchedulerPoller = class _SchedulerPoller {
|
|
|
95020
95117
|
try {
|
|
95021
95118
|
claimed = await this.opts.fireLock.claim(fireKey, now);
|
|
95022
95119
|
} catch (err) {
|
|
95023
|
-
this.opts.logger
|
|
95024
|
-
|
|
95025
|
-
|
|
95026
|
-
|
|
95120
|
+
const log = this.opts.logger;
|
|
95121
|
+
if (log?.warn) {
|
|
95122
|
+
log.warn("scheduler: fire-once claim failed; skipping", {
|
|
95123
|
+
schedule: entry.name,
|
|
95124
|
+
err: err instanceof Error ? err.message : String(err)
|
|
95125
|
+
});
|
|
95126
|
+
}
|
|
95027
95127
|
continue;
|
|
95028
95128
|
}
|
|
95029
95129
|
if (!claimed) {
|
|
@@ -95036,17 +95136,23 @@ var SchedulerPoller = class _SchedulerPoller {
|
|
|
95036
95136
|
this.rememberFired(fireKey);
|
|
95037
95137
|
try {
|
|
95038
95138
|
const outcome = await (this.opts.firingLock ? this.opts.firingLock.run(entry.id, () => runSchedule(entry, this.opts.runner, this.opts.store, this.opts.inbox)) : runSchedule(entry, this.opts.runner, this.opts.store, this.opts.inbox));
|
|
95039
|
-
this.opts.logger
|
|
95040
|
-
|
|
95041
|
-
|
|
95042
|
-
|
|
95043
|
-
|
|
95139
|
+
const log = this.opts.logger;
|
|
95140
|
+
if (log?.info) {
|
|
95141
|
+
log.info("scheduler: fired", {
|
|
95142
|
+
schedule: entry.name,
|
|
95143
|
+
ok: outcome.ok,
|
|
95144
|
+
inbox: outcome.inboxPath
|
|
95145
|
+
});
|
|
95146
|
+
}
|
|
95044
95147
|
onFired?.(entry, { ok: outcome.ok, text: outcome.text });
|
|
95045
95148
|
} catch (err) {
|
|
95046
|
-
this.opts.logger
|
|
95047
|
-
|
|
95048
|
-
|
|
95049
|
-
|
|
95149
|
+
const log = this.opts.logger;
|
|
95150
|
+
if (log?.error) {
|
|
95151
|
+
log.error("scheduler: run failed", {
|
|
95152
|
+
schedule: entry.name,
|
|
95153
|
+
err: err instanceof Error ? err.message : String(err)
|
|
95154
|
+
});
|
|
95155
|
+
}
|
|
95050
95156
|
}
|
|
95051
95157
|
}
|
|
95052
95158
|
if (this.opts.fireLock) {
|
|
@@ -95174,24 +95280,30 @@ var ScheduleStore = class {
|
|
|
95174
95280
|
const quarantine = `${file}.corrupt-${Date.now()}`;
|
|
95175
95281
|
try {
|
|
95176
95282
|
await rename(file, quarantine);
|
|
95177
|
-
logger?.warn
|
|
95178
|
-
file,
|
|
95179
|
-
|
|
95180
|
-
|
|
95283
|
+
if (logger?.warn) {
|
|
95284
|
+
logger.warn("scheduler: schedules file was corrupt; quarantined and reset", {
|
|
95285
|
+
file,
|
|
95286
|
+
quarantine
|
|
95287
|
+
});
|
|
95288
|
+
}
|
|
95181
95289
|
} catch (err) {
|
|
95182
|
-
logger?.warn
|
|
95183
|
-
file,
|
|
95184
|
-
|
|
95185
|
-
|
|
95290
|
+
if (logger?.warn) {
|
|
95291
|
+
logger.warn("scheduler: schedules file was corrupt; failed to quarantine", {
|
|
95292
|
+
file,
|
|
95293
|
+
err: err instanceof Error ? err.message : String(err)
|
|
95294
|
+
});
|
|
95295
|
+
}
|
|
95186
95296
|
}
|
|
95187
95297
|
return [];
|
|
95188
95298
|
},
|
|
95189
95299
|
// Non-ENOENT read errors were previously swallowed to an empty store too.
|
|
95190
95300
|
onReadError: (err) => {
|
|
95191
|
-
logger?.warn
|
|
95192
|
-
file,
|
|
95193
|
-
|
|
95194
|
-
|
|
95301
|
+
if (logger?.warn) {
|
|
95302
|
+
logger.warn("scheduler: failed to read schedules file; using empty set", {
|
|
95303
|
+
file,
|
|
95304
|
+
err: err instanceof Error ? err.message : String(err)
|
|
95305
|
+
});
|
|
95306
|
+
}
|
|
95195
95307
|
return [];
|
|
95196
95308
|
}
|
|
95197
95309
|
});
|
|
@@ -95227,9 +95339,11 @@ var ScheduleStore = class {
|
|
|
95227
95339
|
const idx = schedules.findIndex((s2) => s2.id === id);
|
|
95228
95340
|
if (idx < 0)
|
|
95229
95341
|
return schedules;
|
|
95230
|
-
|
|
95342
|
+
const existing = schedules[idx];
|
|
95343
|
+
assertDefined(existing, "findIndex returned an in-bounds index");
|
|
95344
|
+
if (!isVisibleSchedule(existing))
|
|
95231
95345
|
return schedules;
|
|
95232
|
-
const next = scheduleEntrySchema.parse({ ...
|
|
95346
|
+
const next = scheduleEntrySchema.parse({ ...existing, ...patch });
|
|
95233
95347
|
schedules[idx] = next;
|
|
95234
95348
|
updated = next;
|
|
95235
95349
|
return schedules;
|
|
@@ -95243,6 +95357,7 @@ var ScheduleStore = class {
|
|
|
95243
95357
|
if (idx < 0)
|
|
95244
95358
|
return schedules;
|
|
95245
95359
|
const entry = schedules[idx];
|
|
95360
|
+
assertDefined(entry, "findIndex returned an in-bounds index");
|
|
95246
95361
|
removed = true;
|
|
95247
95362
|
if (entry.source === "manual") {
|
|
95248
95363
|
return schedules.filter((s2) => s2.id !== id);
|
|
@@ -95292,6 +95407,7 @@ var ScheduleStore = class {
|
|
|
95292
95407
|
const posInNext = /* @__PURE__ */ new Map();
|
|
95293
95408
|
for (let i2 = 0; i2 < next.length; i2 += 1) {
|
|
95294
95409
|
const s2 = next[i2];
|
|
95410
|
+
assertDefined(s2, "loop index i is within next.length");
|
|
95295
95411
|
if (s2.source === "skill" && s2.skillName && !posInNext.has(s2.skillName)) {
|
|
95296
95412
|
posInNext.set(s2.skillName, i2);
|
|
95297
95413
|
}
|
|
@@ -95310,6 +95426,7 @@ var ScheduleStore = class {
|
|
|
95310
95426
|
continue;
|
|
95311
95427
|
}
|
|
95312
95428
|
const current = next[idx];
|
|
95429
|
+
assertDefined(current, "posInNext holds an in-bounds index into next");
|
|
95313
95430
|
if (!isVisibleSchedule(current))
|
|
95314
95431
|
continue;
|
|
95315
95432
|
const patch = {
|
|
@@ -95635,9 +95752,12 @@ function buildSchedulerPlugin(opts) {
|
|
|
95635
95752
|
try {
|
|
95636
95753
|
await syncSkillSchedules(opts.skills, store);
|
|
95637
95754
|
} catch (err) {
|
|
95638
|
-
opts.logger
|
|
95639
|
-
|
|
95640
|
-
|
|
95755
|
+
const log = opts.logger;
|
|
95756
|
+
if (log?.warn) {
|
|
95757
|
+
log.warn("scheduler: initial skill sync failed", {
|
|
95758
|
+
err: err instanceof Error ? err.message : String(err)
|
|
95759
|
+
});
|
|
95760
|
+
}
|
|
95641
95761
|
}
|
|
95642
95762
|
}
|
|
95643
95763
|
poller.start();
|
|
@@ -95658,9 +95778,12 @@ function buildSchedulerPlugin(opts) {
|
|
|
95658
95778
|
try {
|
|
95659
95779
|
await syncSkillSchedules(opts.skills, store);
|
|
95660
95780
|
} catch (err) {
|
|
95661
|
-
opts.logger
|
|
95662
|
-
|
|
95663
|
-
|
|
95781
|
+
const log = opts.logger;
|
|
95782
|
+
if (log?.warn) {
|
|
95783
|
+
log.warn("scheduler: skill sync after skill_created failed", {
|
|
95784
|
+
err: err instanceof Error ? err.message : String(err)
|
|
95785
|
+
});
|
|
95786
|
+
}
|
|
95664
95787
|
}
|
|
95665
95788
|
}
|
|
95666
95789
|
}
|
|
@@ -95843,16 +95966,20 @@ var WebhookDispatcher = class {
|
|
|
95843
95966
|
prompt,
|
|
95844
95967
|
deliveryId
|
|
95845
95968
|
});
|
|
95846
|
-
this.opts.logger
|
|
95847
|
-
|
|
95848
|
-
owner
|
|
95849
|
-
|
|
95969
|
+
const logger = this.opts.logger;
|
|
95970
|
+
if (logger?.info) {
|
|
95971
|
+
logger.info("webhooks: delivery handed off to owner runner", {
|
|
95972
|
+
trigger: trigger.name,
|
|
95973
|
+
owner
|
|
95974
|
+
});
|
|
95975
|
+
}
|
|
95850
95976
|
return { handled: "enqueued", ownerSessionId: owner };
|
|
95851
95977
|
}
|
|
95852
95978
|
const outcome = await this.fire(trigger, prompt, deliveryId);
|
|
95853
95979
|
return { handled: "fired", outcome };
|
|
95854
95980
|
}
|
|
95855
95981
|
async fire(trigger, prompt, deliveryId) {
|
|
95982
|
+
const logger = this.opts.logger;
|
|
95856
95983
|
let result;
|
|
95857
95984
|
try {
|
|
95858
95985
|
result = await this.opts.runner.runPrompt({
|
|
@@ -95868,10 +95995,12 @@ var WebhookDispatcher = class {
|
|
|
95868
95995
|
try {
|
|
95869
95996
|
inboxPath = await writeInbox2(trigger, result, deliveryId, this.opts.inbox);
|
|
95870
95997
|
} catch (err) {
|
|
95871
|
-
|
|
95872
|
-
|
|
95873
|
-
|
|
95874
|
-
|
|
95998
|
+
if (logger?.warn) {
|
|
95999
|
+
logger.warn("webhooks: inbox write failed", {
|
|
96000
|
+
trigger: trigger.name,
|
|
96001
|
+
err: err instanceof Error ? err.message : String(err)
|
|
96002
|
+
});
|
|
96003
|
+
}
|
|
95875
96004
|
}
|
|
95876
96005
|
try {
|
|
95877
96006
|
await this.opts.store.recordFire(trigger.id, {
|
|
@@ -95879,10 +96008,12 @@ var WebhookDispatcher = class {
|
|
|
95879
96008
|
...result.error ? { error: result.error } : {}
|
|
95880
96009
|
});
|
|
95881
96010
|
} catch (err) {
|
|
95882
|
-
|
|
95883
|
-
|
|
95884
|
-
|
|
95885
|
-
|
|
96011
|
+
if (logger?.warn) {
|
|
96012
|
+
logger.warn("webhooks: store update failed", {
|
|
96013
|
+
trigger: trigger.name,
|
|
96014
|
+
err: err instanceof Error ? err.message : String(err)
|
|
96015
|
+
});
|
|
96016
|
+
}
|
|
95886
96017
|
}
|
|
95887
96018
|
const outcome = {
|
|
95888
96019
|
ok: !result.error,
|
|
@@ -95893,16 +96024,20 @@ var WebhookDispatcher = class {
|
|
|
95893
96024
|
try {
|
|
95894
96025
|
this.opts.onFired?.(trigger, outcome);
|
|
95895
96026
|
} catch (err) {
|
|
95896
|
-
|
|
96027
|
+
if (logger?.warn) {
|
|
96028
|
+
logger.warn("webhooks: onFired hook threw", {
|
|
96029
|
+
trigger: trigger.name,
|
|
96030
|
+
err: err instanceof Error ? err.message : String(err)
|
|
96031
|
+
});
|
|
96032
|
+
}
|
|
96033
|
+
}
|
|
96034
|
+
if (logger?.info) {
|
|
96035
|
+
logger.info("webhooks: fired", {
|
|
95897
96036
|
trigger: trigger.name,
|
|
95898
|
-
|
|
96037
|
+
ok: outcome.ok,
|
|
96038
|
+
inbox: outcome.inboxPath
|
|
95899
96039
|
});
|
|
95900
96040
|
}
|
|
95901
|
-
this.opts.logger?.info?.("webhooks: fired", {
|
|
95902
|
-
trigger: trigger.name,
|
|
95903
|
-
ok: outcome.ok,
|
|
95904
|
-
inbox: outcome.inboxPath
|
|
95905
|
-
});
|
|
95906
96041
|
return outcome;
|
|
95907
96042
|
}
|
|
95908
96043
|
};
|
|
@@ -96047,9 +96182,12 @@ var WebhookDrainPoller = class {
|
|
|
96047
96182
|
try {
|
|
96048
96183
|
records = await this.opts.queue.listOwned(this.opts.ownerSessionId);
|
|
96049
96184
|
} catch (err) {
|
|
96050
|
-
this.opts.logger
|
|
96051
|
-
|
|
96052
|
-
|
|
96185
|
+
const logger = this.opts.logger;
|
|
96186
|
+
if (logger?.warn) {
|
|
96187
|
+
logger.warn("webhooks: queue read failed", {
|
|
96188
|
+
err: err instanceof Error ? err.message : String(err)
|
|
96189
|
+
});
|
|
96190
|
+
}
|
|
96053
96191
|
return 0;
|
|
96054
96192
|
}
|
|
96055
96193
|
let fired = 0;
|
|
@@ -96063,10 +96201,13 @@ var WebhookDrainPoller = class {
|
|
|
96063
96201
|
await this.opts.dispatcher.fire(trigger, rec.prompt, rec.deliveryId);
|
|
96064
96202
|
fired += 1;
|
|
96065
96203
|
} catch (err) {
|
|
96066
|
-
this.opts.logger
|
|
96067
|
-
|
|
96068
|
-
|
|
96069
|
-
|
|
96204
|
+
const logger = this.opts.logger;
|
|
96205
|
+
if (logger?.warn) {
|
|
96206
|
+
logger.warn("webhooks: drained delivery failed", {
|
|
96207
|
+
trigger: trigger.name,
|
|
96208
|
+
err: err instanceof Error ? err.message : String(err)
|
|
96209
|
+
});
|
|
96210
|
+
}
|
|
96070
96211
|
} finally {
|
|
96071
96212
|
await this.opts.queue.remove(rec.id);
|
|
96072
96213
|
}
|
|
@@ -96083,7 +96224,7 @@ var regexCache2 = /* @__PURE__ */ new Map();
|
|
|
96083
96224
|
var REGEX_CACHE_MAX = 256;
|
|
96084
96225
|
function compileMatcher(source) {
|
|
96085
96226
|
if (regexCache2.has(source))
|
|
96086
|
-
return regexCache2.get(source);
|
|
96227
|
+
return regexCache2.get(source) ?? null;
|
|
96087
96228
|
let compiled = null;
|
|
96088
96229
|
if (source.length <= MAX_REGEX_SOURCE_LEN) {
|
|
96089
96230
|
try {
|
|
@@ -96375,9 +96516,12 @@ var WebhookServer = class {
|
|
|
96375
96516
|
}
|
|
96376
96517
|
const server = createServer((req, res) => {
|
|
96377
96518
|
this.handle(req, res).catch((err) => {
|
|
96378
|
-
this.opts.logger
|
|
96379
|
-
|
|
96380
|
-
|
|
96519
|
+
const logger = this.opts.logger;
|
|
96520
|
+
if (logger?.warn) {
|
|
96521
|
+
logger.warn("webhooks: handler threw", {
|
|
96522
|
+
err: err instanceof Error ? err.message : String(err)
|
|
96523
|
+
});
|
|
96524
|
+
}
|
|
96381
96525
|
if (!res.headersSent) {
|
|
96382
96526
|
res.writeHead(500, { "content-type": "application/json" });
|
|
96383
96527
|
res.end(JSON.stringify({ error: "internal" }));
|
|
@@ -96393,10 +96537,13 @@ var WebhookServer = class {
|
|
|
96393
96537
|
await new Promise((resolve18, reject) => {
|
|
96394
96538
|
server.once("error", reject);
|
|
96395
96539
|
server.listen(this.opts.port, this.opts.host, () => {
|
|
96396
|
-
this.opts.logger
|
|
96397
|
-
|
|
96398
|
-
|
|
96399
|
-
|
|
96540
|
+
const logger = this.opts.logger;
|
|
96541
|
+
if (logger?.info) {
|
|
96542
|
+
logger.info("webhooks: listening", {
|
|
96543
|
+
host: this.opts.host,
|
|
96544
|
+
port: this.opts.port
|
|
96545
|
+
});
|
|
96546
|
+
}
|
|
96400
96547
|
resolve18();
|
|
96401
96548
|
});
|
|
96402
96549
|
});
|
|
@@ -96432,6 +96579,7 @@ var WebhookServer = class {
|
|
|
96432
96579
|
return;
|
|
96433
96580
|
}
|
|
96434
96581
|
const triggerId = m3[1];
|
|
96582
|
+
assertDefined(triggerId, "webhook trigger id capture group");
|
|
96435
96583
|
const trigger = await this.opts.store.get(triggerId);
|
|
96436
96584
|
if (!trigger) {
|
|
96437
96585
|
res.writeHead(404, { "content-type": "application/json" });
|
|
@@ -96444,7 +96592,9 @@ var WebhookServer = class {
|
|
|
96444
96592
|
return;
|
|
96445
96593
|
}
|
|
96446
96594
|
if (this.rateLimiter && !this.rateLimiter.tryAcquire(trigger.id)) {
|
|
96447
|
-
this.opts.logger
|
|
96595
|
+
const logger = this.opts.logger;
|
|
96596
|
+
if (logger?.warn)
|
|
96597
|
+
logger.warn("webhooks: rate limited", { trigger: trigger.name });
|
|
96448
96598
|
res.writeHead(429, { "content-type": "application/json", "retry-after": "1" });
|
|
96449
96599
|
res.end(JSON.stringify({ error: "rate_limited" }));
|
|
96450
96600
|
return;
|
|
@@ -96453,11 +96603,14 @@ var WebhookServer = class {
|
|
|
96453
96603
|
try {
|
|
96454
96604
|
body = await readRequestBody(req, this.maxBodyBytes);
|
|
96455
96605
|
} catch (err) {
|
|
96456
|
-
this.opts.logger
|
|
96457
|
-
|
|
96458
|
-
|
|
96459
|
-
|
|
96460
|
-
|
|
96606
|
+
const logger = this.opts.logger;
|
|
96607
|
+
if (logger?.warn) {
|
|
96608
|
+
logger.warn("webhooks: rejected oversized body", {
|
|
96609
|
+
trigger: trigger.name,
|
|
96610
|
+
limit: this.maxBodyBytes,
|
|
96611
|
+
err: err instanceof Error ? err.message : String(err)
|
|
96612
|
+
});
|
|
96613
|
+
}
|
|
96461
96614
|
res.writeHead(413, { "content-type": "application/json" });
|
|
96462
96615
|
res.end(JSON.stringify({ error: "payload_too_large" }));
|
|
96463
96616
|
return;
|
|
@@ -96468,28 +96621,37 @@ var WebhookServer = class {
|
|
|
96468
96621
|
body
|
|
96469
96622
|
});
|
|
96470
96623
|
if (!verdict.ok) {
|
|
96471
|
-
this.opts.logger
|
|
96472
|
-
|
|
96473
|
-
|
|
96474
|
-
|
|
96624
|
+
const logger = this.opts.logger;
|
|
96625
|
+
if (logger?.warn) {
|
|
96626
|
+
logger.warn("webhooks: rejected delivery", {
|
|
96627
|
+
trigger: trigger.name,
|
|
96628
|
+
reason: verdict.reason
|
|
96629
|
+
});
|
|
96630
|
+
}
|
|
96475
96631
|
res.writeHead(401, { "content-type": "application/json" });
|
|
96476
96632
|
res.end(JSON.stringify({ error: "verification_failed" }));
|
|
96477
96633
|
return;
|
|
96478
96634
|
}
|
|
96479
96635
|
const idempKey = idempotencyKey(trigger, req.headers);
|
|
96480
96636
|
if (idempKey && !this.dedupe.check(trigger.id, idempKey)) {
|
|
96481
|
-
this.opts.logger
|
|
96482
|
-
|
|
96483
|
-
|
|
96484
|
-
|
|
96637
|
+
const logger = this.opts.logger;
|
|
96638
|
+
if (logger?.info) {
|
|
96639
|
+
logger.info("webhooks: duplicate delivery, dropped", {
|
|
96640
|
+
trigger: trigger.name,
|
|
96641
|
+
key: idempKey
|
|
96642
|
+
});
|
|
96643
|
+
}
|
|
96485
96644
|
res.writeHead(200, { "content-type": "application/json" });
|
|
96486
96645
|
res.end(JSON.stringify({ status: "duplicate" }));
|
|
96487
96646
|
return;
|
|
96488
96647
|
}
|
|
96489
96648
|
if (!shouldFire(trigger.filters, { headers: req.headers, body })) {
|
|
96490
|
-
this.opts.logger
|
|
96491
|
-
|
|
96492
|
-
|
|
96649
|
+
const logger = this.opts.logger;
|
|
96650
|
+
if (logger?.info) {
|
|
96651
|
+
logger.info("webhooks: filtered out, not firing", {
|
|
96652
|
+
trigger: trigger.name
|
|
96653
|
+
});
|
|
96654
|
+
}
|
|
96493
96655
|
res.writeHead(200, { "content-type": "application/json" });
|
|
96494
96656
|
res.end(JSON.stringify({ status: "filtered" }));
|
|
96495
96657
|
return;
|
|
@@ -96505,10 +96667,13 @@ var WebhookServer = class {
|
|
|
96505
96667
|
firedAt: /* @__PURE__ */ new Date()
|
|
96506
96668
|
});
|
|
96507
96669
|
void this.opts.dispatcher.route(trigger, prompt, idempKey).catch((err) => {
|
|
96508
|
-
this.opts.logger
|
|
96509
|
-
|
|
96510
|
-
|
|
96511
|
-
|
|
96670
|
+
const logger = this.opts.logger;
|
|
96671
|
+
if (logger?.warn) {
|
|
96672
|
+
logger.warn("webhooks: route failed", {
|
|
96673
|
+
trigger: trigger.name,
|
|
96674
|
+
err: err instanceof Error ? err.message : String(err)
|
|
96675
|
+
});
|
|
96676
|
+
}
|
|
96512
96677
|
});
|
|
96513
96678
|
}
|
|
96514
96679
|
};
|
|
@@ -96706,6 +96871,7 @@ var WebhookStore = class {
|
|
|
96706
96871
|
if (idx < 0)
|
|
96707
96872
|
return triggers;
|
|
96708
96873
|
const current = triggers[idx];
|
|
96874
|
+
assertDefined(current, "trigger at findIndex result");
|
|
96709
96875
|
const next = webhookTriggerSchema.parse({
|
|
96710
96876
|
...current,
|
|
96711
96877
|
lastFiredAt: Date.now(),
|
|
@@ -96769,11 +96935,14 @@ var WebhookStore = class {
|
|
|
96769
96935
|
const preserved = `${this.file}.corrupt-${timestampSlug()}`;
|
|
96770
96936
|
await rename(this.file, preserved);
|
|
96771
96937
|
this.loadWarningMsg = `the webhook trigger store (${this.file}) ${reason}; the original file was preserved at ${preserved} and the store restarted empty. Previously configured triggers (and their secrets) are recoverable from that file \u2014 repair it by hand or recreate the triggers.`;
|
|
96772
|
-
this.logger
|
|
96773
|
-
|
|
96774
|
-
preserved,
|
|
96775
|
-
|
|
96776
|
-
|
|
96938
|
+
const logger = this.logger;
|
|
96939
|
+
if (logger?.error) {
|
|
96940
|
+
logger.error("webhooks: store file corrupt \u2014 preserved aside, starting empty", {
|
|
96941
|
+
file: this.file,
|
|
96942
|
+
preserved,
|
|
96943
|
+
reason
|
|
96944
|
+
});
|
|
96945
|
+
}
|
|
96777
96946
|
return [];
|
|
96778
96947
|
}
|
|
96779
96948
|
/**
|
|
@@ -96790,12 +96959,15 @@ var WebhookStore = class {
|
|
|
96790
96959
|
}, null, 2);
|
|
96791
96960
|
await writeFileAtomic(quarantine, payload, { mode: 384 });
|
|
96792
96961
|
this.loadWarningMsg = `${invalid.length} trigger entr${invalid.length === 1 ? "y" : "ies"} in ${this.file} failed schema validation and ${invalid.length === 1 ? "was" : "were"} quarantined to ${quarantine} (valid triggers were kept). Inspect that file to repair or recreate them.`;
|
|
96793
|
-
this.logger
|
|
96794
|
-
|
|
96795
|
-
|
|
96796
|
-
|
|
96797
|
-
|
|
96798
|
-
|
|
96962
|
+
const logger = this.logger;
|
|
96963
|
+
if (logger?.error) {
|
|
96964
|
+
logger.error("webhooks: invalid trigger entries quarantined", {
|
|
96965
|
+
file: this.file,
|
|
96966
|
+
quarantine,
|
|
96967
|
+
count: invalid.length,
|
|
96968
|
+
issues: invalid.map((i2) => ({ index: i2.index, issues: i2.issues }))
|
|
96969
|
+
});
|
|
96970
|
+
}
|
|
96799
96971
|
}
|
|
96800
96972
|
};
|
|
96801
96973
|
function timestampSlug() {
|
|
@@ -101223,14 +101395,17 @@ function buildWebhooksPlugin(opts) {
|
|
|
101223
101395
|
openAuth = (await store.list()).filter((t2) => t2.enabled && t2.verification.type === "none");
|
|
101224
101396
|
} catch {
|
|
101225
101397
|
}
|
|
101226
|
-
opts.logger
|
|
101227
|
-
|
|
101228
|
-
|
|
101229
|
-
|
|
101230
|
-
|
|
101231
|
-
|
|
101232
|
-
|
|
101233
|
-
|
|
101398
|
+
const logger = opts.logger;
|
|
101399
|
+
if (logger?.warn) {
|
|
101400
|
+
logger.warn("webhooks: binding a NON-LOOPBACK host \u2014 the unauthenticated POST surface is reachable from other machines on the network", {
|
|
101401
|
+
host,
|
|
101402
|
+
port,
|
|
101403
|
+
...openAuth.length > 0 ? {
|
|
101404
|
+
unauthenticatedTriggers: openAuth.map((t2) => t2.name),
|
|
101405
|
+
severity: "critical: any host on the network can fire these triggers"
|
|
101406
|
+
} : {}
|
|
101407
|
+
});
|
|
101408
|
+
}
|
|
101234
101409
|
}
|
|
101235
101410
|
serverInstance = new WebhookServer({
|
|
101236
101411
|
host,
|
|
@@ -101244,21 +101419,31 @@ function buildWebhooksPlugin(opts) {
|
|
|
101244
101419
|
try {
|
|
101245
101420
|
serverHandle = await serverInstance.start();
|
|
101246
101421
|
} catch (err) {
|
|
101247
|
-
opts.logger
|
|
101248
|
-
|
|
101249
|
-
|
|
101250
|
-
|
|
101251
|
-
|
|
101422
|
+
const logger = opts.logger;
|
|
101423
|
+
if (logger?.warn) {
|
|
101424
|
+
logger.warn("webhooks: listener failed to start", {
|
|
101425
|
+
err: err instanceof Error ? err.message : String(err),
|
|
101426
|
+
host,
|
|
101427
|
+
port
|
|
101428
|
+
});
|
|
101429
|
+
}
|
|
101252
101430
|
serverInstance = null;
|
|
101253
101431
|
}
|
|
101254
101432
|
drain?.start();
|
|
101255
101433
|
if (serverHandle && opts.restoreTunnelOnBoot !== false && !tunnelHandle.current && cfg.publicUrl && cfg.publicUrlSource === "proxy") {
|
|
101256
101434
|
void startTunnel({ host, port }).then((t2) => {
|
|
101257
101435
|
tunnelHandle.current = t2;
|
|
101258
|
-
|
|
101259
|
-
|
|
101260
|
-
|
|
101261
|
-
}))
|
|
101436
|
+
const logger = opts.logger;
|
|
101437
|
+
if (logger?.info)
|
|
101438
|
+
logger.info("webhooks: proxy tunnel restored on boot", { url: t2.url });
|
|
101439
|
+
}).catch((err) => {
|
|
101440
|
+
const logger = opts.logger;
|
|
101441
|
+
if (logger?.warn) {
|
|
101442
|
+
logger.warn("webhooks: proxy tunnel restore failed", {
|
|
101443
|
+
err: err instanceof Error ? err.message : String(err)
|
|
101444
|
+
});
|
|
101445
|
+
}
|
|
101446
|
+
});
|
|
101262
101447
|
}
|
|
101263
101448
|
},
|
|
101264
101449
|
onShutdown: () => stopAll()
|
|
@@ -104535,6 +104720,7 @@ function parseJwtClaims(jwt) {
|
|
|
104535
104720
|
if (parts.length !== 3)
|
|
104536
104721
|
return void 0;
|
|
104537
104722
|
const payload = parts[1];
|
|
104723
|
+
assertDefined(payload, "parts.length === 3 checked above");
|
|
104538
104724
|
if (payload.length > MAX_JWT_SEGMENT_CHARS)
|
|
104539
104725
|
return void 0;
|
|
104540
104726
|
try {
|
|
@@ -104847,8 +105033,10 @@ function handleSseEvent(ev, pending, emitReasoning = false) {
|
|
|
104847
105033
|
if (type === "response.completed") {
|
|
104848
105034
|
const usage = ev.response?.usage;
|
|
104849
105035
|
const input = usage?.input_tokens ?? 0;
|
|
104850
|
-
const
|
|
104851
|
-
const
|
|
105036
|
+
const inputTokenDetails = usage?.input_tokens_details;
|
|
105037
|
+
const cacheRead = inputTokenDetails?.cached_tokens ?? 0;
|
|
105038
|
+
const incompleteDetails = ev.response?.incomplete_details;
|
|
105039
|
+
const incomplete = incompleteDetails?.reason;
|
|
104852
105040
|
let stopReason = "end_turn";
|
|
104853
105041
|
if (incomplete === "max_output_tokens")
|
|
104854
105042
|
stopReason = "max_tokens";
|
|
@@ -110208,7 +110396,9 @@ function toAnthropicTools(tools, opts = {}) {
|
|
|
110208
110396
|
input_schema: t2.inputJsonSchema ?? zodToJsonSchema(t2.inputSchema)
|
|
110209
110397
|
}));
|
|
110210
110398
|
if (opts.cacheLast && out.length > 0) {
|
|
110211
|
-
out[out.length - 1]
|
|
110399
|
+
const last = out[out.length - 1];
|
|
110400
|
+
assertDefined(last, "out is non-empty (length > 0 checked above)");
|
|
110401
|
+
last.cache_control = { type: "ephemeral" };
|
|
110212
110402
|
}
|
|
110213
110403
|
return out;
|
|
110214
110404
|
}
|
|
@@ -110540,7 +110730,9 @@ var AnthropicProvider = class {
|
|
|
110540
110730
|
const s2 = stream;
|
|
110541
110731
|
try {
|
|
110542
110732
|
s2.abort?.();
|
|
110543
|
-
s2.controller
|
|
110733
|
+
const controller = s2.controller;
|
|
110734
|
+
if (controller)
|
|
110735
|
+
controller.abort?.();
|
|
110544
110736
|
} catch {
|
|
110545
110737
|
}
|
|
110546
110738
|
}
|
|
@@ -114710,8 +114902,6 @@ var collabCommands = [
|
|
|
114710
114902
|
collabPauseCommand,
|
|
114711
114903
|
collabResumeCommand
|
|
114712
114904
|
];
|
|
114713
|
-
|
|
114714
|
-
// ../plugin-collab/dist/state.js
|
|
114715
114905
|
var MAX_MESSAGES = 5e3;
|
|
114716
114906
|
var MAX_MESSAGES_HARD = MAX_MESSAGES * 4;
|
|
114717
114907
|
function normPath(p3) {
|
|
@@ -114818,7 +115008,11 @@ var CollaborationState = class {
|
|
|
114818
115008
|
this.emitFn({ kind: "agent_done", agentId, summary, ...artifacts ? { artifacts } : {} });
|
|
114819
115009
|
}
|
|
114820
115010
|
allDone() {
|
|
114821
|
-
const live = this.agentOrder.map((id) =>
|
|
115011
|
+
const live = this.agentOrder.map((id) => {
|
|
115012
|
+
const agent = this.agents.get(id);
|
|
115013
|
+
assertDefined(agent, "agentOrder only ever holds live agent ids");
|
|
115014
|
+
return agent;
|
|
115015
|
+
}).filter((a2) => a2.status !== "crashed" && a2.status !== "killed" && a2.status !== "failed");
|
|
114822
115016
|
return live.length > 0 && live.every((a2) => a2.status === "done");
|
|
114823
115017
|
}
|
|
114824
115018
|
roleOf(agentId) {
|
|
@@ -114832,7 +115026,11 @@ var CollaborationState = class {
|
|
|
114832
115026
|
return {
|
|
114833
115027
|
self,
|
|
114834
115028
|
task: this.task,
|
|
114835
|
-
agents: this.agentOrder.map((id) =>
|
|
115029
|
+
agents: this.agentOrder.map((id) => {
|
|
115030
|
+
const agent = this.agents.get(id);
|
|
115031
|
+
assertDefined(agent, "agentOrder only ever holds live agent ids");
|
|
115032
|
+
return { ...agent };
|
|
115033
|
+
}),
|
|
114836
115034
|
control: { ...this.control }
|
|
114837
115035
|
};
|
|
114838
115036
|
}
|
|
@@ -114852,7 +115050,14 @@ var CollaborationState = class {
|
|
|
114852
115050
|
return { ...this.control };
|
|
114853
115051
|
}
|
|
114854
115052
|
doneSummaries() {
|
|
114855
|
-
return this.agentOrder.map((id) =>
|
|
115053
|
+
return this.agentOrder.map((id) => {
|
|
115054
|
+
const agent = this.agents.get(id);
|
|
115055
|
+
assertDefined(agent, "agentOrder only ever holds live agent ids");
|
|
115056
|
+
return agent;
|
|
115057
|
+
}).filter((a2) => a2.status === "done" && a2.doneSummary).map((a2) => {
|
|
115058
|
+
assertDefined(a2.doneSummary, "filtered to agents whose doneSummary is set");
|
|
115059
|
+
return { agentId: a2.id, summary: a2.doneSummary };
|
|
115060
|
+
});
|
|
114856
115061
|
}
|
|
114857
115062
|
// --- messaging ------------------------------------------------------------
|
|
114858
115063
|
post(from, to, body, subject) {
|
|
@@ -114925,7 +115130,11 @@ var CollaborationState = class {
|
|
|
114925
115130
|
}
|
|
114926
115131
|
// --- task board + file locks ----------------------------------------------
|
|
114927
115132
|
boardItems() {
|
|
114928
|
-
return this.boardOrder.map((id) =>
|
|
115133
|
+
return this.boardOrder.map((id) => {
|
|
115134
|
+
const item = this.board.get(id);
|
|
115135
|
+
assertDefined(item, "boardOrder only ever holds live board ids");
|
|
115136
|
+
return { ...item };
|
|
115137
|
+
});
|
|
114929
115138
|
}
|
|
114930
115139
|
boardAdd(by, title, detail, paths) {
|
|
114931
115140
|
const item = {
|
|
@@ -114960,6 +115169,7 @@ var CollaborationState = class {
|
|
|
114960
115169
|
conflictingOwner(claimant, paths) {
|
|
114961
115170
|
for (const id of this.boardOrder) {
|
|
114962
115171
|
const item = this.board.get(id);
|
|
115172
|
+
assertDefined(item, "boardOrder only ever holds live board ids");
|
|
114963
115173
|
if (!item.owner || item.owner === claimant || !item.paths)
|
|
114964
115174
|
continue;
|
|
114965
115175
|
if (item.status === "done")
|
|
@@ -115009,7 +115219,16 @@ var CollaborationState = class {
|
|
|
115009
115219
|
return { ok: true, item: { ...item } };
|
|
115010
115220
|
}
|
|
115011
115221
|
boardRelease(by, opts) {
|
|
115012
|
-
const targets = opts.id ? [this.board.get(opts.id)].filter((it4) => it4 !== void 0 && it4.owner === by) : this.boardOrder.map((id) =>
|
|
115222
|
+
const targets = opts.id ? [this.board.get(opts.id)].filter((it4) => it4 !== void 0 && it4.owner === by) : this.boardOrder.map((id) => {
|
|
115223
|
+
const item = this.board.get(id);
|
|
115224
|
+
assertDefined(item, "boardOrder only ever holds live board ids");
|
|
115225
|
+
return item;
|
|
115226
|
+
}).filter((it4) => {
|
|
115227
|
+
if (it4.owner !== by || !it4.paths)
|
|
115228
|
+
return false;
|
|
115229
|
+
const itPaths = it4.paths;
|
|
115230
|
+
return opts.paths?.some((p3) => itPaths.some((q4) => pathsConflict(p3, q4))) ?? false;
|
|
115231
|
+
});
|
|
115013
115232
|
for (const item of targets) {
|
|
115014
115233
|
delete item.owner;
|
|
115015
115234
|
item.updatedBy = by;
|
|
@@ -115024,6 +115243,7 @@ var CollaborationState = class {
|
|
|
115024
115243
|
releaseAllFor(agentId) {
|
|
115025
115244
|
for (const id of this.boardOrder) {
|
|
115026
115245
|
const item = this.board.get(id);
|
|
115246
|
+
assertDefined(item, "boardOrder only ever holds live board ids");
|
|
115027
115247
|
if (item.owner !== agentId)
|
|
115028
115248
|
continue;
|
|
115029
115249
|
delete item.owner;
|
|
@@ -115034,7 +115254,11 @@ var CollaborationState = class {
|
|
|
115034
115254
|
}
|
|
115035
115255
|
// --- contracts ------------------------------------------------------------
|
|
115036
115256
|
contractList() {
|
|
115037
|
-
return this.contractOrder.map((id) =>
|
|
115257
|
+
return this.contractOrder.map((id) => {
|
|
115258
|
+
const entry = this.contracts.get(id);
|
|
115259
|
+
assertDefined(entry, "contractOrder only ever holds live contract ids");
|
|
115260
|
+
return { ...entry };
|
|
115261
|
+
});
|
|
115038
115262
|
}
|
|
115039
115263
|
contractPublish(by, spec) {
|
|
115040
115264
|
const entry = {
|
|
@@ -115070,7 +115294,9 @@ var CollaborationState = class {
|
|
|
115070
115294
|
entry.pendingChange = { ...entry.pendingChange, acks: [...entry.pendingChange.acks, by] };
|
|
115071
115295
|
}
|
|
115072
115296
|
const required = /* @__PURE__ */ new Set([entry.owner, ...entry.consumers]);
|
|
115073
|
-
const
|
|
115297
|
+
const pending = entry.pendingChange;
|
|
115298
|
+
assertDefined(pending, "pendingChange is guarded non-null at entry and only reassigned to a fresh object");
|
|
115299
|
+
const agreed = [...required].every((a2) => pending.acks.includes(a2));
|
|
115074
115300
|
return { entry: { ...entry }, agreed };
|
|
115075
115301
|
}
|
|
115076
115302
|
/**
|
|
@@ -115092,8 +115318,9 @@ var CollaborationState = class {
|
|
|
115092
115318
|
if (!authorized)
|
|
115093
115319
|
return null;
|
|
115094
115320
|
if (entry.pendingChange) {
|
|
115321
|
+
const pending = entry.pendingChange;
|
|
115095
115322
|
const required = /* @__PURE__ */ new Set([entry.owner, ...entry.consumers]);
|
|
115096
|
-
const agreed = [...required].every((a2) =>
|
|
115323
|
+
const agreed = [...required].every((a2) => pending.acks.includes(a2));
|
|
115097
115324
|
if (!agreed)
|
|
115098
115325
|
return null;
|
|
115099
115326
|
}
|
|
@@ -117613,6 +117840,7 @@ var ipcInputSchemas = {
|
|
|
117613
117840
|
let total = 0;
|
|
117614
117841
|
for (let i2 = 0; i2 < entries.length; i2++) {
|
|
117615
117842
|
const e3 = entries[i2];
|
|
117843
|
+
assertDefined(e3, "entry index is within the bounds of entries");
|
|
117616
117844
|
if (BASE64_ATTACHMENT_KINDS.has(e3.kind) && !BASE64_RE.test(e3.content)) {
|
|
117617
117845
|
ctx.addIssue({
|
|
117618
117846
|
code: z.ZodIssueCode.custom,
|
|
@@ -118942,7 +119170,9 @@ async function startE2EShim(opts) {
|
|
|
118942
119170
|
const wss = new import_websocket_server.default({ server: http2 });
|
|
118943
119171
|
wss.on("connection", (phone) => {
|
|
118944
119172
|
void handlePhone(phone, opts, bridgeHost).catch((err) => {
|
|
118945
|
-
opts.logger
|
|
119173
|
+
const logger2 = opts.logger;
|
|
119174
|
+
if (logger2?.warn)
|
|
119175
|
+
logger2.warn("e2e shim: connection failed", { err: String(err) });
|
|
118946
119176
|
try {
|
|
118947
119177
|
phone.close();
|
|
118948
119178
|
} catch {
|
|
@@ -118951,7 +119181,9 @@ async function startE2EShim(opts) {
|
|
|
118951
119181
|
});
|
|
118952
119182
|
await new Promise((resolve18) => http2.listen(0, "127.0.0.1", resolve18));
|
|
118953
119183
|
const port = http2.address().port;
|
|
118954
|
-
opts.logger
|
|
119184
|
+
const logger = opts.logger;
|
|
119185
|
+
if (logger?.info)
|
|
119186
|
+
logger.info("e2e shim listening", { port });
|
|
118955
119187
|
return {
|
|
118956
119188
|
port,
|
|
118957
119189
|
close: () => new Promise((resolve18) => {
|
|
@@ -118984,7 +119216,9 @@ async function handlePhone(phone, opts, bridgeHost) {
|
|
|
118984
119216
|
if (!authed) {
|
|
118985
119217
|
authed = true;
|
|
118986
119218
|
if (!bearerTokenMatches(text, opts.token)) {
|
|
118987
|
-
opts.logger
|
|
119219
|
+
const logger = opts.logger;
|
|
119220
|
+
if (logger?.warn)
|
|
119221
|
+
logger.warn("e2e shim: bad token, closing");
|
|
118988
119222
|
teardown();
|
|
118989
119223
|
return;
|
|
118990
119224
|
}
|
|
@@ -119216,7 +119450,9 @@ var MobileChannel = class {
|
|
|
119216
119450
|
*/
|
|
119217
119451
|
rotateToken() {
|
|
119218
119452
|
if (this.tokenPinned) {
|
|
119219
|
-
this.logger
|
|
119453
|
+
const logger = this.logger;
|
|
119454
|
+
if (logger?.warn)
|
|
119455
|
+
logger.warn("mobile token is pinned via MOXXY_MOBILE_TOKEN / config \u2014 rotate it at the source; the persisted secret is not used");
|
|
119220
119456
|
return this.token;
|
|
119221
119457
|
}
|
|
119222
119458
|
this.token = rotateMobileToken();
|
|
@@ -119226,7 +119462,11 @@ var MobileChannel = class {
|
|
|
119226
119462
|
async start(startOpts) {
|
|
119227
119463
|
const bus = new WebSocketCommandBus({ allowedCommands: null });
|
|
119228
119464
|
const host = new MobileSessionHost(bus, startOpts.session, {
|
|
119229
|
-
logErr: (err) =>
|
|
119465
|
+
logErr: (err) => {
|
|
119466
|
+
const logger = this.logger;
|
|
119467
|
+
if (logger?.warn)
|
|
119468
|
+
logger.warn("mobile host background error", { err: String(err) });
|
|
119469
|
+
}
|
|
119230
119470
|
});
|
|
119231
119471
|
this.host = host;
|
|
119232
119472
|
host.register();
|
|
@@ -119253,7 +119493,9 @@ var MobileChannel = class {
|
|
|
119253
119493
|
allowQueryToken: this.allowQueryToken
|
|
119254
119494
|
});
|
|
119255
119495
|
this.server = server;
|
|
119256
|
-
|
|
119496
|
+
const logger = this.logger;
|
|
119497
|
+
if (logger?.info)
|
|
119498
|
+
logger.info("mobile channel listening", { address: server.address });
|
|
119257
119499
|
let sawClient = false;
|
|
119258
119500
|
server.onConnection(() => {
|
|
119259
119501
|
sawClient = true;
|
|
@@ -119300,12 +119542,16 @@ var MobileChannel = class {
|
|
|
119300
119542
|
});
|
|
119301
119543
|
tunnelUrl = this.tunnel.url;
|
|
119302
119544
|
server.setAllowedOrigins([...localOrigins, connectUrlOrigin(tunnelUrl)]);
|
|
119303
|
-
|
|
119545
|
+
const logger2 = this.logger;
|
|
119546
|
+
if (logger2?.info)
|
|
119547
|
+
logger2.info("mobile tunnel open", { provider: provider.name, url: tunnelUrl });
|
|
119304
119548
|
} catch (err) {
|
|
119305
|
-
this.logger
|
|
119306
|
-
|
|
119307
|
-
|
|
119308
|
-
|
|
119549
|
+
const logger2 = this.logger;
|
|
119550
|
+
if (logger2?.warn)
|
|
119551
|
+
logger2.warn("mobile tunnel failed; using the local URL", {
|
|
119552
|
+
provider: provider.name,
|
|
119553
|
+
err: String(err)
|
|
119554
|
+
});
|
|
119309
119555
|
if (this.shim) {
|
|
119310
119556
|
await this.shim.close().catch(() => void 0);
|
|
119311
119557
|
this.shim = null;
|
|
@@ -119743,8 +119989,6 @@ init_dist();
|
|
|
119743
119989
|
|
|
119744
119990
|
// ../plugin-workflows/dist/schema.js
|
|
119745
119991
|
var import_yaml2 = __toESM(require_dist());
|
|
119746
|
-
|
|
119747
|
-
// ../plugin-workflows/dist/template.js
|
|
119748
119992
|
var REF_RE = /\{\{\s*([^}]+?)\s*\}\}/g;
|
|
119749
119993
|
function stringifyValue2(value) {
|
|
119750
119994
|
if (value == null)
|
|
@@ -119780,7 +120024,9 @@ function renderTemplate(text, scope, opts = {}) {
|
|
|
119780
120024
|
return text.replace(REF_RE, (_match, ref) => {
|
|
119781
120025
|
const value = resolveRef(ref.trim(), scope);
|
|
119782
120026
|
if (value === void 0) {
|
|
119783
|
-
|
|
120027
|
+
const logger = opts.logger;
|
|
120028
|
+
if (logger?.warn)
|
|
120029
|
+
logger.warn("workflow template: unresolved reference", { ref: ref.trim() });
|
|
119784
120030
|
return "";
|
|
119785
120031
|
}
|
|
119786
120032
|
return stringifyValue2(value);
|
|
@@ -119801,11 +120047,52 @@ function renderArgs(args, scope, opts = {}) {
|
|
|
119801
120047
|
return args;
|
|
119802
120048
|
}
|
|
119803
120049
|
var ATOM_PATTERNS = [
|
|
119804
|
-
{
|
|
119805
|
-
|
|
119806
|
-
|
|
119807
|
-
|
|
119808
|
-
|
|
120050
|
+
{
|
|
120051
|
+
re: /^(.+?)\s+is\s+not\s+empty$/i,
|
|
120052
|
+
build: (m3) => {
|
|
120053
|
+
const lhs = m3[1];
|
|
120054
|
+
assertDefined(lhs, "condition atom regex guarantees capture group 1");
|
|
120055
|
+
return { kind: "notEmpty", lhs: lhs.trim() };
|
|
120056
|
+
}
|
|
120057
|
+
},
|
|
120058
|
+
{
|
|
120059
|
+
re: /^(.+?)\s+is\s+empty$/i,
|
|
120060
|
+
build: (m3) => {
|
|
120061
|
+
const lhs = m3[1];
|
|
120062
|
+
assertDefined(lhs, "condition atom regex guarantees capture group 1");
|
|
120063
|
+
return { kind: "empty", lhs: lhs.trim() };
|
|
120064
|
+
}
|
|
120065
|
+
},
|
|
120066
|
+
{
|
|
120067
|
+
re: /^(.+?)\s+contains\s+"(.*)"$/i,
|
|
120068
|
+
build: (m3) => {
|
|
120069
|
+
const lhs = m3[1];
|
|
120070
|
+
const literal3 = m3[2];
|
|
120071
|
+
assertDefined(lhs, "condition atom regex guarantees capture group 1");
|
|
120072
|
+
assertDefined(literal3, "condition atom regex guarantees capture group 2");
|
|
120073
|
+
return { kind: "contains", lhs: lhs.trim(), literal: literal3 };
|
|
120074
|
+
}
|
|
120075
|
+
},
|
|
120076
|
+
{
|
|
120077
|
+
re: /^(.+?)\s+==\s+"(.*)"$/,
|
|
120078
|
+
build: (m3) => {
|
|
120079
|
+
const lhs = m3[1];
|
|
120080
|
+
const literal3 = m3[2];
|
|
120081
|
+
assertDefined(lhs, "condition atom regex guarantees capture group 1");
|
|
120082
|
+
assertDefined(literal3, "condition atom regex guarantees capture group 2");
|
|
120083
|
+
return { kind: "eq", lhs: lhs.trim(), literal: literal3 };
|
|
120084
|
+
}
|
|
120085
|
+
},
|
|
120086
|
+
{
|
|
120087
|
+
re: /^(.+?)\s+!=\s+"(.*)"$/,
|
|
120088
|
+
build: (m3) => {
|
|
120089
|
+
const lhs = m3[1];
|
|
120090
|
+
const literal3 = m3[2];
|
|
120091
|
+
assertDefined(lhs, "condition atom regex guarantees capture group 1");
|
|
120092
|
+
assertDefined(literal3, "condition atom regex guarantees capture group 2");
|
|
120093
|
+
return { kind: "neq", lhs: lhs.trim(), literal: literal3 };
|
|
120094
|
+
}
|
|
120095
|
+
}
|
|
119809
120096
|
];
|
|
119810
120097
|
function splitTop(expr, connective) {
|
|
119811
120098
|
const parts = [];
|
|
@@ -120007,10 +120294,12 @@ var stepSchema = z.object({
|
|
|
120007
120294
|
path: ["skill"]
|
|
120008
120295
|
});
|
|
120009
120296
|
} else if (present2.length > 1) {
|
|
120297
|
+
const second = present2[1];
|
|
120298
|
+
assertDefined(second, "present.length > 1 guarantees index 1 exists");
|
|
120010
120299
|
ctx.addIssue({
|
|
120011
120300
|
code: z.ZodIssueCode.custom,
|
|
120012
120301
|
message: `step "${step.id}" has multiple actions (${present2.join(", ")}); pick one`,
|
|
120013
|
-
path: [
|
|
120302
|
+
path: [second]
|
|
120014
120303
|
});
|
|
120015
120304
|
}
|
|
120016
120305
|
});
|
|
@@ -120156,6 +120445,7 @@ var workflowSchema = z.object({
|
|
|
120156
120445
|
if (owner == null)
|
|
120157
120446
|
continue;
|
|
120158
120447
|
const body = stepById.get(step.id);
|
|
120448
|
+
assertDefined(body, "stepById is built from wf.steps, so every step.id is a key");
|
|
120159
120449
|
if (body.condition != null || body.switch != null) {
|
|
120160
120450
|
ctx.addIssue({
|
|
120161
120451
|
code: z.ZodIssueCode.custom,
|
|
@@ -120354,11 +120644,12 @@ async function loadDir2(dir, scope, logger) {
|
|
|
120354
120644
|
try {
|
|
120355
120645
|
const st4 = await promises.stat(full);
|
|
120356
120646
|
if (st4.size > MAX_WORKFLOW_FILE_BYTES) {
|
|
120357
|
-
logger?.warn
|
|
120358
|
-
|
|
120359
|
-
|
|
120360
|
-
|
|
120361
|
-
|
|
120647
|
+
if (logger?.warn)
|
|
120648
|
+
logger.warn("workflow: file too large, skipping", {
|
|
120649
|
+
path: full,
|
|
120650
|
+
size: st4.size,
|
|
120651
|
+
max: MAX_WORKFLOW_FILE_BYTES
|
|
120652
|
+
});
|
|
120362
120653
|
continue;
|
|
120363
120654
|
}
|
|
120364
120655
|
} catch {
|
|
@@ -120367,15 +120658,17 @@ async function loadDir2(dir, scope, logger) {
|
|
|
120367
120658
|
try {
|
|
120368
120659
|
raw = await promises.readFile(full, "utf8");
|
|
120369
120660
|
} catch (err) {
|
|
120370
|
-
logger?.warn
|
|
120371
|
-
|
|
120372
|
-
|
|
120373
|
-
|
|
120661
|
+
if (logger?.warn)
|
|
120662
|
+
logger.warn("workflow: unreadable file, skipping", {
|
|
120663
|
+
path: full,
|
|
120664
|
+
error: err instanceof Error ? err.message : String(err)
|
|
120665
|
+
});
|
|
120374
120666
|
continue;
|
|
120375
120667
|
}
|
|
120376
120668
|
const result = parseWorkflowYaml(raw);
|
|
120377
120669
|
if (!result.ok || !result.workflow) {
|
|
120378
|
-
logger?.warn
|
|
120670
|
+
if (logger?.warn)
|
|
120671
|
+
logger.warn("workflow: invalid file, skipping", { path: full, errors: result.errors });
|
|
120379
120672
|
continue;
|
|
120380
120673
|
}
|
|
120381
120674
|
out.push({ workflow: result.workflow, path: full, scope });
|
|
@@ -120498,6 +120791,7 @@ var WorkflowStore = class {
|
|
|
120498
120791
|
const renamed = previousName != null && previousName !== workflow.name ? this.byName.get(previousName) : void 0;
|
|
120499
120792
|
if (renamed && (renamed.scope === "user" || renamed.scope === "project")) {
|
|
120500
120793
|
await promises.rm(renamed.path, { force: true });
|
|
120794
|
+
assertDefined(previousName, "renamed is only set when previousName != null");
|
|
120501
120795
|
this.byName.delete(previousName);
|
|
120502
120796
|
}
|
|
120503
120797
|
const existing = this.byName.get(workflow.name);
|
|
@@ -120647,8 +120941,6 @@ var WorkflowRunStore = class {
|
|
|
120647
120941
|
};
|
|
120648
120942
|
var DEFAULT_CHECKPOINT_TTL_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
120649
120943
|
var defaultWorkflowRunStore = new WorkflowRunStore();
|
|
120650
|
-
|
|
120651
|
-
// ../plugin-workflows/dist/logic-response.js
|
|
120652
120944
|
var PLAIN_PROMPT_MARKERS = [
|
|
120653
120945
|
"odpowiedz wy\u0142\u0105cznie zwyk\u0142ym tekstem",
|
|
120654
120946
|
"odpowiedz tylko zwyk\u0142ym tekstem",
|
|
@@ -120671,7 +120963,11 @@ function wantsPlainResponse(step) {
|
|
|
120671
120963
|
function stripJsonFence(raw) {
|
|
120672
120964
|
const trimmed = raw.trim();
|
|
120673
120965
|
const fence = /^```(?:json)?\s*([\s\S]*?)```$/i.exec(trimmed);
|
|
120674
|
-
|
|
120966
|
+
if (!fence)
|
|
120967
|
+
return trimmed;
|
|
120968
|
+
const body = fence[1];
|
|
120969
|
+
assertDefined(body, "a successful match guarantees capture group 1");
|
|
120970
|
+
return body.trim();
|
|
120675
120971
|
}
|
|
120676
120972
|
function parseJsonObject(raw) {
|
|
120677
120973
|
const parsed = JSON.parse(stripJsonFence(raw));
|
|
@@ -120782,7 +121078,9 @@ function mergeVars(ctx, vars) {
|
|
|
120782
121078
|
return;
|
|
120783
121079
|
for (const [key, value] of Object.entries(vars)) {
|
|
120784
121080
|
if (UNSAFE_VAR_KEYS.has(key)) {
|
|
120785
|
-
ctx.deps.logger
|
|
121081
|
+
const logger = ctx.deps.logger;
|
|
121082
|
+
if (logger?.warn)
|
|
121083
|
+
logger.warn("workflow vars: dropping prototype-pollution key", { key });
|
|
120786
121084
|
continue;
|
|
120787
121085
|
}
|
|
120788
121086
|
Object.defineProperty(ctx.vars, key, {
|
|
@@ -120844,6 +121142,7 @@ function restoreStates(raw) {
|
|
|
120844
121142
|
function buildStepResults(workflow, states) {
|
|
120845
121143
|
return workflow.steps.map((step) => {
|
|
120846
121144
|
const st4 = states.get(step.id);
|
|
121145
|
+
assertDefined(st4, "states has an entry for every workflow step");
|
|
120847
121146
|
const status = st4.status === "pending" ? "skipped" : st4.status;
|
|
120848
121147
|
return {
|
|
120849
121148
|
id: step.id,
|
|
@@ -120875,11 +121174,13 @@ async function runStep(step, scope, ctx) {
|
|
|
120875
121174
|
return await runStepOnce(step, scope, ctx);
|
|
120876
121175
|
} catch (err) {
|
|
120877
121176
|
lastError = err instanceof Error ? err.message : String(err);
|
|
120878
|
-
ctx.deps.logger
|
|
120879
|
-
|
|
120880
|
-
|
|
120881
|
-
|
|
120882
|
-
|
|
121177
|
+
const logger = ctx.deps.logger;
|
|
121178
|
+
if (logger?.warn)
|
|
121179
|
+
logger.warn("workflow step attempt failed", {
|
|
121180
|
+
step: step.id,
|
|
121181
|
+
attempt: attempt + 1,
|
|
121182
|
+
error: lastError
|
|
121183
|
+
});
|
|
120883
121184
|
}
|
|
120884
121185
|
}
|
|
120885
121186
|
return { ok: false, output: "", error: lastError };
|
|
@@ -120924,6 +121225,7 @@ async function runStepOnce(step, scope, ctx) {
|
|
|
120924
121225
|
}
|
|
120925
121226
|
async function runNestedWorkflow(step, scope, ctx, opts) {
|
|
120926
121227
|
const { deps } = ctx;
|
|
121228
|
+
assertDefined(step.workflow, "runNestedWorkflow is only invoked for workflow steps");
|
|
120927
121229
|
const nested = deps.lookup.workflow(step.workflow);
|
|
120928
121230
|
if (!nested)
|
|
120929
121231
|
throw new Error(`nested workflow "${step.workflow}" not found`);
|
|
@@ -120953,8 +121255,11 @@ async function runNestedWorkflow(step, scope, ctx, opts) {
|
|
|
120953
121255
|
function buildUpstreamBlock(step, scope) {
|
|
120954
121256
|
if (step.needs.length === 0)
|
|
120955
121257
|
return "";
|
|
120956
|
-
const parts = step.needs.map((id) =>
|
|
120957
|
-
|
|
121258
|
+
const parts = step.needs.map((id) => {
|
|
121259
|
+
const entry = scope.steps?.[id];
|
|
121260
|
+
return `### ${id}
|
|
121261
|
+
${entry?.output ?? ""}`;
|
|
121262
|
+
});
|
|
120958
121263
|
return `
|
|
120959
121264
|
|
|
120960
121265
|
## Upstream
|
|
@@ -121013,6 +121318,7 @@ async function runLogicStep(step, scope, ctx, opts) {
|
|
|
121013
121318
|
}
|
|
121014
121319
|
}
|
|
121015
121320
|
async function runLoopStep(step, ctx, opts) {
|
|
121321
|
+
assertDefined(step.loop, "runLoopStep is only invoked for loop steps");
|
|
121016
121322
|
const loop = step.loop;
|
|
121017
121323
|
const max = loop.maxIterations;
|
|
121018
121324
|
const bodySteps = loop.body.map((id) => ctx.workflow.steps.find((s2) => s2.id === id)).filter((s2) => s2 != null);
|
|
@@ -121025,6 +121331,7 @@ async function runLoopStep(step, ctx, opts) {
|
|
|
121025
121331
|
});
|
|
121026
121332
|
for (const body of bodySteps) {
|
|
121027
121333
|
const bst = ctx.states.get(body.id);
|
|
121334
|
+
assertDefined(bst, "loop body ids are real workflow steps with initialized state");
|
|
121028
121335
|
bst.status = "pending";
|
|
121029
121336
|
bst.output = "";
|
|
121030
121337
|
delete bst.error;
|
|
@@ -121034,6 +121341,7 @@ async function runLoopStep(step, ctx, opts) {
|
|
|
121034
121341
|
return { ok: false, output: lastBodyOutput, error: "aborted" };
|
|
121035
121342
|
const bodyScope = buildScope(ctx, new Date(ctx.now()).toISOString());
|
|
121036
121343
|
const bst = ctx.states.get(body.id);
|
|
121344
|
+
assertDefined(bst, "loop body ids are real workflow steps with initialized state");
|
|
121037
121345
|
bst.startedAt = ctx.now();
|
|
121038
121346
|
const outcome = await runStep(body, bodyScope, ctx);
|
|
121039
121347
|
bst.endedAt = ctx.now();
|
|
@@ -121053,11 +121361,13 @@ async function runLoopStep(step, ctx, opts) {
|
|
|
121053
121361
|
bst.status = "failed";
|
|
121054
121362
|
bst.error = outcome.error;
|
|
121055
121363
|
if (body.onError !== "continue") {
|
|
121056
|
-
ctx.deps.logger
|
|
121057
|
-
|
|
121058
|
-
body
|
|
121059
|
-
|
|
121060
|
-
|
|
121364
|
+
const logger2 = ctx.deps.logger;
|
|
121365
|
+
if (logger2?.warn)
|
|
121366
|
+
logger2.warn("workflow loop broke on body error", {
|
|
121367
|
+
step: step.id,
|
|
121368
|
+
body: body.id,
|
|
121369
|
+
error: outcome.error
|
|
121370
|
+
});
|
|
121061
121371
|
return {
|
|
121062
121372
|
ok: true,
|
|
121063
121373
|
output: `loop "${step.id}" broke on error in body step "${body.id}" after ${iteration + 1} iteration(s): ${outcome.error}` + (lastBodyOutput ? `
|
|
@@ -121080,7 +121390,9 @@ ${lastBodyOutput}`.trim()
|
|
|
121080
121390
|
};
|
|
121081
121391
|
}
|
|
121082
121392
|
}
|
|
121083
|
-
ctx.deps.logger
|
|
121393
|
+
const logger = ctx.deps.logger;
|
|
121394
|
+
if (logger?.warn)
|
|
121395
|
+
logger.warn("workflow loop hit max iterations", { step: step.id, maxIterations: max });
|
|
121084
121396
|
return {
|
|
121085
121397
|
ok: true,
|
|
121086
121398
|
output: `loop "${step.id}" reached max iterations (${max}); stopping.` + (lastBodyOutput ? `
|
|
@@ -121162,6 +121474,7 @@ async function runExecutorLoop(ctx, resumed = false) {
|
|
|
121162
121474
|
if (ctx.loopBodyIds.has(step.id))
|
|
121163
121475
|
continue;
|
|
121164
121476
|
const st4 = ctx.states.get(step.id);
|
|
121477
|
+
assertDefined(st4, "runExecutor initializes a state for every step");
|
|
121165
121478
|
if (st4.status !== "pending")
|
|
121166
121479
|
continue;
|
|
121167
121480
|
if (!step.needs.every(settled))
|
|
@@ -121200,6 +121513,7 @@ async function runExecutorLoop(ctx, resumed = false) {
|
|
|
121200
121513
|
if (ctx.loopBodyIds.has(step.id))
|
|
121201
121514
|
return false;
|
|
121202
121515
|
const st4 = ctx.states.get(step.id);
|
|
121516
|
+
assertDefined(st4, "runExecutor initializes a state for every step");
|
|
121203
121517
|
return st4.status === "pending" && step.needs.every(settled);
|
|
121204
121518
|
});
|
|
121205
121519
|
if (ready.length === 0) {
|
|
@@ -121216,6 +121530,7 @@ async function runExecutorLoop(ctx, resumed = false) {
|
|
|
121216
121530
|
if (aborted)
|
|
121217
121531
|
break;
|
|
121218
121532
|
const st4 = ctx.states.get(step.id);
|
|
121533
|
+
assertDefined(st4, "runExecutor initializes a state for every step");
|
|
121219
121534
|
st4.startedAt = ctx.now();
|
|
121220
121535
|
await deps.emit?.("workflow_step_started", {
|
|
121221
121536
|
id: step.id,
|
|
@@ -121224,6 +121539,8 @@ async function runExecutorLoop(ctx, resumed = false) {
|
|
|
121224
121539
|
const outcome = await runStep(step, scope, ctx);
|
|
121225
121540
|
st4.endedAt = ctx.now();
|
|
121226
121541
|
if (outcome.paused) {
|
|
121542
|
+
const interactionAgentId = outcome.interactionAgentId;
|
|
121543
|
+
assertDefined(interactionAgentId, "a paused outcome always carries interactionAgentId");
|
|
121227
121544
|
st4.status = "awaiting_input";
|
|
121228
121545
|
st4.output = outcome.output;
|
|
121229
121546
|
await deps.emit?.("workflow_step_awaiting_input", {
|
|
@@ -121242,7 +121559,7 @@ async function runExecutorLoop(ctx, resumed = false) {
|
|
|
121242
121559
|
// resume restores them (otherwise downstream `{{ vars.x }}` is lost).
|
|
121243
121560
|
vars: ctx.vars,
|
|
121244
121561
|
pendingStepId: step.id,
|
|
121245
|
-
interactionAgentId
|
|
121562
|
+
interactionAgentId,
|
|
121246
121563
|
startedAt: ctx.now()
|
|
121247
121564
|
});
|
|
121248
121565
|
await deps.emit?.("workflow_paused", {
|
|
@@ -121369,6 +121686,7 @@ async function resumeWorkflowRunInner(runId, userMessage, deps, store) {
|
|
|
121369
121686
|
};
|
|
121370
121687
|
mergeVars(ctx, checkpoint.vars);
|
|
121371
121688
|
const st4 = ctx.states.get(step.id);
|
|
121689
|
+
assertDefined(st4, "the paused step has a restored state in the checkpoint");
|
|
121372
121690
|
await deps.emit?.("workflow_resumed", { runId, stepId: step.id });
|
|
121373
121691
|
if (typeof deps.spawner.continue !== "function") {
|
|
121374
121692
|
st4.status = "failed";
|
|
@@ -121450,9 +121768,13 @@ async function runWorkflow(workflow, deps, opts = {}) {
|
|
|
121450
121768
|
const startedAt = (deps.now ?? Date.now)();
|
|
121451
121769
|
const result = await executor.run(workflow, deps);
|
|
121452
121770
|
if (opts.recordDir !== null) {
|
|
121453
|
-
await writeRunRecord2(workflow, result, startedAt, executor.name, deps, opts.recordDir ?? defaultRunRecordDir()).catch((err) =>
|
|
121454
|
-
|
|
121455
|
-
|
|
121771
|
+
await writeRunRecord2(workflow, result, startedAt, executor.name, deps, opts.recordDir ?? defaultRunRecordDir()).catch((err) => {
|
|
121772
|
+
const logger = deps.logger;
|
|
121773
|
+
if (logger?.warn)
|
|
121774
|
+
logger.warn("workflow: failed to write run record", {
|
|
121775
|
+
error: err instanceof Error ? err.message : String(err)
|
|
121776
|
+
});
|
|
121777
|
+
});
|
|
121456
121778
|
}
|
|
121457
121779
|
return result;
|
|
121458
121780
|
}
|
|
@@ -121991,6 +122313,7 @@ function validateTool(deps) {
|
|
|
121991
122313
|
const r2 = parseWorkflowYaml(yaml);
|
|
121992
122314
|
return { ok: r2.ok, errors: r2.errors };
|
|
121993
122315
|
}
|
|
122316
|
+
assertDefined(name, "input schema refine requires yaml or name; yaml handled above");
|
|
121994
122317
|
const entry = await deps.store.get(name);
|
|
121995
122318
|
if (!entry)
|
|
121996
122319
|
return { ok: false, errors: [`no workflow named "${name}"`] };
|
|
@@ -123270,6 +123593,13 @@ var BUILTIN_REQUIREMENTS = {
|
|
|
123270
123593
|
"hint": "discord resolves the vault from the service registry for its bot token + pairing; @moxxy/plugin-vault must load first"
|
|
123271
123594
|
}
|
|
123272
123595
|
],
|
|
123596
|
+
"@moxxy/plugin-channel-imessage": [
|
|
123597
|
+
{
|
|
123598
|
+
"kind": "plugin",
|
|
123599
|
+
"name": "@moxxy/plugin-vault",
|
|
123600
|
+
"hint": "imessage resolves the vault from the service registry for its BlueBubbles server URL + password + handle allow-list; @moxxy/plugin-vault must load first"
|
|
123601
|
+
}
|
|
123602
|
+
],
|
|
123273
123603
|
"@moxxy/plugin-channel-signal": [
|
|
123274
123604
|
{
|
|
123275
123605
|
"kind": "plugin",
|
|
@@ -123450,7 +123780,7 @@ function pluginDeps2(requirements) {
|
|
|
123450
123780
|
return out;
|
|
123451
123781
|
}
|
|
123452
123782
|
|
|
123453
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
123783
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/qs/formats.mjs
|
|
123454
123784
|
var default_format = "RFC3986";
|
|
123455
123785
|
var formatters = {
|
|
123456
123786
|
RFC1738: (v3) => String(v3).replace(/%20/g, "+"),
|
|
@@ -123458,7 +123788,7 @@ var formatters = {
|
|
|
123458
123788
|
};
|
|
123459
123789
|
var RFC1738 = "RFC1738";
|
|
123460
123790
|
|
|
123461
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
123791
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/qs/utils.mjs
|
|
123462
123792
|
var is_array = Array.isArray;
|
|
123463
123793
|
var hex_table = (() => {
|
|
123464
123794
|
const array3 = [];
|
|
@@ -123537,7 +123867,7 @@ function maybe_map(val, fn) {
|
|
|
123537
123867
|
return fn(val);
|
|
123538
123868
|
}
|
|
123539
123869
|
|
|
123540
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
123870
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/qs/stringify.mjs
|
|
123541
123871
|
var has = Object.prototype.hasOwnProperty;
|
|
123542
123872
|
var array_prefix_generators = {
|
|
123543
123873
|
brackets(prefix) {
|
|
@@ -123818,10 +124148,10 @@ function stringify2(object5, opts = {}) {
|
|
|
123818
124148
|
return joined.length > 0 ? prefix + joined : "";
|
|
123819
124149
|
}
|
|
123820
124150
|
|
|
123821
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
124151
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/version.mjs
|
|
123822
124152
|
var VERSION2 = "4.104.0";
|
|
123823
124153
|
|
|
123824
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
124154
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/_shims/registry.mjs
|
|
123825
124155
|
var auto2 = false;
|
|
123826
124156
|
var kind2 = void 0;
|
|
123827
124157
|
var fetch4 = void 0;
|
|
@@ -123851,11 +124181,11 @@ function setShims2(shims, options = { auto: false }) {
|
|
|
123851
124181
|
isFsReadStream2 = shims.isFsReadStream;
|
|
123852
124182
|
}
|
|
123853
124183
|
|
|
123854
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
124184
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/_shims/node-runtime.mjs
|
|
123855
124185
|
var import_agentkeepalive2 = __toESM(require_agentkeepalive());
|
|
123856
124186
|
var import_abort_controller2 = __toESM(require_abort_controller());
|
|
123857
124187
|
|
|
123858
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
124188
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/_shims/MultipartBody.mjs
|
|
123859
124189
|
var MultipartBody2 = class {
|
|
123860
124190
|
constructor(body) {
|
|
123861
124191
|
this.body = body;
|
|
@@ -123907,13 +124237,13 @@ function getRuntime2() {
|
|
|
123907
124237
|
};
|
|
123908
124238
|
}
|
|
123909
124239
|
|
|
123910
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
124240
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/_shims/index.mjs
|
|
123911
124241
|
var init2 = () => {
|
|
123912
124242
|
if (!kind2) setShims2(getRuntime2(), { auto: true });
|
|
123913
124243
|
};
|
|
123914
124244
|
init2();
|
|
123915
124245
|
|
|
123916
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
124246
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/error.mjs
|
|
123917
124247
|
var OpenAIError = class extends Error {
|
|
123918
124248
|
};
|
|
123919
124249
|
var APIError2 = class _APIError extends OpenAIError {
|
|
@@ -124017,7 +124347,7 @@ var ContentFilterFinishReasonError = class extends OpenAIError {
|
|
|
124017
124347
|
}
|
|
124018
124348
|
};
|
|
124019
124349
|
|
|
124020
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
124350
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/decoders/line.mjs
|
|
124021
124351
|
var __classPrivateFieldSet9 = function(receiver, state, value, kind3, f3) {
|
|
124022
124352
|
if (typeof state === "function" ? receiver !== state || true : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
124023
124353
|
return state.set(receiver, value), value;
|
|
@@ -124126,7 +124456,7 @@ function findDoubleNewlineIndex2(buffer) {
|
|
|
124126
124456
|
return -1;
|
|
124127
124457
|
}
|
|
124128
124458
|
|
|
124129
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
124459
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/internal/stream-utils.mjs
|
|
124130
124460
|
function ReadableStreamToAsyncIterable2(stream) {
|
|
124131
124461
|
if (stream[Symbol.asyncIterator])
|
|
124132
124462
|
return stream;
|
|
@@ -124155,7 +124485,7 @@ function ReadableStreamToAsyncIterable2(stream) {
|
|
|
124155
124485
|
};
|
|
124156
124486
|
}
|
|
124157
124487
|
|
|
124158
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
124488
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/streaming.mjs
|
|
124159
124489
|
var Stream4 = class _Stream {
|
|
124160
124490
|
constructor(iterator, controller) {
|
|
124161
124491
|
this.iterator = iterator;
|
|
@@ -124407,7 +124737,7 @@ function partition2(str2, delimiter2) {
|
|
|
124407
124737
|
return [str2, "", ""];
|
|
124408
124738
|
}
|
|
124409
124739
|
|
|
124410
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
124740
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/uploads.mjs
|
|
124411
124741
|
var isResponseLike2 = (value) => value != null && typeof value === "object" && typeof value.url === "string" && typeof value.blob === "function";
|
|
124412
124742
|
var isFileLike3 = (value) => value != null && typeof value === "object" && typeof value.name === "string" && typeof value.lastModified === "number" && isBlobLike2(value);
|
|
124413
124743
|
var isBlobLike2 = (value) => value != null && typeof value === "object" && typeof value.size === "number" && typeof value.type === "string" && typeof value.text === "function" && typeof value.slice === "function" && typeof value.arrayBuffer === "function";
|
|
@@ -124497,7 +124827,7 @@ var addFormValue = async (form, key, value) => {
|
|
|
124497
124827
|
}
|
|
124498
124828
|
};
|
|
124499
124829
|
|
|
124500
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
124830
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/core.mjs
|
|
124501
124831
|
var __classPrivateFieldSet10 = function(receiver, state, value, kind3, f3) {
|
|
124502
124832
|
if (typeof state === "function" ? receiver !== state || true : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
124503
124833
|
return state.set(receiver, value), value;
|
|
@@ -125265,7 +125595,7 @@ function isObj(obj) {
|
|
|
125265
125595
|
return obj != null && typeof obj === "object" && !Array.isArray(obj);
|
|
125266
125596
|
}
|
|
125267
125597
|
|
|
125268
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
125598
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/pagination.mjs
|
|
125269
125599
|
var Page2 = class extends AbstractPage2 {
|
|
125270
125600
|
constructor(client2, response, body, options) {
|
|
125271
125601
|
super(client2, response, body, options);
|
|
@@ -125327,14 +125657,14 @@ var CursorPage = class extends AbstractPage2 {
|
|
|
125327
125657
|
}
|
|
125328
125658
|
};
|
|
125329
125659
|
|
|
125330
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
125660
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resource.mjs
|
|
125331
125661
|
var APIResource2 = class {
|
|
125332
125662
|
constructor(client2) {
|
|
125333
125663
|
this._client = client2;
|
|
125334
125664
|
}
|
|
125335
125665
|
};
|
|
125336
125666
|
|
|
125337
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
125667
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/chat/completions/messages.mjs
|
|
125338
125668
|
var Messages3 = class extends APIResource2 {
|
|
125339
125669
|
list(completionId, query = {}, options) {
|
|
125340
125670
|
if (isRequestOptions2(query)) {
|
|
@@ -125344,7 +125674,7 @@ var Messages3 = class extends APIResource2 {
|
|
|
125344
125674
|
}
|
|
125345
125675
|
};
|
|
125346
125676
|
|
|
125347
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
125677
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/chat/completions/completions.mjs
|
|
125348
125678
|
var Completions2 = class extends APIResource2 {
|
|
125349
125679
|
constructor() {
|
|
125350
125680
|
super(...arguments);
|
|
@@ -125409,7 +125739,7 @@ var ChatCompletionStoreMessagesPage = class extends CursorPage {
|
|
|
125409
125739
|
Completions2.ChatCompletionsPage = ChatCompletionsPage;
|
|
125410
125740
|
Completions2.Messages = Messages3;
|
|
125411
125741
|
|
|
125412
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
125742
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/chat/chat.mjs
|
|
125413
125743
|
var Chat = class extends APIResource2 {
|
|
125414
125744
|
constructor() {
|
|
125415
125745
|
super(...arguments);
|
|
@@ -125419,7 +125749,7 @@ var Chat = class extends APIResource2 {
|
|
|
125419
125749
|
Chat.Completions = Completions2;
|
|
125420
125750
|
Chat.ChatCompletionsPage = ChatCompletionsPage;
|
|
125421
125751
|
|
|
125422
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
125752
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/audio/speech.mjs
|
|
125423
125753
|
var Speech = class extends APIResource2 {
|
|
125424
125754
|
/**
|
|
125425
125755
|
* Generates audio from the input text.
|
|
@@ -125446,7 +125776,7 @@ var Speech = class extends APIResource2 {
|
|
|
125446
125776
|
}
|
|
125447
125777
|
};
|
|
125448
125778
|
|
|
125449
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
125779
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/audio/transcriptions.mjs
|
|
125450
125780
|
var Transcriptions = class extends APIResource2 {
|
|
125451
125781
|
create(body, options) {
|
|
125452
125782
|
return this._client.post("/audio/transcriptions", multipartFormRequestOptions({
|
|
@@ -125458,14 +125788,14 @@ var Transcriptions = class extends APIResource2 {
|
|
|
125458
125788
|
}
|
|
125459
125789
|
};
|
|
125460
125790
|
|
|
125461
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
125791
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/audio/translations.mjs
|
|
125462
125792
|
var Translations = class extends APIResource2 {
|
|
125463
125793
|
create(body, options) {
|
|
125464
125794
|
return this._client.post("/audio/translations", multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model } }));
|
|
125465
125795
|
}
|
|
125466
125796
|
};
|
|
125467
125797
|
|
|
125468
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
125798
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/audio/audio.mjs
|
|
125469
125799
|
var Audio = class extends APIResource2 {
|
|
125470
125800
|
constructor() {
|
|
125471
125801
|
super(...arguments);
|
|
@@ -125478,7 +125808,7 @@ Audio.Transcriptions = Transcriptions;
|
|
|
125478
125808
|
Audio.Translations = Translations;
|
|
125479
125809
|
Audio.Speech = Speech;
|
|
125480
125810
|
|
|
125481
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
125811
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/batches.mjs
|
|
125482
125812
|
var Batches3 = class extends APIResource2 {
|
|
125483
125813
|
/**
|
|
125484
125814
|
* Creates and executes a batch from an uploaded file of requests
|
|
@@ -125511,7 +125841,7 @@ var BatchesPage = class extends CursorPage {
|
|
|
125511
125841
|
};
|
|
125512
125842
|
Batches3.BatchesPage = BatchesPage;
|
|
125513
125843
|
|
|
125514
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
125844
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/lib/EventStream.mjs
|
|
125515
125845
|
var __classPrivateFieldSet11 = function(receiver, state, value, kind3, f3) {
|
|
125516
125846
|
if (typeof state === "function" ? receiver !== state || true : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
125517
125847
|
return state.set(receiver, value), value;
|
|
@@ -125709,7 +126039,7 @@ _EventStream_connectedPromise = /* @__PURE__ */ new WeakMap(), _EventStream_reso
|
|
|
125709
126039
|
return this._emit("error", new OpenAIError(String(error2)));
|
|
125710
126040
|
};
|
|
125711
126041
|
|
|
125712
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
126042
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/lib/AssistantStream.mjs
|
|
125713
126043
|
var __classPrivateFieldGet13 = function(receiver, state, kind3, f3) {
|
|
125714
126044
|
if (kind3 === "a" && !f3) throw new TypeError("Private accessor was defined without a getter");
|
|
125715
126045
|
if (typeof state === "function" ? receiver !== state || !f3 : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
@@ -126247,7 +126577,7 @@ _AssistantStream_addEvent = function _AssistantStream_addEvent2(event) {
|
|
|
126247
126577
|
}
|
|
126248
126578
|
};
|
|
126249
126579
|
|
|
126250
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
126580
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/beta/assistants.mjs
|
|
126251
126581
|
var Assistants = class extends APIResource2 {
|
|
126252
126582
|
/**
|
|
126253
126583
|
* Create an assistant with a model and instructions.
|
|
@@ -126330,12 +126660,12 @@ var AssistantsPage = class extends CursorPage {
|
|
|
126330
126660
|
};
|
|
126331
126661
|
Assistants.AssistantsPage = AssistantsPage;
|
|
126332
126662
|
|
|
126333
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
126663
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/lib/RunnableFunction.mjs
|
|
126334
126664
|
function isRunnableFunctionWithParse(fn) {
|
|
126335
126665
|
return typeof fn.parse === "function";
|
|
126336
126666
|
}
|
|
126337
126667
|
|
|
126338
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
126668
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/lib/chatCompletionUtils.mjs
|
|
126339
126669
|
var isAssistantMessage = (message) => {
|
|
126340
126670
|
return message?.role === "assistant";
|
|
126341
126671
|
};
|
|
@@ -126346,7 +126676,7 @@ var isToolMessage = (message) => {
|
|
|
126346
126676
|
return message?.role === "tool";
|
|
126347
126677
|
};
|
|
126348
126678
|
|
|
126349
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
126679
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/lib/parser.mjs
|
|
126350
126680
|
function isAutoParsableResponseFormat(response_format) {
|
|
126351
126681
|
return response_format?.["$brand"] === "auto-parseable-response-format";
|
|
126352
126682
|
}
|
|
@@ -126439,7 +126769,7 @@ function validateInputTools(tools) {
|
|
|
126439
126769
|
}
|
|
126440
126770
|
}
|
|
126441
126771
|
|
|
126442
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
126772
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/lib/AbstractChatCompletionRunner.mjs
|
|
126443
126773
|
var __classPrivateFieldGet14 = function(receiver, state, kind3, f3) {
|
|
126444
126774
|
if (typeof state === "function" ? receiver !== state || !f3 : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
126445
126775
|
return kind3 === "m" ? f3 : kind3 === "a" ? f3.call(receiver) : f3 ? f3.value : state.get(receiver);
|
|
@@ -126784,7 +127114,7 @@ _AbstractChatCompletionRunner_instances = /* @__PURE__ */ new WeakSet(), _Abstra
|
|
|
126784
127114
|
return typeof rawContent === "string" ? rawContent : rawContent === void 0 ? "undefined" : JSON.stringify(rawContent);
|
|
126785
127115
|
};
|
|
126786
127116
|
|
|
126787
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
127117
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/lib/ChatCompletionRunner.mjs
|
|
126788
127118
|
var ChatCompletionRunner = class _ChatCompletionRunner extends AbstractChatCompletionRunner {
|
|
126789
127119
|
/** @deprecated - please use `runTools` instead. */
|
|
126790
127120
|
static runFunctions(client2, params, options) {
|
|
@@ -126813,7 +127143,7 @@ var ChatCompletionRunner = class _ChatCompletionRunner extends AbstractChatCompl
|
|
|
126813
127143
|
}
|
|
126814
127144
|
};
|
|
126815
127145
|
|
|
126816
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
127146
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/_vendor/partial-json-parser/parser.mjs
|
|
126817
127147
|
var STR = 1;
|
|
126818
127148
|
var NUM = 2;
|
|
126819
127149
|
var ARR = 4;
|
|
@@ -127025,7 +127355,7 @@ var _parseJSON = (jsonString, allow) => {
|
|
|
127025
127355
|
};
|
|
127026
127356
|
var partialParse2 = (input) => parseJSON(input, Allow.ALL ^ Allow.NUM);
|
|
127027
127357
|
|
|
127028
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
127358
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/lib/ChatCompletionStream.mjs
|
|
127029
127359
|
var __classPrivateFieldSet13 = function(receiver, state, value, kind3, f3) {
|
|
127030
127360
|
if (typeof state === "function" ? receiver !== state || true : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
127031
127361
|
return state.set(receiver, value), value;
|
|
@@ -127509,7 +127839,7 @@ function str(x4) {
|
|
|
127509
127839
|
function assertNever2(_x) {
|
|
127510
127840
|
}
|
|
127511
127841
|
|
|
127512
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
127842
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/lib/ChatCompletionStreamingRunner.mjs
|
|
127513
127843
|
var ChatCompletionStreamingRunner = class _ChatCompletionStreamingRunner extends ChatCompletionStream {
|
|
127514
127844
|
static fromReadableStream(stream) {
|
|
127515
127845
|
const runner = new _ChatCompletionStreamingRunner(null);
|
|
@@ -127540,7 +127870,7 @@ var ChatCompletionStreamingRunner = class _ChatCompletionStreamingRunner extends
|
|
|
127540
127870
|
}
|
|
127541
127871
|
};
|
|
127542
127872
|
|
|
127543
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
127873
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/beta/chat/completions.mjs
|
|
127544
127874
|
var Completions3 = class extends APIResource2 {
|
|
127545
127875
|
parse(body, options) {
|
|
127546
127876
|
validateInputTools(body.tools);
|
|
@@ -127572,7 +127902,7 @@ var Completions3 = class extends APIResource2 {
|
|
|
127572
127902
|
}
|
|
127573
127903
|
};
|
|
127574
127904
|
|
|
127575
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
127905
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/beta/chat/chat.mjs
|
|
127576
127906
|
var Chat2 = class extends APIResource2 {
|
|
127577
127907
|
constructor() {
|
|
127578
127908
|
super(...arguments);
|
|
@@ -127583,7 +127913,7 @@ var Chat2 = class extends APIResource2 {
|
|
|
127583
127913
|
Chat3.Completions = Completions3;
|
|
127584
127914
|
})(Chat2 || (Chat2 = {}));
|
|
127585
127915
|
|
|
127586
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
127916
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/beta/realtime/sessions.mjs
|
|
127587
127917
|
var Sessions = class extends APIResource2 {
|
|
127588
127918
|
/**
|
|
127589
127919
|
* Create an ephemeral API token for use in client-side applications with the
|
|
@@ -127609,7 +127939,7 @@ var Sessions = class extends APIResource2 {
|
|
|
127609
127939
|
}
|
|
127610
127940
|
};
|
|
127611
127941
|
|
|
127612
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
127942
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/beta/realtime/transcription-sessions.mjs
|
|
127613
127943
|
var TranscriptionSessions = class extends APIResource2 {
|
|
127614
127944
|
/**
|
|
127615
127945
|
* Create an ephemeral API token for use in client-side applications with the
|
|
@@ -127635,7 +127965,7 @@ var TranscriptionSessions = class extends APIResource2 {
|
|
|
127635
127965
|
}
|
|
127636
127966
|
};
|
|
127637
127967
|
|
|
127638
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
127968
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/beta/realtime/realtime.mjs
|
|
127639
127969
|
var Realtime = class extends APIResource2 {
|
|
127640
127970
|
constructor() {
|
|
127641
127971
|
super(...arguments);
|
|
@@ -127646,7 +127976,7 @@ var Realtime = class extends APIResource2 {
|
|
|
127646
127976
|
Realtime.Sessions = Sessions;
|
|
127647
127977
|
Realtime.TranscriptionSessions = TranscriptionSessions;
|
|
127648
127978
|
|
|
127649
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
127979
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/beta/threads/messages.mjs
|
|
127650
127980
|
var Messages4 = class extends APIResource2 {
|
|
127651
127981
|
/**
|
|
127652
127982
|
* Create a message.
|
|
@@ -127709,7 +128039,7 @@ var MessagesPage = class extends CursorPage {
|
|
|
127709
128039
|
};
|
|
127710
128040
|
Messages4.MessagesPage = MessagesPage;
|
|
127711
128041
|
|
|
127712
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128042
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/beta/threads/runs/steps.mjs
|
|
127713
128043
|
var Steps = class extends APIResource2 {
|
|
127714
128044
|
retrieve(threadId, runId, stepId, query = {}, options) {
|
|
127715
128045
|
if (isRequestOptions2(query)) {
|
|
@@ -127736,7 +128066,7 @@ var RunStepsPage = class extends CursorPage {
|
|
|
127736
128066
|
};
|
|
127737
128067
|
Steps.RunStepsPage = RunStepsPage;
|
|
127738
128068
|
|
|
127739
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128069
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/beta/threads/runs/runs.mjs
|
|
127740
128070
|
var Runs = class extends APIResource2 {
|
|
127741
128071
|
constructor() {
|
|
127742
128072
|
super(...arguments);
|
|
@@ -127896,7 +128226,7 @@ Runs.RunsPage = RunsPage;
|
|
|
127896
128226
|
Runs.Steps = Steps;
|
|
127897
128227
|
Runs.RunStepsPage = RunStepsPage;
|
|
127898
128228
|
|
|
127899
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128229
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/beta/threads/threads.mjs
|
|
127900
128230
|
var Threads = class extends APIResource2 {
|
|
127901
128231
|
constructor() {
|
|
127902
128232
|
super(...arguments);
|
|
@@ -127976,7 +128306,7 @@ Threads.RunsPage = RunsPage;
|
|
|
127976
128306
|
Threads.Messages = Messages4;
|
|
127977
128307
|
Threads.MessagesPage = MessagesPage;
|
|
127978
128308
|
|
|
127979
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128309
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/beta/beta.mjs
|
|
127980
128310
|
var Beta2 = class extends APIResource2 {
|
|
127981
128311
|
constructor() {
|
|
127982
128312
|
super(...arguments);
|
|
@@ -127991,14 +128321,14 @@ Beta2.Assistants = Assistants;
|
|
|
127991
128321
|
Beta2.AssistantsPage = AssistantsPage;
|
|
127992
128322
|
Beta2.Threads = Threads;
|
|
127993
128323
|
|
|
127994
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128324
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/completions.mjs
|
|
127995
128325
|
var Completions4 = class extends APIResource2 {
|
|
127996
128326
|
create(body, options) {
|
|
127997
128327
|
return this._client.post("/completions", { body, ...options, stream: body.stream ?? false });
|
|
127998
128328
|
}
|
|
127999
128329
|
};
|
|
128000
128330
|
|
|
128001
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128331
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/containers/files/content.mjs
|
|
128002
128332
|
var Content = class extends APIResource2 {
|
|
128003
128333
|
/**
|
|
128004
128334
|
* Retrieve Container File Content
|
|
@@ -128012,7 +128342,7 @@ var Content = class extends APIResource2 {
|
|
|
128012
128342
|
}
|
|
128013
128343
|
};
|
|
128014
128344
|
|
|
128015
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128345
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/containers/files/files.mjs
|
|
128016
128346
|
var Files = class extends APIResource2 {
|
|
128017
128347
|
constructor() {
|
|
128018
128348
|
super(...arguments);
|
|
@@ -128057,7 +128387,7 @@ var FileListResponsesPage = class extends CursorPage {
|
|
|
128057
128387
|
Files.FileListResponsesPage = FileListResponsesPage;
|
|
128058
128388
|
Files.Content = Content;
|
|
128059
128389
|
|
|
128060
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128390
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/containers/containers.mjs
|
|
128061
128391
|
var Containers = class extends APIResource2 {
|
|
128062
128392
|
constructor() {
|
|
128063
128393
|
super(...arguments);
|
|
@@ -128097,7 +128427,7 @@ Containers.ContainerListResponsesPage = ContainerListResponsesPage;
|
|
|
128097
128427
|
Containers.Files = Files;
|
|
128098
128428
|
Containers.FileListResponsesPage = FileListResponsesPage;
|
|
128099
128429
|
|
|
128100
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128430
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/embeddings.mjs
|
|
128101
128431
|
var Embeddings = class extends APIResource2 {
|
|
128102
128432
|
/**
|
|
128103
128433
|
* Creates an embedding vector representing the input text.
|
|
@@ -128140,7 +128470,7 @@ var Embeddings = class extends APIResource2 {
|
|
|
128140
128470
|
}
|
|
128141
128471
|
};
|
|
128142
128472
|
|
|
128143
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128473
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/evals/runs/output-items.mjs
|
|
128144
128474
|
var OutputItems = class extends APIResource2 {
|
|
128145
128475
|
/**
|
|
128146
128476
|
* Get an evaluation run output item by ID.
|
|
@@ -128159,7 +128489,7 @@ var OutputItemListResponsesPage = class extends CursorPage {
|
|
|
128159
128489
|
};
|
|
128160
128490
|
OutputItems.OutputItemListResponsesPage = OutputItemListResponsesPage;
|
|
128161
128491
|
|
|
128162
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128492
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/evals/runs/runs.mjs
|
|
128163
128493
|
var Runs2 = class extends APIResource2 {
|
|
128164
128494
|
constructor() {
|
|
128165
128495
|
super(...arguments);
|
|
@@ -128204,7 +128534,7 @@ Runs2.RunListResponsesPage = RunListResponsesPage;
|
|
|
128204
128534
|
Runs2.OutputItems = OutputItems;
|
|
128205
128535
|
Runs2.OutputItemListResponsesPage = OutputItemListResponsesPage;
|
|
128206
128536
|
|
|
128207
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128537
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/evals/evals.mjs
|
|
128208
128538
|
var Evals = class extends APIResource2 {
|
|
128209
128539
|
constructor() {
|
|
128210
128540
|
super(...arguments);
|
|
@@ -128252,7 +128582,7 @@ Evals.EvalListResponsesPage = EvalListResponsesPage;
|
|
|
128252
128582
|
Evals.Runs = Runs2;
|
|
128253
128583
|
Evals.RunListResponsesPage = RunListResponsesPage;
|
|
128254
128584
|
|
|
128255
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128585
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/files.mjs
|
|
128256
128586
|
var Files2 = class extends APIResource2 {
|
|
128257
128587
|
/**
|
|
128258
128588
|
* Upload a file that can be used across various endpoints. Individual files can be
|
|
@@ -128339,11 +128669,11 @@ var FileObjectsPage = class extends CursorPage {
|
|
|
128339
128669
|
};
|
|
128340
128670
|
Files2.FileObjectsPage = FileObjectsPage;
|
|
128341
128671
|
|
|
128342
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128672
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/fine-tuning/methods.mjs
|
|
128343
128673
|
var Methods = class extends APIResource2 {
|
|
128344
128674
|
};
|
|
128345
128675
|
|
|
128346
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128676
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/fine-tuning/alpha/graders.mjs
|
|
128347
128677
|
var Graders = class extends APIResource2 {
|
|
128348
128678
|
/**
|
|
128349
128679
|
* Run a grader.
|
|
@@ -128388,7 +128718,7 @@ var Graders = class extends APIResource2 {
|
|
|
128388
128718
|
}
|
|
128389
128719
|
};
|
|
128390
128720
|
|
|
128391
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128721
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/fine-tuning/alpha/alpha.mjs
|
|
128392
128722
|
var Alpha = class extends APIResource2 {
|
|
128393
128723
|
constructor() {
|
|
128394
128724
|
super(...arguments);
|
|
@@ -128397,7 +128727,7 @@ var Alpha = class extends APIResource2 {
|
|
|
128397
128727
|
};
|
|
128398
128728
|
Alpha.Graders = Graders;
|
|
128399
128729
|
|
|
128400
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128730
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/fine-tuning/checkpoints/permissions.mjs
|
|
128401
128731
|
var Permissions = class extends APIResource2 {
|
|
128402
128732
|
/**
|
|
128403
128733
|
* **NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys).
|
|
@@ -128451,7 +128781,7 @@ var PermissionCreateResponsesPage = class extends Page2 {
|
|
|
128451
128781
|
};
|
|
128452
128782
|
Permissions.PermissionCreateResponsesPage = PermissionCreateResponsesPage;
|
|
128453
128783
|
|
|
128454
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128784
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/fine-tuning/checkpoints/checkpoints.mjs
|
|
128455
128785
|
var Checkpoints = class extends APIResource2 {
|
|
128456
128786
|
constructor() {
|
|
128457
128787
|
super(...arguments);
|
|
@@ -128461,7 +128791,7 @@ var Checkpoints = class extends APIResource2 {
|
|
|
128461
128791
|
Checkpoints.Permissions = Permissions;
|
|
128462
128792
|
Checkpoints.PermissionCreateResponsesPage = PermissionCreateResponsesPage;
|
|
128463
128793
|
|
|
128464
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128794
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/fine-tuning/jobs/checkpoints.mjs
|
|
128465
128795
|
var Checkpoints2 = class extends APIResource2 {
|
|
128466
128796
|
list(fineTuningJobId, query = {}, options) {
|
|
128467
128797
|
if (isRequestOptions2(query)) {
|
|
@@ -128474,7 +128804,7 @@ var FineTuningJobCheckpointsPage = class extends CursorPage {
|
|
|
128474
128804
|
};
|
|
128475
128805
|
Checkpoints2.FineTuningJobCheckpointsPage = FineTuningJobCheckpointsPage;
|
|
128476
128806
|
|
|
128477
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128807
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/fine-tuning/jobs/jobs.mjs
|
|
128478
128808
|
var Jobs = class extends APIResource2 {
|
|
128479
128809
|
constructor() {
|
|
128480
128810
|
super(...arguments);
|
|
@@ -128579,7 +128909,7 @@ Jobs.FineTuningJobEventsPage = FineTuningJobEventsPage;
|
|
|
128579
128909
|
Jobs.Checkpoints = Checkpoints2;
|
|
128580
128910
|
Jobs.FineTuningJobCheckpointsPage = FineTuningJobCheckpointsPage;
|
|
128581
128911
|
|
|
128582
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128912
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/fine-tuning/fine-tuning.mjs
|
|
128583
128913
|
var FineTuning = class extends APIResource2 {
|
|
128584
128914
|
constructor() {
|
|
128585
128915
|
super(...arguments);
|
|
@@ -128596,11 +128926,11 @@ FineTuning.FineTuningJobEventsPage = FineTuningJobEventsPage;
|
|
|
128596
128926
|
FineTuning.Checkpoints = Checkpoints;
|
|
128597
128927
|
FineTuning.Alpha = Alpha;
|
|
128598
128928
|
|
|
128599
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128929
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/graders/grader-models.mjs
|
|
128600
128930
|
var GraderModels = class extends APIResource2 {
|
|
128601
128931
|
};
|
|
128602
128932
|
|
|
128603
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128933
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/graders/graders.mjs
|
|
128604
128934
|
var Graders2 = class extends APIResource2 {
|
|
128605
128935
|
constructor() {
|
|
128606
128936
|
super(...arguments);
|
|
@@ -128609,7 +128939,7 @@ var Graders2 = class extends APIResource2 {
|
|
|
128609
128939
|
};
|
|
128610
128940
|
Graders2.GraderModels = GraderModels;
|
|
128611
128941
|
|
|
128612
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128942
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/images.mjs
|
|
128613
128943
|
var Images = class extends APIResource2 {
|
|
128614
128944
|
/**
|
|
128615
128945
|
* Creates a variation of a given image. This endpoint only supports `dall-e-2`.
|
|
@@ -128655,7 +128985,7 @@ var Images = class extends APIResource2 {
|
|
|
128655
128985
|
}
|
|
128656
128986
|
};
|
|
128657
128987
|
|
|
128658
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128988
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/models.mjs
|
|
128659
128989
|
var Models3 = class extends APIResource2 {
|
|
128660
128990
|
/**
|
|
128661
128991
|
* Retrieves a model instance, providing basic information about the model such as
|
|
@@ -128683,7 +129013,7 @@ var ModelsPage = class extends Page2 {
|
|
|
128683
129013
|
};
|
|
128684
129014
|
Models3.ModelsPage = ModelsPage;
|
|
128685
129015
|
|
|
128686
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
129016
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/moderations.mjs
|
|
128687
129017
|
var Moderations = class extends APIResource2 {
|
|
128688
129018
|
/**
|
|
128689
129019
|
* Classifies if text and/or image inputs are potentially harmful. Learn more in
|
|
@@ -128694,7 +129024,7 @@ var Moderations = class extends APIResource2 {
|
|
|
128694
129024
|
}
|
|
128695
129025
|
};
|
|
128696
129026
|
|
|
128697
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
129027
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/lib/ResponsesParser.mjs
|
|
128698
129028
|
function maybeParseResponse(response, params) {
|
|
128699
129029
|
if (!params || !hasAutoParseableInput2(params)) {
|
|
128700
129030
|
return {
|
|
@@ -128815,7 +129145,7 @@ function addOutputText(rsp) {
|
|
|
128815
129145
|
rsp.output_text = texts.join("");
|
|
128816
129146
|
}
|
|
128817
129147
|
|
|
128818
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
129148
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/responses/input-items.mjs
|
|
128819
129149
|
var InputItems = class extends APIResource2 {
|
|
128820
129150
|
list(responseId, query = {}, options) {
|
|
128821
129151
|
if (isRequestOptions2(query)) {
|
|
@@ -128828,7 +129158,7 @@ var InputItems = class extends APIResource2 {
|
|
|
128828
129158
|
}
|
|
128829
129159
|
};
|
|
128830
129160
|
|
|
128831
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
129161
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/lib/responses/ResponseStream.mjs
|
|
128832
129162
|
var __classPrivateFieldSet14 = function(receiver, state, value, kind3, f3) {
|
|
128833
129163
|
if (typeof state === "function" ? receiver !== state || true : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
128834
129164
|
return state.set(receiver, value), value;
|
|
@@ -129075,7 +129405,7 @@ function finalizeResponse(snapshot, params) {
|
|
|
129075
129405
|
return maybeParseResponse(snapshot, params);
|
|
129076
129406
|
}
|
|
129077
129407
|
|
|
129078
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
129408
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/responses/responses.mjs
|
|
129079
129409
|
var Responses = class extends APIResource2 {
|
|
129080
129410
|
constructor() {
|
|
129081
129411
|
super(...arguments);
|
|
@@ -129144,7 +129474,7 @@ var ResponseItemsPage = class extends CursorPage {
|
|
|
129144
129474
|
};
|
|
129145
129475
|
Responses.InputItems = InputItems;
|
|
129146
129476
|
|
|
129147
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
129477
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/uploads/parts.mjs
|
|
129148
129478
|
var Parts = class extends APIResource2 {
|
|
129149
129479
|
/**
|
|
129150
129480
|
* Adds a
|
|
@@ -129164,7 +129494,7 @@ var Parts = class extends APIResource2 {
|
|
|
129164
129494
|
}
|
|
129165
129495
|
};
|
|
129166
129496
|
|
|
129167
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
129497
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/uploads/uploads.mjs
|
|
129168
129498
|
var Uploads = class extends APIResource2 {
|
|
129169
129499
|
constructor() {
|
|
129170
129500
|
super(...arguments);
|
|
@@ -129221,7 +129551,7 @@ var Uploads = class extends APIResource2 {
|
|
|
129221
129551
|
};
|
|
129222
129552
|
Uploads.Parts = Parts;
|
|
129223
129553
|
|
|
129224
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
129554
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/lib/Util.mjs
|
|
129225
129555
|
var allSettledWithThrow = async (promises) => {
|
|
129226
129556
|
const results = await Promise.allSettled(promises);
|
|
129227
129557
|
const rejected = results.filter((result) => result.status === "rejected");
|
|
@@ -129240,7 +129570,7 @@ var allSettledWithThrow = async (promises) => {
|
|
|
129240
129570
|
return values;
|
|
129241
129571
|
};
|
|
129242
129572
|
|
|
129243
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
129573
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/vector-stores/files.mjs
|
|
129244
129574
|
var Files3 = class extends APIResource2 {
|
|
129245
129575
|
/**
|
|
129246
129576
|
* Create a vector store file by attaching a
|
|
@@ -129372,7 +129702,7 @@ var FileContentResponsesPage = class extends Page2 {
|
|
|
129372
129702
|
Files3.VectorStoreFilesPage = VectorStoreFilesPage;
|
|
129373
129703
|
Files3.FileContentResponsesPage = FileContentResponsesPage;
|
|
129374
129704
|
|
|
129375
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
129705
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/vector-stores/file-batches.mjs
|
|
129376
129706
|
var FileBatches = class extends APIResource2 {
|
|
129377
129707
|
/**
|
|
129378
129708
|
* Create a vector store file batch.
|
|
@@ -129483,7 +129813,7 @@ var FileBatches = class extends APIResource2 {
|
|
|
129483
129813
|
}
|
|
129484
129814
|
};
|
|
129485
129815
|
|
|
129486
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
129816
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/resources/vector-stores/vector-stores.mjs
|
|
129487
129817
|
var VectorStores = class extends APIResource2 {
|
|
129488
129818
|
constructor() {
|
|
129489
129819
|
super(...arguments);
|
|
@@ -129562,7 +129892,7 @@ VectorStores.VectorStoreFilesPage = VectorStoreFilesPage;
|
|
|
129562
129892
|
VectorStores.FileContentResponsesPage = FileContentResponsesPage;
|
|
129563
129893
|
VectorStores.FileBatches = FileBatches;
|
|
129564
129894
|
|
|
129565
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
129895
|
+
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.21.0_zod@3.25.76/node_modules/openai/index.mjs
|
|
129566
129896
|
var _a2;
|
|
129567
129897
|
var OpenAI = class extends APIClient2 {
|
|
129568
129898
|
/**
|
|
@@ -129826,8 +130156,13 @@ var OpenAIProvider = class {
|
|
|
129826
130156
|
const messages = toOpenAIMessages(req.messages);
|
|
129827
130157
|
if (req.system) {
|
|
129828
130158
|
let insertAt = 0;
|
|
129829
|
-
while (insertAt < messages.length
|
|
130159
|
+
while (insertAt < messages.length) {
|
|
130160
|
+
const msg = messages[insertAt];
|
|
130161
|
+
assertDefined(msg, "insertAt < messages.length");
|
|
130162
|
+
if (msg.role !== "system")
|
|
130163
|
+
break;
|
|
129830
130164
|
insertAt += 1;
|
|
130165
|
+
}
|
|
129831
130166
|
messages.splice(insertAt, 0, { role: "system", content: req.system });
|
|
129832
130167
|
}
|
|
129833
130168
|
const tools = req.tools && req.tools.length > 0 ? toOpenAITools(req.tools) : void 0;
|
|
@@ -135686,8 +136021,6 @@ async function writeIndex(dir, entries) {
|
|
|
135686
136021
|
}
|
|
135687
136022
|
await writeFileAtomic(path3.join(dir, "MEMORY.md"), lines.join("\n"));
|
|
135688
136023
|
}
|
|
135689
|
-
|
|
135690
|
-
// ../plugin-memory/dist/store/search.js
|
|
135691
136024
|
async function recallVector(all, query, limit2, embedder, index, mutex) {
|
|
135692
136025
|
const corpus = all.map((e3) => entryForEmbedding(e3));
|
|
135693
136026
|
if (embedder instanceof TfIdfEmbedder) {
|
|
@@ -135700,10 +136033,14 @@ async function recallVector(all, query, limit2, embedder, index, mutex) {
|
|
|
135700
136033
|
const cached = [];
|
|
135701
136034
|
const misses = [];
|
|
135702
136035
|
for (let i2 = 0; i2 < all.length; i2++) {
|
|
135703
|
-
const
|
|
136036
|
+
const entry = all[i2];
|
|
136037
|
+
const text = corpus[i2];
|
|
136038
|
+
assertDefined(entry, "loop index i < all.length");
|
|
136039
|
+
assertDefined(text, "corpus is built 1:1 from all");
|
|
136040
|
+
const hit = index.lookup(entry.frontmatter.name, text);
|
|
135704
136041
|
cached.push(hit);
|
|
135705
136042
|
if (!hit)
|
|
135706
|
-
misses.push({ index: i2, text
|
|
136043
|
+
misses.push({ index: i2, text });
|
|
135707
136044
|
}
|
|
135708
136045
|
const queryIdx = misses.length;
|
|
135709
136046
|
const toEmbed = [...misses.map((m3) => m3.text), query];
|
|
@@ -135721,8 +136058,11 @@ async function recallVector(all, query, limit2, embedder, index, mutex) {
|
|
|
135721
136058
|
}
|
|
135722
136059
|
for (const [j3, m3] of misses.entries()) {
|
|
135723
136060
|
const v3 = fresh[j3];
|
|
135724
|
-
if (Array.isArray(v3))
|
|
135725
|
-
|
|
136061
|
+
if (Array.isArray(v3)) {
|
|
136062
|
+
const entry = all[m3.index];
|
|
136063
|
+
assertDefined(entry, "m.index was recorded from the bounds-checked all[] loop");
|
|
136064
|
+
index.set(entry.frontmatter.name, m3.text, v3);
|
|
136065
|
+
}
|
|
135726
136066
|
}
|
|
135727
136067
|
index.prune(all.map((e3) => e3.frontmatter.name));
|
|
135728
136068
|
await index.flush();
|
|
@@ -135748,14 +136088,16 @@ function rankCosine(entries, vectors, query, limit2) {
|
|
|
135748
136088
|
}
|
|
135749
136089
|
const ranked = [];
|
|
135750
136090
|
for (let i2 = 0; i2 < entries.length; i2++) {
|
|
136091
|
+
const entry = entries[i2];
|
|
136092
|
+
assertDefined(entry, "loop index i < entries.length");
|
|
135751
136093
|
const vec = vectors[i2];
|
|
135752
136094
|
if (!Array.isArray(vec) || vec.length !== query.length) {
|
|
135753
|
-
console.warn(`[plugin-memory] skipping '${
|
|
136095
|
+
console.warn(`[plugin-memory] skipping '${entry.frontmatter.name}' in recall: vector dim ${Array.isArray(vec) ? vec.length : "missing"} != query dim ${query.length} (cache/embedder drift)`);
|
|
135754
136096
|
continue;
|
|
135755
136097
|
}
|
|
135756
136098
|
const score = cosineSimilarity(vec, query);
|
|
135757
136099
|
if (score > 0)
|
|
135758
|
-
ranked.push({ entry
|
|
136100
|
+
ranked.push({ entry, score });
|
|
135759
136101
|
}
|
|
135760
136102
|
ranked.sort((a2, b3) => b3.score - a2.score);
|
|
135761
136103
|
return ranked.slice(0, limit2);
|
|
@@ -136014,7 +136356,9 @@ function parseUserModel(text) {
|
|
|
136014
136356
|
seenHeading = true;
|
|
136015
136357
|
if (current)
|
|
136016
136358
|
sections.push({ title: current.title, content: current.body.join("\n").trim() });
|
|
136017
|
-
|
|
136359
|
+
const title = m3[1];
|
|
136360
|
+
assertDefined(title, "HEADING_RE capture group 1 is present on any match");
|
|
136361
|
+
current = { title: title.trim(), body: [] };
|
|
136018
136362
|
} else if (!seenHeading) {
|
|
136019
136363
|
preambleLines.push(line);
|
|
136020
136364
|
} else if (current) {
|
|
@@ -136203,7 +136547,8 @@ var consolidatedSchema = z$1.object({
|
|
|
136203
136547
|
tags: z$1.array(z$1.string().min(1)).optional()
|
|
136204
136548
|
});
|
|
136205
136549
|
function planConsolidation(entries, opts = {}) {
|
|
136206
|
-
const
|
|
136550
|
+
const tag2 = opts.tag;
|
|
136551
|
+
const filtered = tag2 ? entries.filter((e3) => (e3.frontmatter.tags ?? []).includes(tag2)) : entries;
|
|
136207
136552
|
if (filtered.length < 2) {
|
|
136208
136553
|
return { clusters: [], stable: filtered.map((e3) => e3.frontmatter.name) };
|
|
136209
136554
|
}
|
|
@@ -136215,6 +136560,7 @@ function planConsolidation(entries, opts = {}) {
|
|
|
136215
136560
|
tagless.push(e3);
|
|
136216
136561
|
} else {
|
|
136217
136562
|
const key = tags[0];
|
|
136563
|
+
assertDefined(key, "tags is non-empty here (tags.length === 0 handled above)");
|
|
136218
136564
|
const list = byTag.get(key) ?? [];
|
|
136219
136565
|
list.push(e3);
|
|
136220
136566
|
byTag.set(key, list);
|
|
@@ -136243,14 +136589,18 @@ function planConsolidation(entries, opts = {}) {
|
|
|
136243
136589
|
if (members.length >= 2) {
|
|
136244
136590
|
clusters.push({ key: `tag:${key}`, members: members.map((m3) => m3.frontmatter.name) });
|
|
136245
136591
|
} else {
|
|
136246
|
-
|
|
136592
|
+
const only = members[0];
|
|
136593
|
+
assertDefined(only, "byTag lists always carry \u22651 member");
|
|
136594
|
+
stable.push(only.frontmatter.name);
|
|
136247
136595
|
}
|
|
136248
136596
|
}
|
|
136249
136597
|
for (const cluster of descClusters) {
|
|
136250
136598
|
if (cluster.members.length >= 2) {
|
|
136251
136599
|
clusters.push({ key: cluster.key, members: cluster.members.map((m3) => m3.frontmatter.name) });
|
|
136252
136600
|
} else {
|
|
136253
|
-
|
|
136601
|
+
const only = cluster.members[0];
|
|
136602
|
+
assertDefined(only, "desc clusters are created with \u22651 member");
|
|
136603
|
+
stable.push(only.frontmatter.name);
|
|
136254
136604
|
}
|
|
136255
136605
|
}
|
|
136256
136606
|
return { clusters, stable };
|
|
@@ -136415,7 +136765,7 @@ function isAbortError(err) {
|
|
|
136415
136765
|
var MAX_JSON_SPAN = 64 * 1024;
|
|
136416
136766
|
function extractJson(text) {
|
|
136417
136767
|
const fenced = /```(?:json)?\n?([\s\S]*?)```/.exec(text);
|
|
136418
|
-
const candidate = fenced
|
|
136768
|
+
const candidate = fenced?.[1] ?? text;
|
|
136419
136769
|
const start = candidate.indexOf("{");
|
|
136420
136770
|
const end = candidate.lastIndexOf("}");
|
|
136421
136771
|
if (start === -1 || end <= start)
|
|
@@ -136698,8 +137048,12 @@ function buildMemoryPlugin(opts = {}) {
|
|
|
136698
137048
|
hooks: {
|
|
136699
137049
|
onInit: async (ctx) => {
|
|
136700
137050
|
embeddersReg = ctx.services.get("embedders") ?? null;
|
|
136701
|
-
|
|
136702
|
-
|
|
137051
|
+
const baseHooks = base2.hooks;
|
|
137052
|
+
if (baseHooks)
|
|
137053
|
+
await baseHooks.onInit?.(ctx);
|
|
137054
|
+
const consolidateHooks = consolidate.hooks;
|
|
137055
|
+
if (consolidateHooks)
|
|
137056
|
+
await consolidateHooks.onInit?.(ctx);
|
|
136703
137057
|
},
|
|
136704
137058
|
// A Plugin has a single onBeforeProviderCall, but this composed plugin
|
|
136705
137059
|
// carries TWO: base's always-on user-model injection and consolidate's
|
|
@@ -136707,10 +137061,12 @@ function buildMemoryPlugin(opts = {}) {
|
|
|
136707
137061
|
// block, the nudge appends its hint); either may return void to pass through.
|
|
136708
137062
|
onBeforeProviderCall: async (req, ctx) => {
|
|
136709
137063
|
let out;
|
|
136710
|
-
const
|
|
137064
|
+
const baseHooks = base2.hooks;
|
|
137065
|
+
const injected = baseHooks ? await baseHooks.onBeforeProviderCall?.(out ?? req, ctx) : void 0;
|
|
136711
137066
|
if (injected)
|
|
136712
137067
|
out = injected;
|
|
136713
|
-
const
|
|
137068
|
+
const consolidateHooks = consolidate.hooks;
|
|
137069
|
+
const nudged = consolidateHooks ? await consolidateHooks.onBeforeProviderCall?.(out ?? req, ctx) : void 0;
|
|
136714
137070
|
if (nudged)
|
|
136715
137071
|
out = nudged;
|
|
136716
137072
|
return out;
|