@moxxy/cli 0.5.3 → 0.6.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/README.md +3 -3
- package/dist/bin.js +542 -406
- package/dist/bin.js.map +1 -1
- package/package.json +2 -2
package/dist/bin.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { z as z$1, defineProvider, definePlugin, defineTool, MoxxyError, writeFileAtomic, asTurnId, defineMode, asPluginId, defineChannel, defineTunnelProvider, createMutex, defineWorkflowExecutor, toFriendlyError, estimateTextTokens, classifyHttpStatus, createStuckLoopDetector, runCompactionIfNeeded, runElisionIfNeeded, collectProviderStream, usageEventFields, isContextOverflowError, buildSystemPromptWithSkills, projectMessages, defineCompactor, defineCacheStrategy, denyByDefaultResolver, createAllowListResolver, zodToJsonSchema,
|
|
3
|
+
import { z as z$1, defineProvider, definePlugin, defineTool, MoxxyError, writeFileAtomic, asTurnId, defineMode, asPluginId, defineChannel, defineTunnelProvider, createMutex, defineWorkflowExecutor, toFriendlyError, estimateTextTokens, classifyHttpStatus, createStuckLoopDetector, runCompactionIfNeeded, runElisionIfNeeded, collectProviderStream, usageEventFields, isContextOverflowError, emitRequestsAndDetectStuck, executeToolUses, buildSystemPromptWithSkills, projectMessages, defineCompactor, defineCacheStrategy, denyByDefaultResolver, createAllowListResolver, zodToJsonSchema, runSingleShotTurn, bearerTokenMatches, estimateContextTokens, readRequestBody, moxxyPath, defineEmbedder, skillFrontmatterSchema, asSkillId, getInstallHint, moxxyHome, defineTranscriber, summarizeTokensByModel, migrateModeName, createDeferredPermissionResolver, classifyNetworkError, addModelTotals, ISOLATION_RANK, moxxyPackageSchema, defineCommand, createCallbackResolver, autoAllowResolver, asSessionId, asToolCallId, defineViewRenderer, DEFAULT_VIEW_TAGS, evaluateToolRule, summarizeSessionTokensFromEvents, asEventId } from '@moxxy/sdk';
|
|
4
4
|
import * as fs37 from 'fs';
|
|
5
|
-
import fs37__default, { existsSync, promises, ReadStream, readFileSync, statSync, readdirSync, mkdirSync, writeFileSync, unlinkSync, watch, createReadStream } from 'fs';
|
|
5
|
+
import fs37__default, { existsSync, promises, ReadStream, readFileSync, statSync, readdirSync, mkdirSync, writeFileSync, unlinkSync, renameSync, watch, createReadStream } from 'fs';
|
|
6
6
|
import * as path3 from 'path';
|
|
7
7
|
import path3__default, { basename } from 'path';
|
|
8
8
|
import { z } from 'zod';
|
|
@@ -2140,8 +2140,8 @@ var init_tools2 = __esm({
|
|
|
2140
2140
|
const parseResult = tool.inputSchema.safeParse(input);
|
|
2141
2141
|
if (!parseResult.success) {
|
|
2142
2142
|
const issues = parseResult.error.issues.map((iss) => {
|
|
2143
|
-
const
|
|
2144
|
-
return `${
|
|
2143
|
+
const path59 = iss.path.length ? iss.path.join(".") : "(root)";
|
|
2144
|
+
return `${path59}: ${iss.message}`;
|
|
2145
2145
|
}).join("; ");
|
|
2146
2146
|
throw new Error(`Invalid input for ${name}: ${issues}`);
|
|
2147
2147
|
}
|
|
@@ -7338,11 +7338,11 @@ Default "index" lookups for the main are deprecated for ES modules.`, "Deprecati
|
|
|
7338
7338
|
return e6;
|
|
7339
7339
|
})(l3, t4);
|
|
7340
7340
|
}
|
|
7341
|
-
function
|
|
7341
|
+
function fileURLToPath10(e5) {
|
|
7342
7342
|
return "string" != typeof e5 || e5.startsWith("file://") ? normalizeSlash((0, Qe2.fileURLToPath)(e5)) : normalizeSlash(e5);
|
|
7343
7343
|
}
|
|
7344
7344
|
function pathToFileURL3(e5) {
|
|
7345
|
-
return (0, Qe2.pathToFileURL)(
|
|
7345
|
+
return (0, Qe2.pathToFileURL)(fileURLToPath10(e5)).toString();
|
|
7346
7346
|
}
|
|
7347
7347
|
const Ut2 = /* @__PURE__ */ new Set(["node", "import"]), Mt3 = [".mjs", ".cjs", ".js", ".json"], jt3 = /* @__PURE__ */ new Set(["ERR_MODULE_NOT_FOUND", "ERR_UNSUPPORTED_DIR_IMPORT", "MODULE_NOT_FOUND", "ERR_PACKAGE_PATH_NOT_EXPORTED"]);
|
|
7348
7348
|
function _tryModuleResolve(e5, t4, i3) {
|
|
@@ -7355,11 +7355,11 @@ Default "index" lookups for the main are deprecated for ES modules.`, "Deprecati
|
|
|
7355
7355
|
function _resolve(e5, t4 = {}) {
|
|
7356
7356
|
if ("string" != typeof e5) {
|
|
7357
7357
|
if (!(e5 instanceof URL)) throw new TypeError("input must be a `string` or `URL`");
|
|
7358
|
-
e5 =
|
|
7358
|
+
e5 = fileURLToPath10(e5);
|
|
7359
7359
|
}
|
|
7360
7360
|
if (/(?:node|data|http|https):/.test(e5)) return e5;
|
|
7361
7361
|
if (st3.has(e5)) return "node:" + e5;
|
|
7362
|
-
if (e5.startsWith("file://") && (e5 =
|
|
7362
|
+
if (e5.startsWith("file://") && (e5 = fileURLToPath10(e5)), isAbsolute3(e5)) try {
|
|
7363
7363
|
if ((0, $e2.statSync)(e5).isFile()) return pathToFileURL3(e5);
|
|
7364
7364
|
} catch (e6) {
|
|
7365
7365
|
if ("ENOENT" !== e6?.code) throw e6;
|
|
@@ -7389,7 +7389,7 @@ Default "index" lookups for the main are deprecated for ES modules.`, "Deprecati
|
|
|
7389
7389
|
return _resolve(e5, t4);
|
|
7390
7390
|
}
|
|
7391
7391
|
function resolvePathSync(e5, t4) {
|
|
7392
|
-
return
|
|
7392
|
+
return fileURLToPath10(resolveSync(e5, t4));
|
|
7393
7393
|
}
|
|
7394
7394
|
const Ft2 = /(?:[\s;]|^)(?:import[\s\w*,{}]*from|import\s*["'*{]|export\b\s*(?:[*{]|default|class|type|function|const|var|let|async function)|import\.meta\b)/m, Bt2 = /\/\*.+?\*\/|\/\/.*(?=[nr])/g;
|
|
7395
7395
|
function hasESMSyntax(e5, t4 = {}) {
|
|
@@ -7546,7 +7546,7 @@ Default "index" lookups for the main are deprecated for ES modules.`, "Deprecati
|
|
|
7546
7546
|
}
|
|
7547
7547
|
function tryNativeRequireResolve(e5, t4, i3, n3) {
|
|
7548
7548
|
try {
|
|
7549
|
-
return e5.nativeRequire.resolve(t4, { ...n3, paths: [pathe_M_eThtNZ_dirname(
|
|
7549
|
+
return e5.nativeRequire.resolve(t4, { ...n3, paths: [pathe_M_eThtNZ_dirname(fileURLToPath10(i3)), ...n3?.paths || []] });
|
|
7550
7550
|
} catch {
|
|
7551
7551
|
}
|
|
7552
7552
|
}
|
|
@@ -7736,7 +7736,7 @@ Default "index" lookups for the main are deprecated for ES modules.`, "Deprecati
|
|
|
7736
7736
|
const i4 = {};
|
|
7737
7737
|
return void 0 !== e6.cache && (i4.fsCache = e6.cache), void 0 !== e6.requireCache && (i4.moduleCache = e6.requireCache), { ...t5, ...i4, ...e6 };
|
|
7738
7738
|
})(t4);
|
|
7739
|
-
"string" == typeof e5 && e5.startsWith("file://") && (e5 =
|
|
7739
|
+
"string" == typeof e5 && e5.startsWith("file://") && (e5 = fileURLToPath10(e5));
|
|
7740
7740
|
const c3 = a3.alias && Object.keys(a3.alias).length > 0 ? normalizeAliases(a3.alias || {}) : void 0;
|
|
7741
7741
|
let l3;
|
|
7742
7742
|
if (a3.tsconfigPaths) {
|
|
@@ -8054,17 +8054,17 @@ var require_visit = __commonJS({
|
|
|
8054
8054
|
visit.BREAK = BREAK;
|
|
8055
8055
|
visit.SKIP = SKIP;
|
|
8056
8056
|
visit.REMOVE = REMOVE;
|
|
8057
|
-
function visit_(key, node, visitor,
|
|
8058
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
8057
|
+
function visit_(key, node, visitor, path59) {
|
|
8058
|
+
const ctrl = callVisitor(key, node, visitor, path59);
|
|
8059
8059
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
8060
|
-
replaceNode(key,
|
|
8061
|
-
return visit_(key, ctrl, visitor,
|
|
8060
|
+
replaceNode(key, path59, ctrl);
|
|
8061
|
+
return visit_(key, ctrl, visitor, path59);
|
|
8062
8062
|
}
|
|
8063
8063
|
if (typeof ctrl !== "symbol") {
|
|
8064
8064
|
if (identity.isCollection(node)) {
|
|
8065
|
-
|
|
8065
|
+
path59 = Object.freeze(path59.concat(node));
|
|
8066
8066
|
for (let i2 = 0; i2 < node.items.length; ++i2) {
|
|
8067
|
-
const ci = visit_(i2, node.items[i2], visitor,
|
|
8067
|
+
const ci = visit_(i2, node.items[i2], visitor, path59);
|
|
8068
8068
|
if (typeof ci === "number")
|
|
8069
8069
|
i2 = ci - 1;
|
|
8070
8070
|
else if (ci === BREAK)
|
|
@@ -8075,13 +8075,13 @@ var require_visit = __commonJS({
|
|
|
8075
8075
|
}
|
|
8076
8076
|
}
|
|
8077
8077
|
} else if (identity.isPair(node)) {
|
|
8078
|
-
|
|
8079
|
-
const ck = visit_("key", node.key, visitor,
|
|
8078
|
+
path59 = Object.freeze(path59.concat(node));
|
|
8079
|
+
const ck = visit_("key", node.key, visitor, path59);
|
|
8080
8080
|
if (ck === BREAK)
|
|
8081
8081
|
return BREAK;
|
|
8082
8082
|
else if (ck === REMOVE)
|
|
8083
8083
|
node.key = null;
|
|
8084
|
-
const cv = visit_("value", node.value, visitor,
|
|
8084
|
+
const cv = visit_("value", node.value, visitor, path59);
|
|
8085
8085
|
if (cv === BREAK)
|
|
8086
8086
|
return BREAK;
|
|
8087
8087
|
else if (cv === REMOVE)
|
|
@@ -8102,17 +8102,17 @@ var require_visit = __commonJS({
|
|
|
8102
8102
|
visitAsync.BREAK = BREAK;
|
|
8103
8103
|
visitAsync.SKIP = SKIP;
|
|
8104
8104
|
visitAsync.REMOVE = REMOVE;
|
|
8105
|
-
async function visitAsync_(key, node, visitor,
|
|
8106
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
8105
|
+
async function visitAsync_(key, node, visitor, path59) {
|
|
8106
|
+
const ctrl = await callVisitor(key, node, visitor, path59);
|
|
8107
8107
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
8108
|
-
replaceNode(key,
|
|
8109
|
-
return visitAsync_(key, ctrl, visitor,
|
|
8108
|
+
replaceNode(key, path59, ctrl);
|
|
8109
|
+
return visitAsync_(key, ctrl, visitor, path59);
|
|
8110
8110
|
}
|
|
8111
8111
|
if (typeof ctrl !== "symbol") {
|
|
8112
8112
|
if (identity.isCollection(node)) {
|
|
8113
|
-
|
|
8113
|
+
path59 = Object.freeze(path59.concat(node));
|
|
8114
8114
|
for (let i2 = 0; i2 < node.items.length; ++i2) {
|
|
8115
|
-
const ci = await visitAsync_(i2, node.items[i2], visitor,
|
|
8115
|
+
const ci = await visitAsync_(i2, node.items[i2], visitor, path59);
|
|
8116
8116
|
if (typeof ci === "number")
|
|
8117
8117
|
i2 = ci - 1;
|
|
8118
8118
|
else if (ci === BREAK)
|
|
@@ -8123,13 +8123,13 @@ var require_visit = __commonJS({
|
|
|
8123
8123
|
}
|
|
8124
8124
|
}
|
|
8125
8125
|
} else if (identity.isPair(node)) {
|
|
8126
|
-
|
|
8127
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
8126
|
+
path59 = Object.freeze(path59.concat(node));
|
|
8127
|
+
const ck = await visitAsync_("key", node.key, visitor, path59);
|
|
8128
8128
|
if (ck === BREAK)
|
|
8129
8129
|
return BREAK;
|
|
8130
8130
|
else if (ck === REMOVE)
|
|
8131
8131
|
node.key = null;
|
|
8132
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
8132
|
+
const cv = await visitAsync_("value", node.value, visitor, path59);
|
|
8133
8133
|
if (cv === BREAK)
|
|
8134
8134
|
return BREAK;
|
|
8135
8135
|
else if (cv === REMOVE)
|
|
@@ -8156,23 +8156,23 @@ var require_visit = __commonJS({
|
|
|
8156
8156
|
}
|
|
8157
8157
|
return visitor;
|
|
8158
8158
|
}
|
|
8159
|
-
function callVisitor(key, node, visitor,
|
|
8159
|
+
function callVisitor(key, node, visitor, path59) {
|
|
8160
8160
|
if (typeof visitor === "function")
|
|
8161
|
-
return visitor(key, node,
|
|
8161
|
+
return visitor(key, node, path59);
|
|
8162
8162
|
if (identity.isMap(node))
|
|
8163
|
-
return visitor.Map?.(key, node,
|
|
8163
|
+
return visitor.Map?.(key, node, path59);
|
|
8164
8164
|
if (identity.isSeq(node))
|
|
8165
|
-
return visitor.Seq?.(key, node,
|
|
8165
|
+
return visitor.Seq?.(key, node, path59);
|
|
8166
8166
|
if (identity.isPair(node))
|
|
8167
|
-
return visitor.Pair?.(key, node,
|
|
8167
|
+
return visitor.Pair?.(key, node, path59);
|
|
8168
8168
|
if (identity.isScalar(node))
|
|
8169
|
-
return visitor.Scalar?.(key, node,
|
|
8169
|
+
return visitor.Scalar?.(key, node, path59);
|
|
8170
8170
|
if (identity.isAlias(node))
|
|
8171
|
-
return visitor.Alias?.(key, node,
|
|
8171
|
+
return visitor.Alias?.(key, node, path59);
|
|
8172
8172
|
return void 0;
|
|
8173
8173
|
}
|
|
8174
|
-
function replaceNode(key,
|
|
8175
|
-
const parent =
|
|
8174
|
+
function replaceNode(key, path59, node) {
|
|
8175
|
+
const parent = path59[path59.length - 1];
|
|
8176
8176
|
if (identity.isCollection(parent)) {
|
|
8177
8177
|
parent.items[key] = node;
|
|
8178
8178
|
} else if (identity.isPair(parent)) {
|
|
@@ -8773,10 +8773,10 @@ var require_Collection = __commonJS({
|
|
|
8773
8773
|
var createNode2 = require_createNode();
|
|
8774
8774
|
var identity = require_identity();
|
|
8775
8775
|
var Node = require_Node();
|
|
8776
|
-
function collectionFromPath(schema,
|
|
8776
|
+
function collectionFromPath(schema, path59, value) {
|
|
8777
8777
|
let v3 = value;
|
|
8778
|
-
for (let i2 =
|
|
8779
|
-
const k3 =
|
|
8778
|
+
for (let i2 = path59.length - 1; i2 >= 0; --i2) {
|
|
8779
|
+
const k3 = path59[i2];
|
|
8780
8780
|
if (typeof k3 === "number" && Number.isInteger(k3) && k3 >= 0) {
|
|
8781
8781
|
const a2 = [];
|
|
8782
8782
|
a2[k3] = v3;
|
|
@@ -8795,7 +8795,7 @@ var require_Collection = __commonJS({
|
|
|
8795
8795
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
8796
8796
|
});
|
|
8797
8797
|
}
|
|
8798
|
-
var isEmptyPath = (
|
|
8798
|
+
var isEmptyPath = (path59) => path59 == null || typeof path59 === "object" && !!path59[Symbol.iterator]().next().done;
|
|
8799
8799
|
var Collection = class extends Node.NodeBase {
|
|
8800
8800
|
constructor(type, schema) {
|
|
8801
8801
|
super(type);
|
|
@@ -8825,11 +8825,11 @@ var require_Collection = __commonJS({
|
|
|
8825
8825
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
8826
8826
|
* that already exists in the map.
|
|
8827
8827
|
*/
|
|
8828
|
-
addIn(
|
|
8829
|
-
if (isEmptyPath(
|
|
8828
|
+
addIn(path59, value) {
|
|
8829
|
+
if (isEmptyPath(path59))
|
|
8830
8830
|
this.add(value);
|
|
8831
8831
|
else {
|
|
8832
|
-
const [key, ...rest] =
|
|
8832
|
+
const [key, ...rest] = path59;
|
|
8833
8833
|
const node = this.get(key, true);
|
|
8834
8834
|
if (identity.isCollection(node))
|
|
8835
8835
|
node.addIn(rest, value);
|
|
@@ -8843,8 +8843,8 @@ var require_Collection = __commonJS({
|
|
|
8843
8843
|
* Removes a value from the collection.
|
|
8844
8844
|
* @returns `true` if the item was found and removed.
|
|
8845
8845
|
*/
|
|
8846
|
-
deleteIn(
|
|
8847
|
-
const [key, ...rest] =
|
|
8846
|
+
deleteIn(path59) {
|
|
8847
|
+
const [key, ...rest] = path59;
|
|
8848
8848
|
if (rest.length === 0)
|
|
8849
8849
|
return this.delete(key);
|
|
8850
8850
|
const node = this.get(key, true);
|
|
@@ -8858,8 +8858,8 @@ var require_Collection = __commonJS({
|
|
|
8858
8858
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
8859
8859
|
* `true` (collections are always returned intact).
|
|
8860
8860
|
*/
|
|
8861
|
-
getIn(
|
|
8862
|
-
const [key, ...rest] =
|
|
8861
|
+
getIn(path59, keepScalar) {
|
|
8862
|
+
const [key, ...rest] = path59;
|
|
8863
8863
|
const node = this.get(key, true);
|
|
8864
8864
|
if (rest.length === 0)
|
|
8865
8865
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -8877,8 +8877,8 @@ var require_Collection = __commonJS({
|
|
|
8877
8877
|
/**
|
|
8878
8878
|
* Checks if the collection includes a value with the key `key`.
|
|
8879
8879
|
*/
|
|
8880
|
-
hasIn(
|
|
8881
|
-
const [key, ...rest] =
|
|
8880
|
+
hasIn(path59) {
|
|
8881
|
+
const [key, ...rest] = path59;
|
|
8882
8882
|
if (rest.length === 0)
|
|
8883
8883
|
return this.has(key);
|
|
8884
8884
|
const node = this.get(key, true);
|
|
@@ -8888,8 +8888,8 @@ var require_Collection = __commonJS({
|
|
|
8888
8888
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
8889
8889
|
* boolean to add/remove the item from the set.
|
|
8890
8890
|
*/
|
|
8891
|
-
setIn(
|
|
8892
|
-
const [key, ...rest] =
|
|
8891
|
+
setIn(path59, value) {
|
|
8892
|
+
const [key, ...rest] = path59;
|
|
8893
8893
|
if (rest.length === 0) {
|
|
8894
8894
|
this.set(key, value);
|
|
8895
8895
|
} else {
|
|
@@ -11369,9 +11369,9 @@ var require_Document = __commonJS({
|
|
|
11369
11369
|
this.contents.add(value);
|
|
11370
11370
|
}
|
|
11371
11371
|
/** Adds a value to the document. */
|
|
11372
|
-
addIn(
|
|
11372
|
+
addIn(path59, value) {
|
|
11373
11373
|
if (assertCollection(this.contents))
|
|
11374
|
-
this.contents.addIn(
|
|
11374
|
+
this.contents.addIn(path59, value);
|
|
11375
11375
|
}
|
|
11376
11376
|
/**
|
|
11377
11377
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -11446,14 +11446,14 @@ var require_Document = __commonJS({
|
|
|
11446
11446
|
* Removes a value from the document.
|
|
11447
11447
|
* @returns `true` if the item was found and removed.
|
|
11448
11448
|
*/
|
|
11449
|
-
deleteIn(
|
|
11450
|
-
if (Collection.isEmptyPath(
|
|
11449
|
+
deleteIn(path59) {
|
|
11450
|
+
if (Collection.isEmptyPath(path59)) {
|
|
11451
11451
|
if (this.contents == null)
|
|
11452
11452
|
return false;
|
|
11453
11453
|
this.contents = null;
|
|
11454
11454
|
return true;
|
|
11455
11455
|
}
|
|
11456
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
11456
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path59) : false;
|
|
11457
11457
|
}
|
|
11458
11458
|
/**
|
|
11459
11459
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -11468,10 +11468,10 @@ var require_Document = __commonJS({
|
|
|
11468
11468
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
11469
11469
|
* `true` (collections are always returned intact).
|
|
11470
11470
|
*/
|
|
11471
|
-
getIn(
|
|
11472
|
-
if (Collection.isEmptyPath(
|
|
11471
|
+
getIn(path59, keepScalar) {
|
|
11472
|
+
if (Collection.isEmptyPath(path59))
|
|
11473
11473
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
11474
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
11474
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path59, keepScalar) : void 0;
|
|
11475
11475
|
}
|
|
11476
11476
|
/**
|
|
11477
11477
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -11482,10 +11482,10 @@ var require_Document = __commonJS({
|
|
|
11482
11482
|
/**
|
|
11483
11483
|
* Checks if the document includes a value at `path`.
|
|
11484
11484
|
*/
|
|
11485
|
-
hasIn(
|
|
11486
|
-
if (Collection.isEmptyPath(
|
|
11485
|
+
hasIn(path59) {
|
|
11486
|
+
if (Collection.isEmptyPath(path59))
|
|
11487
11487
|
return this.contents !== void 0;
|
|
11488
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
11488
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path59) : false;
|
|
11489
11489
|
}
|
|
11490
11490
|
/**
|
|
11491
11491
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -11502,13 +11502,13 @@ var require_Document = __commonJS({
|
|
|
11502
11502
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
11503
11503
|
* boolean to add/remove the item from the set.
|
|
11504
11504
|
*/
|
|
11505
|
-
setIn(
|
|
11506
|
-
if (Collection.isEmptyPath(
|
|
11505
|
+
setIn(path59, value) {
|
|
11506
|
+
if (Collection.isEmptyPath(path59)) {
|
|
11507
11507
|
this.contents = value;
|
|
11508
11508
|
} else if (this.contents == null) {
|
|
11509
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
11509
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path59), value);
|
|
11510
11510
|
} else if (assertCollection(this.contents)) {
|
|
11511
|
-
this.contents.setIn(
|
|
11511
|
+
this.contents.setIn(path59, value);
|
|
11512
11512
|
}
|
|
11513
11513
|
}
|
|
11514
11514
|
/**
|
|
@@ -13448,9 +13448,9 @@ var require_cst_visit = __commonJS({
|
|
|
13448
13448
|
visit.BREAK = BREAK;
|
|
13449
13449
|
visit.SKIP = SKIP;
|
|
13450
13450
|
visit.REMOVE = REMOVE;
|
|
13451
|
-
visit.itemAtPath = (cst,
|
|
13451
|
+
visit.itemAtPath = (cst, path59) => {
|
|
13452
13452
|
let item = cst;
|
|
13453
|
-
for (const [field, index] of
|
|
13453
|
+
for (const [field, index] of path59) {
|
|
13454
13454
|
const tok = item?.[field];
|
|
13455
13455
|
if (tok && "items" in tok) {
|
|
13456
13456
|
item = tok.items[index];
|
|
@@ -13459,23 +13459,23 @@ var require_cst_visit = __commonJS({
|
|
|
13459
13459
|
}
|
|
13460
13460
|
return item;
|
|
13461
13461
|
};
|
|
13462
|
-
visit.parentCollection = (cst,
|
|
13463
|
-
const parent = visit.itemAtPath(cst,
|
|
13464
|
-
const field =
|
|
13462
|
+
visit.parentCollection = (cst, path59) => {
|
|
13463
|
+
const parent = visit.itemAtPath(cst, path59.slice(0, -1));
|
|
13464
|
+
const field = path59[path59.length - 1][0];
|
|
13465
13465
|
const coll = parent?.[field];
|
|
13466
13466
|
if (coll && "items" in coll)
|
|
13467
13467
|
return coll;
|
|
13468
13468
|
throw new Error("Parent collection not found");
|
|
13469
13469
|
};
|
|
13470
|
-
function _visit(
|
|
13471
|
-
let ctrl = visitor(item,
|
|
13470
|
+
function _visit(path59, item, visitor) {
|
|
13471
|
+
let ctrl = visitor(item, path59);
|
|
13472
13472
|
if (typeof ctrl === "symbol")
|
|
13473
13473
|
return ctrl;
|
|
13474
13474
|
for (const field of ["key", "value"]) {
|
|
13475
13475
|
const token = item[field];
|
|
13476
13476
|
if (token && "items" in token) {
|
|
13477
13477
|
for (let i2 = 0; i2 < token.items.length; ++i2) {
|
|
13478
|
-
const ci = _visit(Object.freeze(
|
|
13478
|
+
const ci = _visit(Object.freeze(path59.concat([[field, i2]])), token.items[i2], visitor);
|
|
13479
13479
|
if (typeof ci === "number")
|
|
13480
13480
|
i2 = ci - 1;
|
|
13481
13481
|
else if (ci === BREAK)
|
|
@@ -13486,10 +13486,10 @@ var require_cst_visit = __commonJS({
|
|
|
13486
13486
|
}
|
|
13487
13487
|
}
|
|
13488
13488
|
if (typeof ctrl === "function" && field === "key")
|
|
13489
|
-
ctrl = ctrl(item,
|
|
13489
|
+
ctrl = ctrl(item, path59);
|
|
13490
13490
|
}
|
|
13491
13491
|
}
|
|
13492
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
13492
|
+
return typeof ctrl === "function" ? ctrl(item, path59) : ctrl;
|
|
13493
13493
|
}
|
|
13494
13494
|
exports.visit = visit;
|
|
13495
13495
|
}
|
|
@@ -16211,14 +16211,14 @@ var require_url_state_machine = __commonJS({
|
|
|
16211
16211
|
return url2.replace(/\u0009|\u000A|\u000D/g, "");
|
|
16212
16212
|
}
|
|
16213
16213
|
function shortenPath(url2) {
|
|
16214
|
-
const
|
|
16215
|
-
if (
|
|
16214
|
+
const path59 = url2.path;
|
|
16215
|
+
if (path59.length === 0) {
|
|
16216
16216
|
return;
|
|
16217
16217
|
}
|
|
16218
|
-
if (url2.scheme === "file" &&
|
|
16218
|
+
if (url2.scheme === "file" && path59.length === 1 && isNormalizedWindowsDriveLetter(path59[0])) {
|
|
16219
16219
|
return;
|
|
16220
16220
|
}
|
|
16221
|
-
|
|
16221
|
+
path59.pop();
|
|
16222
16222
|
}
|
|
16223
16223
|
function includesCredentials(url2) {
|
|
16224
16224
|
return url2.username !== "" || url2.password !== "";
|
|
@@ -25441,14 +25441,14 @@ __export(fileFromPath_exports, {
|
|
|
25441
25441
|
fileFromPathSync: () => fileFromPathSync,
|
|
25442
25442
|
isFile: () => isFile
|
|
25443
25443
|
});
|
|
25444
|
-
function createFileFromPath(
|
|
25444
|
+
function createFileFromPath(path59, { mtimeMs, size }, filenameOrOptions, options = {}) {
|
|
25445
25445
|
let filename;
|
|
25446
25446
|
if (isPlainObject_default2(filenameOrOptions)) {
|
|
25447
25447
|
[options, filename] = [filenameOrOptions, void 0];
|
|
25448
25448
|
} else {
|
|
25449
25449
|
filename = filenameOrOptions;
|
|
25450
25450
|
}
|
|
25451
|
-
const file = new FileFromPath({ path:
|
|
25451
|
+
const file = new FileFromPath({ path: path59, size, lastModified: mtimeMs });
|
|
25452
25452
|
if (!filename) {
|
|
25453
25453
|
filename = file.name;
|
|
25454
25454
|
}
|
|
@@ -25457,13 +25457,13 @@ function createFileFromPath(path58, { mtimeMs, size }, filenameOrOptions, option
|
|
|
25457
25457
|
lastModified: file.lastModified
|
|
25458
25458
|
});
|
|
25459
25459
|
}
|
|
25460
|
-
function fileFromPathSync(
|
|
25461
|
-
const stats = statSync(
|
|
25462
|
-
return createFileFromPath(
|
|
25460
|
+
function fileFromPathSync(path59, filenameOrOptions, options = {}) {
|
|
25461
|
+
const stats = statSync(path59);
|
|
25462
|
+
return createFileFromPath(path59, stats, filenameOrOptions, options);
|
|
25463
25463
|
}
|
|
25464
|
-
async function fileFromPath2(
|
|
25465
|
-
const stats = await promises.stat(
|
|
25466
|
-
return createFileFromPath(
|
|
25464
|
+
async function fileFromPath2(path59, filenameOrOptions, options) {
|
|
25465
|
+
const stats = await promises.stat(path59);
|
|
25466
|
+
return createFileFromPath(path59, stats, filenameOrOptions, options);
|
|
25467
25467
|
}
|
|
25468
25468
|
var import_node_domexception, __classPrivateFieldSet4, __classPrivateFieldGet5, _FileFromPath_path, _FileFromPath_start, MESSAGE, FileFromPath;
|
|
25469
25469
|
var init_fileFromPath = __esm({
|
|
@@ -29322,7 +29322,7 @@ var require_has_flag = __commonJS({
|
|
|
29322
29322
|
// ../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js
|
|
29323
29323
|
var require_supports_color = __commonJS({
|
|
29324
29324
|
"../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js"(exports, module) {
|
|
29325
|
-
var
|
|
29325
|
+
var os21 = __require("os");
|
|
29326
29326
|
var tty2 = __require("tty");
|
|
29327
29327
|
var hasFlag2 = require_has_flag();
|
|
29328
29328
|
var { env: env3 } = process;
|
|
@@ -29370,7 +29370,7 @@ var require_supports_color = __commonJS({
|
|
|
29370
29370
|
return min;
|
|
29371
29371
|
}
|
|
29372
29372
|
if (process.platform === "win32") {
|
|
29373
|
-
const osRelease =
|
|
29373
|
+
const osRelease = os21.release().split(".");
|
|
29374
29374
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
29375
29375
|
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
29376
29376
|
}
|
|
@@ -37434,8 +37434,8 @@ var init_esm = __esm({
|
|
|
37434
37434
|
}
|
|
37435
37435
|
});
|
|
37436
37436
|
function getMethodLiteral(schema) {
|
|
37437
|
-
const
|
|
37438
|
-
const methodSchema =
|
|
37437
|
+
const shape2 = getObjectShape(schema);
|
|
37438
|
+
const methodSchema = shape2?.method;
|
|
37439
37439
|
if (!methodSchema) {
|
|
37440
37440
|
throw new Error("Schema is missing a method literal");
|
|
37441
37441
|
}
|
|
@@ -41595,8 +41595,8 @@ var require_utils2 = __commonJS({
|
|
|
41595
41595
|
}
|
|
41596
41596
|
return ind;
|
|
41597
41597
|
}
|
|
41598
|
-
function removeDotSegments(
|
|
41599
|
-
let input =
|
|
41598
|
+
function removeDotSegments(path59) {
|
|
41599
|
+
let input = path59;
|
|
41600
41600
|
const output = [];
|
|
41601
41601
|
let nextSlash = -1;
|
|
41602
41602
|
let len = 0;
|
|
@@ -41847,8 +41847,8 @@ var require_schemes = __commonJS({
|
|
|
41847
41847
|
wsComponent.secure = void 0;
|
|
41848
41848
|
}
|
|
41849
41849
|
if (wsComponent.resourceName) {
|
|
41850
|
-
const [
|
|
41851
|
-
wsComponent.path =
|
|
41850
|
+
const [path59, query] = wsComponent.resourceName.split("?");
|
|
41851
|
+
wsComponent.path = path59 && path59 !== "/" ? path59 : void 0;
|
|
41852
41852
|
wsComponent.query = query;
|
|
41853
41853
|
wsComponent.resourceName = void 0;
|
|
41854
41854
|
}
|
|
@@ -45605,8 +45605,8 @@ var init_client2 = __esm({
|
|
|
45605
45605
|
* Override request handler registration to enforce client-side validation for elicitation.
|
|
45606
45606
|
*/
|
|
45607
45607
|
setRequestHandler(requestSchema, handler) {
|
|
45608
|
-
const
|
|
45609
|
-
const methodSchema =
|
|
45608
|
+
const shape2 = getObjectShape(requestSchema);
|
|
45609
|
+
const methodSchema = shape2?.method;
|
|
45610
45610
|
if (!methodSchema) {
|
|
45611
45611
|
throw new Error("Schema is missing a method literal");
|
|
45612
45612
|
}
|
|
@@ -46006,7 +46006,7 @@ var require_windows = __commonJS({
|
|
|
46006
46006
|
module.exports = isexe;
|
|
46007
46007
|
isexe.sync = sync;
|
|
46008
46008
|
var fs43 = __require("fs");
|
|
46009
|
-
function checkPathExt(
|
|
46009
|
+
function checkPathExt(path59, options) {
|
|
46010
46010
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
46011
46011
|
if (!pathext) {
|
|
46012
46012
|
return true;
|
|
@@ -46017,25 +46017,25 @@ var require_windows = __commonJS({
|
|
|
46017
46017
|
}
|
|
46018
46018
|
for (var i2 = 0; i2 < pathext.length; i2++) {
|
|
46019
46019
|
var p3 = pathext[i2].toLowerCase();
|
|
46020
|
-
if (p3 &&
|
|
46020
|
+
if (p3 && path59.substr(-p3.length).toLowerCase() === p3) {
|
|
46021
46021
|
return true;
|
|
46022
46022
|
}
|
|
46023
46023
|
}
|
|
46024
46024
|
return false;
|
|
46025
46025
|
}
|
|
46026
|
-
function checkStat(stat,
|
|
46026
|
+
function checkStat(stat, path59, options) {
|
|
46027
46027
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
46028
46028
|
return false;
|
|
46029
46029
|
}
|
|
46030
|
-
return checkPathExt(
|
|
46030
|
+
return checkPathExt(path59, options);
|
|
46031
46031
|
}
|
|
46032
|
-
function isexe(
|
|
46033
|
-
fs43.stat(
|
|
46034
|
-
cb(er2, er2 ? false : checkStat(stat,
|
|
46032
|
+
function isexe(path59, options, cb) {
|
|
46033
|
+
fs43.stat(path59, function(er2, stat) {
|
|
46034
|
+
cb(er2, er2 ? false : checkStat(stat, path59, options));
|
|
46035
46035
|
});
|
|
46036
46036
|
}
|
|
46037
|
-
function sync(
|
|
46038
|
-
return checkStat(fs43.statSync(
|
|
46037
|
+
function sync(path59, options) {
|
|
46038
|
+
return checkStat(fs43.statSync(path59), path59, options);
|
|
46039
46039
|
}
|
|
46040
46040
|
}
|
|
46041
46041
|
});
|
|
@@ -46046,13 +46046,13 @@ var require_mode = __commonJS({
|
|
|
46046
46046
|
module.exports = isexe;
|
|
46047
46047
|
isexe.sync = sync;
|
|
46048
46048
|
var fs43 = __require("fs");
|
|
46049
|
-
function isexe(
|
|
46050
|
-
fs43.stat(
|
|
46049
|
+
function isexe(path59, options, cb) {
|
|
46050
|
+
fs43.stat(path59, function(er2, stat) {
|
|
46051
46051
|
cb(er2, er2 ? false : checkStat(stat, options));
|
|
46052
46052
|
});
|
|
46053
46053
|
}
|
|
46054
|
-
function sync(
|
|
46055
|
-
return checkStat(fs43.statSync(
|
|
46054
|
+
function sync(path59, options) {
|
|
46055
|
+
return checkStat(fs43.statSync(path59), options);
|
|
46056
46056
|
}
|
|
46057
46057
|
function checkStat(stat, options) {
|
|
46058
46058
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -46085,7 +46085,7 @@ var require_isexe = __commonJS({
|
|
|
46085
46085
|
}
|
|
46086
46086
|
module.exports = isexe;
|
|
46087
46087
|
isexe.sync = sync;
|
|
46088
|
-
function isexe(
|
|
46088
|
+
function isexe(path59, options, cb) {
|
|
46089
46089
|
if (typeof options === "function") {
|
|
46090
46090
|
cb = options;
|
|
46091
46091
|
options = {};
|
|
@@ -46095,7 +46095,7 @@ var require_isexe = __commonJS({
|
|
|
46095
46095
|
throw new TypeError("callback not provided");
|
|
46096
46096
|
}
|
|
46097
46097
|
return new Promise(function(resolve12, reject) {
|
|
46098
|
-
isexe(
|
|
46098
|
+
isexe(path59, options || {}, function(er2, is) {
|
|
46099
46099
|
if (er2) {
|
|
46100
46100
|
reject(er2);
|
|
46101
46101
|
} else {
|
|
@@ -46104,7 +46104,7 @@ var require_isexe = __commonJS({
|
|
|
46104
46104
|
});
|
|
46105
46105
|
});
|
|
46106
46106
|
}
|
|
46107
|
-
core(
|
|
46107
|
+
core(path59, options || {}, function(er2, is) {
|
|
46108
46108
|
if (er2) {
|
|
46109
46109
|
if (er2.code === "EACCES" || options && options.ignoreErrors) {
|
|
46110
46110
|
er2 = null;
|
|
@@ -46114,9 +46114,9 @@ var require_isexe = __commonJS({
|
|
|
46114
46114
|
cb(er2, is);
|
|
46115
46115
|
});
|
|
46116
46116
|
}
|
|
46117
|
-
function sync(
|
|
46117
|
+
function sync(path59, options) {
|
|
46118
46118
|
try {
|
|
46119
|
-
return core.sync(
|
|
46119
|
+
return core.sync(path59, options || {});
|
|
46120
46120
|
} catch (er2) {
|
|
46121
46121
|
if (options && options.ignoreErrors || er2.code === "EACCES") {
|
|
46122
46122
|
return false;
|
|
@@ -46132,7 +46132,7 @@ var require_isexe = __commonJS({
|
|
|
46132
46132
|
var require_which = __commonJS({
|
|
46133
46133
|
"../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module) {
|
|
46134
46134
|
var isWindows3 = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
46135
|
-
var
|
|
46135
|
+
var path59 = __require("path");
|
|
46136
46136
|
var COLON = isWindows3 ? ";" : ":";
|
|
46137
46137
|
var isexe = require_isexe();
|
|
46138
46138
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -46170,7 +46170,7 @@ var require_which = __commonJS({
|
|
|
46170
46170
|
return opt.all && found.length ? resolve12(found) : reject(getNotFoundError(cmd));
|
|
46171
46171
|
const ppRaw = pathEnv[i2];
|
|
46172
46172
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
46173
|
-
const pCmd =
|
|
46173
|
+
const pCmd = path59.join(pathPart, cmd);
|
|
46174
46174
|
const p3 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
46175
46175
|
resolve12(subStep(p3, i2, 0));
|
|
46176
46176
|
});
|
|
@@ -46197,7 +46197,7 @@ var require_which = __commonJS({
|
|
|
46197
46197
|
for (let i2 = 0; i2 < pathEnv.length; i2++) {
|
|
46198
46198
|
const ppRaw = pathEnv[i2];
|
|
46199
46199
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
46200
|
-
const pCmd =
|
|
46200
|
+
const pCmd = path59.join(pathPart, cmd);
|
|
46201
46201
|
const p3 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
46202
46202
|
for (let j3 = 0; j3 < pathExt.length; j3++) {
|
|
46203
46203
|
const cur = p3 + pathExt[j3];
|
|
@@ -46243,7 +46243,7 @@ var require_path_key = __commonJS({
|
|
|
46243
46243
|
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
|
|
46244
46244
|
var require_resolveCommand = __commonJS({
|
|
46245
46245
|
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
|
|
46246
|
-
var
|
|
46246
|
+
var path59 = __require("path");
|
|
46247
46247
|
var which = require_which();
|
|
46248
46248
|
var getPathKey = require_path_key();
|
|
46249
46249
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -46261,7 +46261,7 @@ var require_resolveCommand = __commonJS({
|
|
|
46261
46261
|
try {
|
|
46262
46262
|
resolved = which.sync(parsed.command, {
|
|
46263
46263
|
path: env3[getPathKey({ env: env3 })],
|
|
46264
|
-
pathExt: withoutPathExt ?
|
|
46264
|
+
pathExt: withoutPathExt ? path59.delimiter : void 0
|
|
46265
46265
|
});
|
|
46266
46266
|
} catch (e3) {
|
|
46267
46267
|
} finally {
|
|
@@ -46270,7 +46270,7 @@ var require_resolveCommand = __commonJS({
|
|
|
46270
46270
|
}
|
|
46271
46271
|
}
|
|
46272
46272
|
if (resolved) {
|
|
46273
|
-
resolved =
|
|
46273
|
+
resolved = path59.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
46274
46274
|
}
|
|
46275
46275
|
return resolved;
|
|
46276
46276
|
}
|
|
@@ -46321,8 +46321,8 @@ var require_shebang_command = __commonJS({
|
|
|
46321
46321
|
if (!match) {
|
|
46322
46322
|
return null;
|
|
46323
46323
|
}
|
|
46324
|
-
const [
|
|
46325
|
-
const binary =
|
|
46324
|
+
const [path59, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
46325
|
+
const binary = path59.split("/").pop();
|
|
46326
46326
|
if (binary === "env") {
|
|
46327
46327
|
return argument;
|
|
46328
46328
|
}
|
|
@@ -46355,7 +46355,7 @@ var require_readShebang = __commonJS({
|
|
|
46355
46355
|
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
|
|
46356
46356
|
var require_parse = __commonJS({
|
|
46357
46357
|
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports, module) {
|
|
46358
|
-
var
|
|
46358
|
+
var path59 = __require("path");
|
|
46359
46359
|
var resolveCommand = require_resolveCommand();
|
|
46360
46360
|
var escape4 = require_escape();
|
|
46361
46361
|
var readShebang = require_readShebang();
|
|
@@ -46380,7 +46380,7 @@ var require_parse = __commonJS({
|
|
|
46380
46380
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
46381
46381
|
if (parsed.options.forceShell || needsShell) {
|
|
46382
46382
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
46383
|
-
parsed.command =
|
|
46383
|
+
parsed.command = path59.normalize(parsed.command);
|
|
46384
46384
|
parsed.command = escape4.command(parsed.command);
|
|
46385
46385
|
parsed.args = parsed.args.map((arg) => escape4.argument(arg, needsDoubleEscapeMetaChars));
|
|
46386
46386
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
@@ -46468,7 +46468,7 @@ var require_cross_spawn = __commonJS({
|
|
|
46468
46468
|
var cp = __require("child_process");
|
|
46469
46469
|
var parse2 = require_parse();
|
|
46470
46470
|
var enoent = require_enoent();
|
|
46471
|
-
function
|
|
46471
|
+
function spawn17(command, args, options) {
|
|
46472
46472
|
const parsed = parse2(command, args, options);
|
|
46473
46473
|
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
46474
46474
|
enoent.hookChildProcess(spawned, parsed);
|
|
@@ -46480,8 +46480,8 @@ var require_cross_spawn = __commonJS({
|
|
|
46480
46480
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
46481
46481
|
return result;
|
|
46482
46482
|
}
|
|
46483
|
-
module.exports =
|
|
46484
|
-
module.exports.spawn =
|
|
46483
|
+
module.exports = spawn17;
|
|
46484
|
+
module.exports.spawn = spawn17;
|
|
46485
46485
|
module.exports.sync = spawnSync5;
|
|
46486
46486
|
module.exports._parse = parse2;
|
|
46487
46487
|
module.exports._enoent = enoent;
|
|
@@ -74168,10 +74168,10 @@ var require_react_reconciler_development = __commonJS({
|
|
|
74168
74168
|
var setErrorHandler = null;
|
|
74169
74169
|
var setSuspenseHandler = null;
|
|
74170
74170
|
{
|
|
74171
|
-
var copyWithDeleteImpl = function(obj,
|
|
74172
|
-
var key =
|
|
74171
|
+
var copyWithDeleteImpl = function(obj, path59, index2) {
|
|
74172
|
+
var key = path59[index2];
|
|
74173
74173
|
var updated = isArray(obj) ? obj.slice() : assign({}, obj);
|
|
74174
|
-
if (index2 + 1 ===
|
|
74174
|
+
if (index2 + 1 === path59.length) {
|
|
74175
74175
|
if (isArray(updated)) {
|
|
74176
74176
|
updated.splice(key, 1);
|
|
74177
74177
|
} else {
|
|
@@ -74179,11 +74179,11 @@ var require_react_reconciler_development = __commonJS({
|
|
|
74179
74179
|
}
|
|
74180
74180
|
return updated;
|
|
74181
74181
|
}
|
|
74182
|
-
updated[key] = copyWithDeleteImpl(obj[key],
|
|
74182
|
+
updated[key] = copyWithDeleteImpl(obj[key], path59, index2 + 1);
|
|
74183
74183
|
return updated;
|
|
74184
74184
|
};
|
|
74185
|
-
var copyWithDelete = function(obj,
|
|
74186
|
-
return copyWithDeleteImpl(obj,
|
|
74185
|
+
var copyWithDelete = function(obj, path59) {
|
|
74186
|
+
return copyWithDeleteImpl(obj, path59, 0);
|
|
74187
74187
|
};
|
|
74188
74188
|
var copyWithRenameImpl = function(obj, oldPath, newPath, index2) {
|
|
74189
74189
|
var oldKey = oldPath[index2];
|
|
@@ -74221,17 +74221,17 @@ var require_react_reconciler_development = __commonJS({
|
|
|
74221
74221
|
}
|
|
74222
74222
|
return copyWithRenameImpl(obj, oldPath, newPath, 0);
|
|
74223
74223
|
};
|
|
74224
|
-
var copyWithSetImpl = function(obj,
|
|
74225
|
-
if (index2 >=
|
|
74224
|
+
var copyWithSetImpl = function(obj, path59, index2, value) {
|
|
74225
|
+
if (index2 >= path59.length) {
|
|
74226
74226
|
return value;
|
|
74227
74227
|
}
|
|
74228
|
-
var key =
|
|
74228
|
+
var key = path59[index2];
|
|
74229
74229
|
var updated = isArray(obj) ? obj.slice() : assign({}, obj);
|
|
74230
|
-
updated[key] = copyWithSetImpl(obj[key],
|
|
74230
|
+
updated[key] = copyWithSetImpl(obj[key], path59, index2 + 1, value);
|
|
74231
74231
|
return updated;
|
|
74232
74232
|
};
|
|
74233
|
-
var copyWithSet = function(obj,
|
|
74234
|
-
return copyWithSetImpl(obj,
|
|
74233
|
+
var copyWithSet = function(obj, path59, value) {
|
|
74234
|
+
return copyWithSetImpl(obj, path59, 0, value);
|
|
74235
74235
|
};
|
|
74236
74236
|
var findHook = function(fiber, id) {
|
|
74237
74237
|
var currentHook2 = fiber.memoizedState;
|
|
@@ -74241,10 +74241,10 @@ var require_react_reconciler_development = __commonJS({
|
|
|
74241
74241
|
}
|
|
74242
74242
|
return currentHook2;
|
|
74243
74243
|
};
|
|
74244
|
-
overrideHookState = function(fiber, id,
|
|
74244
|
+
overrideHookState = function(fiber, id, path59, value) {
|
|
74245
74245
|
var hook = findHook(fiber, id);
|
|
74246
74246
|
if (hook !== null) {
|
|
74247
|
-
var newState = copyWithSet(hook.memoizedState,
|
|
74247
|
+
var newState = copyWithSet(hook.memoizedState, path59, value);
|
|
74248
74248
|
hook.memoizedState = newState;
|
|
74249
74249
|
hook.baseState = newState;
|
|
74250
74250
|
fiber.memoizedProps = assign({}, fiber.memoizedProps);
|
|
@@ -74254,10 +74254,10 @@ var require_react_reconciler_development = __commonJS({
|
|
|
74254
74254
|
}
|
|
74255
74255
|
}
|
|
74256
74256
|
};
|
|
74257
|
-
overrideHookStateDeletePath = function(fiber, id,
|
|
74257
|
+
overrideHookStateDeletePath = function(fiber, id, path59) {
|
|
74258
74258
|
var hook = findHook(fiber, id);
|
|
74259
74259
|
if (hook !== null) {
|
|
74260
|
-
var newState = copyWithDelete(hook.memoizedState,
|
|
74260
|
+
var newState = copyWithDelete(hook.memoizedState, path59);
|
|
74261
74261
|
hook.memoizedState = newState;
|
|
74262
74262
|
hook.baseState = newState;
|
|
74263
74263
|
fiber.memoizedProps = assign({}, fiber.memoizedProps);
|
|
@@ -74280,8 +74280,8 @@ var require_react_reconciler_development = __commonJS({
|
|
|
74280
74280
|
}
|
|
74281
74281
|
}
|
|
74282
74282
|
};
|
|
74283
|
-
overrideProps = function(fiber,
|
|
74284
|
-
fiber.pendingProps = copyWithSet(fiber.memoizedProps,
|
|
74283
|
+
overrideProps = function(fiber, path59, value) {
|
|
74284
|
+
fiber.pendingProps = copyWithSet(fiber.memoizedProps, path59, value);
|
|
74285
74285
|
if (fiber.alternate) {
|
|
74286
74286
|
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
74287
74287
|
}
|
|
@@ -74290,8 +74290,8 @@ var require_react_reconciler_development = __commonJS({
|
|
|
74290
74290
|
scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp);
|
|
74291
74291
|
}
|
|
74292
74292
|
};
|
|
74293
|
-
overridePropsDeletePath = function(fiber,
|
|
74294
|
-
fiber.pendingProps = copyWithDelete(fiber.memoizedProps,
|
|
74293
|
+
overridePropsDeletePath = function(fiber, path59) {
|
|
74294
|
+
fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path59);
|
|
74295
74295
|
if (fiber.alternate) {
|
|
74296
74296
|
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
74297
74297
|
}
|
|
@@ -81733,8 +81733,8 @@ var init_ErrorOverview = __esm({
|
|
|
81733
81733
|
init_dist7();
|
|
81734
81734
|
init_Box();
|
|
81735
81735
|
init_Text();
|
|
81736
|
-
cleanupPath = (
|
|
81737
|
-
return
|
|
81736
|
+
cleanupPath = (path59) => {
|
|
81737
|
+
return path59?.replace(`file://${cwd()}/`, "");
|
|
81738
81738
|
};
|
|
81739
81739
|
stackUtils = new import_stack_utils.default({
|
|
81740
81740
|
cwd: cwd(),
|
|
@@ -85772,7 +85772,7 @@ var init_StatusLine = __esm({
|
|
|
85772
85772
|
init_theme();
|
|
85773
85773
|
await init_Spinner();
|
|
85774
85774
|
await init_ModeFooter();
|
|
85775
|
-
StatusLine = ({ busyStartedAt, queueCount, modeName, modeBadge, provider, model, mcp, contextUsed, contextWindow }) => {
|
|
85775
|
+
StatusLine = ({ busyStartedAt, queueCount, modeName, modeBadge, provider, model, mcp, contextUsed, contextWindow, version, updateLatest }) => {
|
|
85776
85776
|
const busy = busyStartedAt != null;
|
|
85777
85777
|
const showQueue = (queueCount ?? 0) > 0;
|
|
85778
85778
|
const showMcp = !!(mcp && mcp.enabled > 0);
|
|
@@ -85783,7 +85783,7 @@ var init_StatusLine = __esm({
|
|
|
85783
85783
|
// with the busy marker / idle hint trailing it — so the user always
|
|
85784
85784
|
// sees the mode even mid-run, when a plain footer would be hidden.
|
|
85785
85785
|
(0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [(0, import_jsx_runtime21.jsx)(ModeBadgePill, { badge: modeBadge }), (0, import_jsx_runtime21.jsx)(Text, { children: " " }), busy ? (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [(0, import_jsx_runtime21.jsx)(BusyMarker, { startedAt: busyStartedAt }), queuedTail] }) : (0, import_jsx_runtime21.jsx)(Text, { color: Colors.chrome, dimColor: true, children: "Esc stops \xB7 shift+tab to change" })] })
|
|
85786
|
-
) : busy ? (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [(0, import_jsx_runtime21.jsx)(BusyMarker, { startedAt: busyStartedAt }), queuedTail] }) : (0, import_jsx_runtime21.jsx)(ModeFooter, { modeName }) }), (0, import_jsx_runtime21.jsxs)(Box_default, { children: [(0, import_jsx_runtime21.jsx)(ProviderBadge, { name: provider }), (0, import_jsx_runtime21.jsx)(Text, { dimColor: true, children: ` ${model}` }), showMcp ? (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [(0, import_jsx_runtime21.jsx)(Text, { dimColor: true, children: ` ${Glyphs.midDot} ` }), (0, import_jsx_runtime21.jsx)(Text, { dimColor: true, children: "mcp " }), (0, import_jsx_runtime21.jsx)(Text, { children: `${mcp.connected}/${mcp.enabled}` })] }) : null, showCtx ? (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [(0, import_jsx_runtime21.jsx)(Text, { dimColor: true, children: ` ${Glyphs.midDot} ` }), (0, import_jsx_runtime21.jsx)(ContextMeter, { used: contextUsed ?? 0, total: contextWindow })] }) : null] })] });
|
|
85786
|
+
) : busy ? (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [(0, import_jsx_runtime21.jsx)(BusyMarker, { startedAt: busyStartedAt }), queuedTail] }) : (0, import_jsx_runtime21.jsx)(ModeFooter, { modeName }) }), (0, import_jsx_runtime21.jsxs)(Box_default, { children: [(0, import_jsx_runtime21.jsx)(ProviderBadge, { name: provider }), (0, import_jsx_runtime21.jsx)(Text, { dimColor: true, children: ` ${model}` }), showMcp ? (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [(0, import_jsx_runtime21.jsx)(Text, { dimColor: true, children: ` ${Glyphs.midDot} ` }), (0, import_jsx_runtime21.jsx)(Text, { dimColor: true, children: "mcp " }), (0, import_jsx_runtime21.jsx)(Text, { children: `${mcp.connected}/${mcp.enabled}` })] }) : null, showCtx ? (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [(0, import_jsx_runtime21.jsx)(Text, { dimColor: true, children: ` ${Glyphs.midDot} ` }), (0, import_jsx_runtime21.jsx)(ContextMeter, { used: contextUsed ?? 0, total: contextWindow })] }) : null, version ? (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [(0, import_jsx_runtime21.jsx)(Text, { dimColor: true, children: ` ${Glyphs.midDot} ` }), updateLatest ? (0, import_jsx_runtime21.jsx)(Text, { color: "yellow", children: `v${version} ${Glyphs.contextUp}${updateLatest}` }) : (0, import_jsx_runtime21.jsx)(Text, { dimColor: true, children: `v${version}` })] }) : null] })] });
|
|
85787
85787
|
};
|
|
85788
85788
|
ProviderBadge = ({ name }) => (0, import_jsx_runtime21.jsx)(Text, { backgroundColor: Colors.chrome, color: "black", bold: true, children: ` ${name} ` });
|
|
85789
85789
|
ModeBadgePill = ({ badge }) => (0, import_jsx_runtime21.jsx)(Text, { backgroundColor: badgeBackground(badge.tone), color: "black", bold: true, children: ` ${badge.label} ` });
|
|
@@ -88304,7 +88304,7 @@ var init_SessionView = __esm({
|
|
|
88304
88304
|
await init_run_slash();
|
|
88305
88305
|
await init_OverlayOrNotice();
|
|
88306
88306
|
await init_InteractiveZone();
|
|
88307
|
-
SessionView = ({ session, registerInteractiveResolver, model, initialPrompt }) => {
|
|
88307
|
+
SessionView = ({ session, registerInteractiveResolver, model, version, updateAvailable, initialPrompt }) => {
|
|
88308
88308
|
const { exit } = use_app_default();
|
|
88309
88309
|
const stream = useEventStream(session);
|
|
88310
88310
|
const [systemNotice, setSystemNotice] = (0, import_react62.useState)(null);
|
|
@@ -88478,6 +88478,13 @@ var init_SessionView = __esm({
|
|
|
88478
88478
|
firedInitial.current = true;
|
|
88479
88479
|
void handleSubmit(initialPrompt);
|
|
88480
88480
|
}, [initialPrompt]);
|
|
88481
|
+
const firedUpdateNotice = (0, import_react62.useRef)(false);
|
|
88482
|
+
(0, import_react62.useEffect)(() => {
|
|
88483
|
+
if (firedUpdateNotice.current || !updateAvailable || initialPrompt)
|
|
88484
|
+
return;
|
|
88485
|
+
firedUpdateNotice.current = true;
|
|
88486
|
+
setSystemNotice(`\u2728 moxxy ${updateAvailable.latest} available \u2014 run \`moxxy update\``);
|
|
88487
|
+
}, [updateAvailable, initialPrompt]);
|
|
88481
88488
|
return (0, import_jsx_runtime34.jsxs)(Box_default, { flexDirection: "column", children: [(0, import_jsx_runtime34.jsx)(ChatView, { events: stream.events, streamingDelta: stream.streamingDelta, expandToolOutputs, compactTools, hideLive: overlay != null || picker != null || pendingPermission != null || pendingApproval != null }), (0, import_jsx_runtime34.jsx)(OverlayOrNotice, { overlay, systemNotice, session, events: stream.events, contextWindow, contextTokens: contextUsed, onClose: () => setOverlay(null) }), (0, import_jsx_runtime34.jsx)(InteractiveZone, { session, pendingPermission, pendingPermissionDepth: Math.max(0, permissions.pendingPermissions.length - 1), pendingApproval, picker, busy: turn.busy, voiceReady: voice.ready, voicePhase: voice.phase, yolo, slashCommands: slashSuggestions, queueMessages: turn.queueRef.current, priorityMessage: turn.priorityMessage, commandHotkeys, onCycleMode: cycleMode, externalInsert: voice.externalInsert, onPermissionDecide: (perm, decision) => {
|
|
88482
88489
|
permissions.setPendingPermissions((prev) => prev.slice(1));
|
|
88483
88490
|
if (decision.mode === "allow_always") {
|
|
@@ -88490,7 +88497,7 @@ var init_SessionView = __esm({
|
|
|
88490
88497
|
const { resolve: resolve12 } = pendingApproval;
|
|
88491
88498
|
permissions.setPendingApproval(null);
|
|
88492
88499
|
resolve12(decision);
|
|
88493
|
-
}, onPickerSelect: handlePickerSelect, onPickerCancel: () => setPicker(null), onSubmit: handleSubmit, onPasteText: images.handlePasteText }), (0, import_jsx_runtime34.jsx)(StatusLine, { busyStartedAt: turn.busy && !pendingPermission && !pendingApproval ? turn.busyStartedAt : null, queueCount: turn.queueCount, modeName, modeBadge, provider: providerName, model: activeModel2, mcp: mcpStatus, contextUsed, ...contextWindow ? { contextWindow } : {} })] });
|
|
88500
|
+
}, onPickerSelect: handlePickerSelect, onPickerCancel: () => setPicker(null), onSubmit: handleSubmit, onPasteText: images.handlePasteText }), (0, import_jsx_runtime34.jsx)(StatusLine, { busyStartedAt: turn.busy && !pendingPermission && !pendingApproval ? turn.busyStartedAt : null, queueCount: turn.queueCount, modeName, modeBadge, provider: providerName, model: activeModel2, mcp: mcpStatus, contextUsed, ...contextWindow ? { contextWindow } : {}, ...version ? { version } : {}, ...updateAvailable ? { updateLatest: updateAvailable.latest } : {} })] });
|
|
88494
88501
|
};
|
|
88495
88502
|
}
|
|
88496
88503
|
});
|
|
@@ -88511,7 +88518,7 @@ var init_BootShell = __esm({
|
|
|
88511
88518
|
await init_SessionView();
|
|
88512
88519
|
await init_OverlayOrNotice();
|
|
88513
88520
|
init_use_voice_input();
|
|
88514
|
-
InteractiveSession = ({ session: eagerSession, bootstrap, registerInteractiveResolver, model, resumed }) => {
|
|
88521
|
+
InteractiveSession = ({ session: eagerSession, bootstrap, registerInteractiveResolver, model, version, updateAvailable, resumed }) => {
|
|
88515
88522
|
const [session, setSession] = (0, import_react63.useState)(eagerSession ?? null);
|
|
88516
88523
|
const [bootEvents, setBootEvents] = (0, import_react63.useState)([]);
|
|
88517
88524
|
const [bootError, setBootError] = (0, import_react63.useState)(null);
|
|
@@ -88563,7 +88570,7 @@ var init_BootShell = __esm({
|
|
|
88563
88570
|
if (!session || initialPrompt == null && !resumed) {
|
|
88564
88571
|
return (0, import_jsx_runtime35.jsxs)(Box_default, { flexDirection: "column", children: [(0, import_jsx_runtime35.jsx)(BootScreen, { events: bootEvents, startedAt, ...bootError ? { error: bootError } : {} }), session ? (0, import_jsx_runtime35.jsx)(BootInputArea, { session, ready: bootError == null, bootError, onSubmit: (text) => setInitialPrompt(text) }) : (0, import_jsx_runtime35.jsx)(DisabledBootInput, { placeholder: bootError ? "Bootstrap failed \u2014 quit and run `moxxy init`" : "Initializing\u2026" })] });
|
|
88565
88572
|
}
|
|
88566
|
-
return (0, import_jsx_runtime35.jsx)(SessionView, { session, registerInteractiveResolver, ...initialPrompt ? { initialPrompt } : {}, ...model ? { model } : {} });
|
|
88573
|
+
return (0, import_jsx_runtime35.jsx)(SessionView, { session, registerInteractiveResolver, ...initialPrompt ? { initialPrompt } : {}, ...model ? { model } : {}, ...version ? { version } : {}, ...updateAvailable ? { updateAvailable } : {} });
|
|
88567
88574
|
};
|
|
88568
88575
|
BootInputArea = ({ session, ready, bootError, onSubmit }) => {
|
|
88569
88576
|
const [systemNotice, setSystemNotice] = (0, import_react63.useState)(null);
|
|
@@ -92661,13 +92668,13 @@ var MultipartBody = class {
|
|
|
92661
92668
|
}
|
|
92662
92669
|
};
|
|
92663
92670
|
var fileFromPathWarned = false;
|
|
92664
|
-
async function fileFromPath3(
|
|
92671
|
+
async function fileFromPath3(path59, ...args) {
|
|
92665
92672
|
const { fileFromPath: _fileFromPath } = await Promise.resolve().then(() => (init_fileFromPath(), fileFromPath_exports));
|
|
92666
92673
|
if (!fileFromPathWarned) {
|
|
92667
|
-
console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(
|
|
92674
|
+
console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path59)}) instead`);
|
|
92668
92675
|
fileFromPathWarned = true;
|
|
92669
92676
|
}
|
|
92670
|
-
return await _fileFromPath(
|
|
92677
|
+
return await _fileFromPath(path59, ...args);
|
|
92671
92678
|
}
|
|
92672
92679
|
var defaultHttpAgent = new import_agentkeepalive.default({ keepAlive: true, timeout: 5 * 60 * 1e3 });
|
|
92673
92680
|
var defaultHttpsAgent = new import_agentkeepalive.default.HttpsAgent({ keepAlive: true, timeout: 5 * 60 * 1e3 });
|
|
@@ -93390,29 +93397,29 @@ var APIClient = class {
|
|
|
93390
93397
|
defaultIdempotencyKey() {
|
|
93391
93398
|
return `stainless-node-retry-${uuid4()}`;
|
|
93392
93399
|
}
|
|
93393
|
-
get(
|
|
93394
|
-
return this.methodRequest("get",
|
|
93400
|
+
get(path59, opts) {
|
|
93401
|
+
return this.methodRequest("get", path59, opts);
|
|
93395
93402
|
}
|
|
93396
|
-
post(
|
|
93397
|
-
return this.methodRequest("post",
|
|
93403
|
+
post(path59, opts) {
|
|
93404
|
+
return this.methodRequest("post", path59, opts);
|
|
93398
93405
|
}
|
|
93399
|
-
patch(
|
|
93400
|
-
return this.methodRequest("patch",
|
|
93406
|
+
patch(path59, opts) {
|
|
93407
|
+
return this.methodRequest("patch", path59, opts);
|
|
93401
93408
|
}
|
|
93402
|
-
put(
|
|
93403
|
-
return this.methodRequest("put",
|
|
93409
|
+
put(path59, opts) {
|
|
93410
|
+
return this.methodRequest("put", path59, opts);
|
|
93404
93411
|
}
|
|
93405
|
-
delete(
|
|
93406
|
-
return this.methodRequest("delete",
|
|
93412
|
+
delete(path59, opts) {
|
|
93413
|
+
return this.methodRequest("delete", path59, opts);
|
|
93407
93414
|
}
|
|
93408
|
-
methodRequest(method,
|
|
93415
|
+
methodRequest(method, path59, opts) {
|
|
93409
93416
|
return this.request(Promise.resolve(opts).then(async (opts2) => {
|
|
93410
93417
|
const body = opts2 && isBlobLike(opts2?.body) ? new DataView(await opts2.body.arrayBuffer()) : opts2?.body instanceof DataView ? opts2.body : opts2?.body instanceof ArrayBuffer ? new DataView(opts2.body) : opts2 && ArrayBuffer.isView(opts2?.body) ? new DataView(opts2.body.buffer) : opts2?.body;
|
|
93411
|
-
return { method, path:
|
|
93418
|
+
return { method, path: path59, ...opts2, body };
|
|
93412
93419
|
}));
|
|
93413
93420
|
}
|
|
93414
|
-
getAPIList(
|
|
93415
|
-
return this.requestAPIList(Page3, { method: "get", path:
|
|
93421
|
+
getAPIList(path59, Page3, opts) {
|
|
93422
|
+
return this.requestAPIList(Page3, { method: "get", path: path59, ...opts });
|
|
93416
93423
|
}
|
|
93417
93424
|
calculateContentLength(body) {
|
|
93418
93425
|
if (typeof body === "string") {
|
|
@@ -93431,10 +93438,10 @@ var APIClient = class {
|
|
|
93431
93438
|
}
|
|
93432
93439
|
buildRequest(inputOptions, { retryCount = 0 } = {}) {
|
|
93433
93440
|
const options = { ...inputOptions };
|
|
93434
|
-
const { method, path:
|
|
93441
|
+
const { method, path: path59, query, headers = {} } = options;
|
|
93435
93442
|
const body = ArrayBuffer.isView(options.body) || options.__binaryRequest && typeof options.body === "string" ? options.body : isMultipartBody(options.body) ? options.body.body : options.body ? JSON.stringify(options.body, null, 2) : null;
|
|
93436
93443
|
const contentLength = this.calculateContentLength(body);
|
|
93437
|
-
const url2 = this.buildURL(
|
|
93444
|
+
const url2 = this.buildURL(path59, query);
|
|
93438
93445
|
if ("timeout" in options)
|
|
93439
93446
|
validatePositiveInteger("timeout", options.timeout);
|
|
93440
93447
|
options.timeout = options.timeout ?? this.timeout;
|
|
@@ -93558,8 +93565,8 @@ var APIClient = class {
|
|
|
93558
93565
|
const request = this.makeRequest(options, null);
|
|
93559
93566
|
return new PagePromise(this, request, Page3);
|
|
93560
93567
|
}
|
|
93561
|
-
buildURL(
|
|
93562
|
-
const url2 = isAbsoluteURL(
|
|
93568
|
+
buildURL(path59, query) {
|
|
93569
|
+
const url2 = isAbsoluteURL(path59) ? new URL(path59) : new URL(this.baseURL + (this.baseURL.endsWith("/") && path59.startsWith("/") ? path59.slice(1) : path59));
|
|
93563
93570
|
const defaultQuery = this.defaultQuery();
|
|
93564
93571
|
if (!isEmptyObj(defaultQuery)) {
|
|
93565
93572
|
query = { ...defaultQuery, ...query };
|
|
@@ -96712,13 +96719,13 @@ var MultipartBody2 = class {
|
|
|
96712
96719
|
}
|
|
96713
96720
|
};
|
|
96714
96721
|
var fileFromPathWarned2 = false;
|
|
96715
|
-
async function fileFromPath5(
|
|
96722
|
+
async function fileFromPath5(path59, ...args) {
|
|
96716
96723
|
const { fileFromPath: _fileFromPath } = await Promise.resolve().then(() => (init_fileFromPath(), fileFromPath_exports));
|
|
96717
96724
|
if (!fileFromPathWarned2) {
|
|
96718
|
-
console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(
|
|
96725
|
+
console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path59)}) instead`);
|
|
96719
96726
|
fileFromPathWarned2 = true;
|
|
96720
96727
|
}
|
|
96721
|
-
return await _fileFromPath(
|
|
96728
|
+
return await _fileFromPath(path59, ...args);
|
|
96722
96729
|
}
|
|
96723
96730
|
var defaultHttpAgent2 = new import_agentkeepalive2.default({ keepAlive: true, timeout: 5 * 60 * 1e3 });
|
|
96724
96731
|
var defaultHttpsAgent2 = new import_agentkeepalive2.default.HttpsAgent({ keepAlive: true, timeout: 5 * 60 * 1e3 });
|
|
@@ -97496,29 +97503,29 @@ var APIClient2 = class {
|
|
|
97496
97503
|
defaultIdempotencyKey() {
|
|
97497
97504
|
return `stainless-node-retry-${uuid42()}`;
|
|
97498
97505
|
}
|
|
97499
|
-
get(
|
|
97500
|
-
return this.methodRequest("get",
|
|
97506
|
+
get(path59, opts) {
|
|
97507
|
+
return this.methodRequest("get", path59, opts);
|
|
97501
97508
|
}
|
|
97502
|
-
post(
|
|
97503
|
-
return this.methodRequest("post",
|
|
97509
|
+
post(path59, opts) {
|
|
97510
|
+
return this.methodRequest("post", path59, opts);
|
|
97504
97511
|
}
|
|
97505
|
-
patch(
|
|
97506
|
-
return this.methodRequest("patch",
|
|
97512
|
+
patch(path59, opts) {
|
|
97513
|
+
return this.methodRequest("patch", path59, opts);
|
|
97507
97514
|
}
|
|
97508
|
-
put(
|
|
97509
|
-
return this.methodRequest("put",
|
|
97515
|
+
put(path59, opts) {
|
|
97516
|
+
return this.methodRequest("put", path59, opts);
|
|
97510
97517
|
}
|
|
97511
|
-
delete(
|
|
97512
|
-
return this.methodRequest("delete",
|
|
97518
|
+
delete(path59, opts) {
|
|
97519
|
+
return this.methodRequest("delete", path59, opts);
|
|
97513
97520
|
}
|
|
97514
|
-
methodRequest(method,
|
|
97521
|
+
methodRequest(method, path59, opts) {
|
|
97515
97522
|
return this.request(Promise.resolve(opts).then(async (opts2) => {
|
|
97516
97523
|
const body = opts2 && isBlobLike2(opts2?.body) ? new DataView(await opts2.body.arrayBuffer()) : opts2?.body instanceof DataView ? opts2.body : opts2?.body instanceof ArrayBuffer ? new DataView(opts2.body) : opts2 && ArrayBuffer.isView(opts2?.body) ? new DataView(opts2.body.buffer) : opts2?.body;
|
|
97517
|
-
return { method, path:
|
|
97524
|
+
return { method, path: path59, ...opts2, body };
|
|
97518
97525
|
}));
|
|
97519
97526
|
}
|
|
97520
|
-
getAPIList(
|
|
97521
|
-
return this.requestAPIList(Page3, { method: "get", path:
|
|
97527
|
+
getAPIList(path59, Page3, opts) {
|
|
97528
|
+
return this.requestAPIList(Page3, { method: "get", path: path59, ...opts });
|
|
97522
97529
|
}
|
|
97523
97530
|
calculateContentLength(body) {
|
|
97524
97531
|
if (typeof body === "string") {
|
|
@@ -97537,10 +97544,10 @@ var APIClient2 = class {
|
|
|
97537
97544
|
}
|
|
97538
97545
|
buildRequest(inputOptions, { retryCount = 0 } = {}) {
|
|
97539
97546
|
const options = { ...inputOptions };
|
|
97540
|
-
const { method, path:
|
|
97547
|
+
const { method, path: path59, query, headers = {} } = options;
|
|
97541
97548
|
const body = ArrayBuffer.isView(options.body) || options.__binaryRequest && typeof options.body === "string" ? options.body : isMultipartBody2(options.body) ? options.body.body : options.body ? JSON.stringify(options.body, null, 2) : null;
|
|
97542
97549
|
const contentLength = this.calculateContentLength(body);
|
|
97543
|
-
const url2 = this.buildURL(
|
|
97550
|
+
const url2 = this.buildURL(path59, query);
|
|
97544
97551
|
if ("timeout" in options)
|
|
97545
97552
|
validatePositiveInteger2("timeout", options.timeout);
|
|
97546
97553
|
options.timeout = options.timeout ?? this.timeout;
|
|
@@ -97656,8 +97663,8 @@ var APIClient2 = class {
|
|
|
97656
97663
|
const request = this.makeRequest(options, null);
|
|
97657
97664
|
return new PagePromise2(this, request, Page3);
|
|
97658
97665
|
}
|
|
97659
|
-
buildURL(
|
|
97660
|
-
const url2 = isAbsoluteURL2(
|
|
97666
|
+
buildURL(path59, query) {
|
|
97667
|
+
const url2 = isAbsoluteURL2(path59) ? new URL(path59) : new URL(this.baseURL + (this.baseURL.endsWith("/") && path59.startsWith("/") ? path59.slice(1) : path59));
|
|
97661
97668
|
const defaultQuery = this.defaultQuery();
|
|
97662
97669
|
if (!isEmptyObj2(defaultQuery)) {
|
|
97663
97670
|
query = { ...defaultQuery, ...query };
|
|
@@ -103037,11 +103044,11 @@ function buildAuthUrl(input) {
|
|
|
103037
103044
|
}
|
|
103038
103045
|
async function runAuthorizationCodeFlow(opts) {
|
|
103039
103046
|
const port = opts.redirectPort ?? 8765;
|
|
103040
|
-
const
|
|
103047
|
+
const path59 = opts.redirectPath ?? "/callback";
|
|
103041
103048
|
const codeVerifier = generateCodeVerifier();
|
|
103042
103049
|
const codeChallenge = computeCodeChallenge(codeVerifier);
|
|
103043
103050
|
const state = generateState();
|
|
103044
|
-
const redirectUri = `http://localhost:${port}${
|
|
103051
|
+
const redirectUri = `http://localhost:${port}${path59}`;
|
|
103045
103052
|
const authUrl = buildAuthUrl({
|
|
103046
103053
|
authUrl: opts.authUrl,
|
|
103047
103054
|
clientId: opts.clientId,
|
|
@@ -103053,7 +103060,7 @@ async function runAuthorizationCodeFlow(opts) {
|
|
|
103053
103060
|
});
|
|
103054
103061
|
const codePromise = waitForCallback({
|
|
103055
103062
|
port,
|
|
103056
|
-
path:
|
|
103063
|
+
path: path59,
|
|
103057
103064
|
expectedState: state,
|
|
103058
103065
|
timeoutMs: opts.timeoutMs ?? 3e5,
|
|
103059
103066
|
...opts.signal ? { signal: opts.signal } : {}
|
|
@@ -103401,11 +103408,11 @@ function buildOauthAuthorizeTool(deps) {
|
|
|
103401
103408
|
const { computeCodeChallenge: computeCodeChallenge2 } = await Promise.resolve().then(() => (init_pkce(), pkce_exports));
|
|
103402
103409
|
const challenge = computeCodeChallenge2(verifier);
|
|
103403
103410
|
const port = input.redirectPort ?? 8765;
|
|
103404
|
-
const
|
|
103411
|
+
const path59 = input.redirectPath ?? "/callback";
|
|
103405
103412
|
const url2 = buildAuthUrl({
|
|
103406
103413
|
authUrl: input.authUrl,
|
|
103407
103414
|
clientId: input.clientId,
|
|
103408
|
-
redirectUri: `http://localhost:${port}${
|
|
103415
|
+
redirectUri: `http://localhost:${port}${path59}`,
|
|
103409
103416
|
scopes: input.scopes,
|
|
103410
103417
|
codeChallenge: challenge,
|
|
103411
103418
|
state,
|
|
@@ -103547,7 +103554,7 @@ async function runOauthLogin(profile, ctx) {
|
|
|
103547
103554
|
}
|
|
103548
103555
|
async function runBrowserFlow(profile, ctx) {
|
|
103549
103556
|
const port = profile.redirect?.port ?? 8765;
|
|
103550
|
-
const
|
|
103557
|
+
const path59 = profile.redirect?.path ?? "/callback";
|
|
103551
103558
|
const serviceName = profile.displayName ?? profile.id;
|
|
103552
103559
|
return runAuthorizationCodeFlow({
|
|
103553
103560
|
authUrl: profile.authUrl,
|
|
@@ -103556,7 +103563,7 @@ async function runBrowserFlow(profile, ctx) {
|
|
|
103556
103563
|
...profile.clientSecret ? { clientSecret: profile.clientSecret } : {},
|
|
103557
103564
|
scopes: profile.scopes,
|
|
103558
103565
|
redirectPort: port,
|
|
103559
|
-
redirectPath:
|
|
103566
|
+
redirectPath: path59,
|
|
103560
103567
|
...profile.extraAuthParams ? { extraAuthParams: profile.extraAuthParams } : {},
|
|
103561
103568
|
timeoutMs: DEFAULT_BROWSER_TIMEOUT_MS,
|
|
103562
103569
|
...ctx.signal ? { signal: ctx.signal } : {},
|
|
@@ -103568,7 +103575,7 @@ If your browser doesn't open automatically, paste this URL:
|
|
|
103568
103575
|
|
|
103569
103576
|
${url2}
|
|
103570
103577
|
|
|
103571
|
-
Waiting for callback on http://localhost:${port}${
|
|
103578
|
+
Waiting for callback on http://localhost:${port}${path59} (5 min timeout)\u2026
|
|
103572
103579
|
|
|
103573
103580
|
`);
|
|
103574
103581
|
}
|
|
@@ -105578,7 +105585,11 @@ async function* runDefaultMode(ctx) {
|
|
|
105578
105585
|
continue;
|
|
105579
105586
|
}
|
|
105580
105587
|
reactiveCompactions = 0;
|
|
105581
|
-
const stuck = yield* emitRequestsAndDetectStuck(ctx, toolUses, detector
|
|
105588
|
+
const stuck = yield* emitRequestsAndDetectStuck(ctx, toolUses, detector, {
|
|
105589
|
+
abortedResultMessage: "default mode loop aborted (stuck pattern) before this call ran",
|
|
105590
|
+
nearHint: "against the same target (only volatile args like maxBytes varied)",
|
|
105591
|
+
fatalMessage: ({ toolName, count, how }) => `default mode loop aborted \u2014 detected stuck pattern: tool "${toolName}" called ${count} times ${how}. The model is likely looping on the same call; reset or rephrase.`
|
|
105592
|
+
});
|
|
105582
105593
|
if (stuck)
|
|
105583
105594
|
return;
|
|
105584
105595
|
if (text || stopReason === "end_turn" || toolUses.length === 0) {
|
|
@@ -105606,79 +105617,6 @@ async function* runDefaultMode(ctx) {
|
|
|
105606
105617
|
message: `default mode loop exceeded maxIterations (${maxIterations})`
|
|
105607
105618
|
});
|
|
105608
105619
|
}
|
|
105609
|
-
async function* emitRequestsAndDetectStuck(ctx, toolUses, detector) {
|
|
105610
|
-
const emitted = [];
|
|
105611
|
-
for (const t2 of toolUses) {
|
|
105612
|
-
yield await ctx.emit({
|
|
105613
|
-
type: "tool_call_requested",
|
|
105614
|
-
sessionId: ctx.sessionId,
|
|
105615
|
-
turnId: ctx.turnId,
|
|
105616
|
-
source: "model",
|
|
105617
|
-
callId: asToolCallId(t2.id),
|
|
105618
|
-
name: t2.name,
|
|
105619
|
-
input: t2.input
|
|
105620
|
-
});
|
|
105621
|
-
emitted.push(t2);
|
|
105622
|
-
const sig = detector.record(t2.name, t2.input);
|
|
105623
|
-
if (sig.stuck) {
|
|
105624
|
-
for (const r2 of emitted) {
|
|
105625
|
-
yield await ctx.emit({
|
|
105626
|
-
type: "tool_result",
|
|
105627
|
-
sessionId: ctx.sessionId,
|
|
105628
|
-
turnId: ctx.turnId,
|
|
105629
|
-
source: "tool",
|
|
105630
|
-
callId: asToolCallId(r2.id),
|
|
105631
|
-
ok: false,
|
|
105632
|
-
error: { kind: "aborted", message: "default mode loop aborted (stuck pattern) before this call ran" }
|
|
105633
|
-
});
|
|
105634
|
-
}
|
|
105635
|
-
const how = sig.kind === "near" ? "against the same target (only volatile args like maxBytes varied)" : "with identical input";
|
|
105636
|
-
yield await ctx.emit({
|
|
105637
|
-
type: "error",
|
|
105638
|
-
sessionId: ctx.sessionId,
|
|
105639
|
-
turnId: ctx.turnId,
|
|
105640
|
-
source: "system",
|
|
105641
|
-
kind: "fatal",
|
|
105642
|
-
message: `default mode loop aborted \u2014 detected stuck pattern: tool "${t2.name}" called ${sig.count} times ${how}. The model is likely looping on the same call; reset or rephrase.`
|
|
105643
|
-
});
|
|
105644
|
-
return true;
|
|
105645
|
-
}
|
|
105646
|
-
}
|
|
105647
|
-
return false;
|
|
105648
|
-
}
|
|
105649
|
-
async function* executeToolUses(ctx, toolUses, iteration) {
|
|
105650
|
-
const unresolved = new Set(toolUses.map((t2) => t2.id));
|
|
105651
|
-
for (const t2 of toolUses) {
|
|
105652
|
-
if (ctx.signal.aborted) {
|
|
105653
|
-
for (const orphanId of unresolved) {
|
|
105654
|
-
yield await ctx.emit({
|
|
105655
|
-
type: "tool_result",
|
|
105656
|
-
sessionId: ctx.sessionId,
|
|
105657
|
-
turnId: ctx.turnId,
|
|
105658
|
-
source: "tool",
|
|
105659
|
-
callId: asToolCallId(orphanId),
|
|
105660
|
-
ok: false,
|
|
105661
|
-
error: { kind: "aborted", message: "turn aborted before tool ran" }
|
|
105662
|
-
});
|
|
105663
|
-
}
|
|
105664
|
-
unresolved.clear();
|
|
105665
|
-
yield await ctx.emit({
|
|
105666
|
-
type: "abort",
|
|
105667
|
-
sessionId: ctx.sessionId,
|
|
105668
|
-
turnId: ctx.turnId,
|
|
105669
|
-
source: "system",
|
|
105670
|
-
reason: "signal aborted during tool execution"
|
|
105671
|
-
});
|
|
105672
|
-
return true;
|
|
105673
|
-
}
|
|
105674
|
-
try {
|
|
105675
|
-
yield* dispatchToolCall(ctx, t2, iteration);
|
|
105676
|
-
} finally {
|
|
105677
|
-
unresolved.delete(t2.id);
|
|
105678
|
-
}
|
|
105679
|
-
}
|
|
105680
|
-
return false;
|
|
105681
|
-
}
|
|
105682
105620
|
function buildMessages(ctx) {
|
|
105683
105621
|
const systemPrompt = buildSystemPromptWithSkills(ctx.systemPrompt, ctx.skills.list());
|
|
105684
105622
|
return projectMessages(ctx, { ...systemPrompt ? { systemPrompt } : {} });
|
|
@@ -105914,7 +105852,22 @@ async function* runGoalMode(ctx) {
|
|
|
105914
105852
|
});
|
|
105915
105853
|
return;
|
|
105916
105854
|
}
|
|
105917
|
-
const stuck = yield*
|
|
105855
|
+
const stuck = yield* emitRequestsAndDetectStuck(ctx, toolUses, detector, {
|
|
105856
|
+
abortedResultMessage: "goal mode aborted (stuck pattern) before this call ran",
|
|
105857
|
+
nearHint: "against the same target (only volatile args varied)",
|
|
105858
|
+
extraOnStuck: ({ toolName, count, kind: kind3 }) => [
|
|
105859
|
+
{
|
|
105860
|
+
type: "plugin_event",
|
|
105861
|
+
sessionId: ctx.sessionId,
|
|
105862
|
+
turnId: ctx.turnId,
|
|
105863
|
+
source: "plugin",
|
|
105864
|
+
pluginId: GOAL_PLUGIN_ID,
|
|
105865
|
+
subtype: "goal_stuck",
|
|
105866
|
+
payload: { tool: toolName, count, kind: kind3 }
|
|
105867
|
+
}
|
|
105868
|
+
],
|
|
105869
|
+
fatalMessage: ({ toolName, count, how }) => `goal mode aborted \u2014 stuck pattern: tool "${toolName}" called ${count} times ${how}. The model is looping on the same call; send another message to redirect it.`
|
|
105870
|
+
});
|
|
105918
105871
|
if (stuck)
|
|
105919
105872
|
return;
|
|
105920
105873
|
if (text || stopReason === "end_turn" || toolUses.length === 0) {
|
|
@@ -105952,7 +105905,7 @@ async function* runGoalMode(ctx) {
|
|
|
105952
105905
|
continue;
|
|
105953
105906
|
}
|
|
105954
105907
|
noop3 = 0;
|
|
105955
|
-
const exited = yield*
|
|
105908
|
+
const exited = yield* executeToolUses(goalCtx, toolUses, iteration);
|
|
105956
105909
|
if (exited)
|
|
105957
105910
|
return;
|
|
105958
105911
|
const terminal = detectGoalTerminal(ctx.log.slice(), toolUses);
|
|
@@ -106030,88 +105983,6 @@ function composeSystemPrompts(user, layer) {
|
|
|
106030
105983
|
|
|
106031
105984
|
${user}`;
|
|
106032
105985
|
}
|
|
106033
|
-
async function* emitRequestsAndDetectStuck2(ctx, toolUses, detector) {
|
|
106034
|
-
const emitted = [];
|
|
106035
|
-
for (const t2 of toolUses) {
|
|
106036
|
-
yield await ctx.emit({
|
|
106037
|
-
type: "tool_call_requested",
|
|
106038
|
-
sessionId: ctx.sessionId,
|
|
106039
|
-
turnId: ctx.turnId,
|
|
106040
|
-
source: "model",
|
|
106041
|
-
callId: asToolCallId(t2.id),
|
|
106042
|
-
name: t2.name,
|
|
106043
|
-
input: t2.input
|
|
106044
|
-
});
|
|
106045
|
-
emitted.push(t2);
|
|
106046
|
-
const sig = detector.record(t2.name, t2.input);
|
|
106047
|
-
if (sig.stuck) {
|
|
106048
|
-
for (const r2 of emitted) {
|
|
106049
|
-
yield await ctx.emit({
|
|
106050
|
-
type: "tool_result",
|
|
106051
|
-
sessionId: ctx.sessionId,
|
|
106052
|
-
turnId: ctx.turnId,
|
|
106053
|
-
source: "tool",
|
|
106054
|
-
callId: asToolCallId(r2.id),
|
|
106055
|
-
ok: false,
|
|
106056
|
-
error: { kind: "aborted", message: "goal mode aborted (stuck pattern) before this call ran" }
|
|
106057
|
-
});
|
|
106058
|
-
}
|
|
106059
|
-
const how = sig.kind === "near" ? "against the same target (only volatile args varied)" : "with identical input";
|
|
106060
|
-
yield await ctx.emit({
|
|
106061
|
-
type: "plugin_event",
|
|
106062
|
-
sessionId: ctx.sessionId,
|
|
106063
|
-
turnId: ctx.turnId,
|
|
106064
|
-
source: "plugin",
|
|
106065
|
-
pluginId: GOAL_PLUGIN_ID,
|
|
106066
|
-
subtype: "goal_stuck",
|
|
106067
|
-
payload: { tool: t2.name, count: sig.count, kind: sig.kind }
|
|
106068
|
-
});
|
|
106069
|
-
yield await ctx.emit({
|
|
106070
|
-
type: "error",
|
|
106071
|
-
sessionId: ctx.sessionId,
|
|
106072
|
-
turnId: ctx.turnId,
|
|
106073
|
-
source: "system",
|
|
106074
|
-
kind: "fatal",
|
|
106075
|
-
message: `goal mode aborted \u2014 stuck pattern: tool "${t2.name}" called ${sig.count} times ${how}. The model is looping on the same call; send another message to redirect it.`
|
|
106076
|
-
});
|
|
106077
|
-
return true;
|
|
106078
|
-
}
|
|
106079
|
-
}
|
|
106080
|
-
return false;
|
|
106081
|
-
}
|
|
106082
|
-
async function* executeToolUses2(ctx, toolUses, iteration) {
|
|
106083
|
-
const unresolved = new Set(toolUses.map((t2) => t2.id));
|
|
106084
|
-
for (const t2 of toolUses) {
|
|
106085
|
-
if (ctx.signal.aborted) {
|
|
106086
|
-
for (const orphanId of unresolved) {
|
|
106087
|
-
yield await ctx.emit({
|
|
106088
|
-
type: "tool_result",
|
|
106089
|
-
sessionId: ctx.sessionId,
|
|
106090
|
-
turnId: ctx.turnId,
|
|
106091
|
-
source: "tool",
|
|
106092
|
-
callId: asToolCallId(orphanId),
|
|
106093
|
-
ok: false,
|
|
106094
|
-
error: { kind: "aborted", message: "turn aborted before tool ran" }
|
|
106095
|
-
});
|
|
106096
|
-
}
|
|
106097
|
-
unresolved.clear();
|
|
106098
|
-
yield await ctx.emit({
|
|
106099
|
-
type: "abort",
|
|
106100
|
-
sessionId: ctx.sessionId,
|
|
106101
|
-
turnId: ctx.turnId,
|
|
106102
|
-
source: "system",
|
|
106103
|
-
reason: "signal aborted during tool execution"
|
|
106104
|
-
});
|
|
106105
|
-
return true;
|
|
106106
|
-
}
|
|
106107
|
-
try {
|
|
106108
|
-
yield* dispatchToolCall(ctx, t2, iteration);
|
|
106109
|
-
} finally {
|
|
106110
|
-
unresolved.delete(t2.id);
|
|
106111
|
-
}
|
|
106112
|
-
}
|
|
106113
|
-
return false;
|
|
106114
|
-
}
|
|
106115
105986
|
|
|
106116
105987
|
// ../mode-goal/dist/index.js
|
|
106117
105988
|
var goalMode = defineMode({
|
|
@@ -110114,11 +109985,11 @@ function isAddrInUse(err) {
|
|
|
110114
109985
|
async function freeTcpPort(port) {
|
|
110115
109986
|
if (process.platform === "win32")
|
|
110116
109987
|
return;
|
|
110117
|
-
const { spawn:
|
|
109988
|
+
const { spawn: spawn17 } = await import('child_process');
|
|
110118
109989
|
const pids = await new Promise((resolve12) => {
|
|
110119
109990
|
let out = "";
|
|
110120
109991
|
try {
|
|
110121
|
-
const child =
|
|
109992
|
+
const child = spawn17("lsof", ["-t", `-iTCP:${port}`, "-sTCP:LISTEN"], {
|
|
110122
109993
|
stdio: ["ignore", "pipe", "ignore"]
|
|
110123
109994
|
});
|
|
110124
109995
|
child.stdout.on("data", (b3) => {
|
|
@@ -111353,28 +111224,54 @@ function buildSubagentsPlugin(opts = {}) {
|
|
|
111353
111224
|
});
|
|
111354
111225
|
}
|
|
111355
111226
|
buildSubagentsPlugin();
|
|
111227
|
+
|
|
111228
|
+
// ../plugin-plugins-admin/dist/shared.js
|
|
111229
|
+
var NPM_NAME_RE = /^(?:@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/;
|
|
111230
|
+
function assertSafeNpmSpec(spec) {
|
|
111231
|
+
const trimmed = spec.trim();
|
|
111232
|
+
if (trimmed.length === 0) {
|
|
111233
|
+
throw new Error("plugin spec must be a non-empty package name, git spec, or path");
|
|
111234
|
+
}
|
|
111235
|
+
if (trimmed.startsWith("-")) {
|
|
111236
|
+
throw new Error(`refusing plugin spec "${spec}": leading "-" would be parsed by npm as an option, not a package`);
|
|
111237
|
+
}
|
|
111238
|
+
return trimmed;
|
|
111239
|
+
}
|
|
111240
|
+
function diffSnapshot2(before, after) {
|
|
111241
|
+
const out = {};
|
|
111242
|
+
for (const key of ["tools", "agents", "providers", "modes", "compactors", "channels"]) {
|
|
111243
|
+
const b3 = new Set(before[key]);
|
|
111244
|
+
const added = after[key].filter((n2) => !b3.has(n2));
|
|
111245
|
+
if (added.length > 0)
|
|
111246
|
+
out[key] = added;
|
|
111247
|
+
}
|
|
111248
|
+
return out;
|
|
111249
|
+
}
|
|
111250
|
+
|
|
111251
|
+
// ../plugin-plugins-admin/dist/install.js
|
|
111356
111252
|
function userPluginsDir() {
|
|
111357
111253
|
return moxxyPath("plugins");
|
|
111358
111254
|
}
|
|
111359
|
-
var NPM_NAME_RE = /^(?:@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/;
|
|
111360
111255
|
var VERSION_RE = /^[0-9a-z.~^*<=>-]+$/i;
|
|
111361
111256
|
async function installPluginPackage(opts) {
|
|
111257
|
+
const spec = assertSafeNpmSpec(opts.packageName);
|
|
111362
111258
|
const dir = userPluginsDir();
|
|
111363
111259
|
await ensurePackageJson(dir);
|
|
111364
|
-
const { exitCode, stderr } = await runNpm(["install", "--prefix", dir, "--no-fund", "--no-audit", "--save",
|
|
111260
|
+
const { exitCode, stderr } = await runNpm(["install", "--prefix", dir, "--no-fund", "--no-audit", "--save", spec], opts.signal);
|
|
111365
111261
|
if (exitCode !== 0) {
|
|
111366
111262
|
throw new Error(`npm install failed (exit ${exitCode}): ${truncate9(stderr, 400)}`);
|
|
111367
111263
|
}
|
|
111368
|
-
return { installed:
|
|
111264
|
+
return { installed: spec, dir };
|
|
111369
111265
|
}
|
|
111370
111266
|
async function removePluginPackage(opts) {
|
|
111267
|
+
const spec = assertSafeNpmSpec(opts.packageName);
|
|
111371
111268
|
const dir = userPluginsDir();
|
|
111372
111269
|
await ensurePackageJson(dir);
|
|
111373
|
-
const { exitCode, stderr } = await runNpm(["uninstall", "--prefix", dir, "--no-fund", "--no-audit", "--save",
|
|
111270
|
+
const { exitCode, stderr } = await runNpm(["uninstall", "--prefix", dir, "--no-fund", "--no-audit", "--save", spec], opts.signal);
|
|
111374
111271
|
if (exitCode !== 0) {
|
|
111375
111272
|
throw new Error(`npm uninstall failed (exit ${exitCode}): ${truncate9(stderr, 400)}`);
|
|
111376
111273
|
}
|
|
111377
|
-
return { removed:
|
|
111274
|
+
return { removed: spec, dir };
|
|
111378
111275
|
}
|
|
111379
111276
|
function buildInstallPluginTool(deps) {
|
|
111380
111277
|
return defineTool({
|
|
@@ -111491,26 +111388,15 @@ function runNpm(args, signal) {
|
|
|
111491
111388
|
});
|
|
111492
111389
|
});
|
|
111493
111390
|
}
|
|
111494
|
-
function diffSnapshot2(before, after) {
|
|
111495
|
-
const out = {};
|
|
111496
|
-
for (const key of ["tools", "agents", "providers", "modes", "compactors", "channels"]) {
|
|
111497
|
-
const b3 = new Set(before[key]);
|
|
111498
|
-
const added = after[key].filter((n2) => !b3.has(n2));
|
|
111499
|
-
if (added.length > 0)
|
|
111500
|
-
out[key] = added;
|
|
111501
|
-
}
|
|
111502
|
-
return out;
|
|
111503
|
-
}
|
|
111504
111391
|
function truncate9(s2, n2) {
|
|
111505
111392
|
return s2.length <= n2 ? s2 : s2.slice(0, n2 - 1) + "\u2026";
|
|
111506
111393
|
}
|
|
111507
|
-
var NPM_NAME_RE2 = /^(?:@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/;
|
|
111508
111394
|
function buildDisablePluginTool(deps) {
|
|
111509
111395
|
return defineTool({
|
|
111510
111396
|
name: "disable_plugin",
|
|
111511
111397
|
description: "Disable (unplug) a registered moxxy plugin \u2014 a default builtin or an installed one \u2014 by package name. Persists `plugins[<name>].enabled=false` to ~/.moxxy/config.yaml and unloads it from the running session, so its tools / agents / providers / modes / channels disappear immediately and it stays off across restarts. Reverse with enable_plugin. Use when the user wants to turn a plugin off without uninstalling it.",
|
|
111512
111398
|
inputSchema: z$1.object({
|
|
111513
|
-
packageName: z$1.string().min(1).refine((s2) =>
|
|
111399
|
+
packageName: z$1.string().min(1).refine((s2) => NPM_NAME_RE.test(s2), {
|
|
111514
111400
|
message: "must be a valid moxxy package name (e.g. @moxxy/plugin-browser)"
|
|
111515
111401
|
}).describe("Plugin package name to disable, e.g. @moxxy/plugin-browser.")
|
|
111516
111402
|
}),
|
|
@@ -111519,7 +111405,7 @@ function buildDisablePluginTool(deps) {
|
|
|
111519
111405
|
const before = deps.snapshot();
|
|
111520
111406
|
await deps.setEnabled(packageName, false);
|
|
111521
111407
|
const after = deps.snapshot();
|
|
111522
|
-
return { disabled: packageName, unregistered:
|
|
111408
|
+
return { disabled: packageName, unregistered: diffSnapshot2(after, before) };
|
|
111523
111409
|
}
|
|
111524
111410
|
});
|
|
111525
111411
|
}
|
|
@@ -111528,7 +111414,7 @@ function buildEnablePluginTool(deps) {
|
|
|
111528
111414
|
name: "enable_plugin",
|
|
111529
111415
|
description: "Enable (plug back in) a previously-disabled moxxy plugin by package name. Persists `plugins[<name>].enabled=true` to ~/.moxxy/config.yaml and loads it into the running session (re-registering a default or re-discovering an installed plugin), so its contributions reappear immediately. Reverse with disable_plugin. Use when the user wants to turn a disabled plugin back on.",
|
|
111530
111416
|
inputSchema: z$1.object({
|
|
111531
|
-
packageName: z$1.string().min(1).refine((s2) =>
|
|
111417
|
+
packageName: z$1.string().min(1).refine((s2) => NPM_NAME_RE.test(s2), {
|
|
111532
111418
|
message: "must be a valid moxxy package name (e.g. @moxxy/plugin-browser)"
|
|
111533
111419
|
}).describe("Plugin package name to enable, e.g. @moxxy/plugin-browser.")
|
|
111534
111420
|
}),
|
|
@@ -111537,20 +111423,10 @@ function buildEnablePluginTool(deps) {
|
|
|
111537
111423
|
const before = deps.snapshot();
|
|
111538
111424
|
await deps.setEnabled(packageName, true);
|
|
111539
111425
|
const after = deps.snapshot();
|
|
111540
|
-
return { enabled: packageName, registered:
|
|
111426
|
+
return { enabled: packageName, registered: diffSnapshot2(before, after) };
|
|
111541
111427
|
}
|
|
111542
111428
|
});
|
|
111543
111429
|
}
|
|
111544
|
-
function diffSnapshot3(before, after) {
|
|
111545
|
-
const out = {};
|
|
111546
|
-
for (const key of ["tools", "agents", "providers", "modes", "compactors", "channels"]) {
|
|
111547
|
-
const b3 = new Set(before[key]);
|
|
111548
|
-
const added = after[key].filter((n2) => !b3.has(n2));
|
|
111549
|
-
if (added.length > 0)
|
|
111550
|
-
out[key] = added;
|
|
111551
|
-
}
|
|
111552
|
-
return out;
|
|
111553
|
-
}
|
|
111554
111430
|
|
|
111555
111431
|
// ../plugin-plugins-admin/dist/catalog.js
|
|
111556
111432
|
var INSTALLABLE_PLUGIN_CATALOG = [
|
|
@@ -113565,7 +113441,7 @@ function readHeader(headers, name) {
|
|
|
113565
113441
|
return v3[0] ?? null;
|
|
113566
113442
|
return v3 ?? null;
|
|
113567
113443
|
}
|
|
113568
|
-
function readJsonPath(body,
|
|
113444
|
+
function readJsonPath(body, path59) {
|
|
113569
113445
|
let parsed;
|
|
113570
113446
|
try {
|
|
113571
113447
|
parsed = JSON.parse(body.toString("utf8"));
|
|
@@ -113573,7 +113449,7 @@ function readJsonPath(body, path58) {
|
|
|
113573
113449
|
return null;
|
|
113574
113450
|
}
|
|
113575
113451
|
let cur = parsed;
|
|
113576
|
-
for (const seg of
|
|
113452
|
+
for (const seg of path59.split(".")) {
|
|
113577
113453
|
if (cur === null || cur === void 0 || typeof cur !== "object")
|
|
113578
113454
|
return null;
|
|
113579
113455
|
cur = cur[seg];
|
|
@@ -116225,8 +116101,8 @@ function findCycle(steps) {
|
|
|
116225
116101
|
}
|
|
116226
116102
|
function formatIssues(error2) {
|
|
116227
116103
|
return error2.issues.map((iss) => {
|
|
116228
|
-
const
|
|
116229
|
-
return `${
|
|
116104
|
+
const path59 = iss.path.join(".") || "(root)";
|
|
116105
|
+
return `${path59}: ${iss.message}`;
|
|
116230
116106
|
});
|
|
116231
116107
|
}
|
|
116232
116108
|
function validateWorkflow(raw) {
|
|
@@ -119813,11 +119689,11 @@ async function pidsListeningOnPort(port) {
|
|
|
119813
119689
|
return await runLsof(["-t", `-iTCP:${port}`, "-sTCP:LISTEN"]);
|
|
119814
119690
|
}
|
|
119815
119691
|
async function runLsof(args) {
|
|
119816
|
-
const { spawn:
|
|
119692
|
+
const { spawn: spawn17 } = await import('child_process');
|
|
119817
119693
|
return await new Promise((resolve12) => {
|
|
119818
119694
|
let out = "";
|
|
119819
119695
|
try {
|
|
119820
|
-
const child =
|
|
119696
|
+
const child = spawn17("lsof", [...args], {
|
|
119821
119697
|
stdio: ["ignore", "pipe", "ignore"]
|
|
119822
119698
|
});
|
|
119823
119699
|
child.stdout.on("data", (b3) => {
|
|
@@ -119885,6 +119761,145 @@ function cliVersion() {
|
|
|
119885
119761
|
}
|
|
119886
119762
|
}
|
|
119887
119763
|
|
|
119764
|
+
// src/update/registry.ts
|
|
119765
|
+
var REGISTRY = "https://registry.npmjs.org";
|
|
119766
|
+
var DEFAULT_PKG = "@moxxy/cli";
|
|
119767
|
+
var DEFAULT_TIMEOUT_MS = 4e3;
|
|
119768
|
+
async function fetchLatest(pkg = DEFAULT_PKG, opts = {}) {
|
|
119769
|
+
const fetchImpl2 = opts.fetchImpl ?? fetch;
|
|
119770
|
+
const url2 = `${REGISTRY}/${pkg}/latest`;
|
|
119771
|
+
const controller = new AbortController();
|
|
119772
|
+
const timer = setTimeout(() => controller.abort(), opts.timeoutMs ?? DEFAULT_TIMEOUT_MS);
|
|
119773
|
+
try {
|
|
119774
|
+
const res = await fetchImpl2(url2, {
|
|
119775
|
+
signal: controller.signal,
|
|
119776
|
+
headers: { accept: "application/json" }
|
|
119777
|
+
});
|
|
119778
|
+
if (!res.ok) return null;
|
|
119779
|
+
const json = await res.json();
|
|
119780
|
+
return typeof json.version === "string" ? json.version : null;
|
|
119781
|
+
} catch {
|
|
119782
|
+
return null;
|
|
119783
|
+
} finally {
|
|
119784
|
+
clearTimeout(timer);
|
|
119785
|
+
}
|
|
119786
|
+
}
|
|
119787
|
+
|
|
119788
|
+
// src/update/check.ts
|
|
119789
|
+
var CACHE_TTL_MS = 12 * 60 * 60 * 1e3;
|
|
119790
|
+
var PKG = "@moxxy/cli";
|
|
119791
|
+
function defaultCacheFile() {
|
|
119792
|
+
return path3.join(os5.homedir(), ".moxxy", "update-check.json");
|
|
119793
|
+
}
|
|
119794
|
+
function compareSemver(a2, b3) {
|
|
119795
|
+
const parse2 = (s2) => (s2.split("-")[0] ?? "").split(".").map((n2) => Number.parseInt(n2, 10) || 0);
|
|
119796
|
+
const pa = parse2(a2);
|
|
119797
|
+
const pb = parse2(b3);
|
|
119798
|
+
for (let i2 = 0; i2 < 3; i2 += 1) {
|
|
119799
|
+
const d2 = (pa[i2] ?? 0) - (pb[i2] ?? 0);
|
|
119800
|
+
if (d2 !== 0) return d2 < 0 ? -1 : 1;
|
|
119801
|
+
}
|
|
119802
|
+
return 0;
|
|
119803
|
+
}
|
|
119804
|
+
function readCache(file) {
|
|
119805
|
+
try {
|
|
119806
|
+
const raw = JSON.parse(readFileSync(file, "utf8"));
|
|
119807
|
+
if (typeof raw.checkedAt === "number" && typeof raw.latest === "string") {
|
|
119808
|
+
return { checkedAt: raw.checkedAt, latest: raw.latest };
|
|
119809
|
+
}
|
|
119810
|
+
} catch {
|
|
119811
|
+
}
|
|
119812
|
+
return null;
|
|
119813
|
+
}
|
|
119814
|
+
function writeCache(file, value) {
|
|
119815
|
+
try {
|
|
119816
|
+
mkdirSync(path3.dirname(file), { recursive: true });
|
|
119817
|
+
const tmp = `${file}.tmp-${process.pid}`;
|
|
119818
|
+
writeFileSync(tmp, JSON.stringify(value, null, 2));
|
|
119819
|
+
renameSync(tmp, file);
|
|
119820
|
+
} catch {
|
|
119821
|
+
}
|
|
119822
|
+
}
|
|
119823
|
+
function shape(current, latest) {
|
|
119824
|
+
if (!current || !latest) return null;
|
|
119825
|
+
return { current, latest, updateAvailable: compareSemver(latest, current) > 0 };
|
|
119826
|
+
}
|
|
119827
|
+
function readCachedCheck(current, opts = {}) {
|
|
119828
|
+
const cache3 = readCache(opts.cacheFile ?? defaultCacheFile());
|
|
119829
|
+
return shape(current, cache3?.latest ?? null);
|
|
119830
|
+
}
|
|
119831
|
+
async function refreshCheck(current, opts = {}) {
|
|
119832
|
+
const latest = await fetchLatest(PKG, opts);
|
|
119833
|
+
if (latest) {
|
|
119834
|
+
writeCache(opts.cacheFile ?? defaultCacheFile(), {
|
|
119835
|
+
checkedAt: opts.now ?? Date.now(),
|
|
119836
|
+
latest
|
|
119837
|
+
});
|
|
119838
|
+
}
|
|
119839
|
+
return shape(current, latest);
|
|
119840
|
+
}
|
|
119841
|
+
async function checkForCliUpdate(current, opts = {}) {
|
|
119842
|
+
if (!current) return null;
|
|
119843
|
+
const now = opts.now ?? Date.now();
|
|
119844
|
+
const file = opts.cacheFile ?? defaultCacheFile();
|
|
119845
|
+
if (!opts.force) {
|
|
119846
|
+
const cache3 = readCache(file);
|
|
119847
|
+
if (cache3 && now - cache3.checkedAt < CACHE_TTL_MS) {
|
|
119848
|
+
return shape(current, cache3.latest);
|
|
119849
|
+
}
|
|
119850
|
+
}
|
|
119851
|
+
const refreshed = await refreshCheck(current, { ...opts, cacheFile: file, now });
|
|
119852
|
+
return refreshed ?? shape(current, readCache(file)?.latest ?? null);
|
|
119853
|
+
}
|
|
119854
|
+
var PKG2 = "@moxxy/cli";
|
|
119855
|
+
function detectInstall(opts = {}) {
|
|
119856
|
+
const fromUrl = opts.fromUrl ?? import.meta.url;
|
|
119857
|
+
const ua = opts.userAgent ?? process.env.npm_config_user_agent ?? "";
|
|
119858
|
+
let installPath = null;
|
|
119859
|
+
try {
|
|
119860
|
+
installPath = fileURLToPath(fromUrl);
|
|
119861
|
+
} catch {
|
|
119862
|
+
installPath = null;
|
|
119863
|
+
}
|
|
119864
|
+
const p3 = (installPath ?? "").replace(/\\/g, "/");
|
|
119865
|
+
if (p3.includes("/packages/cli/")) {
|
|
119866
|
+
return { manager: "workspace", global: false, pkg: PKG2, cmd: [], installPath };
|
|
119867
|
+
}
|
|
119868
|
+
const manager = inferManager(p3, ua);
|
|
119869
|
+
const global2 = looksGlobal(p3, (opts.cwd ?? process.cwd()).replace(/\\/g, "/"));
|
|
119870
|
+
return { manager, global: global2, pkg: PKG2, cmd: upgradeCmd(manager, global2), installPath };
|
|
119871
|
+
}
|
|
119872
|
+
function inferManager(p3, ua) {
|
|
119873
|
+
const head = ua.split("/")[0]?.toLowerCase();
|
|
119874
|
+
if (head === "pnpm" || head === "yarn" || head === "bun" || head === "npm") return head;
|
|
119875
|
+
if (/(^|\/)\.?pnpm(\/|-global|$)|\/library\/pnpm\//i.test(p3)) return "pnpm";
|
|
119876
|
+
if (/\/\.bun\//i.test(p3)) return "bun";
|
|
119877
|
+
if (/\/\.?yarn\//i.test(p3) || /\/\.config\/yarn\//i.test(p3)) return "yarn";
|
|
119878
|
+
return "npm";
|
|
119879
|
+
}
|
|
119880
|
+
function looksGlobal(p3, cwd2) {
|
|
119881
|
+
if (!p3) return true;
|
|
119882
|
+
if (p3.includes(`${cwd2}/node_modules/`)) return false;
|
|
119883
|
+
return true;
|
|
119884
|
+
}
|
|
119885
|
+
function upgradeCmd(manager, global2) {
|
|
119886
|
+
const target = `${PKG2}@latest`;
|
|
119887
|
+
switch (manager) {
|
|
119888
|
+
case "pnpm":
|
|
119889
|
+
return ["pnpm", "add", ...global2 ? ["-g"] : [], target];
|
|
119890
|
+
case "yarn":
|
|
119891
|
+
return global2 ? ["yarn", "global", "add", target] : ["yarn", "add", target];
|
|
119892
|
+
case "bun":
|
|
119893
|
+
return ["bun", "add", ...global2 ? ["-g"] : [], target];
|
|
119894
|
+
case "npm":
|
|
119895
|
+
default:
|
|
119896
|
+
return ["npm", "install", ...global2 ? ["-g"] : [], target];
|
|
119897
|
+
}
|
|
119898
|
+
}
|
|
119899
|
+
function formatCmd(cmd) {
|
|
119900
|
+
return cmd.join(" ");
|
|
119901
|
+
}
|
|
119902
|
+
|
|
119888
119903
|
// src/validate-key.ts
|
|
119889
119904
|
async function validateProviderKey(providerName, key, providers) {
|
|
119890
119905
|
const def = providers.list().find((p3) => p3.name === providerName);
|
|
@@ -120266,6 +120281,13 @@ async function killStaleRunnerAt(socketPath) {
|
|
|
120266
120281
|
} catch {
|
|
120267
120282
|
}
|
|
120268
120283
|
}
|
|
120284
|
+
function resolveUpdateNotice(version) {
|
|
120285
|
+
if (!version) return void 0;
|
|
120286
|
+
if (detectInstall().manager === "workspace") return void 0;
|
|
120287
|
+
void refreshCheck(version).catch(() => void 0);
|
|
120288
|
+
const cached = readCachedCheck(version);
|
|
120289
|
+
return cached?.updateAvailable ? { latest: cached.latest } : void 0;
|
|
120290
|
+
}
|
|
120269
120291
|
async function runTuiWithBootstrap(argv, tuiOpts = {}) {
|
|
120270
120292
|
const standalone = hasBoolFlag(argv, "standalone");
|
|
120271
120293
|
const mode = chooseClientMode({ standalone, runnerUp: standalone ? false : await isRunnerUp() });
|
|
@@ -120302,6 +120324,7 @@ async function runAttachedTui(argv, tuiOpts) {
|
|
|
120302
120324
|
const prefs = await loadPreferences();
|
|
120303
120325
|
const effectiveModel = stringFlag(argv, "model") ?? prefs.model;
|
|
120304
120326
|
const version = cliVersion();
|
|
120327
|
+
const updateNotice = resolveUpdateNotice(version);
|
|
120305
120328
|
let shuttingDown = false;
|
|
120306
120329
|
const shutdown = async () => {
|
|
120307
120330
|
if (shuttingDown) return;
|
|
@@ -120321,6 +120344,7 @@ async function runAttachedTui(argv, tuiOpts) {
|
|
|
120321
120344
|
},
|
|
120322
120345
|
...effectiveModel ? { model: effectiveModel } : {},
|
|
120323
120346
|
...version ? { version } : {},
|
|
120347
|
+
...updateNotice ? { updateAvailable: updateNotice } : {},
|
|
120324
120348
|
// Land directly in the (replayed) conversation rather than the splash.
|
|
120325
120349
|
resumed: true
|
|
120326
120350
|
})
|
|
@@ -120372,6 +120396,7 @@ async function runSelfHostedTui(argv, tuiOpts, standalone) {
|
|
|
120372
120396
|
});
|
|
120373
120397
|
const effectiveModel = stringFlag(argv, "model") ?? (await loadPreferences()).model;
|
|
120374
120398
|
const version = cliVersion();
|
|
120399
|
+
const updateNotice = resolveUpdateNotice(version);
|
|
120375
120400
|
let bootedSession = null;
|
|
120376
120401
|
let runnerServer = null;
|
|
120377
120402
|
let webHandle = null;
|
|
@@ -120430,6 +120455,7 @@ async function runSelfHostedTui(argv, tuiOpts, standalone) {
|
|
|
120430
120455
|
},
|
|
120431
120456
|
...effectiveModel ? { model: effectiveModel } : {},
|
|
120432
120457
|
...version ? { version } : {},
|
|
120458
|
+
...updateNotice ? { updateAvailable: updateNotice } : {},
|
|
120433
120459
|
...tuiOpts.resumeSessionId ? { resumed: true } : {}
|
|
120434
120460
|
})
|
|
120435
120461
|
);
|
|
@@ -123951,6 +123977,114 @@ async function runSelfUpdateCommand(argv) {
|
|
|
123951
123977
|
${HELP13}`);
|
|
123952
123978
|
return 2;
|
|
123953
123979
|
}
|
|
123980
|
+
var HELP14 = formatHelp({
|
|
123981
|
+
title: "moxxy update",
|
|
123982
|
+
tagline: "update the moxxy CLI to the latest published version",
|
|
123983
|
+
sections: [
|
|
123984
|
+
{
|
|
123985
|
+
title: "USAGE",
|
|
123986
|
+
rows: [
|
|
123987
|
+
["moxxy update", "check npm + upgrade (asks before running)"],
|
|
123988
|
+
["moxxy update --check", "report current vs latest, print the command, do nothing"],
|
|
123989
|
+
["moxxy update --yes", "upgrade without the confirmation prompt"]
|
|
123990
|
+
]
|
|
123991
|
+
},
|
|
123992
|
+
{
|
|
123993
|
+
title: "NOTES",
|
|
123994
|
+
notes: [
|
|
123995
|
+
"Detects npm / pnpm / yarn / bun (global or local) and runs the matching upgrade.",
|
|
123996
|
+
"From a source checkout, update with git instead \u2014 nothing is installed."
|
|
123997
|
+
]
|
|
123998
|
+
}
|
|
123999
|
+
]
|
|
124000
|
+
});
|
|
124001
|
+
async function runCommand(cmd) {
|
|
124002
|
+
const [bin, ...args] = cmd;
|
|
124003
|
+
if (!bin) return 1;
|
|
124004
|
+
return new Promise((resolve12) => {
|
|
124005
|
+
const proc = spawn(bin, args, {
|
|
124006
|
+
stdio: "inherit",
|
|
124007
|
+
// npm/pnpm/yarn/bun are `.cmd` shims on Windows — needs a shell to launch.
|
|
124008
|
+
shell: process.platform === "win32"
|
|
124009
|
+
});
|
|
124010
|
+
proc.on("error", () => resolve12(127));
|
|
124011
|
+
proc.on("exit", (code) => resolve12(code ?? 1));
|
|
124012
|
+
});
|
|
124013
|
+
}
|
|
124014
|
+
async function runUpdateCommand(argv, deps = {}) {
|
|
124015
|
+
if (helpRequested(argv) || argv.positional[0] === "help") {
|
|
124016
|
+
process.stdout.write(HELP14);
|
|
124017
|
+
return 0;
|
|
124018
|
+
}
|
|
124019
|
+
const out = deps.out ?? ((s2) => process.stdout.write(s2));
|
|
124020
|
+
const current = deps.current ?? cliVersion();
|
|
124021
|
+
const checkOnly = hasBoolFlag(argv, "check") || hasBoolFlag(argv, "dry-run");
|
|
124022
|
+
const check = deps.check ?? ((c2) => checkForCliUpdate(c2, { force: true }));
|
|
124023
|
+
const detect = deps.detect ?? (() => detectInstall());
|
|
124024
|
+
const run2 = deps.run ?? runCommand;
|
|
124025
|
+
out(colors.dim("Checking for updates\u2026\n"));
|
|
124026
|
+
const result = await check(current);
|
|
124027
|
+
if (!result) {
|
|
124028
|
+
const info2 = detect();
|
|
124029
|
+
out(colors.dim(`Could not reach the npm registry. Current version: ${current ?? "unknown"}.
|
|
124030
|
+
`));
|
|
124031
|
+
if (info2.manager !== "workspace") {
|
|
124032
|
+
out(colors.dim("To update manually:\n ") + colors.bold(formatCmd(info2.cmd)) + "\n");
|
|
124033
|
+
}
|
|
124034
|
+
return 0;
|
|
124035
|
+
}
|
|
124036
|
+
if (!result.updateAvailable) {
|
|
124037
|
+
out(colors.green("\u2713 ") + `You're on the latest moxxy (v${result.current}).
|
|
124038
|
+
`);
|
|
124039
|
+
return 0;
|
|
124040
|
+
}
|
|
124041
|
+
out(
|
|
124042
|
+
`Update available: ${colors.dim("v" + result.current)} \u2192 ${colors.bold(colors.green("v" + result.latest))}
|
|
124043
|
+
`
|
|
124044
|
+
);
|
|
124045
|
+
const info = detect();
|
|
124046
|
+
if (info.manager === "workspace") {
|
|
124047
|
+
out(
|
|
124048
|
+
colors.dim(
|
|
124049
|
+
"You're running moxxy from a source checkout \u2014 nothing to install.\nUpdate with: "
|
|
124050
|
+
) + colors.bold("git pull") + colors.dim(" && pnpm install && pnpm build") + "\n"
|
|
124051
|
+
);
|
|
124052
|
+
return 0;
|
|
124053
|
+
}
|
|
124054
|
+
const cmdStr = formatCmd(info.cmd);
|
|
124055
|
+
out(colors.dim("Will run: ") + colors.bold(cmdStr) + "\n");
|
|
124056
|
+
if (checkOnly) return 0;
|
|
124057
|
+
const interactive = deps.interactive ?? Boolean(process.stdin.isTTY);
|
|
124058
|
+
let proceed = confirmedYes(argv);
|
|
124059
|
+
if (!proceed) {
|
|
124060
|
+
if (!interactive) {
|
|
124061
|
+
out(colors.dim("Re-run with --yes to apply, or run the command above yourself.\n"));
|
|
124062
|
+
return 0;
|
|
124063
|
+
}
|
|
124064
|
+
const ask = deps.promptConfirm ?? defaultConfirm;
|
|
124065
|
+
proceed = await ask(`Run \`${cmdStr}\` now?`);
|
|
124066
|
+
if (!proceed) {
|
|
124067
|
+
out(colors.dim("Skipped. Run the command above when you're ready.\n"));
|
|
124068
|
+
return 0;
|
|
124069
|
+
}
|
|
124070
|
+
}
|
|
124071
|
+
out(colors.dim(`
|
|
124072
|
+
$ ${cmdStr}
|
|
124073
|
+
`));
|
|
124074
|
+
const code = await run2(info.cmd);
|
|
124075
|
+
if (code === 0) {
|
|
124076
|
+
out("\n" + colors.green("\u2713 ") + `Updated to v${result.latest}. Restart moxxy to use it.
|
|
124077
|
+
`);
|
|
124078
|
+
return 0;
|
|
124079
|
+
}
|
|
124080
|
+
printError(`update command exited with code ${code}`);
|
|
124081
|
+
return code || 1;
|
|
124082
|
+
}
|
|
124083
|
+
async function defaultConfirm(message) {
|
|
124084
|
+
const answer = await ue2({ message });
|
|
124085
|
+
if (q2(answer)) return false;
|
|
124086
|
+
return answer === true;
|
|
124087
|
+
}
|
|
123954
124088
|
|
|
123955
124089
|
// src/bin.ts
|
|
123956
124090
|
await init_dist9();
|
|
@@ -124014,7 +124148,8 @@ var SECTIONS = [
|
|
|
124014
124148
|
["init", "interactive first-time setup (provider keys \u2192 vault)"],
|
|
124015
124149
|
["login <provider>", "OAuth sign-in for providers that don't use API keys"],
|
|
124016
124150
|
["login status|logout", "inspect / remove stored OAuth credentials"],
|
|
124017
|
-
["doctor [--check-keys]", "diagnose config, vault, providers, channels, memory"]
|
|
124151
|
+
["doctor [--check-keys]", "diagnose config, vault, providers, channels, memory"],
|
|
124152
|
+
["update [--check|--yes]", "upgrade the moxxy CLI to the latest published version"]
|
|
124018
124153
|
]
|
|
124019
124154
|
},
|
|
124020
124155
|
{
|
|
@@ -124132,6 +124267,7 @@ var COMMANDS = {
|
|
|
124132
124267
|
mcp: runMcpCommand,
|
|
124133
124268
|
schedule: runScheduleCommand,
|
|
124134
124269
|
doctor: runDoctorCommand,
|
|
124270
|
+
update: runUpdateCommand,
|
|
124135
124271
|
prompt: runPromptCommand,
|
|
124136
124272
|
tui: runTuiCommand,
|
|
124137
124273
|
resume: runResumeCommand,
|