ente-cli 0.4.93 → 0.4.95
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 -0
- package/dist/SKILL.md +18 -0
- package/dist/cli.mjs +756 -503
- package/dist/cli.mjs.map +4 -4
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -16,8 +16,8 @@ var __commonJS = (cb, mod) => function __require3() {
|
|
|
16
16
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
17
17
|
};
|
|
18
18
|
var __export = (target2, all) => {
|
|
19
|
-
for (var
|
|
20
|
-
__defProp(target2,
|
|
19
|
+
for (var name4 in all)
|
|
20
|
+
__defProp(target2, name4, { get: all[name4], enumerable: true });
|
|
21
21
|
};
|
|
22
22
|
var __copyProps = (to, from, except, desc) => {
|
|
23
23
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -1145,10 +1145,10 @@ function cleanValidationError(message2, { mergeName = false } = {}) {
|
|
|
1145
1145
|
const match = message2.match(/^([^:]+): (.*)$/m);
|
|
1146
1146
|
if (!match)
|
|
1147
1147
|
return `validation failed`;
|
|
1148
|
-
let [,
|
|
1148
|
+
let [, path9, line] = match;
|
|
1149
1149
|
if (mergeName)
|
|
1150
1150
|
line = line[0].toLowerCase() + line.slice(1);
|
|
1151
|
-
line =
|
|
1151
|
+
line = path9 !== `.` || !mergeName ? `${path9.replace(/^\.(\[|$)/, `$1`)}: ${line}` : `: ${line}`;
|
|
1152
1152
|
return line;
|
|
1153
1153
|
}
|
|
1154
1154
|
function formatError(message2, errors) {
|
|
@@ -1160,7 +1160,7 @@ ${errors.map((error62) => `
|
|
|
1160
1160
|
- ${cleanValidationError(error62)}`).join(``)}`);
|
|
1161
1161
|
}
|
|
1162
1162
|
}
|
|
1163
|
-
function applyValidator(
|
|
1163
|
+
function applyValidator(name4, value, validator) {
|
|
1164
1164
|
if (typeof validator === `undefined`)
|
|
1165
1165
|
return value;
|
|
1166
1166
|
const errors = [];
|
|
@@ -1172,7 +1172,7 @@ function applyValidator(name3, value, validator) {
|
|
|
1172
1172
|
};
|
|
1173
1173
|
const check2 = validator(value, { errors, coercions, coercion });
|
|
1174
1174
|
if (!check2)
|
|
1175
|
-
throw formatError(`Invalid value for ${
|
|
1175
|
+
throw formatError(`Invalid value for ${name4}`, errors);
|
|
1176
1176
|
for (const [, op] of coercions)
|
|
1177
1177
|
op();
|
|
1178
1178
|
return value;
|
|
@@ -1484,7 +1484,7 @@ function selectBestState(input2, states) {
|
|
|
1484
1484
|
});
|
|
1485
1485
|
if (terminalStates.length === 0)
|
|
1486
1486
|
throw new Error();
|
|
1487
|
-
const requiredOptionsSetStates = terminalStates.filter((state) => state.selectedIndex === HELP_COMMAND_INDEX || state.requiredOptions.every((names) => names.some((
|
|
1487
|
+
const requiredOptionsSetStates = terminalStates.filter((state) => state.selectedIndex === HELP_COMMAND_INDEX || state.requiredOptions.every((names) => names.some((name4) => state.options.find((opt) => opt.name === name4))));
|
|
1488
1488
|
if (requiredOptionsSetStates.length === 0) {
|
|
1489
1489
|
throw new UnknownSyntaxError(input2, terminalStates.map((state) => ({
|
|
1490
1490
|
usage: state.candidateUsage,
|
|
@@ -1584,8 +1584,8 @@ function registerStatic(machine, from, test, to, reducer) {
|
|
|
1584
1584
|
}
|
|
1585
1585
|
function execute(store, callback, state, segment, segmentIndex) {
|
|
1586
1586
|
if (Array.isArray(callback)) {
|
|
1587
|
-
const [
|
|
1588
|
-
return store[
|
|
1587
|
+
const [name4, ...args] = callback;
|
|
1588
|
+
return store[name4](state, segment, segmentIndex, ...args);
|
|
1589
1589
|
} else {
|
|
1590
1590
|
return store[callback](state, segment, segmentIndex);
|
|
1591
1591
|
}
|
|
@@ -1600,18 +1600,18 @@ var tests = {
|
|
|
1600
1600
|
isNotOptionLike: (state, segment) => {
|
|
1601
1601
|
return state.ignoreOptions || segment === `-` || !segment.startsWith(`-`);
|
|
1602
1602
|
},
|
|
1603
|
-
isOption: (state, segment, segmentIndex,
|
|
1604
|
-
return !state.ignoreOptions && segment ===
|
|
1603
|
+
isOption: (state, segment, segmentIndex, name4) => {
|
|
1604
|
+
return !state.ignoreOptions && segment === name4;
|
|
1605
1605
|
},
|
|
1606
1606
|
isBatchOption: (state, segment, segmentIndex, names) => {
|
|
1607
|
-
return !state.ignoreOptions && BATCH_REGEX.test(segment) && [...segment.slice(1)].every((
|
|
1607
|
+
return !state.ignoreOptions && BATCH_REGEX.test(segment) && [...segment.slice(1)].every((name4) => names.has(`-${name4}`));
|
|
1608
1608
|
},
|
|
1609
1609
|
isBoundOption: (state, segment, segmentIndex, names, options) => {
|
|
1610
1610
|
const optionParsing = segment.match(BINDING_REGEX);
|
|
1611
1611
|
return !state.ignoreOptions && !!optionParsing && OPTION_REGEX.test(optionParsing[1]) && names.has(optionParsing[1]) && options.filter((opt) => opt.nameSet.includes(optionParsing[1])).every((opt) => opt.allowBinding);
|
|
1612
1612
|
},
|
|
1613
|
-
isNegatedOption: (state, segment, segmentIndex,
|
|
1614
|
-
return !state.ignoreOptions && segment === `--no-${
|
|
1613
|
+
isNegatedOption: (state, segment, segmentIndex, name4) => {
|
|
1614
|
+
return !state.ignoreOptions && segment === `--no-${name4.slice(2)}`;
|
|
1615
1615
|
},
|
|
1616
1616
|
isHelp: (state, segment) => {
|
|
1617
1617
|
return !state.ignoreOptions && HELP_REGEX.test(segment);
|
|
@@ -1634,27 +1634,27 @@ var reducers = {
|
|
|
1634
1634
|
const options = state.options.slice();
|
|
1635
1635
|
const tokens = state.tokens.slice();
|
|
1636
1636
|
for (let t = 1; t < segment.length; ++t) {
|
|
1637
|
-
const
|
|
1637
|
+
const name4 = names.get(`-${segment[t]}`);
|
|
1638
1638
|
const slice = t === 1 ? [0, 2] : [t, t + 1];
|
|
1639
|
-
options.push({ name:
|
|
1640
|
-
tokens.push({ segmentIndex, type: `option`, option:
|
|
1639
|
+
options.push({ name: name4, value: true });
|
|
1640
|
+
tokens.push({ segmentIndex, type: `option`, option: name4, slice });
|
|
1641
1641
|
}
|
|
1642
1642
|
return { ...state, options, tokens };
|
|
1643
1643
|
},
|
|
1644
1644
|
pushBound: (state, segment, segmentIndex) => {
|
|
1645
|
-
const [,
|
|
1646
|
-
const options = state.options.concat({ name:
|
|
1645
|
+
const [, name4, value] = segment.match(BINDING_REGEX);
|
|
1646
|
+
const options = state.options.concat({ name: name4, value });
|
|
1647
1647
|
const tokens = state.tokens.concat([
|
|
1648
|
-
{ segmentIndex, type: `option`, slice: [0,
|
|
1649
|
-
{ segmentIndex, type: `assign`, slice: [
|
|
1650
|
-
{ segmentIndex, type: `value`, slice: [
|
|
1648
|
+
{ segmentIndex, type: `option`, slice: [0, name4.length], option: name4 },
|
|
1649
|
+
{ segmentIndex, type: `assign`, slice: [name4.length, name4.length + 1] },
|
|
1650
|
+
{ segmentIndex, type: `value`, slice: [name4.length + 1, name4.length + value.length + 1] }
|
|
1651
1651
|
]);
|
|
1652
1652
|
return { ...state, options, tokens };
|
|
1653
1653
|
},
|
|
1654
1654
|
pushPath: (state, segment, segmentIndex) => {
|
|
1655
|
-
const
|
|
1655
|
+
const path9 = state.path.concat(segment);
|
|
1656
1656
|
const tokens = state.tokens.concat({ segmentIndex, type: `path` });
|
|
1657
|
-
return { ...state, path:
|
|
1657
|
+
return { ...state, path: path9, tokens };
|
|
1658
1658
|
},
|
|
1659
1659
|
pushPositional: (state, segment, segmentIndex) => {
|
|
1660
1660
|
const positionals = state.positionals.concat({ value: segment, extra: false });
|
|
@@ -1671,17 +1671,17 @@ var reducers = {
|
|
|
1671
1671
|
const tokens = state.tokens.concat({ segmentIndex, type: `positional` });
|
|
1672
1672
|
return { ...state, positionals, tokens };
|
|
1673
1673
|
},
|
|
1674
|
-
pushTrue: (state, segment, segmentIndex,
|
|
1675
|
-
const options = state.options.concat({ name:
|
|
1676
|
-
const tokens = state.tokens.concat({ segmentIndex, type: `option`, option:
|
|
1674
|
+
pushTrue: (state, segment, segmentIndex, name4) => {
|
|
1675
|
+
const options = state.options.concat({ name: name4, value: true });
|
|
1676
|
+
const tokens = state.tokens.concat({ segmentIndex, type: `option`, option: name4 });
|
|
1677
1677
|
return { ...state, options, tokens };
|
|
1678
1678
|
},
|
|
1679
|
-
pushFalse: (state, segment, segmentIndex,
|
|
1680
|
-
const options = state.options.concat({ name:
|
|
1681
|
-
const tokens = state.tokens.concat({ segmentIndex, type: `option`, option:
|
|
1679
|
+
pushFalse: (state, segment, segmentIndex, name4) => {
|
|
1680
|
+
const options = state.options.concat({ name: name4, value: false });
|
|
1681
|
+
const tokens = state.tokens.concat({ segmentIndex, type: `option`, option: name4 });
|
|
1682
1682
|
return { ...state, options, tokens };
|
|
1683
1683
|
},
|
|
1684
|
-
pushUndefined: (state, segment, segmentIndex,
|
|
1684
|
+
pushUndefined: (state, segment, segmentIndex, name4) => {
|
|
1685
1685
|
const options = state.options.concat({ name: segment, value: void 0 });
|
|
1686
1686
|
const tokens = state.tokens.concat({ segmentIndex, type: `option`, option: segment });
|
|
1687
1687
|
return { ...state, options, tokens };
|
|
@@ -1739,32 +1739,32 @@ var CommandBuilder = class {
|
|
|
1739
1739
|
this.cliIndex = cliIndex;
|
|
1740
1740
|
this.cliOpts = cliOpts;
|
|
1741
1741
|
}
|
|
1742
|
-
addPath(
|
|
1743
|
-
this.paths.push(
|
|
1742
|
+
addPath(path9) {
|
|
1743
|
+
this.paths.push(path9);
|
|
1744
1744
|
}
|
|
1745
1745
|
setArity({ leading = this.arity.leading, trailing = this.arity.trailing, extra = this.arity.extra, proxy = this.arity.proxy }) {
|
|
1746
1746
|
Object.assign(this.arity, { leading, trailing, extra, proxy });
|
|
1747
1747
|
}
|
|
1748
|
-
addPositional({ name:
|
|
1748
|
+
addPositional({ name: name4 = `arg`, required: required2 = true } = {}) {
|
|
1749
1749
|
if (!required2 && this.arity.extra === NoLimits)
|
|
1750
1750
|
throw new Error(`Optional parameters cannot be declared when using .rest() or .proxy()`);
|
|
1751
1751
|
if (!required2 && this.arity.trailing.length > 0)
|
|
1752
1752
|
throw new Error(`Optional parameters cannot be declared after the required trailing positional arguments`);
|
|
1753
1753
|
if (!required2 && this.arity.extra !== NoLimits) {
|
|
1754
|
-
this.arity.extra.push(
|
|
1754
|
+
this.arity.extra.push(name4);
|
|
1755
1755
|
} else if (this.arity.extra !== NoLimits && this.arity.extra.length === 0) {
|
|
1756
|
-
this.arity.leading.push(
|
|
1756
|
+
this.arity.leading.push(name4);
|
|
1757
1757
|
} else {
|
|
1758
|
-
this.arity.trailing.push(
|
|
1758
|
+
this.arity.trailing.push(name4);
|
|
1759
1759
|
}
|
|
1760
1760
|
}
|
|
1761
|
-
addRest({ name:
|
|
1761
|
+
addRest({ name: name4 = `arg`, required: required2 = 0 } = {}) {
|
|
1762
1762
|
if (this.arity.extra === NoLimits)
|
|
1763
1763
|
throw new Error(`Infinite lists cannot be declared multiple times in the same command`);
|
|
1764
1764
|
if (this.arity.trailing.length > 0)
|
|
1765
1765
|
throw new Error(`Infinite lists cannot be declared after the required trailing positional arguments`);
|
|
1766
1766
|
for (let t = 0; t < required2; ++t)
|
|
1767
|
-
this.addPositional({ name:
|
|
1767
|
+
this.addPositional({ name: name4 });
|
|
1768
1768
|
this.arity.extra = NoLimits;
|
|
1769
1769
|
}
|
|
1770
1770
|
addProxy({ required: required2 = 0 } = {}) {
|
|
@@ -1778,11 +1778,11 @@ var CommandBuilder = class {
|
|
|
1778
1778
|
throw new Error(`The arity must be an integer, got ${arity}`);
|
|
1779
1779
|
if (arity < 0)
|
|
1780
1780
|
throw new Error(`The arity must be positive, got ${arity}`);
|
|
1781
|
-
const preferredName = nameSet.reduce((longestName,
|
|
1782
|
-
return
|
|
1781
|
+
const preferredName = nameSet.reduce((longestName, name4) => {
|
|
1782
|
+
return name4.length > longestName.length ? name4 : longestName;
|
|
1783
1783
|
}, ``);
|
|
1784
|
-
for (const
|
|
1785
|
-
this.allOptionNames.set(
|
|
1784
|
+
for (const name4 of nameSet)
|
|
1785
|
+
this.allOptionNames.set(name4, preferredName);
|
|
1786
1786
|
this.options.push({ preferredName, nameSet, description, arity, hidden, required: required2, allowBinding });
|
|
1787
1787
|
}
|
|
1788
1788
|
setContext(context) {
|
|
@@ -1800,19 +1800,19 @@ var CommandBuilder = class {
|
|
|
1800
1800
|
const args = [];
|
|
1801
1801
|
for (let t = 0; t < arity; ++t)
|
|
1802
1802
|
args.push(` #${t}`);
|
|
1803
|
-
const
|
|
1803
|
+
const definition4 = `${nameSet.join(`,`)}${args.join(``)}`;
|
|
1804
1804
|
if (!inlineOptions && description) {
|
|
1805
|
-
detailedOptionList.push({ preferredName, nameSet, definition:
|
|
1805
|
+
detailedOptionList.push({ preferredName, nameSet, definition: definition4, description, required: required2 });
|
|
1806
1806
|
} else {
|
|
1807
|
-
segments.push(required2 ? `<${
|
|
1807
|
+
segments.push(required2 ? `<${definition4}>` : `[${definition4}]`);
|
|
1808
1808
|
}
|
|
1809
1809
|
}
|
|
1810
|
-
segments.push(...this.arity.leading.map((
|
|
1810
|
+
segments.push(...this.arity.leading.map((name4) => `<${name4}>`));
|
|
1811
1811
|
if (this.arity.extra === NoLimits)
|
|
1812
1812
|
segments.push(`...`);
|
|
1813
1813
|
else
|
|
1814
|
-
segments.push(...this.arity.extra.map((
|
|
1815
|
-
segments.push(...this.arity.trailing.map((
|
|
1814
|
+
segments.push(...this.arity.extra.map((name4) => `[${name4}]`));
|
|
1815
|
+
segments.push(...this.arity.trailing.map((name4) => `<${name4}>`));
|
|
1816
1816
|
}
|
|
1817
1817
|
const usage = segments.join(` `);
|
|
1818
1818
|
return { usage, options: detailedOptionList };
|
|
@@ -1828,19 +1828,19 @@ var CommandBuilder = class {
|
|
|
1828
1828
|
registerStatic(machine, NodeType.InitialNode, SpecialToken.StartOfInput, firstNode, [`setCandidateState`, { candidateUsage, requiredOptions }]);
|
|
1829
1829
|
const positionalArgument = this.arity.proxy ? `always` : `isNotOptionLike`;
|
|
1830
1830
|
const paths = this.paths.length > 0 ? this.paths : [[]];
|
|
1831
|
-
for (const
|
|
1831
|
+
for (const path9 of paths) {
|
|
1832
1832
|
let lastPathNode = firstNode;
|
|
1833
|
-
if (
|
|
1833
|
+
if (path9.length > 0) {
|
|
1834
1834
|
const optionPathNode = injectNode(machine, makeNode());
|
|
1835
1835
|
registerShortcut(machine, lastPathNode, optionPathNode);
|
|
1836
1836
|
this.registerOptions(machine, optionPathNode);
|
|
1837
1837
|
lastPathNode = optionPathNode;
|
|
1838
1838
|
}
|
|
1839
|
-
for (let t = 0; t <
|
|
1839
|
+
for (let t = 0; t < path9.length; ++t) {
|
|
1840
1840
|
const nextPathNode = injectNode(machine, makeNode());
|
|
1841
|
-
registerStatic(machine, lastPathNode,
|
|
1841
|
+
registerStatic(machine, lastPathNode, path9[t], nextPathNode, `pushPath`);
|
|
1842
1842
|
lastPathNode = nextPathNode;
|
|
1843
|
-
if (t + 1 <
|
|
1843
|
+
if (t + 1 < path9.length) {
|
|
1844
1844
|
const helpNode = injectNode(machine, makeNode());
|
|
1845
1845
|
registerDynamic(machine, lastPathNode, `isHelp`, helpNode, [`useHelp`, this.cliIndex]);
|
|
1846
1846
|
registerStatic(machine, helpNode, SpecialToken.EndOfInput, NodeType.SuccessNode, [`setSelectedIndex`, HELP_COMMAND_INDEX]);
|
|
@@ -1925,16 +1925,16 @@ var CommandBuilder = class {
|
|
|
1925
1925
|
registerDynamic(machine, node2, [`isInvalidOption`], NodeType.ErrorNode, [`setError`, `Invalid option name`]);
|
|
1926
1926
|
for (const option of this.options) {
|
|
1927
1927
|
if (option.arity === 0) {
|
|
1928
|
-
for (const
|
|
1929
|
-
registerDynamic(machine, node2, [`isOption`,
|
|
1930
|
-
if (
|
|
1931
|
-
registerDynamic(machine, node2, [`isNegatedOption`,
|
|
1928
|
+
for (const name4 of option.nameSet) {
|
|
1929
|
+
registerDynamic(machine, node2, [`isOption`, name4], node2, [`pushTrue`, option.preferredName]);
|
|
1930
|
+
if (name4.startsWith(`--`) && !name4.startsWith(`--no-`)) {
|
|
1931
|
+
registerDynamic(machine, node2, [`isNegatedOption`, name4], node2, [`pushFalse`, option.preferredName]);
|
|
1932
1932
|
}
|
|
1933
1933
|
}
|
|
1934
1934
|
} else {
|
|
1935
1935
|
let lastNode = injectNode(machine, makeNode());
|
|
1936
|
-
for (const
|
|
1937
|
-
registerDynamic(machine, node2, [`isOption`,
|
|
1936
|
+
for (const name4 of option.nameSet)
|
|
1937
|
+
registerDynamic(machine, node2, [`isOption`, name4], lastNode, [`pushUndefined`, option.preferredName]);
|
|
1938
1938
|
for (let t = 0; t < option.arity; ++t) {
|
|
1939
1939
|
const nextNode = injectNode(machine, makeNode());
|
|
1940
1940
|
registerStatic(machine, lastNode, SpecialToken.EndOfInput, NodeType.ErrorNode, `setOptionArityError`);
|
|
@@ -2146,11 +2146,11 @@ var Cli = class _Cli {
|
|
|
2146
2146
|
const index = builder.cliIndex;
|
|
2147
2147
|
const paths = (_a5 = commandClass.paths) !== null && _a5 !== void 0 ? _a5 : command.paths;
|
|
2148
2148
|
if (typeof paths !== `undefined`)
|
|
2149
|
-
for (const
|
|
2150
|
-
builder.addPath(
|
|
2149
|
+
for (const path9 of paths)
|
|
2150
|
+
builder.addPath(path9);
|
|
2151
2151
|
this.registrations.set(commandClass, { specs, builder, index });
|
|
2152
|
-
for (const [key, { definition:
|
|
2153
|
-
|
|
2152
|
+
for (const [key, { definition: definition4 }] of specs.entries())
|
|
2153
|
+
definition4(builder, key);
|
|
2154
2154
|
builder.setContext({
|
|
2155
2155
|
commandClass
|
|
2156
2156
|
});
|
|
@@ -2245,13 +2245,13 @@ var Cli = class _Cli {
|
|
|
2245
2245
|
definition(commandClass, { colored = false } = {}) {
|
|
2246
2246
|
if (!commandClass.usage)
|
|
2247
2247
|
return null;
|
|
2248
|
-
const { usage:
|
|
2248
|
+
const { usage: path9 } = this.getUsageByRegistration(commandClass, { detailed: false });
|
|
2249
2249
|
const { usage, options } = this.getUsageByRegistration(commandClass, { detailed: true, inlineOptions: false });
|
|
2250
2250
|
const category = typeof commandClass.usage.category !== `undefined` ? formatMarkdownish(commandClass.usage.category, { format: this.format(colored), paragraphs: false }) : void 0;
|
|
2251
2251
|
const description = typeof commandClass.usage.description !== `undefined` ? formatMarkdownish(commandClass.usage.description, { format: this.format(colored), paragraphs: false }) : void 0;
|
|
2252
2252
|
const details = typeof commandClass.usage.details !== `undefined` ? formatMarkdownish(commandClass.usage.details, { format: this.format(colored), paragraphs: true }) : void 0;
|
|
2253
2253
|
const examples = typeof commandClass.usage.examples !== `undefined` ? commandClass.usage.examples.map(([label, cli2]) => [formatMarkdownish(label, { format: this.format(colored), paragraphs: false }), cli2.replace(/\$0/g, this.binaryName)]) : void 0;
|
|
2254
|
-
return { path:
|
|
2254
|
+
return { path: path9, usage, category, description, details, examples, options };
|
|
2255
2255
|
}
|
|
2256
2256
|
definitions({ colored = false } = {}) {
|
|
2257
2257
|
const data = [];
|
|
@@ -2270,7 +2270,7 @@ var Cli = class _Cli {
|
|
|
2270
2270
|
const paths = commandClass2.paths;
|
|
2271
2271
|
const isDocumented = typeof commandClass2.usage !== `undefined`;
|
|
2272
2272
|
const isExclusivelyDefault = !paths || paths.length === 0 || paths.length === 1 && paths[0].length === 0;
|
|
2273
|
-
const isDefault = isExclusivelyDefault || ((_a5 = paths === null || paths === void 0 ? void 0 : paths.some((
|
|
2273
|
+
const isDefault = isExclusivelyDefault || ((_a5 = paths === null || paths === void 0 ? void 0 : paths.some((path9) => path9.length === 0)) !== null && _a5 !== void 0 ? _a5 : false);
|
|
2274
2274
|
if (isDefault) {
|
|
2275
2275
|
if (command) {
|
|
2276
2276
|
command = null;
|
|
@@ -2381,8 +2381,8 @@ var Cli = class _Cli {
|
|
|
2381
2381
|
}, 0);
|
|
2382
2382
|
result += `
|
|
2383
2383
|
`;
|
|
2384
|
-
for (const { definition:
|
|
2385
|
-
result += ` ${this.format(colored).bold(
|
|
2384
|
+
for (const { definition: definition4, description: description2 } of options) {
|
|
2385
|
+
result += ` ${this.format(colored).bold(definition4.padEnd(maxDefinitionLength))} ${formatMarkdownish(description2, { format: this.format(colored), paragraphs: false })}`;
|
|
2386
2386
|
}
|
|
2387
2387
|
}
|
|
2388
2388
|
if (details !== ``) {
|
|
@@ -2417,10 +2417,10 @@ var Cli = class _Cli {
|
|
|
2417
2417
|
if (!error62 || typeof error62 !== `object` || !(`stack` in error62))
|
|
2418
2418
|
error62 = new Error(`Execution failed with a non-error rejection (rejected value: ${JSON.stringify(error62)})`);
|
|
2419
2419
|
let result = ``;
|
|
2420
|
-
let
|
|
2421
|
-
if (
|
|
2422
|
-
|
|
2423
|
-
result += `${this.format(colored).error(
|
|
2420
|
+
let name4 = error62.name.replace(/([a-z])([A-Z])/g, `$1 $2`);
|
|
2421
|
+
if (name4 === `Error`)
|
|
2422
|
+
name4 = `Internal Error`;
|
|
2423
|
+
result += `${this.format(colored).error(name4)}: ${error62.message}
|
|
2424
2424
|
`;
|
|
2425
2425
|
const meta3 = error62.clipanion;
|
|
2426
2426
|
if (typeof meta3 !== `undefined`) {
|
|
@@ -2563,10 +2563,10 @@ function Array2(descriptor, initialValueBase, optsBase) {
|
|
|
2563
2563
|
transformer(builder, key, state) {
|
|
2564
2564
|
let usedName;
|
|
2565
2565
|
let currentValue = typeof initialValue !== `undefined` ? [...initialValue] : void 0;
|
|
2566
|
-
for (const { name:
|
|
2567
|
-
if (!nameSet.has(
|
|
2566
|
+
for (const { name: name4, value } of state.options) {
|
|
2567
|
+
if (!nameSet.has(name4))
|
|
2568
2568
|
continue;
|
|
2569
|
-
usedName =
|
|
2569
|
+
usedName = name4;
|
|
2570
2570
|
currentValue = currentValue !== null && currentValue !== void 0 ? currentValue : [];
|
|
2571
2571
|
currentValue.push(value);
|
|
2572
2572
|
}
|
|
@@ -2597,8 +2597,8 @@ function Boolean2(descriptor, initialValueBase, optsBase) {
|
|
|
2597
2597
|
},
|
|
2598
2598
|
transformer(builer, key, state) {
|
|
2599
2599
|
let currentValue = initialValue;
|
|
2600
|
-
for (const { name:
|
|
2601
|
-
if (!nameSet.has(
|
|
2600
|
+
for (const { name: name4, value } of state.options) {
|
|
2601
|
+
if (!nameSet.has(name4))
|
|
2602
2602
|
continue;
|
|
2603
2603
|
currentValue = value;
|
|
2604
2604
|
}
|
|
@@ -2625,8 +2625,8 @@ function Counter(descriptor, initialValueBase, optsBase) {
|
|
|
2625
2625
|
},
|
|
2626
2626
|
transformer(builder, key, state) {
|
|
2627
2627
|
let currentValue = initialValue;
|
|
2628
|
-
for (const { name:
|
|
2629
|
-
if (!nameSet.has(
|
|
2628
|
+
for (const { name: name4, value } of state.options) {
|
|
2629
|
+
if (!nameSet.has(name4))
|
|
2630
2630
|
continue;
|
|
2631
2631
|
currentValue !== null && currentValue !== void 0 ? currentValue : currentValue = 0;
|
|
2632
2632
|
if (!value) {
|
|
@@ -2690,10 +2690,10 @@ function StringOption(descriptor, initialValueBase, optsBase) {
|
|
|
2690
2690
|
usedName = opts.env;
|
|
2691
2691
|
currentValue = context.env[opts.env];
|
|
2692
2692
|
}
|
|
2693
|
-
for (const { name:
|
|
2694
|
-
if (!nameSet.has(
|
|
2693
|
+
for (const { name: name4, value } of state.options) {
|
|
2694
|
+
if (!nameSet.has(name4))
|
|
2695
2695
|
continue;
|
|
2696
|
-
usedName =
|
|
2696
|
+
usedName = name4;
|
|
2697
2697
|
currentValue = value;
|
|
2698
2698
|
}
|
|
2699
2699
|
if (typeof currentValue === `string`) {
|
|
@@ -3636,10 +3636,10 @@ function listStoredProfiles(branding) {
|
|
|
3636
3636
|
if (!existsSync(dir)) return profiles;
|
|
3637
3637
|
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
3638
3638
|
if (!entry.isFile() || !entry.name.endsWith(".toml")) continue;
|
|
3639
|
-
const
|
|
3639
|
+
const name4 = entry.name.slice(0, -".toml".length);
|
|
3640
3640
|
try {
|
|
3641
|
-
const normalized2 = normalizeProfileName(
|
|
3642
|
-
if (normalized2 && normalized2 ===
|
|
3641
|
+
const normalized2 = normalizeProfileName(name4);
|
|
3642
|
+
if (normalized2 && normalized2 === name4) profiles.push(normalized2);
|
|
3643
3643
|
} catch {
|
|
3644
3644
|
}
|
|
3645
3645
|
}
|
|
@@ -3800,7 +3800,7 @@ async function runCli(cli2, argv, context) {
|
|
|
3800
3800
|
}
|
|
3801
3801
|
|
|
3802
3802
|
// ente/version.ts
|
|
3803
|
-
var VERSION = "0.4.
|
|
3803
|
+
var VERSION = "0.4.95";
|
|
3804
3804
|
|
|
3805
3805
|
// ente/branding.ts
|
|
3806
3806
|
var NPM_REGISTRY = "https://registry.npmjs.org";
|
|
@@ -5153,16 +5153,16 @@ var DefaultLogger = class {
|
|
|
5153
5153
|
this._verbose = options.verbose;
|
|
5154
5154
|
}
|
|
5155
5155
|
addLogLineListener(func) {
|
|
5156
|
-
let
|
|
5156
|
+
let id18 = Math.random().toString(36).substring(2, 15);
|
|
5157
5157
|
for (let i = 0; i < 10; i++) {
|
|
5158
|
-
if (this._onLogLineFuncs[
|
|
5158
|
+
if (this._onLogLineFuncs[id18] === void 0) {
|
|
5159
5159
|
break;
|
|
5160
5160
|
}
|
|
5161
|
-
|
|
5161
|
+
id18 = Math.random().toString(36).substring(2, 15);
|
|
5162
5162
|
}
|
|
5163
|
-
this._onLogLineFuncs[
|
|
5163
|
+
this._onLogLineFuncs[id18] = func;
|
|
5164
5164
|
return () => {
|
|
5165
|
-
delete this._onLogLineFuncs[
|
|
5165
|
+
delete this._onLogLineFuncs[id18];
|
|
5166
5166
|
};
|
|
5167
5167
|
}
|
|
5168
5168
|
logVerbose(...args) {
|
|
@@ -5285,14 +5285,14 @@ function getFunctionName(functionReference) {
|
|
|
5285
5285
|
);
|
|
5286
5286
|
}
|
|
5287
5287
|
if (typeof functionReference === "string") return functionReference;
|
|
5288
|
-
const
|
|
5289
|
-
if (!
|
|
5288
|
+
const name4 = functionReference[functionName];
|
|
5289
|
+
if (!name4) {
|
|
5290
5290
|
throw new Error(`${functionReference} is not a functionReference`);
|
|
5291
5291
|
}
|
|
5292
|
-
return
|
|
5292
|
+
return name4;
|
|
5293
5293
|
}
|
|
5294
|
-
function makeFunctionReference(
|
|
5295
|
-
return { [functionName]:
|
|
5294
|
+
function makeFunctionReference(name4) {
|
|
5295
|
+
return { [functionName]: name4 };
|
|
5296
5296
|
}
|
|
5297
5297
|
function createApi(pathParts = []) {
|
|
5298
5298
|
const handler = {
|
|
@@ -5307,12 +5307,12 @@ function createApi(pathParts = []) {
|
|
|
5307
5307
|
`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${found}\``
|
|
5308
5308
|
);
|
|
5309
5309
|
}
|
|
5310
|
-
const
|
|
5310
|
+
const path9 = pathParts.slice(0, -1).join("/");
|
|
5311
5311
|
const exportName = pathParts[pathParts.length - 1];
|
|
5312
5312
|
if (exportName === "default") {
|
|
5313
|
-
return
|
|
5313
|
+
return path9;
|
|
5314
5314
|
} else {
|
|
5315
|
-
return
|
|
5315
|
+
return path9 + ":" + exportName;
|
|
5316
5316
|
}
|
|
5317
5317
|
} else if (prop === Symbol.toStringTag) {
|
|
5318
5318
|
return "FunctionReference";
|
|
@@ -5477,7 +5477,7 @@ var require_constants = __commonJS2({
|
|
|
5477
5477
|
var require_node_gyp_build = __commonJS2({
|
|
5478
5478
|
"../node_modules/.pnpm/node-gyp-build@4.8.4/node_modules/node-gyp-build/node-gyp-build.js"(exports, module) {
|
|
5479
5479
|
var fs = __require2("fs");
|
|
5480
|
-
var
|
|
5480
|
+
var path9 = __require2("path");
|
|
5481
5481
|
var os3 = __require2("os");
|
|
5482
5482
|
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require2;
|
|
5483
5483
|
var vars3 = process.config && process.config.variables || {};
|
|
@@ -5494,21 +5494,21 @@ var require_node_gyp_build = __commonJS2({
|
|
|
5494
5494
|
return runtimeRequire(load.resolve(dir));
|
|
5495
5495
|
}
|
|
5496
5496
|
load.resolve = load.path = function(dir) {
|
|
5497
|
-
dir =
|
|
5497
|
+
dir = path9.resolve(dir || ".");
|
|
5498
5498
|
try {
|
|
5499
|
-
var
|
|
5500
|
-
if (process.env[
|
|
5499
|
+
var name4 = runtimeRequire(path9.join(dir, "package.json")).name.toUpperCase().replace(/-/g, "_");
|
|
5500
|
+
if (process.env[name4 + "_PREBUILD"]) dir = process.env[name4 + "_PREBUILD"];
|
|
5501
5501
|
} catch (err) {
|
|
5502
5502
|
}
|
|
5503
5503
|
if (!prebuildsOnly) {
|
|
5504
|
-
var release = getFirst(
|
|
5504
|
+
var release = getFirst(path9.join(dir, "build/Release"), matchBuild);
|
|
5505
5505
|
if (release) return release;
|
|
5506
|
-
var debug2 = getFirst(
|
|
5506
|
+
var debug2 = getFirst(path9.join(dir, "build/Debug"), matchBuild);
|
|
5507
5507
|
if (debug2) return debug2;
|
|
5508
5508
|
}
|
|
5509
5509
|
var prebuild = resolve2(dir);
|
|
5510
5510
|
if (prebuild) return prebuild;
|
|
5511
|
-
var nearby = resolve2(
|
|
5511
|
+
var nearby = resolve2(path9.dirname(process.execPath));
|
|
5512
5512
|
if (nearby) return nearby;
|
|
5513
5513
|
var target2 = [
|
|
5514
5514
|
"platform=" + platform,
|
|
@@ -5525,14 +5525,14 @@ var require_node_gyp_build = __commonJS2({
|
|
|
5525
5525
|
].filter(Boolean).join(" ");
|
|
5526
5526
|
throw new Error("No native build was found for " + target2 + "\n loaded from: " + dir + "\n");
|
|
5527
5527
|
function resolve2(dir2) {
|
|
5528
|
-
var tuples = readdirSync2(
|
|
5528
|
+
var tuples = readdirSync2(path9.join(dir2, "prebuilds")).map(parseTuple);
|
|
5529
5529
|
var tuple2 = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0];
|
|
5530
5530
|
if (!tuple2) return;
|
|
5531
|
-
var prebuilds =
|
|
5531
|
+
var prebuilds = path9.join(dir2, "prebuilds", tuple2.name);
|
|
5532
5532
|
var parsed = readdirSync2(prebuilds).map(parseTags);
|
|
5533
5533
|
var candidates = parsed.filter(matchTags(runtime, abi));
|
|
5534
5534
|
var winner = candidates.sort(compareTags(runtime))[0];
|
|
5535
|
-
if (winner) return
|
|
5535
|
+
if (winner) return path9.join(prebuilds, winner.file);
|
|
5536
5536
|
}
|
|
5537
5537
|
};
|
|
5538
5538
|
function readdirSync2(dir) {
|
|
@@ -5544,20 +5544,20 @@ var require_node_gyp_build = __commonJS2({
|
|
|
5544
5544
|
}
|
|
5545
5545
|
function getFirst(dir, filter) {
|
|
5546
5546
|
var files = readdirSync2(dir).filter(filter);
|
|
5547
|
-
return files[0] &&
|
|
5547
|
+
return files[0] && path9.join(dir, files[0]);
|
|
5548
5548
|
}
|
|
5549
|
-
function matchBuild(
|
|
5550
|
-
return /\.node$/.test(
|
|
5549
|
+
function matchBuild(name4) {
|
|
5550
|
+
return /\.node$/.test(name4);
|
|
5551
5551
|
}
|
|
5552
|
-
function parseTuple(
|
|
5553
|
-
var arr3 =
|
|
5552
|
+
function parseTuple(name4) {
|
|
5553
|
+
var arr3 = name4.split("-");
|
|
5554
5554
|
if (arr3.length !== 2) return;
|
|
5555
5555
|
var platform2 = arr3[0];
|
|
5556
5556
|
var architectures = arr3[1].split("+");
|
|
5557
5557
|
if (!platform2) return;
|
|
5558
5558
|
if (!architectures.length) return;
|
|
5559
5559
|
if (!architectures.every(Boolean)) return;
|
|
5560
|
-
return { name:
|
|
5560
|
+
return { name: name4, platform: platform2, architectures };
|
|
5561
5561
|
}
|
|
5562
5562
|
function matchTuple(platform2, arch2) {
|
|
5563
5563
|
return function(tuple2) {
|
|
@@ -7731,9 +7731,9 @@ var require_extension = __commonJS2({
|
|
|
7731
7731
|
"../node_modules/.pnpm/ws@8.21.0_bufferutil@4.0.9/node_modules/ws/lib/extension.js"(exports, module) {
|
|
7732
7732
|
"use strict";
|
|
7733
7733
|
var { tokenChars } = require_validation();
|
|
7734
|
-
function push(dest,
|
|
7735
|
-
if (dest[
|
|
7736
|
-
else dest[
|
|
7734
|
+
function push(dest, name4, elem) {
|
|
7735
|
+
if (dest[name4] === void 0) dest[name4] = [elem];
|
|
7736
|
+
else dest[name4].push(elem);
|
|
7737
7737
|
}
|
|
7738
7738
|
function parse4(header) {
|
|
7739
7739
|
const offers = /* @__PURE__ */ Object.create(null);
|
|
@@ -7759,12 +7759,12 @@ var require_extension = __commonJS2({
|
|
|
7759
7759
|
throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
7760
7760
|
}
|
|
7761
7761
|
if (end === -1) end = i;
|
|
7762
|
-
const
|
|
7762
|
+
const name4 = header.slice(start, end);
|
|
7763
7763
|
if (code3 === 44) {
|
|
7764
|
-
push(offers,
|
|
7764
|
+
push(offers, name4, params);
|
|
7765
7765
|
params = /* @__PURE__ */ Object.create(null);
|
|
7766
7766
|
} else {
|
|
7767
|
-
extensionName =
|
|
7767
|
+
extensionName = name4;
|
|
7768
7768
|
}
|
|
7769
7769
|
start = end = -1;
|
|
7770
7770
|
} else {
|
|
@@ -9506,7 +9506,7 @@ var ConvexHttpClient = class {
|
|
|
9506
9506
|
return await this.queryInner(query, queryArgs, {});
|
|
9507
9507
|
}
|
|
9508
9508
|
async queryInner(query, queryArgs, options) {
|
|
9509
|
-
const
|
|
9509
|
+
const name4 = getFunctionName(query);
|
|
9510
9510
|
const args = [convexToJson(queryArgs)];
|
|
9511
9511
|
const headers = {
|
|
9512
9512
|
"Content-Type": "application/json",
|
|
@@ -9520,7 +9520,7 @@ var ConvexHttpClient = class {
|
|
|
9520
9520
|
const localFetch = this.fetch || specifiedFetch || fetch;
|
|
9521
9521
|
const timestamp2 = options.timestampPromise ? await options.timestampPromise : void 0;
|
|
9522
9522
|
const body = JSON.stringify({
|
|
9523
|
-
path:
|
|
9523
|
+
path: name4,
|
|
9524
9524
|
format: "convex_encoded_json",
|
|
9525
9525
|
args,
|
|
9526
9526
|
...timestamp2 ? { ts: timestamp2 } : {}
|
|
@@ -9538,7 +9538,7 @@ var ConvexHttpClient = class {
|
|
|
9538
9538
|
const respJSON = await response.json();
|
|
9539
9539
|
if (this.debug) {
|
|
9540
9540
|
for (const line of respJSON.logLines ?? []) {
|
|
9541
|
-
logForFunction(this.logger, "info", "query",
|
|
9541
|
+
logForFunction(this.logger, "info", "query", name4, line);
|
|
9542
9542
|
}
|
|
9543
9543
|
}
|
|
9544
9544
|
switch (respJSON.status) {
|
|
@@ -9557,9 +9557,9 @@ var ConvexHttpClient = class {
|
|
|
9557
9557
|
}
|
|
9558
9558
|
}
|
|
9559
9559
|
async mutationInner(mutation2, mutationArgs) {
|
|
9560
|
-
const
|
|
9560
|
+
const name4 = getFunctionName(mutation2);
|
|
9561
9561
|
const body = JSON.stringify({
|
|
9562
|
-
path:
|
|
9562
|
+
path: name4,
|
|
9563
9563
|
format: "convex_encoded_json",
|
|
9564
9564
|
args: [convexToJson(mutationArgs)]
|
|
9565
9565
|
});
|
|
@@ -9585,7 +9585,7 @@ var ConvexHttpClient = class {
|
|
|
9585
9585
|
const respJSON = await response.json();
|
|
9586
9586
|
if (this.debug) {
|
|
9587
9587
|
for (const line of respJSON.logLines ?? []) {
|
|
9588
|
-
logForFunction(this.logger, "info", "mutation",
|
|
9588
|
+
logForFunction(this.logger, "info", "mutation", name4, line);
|
|
9589
9589
|
}
|
|
9590
9590
|
}
|
|
9591
9591
|
switch (respJSON.status) {
|
|
@@ -9654,9 +9654,9 @@ var ConvexHttpClient = class {
|
|
|
9654
9654
|
*/
|
|
9655
9655
|
async action(action2, ...args) {
|
|
9656
9656
|
const actionArgs = parseArgs(args[0]);
|
|
9657
|
-
const
|
|
9657
|
+
const name4 = getFunctionName(action2);
|
|
9658
9658
|
const body = JSON.stringify({
|
|
9659
|
-
path:
|
|
9659
|
+
path: name4,
|
|
9660
9660
|
format: "convex_encoded_json",
|
|
9661
9661
|
args: [convexToJson(actionArgs)]
|
|
9662
9662
|
});
|
|
@@ -9682,7 +9682,7 @@ var ConvexHttpClient = class {
|
|
|
9682
9682
|
const respJSON = await response.json();
|
|
9683
9683
|
if (this.debug) {
|
|
9684
9684
|
for (const line of respJSON.logLines ?? []) {
|
|
9685
|
-
logForFunction(this.logger, "info", "action",
|
|
9685
|
+
logForFunction(this.logger, "info", "action", name4, line);
|
|
9686
9686
|
}
|
|
9687
9687
|
}
|
|
9688
9688
|
switch (respJSON.status) {
|
|
@@ -9712,10 +9712,10 @@ var ConvexHttpClient = class {
|
|
|
9712
9712
|
*/
|
|
9713
9713
|
async function(anyFunction, componentPath, ...args) {
|
|
9714
9714
|
const functionArgs = parseArgs(args[0]);
|
|
9715
|
-
const
|
|
9715
|
+
const name4 = typeof anyFunction === "string" ? anyFunction : getFunctionName(anyFunction);
|
|
9716
9716
|
const body = JSON.stringify({
|
|
9717
9717
|
componentPath,
|
|
9718
|
-
path:
|
|
9718
|
+
path: name4,
|
|
9719
9719
|
format: "convex_encoded_json",
|
|
9720
9720
|
args: convexToJson(functionArgs)
|
|
9721
9721
|
});
|
|
@@ -9741,7 +9741,7 @@ var ConvexHttpClient = class {
|
|
|
9741
9741
|
const respJSON = await response.json();
|
|
9742
9742
|
if (this.debug) {
|
|
9743
9743
|
for (const line of respJSON.logLines ?? []) {
|
|
9744
|
-
logForFunction(this.logger, "info", "any",
|
|
9744
|
+
logForFunction(this.logger, "info", "any", name4, line);
|
|
9745
9745
|
}
|
|
9746
9746
|
}
|
|
9747
9747
|
switch (respJSON.status) {
|
|
@@ -10726,10 +10726,10 @@ function mergeDefs(...defs) {
|
|
|
10726
10726
|
function cloneDef(schema) {
|
|
10727
10727
|
return mergeDefs(schema._zod.def);
|
|
10728
10728
|
}
|
|
10729
|
-
function getElementAtPath(obj,
|
|
10730
|
-
if (!
|
|
10729
|
+
function getElementAtPath(obj, path9) {
|
|
10730
|
+
if (!path9)
|
|
10731
10731
|
return obj;
|
|
10732
|
-
return
|
|
10732
|
+
return path9.reduce((acc, key) => acc?.[key], obj);
|
|
10733
10733
|
}
|
|
10734
10734
|
function promiseAllObject(promisesObj) {
|
|
10735
10735
|
const keys = Object.keys(promisesObj);
|
|
@@ -11028,12 +11028,12 @@ function merge(a, b) {
|
|
|
11028
11028
|
});
|
|
11029
11029
|
return clone(a, def);
|
|
11030
11030
|
}
|
|
11031
|
-
function partial(Class2, schema, mask,
|
|
11031
|
+
function partial(Class2, schema, mask, name4 = "partial") {
|
|
11032
11032
|
const currDef = schema._zod.def;
|
|
11033
11033
|
const checks = currDef.checks;
|
|
11034
11034
|
const hasChecks = checks && checks.length > 0;
|
|
11035
11035
|
if (hasChecks) {
|
|
11036
|
-
throw new Error(`.${
|
|
11036
|
+
throw new Error(`.${name4}() cannot be used on object schemas containing refinements`);
|
|
11037
11037
|
}
|
|
11038
11038
|
const selected = mask ? new Set(maskedKeys(schema, mask)) : void 0;
|
|
11039
11039
|
const newShape = {};
|
|
@@ -11069,11 +11069,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
11069
11069
|
}
|
|
11070
11070
|
return false;
|
|
11071
11071
|
}
|
|
11072
|
-
function prefixIssues(
|
|
11072
|
+
function prefixIssues(path9, issues) {
|
|
11073
11073
|
return issues.map((iss) => {
|
|
11074
11074
|
var _a5;
|
|
11075
11075
|
(_a5 = iss).path ?? (_a5.path = []);
|
|
11076
|
-
iss.path.unshift(
|
|
11076
|
+
iss.path.unshift(path9);
|
|
11077
11077
|
return iss;
|
|
11078
11078
|
});
|
|
11079
11079
|
}
|
|
@@ -11373,7 +11373,7 @@ function newError(Definition) {
|
|
|
11373
11373
|
return new Definition();
|
|
11374
11374
|
}
|
|
11375
11375
|
// @__NO_SIDE_EFFECTS__
|
|
11376
|
-
function $constructor(
|
|
11376
|
+
function $constructor(name4, initializer3, proto, params) {
|
|
11377
11377
|
const zodProto = {};
|
|
11378
11378
|
function Internals(def) {
|
|
11379
11379
|
this.def = def;
|
|
@@ -11391,10 +11391,10 @@ function $constructor(name3, initializer3, proto, params) {
|
|
|
11391
11391
|
} finally {
|
|
11392
11392
|
_zodDesc.value = void 0;
|
|
11393
11393
|
}
|
|
11394
|
-
} else if (inst._zod.traits.has(
|
|
11394
|
+
} else if (inst._zod.traits.has(name4)) {
|
|
11395
11395
|
return;
|
|
11396
11396
|
}
|
|
11397
|
-
inst._zod.traits.add(
|
|
11397
|
+
inst._zod.traits.add(name4);
|
|
11398
11398
|
initializer3(inst, def);
|
|
11399
11399
|
if (initialized) {
|
|
11400
11400
|
const own2 = Object.getPrototypeOf(inst);
|
|
@@ -11420,7 +11420,7 @@ function $constructor(name3, initializer3, proto, params) {
|
|
|
11420
11420
|
const Parent = params?.Parent ?? Object;
|
|
11421
11421
|
class Definition extends Parent {
|
|
11422
11422
|
}
|
|
11423
|
-
Object.defineProperty(Definition, "name", { value:
|
|
11423
|
+
Object.defineProperty(Definition, "name", { value: name4 });
|
|
11424
11424
|
function _(def) {
|
|
11425
11425
|
const inst = params?.Parent ? newError(Definition) : this;
|
|
11426
11426
|
init(inst, def);
|
|
@@ -11441,10 +11441,10 @@ function $constructor(name3, initializer3, proto, params) {
|
|
|
11441
11441
|
value: (inst) => {
|
|
11442
11442
|
if (params?.Parent && inst instanceof params.Parent)
|
|
11443
11443
|
return true;
|
|
11444
|
-
return inst?._zod?.traits?.has(
|
|
11444
|
+
return inst?._zod?.traits?.has(name4);
|
|
11445
11445
|
}
|
|
11446
11446
|
});
|
|
11447
|
-
Object.defineProperty(_, "name", { value:
|
|
11447
|
+
Object.defineProperty(_, "name", { value: name4 });
|
|
11448
11448
|
return _;
|
|
11449
11449
|
}
|
|
11450
11450
|
var $brand = /* @__PURE__ */ Symbol("zod_brand");
|
|
@@ -11454,8 +11454,8 @@ var $ZodAsyncError = class extends Error {
|
|
|
11454
11454
|
}
|
|
11455
11455
|
};
|
|
11456
11456
|
var $ZodEncodeError = class extends Error {
|
|
11457
|
-
constructor(
|
|
11458
|
-
super(`Encountered unidirectional transform during encode: ${
|
|
11457
|
+
constructor(name4) {
|
|
11458
|
+
super(`Encountered unidirectional transform during encode: ${name4}`);
|
|
11459
11459
|
this.name = "ZodEncodeError";
|
|
11460
11460
|
}
|
|
11461
11461
|
};
|
|
@@ -11535,16 +11535,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
|
|
|
11535
11535
|
}
|
|
11536
11536
|
function formatError2(error62, mapper = (issue2) => issue2.message) {
|
|
11537
11537
|
const fieldErrors = { _errors: [] };
|
|
11538
|
-
const processError = (error63,
|
|
11538
|
+
const processError = (error63, path9 = []) => {
|
|
11539
11539
|
for (const issue2 of error63.issues) {
|
|
11540
11540
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
11541
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
11541
|
+
issue2.errors.map((issues) => processError({ issues }, [...path9, ...issue2.path]));
|
|
11542
11542
|
} else if (issue2.code === "invalid_key") {
|
|
11543
|
-
processError({ issues: issue2.issues }, [...
|
|
11543
|
+
processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
|
|
11544
11544
|
} else if (issue2.code === "invalid_element") {
|
|
11545
|
-
processError({ issues: issue2.issues }, [...
|
|
11545
|
+
processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
|
|
11546
11546
|
} else {
|
|
11547
|
-
const fullpath = [...
|
|
11547
|
+
const fullpath = [...path9, ...issue2.path];
|
|
11548
11548
|
if (fullpath.length === 0) {
|
|
11549
11549
|
fieldErrors._errors.push(mapper(issue2));
|
|
11550
11550
|
} else {
|
|
@@ -11583,17 +11583,17 @@ function formatError2(error62, mapper = (issue2) => issue2.message) {
|
|
|
11583
11583
|
}
|
|
11584
11584
|
function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
11585
11585
|
const result = { errors: [] };
|
|
11586
|
-
const processError = (error63,
|
|
11586
|
+
const processError = (error63, path9 = []) => {
|
|
11587
11587
|
var _a5;
|
|
11588
11588
|
for (const issue2 of error63.issues) {
|
|
11589
11589
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
11590
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
11590
|
+
issue2.errors.map((issues) => processError({ issues }, [...path9, ...issue2.path]));
|
|
11591
11591
|
} else if (issue2.code === "invalid_key") {
|
|
11592
|
-
processError({ issues: issue2.issues }, [...
|
|
11592
|
+
processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
|
|
11593
11593
|
} else if (issue2.code === "invalid_element") {
|
|
11594
|
-
processError({ issues: issue2.issues }, [...
|
|
11594
|
+
processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
|
|
11595
11595
|
} else {
|
|
11596
|
-
const fullpath = [...
|
|
11596
|
+
const fullpath = [...path9, ...issue2.path];
|
|
11597
11597
|
if (fullpath.length === 0) {
|
|
11598
11598
|
result.errors.push(mapper(issue2));
|
|
11599
11599
|
continue;
|
|
@@ -11632,8 +11632,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
|
11632
11632
|
}
|
|
11633
11633
|
function toDotPath(_path) {
|
|
11634
11634
|
const segs = [];
|
|
11635
|
-
const
|
|
11636
|
-
for (const seg of
|
|
11635
|
+
const path9 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
11636
|
+
for (const seg of path9) {
|
|
11637
11637
|
if (typeof seg === "number")
|
|
11638
11638
|
segs.push(`[${seg}]`);
|
|
11639
11639
|
else if (typeof seg === "symbol")
|
|
@@ -13527,15 +13527,15 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
13527
13527
|
const syms = normalized2.symbolKeys;
|
|
13528
13528
|
const doc = new Doc(["payload", "ctx"], { shape, inst, memo: memo2, syms });
|
|
13529
13529
|
const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
13530
|
-
const prefixStr = (
|
|
13531
|
-
let ${
|
|
13532
|
-
for (let i = 0; i < ${
|
|
13533
|
-
const iss = ${
|
|
13530
|
+
const prefixStr = (id18, k) => `
|
|
13531
|
+
let ${id18}_ab = false;
|
|
13532
|
+
for (let i = 0; i < ${id18}.issues.length; i++) {
|
|
13533
|
+
const iss = ${id18}.issues[i];
|
|
13534
13534
|
iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
|
|
13535
13535
|
payload.issues.push(iss);
|
|
13536
|
-
if (iss.continue !== true) ${
|
|
13536
|
+
if (iss.continue !== true) ${id18}_ab = true;
|
|
13537
13537
|
}
|
|
13538
|
-
if (${
|
|
13538
|
+
if (${id18}_ab && ctx && ctx.abortEarly) {
|
|
13539
13539
|
payload.value = newResult;
|
|
13540
13540
|
return payload;
|
|
13541
13541
|
}`;
|
|
@@ -13549,34 +13549,34 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
13549
13549
|
for (const key of normalized2.allKeys) {
|
|
13550
13550
|
if (key === "__proto__")
|
|
13551
13551
|
continue;
|
|
13552
|
-
const
|
|
13552
|
+
const id18 = ids2[key];
|
|
13553
13553
|
const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : esc(key);
|
|
13554
13554
|
const isPresent = `${k} in input`;
|
|
13555
13555
|
const schema = shape[key];
|
|
13556
13556
|
const optin = schema?._zod?.optin;
|
|
13557
13557
|
const isOptionalIn = optin !== void 0;
|
|
13558
13558
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
13559
|
-
doc.write(`const ${
|
|
13559
|
+
doc.write(`const ${id18} = ${parseStr(k)};`);
|
|
13560
13560
|
if (isOptionalIn && isOptionalOut) {
|
|
13561
|
-
const assign = optin === "optional" ? `${
|
|
13561
|
+
const assign = optin === "optional" ? `${id18}_present` : `${id18}.value !== undefined || ${id18}_present`;
|
|
13562
13562
|
doc.write(`
|
|
13563
|
-
const ${
|
|
13564
|
-
if (!${
|
|
13565
|
-
if (${
|
|
13563
|
+
const ${id18}_present = ${isPresent};
|
|
13564
|
+
if (!${id18}.issues.length || ${id18}_present) {
|
|
13565
|
+
if (${id18}.issues.length) {${prefixStr(id18, k)}
|
|
13566
13566
|
}
|
|
13567
13567
|
|
|
13568
13568
|
if (${assign}) {
|
|
13569
|
-
newResult[${k}] = ${
|
|
13569
|
+
newResult[${k}] = ${id18}.value;
|
|
13570
13570
|
}
|
|
13571
13571
|
}
|
|
13572
13572
|
|
|
13573
13573
|
`);
|
|
13574
13574
|
} else if (!isOptionalIn) {
|
|
13575
13575
|
doc.write(`
|
|
13576
|
-
const ${
|
|
13577
|
-
if (${
|
|
13576
|
+
const ${id18}_present = ${isPresent};
|
|
13577
|
+
if (${id18}.issues.length) {${prefixStr(id18, k)}
|
|
13578
13578
|
}
|
|
13579
|
-
if (!${
|
|
13579
|
+
if (!${id18}_present && !${id18}.issues.length) {
|
|
13580
13580
|
payload.issues.push({
|
|
13581
13581
|
code: "invalid_type",
|
|
13582
13582
|
expected: "nonoptional",
|
|
@@ -13589,22 +13589,22 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
13589
13589
|
}
|
|
13590
13590
|
}
|
|
13591
13591
|
|
|
13592
|
-
if (${
|
|
13593
|
-
newResult[${k}] = ${
|
|
13592
|
+
if (${id18}_present) {
|
|
13593
|
+
newResult[${k}] = ${id18}.value;
|
|
13594
13594
|
}
|
|
13595
13595
|
|
|
13596
13596
|
`);
|
|
13597
13597
|
} else {
|
|
13598
13598
|
doc.write(`
|
|
13599
|
-
if (${
|
|
13599
|
+
if (${id18}.issues.length) {${prefixStr(id18, k)}
|
|
13600
13600
|
}
|
|
13601
13601
|
`);
|
|
13602
13602
|
if (optin === "defaulted") {
|
|
13603
|
-
doc.write(`newResult[${k}] = ${
|
|
13603
|
+
doc.write(`newResult[${k}] = ${id18}.value;`);
|
|
13604
13604
|
} else {
|
|
13605
13605
|
doc.write(`
|
|
13606
|
-
if (${
|
|
13607
|
-
newResult[${k}] = ${
|
|
13606
|
+
if (${id18}.value !== undefined || ${isPresent}) {
|
|
13607
|
+
newResult[${k}] = ${id18}.value;
|
|
13608
13608
|
}
|
|
13609
13609
|
`);
|
|
13610
13610
|
}
|
|
@@ -22982,13 +22982,13 @@ ${code3}
|
|
|
22982
22982
|
return fn;
|
|
22983
22983
|
}
|
|
22984
22984
|
function addConstant(ctx, value) {
|
|
22985
|
-
for (const [
|
|
22985
|
+
for (const [name5, v3] of ctx.constants) {
|
|
22986
22986
|
if (v3 === value)
|
|
22987
|
-
return
|
|
22987
|
+
return name5;
|
|
22988
22988
|
}
|
|
22989
|
-
const
|
|
22990
|
-
ctx.constants.set(
|
|
22991
|
-
return
|
|
22989
|
+
const name4 = `c${ctx.constantCounter++}`;
|
|
22990
|
+
ctx.constants.set(name4, value);
|
|
22991
|
+
return name4;
|
|
22992
22992
|
}
|
|
22993
22993
|
function addUserConstant(ctx, fn) {
|
|
22994
22994
|
ctx.definite = false;
|
|
@@ -25632,26 +25632,26 @@ function extractDefs(ctx, schema) {
|
|
|
25632
25632
|
return;
|
|
25633
25633
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
25634
25634
|
for (const entry of ctx.seen.entries()) {
|
|
25635
|
-
const
|
|
25636
|
-
if (
|
|
25637
|
-
const existing = idToSchema.get(
|
|
25635
|
+
const id18 = ctx.metadataRegistry.get(entry[0])?.id;
|
|
25636
|
+
if (id18) {
|
|
25637
|
+
const existing = idToSchema.get(id18);
|
|
25638
25638
|
if (existing && existing !== entry[0]) {
|
|
25639
|
-
throw new Error(`Duplicate schema id "${
|
|
25639
|
+
throw new Error(`Duplicate schema id "${id18}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
25640
25640
|
}
|
|
25641
|
-
idToSchema.set(
|
|
25641
|
+
idToSchema.set(id18, entry[0]);
|
|
25642
25642
|
}
|
|
25643
25643
|
}
|
|
25644
25644
|
const makeURI = (entry) => {
|
|
25645
25645
|
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
25646
25646
|
if (ctx.external) {
|
|
25647
25647
|
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
25648
|
-
const uriGenerator = ctx.external.uri ?? ((
|
|
25648
|
+
const uriGenerator = ctx.external.uri ?? ((id19) => id19);
|
|
25649
25649
|
if (externalId) {
|
|
25650
25650
|
return { ref: uriGenerator(externalId) };
|
|
25651
25651
|
}
|
|
25652
|
-
const
|
|
25653
|
-
entry[1].defId =
|
|
25654
|
-
return { defId:
|
|
25652
|
+
const id18 = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
25653
|
+
entry[1].defId = id18;
|
|
25654
|
+
return { defId: id18, ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id18)}` };
|
|
25655
25655
|
}
|
|
25656
25656
|
const uriPrefix = `#`;
|
|
25657
25657
|
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
@@ -25699,8 +25699,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
25699
25699
|
continue;
|
|
25700
25700
|
}
|
|
25701
25701
|
}
|
|
25702
|
-
const
|
|
25703
|
-
if (
|
|
25702
|
+
const id18 = ctx.metadataRegistry.get(entry[0])?.id;
|
|
25703
|
+
if (id18) {
|
|
25704
25704
|
extractToDef(entry);
|
|
25705
25705
|
continue;
|
|
25706
25706
|
}
|
|
@@ -25933,10 +25933,10 @@ function finalize(ctx, schema) {
|
|
|
25933
25933
|
} else {
|
|
25934
25934
|
}
|
|
25935
25935
|
if (ctx.external?.uri) {
|
|
25936
|
-
const
|
|
25937
|
-
if (!
|
|
25936
|
+
const id18 = ctx.external.registry.get(schema)?.id;
|
|
25937
|
+
if (!id18)
|
|
25938
25938
|
throw new Error("Schema is missing an `id` property");
|
|
25939
|
-
result.$id = ctx.external.uri(
|
|
25939
|
+
result.$id = ctx.external.uri(id18);
|
|
25940
25940
|
}
|
|
25941
25941
|
assignProps(result, root.defId ? root.schema : root.def ?? root.schema);
|
|
25942
25942
|
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
@@ -26542,7 +26542,7 @@ function stringifyKeyNames(bySchema, json3, visited) {
|
|
|
26542
26542
|
const values = json3.enum ?? (json3.const !== void 0 ? [json3.const] : void 0);
|
|
26543
26543
|
if (!numericType && !values?.some((v3) => typeof v3 === "number"))
|
|
26544
26544
|
return json3;
|
|
26545
|
-
const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id:
|
|
26545
|
+
const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id: id18, ...rest } = json3;
|
|
26546
26546
|
if (rest.enum)
|
|
26547
26547
|
rest.enum = rest.enum.map((v3) => typeof v3 === "number" ? String(v3) : v3);
|
|
26548
26548
|
else if (typeof rest.const === "number")
|
|
@@ -28771,13 +28771,13 @@ function resolveRef(ref, ctx) {
|
|
|
28771
28771
|
if (!ref.startsWith("#")) {
|
|
28772
28772
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
28773
28773
|
}
|
|
28774
|
-
const
|
|
28775
|
-
if (
|
|
28774
|
+
const path9 = ref.slice(1).split("/").filter(Boolean);
|
|
28775
|
+
if (path9.length === 0) {
|
|
28776
28776
|
return ctx.rootSchema;
|
|
28777
28777
|
}
|
|
28778
28778
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
28779
|
-
if (
|
|
28780
|
-
const key =
|
|
28779
|
+
if (path9[0] === defsKey) {
|
|
28780
|
+
const key = path9[1] === void 0 ? void 0 : decodeJSONPointerSegment(path9[1]);
|
|
28781
28781
|
if (!key || !ctx.defs[key]) {
|
|
28782
28782
|
throw new Error(`Reference not found: ${ref}`);
|
|
28783
28783
|
}
|
|
@@ -29763,8 +29763,8 @@ var CONTROL_CHARACTER = /[\u0000-\u001F\u007F-\u009F]/;
|
|
|
29763
29763
|
function isStorableAttributeKey(key) {
|
|
29764
29764
|
return STORABLE_ATTRIBUTE_KEY.test(key);
|
|
29765
29765
|
}
|
|
29766
|
-
function needsEncoding(
|
|
29767
|
-
return !isStorableAttributeKey(
|
|
29766
|
+
function needsEncoding(name4) {
|
|
29767
|
+
return !isStorableAttributeKey(name4) || name4.startsWith(ENCODED_PREFIX);
|
|
29768
29768
|
}
|
|
29769
29769
|
function escapeCharacter(character) {
|
|
29770
29770
|
if (character === "%") return "%25";
|
|
@@ -29773,12 +29773,12 @@ function escapeCharacter(character) {
|
|
|
29773
29773
|
if (code3 >= 32 && code3 <= 126) return character;
|
|
29774
29774
|
return encodeURIComponent(character).toLowerCase();
|
|
29775
29775
|
}
|
|
29776
|
-
function attributeStorageKey(
|
|
29777
|
-
if (
|
|
29778
|
-
if (!needsEncoding(
|
|
29776
|
+
function attributeStorageKey(name4) {
|
|
29777
|
+
if (name4.length === 0 || CONTROL_CHARACTER.test(name4)) return void 0;
|
|
29778
|
+
if (!needsEncoding(name4)) return name4;
|
|
29779
29779
|
let key = ENCODED_PREFIX;
|
|
29780
29780
|
try {
|
|
29781
|
-
for (const character of
|
|
29781
|
+
for (const character of name4) key += escapeCharacter(character);
|
|
29782
29782
|
} catch {
|
|
29783
29783
|
return void 0;
|
|
29784
29784
|
}
|
|
@@ -29807,7 +29807,7 @@ var ATTRIBUTE_STRING_PATCH_JSON_SCHEMA = {
|
|
|
29807
29807
|
};
|
|
29808
29808
|
var ENTITY_ATTRIBUTE_NAME_RULE = "Entity attribute names must be nonempty, contain no control characters and encode to at most 1024 characters";
|
|
29809
29809
|
var ENTITY_ATTRIBUTE_NAME_JSON_SCHEMA = { type: "string", minLength: 1, maxLength: 1024, pattern: "^[^\\u0000-\\u001F\\u007F-\\u009F]+$" };
|
|
29810
|
-
var entityAttributeName = external_exports.string().refine((
|
|
29810
|
+
var entityAttributeName = external_exports.string().refine((name4) => attributeStorageKey(name4) !== void 0, {
|
|
29811
29811
|
error: (issue2) => `${ENTITY_ATTRIBUTE_NAME_RULE}: ${JSON.stringify(shownKey(String(issue2.input)))}`
|
|
29812
29812
|
}).meta(ENTITY_ATTRIBUTE_NAME_JSON_SCHEMA);
|
|
29813
29813
|
var attributeKey = external_exports.string().regex(ATTRIBUTE_KEY_PATTERN, { error: (issue2) => attributeKeyError(String(issue2.input)) });
|
|
@@ -30998,12 +30998,12 @@ var ValidationError = class extends Error {
|
|
|
30998
30998
|
expected;
|
|
30999
30999
|
got;
|
|
31000
31000
|
path;
|
|
31001
|
-
constructor(expected, got,
|
|
31002
|
-
const message2 = `Validator error${
|
|
31001
|
+
constructor(expected, got, path9) {
|
|
31002
|
+
const message2 = `Validator error${path9 ? ` for ${path9}` : ""}: Expected \`${expected}\`, got \`${got}\``;
|
|
31003
31003
|
super(message2);
|
|
31004
31004
|
this.expected = expected;
|
|
31005
31005
|
this.got = got;
|
|
31006
|
-
this.path =
|
|
31006
|
+
this.path = path9;
|
|
31007
31007
|
this.name = "ValidationError";
|
|
31008
31008
|
}
|
|
31009
31009
|
};
|
|
@@ -31073,8 +31073,8 @@ function validate2(validator, value, opts) {
|
|
|
31073
31073
|
valid2 = false;
|
|
31074
31074
|
} else if (opts?.db) {
|
|
31075
31075
|
expected = `Id<${validator.tableName}>`;
|
|
31076
|
-
const
|
|
31077
|
-
if (!
|
|
31076
|
+
const id18 = opts.db.normalizeId(validator.tableName, value);
|
|
31077
|
+
if (!id18) {
|
|
31078
31078
|
valid2 = false;
|
|
31079
31079
|
}
|
|
31080
31080
|
}
|
|
@@ -31086,10 +31086,10 @@ function validate2(validator, value, opts) {
|
|
|
31086
31086
|
break;
|
|
31087
31087
|
}
|
|
31088
31088
|
for (const [index, v3] of value.entries()) {
|
|
31089
|
-
const
|
|
31089
|
+
const path9 = `${opts?._pathPrefix ?? ""}[${index}]`;
|
|
31090
31090
|
valid2 = validate2(validator.element, v3, {
|
|
31091
31091
|
...opts,
|
|
31092
|
-
_pathPrefix:
|
|
31092
|
+
_pathPrefix: path9
|
|
31093
31093
|
});
|
|
31094
31094
|
if (!valid2) {
|
|
31095
31095
|
expected = validator.element.kind;
|
|
@@ -31187,8 +31187,8 @@ function validate2(validator, value, opts) {
|
|
|
31187
31187
|
}
|
|
31188
31188
|
return valid2;
|
|
31189
31189
|
}
|
|
31190
|
-
function appendPath(opts,
|
|
31191
|
-
return opts?._pathPrefix ? `${opts._pathPrefix}.${
|
|
31190
|
+
function appendPath(opts, path9) {
|
|
31191
|
+
return opts?._pathPrefix ? `${opts._pathPrefix}.${path9}` : path9;
|
|
31192
31192
|
}
|
|
31193
31193
|
|
|
31194
31194
|
// ../packages/shared/src/operation-validation.ts
|
|
@@ -31391,8 +31391,8 @@ function parseOperationAttrs(operation, pairs) {
|
|
|
31391
31391
|
}
|
|
31392
31392
|
|
|
31393
31393
|
// ../packages/shared/src/operation-contract.ts
|
|
31394
|
-
function operationAliases(mapping,
|
|
31395
|
-
return Object.entries(mapping).filter(([, target2]) => target2 ===
|
|
31394
|
+
function operationAliases(mapping, name4, profile = "full") {
|
|
31395
|
+
return Object.entries(mapping).filter(([, target2]) => target2 === name4).map(([alias]) => ({ name: alias, profile }));
|
|
31396
31396
|
}
|
|
31397
31397
|
|
|
31398
31398
|
// ../packages/shared/src/operation-schema.ts
|
|
@@ -31439,9 +31439,9 @@ function operationResultSchema(validator) {
|
|
|
31439
31439
|
case "object": {
|
|
31440
31440
|
const properties = {};
|
|
31441
31441
|
const required2 = [];
|
|
31442
|
-
for (const [
|
|
31443
|
-
properties[
|
|
31444
|
-
if (field.isOptional !== "optional") required2.push(
|
|
31442
|
+
for (const [name4, field] of Object.entries(validator.fields)) {
|
|
31443
|
+
properties[name4] = operationResultSchema(field);
|
|
31444
|
+
if (field.isOptional !== "optional") required2.push(name4);
|
|
31445
31445
|
}
|
|
31446
31446
|
return { type: "object", properties, required: required2, additionalProperties: false };
|
|
31447
31447
|
}
|
|
@@ -31483,8 +31483,8 @@ var workspaceAliases = {
|
|
|
31483
31483
|
space_members_add: "addSpaceMember",
|
|
31484
31484
|
space_members_remove: "removeSpaceMember"
|
|
31485
31485
|
};
|
|
31486
|
-
function isWorkspaceOperationName(
|
|
31487
|
-
return Object.hasOwn(workspaceInputs,
|
|
31486
|
+
function isWorkspaceOperationName(name4) {
|
|
31487
|
+
return Object.hasOwn(workspaceInputs, name4);
|
|
31488
31488
|
}
|
|
31489
31489
|
function parseWorkspaceRequest(operation, raw) {
|
|
31490
31490
|
switch (operation) {
|
|
@@ -31521,38 +31521,38 @@ var descriptions = {
|
|
|
31521
31521
|
addSpaceMember: "Add an existing user by email with spaces:manage and current owner/admin authority. Existing membership is retained.",
|
|
31522
31522
|
removeSpaceMember: "Remove a member with spaces:manage and current owner/admin authority. Owner and active recording-agent protections apply."
|
|
31523
31523
|
};
|
|
31524
|
-
var workspaceCatalog = Object.keys(workspaceInputs).filter(isWorkspaceOperationName).map((
|
|
31525
|
-
const schema = external_exports.toJSONSchema(workspaceInputs[
|
|
31526
|
-
const resultSchema3 = operationResultSchema(workspaceResults[
|
|
31524
|
+
var workspaceCatalog = Object.keys(workspaceInputs).filter(isWorkspaceOperationName).map((name4) => {
|
|
31525
|
+
const schema = external_exports.toJSONSchema(workspaceInputs[name4], { io: "input" });
|
|
31526
|
+
const resultSchema3 = operationResultSchema(workspaceResults[name4]);
|
|
31527
31527
|
return {
|
|
31528
|
-
name:
|
|
31529
|
-
aliases: operationAliases(workspaceAliases,
|
|
31528
|
+
name: name4,
|
|
31529
|
+
aliases: operationAliases(workspaceAliases, name4),
|
|
31530
31530
|
actor: "agent",
|
|
31531
|
-
description: descriptions[
|
|
31532
|
-
inputSchema: { type: "object", properties: schema.properties ?? {}, required: schema.required ?? [], additionalProperties: false, ...
|
|
31531
|
+
description: descriptions[name4],
|
|
31532
|
+
inputSchema: { type: "object", properties: schema.properties ?? {}, required: schema.required ?? [], additionalProperties: false, ...name4 === "updateSpace" ? { anyOf: ["name", "color", "scope"].map((field) => ({ required: [field] })) } : {} },
|
|
31533
31533
|
resultSchema: resultSchema3,
|
|
31534
31534
|
errorSchema: operationErrorSchema,
|
|
31535
31535
|
outputSchema: { type: "object", properties: { data: resultSchema3 }, required: ["data"], additionalProperties: false },
|
|
31536
|
-
capability:
|
|
31537
|
-
requiredScopes:
|
|
31536
|
+
capability: name4 === "listSpaces" || name4 === "listSpaceMembers" ? "read" : "spaces:manage",
|
|
31537
|
+
requiredScopes: name4 === "listSpaces" || name4 === "listSpaceMembers" ? ["read"] : ["write", "spaces:manage"],
|
|
31538
31538
|
executionProfile: "full",
|
|
31539
31539
|
environment: "workspace",
|
|
31540
|
-
resultProjection:
|
|
31541
|
-
compatibilityProjections:
|
|
31542
|
-
availability: { hosted:
|
|
31543
|
-
compatibilityProfiles:
|
|
31544
|
-
"public-cli": { primary: false, transport: "public-jwt", memberListing: "verified-current-credential; unavailable-emails-omitted", footerMemberLimit: WORKSPACE_FOOTER_MEMBER_LIMIT, resultSchema:
|
|
31540
|
+
resultProjection: name4 === "listSpaces" ? "compact-space" : name4 === "updateSpace" ? "space-summary" : "full",
|
|
31541
|
+
compatibilityProjections: name4 === "listSpaces" ? { "legacy-external": "full-space-document-with-role-and-member-emails", "public-cli": "membership-and-space-documents" } : name4 === "updateSpace" ? { "legacy-external": "full-space-document", "public-cli": "full-space-document" } : name4 === "listSpaceMembers" ? { "public-cli": "membership-and-visible-user-documents" } : name4 === "createSpace" ? { "public-cli": "created-space-and-membership-ids" } : {},
|
|
31542
|
+
availability: { hosted: name4 === "listSpaces" || name4 === "listSpaceMembers", external: true, browserHuman: false, agentConnection: name4 !== "listSpaceMembers", executionProfiles: name4 === "addSpaceMember" || name4 === "removeSpaceMember" ? ["full"] : ["full", "public-cli"] },
|
|
31543
|
+
compatibilityProfiles: name4 === "addSpaceMember" || name4 === "removeSpaceMember" ? {} : {
|
|
31544
|
+
"public-cli": { primary: false, transport: "public-jwt", memberListing: "verified-current-credential; unavailable-emails-omitted", footerMemberLimit: WORKSPACE_FOOTER_MEMBER_LIMIT, resultSchema: name4 === "createSpace" ? resultSchema3 : external_exports.toJSONSchema(workspacePublicCliResults[name4]) }
|
|
31545
31545
|
},
|
|
31546
|
-
defaults:
|
|
31546
|
+
defaults: name4 === "createSpace" ? { color: "kale" } : {},
|
|
31547
31547
|
resourcePolicy: {
|
|
31548
|
-
selector:
|
|
31548
|
+
selector: name4 === "listSpaces" ? "accessible-spaces" : name4 === "createSpace" ? "inheriting-personal-agent" : "space",
|
|
31549
31549
|
authority: "live-principal-in-protected-transaction",
|
|
31550
31550
|
bounds: "fresh-authority-intersection-empty-stays-empty"
|
|
31551
31551
|
}
|
|
31552
31552
|
};
|
|
31553
31553
|
});
|
|
31554
|
-
function parseWorkspaceResult(
|
|
31555
|
-
return parseOperationResult(
|
|
31554
|
+
function parseWorkspaceResult(name4, raw) {
|
|
31555
|
+
return parseOperationResult(name4, workspaceResults[name4], raw);
|
|
31556
31556
|
}
|
|
31557
31557
|
|
|
31558
31558
|
// ../packages/shared/src/agent-context-payloads.ts
|
|
@@ -31618,12 +31618,12 @@ function createApi2(pathParts = []) {
|
|
|
31618
31618
|
`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${found}\``
|
|
31619
31619
|
);
|
|
31620
31620
|
}
|
|
31621
|
-
const
|
|
31621
|
+
const path9 = pathParts.slice(0, -1).join("/");
|
|
31622
31622
|
const exportName = pathParts[pathParts.length - 1];
|
|
31623
31623
|
if (exportName === "default") {
|
|
31624
|
-
return
|
|
31624
|
+
return path9;
|
|
31625
31625
|
} else {
|
|
31626
|
-
return
|
|
31626
|
+
return path9 + ":" + exportName;
|
|
31627
31627
|
}
|
|
31628
31628
|
} else if (prop === Symbol.toStringTag) {
|
|
31629
31629
|
return "FunctionReference";
|
|
@@ -31686,52 +31686,52 @@ var TableDefinition = class {
|
|
|
31686
31686
|
" indexes"() {
|
|
31687
31687
|
return this.indexes;
|
|
31688
31688
|
}
|
|
31689
|
-
index(
|
|
31689
|
+
index(name4, indexConfig) {
|
|
31690
31690
|
if (Array.isArray(indexConfig)) {
|
|
31691
31691
|
this.indexes.push({
|
|
31692
|
-
indexDescriptor:
|
|
31692
|
+
indexDescriptor: name4,
|
|
31693
31693
|
fields: indexConfig
|
|
31694
31694
|
});
|
|
31695
31695
|
} else if (indexConfig.staged) {
|
|
31696
31696
|
this.stagedDbIndexes.push({
|
|
31697
|
-
indexDescriptor:
|
|
31697
|
+
indexDescriptor: name4,
|
|
31698
31698
|
fields: indexConfig.fields
|
|
31699
31699
|
});
|
|
31700
31700
|
} else {
|
|
31701
31701
|
this.indexes.push({
|
|
31702
|
-
indexDescriptor:
|
|
31702
|
+
indexDescriptor: name4,
|
|
31703
31703
|
fields: indexConfig.fields
|
|
31704
31704
|
});
|
|
31705
31705
|
}
|
|
31706
31706
|
return this;
|
|
31707
31707
|
}
|
|
31708
|
-
searchIndex(
|
|
31708
|
+
searchIndex(name4, indexConfig) {
|
|
31709
31709
|
if (indexConfig.staged) {
|
|
31710
31710
|
this.stagedSearchIndexes.push({
|
|
31711
|
-
indexDescriptor:
|
|
31711
|
+
indexDescriptor: name4,
|
|
31712
31712
|
searchField: indexConfig.searchField,
|
|
31713
31713
|
filterFields: indexConfig.filterFields || []
|
|
31714
31714
|
});
|
|
31715
31715
|
} else {
|
|
31716
31716
|
this.searchIndexes.push({
|
|
31717
|
-
indexDescriptor:
|
|
31717
|
+
indexDescriptor: name4,
|
|
31718
31718
|
searchField: indexConfig.searchField,
|
|
31719
31719
|
filterFields: indexConfig.filterFields || []
|
|
31720
31720
|
});
|
|
31721
31721
|
}
|
|
31722
31722
|
return this;
|
|
31723
31723
|
}
|
|
31724
|
-
vectorIndex(
|
|
31724
|
+
vectorIndex(name4, indexConfig) {
|
|
31725
31725
|
if (indexConfig.staged) {
|
|
31726
31726
|
this.stagedVectorIndexes.push({
|
|
31727
|
-
indexDescriptor:
|
|
31727
|
+
indexDescriptor: name4,
|
|
31728
31728
|
vectorField: indexConfig.vectorField,
|
|
31729
31729
|
dimensions: indexConfig.dimensions,
|
|
31730
31730
|
filterFields: indexConfig.filterFields || []
|
|
31731
31731
|
});
|
|
31732
31732
|
} else {
|
|
31733
31733
|
this.vectorIndexes.push({
|
|
31734
|
-
indexDescriptor:
|
|
31734
|
+
indexDescriptor: name4,
|
|
31735
31735
|
vectorField: indexConfig.vectorField,
|
|
31736
31736
|
dimensions: indexConfig.dimensions,
|
|
31737
31737
|
filterFields: indexConfig.filterFields || []
|
|
@@ -31904,7 +31904,7 @@ var SchemaDefinition = class {
|
|
|
31904
31904
|
*/
|
|
31905
31905
|
export() {
|
|
31906
31906
|
return JSON.stringify({
|
|
31907
|
-
tables: Object.entries(this.tables).map(([tableName,
|
|
31907
|
+
tables: Object.entries(this.tables).map(([tableName, definition4]) => {
|
|
31908
31908
|
const {
|
|
31909
31909
|
indexes,
|
|
31910
31910
|
stagedDbIndexes,
|
|
@@ -31914,7 +31914,7 @@ var SchemaDefinition = class {
|
|
|
31914
31914
|
stagedVectorIndexes,
|
|
31915
31915
|
documentType,
|
|
31916
31916
|
stagedDocumentType
|
|
31917
|
-
} =
|
|
31917
|
+
} = definition4.export();
|
|
31918
31918
|
return {
|
|
31919
31919
|
tableName,
|
|
31920
31920
|
indexes,
|
|
@@ -32194,17 +32194,17 @@ var browserToolErrorSchema = {
|
|
|
32194
32194
|
function browserFormattedErrorSchema(operation) {
|
|
32195
32195
|
const selector3 = operation === void 0 ? { type: "string" } : { const: operation };
|
|
32196
32196
|
const canonical = operation?.startsWith("ente_") ? operation.slice(5) : operation;
|
|
32197
|
-
const observationFailures = ["agent_config_update", "agent_schedules_configure"].filter((
|
|
32197
|
+
const observationFailures = ["agent_config_update", "agent_schedules_configure"].filter((name4) => canonical === void 0 || canonical === name4).map((name4) => ({
|
|
32198
32198
|
type: "object",
|
|
32199
32199
|
properties: {
|
|
32200
32200
|
code: { const: "INTERNAL_ERROR" },
|
|
32201
32201
|
canonicalCode: operationErrorSchema.properties.code,
|
|
32202
|
-
operation: { const:
|
|
32202
|
+
operation: { const: name4 },
|
|
32203
32203
|
message: { type: "string" },
|
|
32204
32204
|
phase: { const: "postcommit-observation" },
|
|
32205
32205
|
receipt: {
|
|
32206
32206
|
type: "object",
|
|
32207
|
-
properties: { operation: { const:
|
|
32207
|
+
properties: { operation: { const: name4 }, data: operationResultSchema(agentConfigCommitValidator) },
|
|
32208
32208
|
required: ["operation", "data"],
|
|
32209
32209
|
additionalProperties: false
|
|
32210
32210
|
}
|
|
@@ -32920,11 +32920,7 @@ var entityReadFields = {
|
|
|
32920
32920
|
customIconColor: external_exports.enum(customIconColorIds).optional(),
|
|
32921
32921
|
exclusiveParent: external_exports.boolean().optional(),
|
|
32922
32922
|
descriptionPlainText: external_exports.string().optional(),
|
|
32923
|
-
fields: external_exports.array(externalFieldValueSchema)
|
|
32924
|
-
attributes: external_exports.record(external_exports.string(), external_exports.json()).optional(),
|
|
32925
|
-
attributeEncodedKeys: external_exports.array(external_exports.string()).optional(),
|
|
32926
|
-
attributeLabels: external_exports.record(external_exports.string(), external_exports.string()).optional(),
|
|
32927
|
-
entityFieldsPhase: external_exports.enum(["legacy", "planning", "bridge"]).optional(),
|
|
32923
|
+
fields: external_exports.array(externalFieldValueSchema),
|
|
32928
32924
|
tags: external_exports.array(external_exports.string()).optional(),
|
|
32929
32925
|
aliases: external_exports.array(external_exports.string()).optional(),
|
|
32930
32926
|
createdBy: id7,
|
|
@@ -32933,18 +32929,7 @@ var entityReadFields = {
|
|
|
32933
32929
|
archived: external_exports.boolean(),
|
|
32934
32930
|
deletedAt: external_exports.number().optional()
|
|
32935
32931
|
};
|
|
32936
|
-
|
|
32937
|
-
return schema.superRefine((raw, ctx) => {
|
|
32938
|
-
const value = raw;
|
|
32939
|
-
const transitional = value.entityFieldsPhase !== void 0;
|
|
32940
|
-
if (transitional ? value.attributes === void 0 || value.fields !== void 0 : value.fields === void 0 || value.attributes !== void 0)
|
|
32941
|
-
ctx.addIssue({ code: "custom", message: "Entity read shape does not match its migration phase" });
|
|
32942
|
-
}).meta({ anyOf: [
|
|
32943
|
-
{ type: "object", required: ["fields"], properties: { fields: { type: "array" }, attributes: { not: {} }, entityFieldsPhase: { not: {} } }, additionalProperties: true },
|
|
32944
|
-
{ type: "object", required: ["attributes", "entityFieldsPhase"], properties: { attributes: { type: "object" }, entityFieldsPhase: { type: "string", enum: ["legacy", "planning", "bridge"] }, fields: { not: {} } }, additionalProperties: true }
|
|
32945
|
-
] });
|
|
32946
|
-
}
|
|
32947
|
-
var publicEntityReadDto = withEntityReadPhase(external_exports.strictObject(entityReadFields));
|
|
32932
|
+
var publicEntityReadDto = external_exports.strictObject(entityReadFields);
|
|
32948
32933
|
var activityReadFields = {
|
|
32949
32934
|
_id: id7,
|
|
32950
32935
|
title: external_exports.string().optional(),
|
|
@@ -32967,13 +32952,13 @@ var activityReadFields = {
|
|
|
32967
32952
|
attachments: external_exports.array(external_exports.strictObject({ storageId: id7, name: external_exports.string(), mimeType: external_exports.string(), sizeBytes: external_exports.number().optional() })).optional()
|
|
32968
32953
|
};
|
|
32969
32954
|
var publicActivityReadDto = external_exports.strictObject(activityReadFields);
|
|
32970
|
-
var selectPublicEntityRead =
|
|
32955
|
+
var selectPublicEntityRead = external_exports.object(entityReadFields);
|
|
32971
32956
|
var selectPublicActivityRead = external_exports.object(activityReadFields);
|
|
32972
32957
|
|
|
32973
32958
|
// ../packages/shared/src/entity-read-operation-results.ts
|
|
32974
32959
|
var id8 = external_exports.string().min(1);
|
|
32975
32960
|
var entityReadDocument = publicEntityReadDto;
|
|
32976
|
-
var entityReadRichDocument =
|
|
32961
|
+
var entityReadRichDocument = external_exports.strictObject({ ...publicEntityReadDto.shape, displayName: external_exports.string(), parentNames: external_exports.array(external_exports.string()), parentDetails: external_exports.array(readParentDetail) });
|
|
32977
32962
|
var entityReadActivity = publicActivityReadDto;
|
|
32978
32963
|
var parentDetail = readParentDetail;
|
|
32979
32964
|
var space = external_exports.strictObject({ spaceId: id8, spaceName: external_exports.string(), memberEmails: external_exports.array(external_exports.string()), scope: external_exports.string().optional() });
|
|
@@ -32987,10 +32972,10 @@ var entityReadFullSearch = external_exports.strictObject({ entities: external_ex
|
|
|
32987
32972
|
var entityReadFullDetail = external_exports.strictObject({ entity: entityReadRichDocument, pins: external_exports.array(pin), children: external_exports.array(child), childrenTruncated: external_exports.boolean(), aggregationMode: external_exports.enum(["includeDirectChildren", "directOnly"]), activities: external_exports.array(entityReadActivity), openTasks: external_exports.array(task), spaces: external_exports.array(space), descriptionPlainText: external_exports.string().optional() }).nullable();
|
|
32988
32973
|
var selectSpace = external_exports.object(space.shape);
|
|
32989
32974
|
var selectList = external_exports.object({ ...entityReadFullList.shape, entities: external_exports.array(external_exports.object({ entity: selectPublicEntityRead, ...matchFields })), spaces: external_exports.record(external_exports.string(), selectSpace) });
|
|
32990
|
-
var selectRichEntity =
|
|
32975
|
+
var selectRichEntity = external_exports.object({ ...selectPublicEntityRead.shape, displayName: external_exports.string(), parentNames: external_exports.array(external_exports.string()), parentDetails: external_exports.array(readParentDetail) });
|
|
32991
32976
|
var selectSearch = external_exports.object({ ...entityReadFullSearch.shape, entities: external_exports.array(external_exports.object({ entity: selectRichEntity, ...matchFields, pins: external_exports.array(pin), matchedViaParent: external_exports.strictObject({ entityId: id8, name: external_exports.string() }).optional() })), spaces: external_exports.record(external_exports.string(), selectSpace) });
|
|
32992
32977
|
var selectDetail = external_exports.object({ ...entityReadFullDetail.unwrap().shape, entity: selectRichEntity, activities: external_exports.array(selectPublicActivityRead), spaces: external_exports.array(selectSpace) }).nullable();
|
|
32993
|
-
var compactEntity =
|
|
32978
|
+
var compactEntity = external_exports.strictObject(entityReadRichDocument.shape).pick({ _id: true, name: true, displayName: true, parentNames: true, parentDetails: true, type: true, descriptionPlainText: true, tags: true, aliases: true, lastActivityAt: true, fields: true }).partial({ displayName: true, parentNames: true, parentDetails: true });
|
|
32994
32979
|
var compactActivity = entityReadActivity.pick({ _id: true, shortId: true, title: true, type: true, contentPlainText: true, deadline: true, completed: true, tags: true, createdAt: true, updatedAt: true, spaceId: true });
|
|
32995
32980
|
var compactList = entityReadFullList.extend({ entities: external_exports.array(external_exports.strictObject({ entity: compactEntity, ...matchFields })), spaces: external_exports.record(external_exports.string(), compactSpace) });
|
|
32996
32981
|
var compactSearch = entityReadFullSearch.extend({ entities: external_exports.array(external_exports.strictObject({ entity: compactEntity, ...matchFields, pins: external_exports.array(pin), matchedViaParent: external_exports.strictObject({ entityId: id8, name: external_exports.string() }).optional() })), spaces: external_exports.record(external_exports.string(), compactSpace) });
|
|
@@ -33049,14 +33034,14 @@ function isEntityType(value) {
|
|
|
33049
33034
|
return typeof value === "string" && ENTITY_TYPE_VALUES.some((type) => type === value);
|
|
33050
33035
|
}
|
|
33051
33036
|
var invalid = (message2) => ({ ok: false, message: message2 });
|
|
33052
|
-
function parseEntityCreateInput(args,
|
|
33037
|
+
function parseEntityCreateInput(args, name4 = "entities_create") {
|
|
33053
33038
|
if (Object.hasOwn(args, "attributes")) return invalid(LEGACY_ENTITY_ATTRIBUTES_ERROR);
|
|
33054
33039
|
if (args.parentEntityId !== void 0 && (typeof args.parentEntityId !== "string" || !args.parentEntityId.trim()))
|
|
33055
33040
|
return invalid("parentEntityId must be a non-empty string");
|
|
33056
33041
|
if (args.exclusiveParent !== void 0 && typeof args.exclusiveParent !== "boolean") return invalid("exclusiveParent must be a boolean");
|
|
33057
33042
|
if (args.exclusiveParent === true && args.parentEntityId === void 0) return invalid("exclusiveParent requires parentEntityId");
|
|
33058
|
-
if (typeof args.name !== "string" || !args.name.trim()) return invalid(`${
|
|
33059
|
-
if (args.type !== void 0 && !isEntityType(args.type)) return invalid(`${
|
|
33043
|
+
if (typeof args.name !== "string" || !args.name.trim()) return invalid(`${name4} requires non-empty string name`);
|
|
33044
|
+
if (args.type !== void 0 && !isEntityType(args.type)) return invalid(`${name4} type must be one of: ${ENTITY_TYPE_VALUES.join(", ")}`);
|
|
33060
33045
|
const tags = optionalStringArray(args.tags), aliases = optionalStringArray(args.aliases);
|
|
33061
33046
|
const description = typeof args.description === "string" ? args.description : void 0;
|
|
33062
33047
|
const fieldResult = fieldInputSchema.array().safeParse(args.fields);
|
|
@@ -33076,9 +33061,9 @@ function parseEntityCreateInput(args, name3 = "entities_create") {
|
|
|
33076
33061
|
...spaceIds?.length ? { spaceIds } : {}
|
|
33077
33062
|
} };
|
|
33078
33063
|
}
|
|
33079
|
-
function parseEntityUpdateInput(args,
|
|
33064
|
+
function parseEntityUpdateInput(args, name4 = "entities_update") {
|
|
33080
33065
|
if (Object.hasOwn(args, "attributes")) return invalid(LEGACY_ENTITY_ATTRIBUTES_ERROR);
|
|
33081
|
-
if (typeof args.entityId !== "string") return invalid(`${
|
|
33066
|
+
if (typeof args.entityId !== "string") return invalid(`${name4} requires string entityId`);
|
|
33082
33067
|
const tags = optionalStringArray(args.tags), aliases = optionalStringArray(args.aliases);
|
|
33083
33068
|
const fieldResult = fieldInputSchema.array().safeParse(args.fields);
|
|
33084
33069
|
if (args.fields !== void 0 && !fieldResult.success) return invalid("fields must contain label, optional type, and value");
|
|
@@ -33260,11 +33245,11 @@ var activityReadResults = {
|
|
|
33260
33245
|
searchActivities: external_exports.discriminatedUnion("projection", [external_exports.strictObject({ activities: external_exports.array(publicActivityRecordDto), projection: external_exports.literal("full") }), external_exports.strictObject({ activities: external_exports.array(compactActivity2), projection: external_exports.literal("compact") })]),
|
|
33261
33246
|
listRecentActivities: pages
|
|
33262
33247
|
};
|
|
33263
|
-
function parseActivityReadResult(
|
|
33248
|
+
function parseActivityReadResult(name4, raw) {
|
|
33264
33249
|
try {
|
|
33265
|
-
return checked3(activityReadResults[
|
|
33250
|
+
return checked3(activityReadResults[name4], raw);
|
|
33266
33251
|
} catch (error62) {
|
|
33267
|
-
if (error62 instanceof OperationResultError) throw new OperationResultError(
|
|
33252
|
+
if (error62 instanceof OperationResultError) throw new OperationResultError(name4);
|
|
33268
33253
|
throw error62;
|
|
33269
33254
|
}
|
|
33270
33255
|
}
|
|
@@ -33739,16 +33724,16 @@ var descriptions2 = {
|
|
|
33739
33724
|
replaceAgendaPointContent: "Replace point content when expectedContentVersion still matches. Echo the version or null from getMeetingAgenda. A conflict preserves the human edit.",
|
|
33740
33725
|
searchMeetingTasks: "Search existing tasks in the activity's actual space for an explicit agenda task-linking request."
|
|
33741
33726
|
};
|
|
33742
|
-
function isAgendaOperationName(
|
|
33743
|
-
return Object.hasOwn(agendaInputs,
|
|
33727
|
+
function isAgendaOperationName(name4) {
|
|
33728
|
+
return Object.hasOwn(agendaInputs, name4);
|
|
33744
33729
|
}
|
|
33745
|
-
function buildAgendaDefinition(
|
|
33746
|
-
const schema = external_exports.toJSONSchema(agendaInputs[
|
|
33730
|
+
function buildAgendaDefinition(name4) {
|
|
33731
|
+
const schema = external_exports.toJSONSchema(agendaInputs[name4], { io: "input" });
|
|
33747
33732
|
return {
|
|
33748
|
-
name:
|
|
33749
|
-
aliases: operationAliases(agendaAliases,
|
|
33733
|
+
name: name4,
|
|
33734
|
+
aliases: operationAliases(agendaAliases, name4),
|
|
33750
33735
|
actor: "agent",
|
|
33751
|
-
description: descriptions2[
|
|
33736
|
+
description: descriptions2[name4],
|
|
33752
33737
|
inputSchema: {
|
|
33753
33738
|
type: "object",
|
|
33754
33739
|
properties: schema.properties ?? {},
|
|
@@ -33756,23 +33741,23 @@ function buildAgendaDefinition(name3) {
|
|
|
33756
33741
|
additionalProperties: false
|
|
33757
33742
|
},
|
|
33758
33743
|
errorSchema: operationErrorSchema,
|
|
33759
|
-
resultSchema: operationResultSchema(agendaResults[
|
|
33760
|
-
outputSchema: { type: "object", properties: { data: operationResultSchema(agendaResults[
|
|
33761
|
-
capability:
|
|
33744
|
+
resultSchema: operationResultSchema(agendaResults[name4]),
|
|
33745
|
+
outputSchema: { type: "object", properties: { data: operationResultSchema(agendaResults[name4]) }, required: ["data"], additionalProperties: false },
|
|
33746
|
+
capability: name4 === "getMeetingAgenda" || name4 === "searchMeetingTasks" ? "read" : "write",
|
|
33762
33747
|
executionProfile: "full",
|
|
33763
|
-
resultProjection:
|
|
33748
|
+
resultProjection: name4 === "searchMeetingTasks" ? "task-summary" : name4 === "getMeetingAgenda" ? "agenda-snapshot" : "full",
|
|
33764
33749
|
environment: "content",
|
|
33765
33750
|
availability: { hosted: true, external: true, browserHuman: false, agentConnection: false, executionProfiles: ["full", "meeting-realtime"] },
|
|
33766
33751
|
resourcePolicy: {
|
|
33767
|
-
selector: Object.hasOwn(agendaInputs[
|
|
33752
|
+
selector: Object.hasOwn(agendaInputs[name4].shape, "meetingActivityId") ? "activity" : "agenda-point",
|
|
33768
33753
|
space: "actual-activity-space",
|
|
33769
33754
|
enforcement: "live-principal-in-protected-transaction",
|
|
33770
33755
|
providerEmailAgenda: "read-only"
|
|
33771
33756
|
},
|
|
33772
|
-
limits:
|
|
33757
|
+
limits: name4 === "searchMeetingTasks" ? { results: AGENDA_TASK_RESULT_LIMIT, ownersPerTask: AGENDA_TASK_OWNER_LIMIT } : null
|
|
33773
33758
|
};
|
|
33774
33759
|
}
|
|
33775
|
-
var definitions = new Map(Object.keys(agendaInputs).filter(isAgendaOperationName).map((
|
|
33760
|
+
var definitions = new Map(Object.keys(agendaInputs).filter(isAgendaOperationName).map((name4) => [name4, buildAgendaDefinition(name4)]));
|
|
33776
33761
|
var agendaCatalog = [...definitions.values()];
|
|
33777
33762
|
|
|
33778
33763
|
// core/transport.ts
|
|
@@ -33787,55 +33772,55 @@ var RestClient = class {
|
|
|
33787
33772
|
this.apiKey = opts.apiKey;
|
|
33788
33773
|
this.timeoutMs = opts.timeoutMs ?? 15e3;
|
|
33789
33774
|
}
|
|
33790
|
-
get(
|
|
33791
|
-
return this.request("GET",
|
|
33775
|
+
get(path9, params, opts) {
|
|
33776
|
+
return this.request("GET", path9, void 0, params, opts);
|
|
33792
33777
|
}
|
|
33793
|
-
post(
|
|
33794
|
-
return this.request("POST",
|
|
33778
|
+
post(path9, body, params, opts) {
|
|
33779
|
+
return this.request("POST", path9, body, params, opts);
|
|
33795
33780
|
}
|
|
33796
|
-
patch(
|
|
33797
|
-
return this.request("PATCH",
|
|
33781
|
+
patch(path9, body, params, opts) {
|
|
33782
|
+
return this.request("PATCH", path9, body, params, opts);
|
|
33798
33783
|
}
|
|
33799
|
-
put(
|
|
33800
|
-
return this.request("PUT",
|
|
33784
|
+
put(path9, body, params, opts) {
|
|
33785
|
+
return this.request("PUT", path9, body, params, opts);
|
|
33801
33786
|
}
|
|
33802
|
-
delete(
|
|
33803
|
-
return this.request("DELETE",
|
|
33787
|
+
delete(path9, params, opts) {
|
|
33788
|
+
return this.request("DELETE", path9, void 0, params, opts);
|
|
33804
33789
|
}
|
|
33805
33790
|
/**
|
|
33806
33791
|
* POST raw bytes with an explicit Content-Type (not JSON). Used for binary
|
|
33807
33792
|
* uploads where the request body is the file itself, not a JSON envelope.
|
|
33808
33793
|
*/
|
|
33809
|
-
postRaw(
|
|
33810
|
-
return this.request("POST",
|
|
33794
|
+
postRaw(path9, bytes2, contentType, params, opts) {
|
|
33795
|
+
return this.request("POST", path9, void 0, params, opts, { bytes: bytes2, contentType });
|
|
33811
33796
|
}
|
|
33812
33797
|
/**
|
|
33813
33798
|
* GET a raw byte body, aborting once it exceeds `maxBytes`. Errors still
|
|
33814
33799
|
* parse the structured JSON error envelope.
|
|
33815
33800
|
*/
|
|
33816
|
-
async getBytes(
|
|
33801
|
+
async getBytes(path9, params, opts) {
|
|
33817
33802
|
const timeoutMs = opts.timeoutMs ?? this.timeoutMs;
|
|
33818
33803
|
const controller = new AbortController();
|
|
33819
33804
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
33820
33805
|
try {
|
|
33821
33806
|
let resp;
|
|
33822
33807
|
try {
|
|
33823
|
-
resp = await fetch(this.buildUrl(
|
|
33808
|
+
resp = await fetch(this.buildUrl(path9, params), {
|
|
33824
33809
|
method: "GET",
|
|
33825
33810
|
headers: { Authorization: `Bearer ${this.apiKey}`, ...opts.headers },
|
|
33826
33811
|
signal: controller.signal
|
|
33827
33812
|
});
|
|
33828
33813
|
} catch (err) {
|
|
33829
33814
|
if (err instanceof Error && err.name === "AbortError") {
|
|
33830
|
-
throw new Error(`Request to ${
|
|
33815
|
+
throw new Error(`Request to ${path9} timed out after ${timeoutMs}ms.`);
|
|
33831
33816
|
}
|
|
33832
|
-
throw new Error(`Could not reach the ente API (${
|
|
33817
|
+
throw new Error(`Could not reach the ente API (${path9}): ${String(err)}`);
|
|
33833
33818
|
}
|
|
33834
33819
|
const bodyLimit = resp.status >= 400 ? 64 * 1024 : opts.maxBytes;
|
|
33835
33820
|
const declared = Number(resp.headers.get("Content-Length") ?? "0");
|
|
33836
33821
|
if (declared > bodyLimit) {
|
|
33837
33822
|
await resp.body?.cancel();
|
|
33838
|
-
throw new Error(`Response from ${
|
|
33823
|
+
throw new Error(`Response from ${path9} exceeds ${bodyLimit} bytes.`);
|
|
33839
33824
|
}
|
|
33840
33825
|
const chunks = [];
|
|
33841
33826
|
let total = 0;
|
|
@@ -33847,7 +33832,7 @@ var RestClient = class {
|
|
|
33847
33832
|
total += value.byteLength;
|
|
33848
33833
|
if (total > bodyLimit) {
|
|
33849
33834
|
await reader.cancel();
|
|
33850
|
-
throw new Error(`Response from ${
|
|
33835
|
+
throw new Error(`Response from ${path9} exceeds ${bodyLimit} bytes.`);
|
|
33851
33836
|
}
|
|
33852
33837
|
chunks.push(value);
|
|
33853
33838
|
}
|
|
@@ -33864,15 +33849,15 @@ var RestClient = class {
|
|
|
33864
33849
|
return { bytes: bytes2, headers: resp.headers };
|
|
33865
33850
|
} catch (err) {
|
|
33866
33851
|
if (err instanceof Error && err.name === "AbortError") {
|
|
33867
|
-
throw new Error(`Request to ${
|
|
33852
|
+
throw new Error(`Request to ${path9} timed out after ${timeoutMs}ms.`);
|
|
33868
33853
|
}
|
|
33869
33854
|
throw err;
|
|
33870
33855
|
} finally {
|
|
33871
33856
|
clearTimeout(timer);
|
|
33872
33857
|
}
|
|
33873
33858
|
}
|
|
33874
|
-
buildUrl(
|
|
33875
|
-
const url2 = new URL(this.baseUrl +
|
|
33859
|
+
buildUrl(path9, params) {
|
|
33860
|
+
const url2 = new URL(this.baseUrl + path9);
|
|
33876
33861
|
if (params) {
|
|
33877
33862
|
for (const [k, v3] of Object.entries(params)) {
|
|
33878
33863
|
if (v3 !== void 0) url2.searchParams.set(k, v3);
|
|
@@ -33880,13 +33865,13 @@ var RestClient = class {
|
|
|
33880
33865
|
}
|
|
33881
33866
|
return url2.toString();
|
|
33882
33867
|
}
|
|
33883
|
-
async request(method,
|
|
33868
|
+
async request(method, path9, body, params, opts, raw) {
|
|
33884
33869
|
const timeoutMs = opts?.timeoutMs ?? this.timeoutMs;
|
|
33885
33870
|
const controller = new AbortController();
|
|
33886
33871
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
33887
33872
|
let resp;
|
|
33888
33873
|
try {
|
|
33889
|
-
resp = await fetch(this.buildUrl(
|
|
33874
|
+
resp = await fetch(this.buildUrl(path9, params), {
|
|
33890
33875
|
method,
|
|
33891
33876
|
headers: {
|
|
33892
33877
|
Authorization: `Bearer ${this.apiKey}`,
|
|
@@ -33904,9 +33889,9 @@ var RestClient = class {
|
|
|
33904
33889
|
} catch (err) {
|
|
33905
33890
|
clearTimeout(timer);
|
|
33906
33891
|
if (err instanceof Error && err.name === "AbortError") {
|
|
33907
|
-
throw new Error(`Request to ${
|
|
33892
|
+
throw new Error(`Request to ${path9} timed out after ${timeoutMs}ms.`);
|
|
33908
33893
|
}
|
|
33909
|
-
throw new Error(`Could not reach the ente API (${
|
|
33894
|
+
throw new Error(`Could not reach the ente API (${path9}): ${String(err)}`);
|
|
33910
33895
|
}
|
|
33911
33896
|
clearTimeout(timer);
|
|
33912
33897
|
const text2 = await resp.text();
|
|
@@ -33991,18 +33976,18 @@ var EnteClient = class _EnteClient {
|
|
|
33991
33976
|
createEntity(body) {
|
|
33992
33977
|
return this.rest.post("/api/external/entities", body);
|
|
33993
33978
|
}
|
|
33994
|
-
updateEntity(
|
|
33995
|
-
const input2 = parseEntityWriteRequest("updateEntity", body !== null && typeof body === "object" && !Array.isArray(body) ? { ...body, entityId:
|
|
33979
|
+
updateEntity(id18, body) {
|
|
33980
|
+
const input2 = parseEntityWriteRequest("updateEntity", body !== null && typeof body === "object" && !Array.isArray(body) ? { ...body, entityId: id18 } : body).input;
|
|
33996
33981
|
return this.rest.patch("/api/external/entities", input2);
|
|
33997
33982
|
}
|
|
33998
|
-
archiveEntity(
|
|
33999
|
-
return this.rest.delete("/api/external/entities", { id:
|
|
33983
|
+
archiveEntity(id18) {
|
|
33984
|
+
return this.rest.delete("/api/external/entities", { id: id18 });
|
|
34000
33985
|
}
|
|
34001
|
-
restoreEntity(
|
|
34002
|
-
return this.rest.post("/api/external/entities/restore", void 0, { id:
|
|
33986
|
+
restoreEntity(id18) {
|
|
33987
|
+
return this.rest.post("/api/external/entities/restore", void 0, { id: id18 });
|
|
34003
33988
|
}
|
|
34004
|
-
removeFromSpace(entityId2,
|
|
34005
|
-
return this.rest.delete("/api/external/entity-spaces", { entityId: entityId2, spaceId });
|
|
33989
|
+
removeFromSpace(entityId2, spaceId2) {
|
|
33990
|
+
return this.rest.delete("/api/external/entity-spaces", { entityId: entityId2, spaceId: spaceId2 });
|
|
34006
33991
|
}
|
|
34007
33992
|
/** Spaces map (id → {spaceName, memberEmails}) via a minimal entities call. */
|
|
34008
33993
|
async listSpaces() {
|
|
@@ -34018,25 +34003,25 @@ var EnteClient = class _EnteClient {
|
|
|
34018
34003
|
createSpace(body) {
|
|
34019
34004
|
return this.workspaceOperation("createSpace", { ...body, color: body.color ?? "kale" });
|
|
34020
34005
|
}
|
|
34021
|
-
async renameSpace(
|
|
34022
|
-
const request = parseWorkspaceRequest("updateSpace", { spaceId, name:
|
|
34006
|
+
async renameSpace(spaceId2, name4) {
|
|
34007
|
+
const request = parseWorkspaceRequest("updateSpace", { spaceId: spaceId2, name: name4 });
|
|
34023
34008
|
const result = legacyWorkspaceWireResults.updateSpace.safeParse(await this.operationData("spaces_rename", request.input));
|
|
34024
34009
|
if (!result.success) throw new OperationResultError("updateSpace");
|
|
34025
34010
|
return { data: result.data };
|
|
34026
34011
|
}
|
|
34027
34012
|
// --- pins ---------------------------------------------------------------
|
|
34028
|
-
createPin(sourceEntityId, targetEntityId,
|
|
34013
|
+
createPin(sourceEntityId, targetEntityId, spaceId2) {
|
|
34029
34014
|
return this.rest.post("/api/external/pins", {
|
|
34030
34015
|
sourceEntityId,
|
|
34031
34016
|
targetEntityId,
|
|
34032
|
-
...
|
|
34017
|
+
...spaceId2 ? { spaceId: spaceId2 } : {}
|
|
34033
34018
|
});
|
|
34034
34019
|
}
|
|
34035
|
-
deletePin(sourceEntityId, targetEntityId,
|
|
34020
|
+
deletePin(sourceEntityId, targetEntityId, spaceId2) {
|
|
34036
34021
|
return this.rest.delete("/api/external/pins", {
|
|
34037
34022
|
sourceEntityId,
|
|
34038
34023
|
targetEntityId,
|
|
34039
|
-
...
|
|
34024
|
+
...spaceId2 ? { spaceId: spaceId2 } : {}
|
|
34040
34025
|
});
|
|
34041
34026
|
}
|
|
34042
34027
|
listPins(entityId2) {
|
|
@@ -34046,20 +34031,20 @@ var EnteClient = class _EnteClient {
|
|
|
34046
34031
|
listActivities(params) {
|
|
34047
34032
|
return this.rest.get("/api/external/activities", params);
|
|
34048
34033
|
}
|
|
34049
|
-
getActivity(
|
|
34050
|
-
return this.rest.get("/api/external/activity", { id:
|
|
34034
|
+
getActivity(id18) {
|
|
34035
|
+
return this.rest.get("/api/external/activity", { id: id18 });
|
|
34051
34036
|
}
|
|
34052
34037
|
createActivity(body) {
|
|
34053
34038
|
return this.rest.post("/api/external/activities", body);
|
|
34054
34039
|
}
|
|
34055
|
-
updateActivity(
|
|
34056
|
-
return this.rest.patch("/api/external/activities", body, { id:
|
|
34040
|
+
updateActivity(id18, body) {
|
|
34041
|
+
return this.rest.patch("/api/external/activities", body, { id: id18 });
|
|
34057
34042
|
}
|
|
34058
|
-
deleteActivity(
|
|
34059
|
-
return this.rest.delete("/api/external/activities", { id:
|
|
34043
|
+
deleteActivity(id18) {
|
|
34044
|
+
return this.rest.delete("/api/external/activities", { id: id18 });
|
|
34060
34045
|
}
|
|
34061
|
-
restoreActivity(
|
|
34062
|
-
return this.rest.post("/api/external/activities/restore", void 0, { id:
|
|
34046
|
+
restoreActivity(id18) {
|
|
34047
|
+
return this.rest.post("/api/external/activities/restore", void 0, { id: id18 });
|
|
34063
34048
|
}
|
|
34064
34049
|
searchActivities(params) {
|
|
34065
34050
|
return this.rest.get("/api/external/activities/search", params);
|
|
@@ -34068,10 +34053,10 @@ var EnteClient = class _EnteClient {
|
|
|
34068
34053
|
listTasks(params) {
|
|
34069
34054
|
return this.rest.get("/api/external/tasks", params);
|
|
34070
34055
|
}
|
|
34071
|
-
taskByNumber(num,
|
|
34056
|
+
taskByNumber(num, spaceId2) {
|
|
34072
34057
|
return this.rest.get("/api/external/tasks/number", {
|
|
34073
34058
|
number: String(num),
|
|
34074
|
-
...
|
|
34059
|
+
...spaceId2 ? { spaceId: spaceId2 } : {}
|
|
34075
34060
|
});
|
|
34076
34061
|
}
|
|
34077
34062
|
// --- activity agendas ---------------------------------------------------
|
|
@@ -34080,12 +34065,12 @@ var EnteClient = class _EnteClient {
|
|
|
34080
34065
|
const response = await this.rest.post("/api/external/agenda-points", input2);
|
|
34081
34066
|
return parseAgendaCreateResponse(response);
|
|
34082
34067
|
}
|
|
34083
|
-
uploadAttachment(activityId2, bytes2,
|
|
34068
|
+
uploadAttachment(activityId2, bytes2, name4, mimeType) {
|
|
34084
34069
|
return this.rest.postRaw(
|
|
34085
34070
|
"/api/external/activities/upload",
|
|
34086
34071
|
bytes2,
|
|
34087
34072
|
mimeType,
|
|
34088
|
-
{ id: activityId2, name:
|
|
34073
|
+
{ id: activityId2, name: name4 },
|
|
34089
34074
|
{ timeoutMs: UPLOAD_TIMEOUT_MS }
|
|
34090
34075
|
);
|
|
34091
34076
|
}
|
|
@@ -34210,8 +34195,8 @@ var EnteClient = class _EnteClient {
|
|
|
34210
34195
|
);
|
|
34211
34196
|
}
|
|
34212
34197
|
// --- spaces -------------------------------------------------------------
|
|
34213
|
-
spaceMembers(
|
|
34214
|
-
return this.workspaceOperation("listSpaceMembers", { spaceId });
|
|
34198
|
+
spaceMembers(spaceId2) {
|
|
34199
|
+
return this.workspaceOperation("listSpaceMembers", { spaceId: spaceId2 });
|
|
34215
34200
|
}
|
|
34216
34201
|
};
|
|
34217
34202
|
|
|
@@ -34350,7 +34335,6 @@ function formatEntityDetail(data) {
|
|
|
34350
34335
|
if (e.hiddenFromGraph) lines.push("Graph: hidden");
|
|
34351
34336
|
if (e.aliases && e.aliases.length) lines.push(`Aliases: ${e.aliases.join(", ")}`);
|
|
34352
34337
|
if (e.tags && e.tags.length) lines.push(`Tags: ${e.tags.join(", ")}`);
|
|
34353
|
-
if (e.entityFieldsPhase) for (const [label, value] of Object.entries(e.attributes ?? {})) lines.push(` ${label}: ${typeof value === "string" ? value : JSON.stringify(value)}`);
|
|
34354
34338
|
for (const field of e.fields ?? []) lines.push(` ${field.label} (${field.type}): ${field.value} [${field.valueId}]`);
|
|
34355
34339
|
if (data.descriptionPlainText) {
|
|
34356
34340
|
lines.push("");
|
|
@@ -34552,8 +34536,8 @@ async function resolveSpaceByName(client, nameOrId) {
|
|
|
34552
34536
|
if (looksLikeConvexId(nameOrId)) return nameOrId;
|
|
34553
34537
|
const spaces = await client.listSpaces();
|
|
34554
34538
|
const lower = nameOrId.toLowerCase();
|
|
34555
|
-
for (const [
|
|
34556
|
-
if ((space3.spaceName ?? "").toLowerCase() === lower) return
|
|
34539
|
+
for (const [spaceId2, space3] of Object.entries(spaces)) {
|
|
34540
|
+
if ((space3.spaceName ?? "").toLowerCase() === lower) return spaceId2;
|
|
34557
34541
|
}
|
|
34558
34542
|
const partial2 = Object.entries(spaces).filter(
|
|
34559
34543
|
([, s]) => (s.spaceName ?? "").toLowerCase().includes(lower)
|
|
@@ -34609,8 +34593,8 @@ ${footer}` : body;
|
|
|
34609
34593
|
if (opts.space !== void 0 && !opts.space.trim())
|
|
34610
34594
|
throw new OperationInputError(request.operation, [{ path: ["spaceId"], reason: "too_small" }]);
|
|
34611
34595
|
const client = this.client();
|
|
34612
|
-
const
|
|
34613
|
-
const res = await client.entityRead(request.operation, { ...request.input, spaceId });
|
|
34596
|
+
const spaceId2 = opts.space ? await resolveSpaceByName(client, opts.space) : void 0;
|
|
34597
|
+
const res = await client.entityRead(request.operation, { ...request.input, spaceId: spaceId2 });
|
|
34614
34598
|
const data = res.data;
|
|
34615
34599
|
let entities = data.entities ?? [];
|
|
34616
34600
|
const spaces = data.spaces ?? {};
|
|
@@ -35283,8 +35267,8 @@ var pair = { sourceEntityId: relationshipId, targetEntityId: relationshipId, spa
|
|
|
35283
35267
|
var relationshipAddInput = external_exports.strictObject({ action: external_exports.literal("add"), ...pair, role: relationshipRole.optional(), includeInAggregation: external_exports.boolean().optional(), grantMissingParentAccess: external_exports.boolean().optional(), parentSpaceGrantFingerprint: external_exports.string().optional() });
|
|
35284
35268
|
var relationshipRemoveInput = external_exports.strictObject({ action: external_exports.literal("remove"), ...pair });
|
|
35285
35269
|
var relationshipInputs = { listPins: external_exports.strictObject({ entityId: relationshipId }), managePins: external_exports.discriminatedUnion("action", [relationshipAddInput, relationshipRemoveInput]) };
|
|
35286
|
-
function parseRelationshipRequest(
|
|
35287
|
-
return
|
|
35270
|
+
function parseRelationshipRequest(name4, raw) {
|
|
35271
|
+
return name4 === "listPins" ? { operation: name4, input: parseOperationInput(name4, relationshipInputs.listPins, raw) } : { operation: name4, input: parseOperationInput(name4, relationshipInputs.managePins, raw) };
|
|
35288
35272
|
}
|
|
35289
35273
|
var relationshipUiInputs = {
|
|
35290
35274
|
updateRole: external_exports.strictObject({ pinId: relationshipId, role: relationshipRole.optional() }),
|
|
@@ -35319,7 +35303,7 @@ function projectRelationshipCliList(raw) {
|
|
|
35319
35303
|
|
|
35320
35304
|
// ../packages/shared/src/activity-operations.ts
|
|
35321
35305
|
function isBoundedAgentIds(value) {
|
|
35322
|
-
return Array.isArray(value) && value.length <= MAX_ACTIVITY_AGENT_ASSIGNEES && value.every((
|
|
35306
|
+
return Array.isArray(value) && value.length <= MAX_ACTIVITY_AGENT_ASSIGNEES && value.every((id18) => typeof id18 === "string" && id18.length > 0);
|
|
35323
35307
|
}
|
|
35324
35308
|
function optionalBoolean(value) {
|
|
35325
35309
|
return typeof value === "boolean" ? value : void 0;
|
|
@@ -35344,20 +35328,20 @@ function updateAttributes(value) {
|
|
|
35344
35328
|
return result;
|
|
35345
35329
|
}
|
|
35346
35330
|
var invalid2 = (message2) => ({ ok: false, message: message2 });
|
|
35347
|
-
function parseActivityCreateInput(args,
|
|
35348
|
-
if ("createdAt" in args) return invalid2(`${
|
|
35331
|
+
function parseActivityCreateInput(args, name4 = "activities_create") {
|
|
35332
|
+
if ("createdAt" in args) return invalid2(`${name4} createdAt is no longer accepted; use sourceCreatedAt.`);
|
|
35349
35333
|
if (args.sourceCreatedAt !== void 0 && !isSourceCreatedAtInput(args.sourceCreatedAt))
|
|
35350
|
-
return invalid2(`${
|
|
35334
|
+
return invalid2(`${name4} sourceCreatedAt must be an object: { date: "YYYY-MM-DD", time?: "HH:mm" | null, timezone?: string }`);
|
|
35351
35335
|
const entityIds = optionalStringArray(args.entityIds);
|
|
35352
|
-
if (!entityIds?.length) return invalid2(`${
|
|
35353
|
-
if (!isActivityType(args.type)) return invalid2(`${
|
|
35336
|
+
if (!entityIds?.length) return invalid2(`${name4} requires entityIds to be a non-empty string array`);
|
|
35337
|
+
if (!isActivityType(args.type)) return invalid2(`${name4} requires type to be one of: ${ACTIVITY_TYPE_VALUES.join(", ")}`);
|
|
35354
35338
|
if (args.deadline !== void 0 && !isDeadlineInput(args.deadline))
|
|
35355
|
-
return invalid2(`${
|
|
35339
|
+
return invalid2(`${name4} deadline must be a readable deadline object or number`);
|
|
35356
35340
|
if (args.agentAssigneeIds !== void 0 && !isBoundedAgentIds(args.agentAssigneeIds))
|
|
35357
|
-
return invalid2(`${
|
|
35341
|
+
return invalid2(`${name4} agentAssigneeIds must be an array of at most ${MAX_ACTIVITY_AGENT_ASSIGNEES} non-empty IDs`);
|
|
35358
35342
|
const attributes2 = isInputRecord(args.attributes) ? stringAttributes(args.attributes) : void 0;
|
|
35359
35343
|
if (args.attributes === null || isInputRecord(args.attributes) && attributes2 === void 0)
|
|
35360
|
-
return invalid2(`${
|
|
35344
|
+
return invalid2(`${name4} attributes must contain string values`);
|
|
35361
35345
|
return { ok: true, value: {
|
|
35362
35346
|
entityIds,
|
|
35363
35347
|
type: args.type,
|
|
@@ -35376,21 +35360,21 @@ function parseActivityCreateInput(args, name3 = "activities_create") {
|
|
|
35376
35360
|
autoLinkPersonalSpace: optionalBoolean(args.autoLinkPersonalSpace)
|
|
35377
35361
|
} };
|
|
35378
35362
|
}
|
|
35379
|
-
function parseActivityUpdateInput(args,
|
|
35380
|
-
if (typeof args.activityId !== "string") return invalid2(`${
|
|
35363
|
+
function parseActivityUpdateInput(args, name4 = "activities_update") {
|
|
35364
|
+
if (typeof args.activityId !== "string") return invalid2(`${name4} requires string activityId`);
|
|
35381
35365
|
if ("deadline" in args && !isNullableDeadlineInput(args.deadline))
|
|
35382
|
-
return invalid2(`${
|
|
35366
|
+
return invalid2(`${name4} deadline must be a readable deadline object, number, or null`);
|
|
35383
35367
|
if (args.type !== void 0 && !isActivityType(args.type))
|
|
35384
|
-
return invalid2(`${
|
|
35368
|
+
return invalid2(`${name4} type must be one of: ${ACTIVITY_TYPE_VALUES.join(", ")}`);
|
|
35385
35369
|
const entityIds = optionalStringArray(args.entityIds);
|
|
35386
|
-
if (args.entityIds !== void 0 && !entityIds?.length) return invalid2(`${
|
|
35387
|
-
if (args.attributes !== void 0 && !isInputRecord(args.attributes)) return invalid2(`${
|
|
35370
|
+
if (args.entityIds !== void 0 && !entityIds?.length) return invalid2(`${name4} entityIds must be a non-empty string array`);
|
|
35371
|
+
if (args.attributes !== void 0 && !isInputRecord(args.attributes)) return invalid2(`${name4} attributes must be an object`);
|
|
35388
35372
|
const attributes2 = isInputRecord(args.attributes) ? updateAttributes(args.attributes) : void 0;
|
|
35389
|
-
if (isInputRecord(args.attributes) && attributes2 === void 0) return invalid2(`${
|
|
35373
|
+
if (isInputRecord(args.attributes) && attributes2 === void 0) return invalid2(`${name4} attributes must contain string or null values`);
|
|
35390
35374
|
for (const key of ["assigneeIds", "assigneeEmails"])
|
|
35391
|
-
if (args[key] !== void 0 && !optionalStringArray(args[key])) return invalid2(`${
|
|
35375
|
+
if (args[key] !== void 0 && !optionalStringArray(args[key])) return invalid2(`${name4} ${key} must be an array of strings`);
|
|
35392
35376
|
if (args.agentAssigneeIds !== void 0 && !isBoundedAgentIds(args.agentAssigneeIds))
|
|
35393
|
-
return invalid2(`${
|
|
35377
|
+
return invalid2(`${name4} agentAssigneeIds must be an array of at most ${MAX_ACTIVITY_AGENT_ASSIGNEES} non-empty IDs`);
|
|
35394
35378
|
return { ok: true, value: {
|
|
35395
35379
|
activityId: args.activityId,
|
|
35396
35380
|
title: typeof args.title === "string" ? args.title : void 0,
|
|
@@ -35618,8 +35602,8 @@ function isActivityContentAlias(value) {
|
|
|
35618
35602
|
function parseActivityContentRequest(operation, raw) {
|
|
35619
35603
|
return operation === "readActivityContent" ? { operation, input: parseOperationInput(operation, activityContentInputs.readActivityContent, raw) } : { operation, input: parseOperationInput(operation, activityContentInputs.editActivityContent, raw) };
|
|
35620
35604
|
}
|
|
35621
|
-
function parseLegacyActivityContentRequest(
|
|
35622
|
-
const operation = isActivityContentAlias(
|
|
35605
|
+
function parseLegacyActivityContentRequest(name4, raw) {
|
|
35606
|
+
const operation = isActivityContentAlias(name4) ? activityContentAliases[name4] : name4;
|
|
35623
35607
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return parseActivityContentRequest(operation, raw);
|
|
35624
35608
|
const input2 = Object.fromEntries(Object.entries(raw).filter(([key]) => Object.hasOwn(activityContentInputs[operation].shape, key)));
|
|
35625
35609
|
if (operation === "editActivityContent") return parseActivityContentRequest(operation, input2);
|
|
@@ -35761,8 +35745,8 @@ var GraphProgress = class {
|
|
|
35761
35745
|
this.committed.push({ step, state: "committed" });
|
|
35762
35746
|
this.outcome = "committed-unvalidated";
|
|
35763
35747
|
if (createdId) {
|
|
35764
|
-
const
|
|
35765
|
-
if (
|
|
35748
|
+
const id18 = graphId.safeParse(raw);
|
|
35749
|
+
if (id18.success) this.ids[createdId] = id18.data;
|
|
35766
35750
|
}
|
|
35767
35751
|
const value = await check2(raw);
|
|
35768
35752
|
this.outcome = "observation-failed";
|
|
@@ -35867,52 +35851,52 @@ var TableDefinition2 = class {
|
|
|
35867
35851
|
" indexes"() {
|
|
35868
35852
|
return this.indexes;
|
|
35869
35853
|
}
|
|
35870
|
-
index(
|
|
35854
|
+
index(name4, indexConfig) {
|
|
35871
35855
|
if (Array.isArray(indexConfig)) {
|
|
35872
35856
|
this.indexes.push({
|
|
35873
|
-
indexDescriptor:
|
|
35857
|
+
indexDescriptor: name4,
|
|
35874
35858
|
fields: indexConfig
|
|
35875
35859
|
});
|
|
35876
35860
|
} else if (indexConfig.staged) {
|
|
35877
35861
|
this.stagedDbIndexes.push({
|
|
35878
|
-
indexDescriptor:
|
|
35862
|
+
indexDescriptor: name4,
|
|
35879
35863
|
fields: indexConfig.fields
|
|
35880
35864
|
});
|
|
35881
35865
|
} else {
|
|
35882
35866
|
this.indexes.push({
|
|
35883
|
-
indexDescriptor:
|
|
35867
|
+
indexDescriptor: name4,
|
|
35884
35868
|
fields: indexConfig.fields
|
|
35885
35869
|
});
|
|
35886
35870
|
}
|
|
35887
35871
|
return this;
|
|
35888
35872
|
}
|
|
35889
|
-
searchIndex(
|
|
35873
|
+
searchIndex(name4, indexConfig) {
|
|
35890
35874
|
if (indexConfig.staged) {
|
|
35891
35875
|
this.stagedSearchIndexes.push({
|
|
35892
|
-
indexDescriptor:
|
|
35876
|
+
indexDescriptor: name4,
|
|
35893
35877
|
searchField: indexConfig.searchField,
|
|
35894
35878
|
filterFields: indexConfig.filterFields || []
|
|
35895
35879
|
});
|
|
35896
35880
|
} else {
|
|
35897
35881
|
this.searchIndexes.push({
|
|
35898
|
-
indexDescriptor:
|
|
35882
|
+
indexDescriptor: name4,
|
|
35899
35883
|
searchField: indexConfig.searchField,
|
|
35900
35884
|
filterFields: indexConfig.filterFields || []
|
|
35901
35885
|
});
|
|
35902
35886
|
}
|
|
35903
35887
|
return this;
|
|
35904
35888
|
}
|
|
35905
|
-
vectorIndex(
|
|
35889
|
+
vectorIndex(name4, indexConfig) {
|
|
35906
35890
|
if (indexConfig.staged) {
|
|
35907
35891
|
this.stagedVectorIndexes.push({
|
|
35908
|
-
indexDescriptor:
|
|
35892
|
+
indexDescriptor: name4,
|
|
35909
35893
|
vectorField: indexConfig.vectorField,
|
|
35910
35894
|
dimensions: indexConfig.dimensions,
|
|
35911
35895
|
filterFields: indexConfig.filterFields || []
|
|
35912
35896
|
});
|
|
35913
35897
|
} else {
|
|
35914
35898
|
this.vectorIndexes.push({
|
|
35915
|
-
indexDescriptor:
|
|
35899
|
+
indexDescriptor: name4,
|
|
35916
35900
|
vectorField: indexConfig.vectorField,
|
|
35917
35901
|
dimensions: indexConfig.dimensions,
|
|
35918
35902
|
filterFields: indexConfig.filterFields || []
|
|
@@ -36085,7 +36069,7 @@ var SchemaDefinition2 = class {
|
|
|
36085
36069
|
*/
|
|
36086
36070
|
export() {
|
|
36087
36071
|
return JSON.stringify({
|
|
36088
|
-
tables: Object.entries(this.tables).map(([tableName,
|
|
36072
|
+
tables: Object.entries(this.tables).map(([tableName, definition4]) => {
|
|
36089
36073
|
const {
|
|
36090
36074
|
indexes,
|
|
36091
36075
|
stagedDbIndexes,
|
|
@@ -36095,7 +36079,7 @@ var SchemaDefinition2 = class {
|
|
|
36095
36079
|
stagedVectorIndexes,
|
|
36096
36080
|
documentType,
|
|
36097
36081
|
stagedDocumentType
|
|
36098
|
-
} =
|
|
36082
|
+
} = definition4.export();
|
|
36099
36083
|
return {
|
|
36100
36084
|
tableName,
|
|
36101
36085
|
indexes,
|
|
@@ -36198,9 +36182,9 @@ function withFooter(body, spaces) {
|
|
|
36198
36182
|
return footer ? `${body}
|
|
36199
36183
|
${footer}` : body;
|
|
36200
36184
|
}
|
|
36201
|
-
async function resolveAssigneeEmailsToIds(caller,
|
|
36185
|
+
async function resolveAssigneeEmailsToIds(caller, spaceId2, emails) {
|
|
36202
36186
|
if (emails.length === 0) return [];
|
|
36203
|
-
const members2 = await caller.query(membershipsListForSpace, { spaceId });
|
|
36187
|
+
const members2 = await caller.query(membershipsListForSpace, { spaceId: spaceId2 });
|
|
36204
36188
|
const ids2 = [];
|
|
36205
36189
|
for (const email3 of emails) {
|
|
36206
36190
|
const match = members2.find((m) => (m.user?.email ?? "").toLowerCase() === email3.toLowerCase());
|
|
@@ -36278,8 +36262,8 @@ var htmlAliases = {
|
|
|
36278
36262
|
html_blocks_get: "getHtmlBlock",
|
|
36279
36263
|
html_blocks_update: "updateHtmlBlock"
|
|
36280
36264
|
};
|
|
36281
|
-
function isHtmlOperationName(
|
|
36282
|
-
return Object.hasOwn(htmlInputs,
|
|
36265
|
+
function isHtmlOperationName(name4) {
|
|
36266
|
+
return Object.hasOwn(htmlInputs, name4);
|
|
36283
36267
|
}
|
|
36284
36268
|
var descriptions3 = {
|
|
36285
36269
|
listHtmlBlocks: "List interactive HTML block summaries in one accessible Ente document, without source. Use an activity ID directly for its body.",
|
|
@@ -36287,20 +36271,20 @@ var descriptions3 = {
|
|
|
36287
36271
|
getHtmlBlock: "Read one interactive HTML block including its source. Read immediately before updateHtmlBlock and copy its artifactId and versionId.",
|
|
36288
36272
|
updateHtmlBlock: "Revise one interactive HTML block without replacing surrounding content. Pass the artifactId and expectedVersionId from the current read; stale updates fail closed."
|
|
36289
36273
|
};
|
|
36290
|
-
function definition(
|
|
36291
|
-
const schema = external_exports.toJSONSchema(htmlInputs[
|
|
36274
|
+
function definition(name4) {
|
|
36275
|
+
const schema = external_exports.toJSONSchema(htmlInputs[name4], { io: "input" });
|
|
36292
36276
|
return {
|
|
36293
|
-
name:
|
|
36294
|
-
aliases: operationAliases(htmlAliases,
|
|
36277
|
+
name: name4,
|
|
36278
|
+
aliases: operationAliases(htmlAliases, name4),
|
|
36295
36279
|
actor: "agent",
|
|
36296
|
-
description: descriptions3[
|
|
36280
|
+
description: descriptions3[name4],
|
|
36297
36281
|
inputSchema: { type: "object", properties: schema.properties ?? {}, required: schema.required ?? [], additionalProperties: false },
|
|
36298
|
-
resultSchema: operationResultSchema(htmlResults[
|
|
36299
|
-
outputSchema: { type: "object", properties: { data: operationResultSchema(htmlResults[
|
|
36282
|
+
resultSchema: operationResultSchema(htmlResults[name4]),
|
|
36283
|
+
outputSchema: { type: "object", properties: { data: operationResultSchema(htmlResults[name4]) }, required: ["data"], additionalProperties: false },
|
|
36300
36284
|
errorSchema: operationErrorSchema,
|
|
36301
|
-
capability:
|
|
36285
|
+
capability: name4 === "listHtmlBlocks" || name4 === "getHtmlBlock" ? "read" : "write",
|
|
36302
36286
|
executionProfile: "full",
|
|
36303
|
-
resultProjection:
|
|
36287
|
+
resultProjection: name4 === "listHtmlBlocks" ? "summary" : "full",
|
|
36304
36288
|
environment: "content",
|
|
36305
36289
|
availability: { hosted: true, external: true, browserHuman: false, agentConnection: false, executionProfiles: ["full", "public-cli"] },
|
|
36306
36290
|
resourcePolicy: {
|
|
@@ -36319,7 +36303,7 @@ function definition(name3) {
|
|
|
36319
36303
|
}
|
|
36320
36304
|
};
|
|
36321
36305
|
}
|
|
36322
|
-
var definitions2 = new Map(Object.keys(htmlInputs).filter(isHtmlOperationName).map((
|
|
36306
|
+
var definitions2 = new Map(Object.keys(htmlInputs).filter(isHtmlOperationName).map((name4) => [name4, definition(name4)]));
|
|
36323
36307
|
var htmlCatalog = [...definitions2.values()];
|
|
36324
36308
|
|
|
36325
36309
|
// ente/htmlBlocks.ts
|
|
@@ -36486,11 +36470,11 @@ var EntityDuplicate = class extends ProfileCommand {
|
|
|
36486
36470
|
const request = parseEntityWriteRequest("duplicateEntity", { entityId: "pending-entity-resolution", spaceId: "pending-space-resolution", name: this.name, includeExclusiveChildren: this.includeExclusiveChildren });
|
|
36487
36471
|
const caller = await resolveCaller();
|
|
36488
36472
|
const entityId2 = await resolveEntityC(caller, this.nameOrId);
|
|
36489
|
-
const
|
|
36473
|
+
const spaceId2 = await resolveSpaceByNameC(caller, this.space);
|
|
36490
36474
|
const data = projectEntityWriteResult("duplicateEntity", await caller.mutation(entitiesDuplicate, {
|
|
36491
36475
|
...request.input,
|
|
36492
36476
|
entityId: entityId2,
|
|
36493
|
-
spaceId
|
|
36477
|
+
spaceId: spaceId2
|
|
36494
36478
|
}));
|
|
36495
36479
|
this.emitText({ data }, () => `Duplicated ${data.duplicatedCount} entities (${data.entityId})`);
|
|
36496
36480
|
}
|
|
@@ -36546,10 +36530,10 @@ var EntityCreate = class extends ClientCommand {
|
|
|
36546
36530
|
const fields3 = parseCliFields("createEntity", this.field);
|
|
36547
36531
|
const type = core.type;
|
|
36548
36532
|
const caller = await resolveCaller();
|
|
36549
|
-
const
|
|
36533
|
+
const spaceId2 = await resolveSpaceByNameC(caller, this.space);
|
|
36550
36534
|
const parentEntityId = this.parent ? await resolveEntityC(caller, this.parent) : void 0;
|
|
36551
36535
|
const { entityId: entityId2 } = projectEntityWriteResult("createEntity", await caller.mutation(entitiesCreate, {
|
|
36552
|
-
spaceId,
|
|
36536
|
+
spaceId: spaceId2,
|
|
36553
36537
|
name: core.name,
|
|
36554
36538
|
type,
|
|
36555
36539
|
fields: fields3,
|
|
@@ -36831,11 +36815,11 @@ var EntityRemoveFromSpace = class extends ProfileCommand {
|
|
|
36831
36815
|
async run() {
|
|
36832
36816
|
const caller = await resolveCaller();
|
|
36833
36817
|
const entityId2 = await resolveEntityC(caller, this.nameOrId);
|
|
36834
|
-
const
|
|
36818
|
+
const spaceId2 = await resolveSpaceByNameC(caller, this.space);
|
|
36835
36819
|
if (this.removeFromActivities && !this.cleanupFingerprint) throw new Error("Review the activityCleanupFingerprint or use space change prepare and confirm before applying bulk cleanup.");
|
|
36836
36820
|
await caller.mutation(entitiesRemoveFromSpace, {
|
|
36837
36821
|
entityId: entityId2,
|
|
36838
|
-
spaceId,
|
|
36822
|
+
spaceId: spaceId2,
|
|
36839
36823
|
...this.removeFromActivities ? { removeFromActivities: true, activityCleanupFingerprint: this.cleanupFingerprint } : {}
|
|
36840
36824
|
});
|
|
36841
36825
|
const spaces = await spacesFooterFromMemberships(caller);
|
|
@@ -36862,10 +36846,10 @@ var EntityAddToSpace = class extends ProfileCommand {
|
|
|
36862
36846
|
async run() {
|
|
36863
36847
|
const caller = await resolveCaller();
|
|
36864
36848
|
const entityId2 = await resolveEntityC(caller, this.nameOrId);
|
|
36865
|
-
const
|
|
36849
|
+
const spaceId2 = await resolveSpaceByNameC(caller, this.space);
|
|
36866
36850
|
await caller.mutation(entitiesCreateEntitySpaceLink, {
|
|
36867
36851
|
entityId: entityId2,
|
|
36868
|
-
spaceId,
|
|
36852
|
+
spaceId: spaceId2,
|
|
36869
36853
|
...this.shareParents ? {
|
|
36870
36854
|
grantMissingParentAccess: true,
|
|
36871
36855
|
...this.parentSpaceGrantFingerprint ? { parentSpaceGrantFingerprint: this.parentSpaceGrantFingerprint } : {}
|
|
@@ -37140,9 +37124,9 @@ var activityContentResults = {
|
|
|
37140
37124
|
readActivityContent: external_exports.strictObject({ activityId: external_exports.string().min(1), contentVersion: activityContentVersion, blocks: external_exports.array(activityContentBlock).max(ACTIVITY_CONTENT_LIMITS.maxBlocks), nextCursor: external_exports.string().optional() }).refine((value) => value.blocks.reduce((sum, block) => sum + block.content.length, 0) <= ACTIVITY_CONTENT_LIMITS.maxCharacters + 1 && (value.nextCursor === void 0 || decodeActivityContentCursor(value.nextCursor)?.version === value.contentVersion), "Invalid bounded content window"),
|
|
37141
37125
|
editActivityContent: external_exports.strictObject({ activityId: external_exports.string().min(1), contentVersion: activityContentVersion, changed: external_exports.boolean() })
|
|
37142
37126
|
};
|
|
37143
|
-
function parseActivityContentResult(
|
|
37144
|
-
const parsed = activityContentResults[
|
|
37145
|
-
if (!parsed.success) throw new OperationResultError(
|
|
37127
|
+
function parseActivityContentResult(name4, raw) {
|
|
37128
|
+
const parsed = activityContentResults[name4].safeParse(raw);
|
|
37129
|
+
if (!parsed.success) throw new OperationResultError(name4, "Invalid activity content result");
|
|
37146
37130
|
return parsed.data;
|
|
37147
37131
|
}
|
|
37148
37132
|
|
|
@@ -37322,26 +37306,26 @@ function parseInlineImageSpecs(specs, options) {
|
|
|
37322
37306
|
return { contentId, path: spec.slice(separator + 1) };
|
|
37323
37307
|
});
|
|
37324
37308
|
}
|
|
37325
|
-
function readOutgoingEmailAttachment(
|
|
37309
|
+
function readOutgoingEmailAttachment(path9, options) {
|
|
37326
37310
|
let bytes2;
|
|
37327
37311
|
try {
|
|
37328
|
-
bytes2 = readFileSync8(
|
|
37312
|
+
bytes2 = readFileSync8(path9);
|
|
37329
37313
|
} catch (error62) {
|
|
37330
37314
|
const detail = error62 instanceof Error ? error62.message : String(error62);
|
|
37331
|
-
throw new Error(`${options.commandLabel}: could not read attachment '${
|
|
37315
|
+
throw new Error(`${options.commandLabel}: could not read attachment '${path9}': ${detail}`);
|
|
37332
37316
|
}
|
|
37333
37317
|
if (bytes2.byteLength > options.maxBytes) {
|
|
37334
37318
|
throw new Error(
|
|
37335
|
-
`${options.commandLabel}: attachment '${
|
|
37319
|
+
`${options.commandLabel}: attachment '${path9}' must be ${options.maxBytes} bytes or smaller.`
|
|
37336
37320
|
);
|
|
37337
37321
|
}
|
|
37338
37322
|
const detectedImageMimeType = detectImageMimeType(bytes2);
|
|
37339
37323
|
if (options.requireImage && !detectedImageMimeType) {
|
|
37340
37324
|
throw new Error(
|
|
37341
|
-
`${options.commandLabel}: image '${
|
|
37325
|
+
`${options.commandLabel}: image '${path9}' must be PNG, JPEG, GIF, or WebP.`
|
|
37342
37326
|
);
|
|
37343
37327
|
}
|
|
37344
|
-
const filename = basename(
|
|
37328
|
+
const filename = basename(path9);
|
|
37345
37329
|
if (!filename || filename.length > options.maxFilenameLength) {
|
|
37346
37330
|
throw new Error(
|
|
37347
37331
|
`${options.commandLabel}: attachment filename must be 1-${options.maxFilenameLength} characters.`
|
|
@@ -37358,7 +37342,7 @@ function readOutgoingEmailAttachment(path6, options) {
|
|
|
37358
37342
|
}
|
|
37359
37343
|
return {
|
|
37360
37344
|
filename,
|
|
37361
|
-
mimeType: detectedImageMimeType ?? mimeTypeForPath(
|
|
37345
|
+
mimeType: detectedImageMimeType ?? mimeTypeForPath(path9),
|
|
37362
37346
|
data: bytes2.toString("base64"),
|
|
37363
37347
|
...options.contentId ? { contentId: options.contentId } : {}
|
|
37364
37348
|
};
|
|
@@ -37515,12 +37499,12 @@ var ActivityCreate = class extends ProfileCommand {
|
|
|
37515
37499
|
return progress.run(async () => {
|
|
37516
37500
|
const caller = await resolveCaller();
|
|
37517
37501
|
const entityIds = await resolveEntitiesC(caller, intent.entities);
|
|
37518
|
-
const
|
|
37519
|
-
parseActivityWriteRequest("createActivity", { ...Object.fromEntries(Object.entries(intent).filter(([key]) => !["space", "entities", "entitySpaceGrantFingerprint"].includes(key))), spaceId, entityIds });
|
|
37502
|
+
const spaceId2 = await resolveSpaceByNameC(caller, intent.space);
|
|
37503
|
+
parseActivityWriteRequest("createActivity", { ...Object.fromEntries(Object.entries(intent).filter(([key]) => !["space", "entities", "entitySpaceGrantFingerprint"].includes(key))), spaceId: spaceId2, entityIds });
|
|
37520
37504
|
const activityId2 = await progress.write("create", () => caller.mutation(activitiesCreate, {
|
|
37521
37505
|
entityId: entityIds[0],
|
|
37522
37506
|
additionalEntities: entityIds.slice(1),
|
|
37523
|
-
ownerSpaceId:
|
|
37507
|
+
ownerSpaceId: spaceId2,
|
|
37524
37508
|
grantMissingEntityAccess: this.autoLink,
|
|
37525
37509
|
...this.entitySpaceGrantFingerprint !== void 0 ? { entitySpaceGrantFingerprint: this.entitySpaceGrantFingerprint } : {},
|
|
37526
37510
|
type: intent.type,
|
|
@@ -37702,8 +37686,8 @@ var ActivityUpdate = class extends ProfileCommand {
|
|
|
37702
37686
|
const currentIds = rich.entityDetails.flatMap((entity4) => entity4 ? [entity4._id] : []);
|
|
37703
37687
|
const addIds = await resolveEntitiesC(caller, addNames);
|
|
37704
37688
|
const removeSet = new Set(await resolveEntitiesC(caller, removeNames));
|
|
37705
|
-
const newIds = currentIds.filter((
|
|
37706
|
-
for (const
|
|
37689
|
+
const newIds = currentIds.filter((id18) => !removeSet.has(id18));
|
|
37690
|
+
for (const id18 of addIds) if (!currentIds.includes(id18)) newIds.push(id18);
|
|
37707
37691
|
parseActivityWriteRequest("updateActivity", { activityId: this.id, entityIds: newIds });
|
|
37708
37692
|
await progress.write("entities", () => caller.mutation(activitiesUpdateEntities, { activityId: this.id, entities: newIds }), graphAck);
|
|
37709
37693
|
});
|
|
@@ -37821,7 +37805,7 @@ var ActivityAttachmentUpload = class extends ProfileCommand {
|
|
|
37821
37805
|
if (bytes2.byteLength > MAX_ACTIVITY_ATTACHMENT_BYTES) {
|
|
37822
37806
|
throw new Error("Activity attachments must be 20 MB or smaller.");
|
|
37823
37807
|
}
|
|
37824
|
-
const
|
|
37808
|
+
const name4 = this.name ?? basename2(this.file);
|
|
37825
37809
|
const mimeType = mimeTypeForPath(this.file);
|
|
37826
37810
|
const caller = await resolveCaller();
|
|
37827
37811
|
const progress = graphProgress(this, "activity.attachmentUpload", ["uploadUrl", "upload", "attach"], { activityId: this.id });
|
|
@@ -37846,14 +37830,14 @@ var ActivityAttachmentUpload = class extends ProfileCommand {
|
|
|
37846
37830
|
return uploadedFileResult(json3);
|
|
37847
37831
|
});
|
|
37848
37832
|
progress.identifyStorage(storageId);
|
|
37849
|
-
await progress.write("attach", () => caller.mutation(activitiesAddAttachment, { activityId: this.id, storageId, name:
|
|
37833
|
+
await progress.write("attach", () => caller.mutation(activitiesAddAttachment, { activityId: this.id, storageId, name: name4, mimeType }), (raw) => {
|
|
37850
37834
|
progress.identifyAttachment(storageId);
|
|
37851
37835
|
return graphAck(raw);
|
|
37852
37836
|
});
|
|
37853
37837
|
const spaces = await progress.observe("spacesFooter", () => spacesFooterFromMemberships(caller));
|
|
37854
37838
|
await progress.observe("output", async () => this.emitText(
|
|
37855
37839
|
graphEnvelope(external_exports.strictObject({ storageId: graphId }), { storageId }, spaces),
|
|
37856
|
-
() => withFooter(`Attached '${
|
|
37840
|
+
() => withFooter(`Attached '${name4}' to activity ${this.id} (${storageId})`, spaces)
|
|
37857
37841
|
));
|
|
37858
37842
|
});
|
|
37859
37843
|
}
|
|
@@ -38179,7 +38163,7 @@ function toTaskItem(rich) {
|
|
|
38179
38163
|
shortId: rich.shortId,
|
|
38180
38164
|
attributes: rich.attributes,
|
|
38181
38165
|
tags: rich.tags,
|
|
38182
|
-
entityIds: rich.entityDetails.map((e) => e?._id).filter((
|
|
38166
|
+
entityIds: rich.entityDetails.map((e) => e?._id).filter((id18) => !!id18),
|
|
38183
38167
|
assigneeIds: rich.assigneeIds
|
|
38184
38168
|
},
|
|
38185
38169
|
entities: rich.entityDetails.filter((e) => e !== null).map((e) => ({ name: e.name, _id: e._id }))
|
|
@@ -38206,17 +38190,17 @@ var activitiesSetContentFromMarkdown2 = makeFunctionReference("activities:setCon
|
|
|
38206
38190
|
var activitiesUpdateDeadline2 = makeFunctionReference("activities:updateDeadline");
|
|
38207
38191
|
var activitiesSetCompleted = makeFunctionReference("activities:setCompleted");
|
|
38208
38192
|
var activitiesUpdateAssignees = makeFunctionReference("activities:updateAssignees");
|
|
38209
|
-
async function resolveTaskIdC(caller, idStr,
|
|
38193
|
+
async function resolveTaskIdC(caller, idStr, spaceId2) {
|
|
38210
38194
|
const num = graphTaskNumber(idStr);
|
|
38211
38195
|
if (num === null) return idStr;
|
|
38212
|
-
const activityId2 = graphResult(graphId.nullable(), await caller.query(activitiesFindTaskByShortId, { shortId: num, ...
|
|
38196
|
+
const activityId2 = graphResult(graphId.nullable(), await caller.query(activitiesFindTaskByShortId, { shortId: num, ...spaceId2 === void 0 ? {} : { spaceId: spaceId2 } }));
|
|
38213
38197
|
if (!activityId2) throw new Error(`No open task found with short ID #${num}.`);
|
|
38214
38198
|
return activityId2;
|
|
38215
38199
|
}
|
|
38216
|
-
async function getRichTask(caller, idStr,
|
|
38217
|
-
const activityId2 = await resolveTaskIdC(caller, idStr,
|
|
38200
|
+
async function getRichTask(caller, idStr, spaceId2) {
|
|
38201
|
+
const activityId2 = await resolveTaskIdC(caller, idStr, spaceId2);
|
|
38218
38202
|
const rich = graphResult(graphPublicRich.nullable(), await caller.query(activitiesGetByIdRich2, { activityId: activityId2 }));
|
|
38219
|
-
if (!rich || rich.type !== "task" ||
|
|
38203
|
+
if (!rich || rich.type !== "task" || spaceId2 !== void 0 && rich.spaceId !== spaceId2) throw new Error("Task not found or not accessible");
|
|
38220
38204
|
return rich;
|
|
38221
38205
|
}
|
|
38222
38206
|
var TaskListCmd = class extends ClientCommand {
|
|
@@ -38275,8 +38259,8 @@ var TaskGet = class extends ProfileCommand {
|
|
|
38275
38259
|
graphTaskNumber(this.id);
|
|
38276
38260
|
if (this.space !== void 0) graphInput(selector, this.space);
|
|
38277
38261
|
const caller = await resolveCaller();
|
|
38278
|
-
const
|
|
38279
|
-
const rich = await getRichTask(caller, this.id,
|
|
38262
|
+
const spaceId2 = this.space === void 0 ? void 0 : await resolveSpaceByNameC(caller, this.space);
|
|
38263
|
+
const rich = await getRichTask(caller, this.id, spaceId2);
|
|
38280
38264
|
const taskItem = graphResult(graphTaskItem, toTaskItem(rich));
|
|
38281
38265
|
const users = await usersMapForAssignees(caller, rich);
|
|
38282
38266
|
const spaces = await spacesFooterFromMemberships(caller);
|
|
@@ -38321,14 +38305,14 @@ var TaskCreate = class extends ProfileCommand {
|
|
|
38321
38305
|
return progress.run(async () => {
|
|
38322
38306
|
const caller = await resolveCaller();
|
|
38323
38307
|
const entityIds = await resolveEntitiesC(caller, intent.entities);
|
|
38324
|
-
const
|
|
38325
|
-
const resolved = await resolveAssigneeEmailsToIds(caller,
|
|
38308
|
+
const spaceId2 = await resolveSpaceByNameC(caller, intent.space);
|
|
38309
|
+
const resolved = await resolveAssigneeEmailsToIds(caller, spaceId2, emailAssignees);
|
|
38326
38310
|
const assigneeIds = [.../* @__PURE__ */ new Set([...directAssigneeIds, ...resolved])];
|
|
38327
|
-
parseActivityWriteRequest("createActivity", { ...Object.fromEntries(Object.entries(intent).filter(([key]) => !["space", "entities", "entitySpaceGrantFingerprint"].includes(key))), spaceId, entityIds, assigneeIds });
|
|
38311
|
+
parseActivityWriteRequest("createActivity", { ...Object.fromEntries(Object.entries(intent).filter(([key]) => !["space", "entities", "entitySpaceGrantFingerprint"].includes(key))), spaceId: spaceId2, entityIds, assigneeIds });
|
|
38328
38312
|
const activityId2 = await progress.write("create", () => caller.mutation(activitiesCreate2, {
|
|
38329
38313
|
entityId: entityIds[0],
|
|
38330
38314
|
additionalEntities: entityIds.slice(1),
|
|
38331
|
-
ownerSpaceId:
|
|
38315
|
+
ownerSpaceId: spaceId2,
|
|
38332
38316
|
grantMissingEntityAccess: this.autoLink,
|
|
38333
38317
|
...this.entitySpaceGrantFingerprint !== void 0 ? { entitySpaceGrantFingerprint: this.entitySpaceGrantFingerprint } : {},
|
|
38334
38318
|
type: "task",
|
|
@@ -38447,7 +38431,7 @@ var TaskUnassign = class extends ProfileCommand {
|
|
|
38447
38431
|
this.emitText(graphEnvelope(graphContextAck, { success: true, activityId: activityId2, assigneeIds: current, changed: false }), () => "User is not assigned to this task.");
|
|
38448
38432
|
return;
|
|
38449
38433
|
}
|
|
38450
|
-
const updated = current.filter((
|
|
38434
|
+
const updated = current.filter((id18) => id18 !== targetId);
|
|
38451
38435
|
parseActivityWriteRequest("updateActivityAssignees", { activityId: activityId2, action: "replace", assigneeIds: updated });
|
|
38452
38436
|
await progress.write("assignees", () => caller.mutation(activitiesUpdateAssignees, { activityId: activityId2, assigneeIds: updated }), graphAck);
|
|
38453
38437
|
const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
|
|
@@ -38912,9 +38896,9 @@ var ListCreate = class extends ProfileCommand {
|
|
|
38912
38896
|
if (this.icon !== void 0) assertListIcon(this.icon, this.type);
|
|
38913
38897
|
const icon2 = this.icon !== void 0 ? parseEntityIcon(this.icon) : void 0;
|
|
38914
38898
|
const caller = await resolveCaller();
|
|
38915
|
-
const
|
|
38899
|
+
const spaceId2 = await resolveSpaceByNameC(caller, this.space);
|
|
38916
38900
|
const entityId2 = await caller.mutation(entitiesCreate2, {
|
|
38917
|
-
spaceId,
|
|
38901
|
+
spaceId: spaceId2,
|
|
38918
38902
|
name: this.name,
|
|
38919
38903
|
type: this.type
|
|
38920
38904
|
});
|
|
@@ -39475,11 +39459,11 @@ async function loadSettings(caller) {
|
|
|
39475
39459
|
}
|
|
39476
39460
|
return settings;
|
|
39477
39461
|
}
|
|
39478
|
-
function connectionByName(settings,
|
|
39479
|
-
const match = settings.connections.find((connection) => connection.name ===
|
|
39462
|
+
function connectionByName(settings, name4) {
|
|
39463
|
+
const match = settings.connections.find((connection) => connection.name === name4);
|
|
39480
39464
|
if (!match) {
|
|
39481
39465
|
const known = settings.connections.map((connection) => connection.name).join(", ") || "none";
|
|
39482
|
-
throw new Error(`No connection named '${
|
|
39466
|
+
throw new Error(`No connection named '${name4}'. Known: ${known}.`);
|
|
39483
39467
|
}
|
|
39484
39468
|
return match;
|
|
39485
39469
|
}
|
|
@@ -39501,7 +39485,7 @@ var ModelsStatusCommand = class extends ProfileCommand {
|
|
|
39501
39485
|
});
|
|
39502
39486
|
async run() {
|
|
39503
39487
|
const settings = await loadSettings(await resolveCaller());
|
|
39504
|
-
const connectionName = (
|
|
39488
|
+
const connectionName = (id18) => settings.connections.find((connection) => connection.id === id18)?.name ?? id18;
|
|
39505
39489
|
this.print(
|
|
39506
39490
|
{ data: settings },
|
|
39507
39491
|
() => SLOTS.map((slot) => {
|
|
@@ -39719,9 +39703,9 @@ var SpaceRenameCmd = class extends ProfileCommand {
|
|
|
39719
39703
|
if (!this.spaceNameOrId.trim()) throw new OperationInputError("updateSpace", [{ path: ["spaceId"], reason: "too_small" }]);
|
|
39720
39704
|
const input2 = parseWorkspaceRequest("updateSpace", { spaceId: "pending-space-resolution", name: this.newName }).input;
|
|
39721
39705
|
const caller = await resolveCaller();
|
|
39722
|
-
const
|
|
39723
|
-
const res = checkedResult("updateSpace", workspacePublicCliResults.updateSpace, await caller.mutation(spacesUpdate, { ...input2, spaceId }));
|
|
39724
|
-
this.emitText({ data: res }, () => `Renamed space ${
|
|
39706
|
+
const spaceId2 = await resolveSpaceByNameC(caller, this.spaceNameOrId);
|
|
39707
|
+
const res = checkedResult("updateSpace", workspacePublicCliResults.updateSpace, await caller.mutation(spacesUpdate, { ...input2, spaceId: spaceId2 }));
|
|
39708
|
+
this.emitText({ data: res }, () => `Renamed space ${spaceId2} \u2192 '${this.newName}'`);
|
|
39725
39709
|
}
|
|
39726
39710
|
};
|
|
39727
39711
|
var SpaceMembersCmd = class extends ProfileCommand {
|
|
@@ -39732,9 +39716,9 @@ var SpaceMembersCmd = class extends ProfileCommand {
|
|
|
39732
39716
|
if (this.space !== void 0 && !this.space.trim()) throw new OperationInputError("listSpaceMembers", [{ path: ["spaceId"], reason: "too_small" }]);
|
|
39733
39717
|
const caller = await resolveCaller();
|
|
39734
39718
|
const spaces = await spacesFooterFromMemberships(caller);
|
|
39735
|
-
const
|
|
39736
|
-
if (!
|
|
39737
|
-
const members2 = await caller.query(membershipsListForSpace, { spaceId });
|
|
39719
|
+
const spaceId2 = this.space ? await resolveSpaceByNameC(caller, this.space) : Object.keys(spaces)[0];
|
|
39720
|
+
if (!spaceId2) throw new Error("No space found");
|
|
39721
|
+
const members2 = await caller.query(membershipsListForSpace, { spaceId: spaceId2 });
|
|
39738
39722
|
const data = checkedResult("listSpaceMembers", workspacePublicCliResults.listSpaceMembers, members2.map((m) => ({ userId: m.user?._id, name: m.user?.name, email: m.user?.email })));
|
|
39739
39723
|
this.emitText(
|
|
39740
39724
|
jsonWithSpaces({ data }, spaces),
|
|
@@ -40807,7 +40791,7 @@ var AgentAnalyze = class extends ClientCommand {
|
|
|
40807
40791
|
for (const t of errorThreads) lines.push(` \u2717 ${t.id}${t.message ? ` \u2014 ${t.message}` : ""}`);
|
|
40808
40792
|
lines.push("");
|
|
40809
40793
|
lines.push(`Failed tool calls by tool: ${rankedToolErrors.length === 0 ? "(none)" : ""}`);
|
|
40810
|
-
for (const [
|
|
40794
|
+
for (const [name4, count] of rankedToolErrors) lines.push(` ${count}\xD7 ${name4}`);
|
|
40811
40795
|
if (errorSamples.length) {
|
|
40812
40796
|
lines.push("", "Sample failures:");
|
|
40813
40797
|
for (const s of errorSamples) lines.push(` - ${s}`);
|
|
@@ -41730,8 +41714,8 @@ var canvasHtmlAliases = {
|
|
|
41730
41714
|
canvas_html_update: "updateCanvasHtmlPanel",
|
|
41731
41715
|
canvas_html_delete: "deleteCanvasHtmlPanel"
|
|
41732
41716
|
};
|
|
41733
|
-
function isCanvasHtmlOperationName(
|
|
41734
|
-
return Object.hasOwn(canvasHtmlInputs,
|
|
41717
|
+
function isCanvasHtmlOperationName(name4) {
|
|
41718
|
+
return Object.hasOwn(canvasHtmlInputs, name4);
|
|
41735
41719
|
}
|
|
41736
41720
|
var descriptions4 = {
|
|
41737
41721
|
listCanvasBoards: "List accessible persisted canvas boards for an existing entity.",
|
|
@@ -41741,31 +41725,31 @@ var descriptions4 = {
|
|
|
41741
41725
|
updateCanvasHtmlPanel: "Replace an HTML panel's title and source, optionally changing geometry. Echo both expectedVersion and expectedSourceHash from a fresh read; conflicts preserve current content.",
|
|
41742
41726
|
deleteCanvasHtmlPanel: "Delete an HTML panel only when both expectedVersion and expectedSourceHash match a fresh read."
|
|
41743
41727
|
};
|
|
41744
|
-
function definition2(
|
|
41745
|
-
const schema = external_exports.toJSONSchema(canvasHtmlInputs[
|
|
41728
|
+
function definition2(name4) {
|
|
41729
|
+
const schema = external_exports.toJSONSchema(canvasHtmlInputs[name4], { io: "input" });
|
|
41746
41730
|
return {
|
|
41747
|
-
name:
|
|
41748
|
-
aliases: operationAliases(canvasHtmlAliases,
|
|
41731
|
+
name: name4,
|
|
41732
|
+
aliases: operationAliases(canvasHtmlAliases, name4),
|
|
41749
41733
|
actor: "agent",
|
|
41750
|
-
description: descriptions4[
|
|
41734
|
+
description: descriptions4[name4],
|
|
41751
41735
|
inputSchema: { type: "object", properties: schema.properties ?? {}, required: schema.required ?? [], additionalProperties: false },
|
|
41752
41736
|
errorSchema: operationErrorSchema,
|
|
41753
|
-
resultSchema: operationResultSchema(canvasHtmlResults[
|
|
41754
|
-
outputSchema: { type: "object", properties: { data: operationResultSchema(canvasHtmlResults[
|
|
41755
|
-
capability:
|
|
41737
|
+
resultSchema: operationResultSchema(canvasHtmlResults[name4]),
|
|
41738
|
+
outputSchema: { type: "object", properties: { data: operationResultSchema(canvasHtmlResults[name4]) }, required: ["data"], additionalProperties: false },
|
|
41739
|
+
capability: name4 === "listCanvasBoards" || name4 === "listCanvasHtmlPanels" || name4 === "getCanvasHtmlPanel" ? "read" : "write",
|
|
41756
41740
|
executionProfile: "full",
|
|
41757
|
-
resultProjection:
|
|
41741
|
+
resultProjection: name4 === "listCanvasHtmlPanels" || name4 === "listCanvasBoards" ? "summary" : "full",
|
|
41758
41742
|
environment: "content",
|
|
41759
41743
|
availability: { hosted: true, external: true, browserHuman: false, agentConnection: true, executionProfiles: ["full", "public-cli"] },
|
|
41760
41744
|
resourcePolicy: {
|
|
41761
|
-
selector:
|
|
41745
|
+
selector: name4 === "listCanvasBoards" ? "entity" : "board",
|
|
41762
41746
|
space: "actual-board-space",
|
|
41763
41747
|
enforcement: "live-principal-in-protected-transaction"
|
|
41764
41748
|
},
|
|
41765
41749
|
limits: CANVAS_HTML_LIMITS
|
|
41766
41750
|
};
|
|
41767
41751
|
}
|
|
41768
|
-
var definitions3 = new Map(Object.keys(canvasHtmlInputs).filter(isCanvasHtmlOperationName).map((
|
|
41752
|
+
var definitions3 = new Map(Object.keys(canvasHtmlInputs).filter(isCanvasHtmlOperationName).map((name4) => [name4, definition2(name4)]));
|
|
41769
41753
|
var canvasHtmlCatalog = [...definitions3.values()];
|
|
41770
41754
|
|
|
41771
41755
|
// ente/canvasHtml.ts
|
|
@@ -41827,10 +41811,10 @@ async function deleteCanvasHtmlPanel(caller, boardId, elementId) {
|
|
|
41827
41811
|
}
|
|
41828
41812
|
|
|
41829
41813
|
// ente/commands/canvas.ts
|
|
41830
|
-
function numberFlag(value,
|
|
41814
|
+
function numberFlag(value, name4) {
|
|
41831
41815
|
if (value === void 0) return void 0;
|
|
41832
41816
|
const parsed = Number(value);
|
|
41833
|
-
if (!Number.isFinite(parsed)) throw new Error(`${
|
|
41817
|
+
if (!Number.isFinite(parsed)) throw new Error(`${name4} must be a finite number`);
|
|
41834
41818
|
return parsed;
|
|
41835
41819
|
}
|
|
41836
41820
|
var CanvasBoardsCmd = class extends ProfileCommand {
|
|
@@ -41938,8 +41922,276 @@ var CANVAS_COMMANDS = [
|
|
|
41938
41922
|
CanvasHtmlDeleteCmd
|
|
41939
41923
|
];
|
|
41940
41924
|
|
|
41925
|
+
// ente/commands/files.ts
|
|
41926
|
+
import path8 from "node:path";
|
|
41927
|
+
|
|
41928
|
+
// ente/entityFiles.ts
|
|
41929
|
+
import { readFileSync as readFileSync14, statSync } from "node:fs";
|
|
41930
|
+
import path7 from "node:path";
|
|
41931
|
+
|
|
41932
|
+
// ../packages/shared/src/entity-file-operation-results.ts
|
|
41933
|
+
var entityFolderLinkResultValidator = v2.object({ fileId: v2.string(), path: v2.string(), name: v2.string() });
|
|
41934
|
+
var entityFileItemValidator = v2.object({
|
|
41935
|
+
name: v2.string(),
|
|
41936
|
+
path: v2.string(),
|
|
41937
|
+
isFolder: v2.boolean(),
|
|
41938
|
+
size: v2.union(v2.number(), v2.null()),
|
|
41939
|
+
mimeType: v2.union(v2.string(), v2.null()),
|
|
41940
|
+
modifiedAt: v2.union(v2.number(), v2.null())
|
|
41941
|
+
});
|
|
41942
|
+
var ENTITY_FILE_LIST_PROBLEM_STATUSES = [
|
|
41943
|
+
"not_linked",
|
|
41944
|
+
"not_connected",
|
|
41945
|
+
"reconnect_required",
|
|
41946
|
+
"no_access",
|
|
41947
|
+
"folder_deleted",
|
|
41948
|
+
"unreachable",
|
|
41949
|
+
"unavailable"
|
|
41950
|
+
];
|
|
41951
|
+
var entityFileListResultValidator = v2.union(
|
|
41952
|
+
v2.object({ status: v2.literal("ok"), path: v2.string(), items: v2.array(entityFileItemValidator) }),
|
|
41953
|
+
v2.object({ status: v2.union(...ENTITY_FILE_LIST_PROBLEM_STATUSES.map((status2) => v2.literal(status2))) })
|
|
41954
|
+
);
|
|
41955
|
+
var entityFileUploadResultValidator = v2.object({ fileId: v2.string(), name: v2.string(), path: v2.string() });
|
|
41956
|
+
var entityFileResults = {
|
|
41957
|
+
createEntityFolder: entityFolderLinkResultValidator,
|
|
41958
|
+
linkEntityFolder: entityFolderLinkResultValidator,
|
|
41959
|
+
listEntityFiles: entityFileListResultValidator,
|
|
41960
|
+
uploadEntityFile: entityFileUploadResultValidator
|
|
41961
|
+
};
|
|
41962
|
+
function parseEntityFileResult(operation, raw) {
|
|
41963
|
+
return parseOperationResult(operation, entityFileResults[operation], raw, "Invalid entity file result from Ente");
|
|
41964
|
+
}
|
|
41965
|
+
|
|
41966
|
+
// ../packages/shared/src/entity-file-operations.ts
|
|
41967
|
+
var ENTITY_FILE_LIMITS = {
|
|
41968
|
+
/** Decoded bytes of an inline base64 upload. */
|
|
41969
|
+
base64DecodedBytes: 10 * 1024 * 1024,
|
|
41970
|
+
/** Characters of standard padded base64 for base64DecodedBytes. */
|
|
41971
|
+
base64Characters: Math.ceil(10 * 1024 * 1024 / 3) * 4,
|
|
41972
|
+
/** Any upload, including an activity attachment, as Nextcloud receives it. */
|
|
41973
|
+
uploadBytes: 20 * 1024 * 1024,
|
|
41974
|
+
nameCharacters: 250,
|
|
41975
|
+
pathCharacters: 4096,
|
|
41976
|
+
mimeTypeCharacters: 255
|
|
41977
|
+
};
|
|
41978
|
+
function base64DecodedByteLength(value) {
|
|
41979
|
+
const padding = value.endsWith("==") ? 2 : value.endsWith("=") ? 1 : 0;
|
|
41980
|
+
return value.length / 4 * 3 - padding;
|
|
41981
|
+
}
|
|
41982
|
+
var id17 = external_exports.string().min(1).max(128).refine((value) => value.trim() === value, "Copy IDs unchanged");
|
|
41983
|
+
var name3 = external_exports.string().min(1).max(ENTITY_FILE_LIMITS.nameCharacters).refine((value) => value.trim() === value, "Names must not start or end with a space");
|
|
41984
|
+
var path6 = (description) => external_exports.string().max(ENTITY_FILE_LIMITS.pathCharacters).describe(description);
|
|
41985
|
+
var base64Content = external_exports.string().max(ENTITY_FILE_LIMITS.base64Characters).regex(/^[A-Za-z0-9+/]*={0,2}$/, "Use standard base64 without a data: prefix").refine((value) => value.length % 4 === 0, "Use padded standard base64").refine((value) => base64DecodedByteLength(value) <= ENTITY_FILE_LIMITS.base64DecodedBytes, "Inline uploads are limited to 10 MiB").describe("Standard padded base64 of the file, at most 10 MiB decoded. Exactly one of base64Content or activityAttachment.");
|
|
41986
|
+
var activityAttachment = external_exports.strictObject({ activityId: id17, storageId: id17 }).describe("An existing attachment of an Ente activity you can read. Exactly one of base64Content or activityAttachment.");
|
|
41987
|
+
var spaceId = id17.optional().describe("Space whose Nextcloud the link belongs to. Optional when the entity has exactly one space with Nextcloud.");
|
|
41988
|
+
var entityFileInputs = {
|
|
41989
|
+
createEntityFolder: external_exports.strictObject({
|
|
41990
|
+
entityId: id17,
|
|
41991
|
+
parentPath: path6("Parent folder, relative to your Nextcloud root; empty string for the root."),
|
|
41992
|
+
name: name3,
|
|
41993
|
+
spaceId
|
|
41994
|
+
}),
|
|
41995
|
+
linkEntityFolder: external_exports.strictObject({
|
|
41996
|
+
entityId: id17,
|
|
41997
|
+
path: external_exports.string().max(ENTITY_FILE_LIMITS.pathCharacters).refine((value) => value.replace(/^\/+|\/+$/g, "") !== "", "Choose a folder, not the Nextcloud root").describe("Existing folder, relative to your Nextcloud root, for example Mandate/2026-017."),
|
|
41998
|
+
spaceId
|
|
41999
|
+
}),
|
|
42000
|
+
listEntityFiles: external_exports.strictObject({
|
|
42001
|
+
entityId: id17,
|
|
42002
|
+
path: path6("Folder inside the linked folder; omit or empty string for the linked folder itself.").optional()
|
|
42003
|
+
}),
|
|
42004
|
+
uploadEntityFile: external_exports.strictObject({
|
|
42005
|
+
entityId: id17,
|
|
42006
|
+
folderPath: path6("Target folder inside the linked folder; defaults to the linked folder itself.").optional(),
|
|
42007
|
+
name: name3,
|
|
42008
|
+
mimeType: external_exports.string().trim().min(1).max(ENTITY_FILE_LIMITS.mimeTypeCharacters),
|
|
42009
|
+
base64Content: base64Content.optional(),
|
|
42010
|
+
activityAttachment: activityAttachment.optional()
|
|
42011
|
+
}).superRefine((input2, ctx) => {
|
|
42012
|
+
if (input2.base64Content === void 0 === (input2.activityAttachment === void 0))
|
|
42013
|
+
ctx.addIssue({ code: "custom", path: ["base64Content"], message: "Provide exactly one of base64Content or activityAttachment" });
|
|
42014
|
+
})
|
|
42015
|
+
};
|
|
42016
|
+
var entityFileAliases = {
|
|
42017
|
+
entity_folder_create: "createEntityFolder",
|
|
42018
|
+
entity_folder_link: "linkEntityFolder",
|
|
42019
|
+
entity_files_list: "listEntityFiles",
|
|
42020
|
+
entity_file_upload: "uploadEntityFile"
|
|
42021
|
+
};
|
|
42022
|
+
function isEntityFileOperationName(value) {
|
|
42023
|
+
return Object.hasOwn(entityFileInputs, value);
|
|
42024
|
+
}
|
|
42025
|
+
var personalOnly = "Uses your own Nextcloud connection and is available only to your personal agent.";
|
|
42026
|
+
var descriptions5 = {
|
|
42027
|
+
createEntityFolder: `Create a new folder in your Nextcloud below parentPath and link it as the entity's file folder. ${personalOnly}`,
|
|
42028
|
+
linkEntityFolder: `Link an existing folder of your Nextcloud, given by its path, as the entity's file folder. A folder can belong to one entity only. ${personalOnly}`,
|
|
42029
|
+
listEntityFiles: `List the files and folders in the entity's linked Nextcloud folder. status explains a missing link or connection instead of an empty list. ${personalOnly}`,
|
|
42030
|
+
uploadEntityFile: `Upload a file into the entity's linked Nextcloud folder; a taken name gets a numbered suffix. Send exactly one of base64Content (at most 10 MiB decoded) or activityAttachment (an existing Ente activity attachment). ${personalOnly}`
|
|
42031
|
+
};
|
|
42032
|
+
function definition3(operationName) {
|
|
42033
|
+
const schema = external_exports.toJSONSchema(entityFileInputs[operationName], { io: "input" });
|
|
42034
|
+
return {
|
|
42035
|
+
name: operationName,
|
|
42036
|
+
aliases: operationAliases(entityFileAliases, operationName),
|
|
42037
|
+
actor: "agent",
|
|
42038
|
+
description: descriptions5[operationName],
|
|
42039
|
+
inputSchema: { type: "object", properties: schema.properties ?? {}, required: schema.required ?? [], additionalProperties: false },
|
|
42040
|
+
errorSchema: operationErrorSchema,
|
|
42041
|
+
resultSchema: operationResultSchema(entityFileResults[operationName]),
|
|
42042
|
+
outputSchema: { type: "object", properties: { data: operationResultSchema(entityFileResults[operationName]) }, required: ["data"], additionalProperties: false },
|
|
42043
|
+
capability: operationName === "listEntityFiles" ? "read" : "write",
|
|
42044
|
+
executionProfile: "full",
|
|
42045
|
+
resultProjection: "full",
|
|
42046
|
+
environment: "content",
|
|
42047
|
+
availability: { hosted: true, external: true, browserHuman: false, agentConnection: true, executionProfiles: ["full", "public-cli"], runtime: "action" },
|
|
42048
|
+
resourcePolicy: {
|
|
42049
|
+
selector: "entity",
|
|
42050
|
+
space: "entity-folder-link-space",
|
|
42051
|
+
identity: "personal-agent-own-nextcloud",
|
|
42052
|
+
enforcement: "live-principal-in-protected-transaction"
|
|
42053
|
+
},
|
|
42054
|
+
limits: ENTITY_FILE_LIMITS
|
|
42055
|
+
};
|
|
42056
|
+
}
|
|
42057
|
+
var definitions4 = new Map(Object.keys(entityFileInputs).filter(isEntityFileOperationName).map((operationName) => [operationName, definition3(operationName)]));
|
|
42058
|
+
var entityFileCatalog = [...definitions4.values()];
|
|
42059
|
+
|
|
42060
|
+
// ente/entityFiles.ts
|
|
42061
|
+
var createFolderRef = makeFunctionReference(
|
|
42062
|
+
"entityFileOperations:createFolder"
|
|
42063
|
+
);
|
|
42064
|
+
var linkFolderRef = makeFunctionReference(
|
|
42065
|
+
"entityFileOperations:linkFolder"
|
|
42066
|
+
);
|
|
42067
|
+
var listRef = makeFunctionReference(
|
|
42068
|
+
"entityFileOperations:list"
|
|
42069
|
+
);
|
|
42070
|
+
var uploadRef = makeFunctionReference(
|
|
42071
|
+
"entityFileOperations:upload"
|
|
42072
|
+
);
|
|
42073
|
+
async function createEntityFolder(caller, input2) {
|
|
42074
|
+
const args = parseOperationInput("createEntityFolder", entityFileInputs.createEntityFolder, input2);
|
|
42075
|
+
return parseEntityFileResult("createEntityFolder", await caller.action(createFolderRef, args));
|
|
42076
|
+
}
|
|
42077
|
+
async function linkEntityFolder(caller, input2) {
|
|
42078
|
+
const args = parseOperationInput("linkEntityFolder", entityFileInputs.linkEntityFolder, input2);
|
|
42079
|
+
return parseEntityFileResult("linkEntityFolder", await caller.action(linkFolderRef, args));
|
|
42080
|
+
}
|
|
42081
|
+
async function listEntityFiles(caller, input2) {
|
|
42082
|
+
const args = parseOperationInput("listEntityFiles", entityFileInputs.listEntityFiles, input2);
|
|
42083
|
+
return parseEntityFileResult("listEntityFiles", await caller.action(listRef, args));
|
|
42084
|
+
}
|
|
42085
|
+
async function uploadEntityFile(caller, input2) {
|
|
42086
|
+
const args = parseOperationInput("uploadEntityFile", entityFileInputs.uploadEntityFile, input2);
|
|
42087
|
+
return parseEntityFileResult("uploadEntityFile", await caller.action(uploadRef, args));
|
|
42088
|
+
}
|
|
42089
|
+
var MIME_TYPES2 = {
|
|
42090
|
+
".pdf": "application/pdf",
|
|
42091
|
+
".txt": "text/plain",
|
|
42092
|
+
".md": "text/markdown",
|
|
42093
|
+
".csv": "text/csv",
|
|
42094
|
+
".json": "application/json",
|
|
42095
|
+
".html": "text/html",
|
|
42096
|
+
".png": "image/png",
|
|
42097
|
+
".jpg": "image/jpeg",
|
|
42098
|
+
".jpeg": "image/jpeg",
|
|
42099
|
+
".gif": "image/gif",
|
|
42100
|
+
".webp": "image/webp",
|
|
42101
|
+
".svg": "image/svg+xml",
|
|
42102
|
+
".zip": "application/zip",
|
|
42103
|
+
".eml": "message/rfc822",
|
|
42104
|
+
".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
42105
|
+
".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
42106
|
+
".pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
42107
|
+
};
|
|
42108
|
+
function guessMimeType(fileName) {
|
|
42109
|
+
return MIME_TYPES2[path7.extname(fileName).toLowerCase()] ?? "application/octet-stream";
|
|
42110
|
+
}
|
|
42111
|
+
function readLocalFileAsBase64(filePath) {
|
|
42112
|
+
const size = statSync(filePath).size;
|
|
42113
|
+
if (size > ENTITY_FILE_LIMITS.base64DecodedBytes) {
|
|
42114
|
+
throw new Error(`${filePath} is ${size} bytes; inline uploads are limited to ${ENTITY_FILE_LIMITS.base64DecodedBytes} bytes (10 MiB). Attach it to an activity first and use --activity/--storage-id, or add it in Nextcloud directly.`);
|
|
42115
|
+
}
|
|
42116
|
+
return readFileSync14(filePath).toString("base64");
|
|
42117
|
+
}
|
|
42118
|
+
|
|
42119
|
+
// ente/commands/files.ts
|
|
42120
|
+
var FilesListCmd = class extends ProfileCommand {
|
|
42121
|
+
static paths = [["files", "list"]];
|
|
42122
|
+
static usage = Command.Usage({ category: "Files", description: "List the entity's linked Nextcloud folder (your own Nextcloud, personal agent only)" });
|
|
42123
|
+
entityId = options_exports.String({ required: true });
|
|
42124
|
+
folderPath = options_exports.String("--path", { description: "Folder inside the linked folder" });
|
|
42125
|
+
async run() {
|
|
42126
|
+
const data = await listEntityFiles(await resolveCaller(), { entityId: this.entityId, ...this.folderPath === void 0 ? {} : { path: this.folderPath } });
|
|
42127
|
+
this.emitText({ data }, () => data.status !== "ok" ? `Unavailable: ${data.status}` : data.items.length ? data.items.map((item) => `${item.isFolder ? "dir " : "file"} ${item.path}${item.size === null ? "" : ` ${item.size} B`}`).join("\n") : "Empty folder.");
|
|
42128
|
+
}
|
|
42129
|
+
};
|
|
42130
|
+
var FilesUploadCmd = class extends ProfileCommand {
|
|
42131
|
+
static paths = [["files", "upload"]];
|
|
42132
|
+
static usage = Command.Usage({
|
|
42133
|
+
category: "Files",
|
|
42134
|
+
description: "Upload a local file (at most 10 MiB) or an existing activity attachment into the entity's linked folder"
|
|
42135
|
+
});
|
|
42136
|
+
entityId = options_exports.String({ required: true });
|
|
42137
|
+
file = options_exports.String({ required: false, name: "file" });
|
|
42138
|
+
folder = options_exports.String("--folder", { description: "Target folder inside the linked folder" });
|
|
42139
|
+
name = options_exports.String("--name", { description: "File name in Nextcloud; defaults to the local file name" });
|
|
42140
|
+
mimeType = options_exports.String("--mime-type", { description: "Defaults to a guess from the file name" });
|
|
42141
|
+
activityId = options_exports.String("--activity", { description: "Activity whose attachment to copy (with --storage-id)" });
|
|
42142
|
+
storageId = options_exports.String("--storage-id", { description: "Storage ID of the activity attachment" });
|
|
42143
|
+
async run() {
|
|
42144
|
+
const fromAttachment = this.activityId !== void 0 || this.storageId !== void 0;
|
|
42145
|
+
if (fromAttachment === (this.file !== void 0)) throw new Error("Pass either a local file or --activity with --storage-id");
|
|
42146
|
+
if (fromAttachment && (!this.activityId || !this.storageId)) throw new Error("--activity and --storage-id belong together");
|
|
42147
|
+
const name4 = this.name ?? (this.file !== void 0 ? path8.basename(this.file) : void 0);
|
|
42148
|
+
if (!name4) throw new Error("--name is required when uploading an activity attachment");
|
|
42149
|
+
const data = await uploadEntityFile(await resolveCaller(), {
|
|
42150
|
+
entityId: this.entityId,
|
|
42151
|
+
...this.folder === void 0 ? {} : { folderPath: this.folder },
|
|
42152
|
+
name: name4,
|
|
42153
|
+
mimeType: this.mimeType ?? guessMimeType(name4),
|
|
42154
|
+
...this.file !== void 0 ? { base64Content: readLocalFileAsBase64(this.file) } : { activityAttachment: { activityId: this.activityId, storageId: this.storageId } }
|
|
42155
|
+
});
|
|
42156
|
+
this.emitText({ data }, () => `Uploaded ${data.path}`);
|
|
42157
|
+
}
|
|
42158
|
+
};
|
|
42159
|
+
var FilesLinkCmd = class extends ProfileCommand {
|
|
42160
|
+
static paths = [["files", "link"]];
|
|
42161
|
+
static usage = Command.Usage({ category: "Files", description: "Link an existing folder of your Nextcloud to the entity" });
|
|
42162
|
+
entityId = options_exports.String({ required: true });
|
|
42163
|
+
folderPath = options_exports.String({ required: true, name: "nextcloud-path" });
|
|
42164
|
+
spaceId = options_exports.String("--space", { description: "Space whose Nextcloud to use when the entity has several" });
|
|
42165
|
+
async run() {
|
|
42166
|
+
const data = await linkEntityFolder(await resolveCaller(), {
|
|
42167
|
+
entityId: this.entityId,
|
|
42168
|
+
path: this.folderPath,
|
|
42169
|
+
...this.spaceId === void 0 ? {} : { spaceId: this.spaceId }
|
|
42170
|
+
});
|
|
42171
|
+
this.emitText({ data }, () => `Linked ${data.path}`);
|
|
42172
|
+
}
|
|
42173
|
+
};
|
|
42174
|
+
var FilesCreateFolderCmd = class extends ProfileCommand {
|
|
42175
|
+
static paths = [["files", "create-folder"]];
|
|
42176
|
+
static usage = Command.Usage({ category: "Files", description: "Create a folder in your Nextcloud and link it to the entity" });
|
|
42177
|
+
entityId = options_exports.String({ required: true });
|
|
42178
|
+
name = options_exports.String({ required: true, name: "name" });
|
|
42179
|
+
parent = options_exports.String("--parent", "", { description: "Parent folder relative to your Nextcloud root (default: root)" });
|
|
42180
|
+
spaceId = options_exports.String("--space", { description: "Space whose Nextcloud to use when the entity has several" });
|
|
42181
|
+
async run() {
|
|
42182
|
+
const data = await createEntityFolder(await resolveCaller(), {
|
|
42183
|
+
entityId: this.entityId,
|
|
42184
|
+
parentPath: this.parent,
|
|
42185
|
+
name: this.name,
|
|
42186
|
+
...this.spaceId === void 0 ? {} : { spaceId: this.spaceId }
|
|
42187
|
+
});
|
|
42188
|
+
this.emitText({ data }, () => `Created and linked ${data.path}`);
|
|
42189
|
+
}
|
|
42190
|
+
};
|
|
42191
|
+
var FILES_COMMANDS = [FilesListCmd, FilesUploadCmd, FilesLinkCmd, FilesCreateFolderCmd];
|
|
42192
|
+
|
|
41941
42193
|
// ente/commands/notification.ts
|
|
41942
|
-
import { readFileSync as
|
|
42194
|
+
import { readFileSync as readFileSync15 } from "node:fs";
|
|
41943
42195
|
|
|
41944
42196
|
// ente/notificationEmailContract.ts
|
|
41945
42197
|
var NOTIFICATION_EMAIL_CLI_SURFACE = {
|
|
@@ -41973,7 +42225,7 @@ var CLI_LIMITS = NOTIFICATION_EMAIL_CLI_SURFACE.limits;
|
|
|
41973
42225
|
function readBody(inline, file2, label) {
|
|
41974
42226
|
if (inline !== void 0 && file2 !== void 0)
|
|
41975
42227
|
throw new Error(`notification send: use either --${label} or --${label}-file, not both.`);
|
|
41976
|
-
const value = file2 !== void 0 ?
|
|
42228
|
+
const value = file2 !== void 0 ? readFileSync15(file2, "utf8") : inline;
|
|
41977
42229
|
if (value !== void 0 && !value.trim())
|
|
41978
42230
|
throw new Error(`notification send: ${label} body must not be empty.`);
|
|
41979
42231
|
return value;
|
|
@@ -41991,20 +42243,20 @@ function readNotificationEmailAttachments(imagePaths = [], inlineImageSpecs = []
|
|
|
41991
42243
|
commandLabel: "notification send"
|
|
41992
42244
|
});
|
|
41993
42245
|
const attachments = [
|
|
41994
|
-
...imagePaths.map((
|
|
42246
|
+
...imagePaths.map((path9) => readOutgoingEmailAttachment(path9, {
|
|
41995
42247
|
maxBytes: CLI_LIMITS.maxAttachmentBytes,
|
|
41996
42248
|
maxFilenameLength: CLI_LIMITS.maxFilenameLength,
|
|
41997
42249
|
requireImage: true,
|
|
41998
42250
|
commandLabel: "notification send"
|
|
41999
42251
|
})),
|
|
42000
|
-
...inlineImages.map(({ contentId, path:
|
|
42252
|
+
...inlineImages.map(({ contentId, path: path9 }) => readOutgoingEmailAttachment(path9, {
|
|
42001
42253
|
maxBytes: CLI_LIMITS.maxAttachmentBytes,
|
|
42002
42254
|
maxFilenameLength: CLI_LIMITS.maxFilenameLength,
|
|
42003
42255
|
contentId,
|
|
42004
42256
|
requireImage: true,
|
|
42005
42257
|
commandLabel: "notification send"
|
|
42006
42258
|
})),
|
|
42007
|
-
...attachmentPaths.map((
|
|
42259
|
+
...attachmentPaths.map((path9) => readOutgoingEmailAttachment(path9, {
|
|
42008
42260
|
maxBytes: CLI_LIMITS.maxAttachmentBytes,
|
|
42009
42261
|
maxFilenameLength: CLI_LIMITS.maxFilenameLength,
|
|
42010
42262
|
commandLabel: "notification send"
|
|
@@ -42274,7 +42526,7 @@ function parseUserMailboxRequest(input2) {
|
|
|
42274
42526
|
|
|
42275
42527
|
// ente/commands/agentMail.ts
|
|
42276
42528
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
42277
|
-
import { readFileSync as
|
|
42529
|
+
import { readFileSync as readFileSync16 } from "node:fs";
|
|
42278
42530
|
|
|
42279
42531
|
// ente/agentMailContract.ts
|
|
42280
42532
|
var AGENT_MAIL_CLI_SURFACE = {
|
|
@@ -42330,11 +42582,11 @@ function agentMailInlineReferenceError(html2, attachments) {
|
|
|
42330
42582
|
const styles = [];
|
|
42331
42583
|
for (const tag of tags) {
|
|
42332
42584
|
for (const match of tag.matchAll(/\s+([a-z_:][a-z\d_:.-]*)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+))/giu)) {
|
|
42333
|
-
const
|
|
42585
|
+
const name4 = match[1].toLowerCase();
|
|
42334
42586
|
const value = match[2] ?? match[3] ?? match[4];
|
|
42335
|
-
if (["src", "href", "background", "poster"].includes(
|
|
42336
|
-
if (
|
|
42337
|
-
if (
|
|
42587
|
+
if (["src", "href", "background", "poster"].includes(name4)) urls.push(value);
|
|
42588
|
+
if (name4 === "srcset") urls.push(...value.split(/[,\s]+/u));
|
|
42589
|
+
if (name4 === "style") styles.push(value);
|
|
42338
42590
|
}
|
|
42339
42591
|
}
|
|
42340
42592
|
styles.push(...Array.from(
|
|
@@ -42359,7 +42611,7 @@ function agentMailInlineReferenceError(html2, attachments) {
|
|
|
42359
42611
|
|
|
42360
42612
|
// ente/mailAttachmentDownload.ts
|
|
42361
42613
|
import { createHash as createHash4, randomBytes as randomBytes2 } from "node:crypto";
|
|
42362
|
-
import { linkSync, renameSync, statSync, unlinkSync, writeFileSync as writeFileSync7 } from "node:fs";
|
|
42614
|
+
import { linkSync, renameSync, statSync as statSync2, unlinkSync, writeFileSync as writeFileSync7 } from "node:fs";
|
|
42363
42615
|
import { basename as basename3, dirname, extname as extname2, join, resolve } from "node:path";
|
|
42364
42616
|
var MAX_FILENAME_BYTES = 200;
|
|
42365
42617
|
var WINDOWS_RESERVED = /^(con|prn|aux|nul|com\d|lpt\d)(\..*)?$/iu;
|
|
@@ -42371,8 +42623,8 @@ function truncateUtf8(value, maxBytes) {
|
|
|
42371
42623
|
}
|
|
42372
42624
|
return out;
|
|
42373
42625
|
}
|
|
42374
|
-
function safeAttachmentFilename(
|
|
42375
|
-
const leaf =
|
|
42626
|
+
function safeAttachmentFilename(name4, attachmentId) {
|
|
42627
|
+
const leaf = name4.split(/[\\/]/u).pop() ?? "";
|
|
42376
42628
|
let clean = leaf.normalize("NFC").replace(/[\u0000-\u001f\u007f-\u009f---<>:"|?*]/gu, "_").replace(/\s+/gu, " ").trim().replace(/^[.\s]+/u, "").replace(/[.\s]+$/u, "");
|
|
42377
42629
|
if (WINDOWS_RESERVED.test(clean)) clean = `_${clean}`;
|
|
42378
42630
|
if (Buffer.byteLength(clean) > MAX_FILENAME_BYTES) {
|
|
@@ -42393,13 +42645,13 @@ function resolveAttachmentTarget(input2) {
|
|
|
42393
42645
|
if (input2.output !== void 0) {
|
|
42394
42646
|
if (!input2.output.trim()) throw new Error("agent mail attachment: --output must be a file path.");
|
|
42395
42647
|
const target2 = resolve(input2.output);
|
|
42396
|
-
if (
|
|
42648
|
+
if (statSync2(target2, { throwIfNoEntry: false })?.isDirectory()) {
|
|
42397
42649
|
throw new Error("agent mail attachment: --output is a directory; use --output-dir.");
|
|
42398
42650
|
}
|
|
42399
42651
|
return target2;
|
|
42400
42652
|
}
|
|
42401
42653
|
const dir = resolve(input2.outputDir ?? ".");
|
|
42402
|
-
if (!
|
|
42654
|
+
if (!statSync2(dir, { throwIfNoEntry: false })?.isDirectory()) {
|
|
42403
42655
|
throw new Error(`agent mail attachment: output directory does not exist: ${dir}`);
|
|
42404
42656
|
}
|
|
42405
42657
|
return join(dir, safeAttachmentFilename(input2.filename, input2.attachmentId));
|
|
@@ -42474,7 +42726,7 @@ function readBody2(inline, file2, label) {
|
|
|
42474
42726
|
if (inline !== void 0 && file2 !== void 0) {
|
|
42475
42727
|
throw new Error(`agent mail: use either --${label} or --${label}-file, not both.`);
|
|
42476
42728
|
}
|
|
42477
|
-
const value = file2 === void 0 ? inline :
|
|
42729
|
+
const value = file2 === void 0 ? inline : readFileSync16(file2, "utf8");
|
|
42478
42730
|
if (value !== void 0 && !value.trim()) {
|
|
42479
42731
|
throw new Error(`agent mail: ${label} body must not be empty.`);
|
|
42480
42732
|
}
|
|
@@ -42504,14 +42756,14 @@ function readAgentMailBodies(options) {
|
|
|
42504
42756
|
);
|
|
42505
42757
|
}
|
|
42506
42758
|
const attachments = [
|
|
42507
|
-
...inlineImages.map(({ path:
|
|
42759
|
+
...inlineImages.map(({ path: path9, contentId }) => readOutgoingEmailAttachment(path9, {
|
|
42508
42760
|
maxBytes: AGENT_MAIL_CLI_SURFACE.limits.maxAttachmentBytes,
|
|
42509
42761
|
maxFilenameLength: AGENT_MAIL_CLI_SURFACE.limits.maxFilenameLength,
|
|
42510
42762
|
contentId,
|
|
42511
42763
|
requireImage: true,
|
|
42512
42764
|
commandLabel: "agent mail"
|
|
42513
42765
|
})),
|
|
42514
|
-
...paths.map((
|
|
42766
|
+
...paths.map((path9) => readOutgoingEmailAttachment(path9, {
|
|
42515
42767
|
maxBytes: AGENT_MAIL_CLI_SURFACE.limits.maxAttachmentBytes,
|
|
42516
42768
|
maxFilenameLength: AGENT_MAIL_CLI_SURFACE.limits.maxFilenameLength,
|
|
42517
42769
|
commandLabel: "agent mail"
|
|
@@ -42767,7 +43019,7 @@ var UserMailboxCommand = class extends ClientCommand {
|
|
|
42767
43019
|
requestFile = options_exports.String("--request-file", { description: "Read the complete operation JSON from a file" });
|
|
42768
43020
|
async run() {
|
|
42769
43021
|
if (this.request === void 0 === (this.requestFile === void 0)) throw new Error("Use exactly one of --request or --request-file");
|
|
42770
|
-
const parsed = parseUserMailboxRequest(JSON.parse(this.request ??
|
|
43022
|
+
const parsed = parseUserMailboxRequest(JSON.parse(this.request ?? readFileSync16(this.requestFile, "utf8")));
|
|
42771
43023
|
if ("error" in parsed) throw new Error(parsed.error);
|
|
42772
43024
|
const result = await this.client().userMailbox(parsed.value);
|
|
42773
43025
|
this.emitText(result, () => JSON.stringify(result.data, null, 2));
|
|
@@ -42815,6 +43067,7 @@ for (const Cmd of [
|
|
|
42815
43067
|
...FEEDBACK_COMMANDS,
|
|
42816
43068
|
...GUIDE_COMMANDS,
|
|
42817
43069
|
...CANVAS_COMMANDS,
|
|
43070
|
+
...FILES_COMMANDS,
|
|
42818
43071
|
...NOTIFICATION_COMMANDS,
|
|
42819
43072
|
...AGENT_MAIL_COMMANDS,
|
|
42820
43073
|
...AGENT_TASK_COMMANDS
|