@moxxy/cli 0.28.1 → 0.30.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 +733 -333
- 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 {
|
|
@@ -104598,6 +104784,13 @@ var codexModels = [
|
|
|
104598
104784
|
// the proactive compactor's `estimatedTokens > 0.75 * contextWindow` gate
|
|
104599
104785
|
// unreachable, so every overflow fell through to the reactive
|
|
104600
104786
|
// compact-on-overflow retry. Keep these in step with the rest of the catalog.
|
|
104787
|
+
// GPT-5.6 family (GA July 9, 2026): served to ChatGPT-Pro/Plus subscribers
|
|
104788
|
+
// under the same ids the API uses (sol/terra/luna — no `-codex` variant).
|
|
104789
|
+
// Sol is OpenAI's default Codex model. The ChatGPT-plan window cap applies
|
|
104790
|
+
// here too, so keep them at 400k like the rest of this list.
|
|
104791
|
+
{ id: "gpt-5.6-sol", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true, supportsReasoning: true },
|
|
104792
|
+
{ id: "gpt-5.6-terra", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true, supportsReasoning: true },
|
|
104793
|
+
{ id: "gpt-5.6-luna", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true, supportsReasoning: true },
|
|
104601
104794
|
{ id: "gpt-5.5", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true, supportsReasoning: true },
|
|
104602
104795
|
{ id: "gpt-5.4", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true, supportsReasoning: true },
|
|
104603
104796
|
{ id: "gpt-5.4-mini", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true, supportsReasoning: true },
|
|
@@ -104605,7 +104798,7 @@ var codexModels = [
|
|
|
104605
104798
|
{ id: "gpt-5.3-codex-spark", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true, supportsReasoning: true },
|
|
104606
104799
|
{ id: "gpt-5.2", contextWindow: 4e5, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true, supportsReasoning: true }
|
|
104607
104800
|
];
|
|
104608
|
-
var DEFAULT_CODEX_MODEL = "gpt-5.
|
|
104801
|
+
var DEFAULT_CODEX_MODEL = "gpt-5.6-sol";
|
|
104609
104802
|
function contentBlocksToInputText(role, blocks) {
|
|
104610
104803
|
const out = [];
|
|
104611
104804
|
for (const block of blocks) {
|
|
@@ -104847,8 +105040,10 @@ function handleSseEvent(ev, pending, emitReasoning = false) {
|
|
|
104847
105040
|
if (type === "response.completed") {
|
|
104848
105041
|
const usage = ev.response?.usage;
|
|
104849
105042
|
const input = usage?.input_tokens ?? 0;
|
|
104850
|
-
const
|
|
104851
|
-
const
|
|
105043
|
+
const inputTokenDetails = usage?.input_tokens_details;
|
|
105044
|
+
const cacheRead = inputTokenDetails?.cached_tokens ?? 0;
|
|
105045
|
+
const incompleteDetails = ev.response?.incomplete_details;
|
|
105046
|
+
const incomplete = incompleteDetails?.reason;
|
|
104852
105047
|
let stopReason = "end_turn";
|
|
104853
105048
|
if (incomplete === "max_output_tokens")
|
|
104854
105049
|
stopReason = "max_tokens";
|
|
@@ -105292,6 +105487,9 @@ var openaiCodexProviderDef = defineProvider({
|
|
|
105292
105487
|
auth: {
|
|
105293
105488
|
kind: "oauth",
|
|
105294
105489
|
serviceName: "ChatGPT Pro/Plus",
|
|
105490
|
+
// The codex profile carries a device-flow adapter, so `codexLogin` honours
|
|
105491
|
+
// `ctx.headless` with a real no-browser flow — let hosts offer the choice.
|
|
105492
|
+
supportsHeadless: true,
|
|
105295
105493
|
login: codexLogin,
|
|
105296
105494
|
logout: codexLogout,
|
|
105297
105495
|
status: codexStatus
|
|
@@ -110208,7 +110406,9 @@ function toAnthropicTools(tools, opts = {}) {
|
|
|
110208
110406
|
input_schema: t2.inputJsonSchema ?? zodToJsonSchema(t2.inputSchema)
|
|
110209
110407
|
}));
|
|
110210
110408
|
if (opts.cacheLast && out.length > 0) {
|
|
110211
|
-
out[out.length - 1]
|
|
110409
|
+
const last = out[out.length - 1];
|
|
110410
|
+
assertDefined(last, "out is non-empty (length > 0 checked above)");
|
|
110411
|
+
last.cache_control = { type: "ephemeral" };
|
|
110212
110412
|
}
|
|
110213
110413
|
return out;
|
|
110214
110414
|
}
|
|
@@ -110540,7 +110740,9 @@ var AnthropicProvider = class {
|
|
|
110540
110740
|
const s2 = stream;
|
|
110541
110741
|
try {
|
|
110542
110742
|
s2.abort?.();
|
|
110543
|
-
s2.controller
|
|
110743
|
+
const controller = s2.controller;
|
|
110744
|
+
if (controller)
|
|
110745
|
+
controller.abort?.();
|
|
110544
110746
|
} catch {
|
|
110545
110747
|
}
|
|
110546
110748
|
}
|
|
@@ -114710,8 +114912,6 @@ var collabCommands = [
|
|
|
114710
114912
|
collabPauseCommand,
|
|
114711
114913
|
collabResumeCommand
|
|
114712
114914
|
];
|
|
114713
|
-
|
|
114714
|
-
// ../plugin-collab/dist/state.js
|
|
114715
114915
|
var MAX_MESSAGES = 5e3;
|
|
114716
114916
|
var MAX_MESSAGES_HARD = MAX_MESSAGES * 4;
|
|
114717
114917
|
function normPath(p3) {
|
|
@@ -114818,7 +115018,11 @@ var CollaborationState = class {
|
|
|
114818
115018
|
this.emitFn({ kind: "agent_done", agentId, summary, ...artifacts ? { artifacts } : {} });
|
|
114819
115019
|
}
|
|
114820
115020
|
allDone() {
|
|
114821
|
-
const live = this.agentOrder.map((id) =>
|
|
115021
|
+
const live = this.agentOrder.map((id) => {
|
|
115022
|
+
const agent = this.agents.get(id);
|
|
115023
|
+
assertDefined(agent, "agentOrder only ever holds live agent ids");
|
|
115024
|
+
return agent;
|
|
115025
|
+
}).filter((a2) => a2.status !== "crashed" && a2.status !== "killed" && a2.status !== "failed");
|
|
114822
115026
|
return live.length > 0 && live.every((a2) => a2.status === "done");
|
|
114823
115027
|
}
|
|
114824
115028
|
roleOf(agentId) {
|
|
@@ -114832,7 +115036,11 @@ var CollaborationState = class {
|
|
|
114832
115036
|
return {
|
|
114833
115037
|
self,
|
|
114834
115038
|
task: this.task,
|
|
114835
|
-
agents: this.agentOrder.map((id) =>
|
|
115039
|
+
agents: this.agentOrder.map((id) => {
|
|
115040
|
+
const agent = this.agents.get(id);
|
|
115041
|
+
assertDefined(agent, "agentOrder only ever holds live agent ids");
|
|
115042
|
+
return { ...agent };
|
|
115043
|
+
}),
|
|
114836
115044
|
control: { ...this.control }
|
|
114837
115045
|
};
|
|
114838
115046
|
}
|
|
@@ -114852,7 +115060,14 @@ var CollaborationState = class {
|
|
|
114852
115060
|
return { ...this.control };
|
|
114853
115061
|
}
|
|
114854
115062
|
doneSummaries() {
|
|
114855
|
-
return this.agentOrder.map((id) =>
|
|
115063
|
+
return this.agentOrder.map((id) => {
|
|
115064
|
+
const agent = this.agents.get(id);
|
|
115065
|
+
assertDefined(agent, "agentOrder only ever holds live agent ids");
|
|
115066
|
+
return agent;
|
|
115067
|
+
}).filter((a2) => a2.status === "done" && a2.doneSummary).map((a2) => {
|
|
115068
|
+
assertDefined(a2.doneSummary, "filtered to agents whose doneSummary is set");
|
|
115069
|
+
return { agentId: a2.id, summary: a2.doneSummary };
|
|
115070
|
+
});
|
|
114856
115071
|
}
|
|
114857
115072
|
// --- messaging ------------------------------------------------------------
|
|
114858
115073
|
post(from, to, body, subject) {
|
|
@@ -114925,7 +115140,11 @@ var CollaborationState = class {
|
|
|
114925
115140
|
}
|
|
114926
115141
|
// --- task board + file locks ----------------------------------------------
|
|
114927
115142
|
boardItems() {
|
|
114928
|
-
return this.boardOrder.map((id) =>
|
|
115143
|
+
return this.boardOrder.map((id) => {
|
|
115144
|
+
const item = this.board.get(id);
|
|
115145
|
+
assertDefined(item, "boardOrder only ever holds live board ids");
|
|
115146
|
+
return { ...item };
|
|
115147
|
+
});
|
|
114929
115148
|
}
|
|
114930
115149
|
boardAdd(by, title, detail, paths) {
|
|
114931
115150
|
const item = {
|
|
@@ -114960,6 +115179,7 @@ var CollaborationState = class {
|
|
|
114960
115179
|
conflictingOwner(claimant, paths) {
|
|
114961
115180
|
for (const id of this.boardOrder) {
|
|
114962
115181
|
const item = this.board.get(id);
|
|
115182
|
+
assertDefined(item, "boardOrder only ever holds live board ids");
|
|
114963
115183
|
if (!item.owner || item.owner === claimant || !item.paths)
|
|
114964
115184
|
continue;
|
|
114965
115185
|
if (item.status === "done")
|
|
@@ -115009,7 +115229,16 @@ var CollaborationState = class {
|
|
|
115009
115229
|
return { ok: true, item: { ...item } };
|
|
115010
115230
|
}
|
|
115011
115231
|
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) =>
|
|
115232
|
+
const targets = opts.id ? [this.board.get(opts.id)].filter((it4) => it4 !== void 0 && it4.owner === by) : this.boardOrder.map((id) => {
|
|
115233
|
+
const item = this.board.get(id);
|
|
115234
|
+
assertDefined(item, "boardOrder only ever holds live board ids");
|
|
115235
|
+
return item;
|
|
115236
|
+
}).filter((it4) => {
|
|
115237
|
+
if (it4.owner !== by || !it4.paths)
|
|
115238
|
+
return false;
|
|
115239
|
+
const itPaths = it4.paths;
|
|
115240
|
+
return opts.paths?.some((p3) => itPaths.some((q4) => pathsConflict(p3, q4))) ?? false;
|
|
115241
|
+
});
|
|
115013
115242
|
for (const item of targets) {
|
|
115014
115243
|
delete item.owner;
|
|
115015
115244
|
item.updatedBy = by;
|
|
@@ -115024,6 +115253,7 @@ var CollaborationState = class {
|
|
|
115024
115253
|
releaseAllFor(agentId) {
|
|
115025
115254
|
for (const id of this.boardOrder) {
|
|
115026
115255
|
const item = this.board.get(id);
|
|
115256
|
+
assertDefined(item, "boardOrder only ever holds live board ids");
|
|
115027
115257
|
if (item.owner !== agentId)
|
|
115028
115258
|
continue;
|
|
115029
115259
|
delete item.owner;
|
|
@@ -115034,7 +115264,11 @@ var CollaborationState = class {
|
|
|
115034
115264
|
}
|
|
115035
115265
|
// --- contracts ------------------------------------------------------------
|
|
115036
115266
|
contractList() {
|
|
115037
|
-
return this.contractOrder.map((id) =>
|
|
115267
|
+
return this.contractOrder.map((id) => {
|
|
115268
|
+
const entry = this.contracts.get(id);
|
|
115269
|
+
assertDefined(entry, "contractOrder only ever holds live contract ids");
|
|
115270
|
+
return { ...entry };
|
|
115271
|
+
});
|
|
115038
115272
|
}
|
|
115039
115273
|
contractPublish(by, spec) {
|
|
115040
115274
|
const entry = {
|
|
@@ -115070,7 +115304,9 @@ var CollaborationState = class {
|
|
|
115070
115304
|
entry.pendingChange = { ...entry.pendingChange, acks: [...entry.pendingChange.acks, by] };
|
|
115071
115305
|
}
|
|
115072
115306
|
const required = /* @__PURE__ */ new Set([entry.owner, ...entry.consumers]);
|
|
115073
|
-
const
|
|
115307
|
+
const pending = entry.pendingChange;
|
|
115308
|
+
assertDefined(pending, "pendingChange is guarded non-null at entry and only reassigned to a fresh object");
|
|
115309
|
+
const agreed = [...required].every((a2) => pending.acks.includes(a2));
|
|
115074
115310
|
return { entry: { ...entry }, agreed };
|
|
115075
115311
|
}
|
|
115076
115312
|
/**
|
|
@@ -115092,8 +115328,9 @@ var CollaborationState = class {
|
|
|
115092
115328
|
if (!authorized)
|
|
115093
115329
|
return null;
|
|
115094
115330
|
if (entry.pendingChange) {
|
|
115331
|
+
const pending = entry.pendingChange;
|
|
115095
115332
|
const required = /* @__PURE__ */ new Set([entry.owner, ...entry.consumers]);
|
|
115096
|
-
const agreed = [...required].every((a2) =>
|
|
115333
|
+
const agreed = [...required].every((a2) => pending.acks.includes(a2));
|
|
115097
115334
|
if (!agreed)
|
|
115098
115335
|
return null;
|
|
115099
115336
|
}
|
|
@@ -117613,6 +117850,7 @@ var ipcInputSchemas = {
|
|
|
117613
117850
|
let total = 0;
|
|
117614
117851
|
for (let i2 = 0; i2 < entries.length; i2++) {
|
|
117615
117852
|
const e3 = entries[i2];
|
|
117853
|
+
assertDefined(e3, "entry index is within the bounds of entries");
|
|
117616
117854
|
if (BASE64_ATTACHMENT_KINDS.has(e3.kind) && !BASE64_RE.test(e3.content)) {
|
|
117617
117855
|
ctx.addIssue({
|
|
117618
117856
|
code: z.ZodIssueCode.custom,
|
|
@@ -118942,7 +119180,9 @@ async function startE2EShim(opts) {
|
|
|
118942
119180
|
const wss = new import_websocket_server.default({ server: http2 });
|
|
118943
119181
|
wss.on("connection", (phone) => {
|
|
118944
119182
|
void handlePhone(phone, opts, bridgeHost).catch((err) => {
|
|
118945
|
-
opts.logger
|
|
119183
|
+
const logger2 = opts.logger;
|
|
119184
|
+
if (logger2?.warn)
|
|
119185
|
+
logger2.warn("e2e shim: connection failed", { err: String(err) });
|
|
118946
119186
|
try {
|
|
118947
119187
|
phone.close();
|
|
118948
119188
|
} catch {
|
|
@@ -118951,7 +119191,9 @@ async function startE2EShim(opts) {
|
|
|
118951
119191
|
});
|
|
118952
119192
|
await new Promise((resolve18) => http2.listen(0, "127.0.0.1", resolve18));
|
|
118953
119193
|
const port = http2.address().port;
|
|
118954
|
-
opts.logger
|
|
119194
|
+
const logger = opts.logger;
|
|
119195
|
+
if (logger?.info)
|
|
119196
|
+
logger.info("e2e shim listening", { port });
|
|
118955
119197
|
return {
|
|
118956
119198
|
port,
|
|
118957
119199
|
close: () => new Promise((resolve18) => {
|
|
@@ -118984,7 +119226,9 @@ async function handlePhone(phone, opts, bridgeHost) {
|
|
|
118984
119226
|
if (!authed) {
|
|
118985
119227
|
authed = true;
|
|
118986
119228
|
if (!bearerTokenMatches(text, opts.token)) {
|
|
118987
|
-
opts.logger
|
|
119229
|
+
const logger = opts.logger;
|
|
119230
|
+
if (logger?.warn)
|
|
119231
|
+
logger.warn("e2e shim: bad token, closing");
|
|
118988
119232
|
teardown();
|
|
118989
119233
|
return;
|
|
118990
119234
|
}
|
|
@@ -119216,7 +119460,9 @@ var MobileChannel = class {
|
|
|
119216
119460
|
*/
|
|
119217
119461
|
rotateToken() {
|
|
119218
119462
|
if (this.tokenPinned) {
|
|
119219
|
-
this.logger
|
|
119463
|
+
const logger = this.logger;
|
|
119464
|
+
if (logger?.warn)
|
|
119465
|
+
logger.warn("mobile token is pinned via MOXXY_MOBILE_TOKEN / config \u2014 rotate it at the source; the persisted secret is not used");
|
|
119220
119466
|
return this.token;
|
|
119221
119467
|
}
|
|
119222
119468
|
this.token = rotateMobileToken();
|
|
@@ -119226,7 +119472,11 @@ var MobileChannel = class {
|
|
|
119226
119472
|
async start(startOpts) {
|
|
119227
119473
|
const bus = new WebSocketCommandBus({ allowedCommands: null });
|
|
119228
119474
|
const host = new MobileSessionHost(bus, startOpts.session, {
|
|
119229
|
-
logErr: (err) =>
|
|
119475
|
+
logErr: (err) => {
|
|
119476
|
+
const logger = this.logger;
|
|
119477
|
+
if (logger?.warn)
|
|
119478
|
+
logger.warn("mobile host background error", { err: String(err) });
|
|
119479
|
+
}
|
|
119230
119480
|
});
|
|
119231
119481
|
this.host = host;
|
|
119232
119482
|
host.register();
|
|
@@ -119253,7 +119503,9 @@ var MobileChannel = class {
|
|
|
119253
119503
|
allowQueryToken: this.allowQueryToken
|
|
119254
119504
|
});
|
|
119255
119505
|
this.server = server;
|
|
119256
|
-
|
|
119506
|
+
const logger = this.logger;
|
|
119507
|
+
if (logger?.info)
|
|
119508
|
+
logger.info("mobile channel listening", { address: server.address });
|
|
119257
119509
|
let sawClient = false;
|
|
119258
119510
|
server.onConnection(() => {
|
|
119259
119511
|
sawClient = true;
|
|
@@ -119300,12 +119552,16 @@ var MobileChannel = class {
|
|
|
119300
119552
|
});
|
|
119301
119553
|
tunnelUrl = this.tunnel.url;
|
|
119302
119554
|
server.setAllowedOrigins([...localOrigins, connectUrlOrigin(tunnelUrl)]);
|
|
119303
|
-
|
|
119555
|
+
const logger2 = this.logger;
|
|
119556
|
+
if (logger2?.info)
|
|
119557
|
+
logger2.info("mobile tunnel open", { provider: provider.name, url: tunnelUrl });
|
|
119304
119558
|
} catch (err) {
|
|
119305
|
-
this.logger
|
|
119306
|
-
|
|
119307
|
-
|
|
119308
|
-
|
|
119559
|
+
const logger2 = this.logger;
|
|
119560
|
+
if (logger2?.warn)
|
|
119561
|
+
logger2.warn("mobile tunnel failed; using the local URL", {
|
|
119562
|
+
provider: provider.name,
|
|
119563
|
+
err: String(err)
|
|
119564
|
+
});
|
|
119309
119565
|
if (this.shim) {
|
|
119310
119566
|
await this.shim.close().catch(() => void 0);
|
|
119311
119567
|
this.shim = null;
|
|
@@ -119743,8 +119999,6 @@ init_dist();
|
|
|
119743
119999
|
|
|
119744
120000
|
// ../plugin-workflows/dist/schema.js
|
|
119745
120001
|
var import_yaml2 = __toESM(require_dist());
|
|
119746
|
-
|
|
119747
|
-
// ../plugin-workflows/dist/template.js
|
|
119748
120002
|
var REF_RE = /\{\{\s*([^}]+?)\s*\}\}/g;
|
|
119749
120003
|
function stringifyValue2(value) {
|
|
119750
120004
|
if (value == null)
|
|
@@ -119780,7 +120034,9 @@ function renderTemplate(text, scope, opts = {}) {
|
|
|
119780
120034
|
return text.replace(REF_RE, (_match, ref) => {
|
|
119781
120035
|
const value = resolveRef(ref.trim(), scope);
|
|
119782
120036
|
if (value === void 0) {
|
|
119783
|
-
|
|
120037
|
+
const logger = opts.logger;
|
|
120038
|
+
if (logger?.warn)
|
|
120039
|
+
logger.warn("workflow template: unresolved reference", { ref: ref.trim() });
|
|
119784
120040
|
return "";
|
|
119785
120041
|
}
|
|
119786
120042
|
return stringifyValue2(value);
|
|
@@ -119801,11 +120057,52 @@ function renderArgs(args, scope, opts = {}) {
|
|
|
119801
120057
|
return args;
|
|
119802
120058
|
}
|
|
119803
120059
|
var ATOM_PATTERNS = [
|
|
119804
|
-
{
|
|
119805
|
-
|
|
119806
|
-
|
|
119807
|
-
|
|
119808
|
-
|
|
120060
|
+
{
|
|
120061
|
+
re: /^(.+?)\s+is\s+not\s+empty$/i,
|
|
120062
|
+
build: (m3) => {
|
|
120063
|
+
const lhs = m3[1];
|
|
120064
|
+
assertDefined(lhs, "condition atom regex guarantees capture group 1");
|
|
120065
|
+
return { kind: "notEmpty", lhs: lhs.trim() };
|
|
120066
|
+
}
|
|
120067
|
+
},
|
|
120068
|
+
{
|
|
120069
|
+
re: /^(.+?)\s+is\s+empty$/i,
|
|
120070
|
+
build: (m3) => {
|
|
120071
|
+
const lhs = m3[1];
|
|
120072
|
+
assertDefined(lhs, "condition atom regex guarantees capture group 1");
|
|
120073
|
+
return { kind: "empty", lhs: lhs.trim() };
|
|
120074
|
+
}
|
|
120075
|
+
},
|
|
120076
|
+
{
|
|
120077
|
+
re: /^(.+?)\s+contains\s+"(.*)"$/i,
|
|
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: "contains", 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: "eq", lhs: lhs.trim(), literal: literal3 };
|
|
120094
|
+
}
|
|
120095
|
+
},
|
|
120096
|
+
{
|
|
120097
|
+
re: /^(.+?)\s+!=\s+"(.*)"$/,
|
|
120098
|
+
build: (m3) => {
|
|
120099
|
+
const lhs = m3[1];
|
|
120100
|
+
const literal3 = m3[2];
|
|
120101
|
+
assertDefined(lhs, "condition atom regex guarantees capture group 1");
|
|
120102
|
+
assertDefined(literal3, "condition atom regex guarantees capture group 2");
|
|
120103
|
+
return { kind: "neq", lhs: lhs.trim(), literal: literal3 };
|
|
120104
|
+
}
|
|
120105
|
+
}
|
|
119809
120106
|
];
|
|
119810
120107
|
function splitTop(expr, connective) {
|
|
119811
120108
|
const parts = [];
|
|
@@ -120007,10 +120304,12 @@ var stepSchema = z.object({
|
|
|
120007
120304
|
path: ["skill"]
|
|
120008
120305
|
});
|
|
120009
120306
|
} else if (present2.length > 1) {
|
|
120307
|
+
const second = present2[1];
|
|
120308
|
+
assertDefined(second, "present.length > 1 guarantees index 1 exists");
|
|
120010
120309
|
ctx.addIssue({
|
|
120011
120310
|
code: z.ZodIssueCode.custom,
|
|
120012
120311
|
message: `step "${step.id}" has multiple actions (${present2.join(", ")}); pick one`,
|
|
120013
|
-
path: [
|
|
120312
|
+
path: [second]
|
|
120014
120313
|
});
|
|
120015
120314
|
}
|
|
120016
120315
|
});
|
|
@@ -120156,6 +120455,7 @@ var workflowSchema = z.object({
|
|
|
120156
120455
|
if (owner == null)
|
|
120157
120456
|
continue;
|
|
120158
120457
|
const body = stepById.get(step.id);
|
|
120458
|
+
assertDefined(body, "stepById is built from wf.steps, so every step.id is a key");
|
|
120159
120459
|
if (body.condition != null || body.switch != null) {
|
|
120160
120460
|
ctx.addIssue({
|
|
120161
120461
|
code: z.ZodIssueCode.custom,
|
|
@@ -120354,11 +120654,12 @@ async function loadDir2(dir, scope, logger) {
|
|
|
120354
120654
|
try {
|
|
120355
120655
|
const st4 = await promises.stat(full);
|
|
120356
120656
|
if (st4.size > MAX_WORKFLOW_FILE_BYTES) {
|
|
120357
|
-
logger?.warn
|
|
120358
|
-
|
|
120359
|
-
|
|
120360
|
-
|
|
120361
|
-
|
|
120657
|
+
if (logger?.warn)
|
|
120658
|
+
logger.warn("workflow: file too large, skipping", {
|
|
120659
|
+
path: full,
|
|
120660
|
+
size: st4.size,
|
|
120661
|
+
max: MAX_WORKFLOW_FILE_BYTES
|
|
120662
|
+
});
|
|
120362
120663
|
continue;
|
|
120363
120664
|
}
|
|
120364
120665
|
} catch {
|
|
@@ -120367,15 +120668,17 @@ async function loadDir2(dir, scope, logger) {
|
|
|
120367
120668
|
try {
|
|
120368
120669
|
raw = await promises.readFile(full, "utf8");
|
|
120369
120670
|
} catch (err) {
|
|
120370
|
-
logger?.warn
|
|
120371
|
-
|
|
120372
|
-
|
|
120373
|
-
|
|
120671
|
+
if (logger?.warn)
|
|
120672
|
+
logger.warn("workflow: unreadable file, skipping", {
|
|
120673
|
+
path: full,
|
|
120674
|
+
error: err instanceof Error ? err.message : String(err)
|
|
120675
|
+
});
|
|
120374
120676
|
continue;
|
|
120375
120677
|
}
|
|
120376
120678
|
const result = parseWorkflowYaml(raw);
|
|
120377
120679
|
if (!result.ok || !result.workflow) {
|
|
120378
|
-
logger?.warn
|
|
120680
|
+
if (logger?.warn)
|
|
120681
|
+
logger.warn("workflow: invalid file, skipping", { path: full, errors: result.errors });
|
|
120379
120682
|
continue;
|
|
120380
120683
|
}
|
|
120381
120684
|
out.push({ workflow: result.workflow, path: full, scope });
|
|
@@ -120498,6 +120801,7 @@ var WorkflowStore = class {
|
|
|
120498
120801
|
const renamed = previousName != null && previousName !== workflow.name ? this.byName.get(previousName) : void 0;
|
|
120499
120802
|
if (renamed && (renamed.scope === "user" || renamed.scope === "project")) {
|
|
120500
120803
|
await promises.rm(renamed.path, { force: true });
|
|
120804
|
+
assertDefined(previousName, "renamed is only set when previousName != null");
|
|
120501
120805
|
this.byName.delete(previousName);
|
|
120502
120806
|
}
|
|
120503
120807
|
const existing = this.byName.get(workflow.name);
|
|
@@ -120647,8 +120951,6 @@ var WorkflowRunStore = class {
|
|
|
120647
120951
|
};
|
|
120648
120952
|
var DEFAULT_CHECKPOINT_TTL_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
120649
120953
|
var defaultWorkflowRunStore = new WorkflowRunStore();
|
|
120650
|
-
|
|
120651
|
-
// ../plugin-workflows/dist/logic-response.js
|
|
120652
120954
|
var PLAIN_PROMPT_MARKERS = [
|
|
120653
120955
|
"odpowiedz wy\u0142\u0105cznie zwyk\u0142ym tekstem",
|
|
120654
120956
|
"odpowiedz tylko zwyk\u0142ym tekstem",
|
|
@@ -120671,7 +120973,11 @@ function wantsPlainResponse(step) {
|
|
|
120671
120973
|
function stripJsonFence(raw) {
|
|
120672
120974
|
const trimmed = raw.trim();
|
|
120673
120975
|
const fence = /^```(?:json)?\s*([\s\S]*?)```$/i.exec(trimmed);
|
|
120674
|
-
|
|
120976
|
+
if (!fence)
|
|
120977
|
+
return trimmed;
|
|
120978
|
+
const body = fence[1];
|
|
120979
|
+
assertDefined(body, "a successful match guarantees capture group 1");
|
|
120980
|
+
return body.trim();
|
|
120675
120981
|
}
|
|
120676
120982
|
function parseJsonObject(raw) {
|
|
120677
120983
|
const parsed = JSON.parse(stripJsonFence(raw));
|
|
@@ -120782,7 +121088,9 @@ function mergeVars(ctx, vars) {
|
|
|
120782
121088
|
return;
|
|
120783
121089
|
for (const [key, value] of Object.entries(vars)) {
|
|
120784
121090
|
if (UNSAFE_VAR_KEYS.has(key)) {
|
|
120785
|
-
ctx.deps.logger
|
|
121091
|
+
const logger = ctx.deps.logger;
|
|
121092
|
+
if (logger?.warn)
|
|
121093
|
+
logger.warn("workflow vars: dropping prototype-pollution key", { key });
|
|
120786
121094
|
continue;
|
|
120787
121095
|
}
|
|
120788
121096
|
Object.defineProperty(ctx.vars, key, {
|
|
@@ -120844,6 +121152,7 @@ function restoreStates(raw) {
|
|
|
120844
121152
|
function buildStepResults(workflow, states) {
|
|
120845
121153
|
return workflow.steps.map((step) => {
|
|
120846
121154
|
const st4 = states.get(step.id);
|
|
121155
|
+
assertDefined(st4, "states has an entry for every workflow step");
|
|
120847
121156
|
const status = st4.status === "pending" ? "skipped" : st4.status;
|
|
120848
121157
|
return {
|
|
120849
121158
|
id: step.id,
|
|
@@ -120875,11 +121184,13 @@ async function runStep(step, scope, ctx) {
|
|
|
120875
121184
|
return await runStepOnce(step, scope, ctx);
|
|
120876
121185
|
} catch (err) {
|
|
120877
121186
|
lastError = err instanceof Error ? err.message : String(err);
|
|
120878
|
-
ctx.deps.logger
|
|
120879
|
-
|
|
120880
|
-
|
|
120881
|
-
|
|
120882
|
-
|
|
121187
|
+
const logger = ctx.deps.logger;
|
|
121188
|
+
if (logger?.warn)
|
|
121189
|
+
logger.warn("workflow step attempt failed", {
|
|
121190
|
+
step: step.id,
|
|
121191
|
+
attempt: attempt + 1,
|
|
121192
|
+
error: lastError
|
|
121193
|
+
});
|
|
120883
121194
|
}
|
|
120884
121195
|
}
|
|
120885
121196
|
return { ok: false, output: "", error: lastError };
|
|
@@ -120924,6 +121235,7 @@ async function runStepOnce(step, scope, ctx) {
|
|
|
120924
121235
|
}
|
|
120925
121236
|
async function runNestedWorkflow(step, scope, ctx, opts) {
|
|
120926
121237
|
const { deps } = ctx;
|
|
121238
|
+
assertDefined(step.workflow, "runNestedWorkflow is only invoked for workflow steps");
|
|
120927
121239
|
const nested = deps.lookup.workflow(step.workflow);
|
|
120928
121240
|
if (!nested)
|
|
120929
121241
|
throw new Error(`nested workflow "${step.workflow}" not found`);
|
|
@@ -120953,8 +121265,11 @@ async function runNestedWorkflow(step, scope, ctx, opts) {
|
|
|
120953
121265
|
function buildUpstreamBlock(step, scope) {
|
|
120954
121266
|
if (step.needs.length === 0)
|
|
120955
121267
|
return "";
|
|
120956
|
-
const parts = step.needs.map((id) =>
|
|
120957
|
-
|
|
121268
|
+
const parts = step.needs.map((id) => {
|
|
121269
|
+
const entry = scope.steps?.[id];
|
|
121270
|
+
return `### ${id}
|
|
121271
|
+
${entry?.output ?? ""}`;
|
|
121272
|
+
});
|
|
120958
121273
|
return `
|
|
120959
121274
|
|
|
120960
121275
|
## Upstream
|
|
@@ -121013,6 +121328,7 @@ async function runLogicStep(step, scope, ctx, opts) {
|
|
|
121013
121328
|
}
|
|
121014
121329
|
}
|
|
121015
121330
|
async function runLoopStep(step, ctx, opts) {
|
|
121331
|
+
assertDefined(step.loop, "runLoopStep is only invoked for loop steps");
|
|
121016
121332
|
const loop = step.loop;
|
|
121017
121333
|
const max = loop.maxIterations;
|
|
121018
121334
|
const bodySteps = loop.body.map((id) => ctx.workflow.steps.find((s2) => s2.id === id)).filter((s2) => s2 != null);
|
|
@@ -121025,6 +121341,7 @@ async function runLoopStep(step, ctx, opts) {
|
|
|
121025
121341
|
});
|
|
121026
121342
|
for (const body of bodySteps) {
|
|
121027
121343
|
const bst = ctx.states.get(body.id);
|
|
121344
|
+
assertDefined(bst, "loop body ids are real workflow steps with initialized state");
|
|
121028
121345
|
bst.status = "pending";
|
|
121029
121346
|
bst.output = "";
|
|
121030
121347
|
delete bst.error;
|
|
@@ -121034,6 +121351,7 @@ async function runLoopStep(step, ctx, opts) {
|
|
|
121034
121351
|
return { ok: false, output: lastBodyOutput, error: "aborted" };
|
|
121035
121352
|
const bodyScope = buildScope(ctx, new Date(ctx.now()).toISOString());
|
|
121036
121353
|
const bst = ctx.states.get(body.id);
|
|
121354
|
+
assertDefined(bst, "loop body ids are real workflow steps with initialized state");
|
|
121037
121355
|
bst.startedAt = ctx.now();
|
|
121038
121356
|
const outcome = await runStep(body, bodyScope, ctx);
|
|
121039
121357
|
bst.endedAt = ctx.now();
|
|
@@ -121053,11 +121371,13 @@ async function runLoopStep(step, ctx, opts) {
|
|
|
121053
121371
|
bst.status = "failed";
|
|
121054
121372
|
bst.error = outcome.error;
|
|
121055
121373
|
if (body.onError !== "continue") {
|
|
121056
|
-
ctx.deps.logger
|
|
121057
|
-
|
|
121058
|
-
body
|
|
121059
|
-
|
|
121060
|
-
|
|
121374
|
+
const logger2 = ctx.deps.logger;
|
|
121375
|
+
if (logger2?.warn)
|
|
121376
|
+
logger2.warn("workflow loop broke on body error", {
|
|
121377
|
+
step: step.id,
|
|
121378
|
+
body: body.id,
|
|
121379
|
+
error: outcome.error
|
|
121380
|
+
});
|
|
121061
121381
|
return {
|
|
121062
121382
|
ok: true,
|
|
121063
121383
|
output: `loop "${step.id}" broke on error in body step "${body.id}" after ${iteration + 1} iteration(s): ${outcome.error}` + (lastBodyOutput ? `
|
|
@@ -121080,7 +121400,9 @@ ${lastBodyOutput}`.trim()
|
|
|
121080
121400
|
};
|
|
121081
121401
|
}
|
|
121082
121402
|
}
|
|
121083
|
-
ctx.deps.logger
|
|
121403
|
+
const logger = ctx.deps.logger;
|
|
121404
|
+
if (logger?.warn)
|
|
121405
|
+
logger.warn("workflow loop hit max iterations", { step: step.id, maxIterations: max });
|
|
121084
121406
|
return {
|
|
121085
121407
|
ok: true,
|
|
121086
121408
|
output: `loop "${step.id}" reached max iterations (${max}); stopping.` + (lastBodyOutput ? `
|
|
@@ -121162,6 +121484,7 @@ async function runExecutorLoop(ctx, resumed = false) {
|
|
|
121162
121484
|
if (ctx.loopBodyIds.has(step.id))
|
|
121163
121485
|
continue;
|
|
121164
121486
|
const st4 = ctx.states.get(step.id);
|
|
121487
|
+
assertDefined(st4, "runExecutor initializes a state for every step");
|
|
121165
121488
|
if (st4.status !== "pending")
|
|
121166
121489
|
continue;
|
|
121167
121490
|
if (!step.needs.every(settled))
|
|
@@ -121200,6 +121523,7 @@ async function runExecutorLoop(ctx, resumed = false) {
|
|
|
121200
121523
|
if (ctx.loopBodyIds.has(step.id))
|
|
121201
121524
|
return false;
|
|
121202
121525
|
const st4 = ctx.states.get(step.id);
|
|
121526
|
+
assertDefined(st4, "runExecutor initializes a state for every step");
|
|
121203
121527
|
return st4.status === "pending" && step.needs.every(settled);
|
|
121204
121528
|
});
|
|
121205
121529
|
if (ready.length === 0) {
|
|
@@ -121216,6 +121540,7 @@ async function runExecutorLoop(ctx, resumed = false) {
|
|
|
121216
121540
|
if (aborted)
|
|
121217
121541
|
break;
|
|
121218
121542
|
const st4 = ctx.states.get(step.id);
|
|
121543
|
+
assertDefined(st4, "runExecutor initializes a state for every step");
|
|
121219
121544
|
st4.startedAt = ctx.now();
|
|
121220
121545
|
await deps.emit?.("workflow_step_started", {
|
|
121221
121546
|
id: step.id,
|
|
@@ -121224,6 +121549,8 @@ async function runExecutorLoop(ctx, resumed = false) {
|
|
|
121224
121549
|
const outcome = await runStep(step, scope, ctx);
|
|
121225
121550
|
st4.endedAt = ctx.now();
|
|
121226
121551
|
if (outcome.paused) {
|
|
121552
|
+
const interactionAgentId = outcome.interactionAgentId;
|
|
121553
|
+
assertDefined(interactionAgentId, "a paused outcome always carries interactionAgentId");
|
|
121227
121554
|
st4.status = "awaiting_input";
|
|
121228
121555
|
st4.output = outcome.output;
|
|
121229
121556
|
await deps.emit?.("workflow_step_awaiting_input", {
|
|
@@ -121242,7 +121569,7 @@ async function runExecutorLoop(ctx, resumed = false) {
|
|
|
121242
121569
|
// resume restores them (otherwise downstream `{{ vars.x }}` is lost).
|
|
121243
121570
|
vars: ctx.vars,
|
|
121244
121571
|
pendingStepId: step.id,
|
|
121245
|
-
interactionAgentId
|
|
121572
|
+
interactionAgentId,
|
|
121246
121573
|
startedAt: ctx.now()
|
|
121247
121574
|
});
|
|
121248
121575
|
await deps.emit?.("workflow_paused", {
|
|
@@ -121369,6 +121696,7 @@ async function resumeWorkflowRunInner(runId, userMessage, deps, store) {
|
|
|
121369
121696
|
};
|
|
121370
121697
|
mergeVars(ctx, checkpoint.vars);
|
|
121371
121698
|
const st4 = ctx.states.get(step.id);
|
|
121699
|
+
assertDefined(st4, "the paused step has a restored state in the checkpoint");
|
|
121372
121700
|
await deps.emit?.("workflow_resumed", { runId, stepId: step.id });
|
|
121373
121701
|
if (typeof deps.spawner.continue !== "function") {
|
|
121374
121702
|
st4.status = "failed";
|
|
@@ -121450,9 +121778,13 @@ async function runWorkflow(workflow, deps, opts = {}) {
|
|
|
121450
121778
|
const startedAt = (deps.now ?? Date.now)();
|
|
121451
121779
|
const result = await executor.run(workflow, deps);
|
|
121452
121780
|
if (opts.recordDir !== null) {
|
|
121453
|
-
await writeRunRecord2(workflow, result, startedAt, executor.name, deps, opts.recordDir ?? defaultRunRecordDir()).catch((err) =>
|
|
121454
|
-
|
|
121455
|
-
|
|
121781
|
+
await writeRunRecord2(workflow, result, startedAt, executor.name, deps, opts.recordDir ?? defaultRunRecordDir()).catch((err) => {
|
|
121782
|
+
const logger = deps.logger;
|
|
121783
|
+
if (logger?.warn)
|
|
121784
|
+
logger.warn("workflow: failed to write run record", {
|
|
121785
|
+
error: err instanceof Error ? err.message : String(err)
|
|
121786
|
+
});
|
|
121787
|
+
});
|
|
121456
121788
|
}
|
|
121457
121789
|
return result;
|
|
121458
121790
|
}
|
|
@@ -121991,6 +122323,7 @@ function validateTool(deps) {
|
|
|
121991
122323
|
const r2 = parseWorkflowYaml(yaml);
|
|
121992
122324
|
return { ok: r2.ok, errors: r2.errors };
|
|
121993
122325
|
}
|
|
122326
|
+
assertDefined(name, "input schema refine requires yaml or name; yaml handled above");
|
|
121994
122327
|
const entry = await deps.store.get(name);
|
|
121995
122328
|
if (!entry)
|
|
121996
122329
|
return { ok: false, errors: [`no workflow named "${name}"`] };
|
|
@@ -123270,6 +123603,13 @@ var BUILTIN_REQUIREMENTS = {
|
|
|
123270
123603
|
"hint": "discord resolves the vault from the service registry for its bot token + pairing; @moxxy/plugin-vault must load first"
|
|
123271
123604
|
}
|
|
123272
123605
|
],
|
|
123606
|
+
"@moxxy/plugin-channel-imessage": [
|
|
123607
|
+
{
|
|
123608
|
+
"kind": "plugin",
|
|
123609
|
+
"name": "@moxxy/plugin-vault",
|
|
123610
|
+
"hint": "imessage resolves the vault from the service registry for its BlueBubbles server URL + password + handle allow-list; @moxxy/plugin-vault must load first"
|
|
123611
|
+
}
|
|
123612
|
+
],
|
|
123273
123613
|
"@moxxy/plugin-channel-signal": [
|
|
123274
123614
|
{
|
|
123275
123615
|
"kind": "plugin",
|
|
@@ -123450,7 +123790,7 @@ function pluginDeps2(requirements) {
|
|
|
123450
123790
|
return out;
|
|
123451
123791
|
}
|
|
123452
123792
|
|
|
123453
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
123793
|
+
// ../../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
123794
|
var default_format = "RFC3986";
|
|
123455
123795
|
var formatters = {
|
|
123456
123796
|
RFC1738: (v3) => String(v3).replace(/%20/g, "+"),
|
|
@@ -123458,7 +123798,7 @@ var formatters = {
|
|
|
123458
123798
|
};
|
|
123459
123799
|
var RFC1738 = "RFC1738";
|
|
123460
123800
|
|
|
123461
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
123801
|
+
// ../../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
123802
|
var is_array = Array.isArray;
|
|
123463
123803
|
var hex_table = (() => {
|
|
123464
123804
|
const array3 = [];
|
|
@@ -123537,7 +123877,7 @@ function maybe_map(val, fn) {
|
|
|
123537
123877
|
return fn(val);
|
|
123538
123878
|
}
|
|
123539
123879
|
|
|
123540
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
123880
|
+
// ../../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
123881
|
var has = Object.prototype.hasOwnProperty;
|
|
123542
123882
|
var array_prefix_generators = {
|
|
123543
123883
|
brackets(prefix) {
|
|
@@ -123818,10 +124158,10 @@ function stringify2(object5, opts = {}) {
|
|
|
123818
124158
|
return joined.length > 0 ? prefix + joined : "";
|
|
123819
124159
|
}
|
|
123820
124160
|
|
|
123821
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
124161
|
+
// ../../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
124162
|
var VERSION2 = "4.104.0";
|
|
123823
124163
|
|
|
123824
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
124164
|
+
// ../../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
124165
|
var auto2 = false;
|
|
123826
124166
|
var kind2 = void 0;
|
|
123827
124167
|
var fetch4 = void 0;
|
|
@@ -123851,11 +124191,11 @@ function setShims2(shims, options = { auto: false }) {
|
|
|
123851
124191
|
isFsReadStream2 = shims.isFsReadStream;
|
|
123852
124192
|
}
|
|
123853
124193
|
|
|
123854
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
124194
|
+
// ../../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
124195
|
var import_agentkeepalive2 = __toESM(require_agentkeepalive());
|
|
123856
124196
|
var import_abort_controller2 = __toESM(require_abort_controller());
|
|
123857
124197
|
|
|
123858
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
124198
|
+
// ../../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
124199
|
var MultipartBody2 = class {
|
|
123860
124200
|
constructor(body) {
|
|
123861
124201
|
this.body = body;
|
|
@@ -123907,13 +124247,13 @@ function getRuntime2() {
|
|
|
123907
124247
|
};
|
|
123908
124248
|
}
|
|
123909
124249
|
|
|
123910
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
124250
|
+
// ../../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
124251
|
var init2 = () => {
|
|
123912
124252
|
if (!kind2) setShims2(getRuntime2(), { auto: true });
|
|
123913
124253
|
};
|
|
123914
124254
|
init2();
|
|
123915
124255
|
|
|
123916
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
124256
|
+
// ../../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
124257
|
var OpenAIError = class extends Error {
|
|
123918
124258
|
};
|
|
123919
124259
|
var APIError2 = class _APIError extends OpenAIError {
|
|
@@ -124017,7 +124357,7 @@ var ContentFilterFinishReasonError = class extends OpenAIError {
|
|
|
124017
124357
|
}
|
|
124018
124358
|
};
|
|
124019
124359
|
|
|
124020
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
124360
|
+
// ../../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
124361
|
var __classPrivateFieldSet9 = function(receiver, state, value, kind3, f3) {
|
|
124022
124362
|
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
124363
|
return state.set(receiver, value), value;
|
|
@@ -124126,7 +124466,7 @@ function findDoubleNewlineIndex2(buffer) {
|
|
|
124126
124466
|
return -1;
|
|
124127
124467
|
}
|
|
124128
124468
|
|
|
124129
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
124469
|
+
// ../../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
124470
|
function ReadableStreamToAsyncIterable2(stream) {
|
|
124131
124471
|
if (stream[Symbol.asyncIterator])
|
|
124132
124472
|
return stream;
|
|
@@ -124155,7 +124495,7 @@ function ReadableStreamToAsyncIterable2(stream) {
|
|
|
124155
124495
|
};
|
|
124156
124496
|
}
|
|
124157
124497
|
|
|
124158
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
124498
|
+
// ../../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
124499
|
var Stream4 = class _Stream {
|
|
124160
124500
|
constructor(iterator, controller) {
|
|
124161
124501
|
this.iterator = iterator;
|
|
@@ -124407,7 +124747,7 @@ function partition2(str2, delimiter2) {
|
|
|
124407
124747
|
return [str2, "", ""];
|
|
124408
124748
|
}
|
|
124409
124749
|
|
|
124410
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
124750
|
+
// ../../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
124751
|
var isResponseLike2 = (value) => value != null && typeof value === "object" && typeof value.url === "string" && typeof value.blob === "function";
|
|
124412
124752
|
var isFileLike3 = (value) => value != null && typeof value === "object" && typeof value.name === "string" && typeof value.lastModified === "number" && isBlobLike2(value);
|
|
124413
124753
|
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 +124837,7 @@ var addFormValue = async (form, key, value) => {
|
|
|
124497
124837
|
}
|
|
124498
124838
|
};
|
|
124499
124839
|
|
|
124500
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
124840
|
+
// ../../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
124841
|
var __classPrivateFieldSet10 = function(receiver, state, value, kind3, f3) {
|
|
124502
124842
|
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
124843
|
return state.set(receiver, value), value;
|
|
@@ -125265,7 +125605,7 @@ function isObj(obj) {
|
|
|
125265
125605
|
return obj != null && typeof obj === "object" && !Array.isArray(obj);
|
|
125266
125606
|
}
|
|
125267
125607
|
|
|
125268
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
125608
|
+
// ../../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
125609
|
var Page2 = class extends AbstractPage2 {
|
|
125270
125610
|
constructor(client2, response, body, options) {
|
|
125271
125611
|
super(client2, response, body, options);
|
|
@@ -125327,14 +125667,14 @@ var CursorPage = class extends AbstractPage2 {
|
|
|
125327
125667
|
}
|
|
125328
125668
|
};
|
|
125329
125669
|
|
|
125330
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
125670
|
+
// ../../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
125671
|
var APIResource2 = class {
|
|
125332
125672
|
constructor(client2) {
|
|
125333
125673
|
this._client = client2;
|
|
125334
125674
|
}
|
|
125335
125675
|
};
|
|
125336
125676
|
|
|
125337
|
-
// ../../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/messages.mjs
|
|
125338
125678
|
var Messages3 = class extends APIResource2 {
|
|
125339
125679
|
list(completionId, query = {}, options) {
|
|
125340
125680
|
if (isRequestOptions2(query)) {
|
|
@@ -125344,7 +125684,7 @@ var Messages3 = class extends APIResource2 {
|
|
|
125344
125684
|
}
|
|
125345
125685
|
};
|
|
125346
125686
|
|
|
125347
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
125687
|
+
// ../../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
125688
|
var Completions2 = class extends APIResource2 {
|
|
125349
125689
|
constructor() {
|
|
125350
125690
|
super(...arguments);
|
|
@@ -125409,7 +125749,7 @@ var ChatCompletionStoreMessagesPage = class extends CursorPage {
|
|
|
125409
125749
|
Completions2.ChatCompletionsPage = ChatCompletionsPage;
|
|
125410
125750
|
Completions2.Messages = Messages3;
|
|
125411
125751
|
|
|
125412
|
-
// ../../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/chat/chat.mjs
|
|
125413
125753
|
var Chat = class extends APIResource2 {
|
|
125414
125754
|
constructor() {
|
|
125415
125755
|
super(...arguments);
|
|
@@ -125419,7 +125759,7 @@ var Chat = class extends APIResource2 {
|
|
|
125419
125759
|
Chat.Completions = Completions2;
|
|
125420
125760
|
Chat.ChatCompletionsPage = ChatCompletionsPage;
|
|
125421
125761
|
|
|
125422
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
125762
|
+
// ../../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
125763
|
var Speech = class extends APIResource2 {
|
|
125424
125764
|
/**
|
|
125425
125765
|
* Generates audio from the input text.
|
|
@@ -125446,7 +125786,7 @@ var Speech = class extends APIResource2 {
|
|
|
125446
125786
|
}
|
|
125447
125787
|
};
|
|
125448
125788
|
|
|
125449
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
125789
|
+
// ../../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
125790
|
var Transcriptions = class extends APIResource2 {
|
|
125451
125791
|
create(body, options) {
|
|
125452
125792
|
return this._client.post("/audio/transcriptions", multipartFormRequestOptions({
|
|
@@ -125458,14 +125798,14 @@ var Transcriptions = class extends APIResource2 {
|
|
|
125458
125798
|
}
|
|
125459
125799
|
};
|
|
125460
125800
|
|
|
125461
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
125801
|
+
// ../../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
125802
|
var Translations = class extends APIResource2 {
|
|
125463
125803
|
create(body, options) {
|
|
125464
125804
|
return this._client.post("/audio/translations", multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model } }));
|
|
125465
125805
|
}
|
|
125466
125806
|
};
|
|
125467
125807
|
|
|
125468
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
125808
|
+
// ../../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
125809
|
var Audio = class extends APIResource2 {
|
|
125470
125810
|
constructor() {
|
|
125471
125811
|
super(...arguments);
|
|
@@ -125478,7 +125818,7 @@ Audio.Transcriptions = Transcriptions;
|
|
|
125478
125818
|
Audio.Translations = Translations;
|
|
125479
125819
|
Audio.Speech = Speech;
|
|
125480
125820
|
|
|
125481
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
125821
|
+
// ../../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
125822
|
var Batches3 = class extends APIResource2 {
|
|
125483
125823
|
/**
|
|
125484
125824
|
* Creates and executes a batch from an uploaded file of requests
|
|
@@ -125511,7 +125851,7 @@ var BatchesPage = class extends CursorPage {
|
|
|
125511
125851
|
};
|
|
125512
125852
|
Batches3.BatchesPage = BatchesPage;
|
|
125513
125853
|
|
|
125514
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
125854
|
+
// ../../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
125855
|
var __classPrivateFieldSet11 = function(receiver, state, value, kind3, f3) {
|
|
125516
125856
|
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
125857
|
return state.set(receiver, value), value;
|
|
@@ -125709,7 +126049,7 @@ _EventStream_connectedPromise = /* @__PURE__ */ new WeakMap(), _EventStream_reso
|
|
|
125709
126049
|
return this._emit("error", new OpenAIError(String(error2)));
|
|
125710
126050
|
};
|
|
125711
126051
|
|
|
125712
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
126052
|
+
// ../../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
126053
|
var __classPrivateFieldGet13 = function(receiver, state, kind3, f3) {
|
|
125714
126054
|
if (kind3 === "a" && !f3) throw new TypeError("Private accessor was defined without a getter");
|
|
125715
126055
|
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 +126587,7 @@ _AssistantStream_addEvent = function _AssistantStream_addEvent2(event) {
|
|
|
126247
126587
|
}
|
|
126248
126588
|
};
|
|
126249
126589
|
|
|
126250
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
126590
|
+
// ../../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
126591
|
var Assistants = class extends APIResource2 {
|
|
126252
126592
|
/**
|
|
126253
126593
|
* Create an assistant with a model and instructions.
|
|
@@ -126330,12 +126670,12 @@ var AssistantsPage = class extends CursorPage {
|
|
|
126330
126670
|
};
|
|
126331
126671
|
Assistants.AssistantsPage = AssistantsPage;
|
|
126332
126672
|
|
|
126333
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
126673
|
+
// ../../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
126674
|
function isRunnableFunctionWithParse(fn) {
|
|
126335
126675
|
return typeof fn.parse === "function";
|
|
126336
126676
|
}
|
|
126337
126677
|
|
|
126338
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
126678
|
+
// ../../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
126679
|
var isAssistantMessage = (message) => {
|
|
126340
126680
|
return message?.role === "assistant";
|
|
126341
126681
|
};
|
|
@@ -126346,7 +126686,7 @@ var isToolMessage = (message) => {
|
|
|
126346
126686
|
return message?.role === "tool";
|
|
126347
126687
|
};
|
|
126348
126688
|
|
|
126349
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
126689
|
+
// ../../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
126690
|
function isAutoParsableResponseFormat(response_format) {
|
|
126351
126691
|
return response_format?.["$brand"] === "auto-parseable-response-format";
|
|
126352
126692
|
}
|
|
@@ -126439,7 +126779,7 @@ function validateInputTools(tools) {
|
|
|
126439
126779
|
}
|
|
126440
126780
|
}
|
|
126441
126781
|
|
|
126442
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
126782
|
+
// ../../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
126783
|
var __classPrivateFieldGet14 = function(receiver, state, kind3, f3) {
|
|
126444
126784
|
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
126785
|
return kind3 === "m" ? f3 : kind3 === "a" ? f3.call(receiver) : f3 ? f3.value : state.get(receiver);
|
|
@@ -126784,7 +127124,7 @@ _AbstractChatCompletionRunner_instances = /* @__PURE__ */ new WeakSet(), _Abstra
|
|
|
126784
127124
|
return typeof rawContent === "string" ? rawContent : rawContent === void 0 ? "undefined" : JSON.stringify(rawContent);
|
|
126785
127125
|
};
|
|
126786
127126
|
|
|
126787
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
127127
|
+
// ../../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
127128
|
var ChatCompletionRunner = class _ChatCompletionRunner extends AbstractChatCompletionRunner {
|
|
126789
127129
|
/** @deprecated - please use `runTools` instead. */
|
|
126790
127130
|
static runFunctions(client2, params, options) {
|
|
@@ -126813,7 +127153,7 @@ var ChatCompletionRunner = class _ChatCompletionRunner extends AbstractChatCompl
|
|
|
126813
127153
|
}
|
|
126814
127154
|
};
|
|
126815
127155
|
|
|
126816
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
127156
|
+
// ../../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
127157
|
var STR = 1;
|
|
126818
127158
|
var NUM = 2;
|
|
126819
127159
|
var ARR = 4;
|
|
@@ -127025,7 +127365,7 @@ var _parseJSON = (jsonString, allow) => {
|
|
|
127025
127365
|
};
|
|
127026
127366
|
var partialParse2 = (input) => parseJSON(input, Allow.ALL ^ Allow.NUM);
|
|
127027
127367
|
|
|
127028
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
127368
|
+
// ../../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
127369
|
var __classPrivateFieldSet13 = function(receiver, state, value, kind3, f3) {
|
|
127030
127370
|
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
127371
|
return state.set(receiver, value), value;
|
|
@@ -127509,7 +127849,7 @@ function str(x4) {
|
|
|
127509
127849
|
function assertNever2(_x) {
|
|
127510
127850
|
}
|
|
127511
127851
|
|
|
127512
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
127852
|
+
// ../../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
127853
|
var ChatCompletionStreamingRunner = class _ChatCompletionStreamingRunner extends ChatCompletionStream {
|
|
127514
127854
|
static fromReadableStream(stream) {
|
|
127515
127855
|
const runner = new _ChatCompletionStreamingRunner(null);
|
|
@@ -127540,7 +127880,7 @@ var ChatCompletionStreamingRunner = class _ChatCompletionStreamingRunner extends
|
|
|
127540
127880
|
}
|
|
127541
127881
|
};
|
|
127542
127882
|
|
|
127543
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
127883
|
+
// ../../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
127884
|
var Completions3 = class extends APIResource2 {
|
|
127545
127885
|
parse(body, options) {
|
|
127546
127886
|
validateInputTools(body.tools);
|
|
@@ -127572,7 +127912,7 @@ var Completions3 = class extends APIResource2 {
|
|
|
127572
127912
|
}
|
|
127573
127913
|
};
|
|
127574
127914
|
|
|
127575
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
127915
|
+
// ../../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
127916
|
var Chat2 = class extends APIResource2 {
|
|
127577
127917
|
constructor() {
|
|
127578
127918
|
super(...arguments);
|
|
@@ -127583,7 +127923,7 @@ var Chat2 = class extends APIResource2 {
|
|
|
127583
127923
|
Chat3.Completions = Completions3;
|
|
127584
127924
|
})(Chat2 || (Chat2 = {}));
|
|
127585
127925
|
|
|
127586
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
127926
|
+
// ../../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
127927
|
var Sessions = class extends APIResource2 {
|
|
127588
127928
|
/**
|
|
127589
127929
|
* Create an ephemeral API token for use in client-side applications with the
|
|
@@ -127609,7 +127949,7 @@ var Sessions = class extends APIResource2 {
|
|
|
127609
127949
|
}
|
|
127610
127950
|
};
|
|
127611
127951
|
|
|
127612
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
127952
|
+
// ../../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
127953
|
var TranscriptionSessions = class extends APIResource2 {
|
|
127614
127954
|
/**
|
|
127615
127955
|
* Create an ephemeral API token for use in client-side applications with the
|
|
@@ -127635,7 +127975,7 @@ var TranscriptionSessions = class extends APIResource2 {
|
|
|
127635
127975
|
}
|
|
127636
127976
|
};
|
|
127637
127977
|
|
|
127638
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
127978
|
+
// ../../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
127979
|
var Realtime = class extends APIResource2 {
|
|
127640
127980
|
constructor() {
|
|
127641
127981
|
super(...arguments);
|
|
@@ -127646,7 +127986,7 @@ var Realtime = class extends APIResource2 {
|
|
|
127646
127986
|
Realtime.Sessions = Sessions;
|
|
127647
127987
|
Realtime.TranscriptionSessions = TranscriptionSessions;
|
|
127648
127988
|
|
|
127649
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
127989
|
+
// ../../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
127990
|
var Messages4 = class extends APIResource2 {
|
|
127651
127991
|
/**
|
|
127652
127992
|
* Create a message.
|
|
@@ -127709,7 +128049,7 @@ var MessagesPage = class extends CursorPage {
|
|
|
127709
128049
|
};
|
|
127710
128050
|
Messages4.MessagesPage = MessagesPage;
|
|
127711
128051
|
|
|
127712
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128052
|
+
// ../../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
128053
|
var Steps = class extends APIResource2 {
|
|
127714
128054
|
retrieve(threadId, runId, stepId, query = {}, options) {
|
|
127715
128055
|
if (isRequestOptions2(query)) {
|
|
@@ -127736,7 +128076,7 @@ var RunStepsPage = class extends CursorPage {
|
|
|
127736
128076
|
};
|
|
127737
128077
|
Steps.RunStepsPage = RunStepsPage;
|
|
127738
128078
|
|
|
127739
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128079
|
+
// ../../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
128080
|
var Runs = class extends APIResource2 {
|
|
127741
128081
|
constructor() {
|
|
127742
128082
|
super(...arguments);
|
|
@@ -127896,7 +128236,7 @@ Runs.RunsPage = RunsPage;
|
|
|
127896
128236
|
Runs.Steps = Steps;
|
|
127897
128237
|
Runs.RunStepsPage = RunStepsPage;
|
|
127898
128238
|
|
|
127899
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128239
|
+
// ../../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
128240
|
var Threads = class extends APIResource2 {
|
|
127901
128241
|
constructor() {
|
|
127902
128242
|
super(...arguments);
|
|
@@ -127976,7 +128316,7 @@ Threads.RunsPage = RunsPage;
|
|
|
127976
128316
|
Threads.Messages = Messages4;
|
|
127977
128317
|
Threads.MessagesPage = MessagesPage;
|
|
127978
128318
|
|
|
127979
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128319
|
+
// ../../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
128320
|
var Beta2 = class extends APIResource2 {
|
|
127981
128321
|
constructor() {
|
|
127982
128322
|
super(...arguments);
|
|
@@ -127991,14 +128331,14 @@ Beta2.Assistants = Assistants;
|
|
|
127991
128331
|
Beta2.AssistantsPage = AssistantsPage;
|
|
127992
128332
|
Beta2.Threads = Threads;
|
|
127993
128333
|
|
|
127994
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128334
|
+
// ../../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
128335
|
var Completions4 = class extends APIResource2 {
|
|
127996
128336
|
create(body, options) {
|
|
127997
128337
|
return this._client.post("/completions", { body, ...options, stream: body.stream ?? false });
|
|
127998
128338
|
}
|
|
127999
128339
|
};
|
|
128000
128340
|
|
|
128001
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128341
|
+
// ../../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
128342
|
var Content = class extends APIResource2 {
|
|
128003
128343
|
/**
|
|
128004
128344
|
* Retrieve Container File Content
|
|
@@ -128012,7 +128352,7 @@ var Content = class extends APIResource2 {
|
|
|
128012
128352
|
}
|
|
128013
128353
|
};
|
|
128014
128354
|
|
|
128015
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128355
|
+
// ../../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
128356
|
var Files = class extends APIResource2 {
|
|
128017
128357
|
constructor() {
|
|
128018
128358
|
super(...arguments);
|
|
@@ -128057,7 +128397,7 @@ var FileListResponsesPage = class extends CursorPage {
|
|
|
128057
128397
|
Files.FileListResponsesPage = FileListResponsesPage;
|
|
128058
128398
|
Files.Content = Content;
|
|
128059
128399
|
|
|
128060
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128400
|
+
// ../../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
128401
|
var Containers = class extends APIResource2 {
|
|
128062
128402
|
constructor() {
|
|
128063
128403
|
super(...arguments);
|
|
@@ -128097,7 +128437,7 @@ Containers.ContainerListResponsesPage = ContainerListResponsesPage;
|
|
|
128097
128437
|
Containers.Files = Files;
|
|
128098
128438
|
Containers.FileListResponsesPage = FileListResponsesPage;
|
|
128099
128439
|
|
|
128100
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128440
|
+
// ../../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
128441
|
var Embeddings = class extends APIResource2 {
|
|
128102
128442
|
/**
|
|
128103
128443
|
* Creates an embedding vector representing the input text.
|
|
@@ -128140,7 +128480,7 @@ var Embeddings = class extends APIResource2 {
|
|
|
128140
128480
|
}
|
|
128141
128481
|
};
|
|
128142
128482
|
|
|
128143
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128483
|
+
// ../../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
128484
|
var OutputItems = class extends APIResource2 {
|
|
128145
128485
|
/**
|
|
128146
128486
|
* Get an evaluation run output item by ID.
|
|
@@ -128159,7 +128499,7 @@ var OutputItemListResponsesPage = class extends CursorPage {
|
|
|
128159
128499
|
};
|
|
128160
128500
|
OutputItems.OutputItemListResponsesPage = OutputItemListResponsesPage;
|
|
128161
128501
|
|
|
128162
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128502
|
+
// ../../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
128503
|
var Runs2 = class extends APIResource2 {
|
|
128164
128504
|
constructor() {
|
|
128165
128505
|
super(...arguments);
|
|
@@ -128204,7 +128544,7 @@ Runs2.RunListResponsesPage = RunListResponsesPage;
|
|
|
128204
128544
|
Runs2.OutputItems = OutputItems;
|
|
128205
128545
|
Runs2.OutputItemListResponsesPage = OutputItemListResponsesPage;
|
|
128206
128546
|
|
|
128207
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128547
|
+
// ../../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
128548
|
var Evals = class extends APIResource2 {
|
|
128209
128549
|
constructor() {
|
|
128210
128550
|
super(...arguments);
|
|
@@ -128252,7 +128592,7 @@ Evals.EvalListResponsesPage = EvalListResponsesPage;
|
|
|
128252
128592
|
Evals.Runs = Runs2;
|
|
128253
128593
|
Evals.RunListResponsesPage = RunListResponsesPage;
|
|
128254
128594
|
|
|
128255
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128595
|
+
// ../../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
128596
|
var Files2 = class extends APIResource2 {
|
|
128257
128597
|
/**
|
|
128258
128598
|
* Upload a file that can be used across various endpoints. Individual files can be
|
|
@@ -128339,11 +128679,11 @@ var FileObjectsPage = class extends CursorPage {
|
|
|
128339
128679
|
};
|
|
128340
128680
|
Files2.FileObjectsPage = FileObjectsPage;
|
|
128341
128681
|
|
|
128342
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128682
|
+
// ../../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
128683
|
var Methods = class extends APIResource2 {
|
|
128344
128684
|
};
|
|
128345
128685
|
|
|
128346
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128686
|
+
// ../../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
128687
|
var Graders = class extends APIResource2 {
|
|
128348
128688
|
/**
|
|
128349
128689
|
* Run a grader.
|
|
@@ -128388,7 +128728,7 @@ var Graders = class extends APIResource2 {
|
|
|
128388
128728
|
}
|
|
128389
128729
|
};
|
|
128390
128730
|
|
|
128391
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128731
|
+
// ../../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
128732
|
var Alpha = class extends APIResource2 {
|
|
128393
128733
|
constructor() {
|
|
128394
128734
|
super(...arguments);
|
|
@@ -128397,7 +128737,7 @@ var Alpha = class extends APIResource2 {
|
|
|
128397
128737
|
};
|
|
128398
128738
|
Alpha.Graders = Graders;
|
|
128399
128739
|
|
|
128400
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128740
|
+
// ../../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
128741
|
var Permissions = class extends APIResource2 {
|
|
128402
128742
|
/**
|
|
128403
128743
|
* **NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys).
|
|
@@ -128451,7 +128791,7 @@ var PermissionCreateResponsesPage = class extends Page2 {
|
|
|
128451
128791
|
};
|
|
128452
128792
|
Permissions.PermissionCreateResponsesPage = PermissionCreateResponsesPage;
|
|
128453
128793
|
|
|
128454
|
-
// ../../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/checkpoints/checkpoints.mjs
|
|
128455
128795
|
var Checkpoints = class extends APIResource2 {
|
|
128456
128796
|
constructor() {
|
|
128457
128797
|
super(...arguments);
|
|
@@ -128461,7 +128801,7 @@ var Checkpoints = class extends APIResource2 {
|
|
|
128461
128801
|
Checkpoints.Permissions = Permissions;
|
|
128462
128802
|
Checkpoints.PermissionCreateResponsesPage = PermissionCreateResponsesPage;
|
|
128463
128803
|
|
|
128464
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128804
|
+
// ../../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
128805
|
var Checkpoints2 = class extends APIResource2 {
|
|
128466
128806
|
list(fineTuningJobId, query = {}, options) {
|
|
128467
128807
|
if (isRequestOptions2(query)) {
|
|
@@ -128474,7 +128814,7 @@ var FineTuningJobCheckpointsPage = class extends CursorPage {
|
|
|
128474
128814
|
};
|
|
128475
128815
|
Checkpoints2.FineTuningJobCheckpointsPage = FineTuningJobCheckpointsPage;
|
|
128476
128816
|
|
|
128477
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128817
|
+
// ../../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
128818
|
var Jobs = class extends APIResource2 {
|
|
128479
128819
|
constructor() {
|
|
128480
128820
|
super(...arguments);
|
|
@@ -128579,7 +128919,7 @@ Jobs.FineTuningJobEventsPage = FineTuningJobEventsPage;
|
|
|
128579
128919
|
Jobs.Checkpoints = Checkpoints2;
|
|
128580
128920
|
Jobs.FineTuningJobCheckpointsPage = FineTuningJobCheckpointsPage;
|
|
128581
128921
|
|
|
128582
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128922
|
+
// ../../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
128923
|
var FineTuning = class extends APIResource2 {
|
|
128584
128924
|
constructor() {
|
|
128585
128925
|
super(...arguments);
|
|
@@ -128596,11 +128936,11 @@ FineTuning.FineTuningJobEventsPage = FineTuningJobEventsPage;
|
|
|
128596
128936
|
FineTuning.Checkpoints = Checkpoints;
|
|
128597
128937
|
FineTuning.Alpha = Alpha;
|
|
128598
128938
|
|
|
128599
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128939
|
+
// ../../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
128940
|
var GraderModels = class extends APIResource2 {
|
|
128601
128941
|
};
|
|
128602
128942
|
|
|
128603
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128943
|
+
// ../../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
128944
|
var Graders2 = class extends APIResource2 {
|
|
128605
128945
|
constructor() {
|
|
128606
128946
|
super(...arguments);
|
|
@@ -128609,7 +128949,7 @@ var Graders2 = class extends APIResource2 {
|
|
|
128609
128949
|
};
|
|
128610
128950
|
Graders2.GraderModels = GraderModels;
|
|
128611
128951
|
|
|
128612
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128952
|
+
// ../../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
128953
|
var Images = class extends APIResource2 {
|
|
128614
128954
|
/**
|
|
128615
128955
|
* Creates a variation of a given image. This endpoint only supports `dall-e-2`.
|
|
@@ -128655,7 +128995,7 @@ var Images = class extends APIResource2 {
|
|
|
128655
128995
|
}
|
|
128656
128996
|
};
|
|
128657
128997
|
|
|
128658
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
128998
|
+
// ../../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
128999
|
var Models3 = class extends APIResource2 {
|
|
128660
129000
|
/**
|
|
128661
129001
|
* Retrieves a model instance, providing basic information about the model such as
|
|
@@ -128683,7 +129023,7 @@ var ModelsPage = class extends Page2 {
|
|
|
128683
129023
|
};
|
|
128684
129024
|
Models3.ModelsPage = ModelsPage;
|
|
128685
129025
|
|
|
128686
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
129026
|
+
// ../../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
129027
|
var Moderations = class extends APIResource2 {
|
|
128688
129028
|
/**
|
|
128689
129029
|
* Classifies if text and/or image inputs are potentially harmful. Learn more in
|
|
@@ -128694,7 +129034,7 @@ var Moderations = class extends APIResource2 {
|
|
|
128694
129034
|
}
|
|
128695
129035
|
};
|
|
128696
129036
|
|
|
128697
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
129037
|
+
// ../../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
129038
|
function maybeParseResponse(response, params) {
|
|
128699
129039
|
if (!params || !hasAutoParseableInput2(params)) {
|
|
128700
129040
|
return {
|
|
@@ -128815,7 +129155,7 @@ function addOutputText(rsp) {
|
|
|
128815
129155
|
rsp.output_text = texts.join("");
|
|
128816
129156
|
}
|
|
128817
129157
|
|
|
128818
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
129158
|
+
// ../../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
129159
|
var InputItems = class extends APIResource2 {
|
|
128820
129160
|
list(responseId, query = {}, options) {
|
|
128821
129161
|
if (isRequestOptions2(query)) {
|
|
@@ -128828,7 +129168,7 @@ var InputItems = class extends APIResource2 {
|
|
|
128828
129168
|
}
|
|
128829
129169
|
};
|
|
128830
129170
|
|
|
128831
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
129171
|
+
// ../../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
129172
|
var __classPrivateFieldSet14 = function(receiver, state, value, kind3, f3) {
|
|
128833
129173
|
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
129174
|
return state.set(receiver, value), value;
|
|
@@ -129075,7 +129415,7 @@ function finalizeResponse(snapshot, params) {
|
|
|
129075
129415
|
return maybeParseResponse(snapshot, params);
|
|
129076
129416
|
}
|
|
129077
129417
|
|
|
129078
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
129418
|
+
// ../../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
129419
|
var Responses = class extends APIResource2 {
|
|
129080
129420
|
constructor() {
|
|
129081
129421
|
super(...arguments);
|
|
@@ -129144,7 +129484,7 @@ var ResponseItemsPage = class extends CursorPage {
|
|
|
129144
129484
|
};
|
|
129145
129485
|
Responses.InputItems = InputItems;
|
|
129146
129486
|
|
|
129147
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
129487
|
+
// ../../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
129488
|
var Parts = class extends APIResource2 {
|
|
129149
129489
|
/**
|
|
129150
129490
|
* Adds a
|
|
@@ -129164,7 +129504,7 @@ var Parts = class extends APIResource2 {
|
|
|
129164
129504
|
}
|
|
129165
129505
|
};
|
|
129166
129506
|
|
|
129167
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
129507
|
+
// ../../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
129508
|
var Uploads = class extends APIResource2 {
|
|
129169
129509
|
constructor() {
|
|
129170
129510
|
super(...arguments);
|
|
@@ -129221,7 +129561,7 @@ var Uploads = class extends APIResource2 {
|
|
|
129221
129561
|
};
|
|
129222
129562
|
Uploads.Parts = Parts;
|
|
129223
129563
|
|
|
129224
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
129564
|
+
// ../../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
129565
|
var allSettledWithThrow = async (promises) => {
|
|
129226
129566
|
const results = await Promise.allSettled(promises);
|
|
129227
129567
|
const rejected = results.filter((result) => result.status === "rejected");
|
|
@@ -129240,7 +129580,7 @@ var allSettledWithThrow = async (promises) => {
|
|
|
129240
129580
|
return values;
|
|
129241
129581
|
};
|
|
129242
129582
|
|
|
129243
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
129583
|
+
// ../../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
129584
|
var Files3 = class extends APIResource2 {
|
|
129245
129585
|
/**
|
|
129246
129586
|
* Create a vector store file by attaching a
|
|
@@ -129372,7 +129712,7 @@ var FileContentResponsesPage = class extends Page2 {
|
|
|
129372
129712
|
Files3.VectorStoreFilesPage = VectorStoreFilesPage;
|
|
129373
129713
|
Files3.FileContentResponsesPage = FileContentResponsesPage;
|
|
129374
129714
|
|
|
129375
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
129715
|
+
// ../../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
129716
|
var FileBatches = class extends APIResource2 {
|
|
129377
129717
|
/**
|
|
129378
129718
|
* Create a vector store file batch.
|
|
@@ -129483,7 +129823,7 @@ var FileBatches = class extends APIResource2 {
|
|
|
129483
129823
|
}
|
|
129484
129824
|
};
|
|
129485
129825
|
|
|
129486
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
129826
|
+
// ../../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
129827
|
var VectorStores = class extends APIResource2 {
|
|
129488
129828
|
constructor() {
|
|
129489
129829
|
super(...arguments);
|
|
@@ -129562,7 +129902,7 @@ VectorStores.VectorStoreFilesPage = VectorStoreFilesPage;
|
|
|
129562
129902
|
VectorStores.FileContentResponsesPage = FileContentResponsesPage;
|
|
129563
129903
|
VectorStores.FileBatches = FileBatches;
|
|
129564
129904
|
|
|
129565
|
-
// ../../node_modules/.pnpm/openai@4.104.0_encoding@0.1.13_ws@8.
|
|
129905
|
+
// ../../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
129906
|
var _a2;
|
|
129567
129907
|
var OpenAI = class extends APIClient2 {
|
|
129568
129908
|
/**
|
|
@@ -129776,7 +130116,14 @@ function toOpenAITools(tools) {
|
|
|
129776
130116
|
// ../plugin-provider-openai/dist/provider.js
|
|
129777
130117
|
var DEFAULT_TIMEOUT_MS = 12e4;
|
|
129778
130118
|
var openAIModels = [
|
|
129779
|
-
// GPT-5.
|
|
130119
|
+
// GPT-5.6 family (GA July 9, 2026): three-tier frontier class, knowledge
|
|
130120
|
+
// cutoff Feb 16, 2026. Sol = flagship, Terra = balanced, Luna = fast/cheap.
|
|
130121
|
+
// All share the 1,050,000-token window and 128k max output; pick by cost:
|
|
130122
|
+
// Sol $5/$30, Terra $2.50/$15, Luna $1/$6 per 1M in/out tokens.
|
|
130123
|
+
{ id: "gpt-5.6-sol", contextWindow: 105e4, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true, supportsReasoning: true },
|
|
130124
|
+
{ id: "gpt-5.6-terra", contextWindow: 105e4, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true, supportsReasoning: true },
|
|
130125
|
+
{ id: "gpt-5.6-luna", contextWindow: 105e4, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true, supportsReasoning: true },
|
|
130126
|
+
// GPT-5.5 family (released April 23, 2026): prior frontier class.
|
|
129780
130127
|
{ id: "gpt-5.5", contextWindow: 105e4, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true, supportsReasoning: true },
|
|
129781
130128
|
{ id: "gpt-5.5-pro", contextWindow: 105e4, maxOutputTokens: 128e3, supportsTools: true, supportsStreaming: true, supportsImages: true, supportsDocuments: true, supportsReasoning: true },
|
|
129782
130129
|
// GPT-5.4 family: cheaper general-purpose tier; -mini and -nano are the
|
|
@@ -129826,8 +130173,13 @@ var OpenAIProvider = class {
|
|
|
129826
130173
|
const messages = toOpenAIMessages(req.messages);
|
|
129827
130174
|
if (req.system) {
|
|
129828
130175
|
let insertAt = 0;
|
|
129829
|
-
while (insertAt < messages.length
|
|
130176
|
+
while (insertAt < messages.length) {
|
|
130177
|
+
const msg = messages[insertAt];
|
|
130178
|
+
assertDefined(msg, "insertAt < messages.length");
|
|
130179
|
+
if (msg.role !== "system")
|
|
130180
|
+
break;
|
|
129830
130181
|
insertAt += 1;
|
|
130182
|
+
}
|
|
129831
130183
|
messages.splice(insertAt, 0, { role: "system", content: req.system });
|
|
129832
130184
|
}
|
|
129833
130185
|
const tools = req.tools && req.tools.length > 0 ? toOpenAITools(req.tools) : void 0;
|
|
@@ -131069,7 +131421,7 @@ function buildProviderSetupView(opts) {
|
|
|
131069
131421
|
await vault.set(canonicalKey(providerId), key, [providerId]);
|
|
131070
131422
|
markReady(providerId);
|
|
131071
131423
|
},
|
|
131072
|
-
loginOAuth: async (providerId, io) => {
|
|
131424
|
+
loginOAuth: async (providerId, io, opts2) => {
|
|
131073
131425
|
const def = registered(providerId);
|
|
131074
131426
|
if (!def || def.auth?.kind !== "oauth") {
|
|
131075
131427
|
throw new MoxxyError({
|
|
@@ -131079,16 +131431,17 @@ function buildProviderSetupView(opts) {
|
|
|
131079
131431
|
context: { provider: providerId }
|
|
131080
131432
|
});
|
|
131081
131433
|
}
|
|
131082
|
-
const
|
|
131434
|
+
const headless = opts2?.headless === true;
|
|
131435
|
+
const ctx = io ? channelAuthContext(vault, io, headless) : buildProviderAuthContext(vault, { headless });
|
|
131083
131436
|
const result = await def.auth.login(ctx);
|
|
131084
131437
|
markReady(providerId);
|
|
131085
131438
|
return result;
|
|
131086
131439
|
}
|
|
131087
131440
|
};
|
|
131088
131441
|
}
|
|
131089
|
-
function channelAuthContext(vault, io) {
|
|
131442
|
+
function channelAuthContext(vault, io, headless = false) {
|
|
131090
131443
|
return {
|
|
131091
|
-
headless
|
|
131444
|
+
headless,
|
|
131092
131445
|
write: io.write,
|
|
131093
131446
|
...io.prompt ? { prompt: io.prompt } : {},
|
|
131094
131447
|
vault: {
|
|
@@ -131836,7 +132189,8 @@ async function runSetupWizard(opts) {
|
|
|
131836
132189
|
);
|
|
131837
132190
|
process.exit(1);
|
|
131838
132191
|
}
|
|
131839
|
-
|
|
132192
|
+
const supportsHeadless = opts.controller.oauthSupportsHeadless?.(provider) ?? false;
|
|
132193
|
+
await collectOAuth(provider, opts.controller.loginOAuth, supportsHeadless);
|
|
131840
132194
|
oauthCompleted.push(provider);
|
|
131841
132195
|
} else {
|
|
131842
132196
|
apiKeys[provider] = await collectKey(provider, opts.controller);
|
|
@@ -131928,11 +132282,32 @@ async function runSetupWizard(opts) {
|
|
|
131928
132282
|
);
|
|
131929
132283
|
return configPath;
|
|
131930
132284
|
}
|
|
131931
|
-
async function collectOAuth(providerId, loginOAuth) {
|
|
132285
|
+
async function collectOAuth(providerId, loginOAuth, supportsHeadless) {
|
|
132286
|
+
let headless;
|
|
132287
|
+
if (supportsHeadless) {
|
|
132288
|
+
const choiceRaw = await xe2({
|
|
132289
|
+
message: `Step 2 \u2014 How do you want to sign in to ${colors.bold(providerId)}?`,
|
|
132290
|
+
options: [
|
|
132291
|
+
{
|
|
132292
|
+
value: "browser",
|
|
132293
|
+
label: "Open a browser on this machine",
|
|
132294
|
+
hint: "loopback callback \u2014 for a local desktop"
|
|
132295
|
+
},
|
|
132296
|
+
{
|
|
132297
|
+
value: "no-browser",
|
|
132298
|
+
label: "No browser \u2014 show a URL + code to enter elsewhere",
|
|
132299
|
+
hint: "device-code flow \u2014 for a headless / remote box"
|
|
132300
|
+
}
|
|
132301
|
+
],
|
|
132302
|
+
initialValue: "browser"
|
|
132303
|
+
});
|
|
132304
|
+
headless = guard(choiceRaw) === "no-browser";
|
|
132305
|
+
}
|
|
132306
|
+
const loginOpts = headless === void 0 ? void 0 : { headless };
|
|
131932
132307
|
while (true) {
|
|
131933
132308
|
R3.step(`Step 2 \u2014 Sign in to ${colors.bold(providerId)} (OAuth)`);
|
|
131934
132309
|
try {
|
|
131935
|
-
await loginOAuth(providerId);
|
|
132310
|
+
await loginOAuth(providerId, loginOpts);
|
|
131936
132311
|
R3.success(`${providerId} sign-in complete`);
|
|
131937
132312
|
return;
|
|
131938
132313
|
} catch (err) {
|
|
@@ -132153,8 +132528,12 @@ async function runInteractiveInit(session, vault) {
|
|
|
132153
132528
|
async testKey(providerId, key) {
|
|
132154
132529
|
return await providerSetup.testKey(providerId, key);
|
|
132155
132530
|
},
|
|
132156
|
-
async loginOAuth(providerId) {
|
|
132157
|
-
await providerSetup.loginOAuth(providerId);
|
|
132531
|
+
async loginOAuth(providerId, loginOpts) {
|
|
132532
|
+
await providerSetup.loginOAuth(providerId, void 0, loginOpts);
|
|
132533
|
+
},
|
|
132534
|
+
oauthSupportsHeadless(providerId) {
|
|
132535
|
+
const def = session.providers.list().find((p3) => p3.name === providerId);
|
|
132536
|
+
return def?.auth?.kind === "oauth" && def.auth.supportsHeadless === true;
|
|
132158
132537
|
},
|
|
132159
132538
|
async installPlugins(ids) {
|
|
132160
132539
|
for (const id of ids) {
|
|
@@ -135686,8 +136065,6 @@ async function writeIndex(dir, entries) {
|
|
|
135686
136065
|
}
|
|
135687
136066
|
await writeFileAtomic(path3.join(dir, "MEMORY.md"), lines.join("\n"));
|
|
135688
136067
|
}
|
|
135689
|
-
|
|
135690
|
-
// ../plugin-memory/dist/store/search.js
|
|
135691
136068
|
async function recallVector(all, query, limit2, embedder, index, mutex) {
|
|
135692
136069
|
const corpus = all.map((e3) => entryForEmbedding(e3));
|
|
135693
136070
|
if (embedder instanceof TfIdfEmbedder) {
|
|
@@ -135700,10 +136077,14 @@ async function recallVector(all, query, limit2, embedder, index, mutex) {
|
|
|
135700
136077
|
const cached = [];
|
|
135701
136078
|
const misses = [];
|
|
135702
136079
|
for (let i2 = 0; i2 < all.length; i2++) {
|
|
135703
|
-
const
|
|
136080
|
+
const entry = all[i2];
|
|
136081
|
+
const text = corpus[i2];
|
|
136082
|
+
assertDefined(entry, "loop index i < all.length");
|
|
136083
|
+
assertDefined(text, "corpus is built 1:1 from all");
|
|
136084
|
+
const hit = index.lookup(entry.frontmatter.name, text);
|
|
135704
136085
|
cached.push(hit);
|
|
135705
136086
|
if (!hit)
|
|
135706
|
-
misses.push({ index: i2, text
|
|
136087
|
+
misses.push({ index: i2, text });
|
|
135707
136088
|
}
|
|
135708
136089
|
const queryIdx = misses.length;
|
|
135709
136090
|
const toEmbed = [...misses.map((m3) => m3.text), query];
|
|
@@ -135721,8 +136102,11 @@ async function recallVector(all, query, limit2, embedder, index, mutex) {
|
|
|
135721
136102
|
}
|
|
135722
136103
|
for (const [j3, m3] of misses.entries()) {
|
|
135723
136104
|
const v3 = fresh[j3];
|
|
135724
|
-
if (Array.isArray(v3))
|
|
135725
|
-
|
|
136105
|
+
if (Array.isArray(v3)) {
|
|
136106
|
+
const entry = all[m3.index];
|
|
136107
|
+
assertDefined(entry, "m.index was recorded from the bounds-checked all[] loop");
|
|
136108
|
+
index.set(entry.frontmatter.name, m3.text, v3);
|
|
136109
|
+
}
|
|
135726
136110
|
}
|
|
135727
136111
|
index.prune(all.map((e3) => e3.frontmatter.name));
|
|
135728
136112
|
await index.flush();
|
|
@@ -135748,14 +136132,16 @@ function rankCosine(entries, vectors, query, limit2) {
|
|
|
135748
136132
|
}
|
|
135749
136133
|
const ranked = [];
|
|
135750
136134
|
for (let i2 = 0; i2 < entries.length; i2++) {
|
|
136135
|
+
const entry = entries[i2];
|
|
136136
|
+
assertDefined(entry, "loop index i < entries.length");
|
|
135751
136137
|
const vec = vectors[i2];
|
|
135752
136138
|
if (!Array.isArray(vec) || vec.length !== query.length) {
|
|
135753
|
-
console.warn(`[plugin-memory] skipping '${
|
|
136139
|
+
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
136140
|
continue;
|
|
135755
136141
|
}
|
|
135756
136142
|
const score = cosineSimilarity(vec, query);
|
|
135757
136143
|
if (score > 0)
|
|
135758
|
-
ranked.push({ entry
|
|
136144
|
+
ranked.push({ entry, score });
|
|
135759
136145
|
}
|
|
135760
136146
|
ranked.sort((a2, b3) => b3.score - a2.score);
|
|
135761
136147
|
return ranked.slice(0, limit2);
|
|
@@ -136014,7 +136400,9 @@ function parseUserModel(text) {
|
|
|
136014
136400
|
seenHeading = true;
|
|
136015
136401
|
if (current)
|
|
136016
136402
|
sections.push({ title: current.title, content: current.body.join("\n").trim() });
|
|
136017
|
-
|
|
136403
|
+
const title = m3[1];
|
|
136404
|
+
assertDefined(title, "HEADING_RE capture group 1 is present on any match");
|
|
136405
|
+
current = { title: title.trim(), body: [] };
|
|
136018
136406
|
} else if (!seenHeading) {
|
|
136019
136407
|
preambleLines.push(line);
|
|
136020
136408
|
} else if (current) {
|
|
@@ -136203,7 +136591,8 @@ var consolidatedSchema = z$1.object({
|
|
|
136203
136591
|
tags: z$1.array(z$1.string().min(1)).optional()
|
|
136204
136592
|
});
|
|
136205
136593
|
function planConsolidation(entries, opts = {}) {
|
|
136206
|
-
const
|
|
136594
|
+
const tag2 = opts.tag;
|
|
136595
|
+
const filtered = tag2 ? entries.filter((e3) => (e3.frontmatter.tags ?? []).includes(tag2)) : entries;
|
|
136207
136596
|
if (filtered.length < 2) {
|
|
136208
136597
|
return { clusters: [], stable: filtered.map((e3) => e3.frontmatter.name) };
|
|
136209
136598
|
}
|
|
@@ -136215,6 +136604,7 @@ function planConsolidation(entries, opts = {}) {
|
|
|
136215
136604
|
tagless.push(e3);
|
|
136216
136605
|
} else {
|
|
136217
136606
|
const key = tags[0];
|
|
136607
|
+
assertDefined(key, "tags is non-empty here (tags.length === 0 handled above)");
|
|
136218
136608
|
const list = byTag.get(key) ?? [];
|
|
136219
136609
|
list.push(e3);
|
|
136220
136610
|
byTag.set(key, list);
|
|
@@ -136243,14 +136633,18 @@ function planConsolidation(entries, opts = {}) {
|
|
|
136243
136633
|
if (members.length >= 2) {
|
|
136244
136634
|
clusters.push({ key: `tag:${key}`, members: members.map((m3) => m3.frontmatter.name) });
|
|
136245
136635
|
} else {
|
|
136246
|
-
|
|
136636
|
+
const only = members[0];
|
|
136637
|
+
assertDefined(only, "byTag lists always carry \u22651 member");
|
|
136638
|
+
stable.push(only.frontmatter.name);
|
|
136247
136639
|
}
|
|
136248
136640
|
}
|
|
136249
136641
|
for (const cluster of descClusters) {
|
|
136250
136642
|
if (cluster.members.length >= 2) {
|
|
136251
136643
|
clusters.push({ key: cluster.key, members: cluster.members.map((m3) => m3.frontmatter.name) });
|
|
136252
136644
|
} else {
|
|
136253
|
-
|
|
136645
|
+
const only = cluster.members[0];
|
|
136646
|
+
assertDefined(only, "desc clusters are created with \u22651 member");
|
|
136647
|
+
stable.push(only.frontmatter.name);
|
|
136254
136648
|
}
|
|
136255
136649
|
}
|
|
136256
136650
|
return { clusters, stable };
|
|
@@ -136415,7 +136809,7 @@ function isAbortError(err) {
|
|
|
136415
136809
|
var MAX_JSON_SPAN = 64 * 1024;
|
|
136416
136810
|
function extractJson(text) {
|
|
136417
136811
|
const fenced = /```(?:json)?\n?([\s\S]*?)```/.exec(text);
|
|
136418
|
-
const candidate = fenced
|
|
136812
|
+
const candidate = fenced?.[1] ?? text;
|
|
136419
136813
|
const start = candidate.indexOf("{");
|
|
136420
136814
|
const end = candidate.lastIndexOf("}");
|
|
136421
136815
|
if (start === -1 || end <= start)
|
|
@@ -136698,8 +137092,12 @@ function buildMemoryPlugin(opts = {}) {
|
|
|
136698
137092
|
hooks: {
|
|
136699
137093
|
onInit: async (ctx) => {
|
|
136700
137094
|
embeddersReg = ctx.services.get("embedders") ?? null;
|
|
136701
|
-
|
|
136702
|
-
|
|
137095
|
+
const baseHooks = base2.hooks;
|
|
137096
|
+
if (baseHooks)
|
|
137097
|
+
await baseHooks.onInit?.(ctx);
|
|
137098
|
+
const consolidateHooks = consolidate.hooks;
|
|
137099
|
+
if (consolidateHooks)
|
|
137100
|
+
await consolidateHooks.onInit?.(ctx);
|
|
136703
137101
|
},
|
|
136704
137102
|
// A Plugin has a single onBeforeProviderCall, but this composed plugin
|
|
136705
137103
|
// carries TWO: base's always-on user-model injection and consolidate's
|
|
@@ -136707,10 +137105,12 @@ function buildMemoryPlugin(opts = {}) {
|
|
|
136707
137105
|
// block, the nudge appends its hint); either may return void to pass through.
|
|
136708
137106
|
onBeforeProviderCall: async (req, ctx) => {
|
|
136709
137107
|
let out;
|
|
136710
|
-
const
|
|
137108
|
+
const baseHooks = base2.hooks;
|
|
137109
|
+
const injected = baseHooks ? await baseHooks.onBeforeProviderCall?.(out ?? req, ctx) : void 0;
|
|
136711
137110
|
if (injected)
|
|
136712
137111
|
out = injected;
|
|
136713
|
-
const
|
|
137112
|
+
const consolidateHooks = consolidate.hooks;
|
|
137113
|
+
const nudged = consolidateHooks ? await consolidateHooks.onBeforeProviderCall?.(out ?? req, ctx) : void 0;
|
|
136714
137114
|
if (nudged)
|
|
136715
137115
|
out = nudged;
|
|
136716
137116
|
return out;
|