ente-cli 0.4.141 → 0.4.143
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 +75 -22
- package/dist/SKILL.md +156 -58
- package/dist/cli.mjs +1171 -319
- package/dist/cli.mjs.map +4 -4
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -3183,12 +3183,12 @@ var init_query_impl = __esm({
|
|
|
3183
3183
|
}
|
|
3184
3184
|
const query = this.takeQuery();
|
|
3185
3185
|
const pageSize = paginationOpts.numItems;
|
|
3186
|
-
const
|
|
3186
|
+
const cursor2 = paginationOpts.cursor;
|
|
3187
3187
|
const endCursor = paginationOpts?.endCursor ?? null;
|
|
3188
3188
|
const maximumRowsRead = paginationOpts.maximumRowsRead ?? null;
|
|
3189
3189
|
const { page: page3, isDone, continueCursor, splitCursor, pageStatus } = await performAsyncSyscall("1.0/queryPage", {
|
|
3190
3190
|
query,
|
|
3191
|
-
cursor:
|
|
3191
|
+
cursor: cursor2,
|
|
3192
3192
|
endCursor,
|
|
3193
3193
|
pageSize,
|
|
3194
3194
|
maximumRowsRead,
|
|
@@ -4252,12 +4252,12 @@ var init_cron = __esm({
|
|
|
4252
4252
|
* @param args - The arguments to the function.
|
|
4253
4253
|
*/
|
|
4254
4254
|
monthly(cronIdentifier, schedule, functionReference, ...args) {
|
|
4255
|
-
const
|
|
4255
|
+
const day2 = validatedDayOfMonth(schedule.day);
|
|
4256
4256
|
const hourUTC = validatedHourOfDay(schedule.hourUTC);
|
|
4257
4257
|
const minuteUTC = validatedOptionalMinuteOfHour(schedule.minuteUTC);
|
|
4258
4258
|
this.schedule(
|
|
4259
4259
|
cronIdentifier,
|
|
4260
|
-
minuteUTC === void 0 ? { day, hourUTC, type: "monthly" } : { day, hourUTC, minuteUTC, type: "monthly" },
|
|
4260
|
+
minuteUTC === void 0 ? { day: day2, hourUTC, type: "monthly" } : { day: day2, hourUTC, minuteUTC, type: "monthly" },
|
|
4261
4261
|
functionReference,
|
|
4262
4262
|
...args
|
|
4263
4263
|
);
|
|
@@ -4490,8 +4490,8 @@ function createEnvRefs(ownerLabel, declared) {
|
|
|
4490
4490
|
function isEnvRef(value) {
|
|
4491
4491
|
return typeof value === "object" && value !== null && typeof value.__envVarRef === "string";
|
|
4492
4492
|
}
|
|
4493
|
-
function use(
|
|
4494
|
-
const importedComponentDefinition =
|
|
4493
|
+
function use(definition7, options) {
|
|
4494
|
+
const importedComponentDefinition = definition7;
|
|
4495
4495
|
if (typeof importedComponentDefinition.componentDefinitionPath !== "string") {
|
|
4496
4496
|
throw new Error(
|
|
4497
4497
|
"Component definition does not have the required componentDefinitionPath property. This code only works in Convex runtime."
|
|
@@ -4530,7 +4530,7 @@ function use(definition6, options) {
|
|
|
4530
4530
|
envValues,
|
|
4531
4531
|
httpPrefix
|
|
4532
4532
|
]);
|
|
4533
|
-
return new InstalledComponent(
|
|
4533
|
+
return new InstalledComponent(definition7, name4);
|
|
4534
4534
|
}
|
|
4535
4535
|
function exportAppForAnalysis() {
|
|
4536
4536
|
const definitionType = { type: "app" };
|
|
@@ -4582,7 +4582,7 @@ function buildHttpMounts(childComponents) {
|
|
|
4582
4582
|
return httpMounts;
|
|
4583
4583
|
}
|
|
4584
4584
|
function serializeChildComponents(childComponents) {
|
|
4585
|
-
return childComponents.map(([name4,
|
|
4585
|
+
return childComponents.map(([name4, definition7, p]) => {
|
|
4586
4586
|
let env = null;
|
|
4587
4587
|
if (p !== null) {
|
|
4588
4588
|
env = [];
|
|
@@ -4601,10 +4601,10 @@ function serializeChildComponents(childComponents) {
|
|
|
4601
4601
|
}
|
|
4602
4602
|
}
|
|
4603
4603
|
}
|
|
4604
|
-
const path12 =
|
|
4604
|
+
const path12 = definition7.componentDefinitionPath;
|
|
4605
4605
|
if (!path12)
|
|
4606
4606
|
throw new Error(
|
|
4607
|
-
"no .componentPath for component definition " + JSON.stringify(
|
|
4607
|
+
"no .componentPath for component definition " + JSON.stringify(definition7, null, 2)
|
|
4608
4608
|
);
|
|
4609
4609
|
return {
|
|
4610
4610
|
name: name4,
|
|
@@ -4736,10 +4736,10 @@ var init_components = __esm({
|
|
|
4736
4736
|
__defNormalProp14 = (obj, key, value) => key in obj ? __defProp15(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4737
4737
|
__publicField14 = (obj, key, value) => __defNormalProp14(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4738
4738
|
InstalledComponent = class {
|
|
4739
|
-
constructor(
|
|
4739
|
+
constructor(definition7, name4) {
|
|
4740
4740
|
__publicField14(this, "_definition");
|
|
4741
4741
|
__publicField14(this, "_name");
|
|
4742
|
-
this._definition =
|
|
4742
|
+
this._definition = definition7;
|
|
4743
4743
|
this._name = name4;
|
|
4744
4744
|
setReferencePath(this, `_reference/childComponent/${name4}`);
|
|
4745
4745
|
}
|
|
@@ -5116,7 +5116,7 @@ var init_schema = __esm({
|
|
|
5116
5116
|
*/
|
|
5117
5117
|
export() {
|
|
5118
5118
|
return JSON.stringify({
|
|
5119
|
-
tables: Object.entries(this.tables).map(([tableName,
|
|
5119
|
+
tables: Object.entries(this.tables).map(([tableName, definition7]) => {
|
|
5120
5120
|
const {
|
|
5121
5121
|
indexes,
|
|
5122
5122
|
stagedDbIndexes,
|
|
@@ -5126,7 +5126,7 @@ var init_schema = __esm({
|
|
|
5126
5126
|
stagedVectorIndexes,
|
|
5127
5127
|
documentType,
|
|
5128
5128
|
stagedDocumentType
|
|
5129
|
-
} =
|
|
5129
|
+
} = definition7.export();
|
|
5130
5130
|
return {
|
|
5131
5131
|
tableName,
|
|
5132
5132
|
indexes,
|
|
@@ -5982,11 +5982,11 @@ var CommandBuilder = class {
|
|
|
5982
5982
|
const args = [];
|
|
5983
5983
|
for (let t = 0; t < arity; ++t)
|
|
5984
5984
|
args.push(` #${t}`);
|
|
5985
|
-
const
|
|
5985
|
+
const definition7 = `${nameSet.join(`,`)}${args.join(``)}`;
|
|
5986
5986
|
if (!inlineOptions && description) {
|
|
5987
|
-
detailedOptionList.push({ preferredName, nameSet, definition:
|
|
5987
|
+
detailedOptionList.push({ preferredName, nameSet, definition: definition7, description, required: required2 });
|
|
5988
5988
|
} else {
|
|
5989
|
-
segments.push(required2 ? `<${
|
|
5989
|
+
segments.push(required2 ? `<${definition7}>` : `[${definition7}]`);
|
|
5990
5990
|
}
|
|
5991
5991
|
}
|
|
5992
5992
|
segments.push(...this.arity.leading.map((name4) => `<${name4}>`));
|
|
@@ -6192,25 +6192,25 @@ var textFormat = {
|
|
|
6192
6192
|
error: (str) => str,
|
|
6193
6193
|
code: (str) => str
|
|
6194
6194
|
};
|
|
6195
|
-
function dedent(
|
|
6196
|
-
const lines =
|
|
6195
|
+
function dedent(text4) {
|
|
6196
|
+
const lines = text4.split(`
|
|
6197
6197
|
`);
|
|
6198
6198
|
const nonEmptyLines = lines.filter((line) => line.match(/\S/));
|
|
6199
6199
|
const indent = nonEmptyLines.length > 0 ? nonEmptyLines.reduce((minLength, line) => Math.min(minLength, line.length - line.trimStart().length), Number.MAX_VALUE) : 0;
|
|
6200
6200
|
return lines.map((line) => line.slice(indent).trimRight()).join(`
|
|
6201
6201
|
`);
|
|
6202
6202
|
}
|
|
6203
|
-
function formatMarkdownish(
|
|
6204
|
-
|
|
6203
|
+
function formatMarkdownish(text4, { format, paragraphs }) {
|
|
6204
|
+
text4 = text4.replace(/\r\n?/g, `
|
|
6205
6205
|
`);
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6206
|
+
text4 = dedent(text4);
|
|
6207
|
+
text4 = text4.replace(/^\n+|\n+$/g, ``);
|
|
6208
|
+
text4 = text4.replace(/^(\s*)-([^\n]*?)\n+/gm, `$1-$2
|
|
6209
6209
|
|
|
6210
6210
|
`);
|
|
6211
|
-
|
|
6211
|
+
text4 = text4.replace(/\n(\n)?\n*/g, ($0, $1) => $1 ? $1 : ` `);
|
|
6212
6212
|
if (paragraphs) {
|
|
6213
|
-
|
|
6213
|
+
text4 = text4.split(/\n/).map((paragraph) => {
|
|
6214
6214
|
const bulletMatch = paragraph.match(/^\s*[*-][\t ]+(.*)/);
|
|
6215
6215
|
if (!bulletMatch)
|
|
6216
6216
|
return paragraph.match(/(.{1,80})(?: |$)/g).join(`
|
|
@@ -6224,13 +6224,13 @@ function formatMarkdownish(text3, { format, paragraphs }) {
|
|
|
6224
6224
|
|
|
6225
6225
|
`);
|
|
6226
6226
|
}
|
|
6227
|
-
|
|
6227
|
+
text4 = text4.replace(/(`+)((?:.|[\n])*?)\1/g, ($0, $1, $2) => {
|
|
6228
6228
|
return format.code($1 + $2 + $1);
|
|
6229
6229
|
});
|
|
6230
|
-
|
|
6230
|
+
text4 = text4.replace(/(\*\*)((?:.|[\n])*?)\1/g, ($0, $1, $2) => {
|
|
6231
6231
|
return format.bold($1 + $2 + $1);
|
|
6232
6232
|
});
|
|
6233
|
-
return
|
|
6233
|
+
return text4 ? `${text4}
|
|
6234
6234
|
` : ``;
|
|
6235
6235
|
}
|
|
6236
6236
|
|
|
@@ -6331,8 +6331,8 @@ var Cli = class _Cli {
|
|
|
6331
6331
|
for (const path12 of paths)
|
|
6332
6332
|
builder.addPath(path12);
|
|
6333
6333
|
this.registrations.set(commandClass, { specs, builder, index });
|
|
6334
|
-
for (const [key, { definition:
|
|
6335
|
-
|
|
6334
|
+
for (const [key, { definition: definition7 }] of specs.entries())
|
|
6335
|
+
definition7(builder, key);
|
|
6336
6336
|
builder.setContext({
|
|
6337
6337
|
commandClass
|
|
6338
6338
|
});
|
|
@@ -6355,16 +6355,16 @@ var Cli = class _Cli {
|
|
|
6355
6355
|
default:
|
|
6356
6356
|
{
|
|
6357
6357
|
const { commandClass } = contexts[state.selectedIndex];
|
|
6358
|
-
const
|
|
6359
|
-
if (typeof
|
|
6358
|
+
const record3 = this.registrations.get(commandClass);
|
|
6359
|
+
if (typeof record3 === `undefined`)
|
|
6360
6360
|
throw new Error(`Assertion failed: Expected the command class to have been registered.`);
|
|
6361
6361
|
const command = new commandClass();
|
|
6362
6362
|
command.context = context;
|
|
6363
6363
|
command.tokens = state.tokens;
|
|
6364
6364
|
command.path = state.path;
|
|
6365
6365
|
try {
|
|
6366
|
-
for (const [key, { transformer }] of
|
|
6367
|
-
command[key] = transformer(
|
|
6366
|
+
for (const [key, { transformer }] of record3.specs.entries())
|
|
6367
|
+
command[key] = transformer(record3.builder, key, state, context);
|
|
6368
6368
|
return command;
|
|
6369
6369
|
} catch (error62) {
|
|
6370
6370
|
error62[errorCommandSymbol] = command;
|
|
@@ -6563,8 +6563,8 @@ var Cli = class _Cli {
|
|
|
6563
6563
|
}, 0);
|
|
6564
6564
|
result += `
|
|
6565
6565
|
`;
|
|
6566
|
-
for (const { definition:
|
|
6567
|
-
result += ` ${this.format(colored).bold(
|
|
6566
|
+
for (const { definition: definition7, description: description2 } of options) {
|
|
6567
|
+
result += ` ${this.format(colored).bold(definition7.padEnd(maxDefinitionLength))} ${formatMarkdownish(description2, { format: this.format(colored), paragraphs: false })}`;
|
|
6568
6568
|
}
|
|
6569
6569
|
}
|
|
6570
6570
|
if (details !== ``) {
|
|
@@ -6624,10 +6624,10 @@ var Cli = class _Cli {
|
|
|
6624
6624
|
return ((_a5 = colored !== null && colored !== void 0 ? colored : this.enableColors) !== null && _a5 !== void 0 ? _a5 : _Cli.defaultContext.colorDepth > 1) ? richFormat : textFormat;
|
|
6625
6625
|
}
|
|
6626
6626
|
getUsageByRegistration(klass, opts) {
|
|
6627
|
-
const
|
|
6628
|
-
if (typeof
|
|
6627
|
+
const record3 = this.registrations.get(klass);
|
|
6628
|
+
if (typeof record3 === `undefined`)
|
|
6629
6629
|
throw new Error(`Assertion failed: Unregistered command`);
|
|
6630
|
-
return this.getUsageByIndex(
|
|
6630
|
+
return this.getUsageByIndex(record3.index, opts);
|
|
6631
6631
|
}
|
|
6632
6632
|
getUsageByIndex(n, opts) {
|
|
6633
6633
|
return this.builder.getBuilderByIndex(n).usage(opts);
|
|
@@ -17451,8 +17451,8 @@ function ko_default() {
|
|
|
17451
17451
|
}
|
|
17452
17452
|
|
|
17453
17453
|
// ../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/lt.js
|
|
17454
|
-
var capitalizeFirstCharacter = (
|
|
17455
|
-
return
|
|
17454
|
+
var capitalizeFirstCharacter = (text4) => {
|
|
17455
|
+
return text4.charAt(0).toUpperCase() + text4.slice(1);
|
|
17456
17456
|
};
|
|
17457
17457
|
function getUnitTypeFromNumber(number5) {
|
|
17458
17458
|
const abs = Math.abs(number5);
|
|
@@ -24306,8 +24306,8 @@ var contributors = {
|
|
|
24306
24306
|
function aggregateChecks(schema) {
|
|
24307
24307
|
const agg = {};
|
|
24308
24308
|
const def = schema._zod.def;
|
|
24309
|
-
const
|
|
24310
|
-
for (const ch of
|
|
24309
|
+
const list3 = schema._zod.traits.has("$ZodCheck") ? [schema, ...def.checks ?? []] : def.checks ?? [];
|
|
24310
|
+
for (const ch of list3)
|
|
24311
24311
|
contributors[ch._zod.def.check]?.(agg, ch._zod.def);
|
|
24312
24312
|
const bag = schema._zod.bag;
|
|
24313
24313
|
if (bag.minimum !== void 0)
|
|
@@ -24754,8 +24754,8 @@ function rewriteKeyNames(ctx) {
|
|
|
24754
24754
|
bySchema.set(entry.schema, entry);
|
|
24755
24755
|
}
|
|
24756
24756
|
const rewrites = /* @__PURE__ */ new Map();
|
|
24757
|
-
for (const
|
|
24758
|
-
const seen = ctx.seen.get(
|
|
24757
|
+
for (const record3 of pendingRecords.get(ctx) ?? []) {
|
|
24758
|
+
const seen = ctx.seen.get(record3);
|
|
24759
24759
|
const names = (seen?.def ?? seen?.schema)?.propertyNames;
|
|
24760
24760
|
if (!names || names === true || rewrites.has(names))
|
|
24761
24761
|
continue;
|
|
@@ -27925,22 +27925,22 @@ function isNullableDeadlineInput(value) {
|
|
|
27925
27925
|
return value === null || isDeadlineInput(value);
|
|
27926
27926
|
}
|
|
27927
27927
|
function readableDateTimeToEpochMs(input2, fieldName) {
|
|
27928
|
-
const { year, month, day } = parseDate(input2.date, fieldName);
|
|
27928
|
+
const { year, month, day: day2 } = parseDate(input2.date, fieldName);
|
|
27929
27929
|
const { hour, minute } = input2.time === void 0 || input2.time === null ? { hour: 0, minute: 0 } : parseTime(input2.time, fieldName);
|
|
27930
27930
|
const timezone = validateTimeZone(input2.timezone ?? DEFAULT_DEADLINE_TIME_ZONE, fieldName);
|
|
27931
|
-
return zonedWallTimeToUtcMs({ year, month, day, hour, minute, timezone });
|
|
27931
|
+
return zonedWallTimeToUtcMs({ year, month, day: day2, hour, minute, timezone });
|
|
27932
27932
|
}
|
|
27933
27933
|
function parseDate(value, fieldName) {
|
|
27934
27934
|
const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
|
|
27935
27935
|
if (!match) throw new Error(`${fieldName}.date must use YYYY-MM-DD format`);
|
|
27936
27936
|
const year = Number(match[1]);
|
|
27937
27937
|
const month = Number(match[2]);
|
|
27938
|
-
const
|
|
27939
|
-
const roundTrip = new Date(Date.UTC(year, month - 1,
|
|
27940
|
-
if (roundTrip.getUTCFullYear() !== year || roundTrip.getUTCMonth() !== month - 1 || roundTrip.getUTCDate() !==
|
|
27938
|
+
const day2 = Number(match[3]);
|
|
27939
|
+
const roundTrip = new Date(Date.UTC(year, month - 1, day2));
|
|
27940
|
+
if (roundTrip.getUTCFullYear() !== year || roundTrip.getUTCMonth() !== month - 1 || roundTrip.getUTCDate() !== day2) {
|
|
27941
27941
|
throw new Error(`${fieldName}.date is not a valid calendar date`);
|
|
27942
27942
|
}
|
|
27943
|
-
return { year, month, day };
|
|
27943
|
+
return { year, month, day: day2 };
|
|
27944
27944
|
}
|
|
27945
27945
|
function parseTime(value, fieldName) {
|
|
27946
27946
|
const match = /^(\d{2}):(\d{2})$/.exec(value);
|
|
@@ -27961,12 +27961,12 @@ function validateTimeZone(timezone, fieldName) {
|
|
|
27961
27961
|
function zonedWallTimeToUtcMs({
|
|
27962
27962
|
year,
|
|
27963
27963
|
month,
|
|
27964
|
-
day,
|
|
27964
|
+
day: day2,
|
|
27965
27965
|
hour,
|
|
27966
27966
|
minute,
|
|
27967
27967
|
timezone
|
|
27968
27968
|
}) {
|
|
27969
|
-
const wallTimeAsUtc = Date.UTC(year, month - 1,
|
|
27969
|
+
const wallTimeAsUtc = Date.UTC(year, month - 1, day2, hour, minute);
|
|
27970
27970
|
let utcMs = wallTimeAsUtc;
|
|
27971
27971
|
for (let i = 0; i < 3; i++) {
|
|
27972
27972
|
const offset = getTimeZoneOffsetMs(timezone, utcMs);
|
|
@@ -28001,11 +28001,11 @@ function getTimeZoneOffsetMs(timezone, utcMs) {
|
|
|
28001
28001
|
var SOURCE_CREATED_AT_DESCRIPTION = "Omit for normal creation. Use only for imports/backfills or when the user explicitly says the activity happened at a different time.";
|
|
28002
28002
|
function isSourceCreatedAtInput(value) {
|
|
28003
28003
|
if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
|
|
28004
|
-
const
|
|
28005
|
-
if (typeof
|
|
28006
|
-
if ("time" in
|
|
28004
|
+
const record3 = value;
|
|
28005
|
+
if (typeof record3.date !== "string") return false;
|
|
28006
|
+
if ("time" in record3 && record3.time !== null && record3.time !== void 0 && typeof record3.time !== "string")
|
|
28007
28007
|
return false;
|
|
28008
|
-
if ("timezone" in
|
|
28008
|
+
if ("timezone" in record3 && record3.timezone !== void 0 && typeof record3.timezone !== "string")
|
|
28009
28009
|
return false;
|
|
28010
28010
|
return true;
|
|
28011
28011
|
}
|
|
@@ -28040,11 +28040,38 @@ var APP_ERROR_CODES = {
|
|
|
28040
28040
|
};
|
|
28041
28041
|
var OPERATION_ERROR_CODES = { ...APP_ERROR_CODES, notAvailableHere: "NOT_AVAILABLE_HERE" };
|
|
28042
28042
|
|
|
28043
|
+
// ../packages/shared/src/control-characters.ts
|
|
28044
|
+
var c0 = Array.from({ length: 32 }, (_, code3) => String.fromCharCode(code3));
|
|
28045
|
+
var C0_CONTROLS = new Set(c0);
|
|
28046
|
+
var ASCII_CONTROLS = /* @__PURE__ */ new Set([...c0, "\x7F"]);
|
|
28047
|
+
var UNICODE_CONTROLS = /* @__PURE__ */ new Set([
|
|
28048
|
+
...c0,
|
|
28049
|
+
...Array.from({ length: 33 }, (_, offset) => String.fromCharCode(127 + offset))
|
|
28050
|
+
]);
|
|
28051
|
+
var HEADER_BREAKS = /* @__PURE__ */ new Set(["\r", "\n", "\0"]);
|
|
28052
|
+
var TEXT_CONTROLS = new Set(
|
|
28053
|
+
[...ASCII_CONTROLS].filter((character) => character !== " " && character !== "\n")
|
|
28054
|
+
);
|
|
28055
|
+
function containsCharacter(value, characters) {
|
|
28056
|
+
for (const character of value) if (characters.has(character)) return true;
|
|
28057
|
+
return false;
|
|
28058
|
+
}
|
|
28059
|
+
function replaceCharacters(value, characters, replacement) {
|
|
28060
|
+
let result = "", chunkStart = 0, offset = 0;
|
|
28061
|
+
for (const character of value) {
|
|
28062
|
+
if (characters.has(character)) {
|
|
28063
|
+
result += value.slice(chunkStart, offset) + replacement;
|
|
28064
|
+
chunkStart = offset + character.length;
|
|
28065
|
+
}
|
|
28066
|
+
offset += character.length;
|
|
28067
|
+
}
|
|
28068
|
+
return chunkStart === 0 ? value : result + value.slice(chunkStart);
|
|
28069
|
+
}
|
|
28070
|
+
|
|
28043
28071
|
// ../packages/shared/src/attribute-names.ts
|
|
28044
28072
|
var STORABLE_ATTRIBUTE_KEY = /^[\x20-\x23\x25-\x7E][\x20-\x7E]{0,1023}$/;
|
|
28045
28073
|
var ENCODED_PREFIX = "~";
|
|
28046
28074
|
var MAX_STORAGE_KEY_LENGTH = 1024;
|
|
28047
|
-
var CONTROL_CHARACTER = /[\u0000-\u001F\u007F-\u009F]/;
|
|
28048
28075
|
function isStorableAttributeKey(key) {
|
|
28049
28076
|
return STORABLE_ATTRIBUTE_KEY.test(key);
|
|
28050
28077
|
}
|
|
@@ -28059,7 +28086,7 @@ function escapeCharacter(character) {
|
|
|
28059
28086
|
return encodeURIComponent(character).toLowerCase();
|
|
28060
28087
|
}
|
|
28061
28088
|
function attributeStorageKey(name4) {
|
|
28062
|
-
if (name4.length === 0 ||
|
|
28089
|
+
if (name4.length === 0 || containsCharacter(name4, UNICODE_CONTROLS)) return void 0;
|
|
28063
28090
|
if (!needsEncoding(name4)) return name4;
|
|
28064
28091
|
let key = ENCODED_PREFIX;
|
|
28065
28092
|
try {
|
|
@@ -28669,8 +28696,8 @@ var BaseCommand = class extends Command {
|
|
|
28669
28696
|
`);
|
|
28670
28697
|
return;
|
|
28671
28698
|
}
|
|
28672
|
-
const
|
|
28673
|
-
if (
|
|
28699
|
+
const text4 = render();
|
|
28700
|
+
if (text4) this.context.stdout.write(`${text4}
|
|
28674
28701
|
`);
|
|
28675
28702
|
}
|
|
28676
28703
|
out(line) {
|
|
@@ -28701,18 +28728,18 @@ var BaseCommand = class extends Command {
|
|
|
28701
28728
|
function parseFieldPairs(pairs) {
|
|
28702
28729
|
const result = {};
|
|
28703
28730
|
if (!pairs) return result;
|
|
28704
|
-
for (const
|
|
28705
|
-
const eq =
|
|
28706
|
-
if (eq === -1) throw new Error(`Invalid field format: '${
|
|
28707
|
-
result[
|
|
28731
|
+
for (const pair3 of pairs) {
|
|
28732
|
+
const eq = pair3.indexOf("=");
|
|
28733
|
+
if (eq === -1) throw new Error(`Invalid field format: '${pair3}'. Use key=value.`);
|
|
28734
|
+
result[pair3.slice(0, eq)] = pair3.slice(eq + 1);
|
|
28708
28735
|
}
|
|
28709
28736
|
return result;
|
|
28710
28737
|
}
|
|
28711
28738
|
function parseFieldPairList(pairs) {
|
|
28712
|
-
return (pairs ?? []).map((
|
|
28713
|
-
const eq =
|
|
28714
|
-
if (eq === -1) throw new Error(`Invalid field format: '${
|
|
28715
|
-
return [
|
|
28739
|
+
return (pairs ?? []).map((pair3) => {
|
|
28740
|
+
const eq = pair3.indexOf("=");
|
|
28741
|
+
if (eq === -1) throw new Error(`Invalid field format: '${pair3}'. Use key=value.`);
|
|
28742
|
+
return [pair3.slice(0, eq), pair3.slice(eq + 1)];
|
|
28716
28743
|
});
|
|
28717
28744
|
}
|
|
28718
28745
|
function parseOperationFieldPairs(operation, pairs) {
|
|
@@ -28724,7 +28751,7 @@ function parseOperationFieldPairs(operation, pairs) {
|
|
|
28724
28751
|
}
|
|
28725
28752
|
|
|
28726
28753
|
// ente/version.ts
|
|
28727
|
-
var VERSION = "0.4.
|
|
28754
|
+
var VERSION = "0.4.143";
|
|
28728
28755
|
|
|
28729
28756
|
// ente/branding.ts
|
|
28730
28757
|
var NPM_REGISTRY = "https://registry.npmjs.org";
|
|
@@ -29136,6 +29163,7 @@ var activityWriteRestBindings = [
|
|
|
29136
29163
|
];
|
|
29137
29164
|
|
|
29138
29165
|
// ../packages/shared/src/account-settings.ts
|
|
29166
|
+
var mailFolderName = new RegExp(`^[^${[...HEADER_BREAKS].join("")}]+$`);
|
|
29139
29167
|
var text = external_exports.string().max(200);
|
|
29140
29168
|
var tags = external_exports.array(text).max(100);
|
|
29141
29169
|
var id6 = external_exports.string().min(1).max(100);
|
|
@@ -29147,7 +29175,7 @@ var tabs = (filters, entity5 = false) => external_exports.strictObject({ activeI
|
|
|
29147
29175
|
function setting(schema, defaultValue, description, examples, scope = "user", content = false) {
|
|
29148
29176
|
return { schema, default: defaultValue, description, examples, scope, adminSettable: true, content };
|
|
29149
29177
|
}
|
|
29150
|
-
var mailSetupSchema = external_exports.strictObject({ provider: external_exports.enum(["imap", "google", "microsoft"]), email: external_exports.string().trim().email().max(254), username: external_exports.string().max(254).optional(), imapHost: external_exports.string().min(1).max(253).optional(), imapPort: external_exports.number().int().min(1).max(65535).optional(), imapSecure: external_exports.boolean().optional(), smtpHost: external_exports.string().min(1).max(253).optional(), smtpPort: external_exports.number().int().min(1).max(65535).optional(), smtpSecure: external_exports.boolean().optional(), folders: external_exports.array(external_exports.string().min(1).max(200).regex(
|
|
29178
|
+
var mailSetupSchema = external_exports.strictObject({ provider: external_exports.enum(["imap", "google", "microsoft"]), email: external_exports.string().trim().email().max(254), username: external_exports.string().max(254).optional(), imapHost: external_exports.string().min(1).max(253).optional(), imapPort: external_exports.number().int().min(1).max(65535).optional(), imapSecure: external_exports.boolean().optional(), smtpHost: external_exports.string().min(1).max(253).optional(), smtpPort: external_exports.number().int().min(1).max(65535).optional(), smtpSecure: external_exports.boolean().optional(), folders: external_exports.array(external_exports.string().min(1).max(200).regex(mailFolderName)).max(20).default([]), signatureHtml: external_exports.string().max(2e4).default("") }).refine((v3) => v3.provider !== "imap" || Boolean(v3.imapHost && v3.imapPort && v3.imapSecure !== void 0 && v3.smtpHost && v3.smtpPort && v3.smtpSecure !== void 0), "IMAP and SMTP endpoints required");
|
|
29151
29179
|
var accountSettings = {
|
|
29152
29180
|
mailSetup: setting(mailSetupSchema.nullable(), null, "Prepare non-secret mail connection metadata and a 15-minute, single-use finish link for the exact signed-in target. The user enters the password directly in Ente; never ask for or pass a password. OAuth remains user-session-only. Folders are synchronized first; signature is sanitized. Applying null revokes an unused link.", [null], "user", true),
|
|
29153
29181
|
language: setting(external_exports.enum(["en", "de"]), "en", "Language used by the account.", ["en", "de"]),
|
|
@@ -29686,7 +29714,7 @@ var SchemaDefinition2 = class {
|
|
|
29686
29714
|
*/
|
|
29687
29715
|
export() {
|
|
29688
29716
|
return JSON.stringify({
|
|
29689
|
-
tables: Object.entries(this.tables).map(([tableName,
|
|
29717
|
+
tables: Object.entries(this.tables).map(([tableName, definition7]) => {
|
|
29690
29718
|
const {
|
|
29691
29719
|
indexes,
|
|
29692
29720
|
stagedDbIndexes,
|
|
@@ -29696,7 +29724,7 @@ var SchemaDefinition2 = class {
|
|
|
29696
29724
|
stagedVectorIndexes,
|
|
29697
29725
|
documentType,
|
|
29698
29726
|
stagedDocumentType
|
|
29699
|
-
} =
|
|
29727
|
+
} = definition7.export();
|
|
29700
29728
|
return {
|
|
29701
29729
|
tableName,
|
|
29702
29730
|
indexes,
|
|
@@ -29990,6 +30018,16 @@ var agentContextExternalEnvelopeResults = {
|
|
|
29990
30018
|
agent_threads_list: flatThreads,
|
|
29991
30019
|
agent_thread_get: v2.object({ data: flatDetail })
|
|
29992
30020
|
};
|
|
30021
|
+
var scheduleInputValidator = v2.object({
|
|
30022
|
+
automationId: v2.optional(v2.id("agentAutomations")),
|
|
30023
|
+
enabled: v2.boolean(),
|
|
30024
|
+
prompt: v2.string(),
|
|
30025
|
+
intervalHours: v2.optional(v2.union(v2.literal(1), v2.literal(24))),
|
|
30026
|
+
mailPurpose: v2.optional(v2.union(v2.literal("classification"), v2.literal("replies"))),
|
|
30027
|
+
runCondition: v2.optional(v2.literal("new_chats")),
|
|
30028
|
+
timeMinutes: v2.number(),
|
|
30029
|
+
timezone: v2.string()
|
|
30030
|
+
});
|
|
29993
30031
|
|
|
29994
30032
|
// ../packages/shared/src/agent-config-results.ts
|
|
29995
30033
|
var agentConfigCommitValidator = v2.object({ agentId: v2.id("agents"), committed: v2.literal(true) });
|
|
@@ -30127,6 +30165,9 @@ var outgoingEmailAttachmentsJsonSchema = {
|
|
|
30127
30165
|
items: outgoingEmailAttachmentJsonSchema,
|
|
30128
30166
|
description: "Optional bounded file attachments (3000000 decoded bytes in total). Regular attachments may use any valid MIME type; inline Content-ID attachments must be PNG, JPEG, GIF, or WebP images."
|
|
30129
30167
|
};
|
|
30168
|
+
var GMAIL_BLOCKED_EXTENSIONS = new Set(
|
|
30169
|
+
"ade adp apk appx appxbundle bat cab chm cmd com cpl diagcab diagcfg diagpkg dll dmg ex ex_ exe hta img ins iso isp jar jnlp js jse lib lnk mde mjs msc msi msix msixbundle msp mst nsh pif ps1 scr sct shb sys vb vbe vbs vhd vxd wsc wsf wsh xll".split(" ")
|
|
30170
|
+
);
|
|
30130
30171
|
function validateOutgoingEmailAttachments(value) {
|
|
30131
30172
|
if (value === void 0) return { ok: true };
|
|
30132
30173
|
if (!Array.isArray(value))
|
|
@@ -33364,6 +33405,107 @@ function parseEntityUpdateInput(args, name4 = "entities_update") {
|
|
|
33364
33405
|
} };
|
|
33365
33406
|
}
|
|
33366
33407
|
|
|
33408
|
+
// ../packages/shared/src/entity-image.ts
|
|
33409
|
+
var ENTITY_IMAGE_MAX_BYTES = 64 * 1024;
|
|
33410
|
+
var ENTITY_IMAGE_MAX_DIMENSION = 256;
|
|
33411
|
+
var ENTITY_IMAGE_OUTPUT_SIZE = 192;
|
|
33412
|
+
var ENTITY_IMAGE_DATA_URI_MAX_LENGTH = 23 + Math.ceil(ENTITY_IMAGE_MAX_BYTES / 3) * 4;
|
|
33413
|
+
var EntityImageError = class extends Error {
|
|
33414
|
+
constructor(message4) {
|
|
33415
|
+
super(message4);
|
|
33416
|
+
this.name = "EntityImageError";
|
|
33417
|
+
}
|
|
33418
|
+
};
|
|
33419
|
+
var DATA_URI = /^data:(image\/(?:png|jpeg|webp));base64,([A-Za-z0-9+/]+={0,2})$/;
|
|
33420
|
+
function decodeBase64(value) {
|
|
33421
|
+
const binary = atob(value);
|
|
33422
|
+
const bytes2 = new Uint8Array(binary.length);
|
|
33423
|
+
for (let index = 0; index < binary.length; index++) bytes2[index] = binary.charCodeAt(index);
|
|
33424
|
+
return bytes2;
|
|
33425
|
+
}
|
|
33426
|
+
var ascii = (bytes2, start, length) => String.fromCharCode(...bytes2.subarray(start, start + length));
|
|
33427
|
+
var u16be = (bytes2, offset) => bytes2[offset] << 8 | bytes2[offset + 1];
|
|
33428
|
+
var u32be = (bytes2, offset) => bytes2[offset] * 16777216 + (bytes2[offset + 1] << 16 | bytes2[offset + 2] << 8 | bytes2[offset + 3]);
|
|
33429
|
+
var u24le = (bytes2, offset) => bytes2[offset] | bytes2[offset + 1] << 8 | bytes2[offset + 2] << 16;
|
|
33430
|
+
var u32le = (bytes2, offset) => u24le(bytes2, offset) + bytes2[offset + 3] * 16777216;
|
|
33431
|
+
function pngSize(bytes2) {
|
|
33432
|
+
if (bytes2.length < 33 || ascii(bytes2, 1, 3) !== "PNG" || bytes2[0] !== 137 || ascii(bytes2, 12, 4) !== "IHDR") return null;
|
|
33433
|
+
for (let offset = 8; offset + 8 <= bytes2.length; ) {
|
|
33434
|
+
const type = ascii(bytes2, offset + 4, 4);
|
|
33435
|
+
if (type === "acTL") return null;
|
|
33436
|
+
if (type === "IDAT" || type === "IEND") break;
|
|
33437
|
+
offset += 12 + u32be(bytes2, offset);
|
|
33438
|
+
}
|
|
33439
|
+
return { width: u32be(bytes2, 16), height: u32be(bytes2, 20) };
|
|
33440
|
+
}
|
|
33441
|
+
function jpegSize(bytes2) {
|
|
33442
|
+
if (bytes2[0] !== 255 || bytes2[1] !== 216) return null;
|
|
33443
|
+
let offset = 2;
|
|
33444
|
+
while (offset + 9 < bytes2.length) {
|
|
33445
|
+
if (bytes2[offset] !== 255) return null;
|
|
33446
|
+
const marker = bytes2[offset + 1];
|
|
33447
|
+
if (marker === 255) {
|
|
33448
|
+
offset++;
|
|
33449
|
+
continue;
|
|
33450
|
+
}
|
|
33451
|
+
if (marker === 216 || marker >= 208 && marker <= 215 || marker === 1) {
|
|
33452
|
+
offset += 2;
|
|
33453
|
+
continue;
|
|
33454
|
+
}
|
|
33455
|
+
const length = u16be(bytes2, offset + 2);
|
|
33456
|
+
if (marker >= 192 && marker <= 207 && marker !== 196 && marker !== 200 && marker !== 204) {
|
|
33457
|
+
return { height: u16be(bytes2, offset + 5), width: u16be(bytes2, offset + 7) };
|
|
33458
|
+
}
|
|
33459
|
+
if (marker === 218 || length < 2) return null;
|
|
33460
|
+
offset += 2 + length;
|
|
33461
|
+
}
|
|
33462
|
+
return null;
|
|
33463
|
+
}
|
|
33464
|
+
function webpSize(bytes2) {
|
|
33465
|
+
if (bytes2.length < 30 || ascii(bytes2, 0, 4) !== "RIFF" || ascii(bytes2, 8, 4) !== "WEBP") return null;
|
|
33466
|
+
const chunk = ascii(bytes2, 12, 4);
|
|
33467
|
+
if (chunk === "VP8 ") {
|
|
33468
|
+
if (bytes2[23] !== 157 || bytes2[24] !== 1 || bytes2[25] !== 42) return null;
|
|
33469
|
+
return { width: (bytes2[26] | bytes2[27] << 8) & 16383, height: (bytes2[28] | bytes2[29] << 8) & 16383 };
|
|
33470
|
+
}
|
|
33471
|
+
if (chunk === "VP8L") {
|
|
33472
|
+
if (bytes2[20] !== 47) return null;
|
|
33473
|
+
const bits = u32le(bytes2, 21);
|
|
33474
|
+
return { width: (bits & 16383) + 1, height: (bits >>> 14 & 16383) + 1 };
|
|
33475
|
+
}
|
|
33476
|
+
if (chunk === "VP8X") {
|
|
33477
|
+
if (bytes2[20] & 2) return null;
|
|
33478
|
+
return { width: u24le(bytes2, 24) + 1, height: u24le(bytes2, 27) + 1 };
|
|
33479
|
+
}
|
|
33480
|
+
return null;
|
|
33481
|
+
}
|
|
33482
|
+
function parseEntityImageDataUri(value) {
|
|
33483
|
+
if (typeof value !== "string") throw new EntityImageError("Entity image must be a data URI string or null");
|
|
33484
|
+
if (value.length > ENTITY_IMAGE_DATA_URI_MAX_LENGTH) {
|
|
33485
|
+
throw new EntityImageError(`Entity image is larger than ${ENTITY_IMAGE_MAX_BYTES / 1024} KB; downscale it to at most ${ENTITY_IMAGE_MAX_DIMENSION} \xD7 ${ENTITY_IMAGE_MAX_DIMENSION} px`);
|
|
33486
|
+
}
|
|
33487
|
+
const match = DATA_URI.exec(value);
|
|
33488
|
+
if (!match) throw new EntityImageError("Entity image must be a data:image/png, data:image/jpeg or data:image/webp base64 URI");
|
|
33489
|
+
const mimeType = match[1];
|
|
33490
|
+
let bytes2;
|
|
33491
|
+
try {
|
|
33492
|
+
bytes2 = decodeBase64(match[2]);
|
|
33493
|
+
} catch {
|
|
33494
|
+
throw new EntityImageError("Entity image base64 is invalid");
|
|
33495
|
+
}
|
|
33496
|
+
if (bytes2.length > ENTITY_IMAGE_MAX_BYTES) {
|
|
33497
|
+
throw new EntityImageError(`Entity image is larger than ${ENTITY_IMAGE_MAX_BYTES / 1024} KB; downscale it to at most ${ENTITY_IMAGE_MAX_DIMENSION} \xD7 ${ENTITY_IMAGE_MAX_DIMENSION} px`);
|
|
33498
|
+
}
|
|
33499
|
+
const size = mimeType === "image/png" ? pngSize(bytes2) : mimeType === "image/jpeg" ? jpegSize(bytes2) : webpSize(bytes2);
|
|
33500
|
+
if (!size || size.width < 1 || size.height < 1) {
|
|
33501
|
+
throw new EntityImageError(`Entity image is not a valid still ${mimeType.slice(6).toUpperCase()} image`);
|
|
33502
|
+
}
|
|
33503
|
+
if (size.width > ENTITY_IMAGE_MAX_DIMENSION || size.height > ENTITY_IMAGE_MAX_DIMENSION) {
|
|
33504
|
+
throw new EntityImageError(`Entity image is ${size.width} \xD7 ${size.height} px; the maximum is ${ENTITY_IMAGE_MAX_DIMENSION} \xD7 ${ENTITY_IMAGE_MAX_DIMENSION} px`);
|
|
33505
|
+
}
|
|
33506
|
+
return { mimeType, bytes: bytes2, ...size };
|
|
33507
|
+
}
|
|
33508
|
+
|
|
33367
33509
|
// ../packages/shared/src/entity-write-operations.ts
|
|
33368
33510
|
var id12 = external_exports.string().min(1).max(128).refine((value) => value.trim() === value, "Copy IDs unchanged");
|
|
33369
33511
|
var name2 = external_exports.string().trim().min(1);
|
|
@@ -33387,7 +33529,8 @@ var entityWriteInputs = {
|
|
|
33387
33529
|
updateFieldValue: external_exports.strictObject({ valueId: id12, value: external_exports.string() }),
|
|
33388
33530
|
removeFieldValue: external_exports.strictObject({ valueId: id12 }),
|
|
33389
33531
|
archiveEntity: external_exports.strictObject({ entityId: id12 }),
|
|
33390
|
-
restoreEntity: external_exports.strictObject({ entityId: id12, grantMissingParentAccess: external_exports.boolean().optional(), parentSpaceGrantFingerprint: external_exports.string().trim().min(1).optional() })
|
|
33532
|
+
restoreEntity: external_exports.strictObject({ entityId: id12, grantMissingParentAccess: external_exports.boolean().optional(), parentSpaceGrantFingerprint: external_exports.string().trim().min(1).optional() }),
|
|
33533
|
+
setEntityImage: external_exports.strictObject({ entityId: id12, spaceId: id12.optional(), image: external_exports.string().max(ENTITY_IMAGE_DATA_URI_MAX_LENGTH).nullable() })
|
|
33391
33534
|
};
|
|
33392
33535
|
function parserMismatch2(operation) {
|
|
33393
33536
|
throw new OperationInputError(operation, [{ path: [], reason: "custom" }]);
|
|
@@ -33423,6 +33566,8 @@ function parseEntityWriteRequest(operation, raw) {
|
|
|
33423
33566
|
return { operation, input: parseOperationInput(operation, entityWriteInputs.archiveEntity, raw) };
|
|
33424
33567
|
case "restoreEntity":
|
|
33425
33568
|
return { operation, input: parseOperationInput(operation, entityWriteInputs.restoreEntity, raw) };
|
|
33569
|
+
case "setEntityImage":
|
|
33570
|
+
return { operation, input: parseOperationInput(operation, entityWriteInputs.setEntityImage, raw) };
|
|
33426
33571
|
}
|
|
33427
33572
|
}
|
|
33428
33573
|
function rejectLegacyEntityAttributes(operation, raw) {
|
|
@@ -33449,7 +33594,8 @@ var entityWriteResults = {
|
|
|
33449
33594
|
restoreEntity: success2,
|
|
33450
33595
|
addFieldValue: external_exports.strictObject({ valueId: entityId, added: external_exports.boolean() }),
|
|
33451
33596
|
updateFieldValue: success2,
|
|
33452
|
-
removeFieldValue: success2
|
|
33597
|
+
removeFieldValue: success2,
|
|
33598
|
+
setEntityImage: external_exports.strictObject({ entityId, imageId: external_exports.string().min(1).nullable() })
|
|
33453
33599
|
};
|
|
33454
33600
|
var nativeEntityWriteResults = {
|
|
33455
33601
|
...entityWriteResults,
|
|
@@ -33466,7 +33612,8 @@ var publicCliEntityWriteResults = {
|
|
|
33466
33612
|
updateEntity: success2.extend({ entityId }),
|
|
33467
33613
|
updateEntityName: success2.extend({ entityId, name: external_exports.string() }),
|
|
33468
33614
|
archiveEntity: success2.extend({ entityId }),
|
|
33469
|
-
restoreEntity: success2.extend({ entityId })
|
|
33615
|
+
restoreEntity: success2.extend({ entityId }),
|
|
33616
|
+
setEntityImage: entityWriteResults.setEntityImage
|
|
33470
33617
|
};
|
|
33471
33618
|
function parsePublicCliEntityWriteResult(operation, raw) {
|
|
33472
33619
|
return checked3(publicCliEntityWriteResults[operation], raw);
|
|
@@ -33485,6 +33632,8 @@ function projectEntityWriteResult(operation, raw) {
|
|
|
33485
33632
|
return checked3(entityWriteResults.duplicateEntity, raw);
|
|
33486
33633
|
case "addFieldValue":
|
|
33487
33634
|
return checked3(entityWriteResults.addFieldValue, raw);
|
|
33635
|
+
case "setEntityImage":
|
|
33636
|
+
return checked3(entityWriteResults.setEntityImage, raw);
|
|
33488
33637
|
default:
|
|
33489
33638
|
if (raw !== null) throw new OperationResultError(operation, "Invalid entity write result");
|
|
33490
33639
|
return checked3(success2, { success: true });
|
|
@@ -33594,31 +33743,31 @@ var fields2 = {
|
|
|
33594
33743
|
release: ["assignmentId", "claimToken"]
|
|
33595
33744
|
};
|
|
33596
33745
|
function validateAgentTaskInput(raw) {
|
|
33597
|
-
const
|
|
33598
|
-
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return
|
|
33746
|
+
const invalid5 = (message4) => ({ ok: false, message: message4 });
|
|
33747
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return invalid5("Task input must be an object");
|
|
33599
33748
|
const input2 = raw;
|
|
33600
|
-
if (!AGENT_TASK_OPERATIONS.includes(input2.operation)) return
|
|
33749
|
+
if (!AGENT_TASK_OPERATIONS.includes(input2.operation)) return invalid5("Unknown task operation");
|
|
33601
33750
|
const operation = input2.operation;
|
|
33602
|
-
if (Object.keys(input2).some((key) => key !== "operation" && !fields2[operation].includes(key))) return
|
|
33751
|
+
if (Object.keys(input2).some((key) => key !== "operation" && !fields2[operation].includes(key))) return invalid5("Unsupported task operation argument");
|
|
33603
33752
|
for (const key of ["assignmentId", "observationId", "claimToken", "cursor", "idempotencyKey", "messageId"]) {
|
|
33604
|
-
if (input2[key] !== void 0 && (typeof input2[key] !== "string" || !input2[key].trim())) return
|
|
33605
|
-
}
|
|
33606
|
-
if (input2.field !== void 0 && !activityFieldFiltersSchema.safeParse(input2.field).success) return
|
|
33607
|
-
if (input2.principals !== void 0 && input2.principals !== "granted") return
|
|
33608
|
-
if (input2.forAgentIds !== void 0 && (!Array.isArray(input2.forAgentIds) || input2.forAgentIds.length > 21 || input2.forAgentIds.some((id21) => typeof id21 !== "string" || !id21.trim()))) return
|
|
33609
|
-
if (input2.principals !== void 0 && input2.forAgentIds !== void 0) return
|
|
33610
|
-
if (operation === "message" && !input2.messageId) return
|
|
33611
|
-
if (input2.offset !== void 0 && (!Number.isSafeInteger(input2.offset) || input2.offset < 0)) return
|
|
33612
|
-
if (input2.expectedUpdatedAt !== void 0 && (typeof input2.expectedUpdatedAt !== "number" || !Number.isFinite(input2.expectedUpdatedAt))) return
|
|
33613
|
-
if (operation === "message" && (input2.offset ?? 0) > 0 && input2.expectedUpdatedAt === void 0) return
|
|
33614
|
-
if (operation !== "list" && operation !== "attentionFeed" && !input2.assignmentId) return
|
|
33615
|
-
if ((operation === "renew" || operation === "release") && !input2.claimToken) return
|
|
33616
|
-
if (operation === "acknowledge" && (!input2.observationId || !Number.isSafeInteger(input2.version) || input2.version < 0)) return
|
|
33617
|
-
if (input2.limit !== void 0 && (!Number.isInteger(input2.limit) || input2.limit < 1 || input2.limit > AGENT_TASK_PAGE_MAX)) return
|
|
33618
|
-
if (input2.view !== void 0 && input2.view !== "open" && input2.view !== "attention") return
|
|
33619
|
-
if (operation === "comment" && (typeof input2.content !== "string" || !input2.content.trim() || input2.content.length > AGENT_TASK_TEXT_MAX || !input2.idempotencyKey)) return
|
|
33620
|
-
if (typeof input2.cursor === "string" && input2.cursor.length > AGENT_TASK_CURSOR_MAX) return
|
|
33621
|
-
for (const key of ["claimToken", "idempotencyKey"]) if (typeof input2[key] === "string" && input2[key].length > 128) return
|
|
33753
|
+
if (input2[key] !== void 0 && (typeof input2[key] !== "string" || !input2[key].trim())) return invalid5(`${key} must be a non-empty string`);
|
|
33754
|
+
}
|
|
33755
|
+
if (input2.field !== void 0 && !activityFieldFiltersSchema.safeParse(input2.field).success) return invalid5("Invalid activity field filter");
|
|
33756
|
+
if (input2.principals !== void 0 && input2.principals !== "granted") return invalid5("Invalid principal selector");
|
|
33757
|
+
if (input2.forAgentIds !== void 0 && (!Array.isArray(input2.forAgentIds) || input2.forAgentIds.length > 21 || input2.forAgentIds.some((id21) => typeof id21 !== "string" || !id21.trim()))) return invalid5("Invalid agent IDs");
|
|
33758
|
+
if (input2.principals !== void 0 && input2.forAgentIds !== void 0) return invalid5("Choose one principal selector");
|
|
33759
|
+
if (operation === "message" && !input2.messageId) return invalid5("messageId is required");
|
|
33760
|
+
if (input2.offset !== void 0 && (!Number.isSafeInteger(input2.offset) || input2.offset < 0)) return invalid5("offset must be a non-negative integer");
|
|
33761
|
+
if (input2.expectedUpdatedAt !== void 0 && (typeof input2.expectedUpdatedAt !== "number" || !Number.isFinite(input2.expectedUpdatedAt))) return invalid5("expectedUpdatedAt must be a finite number");
|
|
33762
|
+
if (operation === "message" && (input2.offset ?? 0) > 0 && input2.expectedUpdatedAt === void 0) return invalid5("Message continuation requires expectedUpdatedAt");
|
|
33763
|
+
if (operation !== "list" && operation !== "attentionFeed" && !input2.assignmentId) return invalid5("assignmentId is required");
|
|
33764
|
+
if ((operation === "renew" || operation === "release") && !input2.claimToken) return invalid5("claimToken is required");
|
|
33765
|
+
if (operation === "acknowledge" && (!input2.observationId || !Number.isSafeInteger(input2.version) || input2.version < 0)) return invalid5("Acknowledgement requires observationId and exact version");
|
|
33766
|
+
if (input2.limit !== void 0 && (!Number.isInteger(input2.limit) || input2.limit < 1 || input2.limit > AGENT_TASK_PAGE_MAX)) return invalid5("limit must be an integer from 1 to 100");
|
|
33767
|
+
if (input2.view !== void 0 && input2.view !== "open" && input2.view !== "attention") return invalid5("view must be open or attention");
|
|
33768
|
+
if (operation === "comment" && (typeof input2.content !== "string" || !input2.content.trim() || input2.content.length > AGENT_TASK_TEXT_MAX || !input2.idempotencyKey)) return invalid5("Comment requires bounded non-empty content and idempotencyKey");
|
|
33769
|
+
if (typeof input2.cursor === "string" && input2.cursor.length > AGENT_TASK_CURSOR_MAX) return invalid5("cursor exceeds its limit");
|
|
33770
|
+
for (const key of ["claimToken", "idempotencyKey"]) if (typeof input2[key] === "string" && input2[key].length > 128) return invalid5(`${key} exceeds its limit`);
|
|
33622
33771
|
return { ok: true, value: input2 };
|
|
33623
33772
|
}
|
|
33624
33773
|
|
|
@@ -33912,7 +34061,7 @@ var diagnosticOutputValidator = v2.object({
|
|
|
33912
34061
|
|
|
33913
34062
|
// ../packages/shared/src/agent-self-task-diagnostic-operations.ts
|
|
33914
34063
|
function parseAgentSelfTaskDiagnosticRequest(operation, raw) {
|
|
33915
|
-
const
|
|
34064
|
+
const invalid5 = () => {
|
|
33916
34065
|
throw new OperationInputError(operation, [{ path: [], reason: "custom" }]);
|
|
33917
34066
|
};
|
|
33918
34067
|
switch (operation) {
|
|
@@ -33920,17 +34069,17 @@ function parseAgentSelfTaskDiagnosticRequest(operation, raw) {
|
|
|
33920
34069
|
try {
|
|
33921
34070
|
return { operation, input: parseAgentIconInput(raw) };
|
|
33922
34071
|
} catch {
|
|
33923
|
-
return
|
|
34072
|
+
return invalid5();
|
|
33924
34073
|
}
|
|
33925
34074
|
}
|
|
33926
34075
|
case "manageAssignedTasks": {
|
|
33927
34076
|
const parsed = validateAgentTaskInput(raw);
|
|
33928
|
-
if (!parsed.ok) return
|
|
34077
|
+
if (!parsed.ok) return invalid5();
|
|
33929
34078
|
return { operation, input: parsed.value };
|
|
33930
34079
|
}
|
|
33931
34080
|
case "getAgentDiagnostics": {
|
|
33932
34081
|
const parsed = validateDiagnosticInput(raw);
|
|
33933
|
-
if (!parsed.ok) return
|
|
34082
|
+
if (!parsed.ok) return invalid5();
|
|
33934
34083
|
return { operation, input: parsed.value };
|
|
33935
34084
|
}
|
|
33936
34085
|
}
|
|
@@ -34069,6 +34218,414 @@ function buildAgendaDefinition(name4) {
|
|
|
34069
34218
|
var definitions2 = new Map(Object.keys(agendaInputs).filter(isAgendaOperationName).map((name4) => [name4, buildAgendaDefinition(name4)]));
|
|
34070
34219
|
var agendaCatalog = [...definitions2.values()];
|
|
34071
34220
|
|
|
34221
|
+
// ../packages/shared/src/health-measurements.ts
|
|
34222
|
+
var HEALTH_SERIES_KEY_PATTERN = /^[a-z][a-z0-9_]{0,39}$/;
|
|
34223
|
+
var HEALTH_SERIES_LABEL_MAX_LENGTH = 60;
|
|
34224
|
+
var HEALTH_SERIES_UNIT_MAX_LENGTH = 16;
|
|
34225
|
+
var HEALTH_SERIES_DESCRIPTION_MAX_LENGTH = 160;
|
|
34226
|
+
var HEALTH_SERIES_MAX_PER_USER = 20;
|
|
34227
|
+
var HEALTH_RECORD_MAX_POINTS = 500;
|
|
34228
|
+
var HEALTH_RECORD_MAX_REMOVALS = 500;
|
|
34229
|
+
var HEALTH_READ_MAX_DAYS = 800;
|
|
34230
|
+
var HEALTH_READ_MAX_POINTS = 8e3;
|
|
34231
|
+
var HEALTH_SERIES_REMOVE_MAX_POINTS = 4e3;
|
|
34232
|
+
var HEALTH_VALUE_ABS_MAX = 1e9;
|
|
34233
|
+
var HEALTH_INTRADAY_MAX_DAYS_PER_RECORD = 14;
|
|
34234
|
+
var HEALTH_INTRADAY_READ_MAX_VALUES = 2e4;
|
|
34235
|
+
var HealthMeasurementError = class extends Error {
|
|
34236
|
+
constructor(message4) {
|
|
34237
|
+
super(message4);
|
|
34238
|
+
this.name = "HealthMeasurementError";
|
|
34239
|
+
}
|
|
34240
|
+
};
|
|
34241
|
+
var fail = (message4) => {
|
|
34242
|
+
throw new HealthMeasurementError(message4);
|
|
34243
|
+
};
|
|
34244
|
+
var DAY_PATTERN = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
34245
|
+
var DATE_TIME_PATTERN = /^(\d{4}-\d{2}-\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,9})?)?(Z|[+-]\d{2}:?\d{2})?$/;
|
|
34246
|
+
function isHealthDay(value) {
|
|
34247
|
+
const match = DAY_PATTERN.exec(value);
|
|
34248
|
+
if (!match) return false;
|
|
34249
|
+
const [year, month, day2] = [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
34250
|
+
const date5 = new Date(Date.UTC(year, month - 1, day2));
|
|
34251
|
+
return date5.getUTCFullYear() === year && date5.getUTCMonth() === month - 1 && date5.getUTCDate() === day2;
|
|
34252
|
+
}
|
|
34253
|
+
function parseHealthDay(value, field) {
|
|
34254
|
+
if (typeof value !== "string" || !isHealthDay(value)) fail(`${field} must be a date like 2026-11-22`);
|
|
34255
|
+
return value;
|
|
34256
|
+
}
|
|
34257
|
+
function parseHealthPointAt(value, field = "at") {
|
|
34258
|
+
if (typeof value !== "string") return fail(`${field} must be a date or a local date-time`);
|
|
34259
|
+
if (DAY_PATTERN.test(value)) return { day: parseHealthDay(value, field) };
|
|
34260
|
+
const match = DATE_TIME_PATTERN.exec(value);
|
|
34261
|
+
if (!match) return fail(`${field} must look like 2026-11-22 or 2026-11-22T07:30+01:00`);
|
|
34262
|
+
const day2 = parseHealthDay(match[1], field);
|
|
34263
|
+
const hour = Number(match[2]);
|
|
34264
|
+
const minute = Number(match[3]);
|
|
34265
|
+
const second = match[4] === void 0 ? 0 : Number(match[4]);
|
|
34266
|
+
if (hour > 23 || minute > 59 || second > 59) fail(`${field} has an invalid time`);
|
|
34267
|
+
return { day: day2, minute: hour * 60 + minute };
|
|
34268
|
+
}
|
|
34269
|
+
function formatHealthPointAt(position) {
|
|
34270
|
+
if (position.minute === void 0) return position.day;
|
|
34271
|
+
const hours = String(Math.floor(position.minute / 60)).padStart(2, "0");
|
|
34272
|
+
const minutes = String(position.minute % 60).padStart(2, "0");
|
|
34273
|
+
return `${position.day}T${hours}:${minutes}`;
|
|
34274
|
+
}
|
|
34275
|
+
function healthDayDiff(from, to) {
|
|
34276
|
+
const start = Date.parse(`${from}T00:00:00Z`);
|
|
34277
|
+
const end = Date.parse(`${to}T00:00:00Z`);
|
|
34278
|
+
return Math.round((end - start) / 864e5);
|
|
34279
|
+
}
|
|
34280
|
+
function finite(value, field) {
|
|
34281
|
+
if (typeof value !== "number" || !Number.isFinite(value) || Math.abs(value) > HEALTH_VALUE_ABS_MAX) {
|
|
34282
|
+
fail(`${field} must be a finite number`);
|
|
34283
|
+
}
|
|
34284
|
+
return value;
|
|
34285
|
+
}
|
|
34286
|
+
function text2(value, field, max, required2) {
|
|
34287
|
+
if (value === void 0 || value === null) {
|
|
34288
|
+
if (required2) fail(`${field} is required`);
|
|
34289
|
+
return void 0;
|
|
34290
|
+
}
|
|
34291
|
+
if (typeof value !== "string") return fail(`${field} must be text`);
|
|
34292
|
+
const trimmed = value.trim();
|
|
34293
|
+
if (!trimmed && required2) fail(`${field} is required`);
|
|
34294
|
+
if (trimmed.length > max) fail(`${field} must be at most ${max} characters`);
|
|
34295
|
+
return trimmed || void 0;
|
|
34296
|
+
}
|
|
34297
|
+
function record2(value, field) {
|
|
34298
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) fail(`${field} must be an object`);
|
|
34299
|
+
return value;
|
|
34300
|
+
}
|
|
34301
|
+
function onlyKeys(value, allowed, field) {
|
|
34302
|
+
for (const key of Object.keys(value)) {
|
|
34303
|
+
if (!allowed.includes(key)) fail(`${field} has unknown field ${key}`);
|
|
34304
|
+
}
|
|
34305
|
+
}
|
|
34306
|
+
function parseHealthSeriesKey(value, field = "series") {
|
|
34307
|
+
if (typeof value !== "string" || !HEALTH_SERIES_KEY_PATTERN.test(value)) {
|
|
34308
|
+
fail(`${field} must be a key like resting_heart_rate (lowercase letters, digits, underscores)`);
|
|
34309
|
+
}
|
|
34310
|
+
return value;
|
|
34311
|
+
}
|
|
34312
|
+
function parseHealthSeriesDefinition(value, field = "series") {
|
|
34313
|
+
const raw = record2(value, field);
|
|
34314
|
+
onlyKeys(raw, ["key", "label", "unit", "description", "better", "scale", "bands", "resolution"], field);
|
|
34315
|
+
const key = parseHealthSeriesKey(raw.key, `${field}.key`);
|
|
34316
|
+
const label = text2(raw.label, `${field}.label`, HEALTH_SERIES_LABEL_MAX_LENGTH, true);
|
|
34317
|
+
const unit = text2(raw.unit, `${field}.unit`, HEALTH_SERIES_UNIT_MAX_LENGTH, false);
|
|
34318
|
+
const description = text2(raw.description, `${field}.description`, HEALTH_SERIES_DESCRIPTION_MAX_LENGTH, false);
|
|
34319
|
+
if (raw.better !== "higher" && raw.better !== "lower") fail(`${field}.better must be "higher" or "lower"`);
|
|
34320
|
+
const better2 = raw.better;
|
|
34321
|
+
let scale;
|
|
34322
|
+
if (raw.scale !== void 0 && raw.scale !== null) {
|
|
34323
|
+
const rawScale = record2(raw.scale, `${field}.scale`);
|
|
34324
|
+
onlyKeys(rawScale, ["min", "max"], `${field}.scale`);
|
|
34325
|
+
scale = { min: finite(rawScale.min, `${field}.scale.min`), max: finite(rawScale.max, `${field}.scale.max`) };
|
|
34326
|
+
if (scale.max <= scale.min) fail(`${field}.scale.max must be greater than min`);
|
|
34327
|
+
}
|
|
34328
|
+
let bands;
|
|
34329
|
+
if (raw.bands !== void 0 && raw.bands !== null) {
|
|
34330
|
+
const rawBands = record2(raw.bands, `${field}.bands`);
|
|
34331
|
+
onlyKeys(rawBands, ["lower", "upper"], `${field}.bands`);
|
|
34332
|
+
bands = { lower: finite(rawBands.lower, `${field}.bands.lower`), upper: finite(rawBands.upper, `${field}.bands.upper`) };
|
|
34333
|
+
if (bands.upper <= bands.lower) fail(`${field}.bands.upper must be greater than lower`);
|
|
34334
|
+
if (scale && (bands.lower < scale.min || bands.upper > scale.max)) fail(`${field}.bands must lie inside scale`);
|
|
34335
|
+
}
|
|
34336
|
+
if (raw.resolution !== void 0 && raw.resolution !== null && raw.resolution !== "day" && raw.resolution !== "intraday") {
|
|
34337
|
+
fail(`${field}.resolution must be "day" or "intraday"`);
|
|
34338
|
+
}
|
|
34339
|
+
return {
|
|
34340
|
+
key,
|
|
34341
|
+
label,
|
|
34342
|
+
better: better2,
|
|
34343
|
+
...unit ? { unit } : {},
|
|
34344
|
+
...description ? { description } : {},
|
|
34345
|
+
...scale ? { scale } : {},
|
|
34346
|
+
...bands ? { bands } : {},
|
|
34347
|
+
...raw.resolution === "intraday" ? { resolution: "intraday" } : {}
|
|
34348
|
+
};
|
|
34349
|
+
}
|
|
34350
|
+
function list(value, field, max) {
|
|
34351
|
+
if (value === void 0 || value === null) return [];
|
|
34352
|
+
if (!Array.isArray(value)) return fail(`${field} must be a list`);
|
|
34353
|
+
if (value.length > max) fail(`${field} accepts at most ${max} items`);
|
|
34354
|
+
return value;
|
|
34355
|
+
}
|
|
34356
|
+
function parseHealthIntradayDay(value, field = "intraday") {
|
|
34357
|
+
const raw = record2(value, field);
|
|
34358
|
+
onlyKeys(raw, ["series", "day", "stepMinutes", "values"], field);
|
|
34359
|
+
const series = parseHealthSeriesKey(raw.series, `${field}.series`);
|
|
34360
|
+
const day2 = parseHealthDay(raw.day, `${field}.day`);
|
|
34361
|
+
const step = raw.stepMinutes;
|
|
34362
|
+
if (typeof step !== "number" || !Number.isInteger(step) || step < 1 || step > 60 || 1440 % step !== 0) {
|
|
34363
|
+
fail(`${field}.stepMinutes must divide a day: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30 or 60`);
|
|
34364
|
+
}
|
|
34365
|
+
if (!Array.isArray(raw.values)) fail(`${field}.values must be a list`);
|
|
34366
|
+
const values = raw.values;
|
|
34367
|
+
const max = 1440 / step;
|
|
34368
|
+
if (values.length > max) fail(`${field}.values has ${values.length} values; at ${step} minutes a day holds at most ${max}`);
|
|
34369
|
+
return {
|
|
34370
|
+
series,
|
|
34371
|
+
day: day2,
|
|
34372
|
+
stepMinutes: step,
|
|
34373
|
+
values: values.map((item, index) => item === null ? null : finite(item, `${field}.values[${index}]`))
|
|
34374
|
+
};
|
|
34375
|
+
}
|
|
34376
|
+
var positionKey = (series, position) => `${series}|${position.day}|${position.minute ?? ""}`;
|
|
34377
|
+
function parseHealthRecordRequest(value) {
|
|
34378
|
+
const raw = record2(value, "request");
|
|
34379
|
+
onlyKeys(raw, ["series", "points", "intraday", "remove", "removeSeries"], "request");
|
|
34380
|
+
const series = list(raw.series, "series", HEALTH_SERIES_MAX_PER_USER).map((item, index) => parseHealthSeriesDefinition(item, `series[${index}]`));
|
|
34381
|
+
const seriesKeys = /* @__PURE__ */ new Set();
|
|
34382
|
+
for (const definition7 of series) {
|
|
34383
|
+
if (seriesKeys.has(definition7.key)) fail(`series ${definition7.key} is defined twice`);
|
|
34384
|
+
seriesKeys.add(definition7.key);
|
|
34385
|
+
}
|
|
34386
|
+
const seen = /* @__PURE__ */ new Set();
|
|
34387
|
+
const points = list(raw.points, "points", HEALTH_RECORD_MAX_POINTS).map((item, index) => {
|
|
34388
|
+
const field = `points[${index}]`;
|
|
34389
|
+
const point2 = record2(item, field);
|
|
34390
|
+
onlyKeys(point2, ["series", "at", "value"], field);
|
|
34391
|
+
const parsed = {
|
|
34392
|
+
series: parseHealthSeriesKey(point2.series, `${field}.series`),
|
|
34393
|
+
position: parseHealthPointAt(point2.at, `${field}.at`),
|
|
34394
|
+
value: finite(point2.value, `${field}.value`)
|
|
34395
|
+
};
|
|
34396
|
+
const key = positionKey(parsed.series, parsed.position);
|
|
34397
|
+
if (seen.has(key)) fail(`${field} repeats ${parsed.series} at ${formatHealthPointAt(parsed.position)}`);
|
|
34398
|
+
seen.add(key);
|
|
34399
|
+
return parsed;
|
|
34400
|
+
});
|
|
34401
|
+
const remove = list(raw.remove, "remove", HEALTH_RECORD_MAX_REMOVALS).map((item, index) => {
|
|
34402
|
+
const field = `remove[${index}]`;
|
|
34403
|
+
const ref = record2(item, field);
|
|
34404
|
+
onlyKeys(ref, ["series", "at"], field);
|
|
34405
|
+
const parsed = { series: parseHealthSeriesKey(ref.series, `${field}.series`), position: parseHealthPointAt(ref.at, `${field}.at`) };
|
|
34406
|
+
if (seen.has(positionKey(parsed.series, parsed.position))) fail(`${field} also appears in points`);
|
|
34407
|
+
return parsed;
|
|
34408
|
+
});
|
|
34409
|
+
const removeSeries = list(raw.removeSeries, "removeSeries", HEALTH_SERIES_MAX_PER_USER).map((item, index) => parseHealthSeriesKey(item, `removeSeries[${index}]`));
|
|
34410
|
+
for (const key of removeSeries) {
|
|
34411
|
+
if (seriesKeys.has(key)) fail(`series ${key} cannot be defined and removed in one request`);
|
|
34412
|
+
if (points.some((point2) => point2.series === key)) fail(`series ${key} cannot receive points and be removed in one request`);
|
|
34413
|
+
}
|
|
34414
|
+
const intradaySeen = /* @__PURE__ */ new Set();
|
|
34415
|
+
const intraday = list(raw.intraday, "intraday", HEALTH_INTRADAY_MAX_DAYS_PER_RECORD).map((item, index) => {
|
|
34416
|
+
const block = parseHealthIntradayDay(item, `intraday[${index}]`);
|
|
34417
|
+
const key = `${block.series}|${block.day}`;
|
|
34418
|
+
if (intradaySeen.has(key)) fail(`intraday[${index}] repeats ${block.series} on ${block.day}`);
|
|
34419
|
+
if (removeSeries.includes(block.series)) fail(`series ${block.series} cannot receive values and be removed in one request`);
|
|
34420
|
+
intradaySeen.add(key);
|
|
34421
|
+
return block;
|
|
34422
|
+
});
|
|
34423
|
+
if (!series.length && !points.length && !remove.length && !removeSeries.length && !intraday.length) {
|
|
34424
|
+
fail("request needs series, points, intraday, remove or removeSeries");
|
|
34425
|
+
}
|
|
34426
|
+
return { series, points, remove, removeSeries, intraday };
|
|
34427
|
+
}
|
|
34428
|
+
function parseHealthListRequest(value) {
|
|
34429
|
+
const raw = record2(value, "request");
|
|
34430
|
+
onlyKeys(raw, ["from", "to", "series"], "request");
|
|
34431
|
+
const from = parseHealthDay(raw.from, "from");
|
|
34432
|
+
const to = parseHealthDay(raw.to, "to");
|
|
34433
|
+
const span = healthDayDiff(from, to);
|
|
34434
|
+
if (span < 0) fail("to must not be before from");
|
|
34435
|
+
if (span >= HEALTH_READ_MAX_DAYS) fail(`a read covers at most ${HEALTH_READ_MAX_DAYS} days`);
|
|
34436
|
+
const series = raw.series === void 0 || raw.series === null ? void 0 : list(raw.series, "series", HEALTH_SERIES_MAX_PER_USER).map((item, index) => parseHealthSeriesKey(item, `series[${index}]`));
|
|
34437
|
+
return { from, to, ...series ? { series } : {} };
|
|
34438
|
+
}
|
|
34439
|
+
|
|
34440
|
+
// ../packages/shared/src/health-measurement-operations.ts
|
|
34441
|
+
var better = v2.union(v2.literal("higher"), v2.literal("lower"));
|
|
34442
|
+
var healthSeriesViewValidator = v2.object({
|
|
34443
|
+
key: v2.string(),
|
|
34444
|
+
label: v2.string(),
|
|
34445
|
+
unit: v2.optional(v2.string()),
|
|
34446
|
+
description: v2.optional(v2.string()),
|
|
34447
|
+
better,
|
|
34448
|
+
scale: v2.optional(v2.object({ min: v2.number(), max: v2.number() })),
|
|
34449
|
+
bands: v2.optional(v2.object({ lower: v2.number(), upper: v2.number() })),
|
|
34450
|
+
resolution: v2.optional(v2.literal("intraday")),
|
|
34451
|
+
updatedAt: v2.number()
|
|
34452
|
+
});
|
|
34453
|
+
var healthIntradayDayViewValidator = v2.object({
|
|
34454
|
+
series: v2.string(),
|
|
34455
|
+
day: v2.string(),
|
|
34456
|
+
stepMinutes: v2.number(),
|
|
34457
|
+
values: v2.array(v2.union(v2.number(), v2.null()))
|
|
34458
|
+
});
|
|
34459
|
+
var healthPointViewValidator = v2.object({
|
|
34460
|
+
series: v2.string(),
|
|
34461
|
+
day: v2.string(),
|
|
34462
|
+
minute: v2.optional(v2.number()),
|
|
34463
|
+
value: v2.number()
|
|
34464
|
+
});
|
|
34465
|
+
var healthListResultValidator = v2.object({
|
|
34466
|
+
from: v2.string(),
|
|
34467
|
+
to: v2.string(),
|
|
34468
|
+
series: v2.array(healthSeriesViewValidator),
|
|
34469
|
+
points: v2.array(healthPointViewValidator),
|
|
34470
|
+
intraday: v2.array(healthIntradayDayViewValidator)
|
|
34471
|
+
});
|
|
34472
|
+
var healthRecordResultValidator = v2.object({
|
|
34473
|
+
seriesCreated: v2.number(),
|
|
34474
|
+
seriesUpdated: v2.number(),
|
|
34475
|
+
seriesRemoved: v2.number(),
|
|
34476
|
+
pointsInserted: v2.number(),
|
|
34477
|
+
pointsUpdated: v2.number(),
|
|
34478
|
+
pointsUnchanged: v2.number(),
|
|
34479
|
+
pointsRemoved: v2.number(),
|
|
34480
|
+
intradayDaysWritten: v2.number(),
|
|
34481
|
+
intradayDaysRemoved: v2.number()
|
|
34482
|
+
});
|
|
34483
|
+
var healthMeasurementResults = {
|
|
34484
|
+
recordHealthMeasurements: healthRecordResultValidator,
|
|
34485
|
+
listHealthMeasurements: healthListResultValidator
|
|
34486
|
+
};
|
|
34487
|
+
var healthMeasurementAliases = {
|
|
34488
|
+
health_measurements_record: "recordHealthMeasurements",
|
|
34489
|
+
health_measurements_list: "listHealthMeasurements"
|
|
34490
|
+
};
|
|
34491
|
+
function invalid3(operation, error62) {
|
|
34492
|
+
if (error62 instanceof HealthMeasurementError) throw new OperationInputError(operation, [{ path: [], reason: "custom" }], error62.message);
|
|
34493
|
+
throw error62;
|
|
34494
|
+
}
|
|
34495
|
+
function parseHealthMeasurementRequest(operation, raw) {
|
|
34496
|
+
try {
|
|
34497
|
+
if (operation === "recordHealthMeasurements") {
|
|
34498
|
+
parseHealthRecordRequest(raw);
|
|
34499
|
+
return { operation, input: raw };
|
|
34500
|
+
}
|
|
34501
|
+
return { operation, input: parseHealthListRequest(raw) };
|
|
34502
|
+
} catch (error62) {
|
|
34503
|
+
return invalid3(operation, error62);
|
|
34504
|
+
}
|
|
34505
|
+
}
|
|
34506
|
+
var seriesRef = { type: "string" };
|
|
34507
|
+
var at = { type: "string", description: "YYYY-MM-DD or local YYYY-MM-DDTHH:MM, kept as written" };
|
|
34508
|
+
var pair2 = (lower, upper) => ({
|
|
34509
|
+
type: "object",
|
|
34510
|
+
additionalProperties: false,
|
|
34511
|
+
properties: { [lower]: { type: "number" }, [upper]: { type: "number" } },
|
|
34512
|
+
required: [lower, upper]
|
|
34513
|
+
});
|
|
34514
|
+
var recordInputSchema = {
|
|
34515
|
+
type: "object",
|
|
34516
|
+
additionalProperties: false,
|
|
34517
|
+
properties: {
|
|
34518
|
+
series: {
|
|
34519
|
+
type: "array",
|
|
34520
|
+
maxItems: HEALTH_SERIES_MAX_PER_USER,
|
|
34521
|
+
items: {
|
|
34522
|
+
type: "object",
|
|
34523
|
+
additionalProperties: false,
|
|
34524
|
+
required: ["key", "label", "better"],
|
|
34525
|
+
properties: {
|
|
34526
|
+
key: { type: "string", pattern: HEALTH_SERIES_KEY_PATTERN.source },
|
|
34527
|
+
label: { type: "string", minLength: 1, maxLength: HEALTH_SERIES_LABEL_MAX_LENGTH },
|
|
34528
|
+
unit: { type: "string", maxLength: HEALTH_SERIES_UNIT_MAX_LENGTH },
|
|
34529
|
+
description: { type: "string", maxLength: HEALTH_SERIES_DESCRIPTION_MAX_LENGTH },
|
|
34530
|
+
better: { enum: ["higher", "lower"] },
|
|
34531
|
+
scale: pair2("min", "max"),
|
|
34532
|
+
bands: { ...pair2("lower", "upper"), description: "Omit for personal bands" },
|
|
34533
|
+
resolution: { enum: ["day", "intraday"] }
|
|
34534
|
+
}
|
|
34535
|
+
}
|
|
34536
|
+
},
|
|
34537
|
+
points: {
|
|
34538
|
+
type: "array",
|
|
34539
|
+
maxItems: HEALTH_RECORD_MAX_POINTS,
|
|
34540
|
+
items: {
|
|
34541
|
+
type: "object",
|
|
34542
|
+
additionalProperties: false,
|
|
34543
|
+
required: ["series", "at", "value"],
|
|
34544
|
+
properties: { series: seriesRef, at, value: { type: "number" } }
|
|
34545
|
+
}
|
|
34546
|
+
},
|
|
34547
|
+
intraday: {
|
|
34548
|
+
type: "array",
|
|
34549
|
+
maxItems: HEALTH_INTRADAY_MAX_DAYS_PER_RECORD,
|
|
34550
|
+
description: "values per step from 00:00",
|
|
34551
|
+
items: {
|
|
34552
|
+
type: "object",
|
|
34553
|
+
required: ["series", "day", "stepMinutes", "values"],
|
|
34554
|
+
properties: { series: seriesRef, day: seriesRef, stepMinutes: { type: "integer" }, values: { type: "array" } }
|
|
34555
|
+
}
|
|
34556
|
+
},
|
|
34557
|
+
remove: {
|
|
34558
|
+
type: "array",
|
|
34559
|
+
maxItems: HEALTH_RECORD_MAX_REMOVALS,
|
|
34560
|
+
items: { type: "object", additionalProperties: false, required: ["series", "at"], properties: { series: seriesRef, at } }
|
|
34561
|
+
},
|
|
34562
|
+
removeSeries: { type: "array", maxItems: HEALTH_SERIES_MAX_PER_USER, items: seriesRef }
|
|
34563
|
+
},
|
|
34564
|
+
required: []
|
|
34565
|
+
};
|
|
34566
|
+
var day = { type: "string", pattern: "^\\d{4}-\\d{2}-\\d{2}$" };
|
|
34567
|
+
var listInputSchema = {
|
|
34568
|
+
type: "object",
|
|
34569
|
+
additionalProperties: false,
|
|
34570
|
+
properties: {
|
|
34571
|
+
from: day,
|
|
34572
|
+
to: { ...day, description: `Inclusive; at most ${HEALTH_READ_MAX_DAYS} days after from` },
|
|
34573
|
+
series: { type: "array", maxItems: HEALTH_SERIES_MAX_PER_USER, items: seriesRef }
|
|
34574
|
+
},
|
|
34575
|
+
required: ["from", "to"]
|
|
34576
|
+
};
|
|
34577
|
+
var ownerOnly = " Owner's own personal agent only.";
|
|
34578
|
+
var descriptions4 = {
|
|
34579
|
+
recordHealthMeasurements: "Write the owner's health series for the calendar: define series, then send points or whole intraday days. Same series and at replace; remove, removeSeries delete." + ownerOnly,
|
|
34580
|
+
listHealthMeasurements: `Read the owner's health series, points and intraday days from..to (inclusive), max ${HEALTH_READ_MAX_POINTS} points.` + ownerOnly
|
|
34581
|
+
};
|
|
34582
|
+
function definition2(name4, inputSchema2) {
|
|
34583
|
+
const resultSchema3 = operationResultSchema(healthMeasurementResults[name4]);
|
|
34584
|
+
return {
|
|
34585
|
+
name: name4,
|
|
34586
|
+
aliases: operationAliases(healthMeasurementAliases, name4),
|
|
34587
|
+
actor: "agent",
|
|
34588
|
+
description: descriptions4[name4],
|
|
34589
|
+
inputSchema: inputSchema2,
|
|
34590
|
+
resultSchema: resultSchema3,
|
|
34591
|
+
errorSchema: operationErrorSchema,
|
|
34592
|
+
outputSchema: { type: "object", properties: { data: resultSchema3 }, required: ["data"], additionalProperties: false },
|
|
34593
|
+
capability: name4 === "listHealthMeasurements" ? "read" : "write",
|
|
34594
|
+
executionProfile: "full",
|
|
34595
|
+
resultProjection: "full",
|
|
34596
|
+
environment: "content",
|
|
34597
|
+
availability: {
|
|
34598
|
+
hosted: false,
|
|
34599
|
+
external: true,
|
|
34600
|
+
browserHuman: false,
|
|
34601
|
+
agentConnection: true,
|
|
34602
|
+
executionProfiles: ["full", "public-cli"],
|
|
34603
|
+
runtime: name4 === "listHealthMeasurements" ? "query" : "mutation"
|
|
34604
|
+
},
|
|
34605
|
+
resourcePolicy: {
|
|
34606
|
+
selector: "credential-owner",
|
|
34607
|
+
identity: "own-active-personal-agent",
|
|
34608
|
+
enforcement: "live-principal-in-protected-transaction",
|
|
34609
|
+
hostedThreads: "refused"
|
|
34610
|
+
},
|
|
34611
|
+
limits: {
|
|
34612
|
+
seriesPerUser: HEALTH_SERIES_MAX_PER_USER,
|
|
34613
|
+
recordPoints: HEALTH_RECORD_MAX_POINTS,
|
|
34614
|
+
recordRemovals: HEALTH_RECORD_MAX_REMOVALS,
|
|
34615
|
+
readDays: HEALTH_READ_MAX_DAYS,
|
|
34616
|
+
readPoints: HEALTH_READ_MAX_POINTS,
|
|
34617
|
+
removeSeriesPoints: HEALTH_SERIES_REMOVE_MAX_POINTS,
|
|
34618
|
+
recordIntradayDays: HEALTH_INTRADAY_MAX_DAYS_PER_RECORD,
|
|
34619
|
+
readIntradayValues: HEALTH_INTRADAY_READ_MAX_VALUES
|
|
34620
|
+
}
|
|
34621
|
+
};
|
|
34622
|
+
}
|
|
34623
|
+
var definitions3 = {
|
|
34624
|
+
recordHealthMeasurements: definition2("recordHealthMeasurements", recordInputSchema),
|
|
34625
|
+
listHealthMeasurements: definition2("listHealthMeasurements", listInputSchema)
|
|
34626
|
+
};
|
|
34627
|
+
var healthMeasurementCatalog = [definitions3.recordHealthMeasurements, definitions3.listHealthMeasurements];
|
|
34628
|
+
|
|
34072
34629
|
// core/transport.ts
|
|
34073
34630
|
var RestClient = class {
|
|
34074
34631
|
baseUrl;
|
|
@@ -34209,18 +34766,18 @@ var RestClient = class {
|
|
|
34209
34766
|
throw new Error(`Could not reach the ente API (${path12}): ${String(err)}`);
|
|
34210
34767
|
}
|
|
34211
34768
|
clearTimeout(timer);
|
|
34212
|
-
const
|
|
34213
|
-
if (resp.status >= 400) throw toApiError(resp.status, resp.statusText,
|
|
34214
|
-
if (!
|
|
34215
|
-
return JSON.parse(
|
|
34769
|
+
const text4 = await resp.text();
|
|
34770
|
+
if (resp.status >= 400) throw toApiError(resp.status, resp.statusText, text4);
|
|
34771
|
+
if (!text4) return null;
|
|
34772
|
+
return JSON.parse(text4);
|
|
34216
34773
|
}
|
|
34217
34774
|
};
|
|
34218
|
-
function toApiError(status2, statusText,
|
|
34775
|
+
function toApiError(status2, statusText, text4) {
|
|
34219
34776
|
let message4 = statusText || "Unknown error";
|
|
34220
34777
|
let structured = {};
|
|
34221
|
-
if (
|
|
34778
|
+
if (text4) {
|
|
34222
34779
|
try {
|
|
34223
|
-
const data = JSON.parse(
|
|
34780
|
+
const data = JSON.parse(text4);
|
|
34224
34781
|
const raw = data.error;
|
|
34225
34782
|
if (raw && typeof raw === "object") {
|
|
34226
34783
|
structured = raw;
|
|
@@ -35274,13 +35831,13 @@ var EnteClient = class _EnteClient {
|
|
|
35274
35831
|
* against its owning declaration, without discovery or reconstruction reads. */
|
|
35275
35832
|
async operationData(operation, input2) {
|
|
35276
35833
|
const rpc = await this.rest.post("/api/mcp", { jsonrpc: "2.0", id: 1, method: "tools/call", params: { name: operation, arguments: input2 } });
|
|
35277
|
-
const
|
|
35278
|
-
if (
|
|
35279
|
-
const data =
|
|
35834
|
+
const record3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
35835
|
+
if (record3(rpc) && record3(rpc.error)) {
|
|
35836
|
+
const data = record3(rpc.error.data) ? rpc.error.data : {};
|
|
35280
35837
|
const status2 = data.code === APP_ERROR_CODES.forbidden ? 403 : data.code === APP_ERROR_CODES.unauthenticated ? 401 : data.code === APP_ERROR_CODES.notFound ? 404 : data.code === APP_ERROR_CODES.internal ? 500 : 400;
|
|
35281
35838
|
throw new ApiError(status2, typeof rpc.error.message === "string" ? rpc.error.message : "Operation failed", data);
|
|
35282
35839
|
}
|
|
35283
|
-
if (!
|
|
35840
|
+
if (!record3(rpc) || !record3(rpc.result) || rpc.result.isError === true || !record3(rpc.result.structuredContent)) throw new OperationResultError(operation);
|
|
35284
35841
|
return rpc.result.structuredContent.data;
|
|
35285
35842
|
}
|
|
35286
35843
|
createEntity(body) {
|
|
@@ -35405,6 +35962,19 @@ var EnteClient = class _EnteClient {
|
|
|
35405
35962
|
const result = await this.rest.post("/api/external/agent/tasks", request.input);
|
|
35406
35963
|
return { data: parseOperationResult("manageAssignedTasks", taskCommandResults[body.operation], result.data) };
|
|
35407
35964
|
}
|
|
35965
|
+
// --- health measurements (the credential owner's own data) -------------
|
|
35966
|
+
async recordHealthMeasurements(body) {
|
|
35967
|
+
const request = parseHealthMeasurementRequest("recordHealthMeasurements", body);
|
|
35968
|
+
const result = await this.rest.post("/api/external/health/measurements", request.input);
|
|
35969
|
+
return { data: parseOperationResult("recordHealthMeasurements", healthMeasurementResults.recordHealthMeasurements, result.data) };
|
|
35970
|
+
}
|
|
35971
|
+
async listHealthMeasurements(input2) {
|
|
35972
|
+
const request = parseHealthMeasurementRequest("listHealthMeasurements", input2);
|
|
35973
|
+
if (request.operation !== "listHealthMeasurements") throw new Error("Unexpected health request");
|
|
35974
|
+
const { from, to, series } = request.input;
|
|
35975
|
+
const result = await this.rest.get("/api/external/health/measurements", { from, to, series: series?.join(",") });
|
|
35976
|
+
return { data: parseOperationResult("listHealthMeasurements", healthMeasurementResults.listHealthMeasurements, result.data) };
|
|
35977
|
+
}
|
|
35408
35978
|
// --- external credential context / bound agent ------------------------
|
|
35409
35979
|
adminSettings(operation, input2) {
|
|
35410
35980
|
return this.rest.post("/api/external/admin/settings/" + operation.replace("settings_", ""), settingsInputSchemas[operation].parse(input2));
|
|
@@ -35429,10 +35999,10 @@ var EnteClient = class _EnteClient {
|
|
|
35429
35999
|
listAgentThreads(params) {
|
|
35430
36000
|
return this.rest.get("/api/external/agent/threads", params);
|
|
35431
36001
|
}
|
|
35432
|
-
getAgentThread(threadId,
|
|
36002
|
+
getAgentThread(threadId, cursor2, limit3) {
|
|
35433
36003
|
return this.rest.get("/api/external/agent/thread", {
|
|
35434
36004
|
threadId,
|
|
35435
|
-
...
|
|
36005
|
+
...cursor2 ? { cursor: cursor2 } : {},
|
|
35436
36006
|
...limit3 ? { limit: String(limit3) } : {}
|
|
35437
36007
|
});
|
|
35438
36008
|
}
|
|
@@ -35467,10 +36037,10 @@ var EnteClient = class _EnteClient {
|
|
|
35467
36037
|
params
|
|
35468
36038
|
);
|
|
35469
36039
|
}
|
|
35470
|
-
getAgentMailThread(threadId,
|
|
36040
|
+
getAgentMailThread(threadId, cursor2) {
|
|
35471
36041
|
return this.rest.get(
|
|
35472
36042
|
"/api/external/agent-mail/thread",
|
|
35473
|
-
{ threadId, cursor:
|
|
36043
|
+
{ threadId, cursor: cursor2 }
|
|
35474
36044
|
);
|
|
35475
36045
|
}
|
|
35476
36046
|
/** Raw bytes for one attachment in the key's bound agent inbox. */
|
|
@@ -35534,8 +36104,8 @@ function berlinOffsetMs(utcMs) {
|
|
|
35534
36104
|
const asUtc = Date.UTC(p.year, p.month - 1, p.day, p.hour, p.minute, p.second);
|
|
35535
36105
|
return asUtc - utcMs;
|
|
35536
36106
|
}
|
|
35537
|
-
function berlinToEpochMs(year, month,
|
|
35538
|
-
const naive = Date.UTC(year, month - 1,
|
|
36107
|
+
function berlinToEpochMs(year, month, day2, hour, minute, second = 0) {
|
|
36108
|
+
const naive = Date.UTC(year, month - 1, day2, hour, minute, second);
|
|
35539
36109
|
const off = berlinOffsetMs(naive);
|
|
35540
36110
|
let ms = naive - off;
|
|
35541
36111
|
const off2 = berlinOffsetMs(ms);
|
|
@@ -36623,13 +37193,13 @@ var require_buffer_util = __commonJS2({
|
|
|
36623
37193
|
"use strict";
|
|
36624
37194
|
var { EMPTY_BUFFER } = require_constants();
|
|
36625
37195
|
var FastBuffer = Buffer[Symbol.species];
|
|
36626
|
-
function concat(
|
|
36627
|
-
if (
|
|
36628
|
-
if (
|
|
37196
|
+
function concat(list3, totalLength) {
|
|
37197
|
+
if (list3.length === 0) return EMPTY_BUFFER;
|
|
37198
|
+
if (list3.length === 1) return list3[0];
|
|
36629
37199
|
const target3 = Buffer.allocUnsafe(totalLength);
|
|
36630
37200
|
let offset = 0;
|
|
36631
|
-
for (let i = 0; i <
|
|
36632
|
-
const buf =
|
|
37201
|
+
for (let i = 0; i < list3.length; i++) {
|
|
37202
|
+
const buf = list3[i];
|
|
36633
37203
|
target3.set(buf, offset);
|
|
36634
37204
|
offset += buf.length;
|
|
36635
37205
|
}
|
|
@@ -38414,14 +38984,14 @@ var require_sender = __commonJS2({
|
|
|
38414
38984
|
* @param {Function} [cb] Callback
|
|
38415
38985
|
* @private
|
|
38416
38986
|
*/
|
|
38417
|
-
sendFrame(
|
|
38418
|
-
if (
|
|
38987
|
+
sendFrame(list3, cb) {
|
|
38988
|
+
if (list3.length === 2) {
|
|
38419
38989
|
this._socket.cork();
|
|
38420
|
-
this._socket.write(
|
|
38421
|
-
this._socket.write(
|
|
38990
|
+
this._socket.write(list3[0]);
|
|
38991
|
+
this._socket.write(list3[1], cb);
|
|
38422
38992
|
this._socket.uncork();
|
|
38423
38993
|
} else {
|
|
38424
|
-
this._socket.write(
|
|
38994
|
+
this._socket.write(list3[0], cb);
|
|
38425
38995
|
}
|
|
38426
38996
|
}
|
|
38427
38997
|
};
|
|
@@ -41045,7 +41615,7 @@ function parseActivityFieldRequest(name4, validator, raw) {
|
|
|
41045
41615
|
if (!validate2(validator, raw)) throw new OperationInputError(name4, [{ path: [], reason: "custom" }]);
|
|
41046
41616
|
return raw;
|
|
41047
41617
|
}
|
|
41048
|
-
function
|
|
41618
|
+
function definition3(name4) {
|
|
41049
41619
|
const read = name4 === "getActivityFields";
|
|
41050
41620
|
const resultSchema3 = operationResultSchema(read ? activityFieldReadResult : activityFieldConfigureResult);
|
|
41051
41621
|
return {
|
|
@@ -41067,7 +41637,7 @@ function definition2(name4) {
|
|
|
41067
41637
|
resourcePolicy: { selector: "explicit-space-and-activity-type", authority: "live-scope-and-space-manager", hidden: "presentation-only", copy: "exact-source-and-target-fingerprints" }
|
|
41068
41638
|
};
|
|
41069
41639
|
}
|
|
41070
|
-
var activityFieldLayoutCatalog = [
|
|
41640
|
+
var activityFieldLayoutCatalog = [definition3("getActivityFields"), definition3("configureActivityFields")];
|
|
41071
41641
|
var activityFieldBrowserSpecs = activityFieldLayoutCatalog.map((entry) => ({
|
|
41072
41642
|
name: entry.name === "getActivityFields" ? "ente_activity_fields_get" : "ente_activity_fields_configure",
|
|
41073
41643
|
title: entry.title,
|
|
@@ -41901,7 +42471,7 @@ var relationshipPublicListRow = external_exports.strictObject({
|
|
|
41901
42471
|
role: external_exports.string().max(RELATIONSHIP_LIMITS.role).optional(),
|
|
41902
42472
|
displayOrder: external_exports.number().finite().optional(),
|
|
41903
42473
|
includeInAggregation: external_exports.boolean(),
|
|
41904
|
-
targetEntity: external_exports.strictObject({ _id: id15, name: external_exports.string(), type: external_exports.enum(ENTITY_TYPE_VALUES), customIcon: entityReadFields.customIcon, customIconColor: entityReadFields.customIconColor, displayName: external_exports.string(), parentNames: external_exports.array(external_exports.string()), parentDetails: external_exports.array(readParentDetail) }).nullable()
|
|
42474
|
+
targetEntity: external_exports.strictObject({ _id: id15, name: external_exports.string(), type: external_exports.enum(ENTITY_TYPE_VALUES), customIcon: entityReadFields.customIcon, customIconColor: entityReadFields.customIconColor, imageId: id15.optional(), displayName: external_exports.string(), parentNames: external_exports.array(external_exports.string()), parentDetails: external_exports.array(readParentDetail) }).nullable()
|
|
41905
42475
|
});
|
|
41906
42476
|
var relationshipPublicList = external_exports.array(relationshipPublicListRow).max(RELATIONSHIP_LIMITS.rows);
|
|
41907
42477
|
function projectRelationshipCliList(raw) {
|
|
@@ -41935,9 +42505,9 @@ var uploadRetryInstructions = [
|
|
|
41935
42505
|
// ../packages/shared/src/task-read-operations.ts
|
|
41936
42506
|
var TASK_READ_LIMITS = { results: 200, children: 100, childLinks: 1e3, childSources: 400 };
|
|
41937
42507
|
var id16 = external_exports.string().min(1).max(128);
|
|
41938
|
-
var
|
|
42508
|
+
var list2 = { field: activityFieldFiltersSchema.optional(), spaceId: id16.optional(), entityId: id16.optional(), onlyOpen: external_exports.boolean().default(true), dueBy: activityWriteDeadline.optional(), assignee: external_exports.enum(["me", "meOrUnassigned", "unassigned"]).optional(), assigneeUserId: id16.optional(), assigneeEmail: external_exports.string().optional(), assigneeAgentId: id16.optional(), agentTaskDisplay: external_exports.enum(["show", "dim", "hideAgentOnly", "hideAllWithAgent"]).optional() };
|
|
41939
42509
|
var taskReadInputs = {
|
|
41940
|
-
listTasks: external_exports.strictObject(
|
|
42510
|
+
listTasks: external_exports.strictObject(list2),
|
|
41941
42511
|
getTaskByNumber: external_exports.strictObject({ number: external_exports.number().int().positive().max(Number.MAX_SAFE_INTEGER), spaceId: id16.optional() }),
|
|
41942
42512
|
listOpenTasks: external_exports.strictObject({ spaceId: id16 }),
|
|
41943
42513
|
listTasksDueBy: external_exports.strictObject({ spaceId: id16, deadline: activityWriteDeadline, includeOverdue: external_exports.boolean().default(true) }),
|
|
@@ -42026,34 +42596,40 @@ function decodeActivityContentCursor(raw) {
|
|
|
42026
42596
|
const parsed = documentCursor.safeParse({ version: match[1] === "null" ? null : Number(match[1]), blockIndex: Number(match[2]), offset: Number(match[3]) });
|
|
42027
42597
|
return parsed.success ? { kind: "document", ...parsed.data } : null;
|
|
42028
42598
|
}
|
|
42029
|
-
var
|
|
42599
|
+
var activityContentCursor = external_exports.string().refine((value) => decodeActivityContentCursor(value) !== null, "Invalid activity content cursor");
|
|
42030
42600
|
var target = external_exports.string().regex(/^b:\d+$/).refine((value) => Number.isSafeInteger(Number(value.slice(2))), "Invalid block target");
|
|
42031
|
-
var
|
|
42032
|
-
var fragment =
|
|
42601
|
+
var text3 = external_exports.string().max(ACTIVITY_CONTENT_LIMITS.maxEditCharacters);
|
|
42602
|
+
var fragment = text3.regex(/\S/, "A nonempty fragment is required");
|
|
42033
42603
|
var activityContentEditOperation = external_exports.discriminatedUnion("type", [
|
|
42034
|
-
external_exports.strictObject({ type: external_exports.literal("replaceBlock"), target, markdown:
|
|
42604
|
+
external_exports.strictObject({ type: external_exports.literal("replaceBlock"), target, markdown: text3 }),
|
|
42035
42605
|
external_exports.strictObject({ type: external_exports.literal("insertBefore"), target, markdown: fragment }),
|
|
42036
42606
|
external_exports.strictObject({ type: external_exports.literal("insertAfter"), target, markdown: fragment }),
|
|
42037
42607
|
external_exports.strictObject({ type: external_exports.literal("deleteBlock"), target }),
|
|
42038
|
-
external_exports.strictObject({ type: external_exports.literal("replaceText"), target, oldText:
|
|
42608
|
+
external_exports.strictObject({ type: external_exports.literal("replaceText"), target, oldText: text3.min(1), newText: text3 }),
|
|
42039
42609
|
external_exports.strictObject({ type: external_exports.literal("append"), markdown: fragment })
|
|
42040
42610
|
]);
|
|
42041
|
-
var readFields = { activityId: external_exports.string().min(1), cursor:
|
|
42611
|
+
var readFields = { activityId: external_exports.string().min(1), cursor: activityContentCursor.optional(), expectedContentVersion: activityContentVersion.optional() };
|
|
42042
42612
|
var operations = external_exports.array(activityContentEditOperation).min(1).max(ACTIVITY_CONTENT_LIMITS.maxEditOperations).refine((values) => values.reduce((sum, value) => sum + (value.type === "deleteBlock" ? 0 : value.type === "replaceText" ? value.oldText.length + value.newText.length : value.markdown.length), 0) <= ACTIVITY_CONTENT_LIMITS.maxEditCharacters, "Edit text exceeds the batch limit");
|
|
42043
42613
|
var activityContentInputs = {
|
|
42614
|
+
readActivityContents: external_exports.strictObject({
|
|
42615
|
+
items: external_exports.array(external_exports.strictObject(readFields)).min(1).max(10),
|
|
42616
|
+
maxCharacters: safeInteger.min(1).max(1e5).default(5e4)
|
|
42617
|
+
}),
|
|
42044
42618
|
readActivityContent: external_exports.strictObject({ ...readFields, maxBlocks: safeInteger.min(1).max(ACTIVITY_CONTENT_LIMITS.maxBlocks).default(ACTIVITY_CONTENT_LIMITS.defaultBlocks), maxCharacters: safeInteger.min(1).max(ACTIVITY_CONTENT_LIMITS.maxCharacters).default(ACTIVITY_CONTENT_LIMITS.defaultCharacters) }),
|
|
42045
42619
|
editActivityContent: external_exports.strictObject({ activityId: readFields.activityId, expectedContentVersion: activityContentVersion, operations })
|
|
42046
42620
|
};
|
|
42047
42621
|
var legacyActivityContentReadInput = external_exports.strictObject({ ...readFields, maxBlocks: safeInteger.min(1).optional(), maxCharacters: safeInteger.min(1).optional() });
|
|
42048
|
-
var activityContentAliases = { activities_contentRead: "readActivityContent", activities_contentEdit: "editActivityContent" };
|
|
42622
|
+
var activityContentAliases = { activities_contentsRead: "readActivityContents", activities_contentRead: "readActivityContent", activities_contentEdit: "editActivityContent" };
|
|
42049
42623
|
function isActivityContentAlias(value) {
|
|
42050
42624
|
return Object.hasOwn(activityContentAliases, value);
|
|
42051
42625
|
}
|
|
42052
42626
|
function parseActivityContentRequest(operation, raw) {
|
|
42627
|
+
if (operation === "readActivityContents") return { operation, input: parseOperationInput(operation, activityContentInputs.readActivityContents, raw) };
|
|
42053
42628
|
return operation === "readActivityContent" ? { operation, input: parseOperationInput(operation, activityContentInputs.readActivityContent, raw) } : { operation, input: parseOperationInput(operation, activityContentInputs.editActivityContent, raw) };
|
|
42054
42629
|
}
|
|
42055
42630
|
function parseLegacyActivityContentRequest(name4, raw) {
|
|
42056
42631
|
const operation = isActivityContentAlias(name4) ? activityContentAliases[name4] : name4;
|
|
42632
|
+
if (operation === "readActivityContents") return parseActivityContentRequest(operation, raw);
|
|
42057
42633
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return parseActivityContentRequest(operation, raw);
|
|
42058
42634
|
const input2 = Object.fromEntries(Object.entries(raw).filter(([key]) => Object.hasOwn(activityContentInputs[operation].shape, key)));
|
|
42059
42635
|
if (operation === "editActivityContent") return parseActivityContentRequest(operation, input2);
|
|
@@ -42238,6 +42814,7 @@ function graphProgress(command, operation, planned, ids2 = {}) {
|
|
|
42238
42814
|
}
|
|
42239
42815
|
|
|
42240
42816
|
// ente/commands/entity.ts
|
|
42817
|
+
import { readFileSync as readFileSync7 } from "node:fs";
|
|
42241
42818
|
init_server();
|
|
42242
42819
|
|
|
42243
42820
|
// ente/pinRole.ts
|
|
@@ -42312,19 +42889,19 @@ var htmlAliases = {
|
|
|
42312
42889
|
function isHtmlOperationName(name4) {
|
|
42313
42890
|
return Object.hasOwn(htmlInputs, name4);
|
|
42314
42891
|
}
|
|
42315
|
-
var
|
|
42892
|
+
var descriptions5 = {
|
|
42316
42893
|
listHtmlBlocks: "List interactive HTML block summaries in one accessible Ente document, without source. Use an activity ID directly for its body.",
|
|
42317
42894
|
addHtmlBlock: "Append a self-contained interactive HTML block without replacing surrounding document content. Use normal Markdown for non-visual information.",
|
|
42318
42895
|
getHtmlBlock: "Read one interactive HTML block including its source. Read immediately before updateHtmlBlock and copy its artifactId and versionId.",
|
|
42319
42896
|
updateHtmlBlock: "Revise one interactive HTML block without replacing surrounding content. Pass the artifactId and expectedVersionId from the current read; stale updates fail closed."
|
|
42320
42897
|
};
|
|
42321
|
-
function
|
|
42898
|
+
function definition4(name4) {
|
|
42322
42899
|
const schema = external_exports.toJSONSchema(htmlInputs[name4], { io: "input" });
|
|
42323
42900
|
return {
|
|
42324
42901
|
name: name4,
|
|
42325
42902
|
aliases: operationAliases(htmlAliases, name4),
|
|
42326
42903
|
actor: "agent",
|
|
42327
|
-
description:
|
|
42904
|
+
description: descriptions5[name4],
|
|
42328
42905
|
inputSchema: { type: "object", properties: schema.properties ?? {}, required: schema.required ?? [], additionalProperties: false },
|
|
42329
42906
|
resultSchema: operationResultSchema(htmlResults[name4]),
|
|
42330
42907
|
outputSchema: { type: "object", properties: { data: operationResultSchema(htmlResults[name4]) }, required: ["data"], additionalProperties: false },
|
|
@@ -42350,8 +42927,8 @@ function definition3(name4) {
|
|
|
42350
42927
|
}
|
|
42351
42928
|
};
|
|
42352
42929
|
}
|
|
42353
|
-
var
|
|
42354
|
-
var htmlCatalog = [...
|
|
42930
|
+
var definitions4 = new Map(Object.keys(htmlInputs).filter(isHtmlOperationName).map((name4) => [name4, definition4(name4)]));
|
|
42931
|
+
var htmlCatalog = [...definitions4.values()];
|
|
42355
42932
|
|
|
42356
42933
|
// ente/htmlBlocks.ts
|
|
42357
42934
|
var htmlArtifactsList = makeFunctionReference("htmlArtifacts:list");
|
|
@@ -42481,6 +43058,9 @@ var entitiesCreate = makeFunctionReference("entities:create");
|
|
|
42481
43058
|
var entitiesFindById = makeFunctionReference(
|
|
42482
43059
|
"entities:findById"
|
|
42483
43060
|
);
|
|
43061
|
+
var entitiesSetImage = makeFunctionReference(
|
|
43062
|
+
"entities:setImage"
|
|
43063
|
+
);
|
|
42484
43064
|
var entitiesUpdateName = makeFunctionReference(
|
|
42485
43065
|
"entities:updateName"
|
|
42486
43066
|
);
|
|
@@ -42751,6 +43331,38 @@ var EntityRename = class extends ProfileCommand {
|
|
|
42751
43331
|
);
|
|
42752
43332
|
}
|
|
42753
43333
|
};
|
|
43334
|
+
var ENTITY_IMAGE_FILE_TYPES = { png: "image/png", jpg: "image/jpeg", jpeg: "image/jpeg", webp: "image/webp" };
|
|
43335
|
+
var EntitySetImage = class extends ProfileCommand {
|
|
43336
|
+
static paths = [["entity", "set-image"]];
|
|
43337
|
+
static usage = Command.Usage({
|
|
43338
|
+
category: "Entity",
|
|
43339
|
+
description: "Set or remove an entity's logo or photo (shown instead of its type icon)",
|
|
43340
|
+
details: `Send a square PNG, JPEG or WebP, at most ${ENTITY_IMAGE_MAX_DIMENSION} \xD7 ${ENTITY_IMAGE_MAX_DIMENSION} px and ${ENTITY_IMAGE_MAX_BYTES / 1024} KB. Downscale first, e.g. \`sips -Z ${ENTITY_IMAGE_OUTPUT_SIZE} logo.png --out small.png\` on macOS. Persons render as a circle, other entities as a rounded square.`,
|
|
43341
|
+
examples: [["Set a project logo", '$0 entity set-image "Ente" --file ./ente.png'], ["Remove it", '$0 entity set-image "Ente" --remove']]
|
|
43342
|
+
});
|
|
43343
|
+
nameOrId = options_exports.String();
|
|
43344
|
+
file = options_exports.String("--file", { description: `PNG, JPEG or WebP, at most ${ENTITY_IMAGE_MAX_DIMENSION} px and ${ENTITY_IMAGE_MAX_BYTES / 1024} KB` });
|
|
43345
|
+
remove = options_exports.Boolean("--remove", false, { description: "Remove the image and show the type icon again" });
|
|
43346
|
+
async run() {
|
|
43347
|
+
if (Number(this.remove) + Number(this.file !== void 0) !== 1) throw new Error("Provide --file <path> or --remove.");
|
|
43348
|
+
requireEntitySelector("setEntityImage", this.nameOrId, "entityId");
|
|
43349
|
+
let image = null;
|
|
43350
|
+
if (this.file !== void 0) {
|
|
43351
|
+
const mimeType = ENTITY_IMAGE_FILE_TYPES[this.file.split(".").pop()?.toLowerCase() ?? ""];
|
|
43352
|
+
if (!mimeType) throw new Error("Use a .png, .jpg, .jpeg or .webp file.");
|
|
43353
|
+
image = `data:${mimeType};base64,${readFileSync7(this.file).toString("base64")}`;
|
|
43354
|
+
parseEntityImageDataUri(image);
|
|
43355
|
+
}
|
|
43356
|
+
const caller = await resolveCaller();
|
|
43357
|
+
const entityId2 = await resolveEntityC(caller, this.nameOrId);
|
|
43358
|
+
const { imageId } = await caller.mutation(entitiesSetImage, { id: entityId2, image });
|
|
43359
|
+
const spaces = await spacesFooterFromMemberships(caller);
|
|
43360
|
+
this.emitText(
|
|
43361
|
+
jsonWithSpaces({ data: parsePublicCliEntityWriteResult("setEntityImage", { entityId: entityId2, imageId }) }, spaces),
|
|
43362
|
+
() => withFooter(imageId ? `Set image of entity ${entityId2}` : `Removed image of entity ${entityId2}`, spaces)
|
|
43363
|
+
);
|
|
43364
|
+
}
|
|
43365
|
+
};
|
|
42754
43366
|
var EntityArchive = class extends ProfileCommand {
|
|
42755
43367
|
static paths = [["entity", "archive"]];
|
|
42756
43368
|
static usage = Command.Usage({
|
|
@@ -43067,6 +43679,7 @@ var ENTITY_COMMANDS = [
|
|
|
43067
43679
|
EntityUpdate,
|
|
43068
43680
|
EntityRename,
|
|
43069
43681
|
EntityArchive,
|
|
43682
|
+
EntitySetImage,
|
|
43070
43683
|
EntityRestore,
|
|
43071
43684
|
EntityPin,
|
|
43072
43685
|
EntityUnpin,
|
|
@@ -43088,9 +43701,9 @@ function parseActivityFields(flags, pairs = []) {
|
|
|
43088
43701
|
const lists = /* @__PURE__ */ new Map();
|
|
43089
43702
|
const shorthand = (label, value) => {
|
|
43090
43703
|
const key = fieldLabelKey(label);
|
|
43091
|
-
const
|
|
43092
|
-
if (
|
|
43093
|
-
|
|
43704
|
+
const list3 = lists.get(key);
|
|
43705
|
+
if (list3) {
|
|
43706
|
+
list3.values.push(value);
|
|
43094
43707
|
return;
|
|
43095
43708
|
}
|
|
43096
43709
|
const entry = { label, values: [value] };
|
|
@@ -43236,13 +43849,13 @@ function parseActivityType(value) {
|
|
|
43236
43849
|
init_server();
|
|
43237
43850
|
|
|
43238
43851
|
// ente/content.ts
|
|
43239
|
-
import { readFileSync as
|
|
43852
|
+
import { readFileSync as readFileSync8 } from "node:fs";
|
|
43240
43853
|
function readContentOption(content, contentFile) {
|
|
43241
43854
|
if (content !== void 0 && contentFile !== void 0) {
|
|
43242
43855
|
throw new Error("Use either --content or --content-file, not both.");
|
|
43243
43856
|
}
|
|
43244
43857
|
if (content !== void 0) return content;
|
|
43245
|
-
if (contentFile !== void 0) return
|
|
43858
|
+
if (contentFile !== void 0) return readFileSync8(contentFile, "utf8");
|
|
43246
43859
|
return void 0;
|
|
43247
43860
|
}
|
|
43248
43861
|
|
|
@@ -43263,13 +43876,13 @@ function parseTimeOrDefault(s) {
|
|
|
43263
43876
|
if (hour > 23 || minute > 59) throw new Error(`Invalid time format: '${s}'.`);
|
|
43264
43877
|
return [hour, minute];
|
|
43265
43878
|
}
|
|
43266
|
-
function validateDate(year, month,
|
|
43267
|
-
if (month < 1 || month > 12 ||
|
|
43879
|
+
function validateDate(year, month, day2, original) {
|
|
43880
|
+
if (month < 1 || month > 12 || day2 < 1 || day2 > 31) {
|
|
43268
43881
|
throw new Error(`Invalid date: '${original}'.`);
|
|
43269
43882
|
}
|
|
43270
|
-
const d = new Date(Date.UTC(year, month - 1,
|
|
43271
|
-
if (d.getUTCFullYear() !== year || d.getUTCMonth() + 1 !== month || d.getUTCDate() !==
|
|
43272
|
-
throw new Error(`Invalid date: '${original}' \u2014 day ${
|
|
43883
|
+
const d = new Date(Date.UTC(year, month - 1, day2));
|
|
43884
|
+
if (d.getUTCFullYear() !== year || d.getUTCMonth() + 1 !== month || d.getUTCDate() !== day2) {
|
|
43885
|
+
throw new Error(`Invalid date: '${original}' \u2014 day ${day2} does not exist in month ${month}.`);
|
|
43273
43886
|
}
|
|
43274
43887
|
}
|
|
43275
43888
|
function parseDeadline(input2) {
|
|
@@ -43297,29 +43910,29 @@ function parseDeadline(input2) {
|
|
|
43297
43910
|
if (iso) {
|
|
43298
43911
|
const year = Number(iso[1]);
|
|
43299
43912
|
const month = Number(iso[2]);
|
|
43300
|
-
const
|
|
43913
|
+
const day2 = Number(iso[3]);
|
|
43301
43914
|
const hour = Number(iso[4]);
|
|
43302
43915
|
const minute = Number(iso[5]);
|
|
43303
43916
|
const second = iso[6] ? Number(iso[6]) : 0;
|
|
43304
|
-
validateDate(year, month,
|
|
43917
|
+
validateDate(year, month, day2, input2);
|
|
43305
43918
|
if (hour > 23 || minute > 59 || second > 59) throw new Error(`Invalid time in deadline: '${input2}'.`);
|
|
43306
43919
|
let offsetMs2 = 0;
|
|
43307
43920
|
if (iso[7]) {
|
|
43308
43921
|
const sign = iso[7] === "-" ? -1 : 1;
|
|
43309
43922
|
offsetMs2 = sign * (Number(iso[8]) * 60 + Number(iso[9])) * 6e4;
|
|
43310
43923
|
}
|
|
43311
|
-
return Date.UTC(year, month - 1,
|
|
43924
|
+
return Date.UTC(year, month - 1, day2, hour, minute, second) - offsetMs2;
|
|
43312
43925
|
}
|
|
43313
43926
|
const date5 = /^(\d{4})-(\d{2})-(\d{2})(?:\s+(\d{1,2}):(\d{2}))?$/.exec(trimmed);
|
|
43314
43927
|
if (date5) {
|
|
43315
43928
|
const year = Number(date5[1]);
|
|
43316
43929
|
const month = Number(date5[2]);
|
|
43317
|
-
const
|
|
43318
|
-
validateDate(year, month,
|
|
43930
|
+
const day2 = Number(date5[3]);
|
|
43931
|
+
validateDate(year, month, day2, input2);
|
|
43319
43932
|
const hour = date5[4] ? Number(date5[4]) : DEFAULT_HOUR;
|
|
43320
43933
|
const minute = date5[5] ? Number(date5[5]) : DEFAULT_MINUTE;
|
|
43321
43934
|
if (hour > 23 || minute > 59) throw new Error(`Invalid time in deadline: '${input2}'.`);
|
|
43322
|
-
return berlinToEpochMs(year, month,
|
|
43935
|
+
return berlinToEpochMs(year, month, day2, hour, minute);
|
|
43323
43936
|
}
|
|
43324
43937
|
throw new Error(
|
|
43325
43938
|
`Cannot parse deadline '${input2}'. Accepted: "tomorrow", "today", "+3 days", "+1 week", "2026-03-15", "2026-03-15 14:00", "2026-03-15T14:00:00+01:00"`
|
|
@@ -43339,16 +43952,16 @@ function deadlineChange(deadline, clear) {
|
|
|
43339
43952
|
// ente/source-created-at.ts
|
|
43340
43953
|
var DATE_ONLY = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
43341
43954
|
var DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/;
|
|
43342
|
-
function valid(year, month,
|
|
43343
|
-
if (month < 1 || month > 12 ||
|
|
43344
|
-
const d = new Date(Date.UTC(year, month - 1,
|
|
43345
|
-
return d.getUTCFullYear() === year && d.getUTCMonth() + 1 === month && d.getUTCDate() ===
|
|
43955
|
+
function valid(year, month, day2, hour = 0, minute = 0) {
|
|
43956
|
+
if (month < 1 || month > 12 || day2 < 1 || day2 > 31 || hour > 23 || minute > 59) return false;
|
|
43957
|
+
const d = new Date(Date.UTC(year, month - 1, day2));
|
|
43958
|
+
return d.getUTCFullYear() === year && d.getUTCMonth() + 1 === month && d.getUTCDate() === day2;
|
|
43346
43959
|
}
|
|
43347
43960
|
function parseSourceCreatedAt(value, timezone = "Europe/Berlin") {
|
|
43348
43961
|
const dt = DATE_TIME.exec(value);
|
|
43349
43962
|
if (dt) {
|
|
43350
|
-
const [year, month,
|
|
43351
|
-
if (!valid(year, month,
|
|
43963
|
+
const [year, month, day2, hour, minute] = dt.slice(1).map(Number);
|
|
43964
|
+
if (!valid(year, month, day2, hour, minute)) throw new Error(`Invalid --source-created-at value: ${value}`);
|
|
43352
43965
|
return {
|
|
43353
43966
|
date: `${dt[1]}-${dt[2]}-${dt[3]}`,
|
|
43354
43967
|
time: `${dt[4]}:${dt[5]}`,
|
|
@@ -43357,8 +43970,8 @@ function parseSourceCreatedAt(value, timezone = "Europe/Berlin") {
|
|
|
43357
43970
|
}
|
|
43358
43971
|
const d = DATE_ONLY.exec(value);
|
|
43359
43972
|
if (d) {
|
|
43360
|
-
const [year, month,
|
|
43361
|
-
if (!valid(year, month,
|
|
43973
|
+
const [year, month, day2] = d.slice(1).map(Number);
|
|
43974
|
+
if (!valid(year, month, day2)) throw new Error(`Invalid --source-created-at value: ${value}`);
|
|
43362
43975
|
return { date: `${d[1]}-${d[2]}-${d[3]}`, time: null, timezone };
|
|
43363
43976
|
}
|
|
43364
43977
|
throw new Error("--source-created-at must be YYYY-MM-DD or YYYY-MM-DDTHH:mm");
|
|
@@ -43367,7 +43980,20 @@ function parseSourceCreatedAt(value, timezone = "Europe/Berlin") {
|
|
|
43367
43980
|
// ../packages/shared/src/activity-content-operation-results.ts
|
|
43368
43981
|
var integer2 = external_exports.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
43369
43982
|
var activityContentBlock = external_exports.strictObject({ target: external_exports.string().min(1), blockType: external_exports.string(), format: external_exports.enum(["markdown", "plain_text"]), content: external_exports.string(), start: integer2, end: integer2, totalCharacters: integer2, canReplaceText: external_exports.boolean() }).refine((value) => value.start <= value.end && value.end <= value.totalCharacters && value.end - value.start === value.content.length, "Invalid UTF16 content range");
|
|
43983
|
+
var activityContentBulkItem = external_exports.discriminatedUnion("status", [
|
|
43984
|
+
external_exports.strictObject({ activityId: external_exports.string().min(1), status: external_exports.literal("unavailable") }),
|
|
43985
|
+
external_exports.strictObject({
|
|
43986
|
+
activityId: external_exports.string().min(1),
|
|
43987
|
+
status: external_exports.literal("available"),
|
|
43988
|
+
contentVersion: activityContentVersion,
|
|
43989
|
+
sourceHash: external_exports.string().regex(/^[a-f0-9]{64}$/),
|
|
43990
|
+
markdown: external_exports.string(),
|
|
43991
|
+
complete: external_exports.boolean(),
|
|
43992
|
+
nextCursor: activityContentCursor.optional()
|
|
43993
|
+
}).refine((value) => value.complete === (value.nextCursor === void 0) && (value.nextCursor === void 0 || decodeActivityContentCursor(value.nextCursor)?.version === value.contentVersion), "Invalid continuation")
|
|
43994
|
+
]);
|
|
43370
43995
|
var activityContentResults = {
|
|
43996
|
+
readActivityContents: external_exports.strictObject({ items: external_exports.array(activityContentBulkItem).min(1).max(10) }).refine((value) => value.items.reduce((sum, item) => sum + (item.status === "available" ? item.markdown.length : 0), 0) <= 1e5, "Invalid bulk budget"),
|
|
43371
43997
|
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"),
|
|
43372
43998
|
editActivityContent: external_exports.strictObject({ activityId: external_exports.string().min(1), contentVersion: activityContentVersion, changed: external_exports.boolean() })
|
|
43373
43999
|
};
|
|
@@ -43376,11 +44002,11 @@ function parseActivityContentResult(name4, raw) {
|
|
|
43376
44002
|
}
|
|
43377
44003
|
|
|
43378
44004
|
// ente/commands/activityContent.ts
|
|
43379
|
-
import { readFileSync as
|
|
44005
|
+
import { readFileSync as readFileSync10 } from "node:fs";
|
|
43380
44006
|
import { basename as basename2 } from "node:path";
|
|
43381
44007
|
|
|
43382
44008
|
// ente/fileAttachments.ts
|
|
43383
|
-
import { readFileSync as
|
|
44009
|
+
import { readFileSync as readFileSync9 } from "node:fs";
|
|
43384
44010
|
import { basename, extname } from "node:path";
|
|
43385
44011
|
var MIME_TYPES = {
|
|
43386
44012
|
".pdf": "application/pdf",
|
|
@@ -43446,7 +44072,7 @@ function parseInlineImageSpecs(specs, options) {
|
|
|
43446
44072
|
function readOutgoingEmailAttachment(path12, options) {
|
|
43447
44073
|
let bytes2;
|
|
43448
44074
|
try {
|
|
43449
|
-
bytes2 =
|
|
44075
|
+
bytes2 = readFileSync9(path12);
|
|
43450
44076
|
} catch (error62) {
|
|
43451
44077
|
const detail = error62 instanceof Error ? error62.message : String(error62);
|
|
43452
44078
|
throw new Error(`${options.commandLabel}: could not read attachment '${path12}': ${detail}`);
|
|
@@ -43493,6 +44119,7 @@ var activitiesGetByIdRich = makeFunctionReference("activities:getByIdRich");
|
|
|
43493
44119
|
var activitiesUpdateDeadline = makeFunctionReference("activities:updateDeadline");
|
|
43494
44120
|
var activitiesUpdateTitle = makeFunctionReference("activities:updateTitle");
|
|
43495
44121
|
var activitiesSetContentFromMarkdown = makeFunctionReference("activities:setContentFromMarkdown");
|
|
44122
|
+
var activitiesReadContents = makeFunctionReference("activityContents:readMany");
|
|
43496
44123
|
var activitiesReadContent = makeFunctionReference("activities:readContentDurable");
|
|
43497
44124
|
var activitiesEditContent = makeFunctionReference("activities:editContent");
|
|
43498
44125
|
var activitiesUpdateEntities = makeFunctionReference("activities:updateEntities");
|
|
@@ -43526,16 +44153,29 @@ var ActivityContentRead = class extends ProfileCommand {
|
|
|
43526
44153
|
static paths = [["activity", "content", "read"]];
|
|
43527
44154
|
static usage = Command.Usage({
|
|
43528
44155
|
category: "Activity",
|
|
43529
|
-
description: "Read
|
|
44156
|
+
description: "Read complete or resumable activity bodies; repeat --id for up to ten sources"
|
|
43530
44157
|
});
|
|
43531
|
-
id = options_exports.String();
|
|
44158
|
+
id = options_exports.String({ required: false });
|
|
44159
|
+
ids = options_exports.Array("--id", [], { description: "Activity ID; repeat up to ten times for a shared full-read budget" });
|
|
43532
44160
|
cursor = options_exports.String("--cursor", { description: "Opaque nextCursor from the preceding page" });
|
|
43533
44161
|
expectedVersion = options_exports.String("--expected-version", {
|
|
43534
44162
|
description: "contentVersion from the preceding page"
|
|
43535
44163
|
});
|
|
43536
44164
|
maxBlocks = options_exports.String("--max-blocks", { description: "Maximum block windows (max 50)" });
|
|
43537
|
-
maxCharacters = options_exports.String("--max-characters", { description: "
|
|
44165
|
+
maxCharacters = options_exports.String("--max-characters", { description: "Rendered UTF16 budget (bulk default 50000, max 100000; positional max 50000)" });
|
|
43538
44166
|
async run() {
|
|
44167
|
+
if (this.ids.length) {
|
|
44168
|
+
if (this.id || this.maxBlocks !== void 0 || this.ids.length > 1 && (this.cursor !== void 0 || this.expectedVersion !== void 0)) throw new Error("Use --id without a positional ID or --max-blocks. Resume one source at a time with --cursor and --expected-version.");
|
|
44169
|
+
const request2 = parseActivityContentRequest("readActivityContents", { items: this.ids.map((activityId2) => ({ activityId: activityId2, cursor: this.cursor, expectedContentVersion: this.expectedVersion === void 0 ? void 0 : graphVersion(this.expectedVersion) })), maxCharacters: graphPositiveInteger(this.maxCharacters) });
|
|
44170
|
+
if (request2.operation !== "readActivityContents") throw new Error("Invalid content operation");
|
|
44171
|
+
const caller2 = await resolveCaller();
|
|
44172
|
+
const data2 = parseActivityContentResult("readActivityContents", await caller2.action(activitiesReadContents, request2.input));
|
|
44173
|
+
this.emitText(graphEnvelope(activityContentResults.readActivityContents, data2), () => data2.items.map((item) => item.status === "unavailable" ? `Activity ${item.activityId}: unavailable` : `Activity ${item.activityId} contentVersion=${String(item.contentVersion)} complete=${item.complete}
|
|
44174
|
+
${item.markdown}${item.nextCursor ? `
|
|
44175
|
+
Next: --id ${item.activityId} --cursor '${item.nextCursor}' --expected-version ${String(item.contentVersion)}` : ""}`).join("\n\n"));
|
|
44176
|
+
return;
|
|
44177
|
+
}
|
|
44178
|
+
if (!this.id) throw new Error("Supply an activity ID or repeat --id for a bulk read");
|
|
43539
44179
|
const request = parseLegacyActivityContentRequest("readActivityContent", {
|
|
43540
44180
|
activityId: this.id,
|
|
43541
44181
|
cursor: this.cursor,
|
|
@@ -43571,7 +44211,7 @@ var ActivityContentEdit = class extends ProfileCommand {
|
|
|
43571
44211
|
description: "JSON file containing an operation array or {operations:[...]}"
|
|
43572
44212
|
});
|
|
43573
44213
|
async run() {
|
|
43574
|
-
const raw = graphConvert("operationsFile", () => JSON.parse(
|
|
44214
|
+
const raw = graphConvert("operationsFile", () => JSON.parse(readFileSync10(this.operationsFile, "utf8")));
|
|
43575
44215
|
const operations2 = graphInput(external_exports.union([external_exports.array(activityContentEditOperation), external_exports.strictObject({ operations: external_exports.array(activityContentEditOperation) })]), raw);
|
|
43576
44216
|
const request = parseActivityContentRequest("editActivityContent", { activityId: this.id, expectedContentVersion: graphVersion(this.expectedVersion), operations: Array.isArray(operations2) ? operations2 : operations2.operations });
|
|
43577
44217
|
if (request.operation !== "editActivityContent") throw new Error("Invalid content operation");
|
|
@@ -43594,7 +44234,7 @@ var ActivityAttachmentUpload = class extends ProfileCommand {
|
|
|
43594
44234
|
name = options_exports.String("--name", { description: "Stored filename (defaults to the file's basename)" });
|
|
43595
44235
|
async run() {
|
|
43596
44236
|
graphInput(graphId2, this.id);
|
|
43597
|
-
const bytes2 =
|
|
44237
|
+
const bytes2 = readFileSync10(this.file);
|
|
43598
44238
|
if (bytes2.byteLength > MAX_ACTIVITY_ATTACHMENT_BYTES) {
|
|
43599
44239
|
throw new Error("Activity attachments must be 20 MB or smaller.");
|
|
43600
44240
|
}
|
|
@@ -44374,6 +45014,8 @@ var TaskListCmd = class extends ClientCommand {
|
|
|
44374
45014
|
static usage = Command.Usage({ category: "Task", description: "List open tasks" });
|
|
44375
45015
|
due = options_exports.String("--due", { description: "Filter: today, overdue, all" });
|
|
44376
45016
|
entity = options_exports.String("--entity", { description: "Filter by entity (name or ID)" });
|
|
45017
|
+
assigneeAgent = options_exports.String("--assignee-agent", { description: "Filter by assigned agent ID" });
|
|
45018
|
+
agentTaskDisplay = options_exports.String("--agent-task-display", { description: "show, dim, hideAgentOnly, or hideAllWithAgent" });
|
|
44377
45019
|
assignee = options_exports.String("--assignee", {
|
|
44378
45020
|
description: "Filter by assignee: me, meOrUnassigned, unassigned, user ID, or email"
|
|
44379
45021
|
});
|
|
@@ -44382,6 +45024,8 @@ var TaskListCmd = class extends ClientCommand {
|
|
|
44382
45024
|
const params = { onlyOpen: "true" };
|
|
44383
45025
|
if (this.entity) params.entityId = await resolveEntity(client, this.entity);
|
|
44384
45026
|
applyAssignee(params, this.assignee);
|
|
45027
|
+
if (this.assigneeAgent) params.assigneeAgentId = this.assigneeAgent;
|
|
45028
|
+
if (this.agentTaskDisplay) params.agentTaskDisplay = this.agentTaskDisplay;
|
|
44385
45029
|
if (this.due === "all") params.onlyOpen = "false";
|
|
44386
45030
|
else if (this.due === "today") params.dueBy = String(endOfTodayBerlin());
|
|
44387
45031
|
else if (this.due === "overdue") params.dueBy = String(Date.now());
|
|
@@ -45058,9 +45702,9 @@ function planUpsert(existing, inputs, keyColumn) {
|
|
|
45058
45702
|
);
|
|
45059
45703
|
return steps;
|
|
45060
45704
|
}
|
|
45061
|
-
function parseImportLines(
|
|
45705
|
+
function parseImportLines(text4) {
|
|
45062
45706
|
const rows = [];
|
|
45063
|
-
for (const [index, source2] of
|
|
45707
|
+
for (const [index, source2] of text4.split(/\r?\n/).entries()) {
|
|
45064
45708
|
if (!source2.trim()) continue;
|
|
45065
45709
|
const line = index + 1;
|
|
45066
45710
|
let parsed;
|
|
@@ -45219,17 +45863,17 @@ async function loadList(caller, listNameOrId) {
|
|
|
45219
45863
|
}
|
|
45220
45864
|
async function fetchMatchingRows(caller, entityId2, where) {
|
|
45221
45865
|
const rows = [];
|
|
45222
|
-
let
|
|
45866
|
+
let cursor2 = null;
|
|
45223
45867
|
for (; ; ) {
|
|
45224
45868
|
const res = databaseListPage(await caller.query(listRows, parseDatabaseProtocolInput("database rows", databaseRowsArgs, {
|
|
45225
45869
|
entityId: entityId2,
|
|
45226
45870
|
ignoreViewFilters: true,
|
|
45227
45871
|
where,
|
|
45228
|
-
paginationOpts: { numItems: ROW_PAGE_SIZE, cursor:
|
|
45872
|
+
paginationOpts: { numItems: ROW_PAGE_SIZE, cursor: cursor2 }
|
|
45229
45873
|
})));
|
|
45230
45874
|
rows.push(...res.page);
|
|
45231
45875
|
if (res.isDone) return rows;
|
|
45232
|
-
|
|
45876
|
+
cursor2 = res.continueCursor;
|
|
45233
45877
|
}
|
|
45234
45878
|
}
|
|
45235
45879
|
async function fetchRowsForKeys(caller, entityId2, inputs, key) {
|
|
@@ -45392,7 +46036,7 @@ var ListColumnRemove = class extends ProfileCommand {
|
|
|
45392
46036
|
};
|
|
45393
46037
|
|
|
45394
46038
|
// ente/commands/listRows.ts
|
|
45395
|
-
import { readFileSync as
|
|
46039
|
+
import { readFileSync as readFileSync11 } from "node:fs";
|
|
45396
46040
|
var ListAdd = class extends ProfileCommand {
|
|
45397
46041
|
static paths = [["list", "add"]];
|
|
45398
46042
|
static usage = Command.Usage({
|
|
@@ -45405,11 +46049,11 @@ var ListAdd = class extends ProfileCommand {
|
|
|
45405
46049
|
],
|
|
45406
46050
|
[
|
|
45407
46051
|
"Add a recipe row whose body is the recipe",
|
|
45408
|
-
'ente list add Rezepte --space "
|
|
46052
|
+
'ente list add Rezepte --space "Personal" --title "Tofu-Wraps" --attr vegan=true --content-file tofu-wraps.md'
|
|
45409
46053
|
],
|
|
45410
46054
|
[
|
|
45411
46055
|
"Upsert by a stable key column",
|
|
45412
|
-
'ente list add Firmen --space "
|
|
46056
|
+
'ente list add Firmen --space "Team" --key repo --title "Acme" --attr repo=firmen.csv#42 --attr stage=Kandidat'
|
|
45413
46057
|
]
|
|
45414
46058
|
]
|
|
45415
46059
|
});
|
|
@@ -45513,8 +46157,8 @@ var ListImport = class extends ProfileCommand {
|
|
|
45513
46157
|
Rows of the list that are not in the file are left alone.
|
|
45514
46158
|
`,
|
|
45515
46159
|
examples: [
|
|
45516
|
-
["Preview a sync", 'ente list import Firmen --space "
|
|
45517
|
-
["Run it", 'ente list import Firmen --space "
|
|
46160
|
+
["Preview a sync", 'ente list import Firmen --space "Team" --file firmen.jsonl --key repo --dry-run --json'],
|
|
46161
|
+
["Run it", 'ente list import Firmen --space "Team" --file firmen.jsonl --key repo']
|
|
45518
46162
|
]
|
|
45519
46163
|
});
|
|
45520
46164
|
list = options_exports.String();
|
|
@@ -45527,7 +46171,7 @@ var ListImport = class extends ProfileCommand {
|
|
|
45527
46171
|
const concurrency = Number(this.concurrency);
|
|
45528
46172
|
if (!Number.isInteger(concurrency) || concurrency < 1 || concurrency > 16)
|
|
45529
46173
|
throw new Error(`--concurrency must be an integer from 1 to 16 (got '${this.concurrency}').`);
|
|
45530
|
-
const lines = parseImportLines(
|
|
46174
|
+
const lines = parseImportLines(readFileSync11(this.file, "utf8"));
|
|
45531
46175
|
if (this.space !== void 0 && !this.space.trim()) throw new Error("--space must name a space.");
|
|
45532
46176
|
const caller = await resolveCaller();
|
|
45533
46177
|
const { entityId: entityId2, entity: entity5, view } = await loadList(caller, this.list);
|
|
@@ -45548,7 +46192,8 @@ var ListImport = class extends ProfileCommand {
|
|
|
45548
46192
|
const steps = planUpsert(existing, inputs, this.key);
|
|
45549
46193
|
const needsSpace = steps.some((s) => s.action === "create");
|
|
45550
46194
|
const ownerSpaceId = needsSpace ? await resolveOwnerSpace(caller, this.space) : "";
|
|
45551
|
-
const results =
|
|
46195
|
+
const results = [];
|
|
46196
|
+
results.length = steps.length;
|
|
45552
46197
|
let failure2 = null;
|
|
45553
46198
|
const rowFailures = [];
|
|
45554
46199
|
if (this.dryRun) {
|
|
@@ -45618,11 +46263,11 @@ var ListCreate = class extends ProfileCommand {
|
|
|
45618
46263
|
],
|
|
45619
46264
|
[
|
|
45620
46265
|
"A recipe collection with labelled columns and an icon",
|
|
45621
|
-
'ente list create Rezepte --space "
|
|
46266
|
+
'ente list create Rezepte --space "Personal" --icon book-open --column "protein_g=Protein (g):number" --column "vegan:boolean"'
|
|
45622
46267
|
],
|
|
45623
46268
|
[
|
|
45624
46269
|
"A sync target pinned under a project",
|
|
45625
|
-
'ente list create Firmen --space "
|
|
46270
|
+
'ente list create Firmen --space "Team" --pin Recherche --column "repo:text" --column "stage:single-select:Kandidat,in Review,verfolgt,verworfen"'
|
|
45626
46271
|
]
|
|
45627
46272
|
]
|
|
45628
46273
|
});
|
|
@@ -45721,19 +46366,19 @@ var ListShow = class extends ProfileCommand {
|
|
|
45721
46366
|
const { entityId: entityId2, entity: entity5, view } = await loadList(caller, this.list);
|
|
45722
46367
|
const clauses = parseWhere(view.columns, this.where ?? [], entity5.name);
|
|
45723
46368
|
const rows = [];
|
|
45724
|
-
let
|
|
46369
|
+
let cursor2 = this.cursor ?? null;
|
|
45725
46370
|
let nextCursor = null;
|
|
45726
46371
|
for (; ; ) {
|
|
45727
46372
|
const res = databaseListPage(await caller.query(listRows, parseDatabaseProtocolInput("database rows", databaseRowsArgs, {
|
|
45728
46373
|
entityId: entityId2,
|
|
45729
46374
|
...this.view ? {} : { ignoreViewFilters: true },
|
|
45730
46375
|
where: clauses,
|
|
45731
|
-
paginationOpts: { numItems, cursor:
|
|
46376
|
+
paginationOpts: { numItems, cursor: cursor2 }
|
|
45732
46377
|
})));
|
|
45733
46378
|
rows.push(...res.page);
|
|
45734
46379
|
nextCursor = res.isDone ? null : res.continueCursor;
|
|
45735
46380
|
if (!this.all || nextCursor === null) break;
|
|
45736
|
-
|
|
46381
|
+
cursor2 = nextCursor;
|
|
45737
46382
|
}
|
|
45738
46383
|
const kept = rows;
|
|
45739
46384
|
this.emitText(
|
|
@@ -45899,15 +46544,15 @@ var resetPassword = makeFunctionReference("admin/users:resetPassword");
|
|
|
45899
46544
|
var changeUserPlan = makeFunctionReference("admin/users:changeUserPlan");
|
|
45900
46545
|
async function listAllUsers(caller, email3) {
|
|
45901
46546
|
const users = [];
|
|
45902
|
-
let
|
|
46547
|
+
let cursor2 = null;
|
|
45903
46548
|
do {
|
|
45904
46549
|
const result = await caller.query(listUsers, parseHumanInput("admin/users:listUsers", adminUserContracts.listUsers.args, {
|
|
45905
|
-
paginationOpts: { numItems: 100, cursor:
|
|
46550
|
+
paginationOpts: { numItems: 100, cursor: cursor2 },
|
|
45906
46551
|
...email3 ? { email: email3 } : {}
|
|
45907
46552
|
})).then((raw) => parseOperationResult("admin/users:listUsers", adminUserContracts.listUsers.result, raw));
|
|
45908
46553
|
users.push(...result.page);
|
|
45909
|
-
|
|
45910
|
-
} while (
|
|
46554
|
+
cursor2 = result.isDone ? null : result.continueCursor;
|
|
46555
|
+
} while (cursor2 !== null);
|
|
45911
46556
|
return users;
|
|
45912
46557
|
}
|
|
45913
46558
|
async function resolveUserByEmail(caller, email3) {
|
|
@@ -46508,37 +47153,53 @@ var fields3 = {
|
|
|
46508
47153
|
since: external_exports.number().nonnegative().optional().meta({ description: "Optional epoch millisecond lower bound for activity evidence." }),
|
|
46509
47154
|
until: external_exports.number().nonnegative().optional().meta({ description: "Optional epoch millisecond upper bound for activity evidence." })
|
|
46510
47155
|
};
|
|
47156
|
+
var provenanceCategories = ["owner", "human", "agent", "inbound", "unknown"];
|
|
47157
|
+
var queryControls = {
|
|
47158
|
+
responseVersion: external_exports.literal(2).optional().meta({ description: "Request GA coverage, passages and ranking metadata. Omit for the installed-client-compatible response format." }),
|
|
47159
|
+
spaceCursor: external_exports.string().regex(/^v1\.\d+\.[a-f0-9]{64}$/).max(100).optional().meta({ description: "Continue authorized space partitions using coverage.nextSpaceCursor. Bound to the question, filters and current scope; never an ANN result page." }),
|
|
47160
|
+
recency: external_exports.strictObject({
|
|
47161
|
+
since: external_exports.number().nonnegative().optional(),
|
|
47162
|
+
until: external_exports.number().nonnegative().optional(),
|
|
47163
|
+
weight: external_exports.number().nonnegative().optional()
|
|
47164
|
+
}).optional().meta({ description: "Soft date preference only; older matches remain eligible. Weight is capped at 1 by the server." }),
|
|
47165
|
+
authoredBy: external_exports.enum(provenanceCategories).optional().meta({ description: "Filter activity provenance relative to the human principal. Unknown origin is never inferred from a title or creator alone." }),
|
|
47166
|
+
activityTypes: external_exports.array(external_exports.enum(["note", "conversation", "meeting", "call", "message", "task"])).min(1).max(6).optional().meta({ description: "Restrict activity/task sources to these types. Structured entity context remains available." })
|
|
47167
|
+
};
|
|
46511
47168
|
var retrievalInputs = {
|
|
46512
|
-
query: external_exports.strictObject({ ...fields3, mode: external_exports.enum(["lexical", "semantic", "hybrid"]).optional().meta({ description: "Optional
|
|
47169
|
+
query: external_exports.strictObject({ ...fields3, ...queryControls, mode: external_exports.enum(["lexical", "semantic", "hybrid"]).optional().meta({ description: "Optional mode. The server uses hybrid when GA is ready and enabled, otherwise lexical with a reason. Explicit lexical makes no provider call; semantic never returns lexical fallback." }) }),
|
|
46513
47170
|
ask: external_exports.strictObject(fields3)
|
|
46514
47171
|
};
|
|
46515
47172
|
var legacyFields = { ...fields3, since: external_exports.number().optional(), until: external_exports.number().optional() };
|
|
46516
47173
|
var lexicalLimit = external_exports.custom((value) => typeof value === "number").optional();
|
|
46517
47174
|
var profileInputs = {
|
|
46518
47175
|
"legacy-lexical": external_exports.strictObject({ ...legacyFields, limit: lexicalLimit, mode: external_exports.literal("lexical").optional() }),
|
|
46519
|
-
"legacy-raw-action": external_exports.strictObject({ ...legacyFields, limit: external_exports.number().optional(), mode: external_exports.enum(["lexical", "semantic", "hybrid"]).optional() }),
|
|
47176
|
+
"legacy-raw-action": external_exports.strictObject({ ...legacyFields, ...queryControls, limit: external_exports.number().optional(), mode: external_exports.enum(["lexical", "semantic", "hybrid"]).optional() }),
|
|
46520
47177
|
"legacy-ask": external_exports.strictObject(fields3),
|
|
46521
47178
|
cli: external_exports.strictObject({ ...fields3, limit: external_exports.number().int().positive().optional(), since: external_exports.number().int().nonnegative().optional(), until: external_exports.number().int().nonnegative().optional() })
|
|
46522
47179
|
};
|
|
46523
47180
|
function retrievalInputSchema(operation, profile) {
|
|
46524
47181
|
if (profile === "tool") return retrievalInputs[operation];
|
|
46525
|
-
if (profile === "cli" && operation === "query") return profileInputs.cli.extend({ mode: retrievalInputs.query.shape.mode });
|
|
47182
|
+
if (profile === "cli" && operation === "query") return profileInputs.cli.extend({ ...queryControls, mode: retrievalInputs.query.shape.mode });
|
|
46526
47183
|
return profileInputs[profile];
|
|
46527
47184
|
}
|
|
46528
|
-
function
|
|
47185
|
+
function invalid4(operation, field) {
|
|
46529
47186
|
throw new OperationInputError(operation, [{ path: [field], reason: "custom" }]);
|
|
46530
47187
|
}
|
|
46531
47188
|
function parseRetrievalInput(operation, raw, profile = "tool") {
|
|
46532
|
-
if (operation === "ask" && (profile === "legacy-lexical" || profile === "legacy-raw-action") || operation === "query" && profile === "legacy-ask")
|
|
47189
|
+
if (operation === "ask" && (profile === "legacy-lexical" || profile === "legacy-raw-action") || operation === "query" && profile === "legacy-ask") invalid4(operation, "profile");
|
|
46533
47190
|
const input2 = parseOperationInput(operation, retrievalInputSchema(operation, profile), raw);
|
|
46534
|
-
if (input2.since !== void 0 && input2.until !== void 0 && input2.since > input2.until)
|
|
46535
|
-
if (
|
|
47191
|
+
if (input2.since !== void 0 && input2.until !== void 0 && input2.since > input2.until) invalid4(operation, "until");
|
|
47192
|
+
if (input2.recency?.since !== void 0 && input2.recency.until !== void 0 && input2.recency.since > input2.recency.until) invalid4(operation, "recency");
|
|
47193
|
+
if (input2.recency?.weight !== void 0) input2.recency.weight = Math.min(1, input2.recency.weight);
|
|
47194
|
+
if (input2.activityTypes) input2.activityTypes = [...new Set(input2.activityTypes)];
|
|
47195
|
+
if (input2.mode === "lexical" && input2.spaceCursor) invalid4(operation, "spaceCursor");
|
|
47196
|
+
if (profile === "legacy-raw-action" && input2.question.length > RETRIEVAL_QUESTION_LIMIT) invalid4(operation, "question");
|
|
46536
47197
|
let question = input2.question.trim();
|
|
46537
47198
|
const mode = input2.mode;
|
|
46538
|
-
if (profile === "cli" && operation === "query" && (mode === "semantic" || mode === "hybrid") && input2.question.length > RETRIEVAL_QUESTION_LIMIT)
|
|
47199
|
+
if (profile === "cli" && operation === "query" && (mode === "semantic" || mode === "hybrid") && input2.question.length > RETRIEVAL_QUESTION_LIMIT) invalid4(operation, "question");
|
|
46539
47200
|
if (operation === "query") {
|
|
46540
47201
|
if (profile === "legacy-lexical" || profile !== "legacy-raw-action" && (!mode || mode === "lexical")) question = question.slice(0, RETRIEVAL_QUESTION_LIMIT);
|
|
46541
|
-
else if (question.length > RETRIEVAL_QUESTION_LIMIT)
|
|
47202
|
+
else if (question.length > RETRIEVAL_QUESTION_LIMIT) invalid4(operation, "question");
|
|
46542
47203
|
}
|
|
46543
47204
|
const limit3 = input2.limit === void 0 || !Number.isFinite(input2.limit) ? RETRIEVAL_DEFAULT_LIMIT : Math.min(RETRIEVAL_MAX_LIMIT, Math.max(1, Math.floor(input2.limit)));
|
|
46544
47205
|
return { ...input2, question, limit: limit3 };
|
|
@@ -46559,6 +47220,7 @@ var askSpaceSummaryValidator = v2.object({
|
|
|
46559
47220
|
color: v2.optional(v2.string())
|
|
46560
47221
|
});
|
|
46561
47222
|
var askPassageValidator = v2.object({
|
|
47223
|
+
passageId: v2.optional(v2.id("askPassages")),
|
|
46562
47224
|
sourceHash: v2.string(),
|
|
46563
47225
|
chunker: v2.string(),
|
|
46564
47226
|
embeddingIdentity: v2.optional(v2.string()),
|
|
@@ -46566,6 +47228,37 @@ var askPassageValidator = v2.object({
|
|
|
46566
47228
|
start: v2.number(),
|
|
46567
47229
|
end: v2.number()
|
|
46568
47230
|
});
|
|
47231
|
+
var matchedPassageValidator = v2.object({
|
|
47232
|
+
text: v2.string(),
|
|
47233
|
+
sourceHash: v2.string(),
|
|
47234
|
+
contentVersion: v2.union(v2.number(), v2.null()),
|
|
47235
|
+
preparationIdentity: v2.string(),
|
|
47236
|
+
matchKind: v2.union(v2.literal("body"), v2.literal("title"), v2.literal("context"), v2.literal("legacy")),
|
|
47237
|
+
ranges: v2.array(v2.object({ target: v2.string(), start: v2.number(), end: v2.number() }))
|
|
47238
|
+
});
|
|
47239
|
+
var provenanceValidator = v2.union(v2.literal("owner"), v2.literal("human"), v2.literal("agent"), v2.literal("inbound"), v2.literal("unknown"));
|
|
47240
|
+
var rankingContributionsValidator = v2.object({
|
|
47241
|
+
rrf: v2.number(),
|
|
47242
|
+
provenance: v2.number(),
|
|
47243
|
+
recency: v2.number(),
|
|
47244
|
+
graph: v2.number(),
|
|
47245
|
+
total: v2.number()
|
|
47246
|
+
});
|
|
47247
|
+
var querySpaceCoverageValidator = v2.object({
|
|
47248
|
+
spaceId: v2.id("spaces"),
|
|
47249
|
+
state: v2.union(v2.literal("building"), v2.literal("ready"), v2.literal("paused"), v2.literal("limited"), v2.literal("disabled")),
|
|
47250
|
+
discoveryComplete: v2.boolean(),
|
|
47251
|
+
watermark: v2.number(),
|
|
47252
|
+
discovered: v2.number(),
|
|
47253
|
+
current: v2.number(),
|
|
47254
|
+
pending: v2.number(),
|
|
47255
|
+
stale: v2.number(),
|
|
47256
|
+
failed: v2.number(),
|
|
47257
|
+
excluded: v2.number(),
|
|
47258
|
+
passages: v2.number(),
|
|
47259
|
+
asOf: v2.number(),
|
|
47260
|
+
reason: v2.optional(v2.string())
|
|
47261
|
+
});
|
|
46569
47262
|
var askEvidenceValidator = v2.object({
|
|
46570
47263
|
id: v2.string(),
|
|
46571
47264
|
kind: askEvidenceKindValidator,
|
|
@@ -46591,6 +47284,11 @@ var askEvidenceValidator = v2.object({
|
|
|
46591
47284
|
sourceHash: v2.optional(v2.string()),
|
|
46592
47285
|
sourceFingerprint: v2.optional(v2.string()),
|
|
46593
47286
|
passage: v2.optional(askPassageValidator),
|
|
47287
|
+
passages: v2.optional(v2.array(matchedPassageValidator)),
|
|
47288
|
+
provenance: v2.optional(provenanceValidator),
|
|
47289
|
+
cosineScore: v2.optional(v2.number()),
|
|
47290
|
+
rankingContributions: v2.optional(rankingContributionsValidator),
|
|
47291
|
+
assigneeIds: v2.optional(v2.array(v2.id("users"))),
|
|
46594
47292
|
score: v2.number(),
|
|
46595
47293
|
relatedEntityNames: v2.array(v2.string()),
|
|
46596
47294
|
relatedEntityIds: v2.optional(v2.array(v2.id("entities"))),
|
|
@@ -46624,6 +47322,7 @@ var askCitationValidator = v2.object({
|
|
|
46624
47322
|
sourceHash: v2.optional(v2.string()),
|
|
46625
47323
|
sourceFingerprint: v2.optional(v2.string()),
|
|
46626
47324
|
passage: v2.optional(askPassageValidator),
|
|
47325
|
+
passages: v2.optional(v2.array(matchedPassageValidator)),
|
|
46627
47326
|
title: v2.string(),
|
|
46628
47327
|
kind: askEvidenceKindValidator,
|
|
46629
47328
|
entityId: v2.optional(v2.id("entities")),
|
|
@@ -46651,7 +47350,28 @@ var retrievalMetadataValidator = v2.object({
|
|
|
46651
47350
|
usedMode: v2.union(queryModeValidator, v2.literal("unavailable")),
|
|
46652
47351
|
status: v2.union(v2.literal("ready"), v2.literal("fallback"), v2.literal("unavailable")),
|
|
46653
47352
|
vector: v2.object({ embeddingAttempted: v2.boolean(), searchExecuted: v2.boolean(), candidates: v2.number(), model: v2.optional(v2.string()), region: v2.optional(v2.string()), embeddingIdentity: v2.optional(v2.string()), generation: v2.optional(v2.number()), provider: v2.union(v2.literal("none"), v2.literal("titan"), v2.literal("openai"), v2.literal("fixture")) }),
|
|
46654
|
-
coverage: v2.object({
|
|
47353
|
+
coverage: v2.object({
|
|
47354
|
+
scope: v2.union(v2.literal("own_personal_activity_passages"), v2.literal("accessible_activity_passages")),
|
|
47355
|
+
partial: v2.literal(true),
|
|
47356
|
+
indexInspected: v2.boolean(),
|
|
47357
|
+
indexedSources: v2.union(v2.number(), v2.null()),
|
|
47358
|
+
indexedSourcesLowerBound: v2.boolean(),
|
|
47359
|
+
exclusions: v2.array(v2.string()),
|
|
47360
|
+
state: v2.optional(v2.union(v2.literal("building"), v2.literal("ready"), v2.literal("paused"), v2.literal("limited"), v2.literal("disabled"))),
|
|
47361
|
+
spaces: v2.optional(v2.array(querySpaceCoverageValidator)),
|
|
47362
|
+
discoveryComplete: v2.optional(v2.boolean()),
|
|
47363
|
+
asOf: v2.optional(v2.number()),
|
|
47364
|
+
countsAreCorpus: v2.optional(v2.literal(true)),
|
|
47365
|
+
filteredSourceCount: v2.optional(v2.null()),
|
|
47366
|
+
nextSpaceCursor: v2.optional(v2.string()),
|
|
47367
|
+
scopeTruncated: v2.optional(v2.boolean()),
|
|
47368
|
+
spacesOmitted: v2.optional(v2.union(v2.number(), v2.null())),
|
|
47369
|
+
partitionsSearched: v2.optional(v2.number()),
|
|
47370
|
+
candidatesSaturated: v2.optional(v2.boolean()),
|
|
47371
|
+
postFilterDropped: v2.optional(v2.number()),
|
|
47372
|
+
postFiltersApplied: v2.optional(v2.boolean()),
|
|
47373
|
+
continuationPaths: v2.optional(v2.array(v2.string()))
|
|
47374
|
+
}),
|
|
46655
47375
|
truncation: v2.object({ context: v2.boolean(), results: v2.boolean(), activitySources: v2.boolean(), vectorCandidates: v2.boolean() }),
|
|
46656
47376
|
counts: v2.object({ structuredCandidates: v2.number(), structuredReturned: v2.number(), activityCandidates: v2.number(), activityReturned: v2.number() }),
|
|
46657
47377
|
fallbackReason: v2.optional(v2.string()),
|
|
@@ -46659,7 +47379,28 @@ var retrievalMetadataValidator = v2.object({
|
|
|
46659
47379
|
});
|
|
46660
47380
|
var rawQueryResultValidator = v2.object({ ...askEvidenceResultValidator.fields, retrieval: retrievalMetadataValidator });
|
|
46661
47381
|
function parseQueryResult(raw) {
|
|
46662
|
-
|
|
47382
|
+
const result = parseOperationResult("query", rawQueryResultValidator, raw);
|
|
47383
|
+
let characters = 0;
|
|
47384
|
+
for (const item of result.evidence) {
|
|
47385
|
+
const passages = item.passages;
|
|
47386
|
+
characters += (passages ? passages.reduce((sum, passage) => sum + passage.text.length, 0) : item.text?.length ?? 0) + (item.metadataText?.length ?? 0);
|
|
47387
|
+
if (!passages) continue;
|
|
47388
|
+
const primary = passages[0];
|
|
47389
|
+
if (!primary || passages.length > 3 || item.text !== primary.text) throw new OperationResultError("query");
|
|
47390
|
+
const seen = [];
|
|
47391
|
+
for (const passage of passages) {
|
|
47392
|
+
if (!/^[a-f0-9]{64}$/.test(passage.sourceHash) || passage.sourceHash !== item.sourceHash || !passage.preparationIdentity || passage.contentVersion !== null && (!Number.isSafeInteger(passage.contentVersion) || passage.contentVersion < 0)) throw new OperationResultError("query");
|
|
47393
|
+
let length = 0;
|
|
47394
|
+
for (const range of passage.ranges) {
|
|
47395
|
+
if (!/^b:\d+$/.test(range.target) || !Number.isSafeInteger(range.start) || !Number.isSafeInteger(range.end) || range.start < 0 || range.end <= range.start || seen.some((prior) => prior.target === range.target && prior.start < range.end && range.start < prior.end)) throw new OperationResultError("query");
|
|
47396
|
+
length += range.end - range.start;
|
|
47397
|
+
seen.push(range);
|
|
47398
|
+
}
|
|
47399
|
+
if (passage.ranges.length && length !== passage.text.length) throw new OperationResultError("query");
|
|
47400
|
+
}
|
|
47401
|
+
}
|
|
47402
|
+
if (result.evidence.some((item) => item.passages) && characters > 24e3) throw new OperationResultError("query");
|
|
47403
|
+
return result;
|
|
46663
47404
|
}
|
|
46664
47405
|
function parseAskResult(raw) {
|
|
46665
47406
|
return parseOperationResult("ask", askAnswerResultValidator, raw);
|
|
@@ -46730,12 +47471,10 @@ var ASK_COMMANDS = [AskCmd];
|
|
|
46730
47471
|
|
|
46731
47472
|
// ente/commands/query.ts
|
|
46732
47473
|
init_server();
|
|
46733
|
-
var askQuery = makeFunctionReference("ask:query");
|
|
46734
47474
|
var rawQuery = makeFunctionReference("retrieval/raw:run");
|
|
46735
47475
|
async function retrieveEvidenceC(caller, body, mode) {
|
|
46736
47476
|
const input2 = parseRetrievalInput("query", { ...body, ...mode === void 0 ? {} : { mode } }, "cli");
|
|
46737
|
-
const
|
|
46738
|
-
const raw = requestedMode === "hybrid" || requestedMode === "semantic" ? await caller.action(rawQuery, input2) : await caller.query(askQuery, lexicalInput);
|
|
47477
|
+
const raw = await caller.action(rawQuery, { ...input2, responseVersion: 2 });
|
|
46739
47478
|
return parseQueryResult(raw);
|
|
46740
47479
|
}
|
|
46741
47480
|
function formatEvidence(item, verbose) {
|
|
@@ -46745,9 +47484,12 @@ function formatEvidence(item, verbose) {
|
|
|
46745
47484
|
const related = item.relatedEntityNames ?? [];
|
|
46746
47485
|
if (spaces.length) details.push(`spaces: ${spaces.join(", ")}`);
|
|
46747
47486
|
if (related.length) details.push(`related: ${related.join(", ")}`);
|
|
47487
|
+
if (item.provenance) details.push(`origin: ${item.provenance}`);
|
|
46748
47488
|
if (item.deadline !== void 0) details.push(`deadline: ${item.deadline}`);
|
|
46749
47489
|
if (details.length) lines.push(` ${dim(details.join(" \xB7 "))}`);
|
|
46750
47490
|
if (item.text) lines.push(` ${verbose ? item.text : truncate(item.text, 180)}`);
|
|
47491
|
+
if (verbose && item.rankingContributions) lines.push(` rank: ${item.rank ?? "?"}; lexical: ${item.lexicalRank ?? "-"}; semantic: ${item.semanticRank ?? "-"}; cosine: ${item.cosineScore ?? "-"}; contributions: ${JSON.stringify(item.rankingContributions)}`);
|
|
47492
|
+
if (verbose && item.sourceUrl) lines.push(` ${item.sourceUrl}`);
|
|
46751
47493
|
return lines;
|
|
46752
47494
|
}
|
|
46753
47495
|
function formatQueryResult(data, verbose) {
|
|
@@ -46757,6 +47499,9 @@ function formatQueryResult(data, verbose) {
|
|
|
46757
47499
|
const retrieval = data.retrieval;
|
|
46758
47500
|
lines.push(`Retrieval: ${retrieval.requestedMode} \u2192 ${retrieval.usedMode}; vectors ${retrieval.vector.searchExecuted ? retrieval.vector.provider : "not executed"}${retrieval.fallbackReason ? ` (${retrieval.fallbackReason})` : ""}`);
|
|
46759
47501
|
}
|
|
47502
|
+
const coverage = data.retrieval.coverage;
|
|
47503
|
+
if (coverage.state) lines.push(`Index: ${coverage.state}; corpus sources: ${coverage.indexedSources ?? "unknown"} current; ${coverage.scopeTruncated ? "scope truncated; " : ""}${coverage.candidatesSaturated ? "candidate budget saturated; " : ""}${coverage.postFilterDropped ?? 0} candidate drops. Coverage is not exhaustive recall.`);
|
|
47504
|
+
if (verbose && evidence.some((item) => item.activityId)) lines.push("Read bodies: ente activity content read --id <activity> --json");
|
|
46760
47505
|
if (!evidence.length) lines.push("No evidence found.");
|
|
46761
47506
|
for (const item of evidence) lines.push(...formatEvidence(item, verbose));
|
|
46762
47507
|
const warnings = data.warnings ?? [];
|
|
@@ -46769,15 +47514,20 @@ var QueryCmd = class extends ProfileCommand {
|
|
|
46769
47514
|
static paths = [["query"]];
|
|
46770
47515
|
static usage = Command.Usage({
|
|
46771
47516
|
category: "Retrieval",
|
|
46772
|
-
description: "Retrieve
|
|
47517
|
+
description: "Retrieve evidence; the server selects hybrid when ready or lexical with a reason"
|
|
46773
47518
|
});
|
|
46774
47519
|
question = options_exports.String();
|
|
46775
|
-
mode = options_exports.String("--mode", { description: "lexical (
|
|
47520
|
+
mode = options_exports.String("--mode", { description: "lexical (no provider call), hybrid, or semantic; omitted mode is negotiated by the server" });
|
|
46776
47521
|
space = options_exports.String("--space", { description: "Restrict evidence to a space (name or ID)" });
|
|
46777
47522
|
entity = options_exports.String("--entity", { description: "Use an entity (name or ID) as the main graph anchor" });
|
|
46778
47523
|
limit = options_exports.String("--limit", { description: "Maximum evidence items to return" });
|
|
46779
47524
|
since = options_exports.String("--since", { description: "Only include activity evidence after this epoch ms" });
|
|
46780
47525
|
until = options_exports.String("--until", { description: "Only include activity evidence before this epoch ms" });
|
|
47526
|
+
spaceCursor = options_exports.String("--space-cursor", { description: "Continue coverage.nextSpaceCursor with the same query and filters" });
|
|
47527
|
+
preferSince = options_exports.String("--prefer-since", { description: "Soft epoch-ms date preference; older matches remain eligible" });
|
|
47528
|
+
preferUntil = options_exports.String("--prefer-until", { description: "Soft epoch-ms upper date preference" });
|
|
47529
|
+
authoredBy = options_exports.String("--authored-by", { description: "Activity origin: owner, human, agent, inbound, or unknown" });
|
|
47530
|
+
activityTypes = options_exports.Array("--type", [], { description: "Activity type; repeat for multiple types" });
|
|
46781
47531
|
verbose = options_exports.Boolean("--verbose,-v", false, { description: "Print full evidence snippets" });
|
|
46782
47532
|
async run() {
|
|
46783
47533
|
const input2 = parseRetrievalInput("query", {
|
|
@@ -46785,11 +47535,18 @@ var QueryCmd = class extends ProfileCommand {
|
|
|
46785
47535
|
...this.mode === void 0 ? {} : { mode: this.mode },
|
|
46786
47536
|
...this.limit === void 0 ? {} : { limit: Number(this.limit.trim() || NaN) },
|
|
46787
47537
|
...this.since === void 0 ? {} : { since: Number(this.since.trim() || NaN) },
|
|
47538
|
+
...this.spaceCursor === void 0 ? {} : { spaceCursor: this.spaceCursor },
|
|
47539
|
+
...this.preferSince === void 0 && this.preferUntil === void 0 ? {} : { recency: {
|
|
47540
|
+
...this.preferSince === void 0 ? {} : { since: Number(this.preferSince.trim() || NaN) },
|
|
47541
|
+
...this.preferUntil === void 0 ? {} : { until: Number(this.preferUntil.trim() || NaN) }
|
|
47542
|
+
} },
|
|
47543
|
+
...this.authoredBy === void 0 ? {} : { authoredBy: this.authoredBy },
|
|
47544
|
+
...this.activityTypes.length ? { activityTypes: this.activityTypes } : {},
|
|
46788
47545
|
...this.until === void 0 ? {} : { until: Number(this.until.trim() || NaN) }
|
|
46789
47546
|
}, "cli");
|
|
46790
47547
|
const caller = await resolveCaller();
|
|
46791
47548
|
const body = await buildEvidenceBodyC(caller, { ...this, question: input2.question });
|
|
46792
|
-
const res = await retrieveEvidenceC(caller, body, this.mode);
|
|
47549
|
+
const res = await retrieveEvidenceC(caller, { ...body, spaceCursor: input2.spaceCursor, recency: input2.recency, authoredBy: input2.authoredBy, activityTypes: input2.activityTypes }, this.mode);
|
|
46793
47550
|
this.emitText({ data: res }, () => formatQueryResult(res, this.verbose));
|
|
46794
47551
|
if (res.retrieval.status === "unavailable") return 1;
|
|
46795
47552
|
}
|
|
@@ -46798,7 +47555,7 @@ var QUERY_COMMANDS = [QueryCmd];
|
|
|
46798
47555
|
|
|
46799
47556
|
// ente/commands/recordingPipeline.ts
|
|
46800
47557
|
import { spawnSync } from "node:child_process";
|
|
46801
|
-
import { mkdtempSync, readFileSync as
|
|
47558
|
+
import { mkdtempSync, readFileSync as readFileSync12, writeFileSync as writeFileSync6 } from "node:fs";
|
|
46802
47559
|
import { tmpdir } from "node:os";
|
|
46803
47560
|
import path5 from "node:path";
|
|
46804
47561
|
init_server();
|
|
@@ -46819,7 +47576,7 @@ async function resolveValue(cmd, label, current) {
|
|
|
46819
47576
|
if (cmd.edit) return editInEditor(current, label);
|
|
46820
47577
|
if (cmd.file !== void 0) {
|
|
46821
47578
|
if (cmd.file === "-") return await readStdin();
|
|
46822
|
-
return
|
|
47579
|
+
return readFileSync12(cmd.file, "utf8");
|
|
46823
47580
|
}
|
|
46824
47581
|
if (cmd.value !== void 0) return cmd.value;
|
|
46825
47582
|
throw new Error(`No ${label} given. Pass a value, --file <path> (or --file -), or --edit.`);
|
|
@@ -46833,7 +47590,7 @@ function editInEditor(initial, label) {
|
|
|
46833
47590
|
if (res.status !== 0) {
|
|
46834
47591
|
throw new Error(`Editor '${editor}' exited with a non-zero status; ${label} unchanged.`);
|
|
46835
47592
|
}
|
|
46836
|
-
return
|
|
47593
|
+
return readFileSync12(file2, "utf8");
|
|
46837
47594
|
}
|
|
46838
47595
|
function readStdin() {
|
|
46839
47596
|
return new Promise((resolve2, reject) => {
|
|
@@ -47564,7 +48321,7 @@ var agentConfigBrowserInputs = {
|
|
|
47564
48321
|
};
|
|
47565
48322
|
|
|
47566
48323
|
// ente/commands/agent.ts
|
|
47567
|
-
import { readFileSync as
|
|
48324
|
+
import { readFileSync as readFileSync13 } from "node:fs";
|
|
47568
48325
|
import { randomUUID } from "node:crypto";
|
|
47569
48326
|
|
|
47570
48327
|
// ente/agentCaller.ts
|
|
@@ -47702,8 +48459,8 @@ async function boundAgentClient(client, context) {
|
|
|
47702
48459
|
}));
|
|
47703
48460
|
return { data: page3.page, ...!page3.isDone ? { continueCursor: page3.continueCursor } : {} };
|
|
47704
48461
|
},
|
|
47705
|
-
getAgentThread: async (threadId,
|
|
47706
|
-
const request = parseAgentContextInput("agent_thread_get", { threadId, cursor:
|
|
48462
|
+
getAgentThread: async (threadId, cursor2, limit3 = 50) => {
|
|
48463
|
+
const request = parseAgentContextInput("agent_thread_get", { threadId, cursor: cursor2, limit: limit3 });
|
|
47707
48464
|
if (request.operation !== "agent_thread_get") throw new Error("Invalid agent context operation");
|
|
47708
48465
|
const page3 = encodeAgentContextResult("agent_thread_get", await (await caller()).query(thread, {
|
|
47709
48466
|
threadId: request.input.threadId,
|
|
@@ -47750,14 +48507,14 @@ function fmtTime(ms) {
|
|
|
47750
48507
|
return new Date(ms).toISOString().replace("T", " ").slice(0, 16);
|
|
47751
48508
|
}
|
|
47752
48509
|
function summarizeValue(value, maxLen = 200) {
|
|
47753
|
-
let
|
|
48510
|
+
let text4;
|
|
47754
48511
|
try {
|
|
47755
|
-
|
|
48512
|
+
text4 = typeof value === "string" ? value : JSON.stringify(value);
|
|
47756
48513
|
} catch {
|
|
47757
|
-
|
|
48514
|
+
text4 = String(value);
|
|
47758
48515
|
}
|
|
47759
|
-
if (
|
|
47760
|
-
return
|
|
48516
|
+
if (text4 === void 0) text4 = "";
|
|
48517
|
+
return text4.length > maxLen ? `${text4.slice(0, maxLen - 1)}\u2026` : text4;
|
|
47761
48518
|
}
|
|
47762
48519
|
function isErrorResult(result) {
|
|
47763
48520
|
if (result.isError) return true;
|
|
@@ -47779,15 +48536,15 @@ function normalizeOperatorMessage(message4) {
|
|
|
47779
48536
|
};
|
|
47780
48537
|
}
|
|
47781
48538
|
async function fetchOperatorThread(client, threadId, agentId = "") {
|
|
47782
|
-
let
|
|
48539
|
+
let cursor2;
|
|
47783
48540
|
let thread2;
|
|
47784
48541
|
const messages = [];
|
|
47785
48542
|
do {
|
|
47786
|
-
const response = await client.getAgentThread(threadId,
|
|
48543
|
+
const response = await client.getAgentThread(threadId, cursor2, 50);
|
|
47787
48544
|
thread2 = normalizeOperatorThread(response.data.thread, agentId);
|
|
47788
48545
|
messages.push(...response.data.messages.map(normalizeOperatorMessage));
|
|
47789
|
-
|
|
47790
|
-
} while (
|
|
48546
|
+
cursor2 = response.data.continueCursor;
|
|
48547
|
+
} while (cursor2);
|
|
47791
48548
|
return thread2 ? { thread: thread2, messages } : null;
|
|
47792
48549
|
}
|
|
47793
48550
|
function renderAgentConfiguration(agent3) {
|
|
@@ -47850,17 +48607,17 @@ var AgentThreads = class extends ClientCommand {
|
|
|
47850
48607
|
}
|
|
47851
48608
|
const cap = requestedLimit ?? 200;
|
|
47852
48609
|
const operatorThreads = [];
|
|
47853
|
-
let
|
|
48610
|
+
let cursor2;
|
|
47854
48611
|
do {
|
|
47855
48612
|
const response = await client.listAgentThreads({
|
|
47856
48613
|
includeArchived: this.includeArchived ? "true" : void 0,
|
|
47857
48614
|
limit: String(Math.min(cap - operatorThreads.length, 50)),
|
|
47858
|
-
cursor:
|
|
48615
|
+
cursor: cursor2,
|
|
47859
48616
|
attention: this.attention
|
|
47860
48617
|
});
|
|
47861
48618
|
operatorThreads.push(...response.data);
|
|
47862
|
-
|
|
47863
|
-
} while (
|
|
48619
|
+
cursor2 = response.continueCursor;
|
|
48620
|
+
} while (cursor2 && operatorThreads.length < cap);
|
|
47864
48621
|
threads2 = operatorThreads.map((thread2) => normalizeOperatorThread(thread2, context.data.agentId));
|
|
47865
48622
|
if (status2) threads2 = threads2.filter((thread2) => thread2.status === status2);
|
|
47866
48623
|
} else {
|
|
@@ -48010,7 +48767,7 @@ var AgentSend = class extends ClientCommand {
|
|
|
48010
48767
|
threadId: this.threadId,
|
|
48011
48768
|
claimId,
|
|
48012
48769
|
text: this.message,
|
|
48013
|
-
...this.htmlFile ? { html:
|
|
48770
|
+
...this.htmlFile ? { html: readFileSync13(this.htmlFile, "utf8") } : {},
|
|
48014
48771
|
...this.request === "none" ? {} : { requestKind: this.request },
|
|
48015
48772
|
...this.requestPrompt ? { requestPrompt: this.requestPrompt } : {},
|
|
48016
48773
|
idempotencyKey: this.idempotencyKey ?? randomUUID()
|
|
@@ -48049,7 +48806,7 @@ var AgentNew = class extends ClientCommand {
|
|
|
48049
48806
|
const response = await client.createAgentThread({
|
|
48050
48807
|
title: this.title,
|
|
48051
48808
|
text: this.message,
|
|
48052
|
-
...this.htmlFile ? { html:
|
|
48809
|
+
...this.htmlFile ? { html: readFileSync13(this.htmlFile, "utf8") } : {},
|
|
48053
48810
|
...this.request === "none" ? {} : { requestKind: this.request },
|
|
48054
48811
|
...this.requestPrompt ? { requestPrompt: this.requestPrompt } : {},
|
|
48055
48812
|
idempotencyKey: this.idempotencyKey ?? randomUUID()
|
|
@@ -48068,7 +48825,7 @@ var AgentSetIcon = class extends ClientCommand {
|
|
|
48068
48825
|
reset = options_exports.Boolean("--reset", false);
|
|
48069
48826
|
async run() {
|
|
48070
48827
|
if (Number(this.reset) + Number(this.icon !== void 0) + Number(this.file !== void 0) !== 1) throw new Error("Provide one icon ID, --file or --reset.");
|
|
48071
|
-
const { icon: icon2 } = parseAgentIconInput({ icon: this.reset ? null : this.file ? `data:image/png;base64,${
|
|
48828
|
+
const { icon: icon2 } = parseAgentIconInput({ icon: this.reset ? null : this.file ? `data:image/png;base64,${readFileSync13(this.file).toString("base64")}` : this.icon });
|
|
48072
48829
|
const result = await this.client().setAgentIcon(icon2);
|
|
48073
48830
|
this.emitText(result, () => `Agent ${result.data.agentId}: ${result.data.icon?.startsWith("data:") ? "PNG icon" : result.data.icon ?? "default icon"}`);
|
|
48074
48831
|
}
|
|
@@ -48097,7 +48854,7 @@ var AgentConfigSetPrompt = class extends ClientCommand {
|
|
|
48097
48854
|
if (!!this.prompt === !!this.file) {
|
|
48098
48855
|
throw new Error("Provide exactly one of --text or --file.");
|
|
48099
48856
|
}
|
|
48100
|
-
const prompt = this.file ?
|
|
48857
|
+
const prompt = this.file ? readFileSync13(this.file, "utf8") : this.prompt;
|
|
48101
48858
|
const client = await boundAgentClient(this.client(), await this.client().getAuthContext());
|
|
48102
48859
|
const { data } = await client.updateAgentPrompt(prompt);
|
|
48103
48860
|
this.emitText({ data }, () => `Updated Ente prompt configuration for ${data.name}.`);
|
|
@@ -48111,7 +48868,7 @@ var AgentSchedulesConfigure = class extends ClientCommand {
|
|
|
48111
48868
|
});
|
|
48112
48869
|
file = options_exports.String("--file", { required: true, description: "JSON file containing an array of schedules" });
|
|
48113
48870
|
async run() {
|
|
48114
|
-
const parsed = JSON.parse(
|
|
48871
|
+
const parsed = JSON.parse(readFileSync13(this.file, "utf8"));
|
|
48115
48872
|
const request = parseAgentConfigInput("agent_schedules_configure", { schedules: parsed });
|
|
48116
48873
|
if (request.operation !== "agent_schedules_configure") throw new Error("Invalid agent configuration operation");
|
|
48117
48874
|
const client = await boundAgentClient(this.client(), await this.client().getAuthContext());
|
|
@@ -48135,7 +48892,7 @@ var AGENT_COMMANDS = [
|
|
|
48135
48892
|
];
|
|
48136
48893
|
|
|
48137
48894
|
// ente/commands/agenda.ts
|
|
48138
|
-
import { readFileSync as
|
|
48895
|
+
import { readFileSync as readFileSync14 } from "node:fs";
|
|
48139
48896
|
var AgendaPointCreate = class extends ClientCommand {
|
|
48140
48897
|
static paths = [["agenda", "create-point"]];
|
|
48141
48898
|
static usage = Command.Usage({
|
|
@@ -48165,7 +48922,7 @@ var AgendaPointCreate = class extends ClientCommand {
|
|
|
48165
48922
|
async run() {
|
|
48166
48923
|
if (this.content !== void 0 && this.contentFile !== void 0)
|
|
48167
48924
|
throw new Error("Use either --content or --content-file, not both.");
|
|
48168
|
-
const contentMarkdown = this.content !== void 0 ? this.content : this.contentFile !== void 0 ?
|
|
48925
|
+
const contentMarkdown = this.content !== void 0 ? this.content : this.contentFile !== void 0 ? readFileSync14(this.contentFile, "utf8") : void 0;
|
|
48169
48926
|
const result = await this.client().createAgendaPoint({
|
|
48170
48927
|
meetingActivityId: this.activity,
|
|
48171
48928
|
title: this.title,
|
|
@@ -48335,19 +49092,19 @@ function offsetMs(utcMs, timeZone) {
|
|
|
48335
49092
|
const hour = get2("hour") === 24 ? 0 : get2("hour");
|
|
48336
49093
|
return Date.UTC(get2("year"), get2("month") - 1, get2("day"), hour, get2("minute"), get2("second")) - utcMs;
|
|
48337
49094
|
}
|
|
48338
|
-
function zonedWallTimeToMs({ year, month, day, hour, minute, second = 0 }, timeZone) {
|
|
48339
|
-
const naive = Date.UTC(year, month - 1,
|
|
49095
|
+
function zonedWallTimeToMs({ year, month, day: day2, hour, minute, second = 0 }, timeZone) {
|
|
49096
|
+
const naive = Date.UTC(year, month - 1, day2, hour, minute, second);
|
|
48340
49097
|
const first = offsetMs(naive, timeZone);
|
|
48341
49098
|
let ms = naive - first;
|
|
48342
49099
|
const second2 = offsetMs(ms, timeZone);
|
|
48343
49100
|
if (second2 !== first) ms = naive - second2;
|
|
48344
49101
|
if (ms + offsetMs(ms, timeZone) !== naive)
|
|
48345
|
-
throw new Error(`${year}-${String(month).padStart(2, "0")}-${String(
|
|
49102
|
+
throw new Error(`${year}-${String(month).padStart(2, "0")}-${String(day2).padStart(2, "0")} ${hour}:${String(minute).padStart(2, "0")} does not exist in ${timeZone} (clock change); pick another time or give an explicit offset.`);
|
|
48346
49103
|
return ms;
|
|
48347
49104
|
}
|
|
48348
|
-
function checkedDate(year, month,
|
|
48349
|
-
const date5 = new Date(Date.UTC(year, month - 1,
|
|
48350
|
-
if (date5.getUTCFullYear() !== year || date5.getUTCMonth() !== month - 1 || date5.getUTCDate() !==
|
|
49105
|
+
function checkedDate(year, month, day2, raw) {
|
|
49106
|
+
const date5 = new Date(Date.UTC(year, month - 1, day2));
|
|
49107
|
+
if (date5.getUTCFullYear() !== year || date5.getUTCMonth() !== month - 1 || date5.getUTCDate() !== day2)
|
|
48351
49108
|
throw new Error(`Invalid date "${raw}".`);
|
|
48352
49109
|
}
|
|
48353
49110
|
function parseInstant(raw, timeZone, flag) {
|
|
@@ -48358,10 +49115,10 @@ function parseInstant(raw, timeZone, flag) {
|
|
|
48358
49115
|
}
|
|
48359
49116
|
const match = WALL_RE.exec(value);
|
|
48360
49117
|
if (match) {
|
|
48361
|
-
const [year, month,
|
|
48362
|
-
checkedDate(year, month,
|
|
49118
|
+
const [year, month, day2, hour, minute, second] = match.slice(1).map((part) => Number(part ?? 0));
|
|
49119
|
+
checkedDate(year, month, day2, raw);
|
|
48363
49120
|
if (hour > 23 || minute > 59 || second > 59) throw new Error(`Invalid time in ${flag} "${raw}".`);
|
|
48364
|
-
return zonedWallTimeToMs({ year, month, day, hour, minute, second }, timeZone);
|
|
49121
|
+
return zonedWallTimeToMs({ year, month, day: day2, hour, minute, second }, timeZone);
|
|
48365
49122
|
}
|
|
48366
49123
|
if (DATE_RE.test(value)) throw new Error(`${flag} "${raw}" is a date; add a time (YYYY-MM-DD HH:MM) or use --all-day.`);
|
|
48367
49124
|
throw new Error(`Invalid ${flag} "${raw}". Use YYYY-MM-DD HH:MM (in --tz), or ISO 8601 with Z/offset.`);
|
|
@@ -48372,12 +49129,12 @@ function parseDay(raw, flag) {
|
|
|
48372
49129
|
checkedDate(Number(match[1]), Number(match[2]), Number(match[3]), raw);
|
|
48373
49130
|
return raw.trim();
|
|
48374
49131
|
}
|
|
48375
|
-
function addDays(
|
|
48376
|
-
const [year, month, date5] =
|
|
49132
|
+
function addDays(day2, days) {
|
|
49133
|
+
const [year, month, date5] = day2.split("-").map(Number);
|
|
48377
49134
|
return new Date(Date.UTC(year, month - 1, date5 + days)).toISOString().slice(0, 10);
|
|
48378
49135
|
}
|
|
48379
|
-
function dayToUtcMs(
|
|
48380
|
-
const [year, month, date5] =
|
|
49136
|
+
function dayToUtcMs(day2) {
|
|
49137
|
+
const [year, month, date5] = day2.split("-").map(Number);
|
|
48381
49138
|
return Date.UTC(year, month - 1, date5);
|
|
48382
49139
|
}
|
|
48383
49140
|
function todayIn(timeZone) {
|
|
@@ -49030,19 +49787,19 @@ var CLI_CONTEXT = {
|
|
|
49030
49787
|
};
|
|
49031
49788
|
var PAGE_SIZE = 50;
|
|
49032
49789
|
var MAX_PAGES2 = 50;
|
|
49033
|
-
async function collectColumn(caller, status2,
|
|
49790
|
+
async function collectColumn(caller, status2, text4, limit3, scope) {
|
|
49034
49791
|
const items2 = [];
|
|
49035
|
-
let
|
|
49792
|
+
let cursor2 = null;
|
|
49036
49793
|
for (let page3 = 0; page3 < MAX_PAGES2; page3 += 1) {
|
|
49037
49794
|
const res = await caller.query(listColumn, parseHumanInput("feedback:listColumn", feedbackContracts.listColumn.args, {
|
|
49038
49795
|
status: status2,
|
|
49039
|
-
paginationOpts: { numItems: Math.min(PAGE_SIZE, limit3 - items2.length), cursor:
|
|
49040
|
-
...
|
|
49796
|
+
paginationOpts: { numItems: Math.min(PAGE_SIZE, limit3 - items2.length), cursor: cursor2 },
|
|
49797
|
+
...text4 ? { text: text4 } : {},
|
|
49041
49798
|
scope
|
|
49042
49799
|
})).then((raw) => parseOperationResult("feedback:listColumn", feedbackContracts.listColumn.result, raw));
|
|
49043
49800
|
items2.push(...res.page);
|
|
49044
49801
|
if (res.isDone || items2.length >= limit3) break;
|
|
49045
|
-
|
|
49802
|
+
cursor2 = res.continueCursor;
|
|
49046
49803
|
}
|
|
49047
49804
|
return items2.slice(0, limit3);
|
|
49048
49805
|
}
|
|
@@ -49254,7 +50011,7 @@ ancestors redundantly.
|
|
|
49254
50011
|
Commands:
|
|
49255
50012
|
ente search <query> Fuzzy search entities
|
|
49256
50013
|
ente ask <question> Experimental opt-in beta answer (not general AI chat)
|
|
49257
|
-
ente query <question>
|
|
50014
|
+
ente query <question> Evidence; server-negotiated hybrid or lexical, no answer synthesis
|
|
49258
50015
|
ente entity create|get|update|duplicate|rename|archive|restore|pin|unpin
|
|
49259
50016
|
ente entity list [--archived]
|
|
49260
50017
|
ente pins list <entity> List pins for an entity
|
|
@@ -49265,6 +50022,7 @@ Commands:
|
|
|
49265
50022
|
ente notification send Email your own Ente account (text, HTML, and images)
|
|
49266
50023
|
ente activity create|list|get|update|delete|restore
|
|
49267
50024
|
ente activity content read|edit
|
|
50025
|
+
ente activity content read --id <A> --id <B> --json
|
|
49268
50026
|
ente activity transcript <activityId> [--grep <text>] Transcript behind an activity \u2014 read it when a note or summary is unclear
|
|
49269
50027
|
ente agenda create-point|link-task
|
|
49270
50028
|
ente activity message add <activityId> --content "..."
|
|
@@ -49400,6 +50158,10 @@ Chronological updates:
|
|
|
49400
50158
|
ente activity message add <activity-id> --content "Requirements changed: export must include archived rows."
|
|
49401
50159
|
|
|
49402
50160
|
Focused edits to long bodies:
|
|
50161
|
+
Bulk reading: ente activity content read --id <A> --id <B> --json
|
|
50162
|
+
Up to ten IDs share 50000 UTF16 characters (max 100000). Inspect each complete flag.
|
|
50163
|
+
Resume one source with --id, --cursor and --expected-version; missing/denied is unavailable.
|
|
50164
|
+
Query passages carry canonical versions, hashes and version-scoped b:index local ranges.
|
|
49403
50165
|
1. ente activity content read <activity-id> --json
|
|
49404
50166
|
2. Write a small JSON operation array using returned targets.
|
|
49405
50167
|
3. ente activity content edit <activity-id> --expected-version <contentVersion> --operations-file edits.json --json
|
|
@@ -49419,8 +50181,8 @@ Archiving (trash):
|
|
|
49419
50181
|
content: `Resolve entities globally first: ente search "Apollo" --json
|
|
49420
50182
|
Use an explicit space when the task specifies one:
|
|
49421
50183
|
ente query "launch decisions" --space "Work" --entity "Apollo" --since 1791763200000 --until 1792368000000 --limit 8 --json
|
|
49422
|
-
Ask is an experimental opt-in beta, not a general AI chat or included-model execution command. If unavailable, use ente search, ente entity get, ente activity search/list/get and summarize those records with your agent. Do not change provider/model settings to repair beta unavailability.
|
|
49423
|
-
Time filters
|
|
50184
|
+
Ask is an experimental opt-in beta, not a general AI chat or included-model execution command. If unavailable, use ente search, ente entity get, ente activity search/list/get and summarize those records with your agent. Do not change provider/model settings to repair beta unavailability. Raw query uses its separate GA policy; explicit lexical remains provider-free.
|
|
50185
|
+
Time filters --since/--until stay hard. For uncertain dates use --prefer-since/--prefer-until (soft, never excluding older matches). Repeat --type for activity types; --authored-by filters owner/human/agent/inbound/unknown provenance. Query defaults to hybrid only when GA is ready and the caller is enabled, otherwise lexical with a fallback reason. Explicit --mode lexical makes no provider or reservation call. Semantic returns indexed activity/task sources only and exits 1 when unavailable. Inspect requested/used mode, vector execution, per-space corpus coverage, candidate saturation and truncation. Coverage does not prove exhaustive recall. Use rank for ordering; bounded rankingContributions and cosine are not confidence. No automatic provider fallback runs.
|
|
49424
50186
|
|
|
49425
50187
|
Read one compact entity-history page:
|
|
49426
50188
|
ente activity list --entity <id> --after 1791763200000 --min-count 0 --limit 10 --compact --json
|
|
@@ -49646,7 +50408,7 @@ var canvasHtmlAliases = {
|
|
|
49646
50408
|
function isCanvasHtmlOperationName(name4) {
|
|
49647
50409
|
return Object.hasOwn(canvasHtmlInputs, name4);
|
|
49648
50410
|
}
|
|
49649
|
-
var
|
|
50411
|
+
var descriptions6 = {
|
|
49650
50412
|
listCanvasBoards: "List accessible persisted boards for an entity.",
|
|
49651
50413
|
listCanvasHtmlPanels: "List HTML panel summaries without source.",
|
|
49652
50414
|
getCanvasHtmlPanel: "Read HTML, version and source hash; null if missing or deleted.",
|
|
@@ -49654,13 +50416,13 @@ var descriptions5 = {
|
|
|
49654
50416
|
updateCanvasHtmlPanel: "Update canvas HTML panel title/source and optional geometry. Use fresh expectedVersion and expectedSourceHash; conflicts preserve content.",
|
|
49655
50417
|
deleteCanvasHtmlPanel: "Delete using fresh expectedVersion and expectedSourceHash."
|
|
49656
50418
|
};
|
|
49657
|
-
function
|
|
50419
|
+
function definition5(name4) {
|
|
49658
50420
|
const schema = external_exports.toJSONSchema(canvasHtmlInputs[name4], { io: "input" });
|
|
49659
50421
|
return {
|
|
49660
50422
|
name: name4,
|
|
49661
50423
|
aliases: operationAliases(canvasHtmlAliases, name4),
|
|
49662
50424
|
actor: "agent",
|
|
49663
|
-
description:
|
|
50425
|
+
description: descriptions6[name4],
|
|
49664
50426
|
inputSchema: { type: "object", properties: schema.properties ?? {}, required: schema.required ?? [], additionalProperties: false },
|
|
49665
50427
|
errorSchema: operationErrorSchema,
|
|
49666
50428
|
resultSchema: operationResultSchema(canvasHtmlResults[name4]),
|
|
@@ -49678,8 +50440,8 @@ function definition4(name4) {
|
|
|
49678
50440
|
limits: CANVAS_HTML_LIMITS
|
|
49679
50441
|
};
|
|
49680
50442
|
}
|
|
49681
|
-
var
|
|
49682
|
-
var canvasHtmlCatalog = [...
|
|
50443
|
+
var definitions5 = new Map(Object.keys(canvasHtmlInputs).filter(isCanvasHtmlOperationName).map((name4) => [name4, definition5(name4)]));
|
|
50444
|
+
var canvasHtmlCatalog = [...definitions5.values()];
|
|
49683
50445
|
|
|
49684
50446
|
// ente/canvasHtml.ts
|
|
49685
50447
|
var listBoardsRef = makeFunctionReference(
|
|
@@ -49858,7 +50620,7 @@ import path8 from "node:path";
|
|
|
49858
50620
|
|
|
49859
50621
|
// ente/entityFiles.ts
|
|
49860
50622
|
init_server();
|
|
49861
|
-
import { readFileSync as
|
|
50623
|
+
import { readFileSync as readFileSync15, statSync as statSync2 } from "node:fs";
|
|
49862
50624
|
import path7 from "node:path";
|
|
49863
50625
|
|
|
49864
50626
|
// ../packages/shared/src/entity-file-operation-results.ts
|
|
@@ -50154,7 +50916,7 @@ function isEntityFileOperationName(value) {
|
|
|
50154
50916
|
return Object.hasOwn(entityFileInputs, value);
|
|
50155
50917
|
}
|
|
50156
50918
|
var personalOnly = "Uses your own Nextcloud connection and is available only to your personal agent.";
|
|
50157
|
-
var
|
|
50919
|
+
var descriptions7 = {
|
|
50158
50920
|
createEntityFolder: `Create a new folder in your Nextcloud below parentPath and link it as the entity's file folder. ${personalOnly}`,
|
|
50159
50921
|
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}`,
|
|
50160
50922
|
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. Item paths are relative to the linked folder; linkedFolderPath is the linked folder's own path from your Nextcloud root, so join it with an item path to address that exact file in Nextcloud instead of searching by name. ${personalOnly}`,
|
|
@@ -50167,13 +50929,13 @@ var READ_OPERATIONS = /* @__PURE__ */ new Set(["listEntityFiles", "searchEntityF
|
|
|
50167
50929
|
function isEntityFileReadOperation(operationName) {
|
|
50168
50930
|
return READ_OPERATIONS.has(operationName);
|
|
50169
50931
|
}
|
|
50170
|
-
function
|
|
50932
|
+
function definition6(operationName) {
|
|
50171
50933
|
const schema = external_exports.toJSONSchema(entityFileInputs[operationName], { io: "input" });
|
|
50172
50934
|
return {
|
|
50173
50935
|
name: operationName,
|
|
50174
50936
|
aliases: operationAliases(entityFileAliases, operationName),
|
|
50175
50937
|
actor: "agent",
|
|
50176
|
-
description:
|
|
50938
|
+
description: descriptions7[operationName],
|
|
50177
50939
|
inputSchema: { type: "object", properties: schema.properties ?? {}, required: schema.required ?? [], additionalProperties: false },
|
|
50178
50940
|
errorSchema: operationErrorSchema,
|
|
50179
50941
|
resultSchema: operationResultSchema(entityFileResults[operationName]),
|
|
@@ -50192,8 +50954,8 @@ function definition5(operationName) {
|
|
|
50192
50954
|
limits: ENTITY_FILE_LIMITS
|
|
50193
50955
|
};
|
|
50194
50956
|
}
|
|
50195
|
-
var
|
|
50196
|
-
var entityFileCatalog = [...
|
|
50957
|
+
var definitions6 = new Map(Object.keys(entityFileInputs).filter(isEntityFileOperationName).map((operationName) => [operationName, definition6(operationName)]));
|
|
50958
|
+
var entityFileCatalog = [...definitions6.values()];
|
|
50197
50959
|
|
|
50198
50960
|
// ente/entityFiles.ts
|
|
50199
50961
|
var createFolderRef = makeFunctionReference(
|
|
@@ -50272,7 +51034,7 @@ function readLocalFileAsBase64(filePath) {
|
|
|
50272
51034
|
if (size > ENTITY_FILE_LIMITS.base64DecodedBytes) {
|
|
50273
51035
|
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.`);
|
|
50274
51036
|
}
|
|
50275
|
-
return
|
|
51037
|
+
return readFileSync15(filePath).toString("base64");
|
|
50276
51038
|
}
|
|
50277
51039
|
|
|
50278
51040
|
// ente/commands/files.ts
|
|
@@ -50360,7 +51122,7 @@ var FilesCiteCmd = class extends ProfileCommand {
|
|
|
50360
51122
|
const data = await citeEntityFile(await resolveCaller(), {
|
|
50361
51123
|
entityId: this.entityId,
|
|
50362
51124
|
path: this.filePath,
|
|
50363
|
-
quotes: [...this.quotes.map((
|
|
51125
|
+
quotes: [...this.quotes.map((text4) => candidate === void 0 ? { text: text4 } : { text: text4, candidate }), ...ranges]
|
|
50364
51126
|
});
|
|
50365
51127
|
this.emitText({ data }, () => data.status !== "ok" ? `Unavailable: ${data.status}` : data.citations.map((citation, index) => `${index + 1}. ${citationLine(citation)}`).join("\n"));
|
|
50366
51128
|
}
|
|
@@ -50429,7 +51191,7 @@ var FilesCreateFolderCmd = class extends ProfileCommand {
|
|
|
50429
51191
|
var FILES_COMMANDS = [FilesListCmd, FilesSearchCmd, FilesReadCmd, FilesCiteCmd, FilesUploadCmd, FilesLinkCmd, FilesCreateFolderCmd];
|
|
50430
51192
|
|
|
50431
51193
|
// ente/commands/notification.ts
|
|
50432
|
-
import { readFileSync as
|
|
51194
|
+
import { readFileSync as readFileSync16 } from "node:fs";
|
|
50433
51195
|
|
|
50434
51196
|
// ente/notificationEmailContract.ts
|
|
50435
51197
|
var NOTIFICATION_EMAIL_CLI_SURFACE = {
|
|
@@ -50463,7 +51225,7 @@ var CLI_LIMITS = NOTIFICATION_EMAIL_CLI_SURFACE.limits;
|
|
|
50463
51225
|
function readBody(inline, file2, label) {
|
|
50464
51226
|
if (inline !== void 0 && file2 !== void 0)
|
|
50465
51227
|
throw new Error(`notification send: use either --${label} or --${label}-file, not both.`);
|
|
50466
|
-
const value = file2 !== void 0 ?
|
|
51228
|
+
const value = file2 !== void 0 ? readFileSync16(file2, "utf8") : inline;
|
|
50467
51229
|
if (value !== void 0 && !value.trim())
|
|
50468
51230
|
throw new Error(`notification send: ${label} body must not be empty.`);
|
|
50469
51231
|
return value;
|
|
@@ -50545,8 +51307,8 @@ var NotificationSendCommand = class extends ClientCommand {
|
|
|
50545
51307
|
description: "Attach any bounded file (repeatable)"
|
|
50546
51308
|
});
|
|
50547
51309
|
async run() {
|
|
50548
|
-
const
|
|
50549
|
-
if (
|
|
51310
|
+
const text4 = readBody(this.text, this.textFile, "text");
|
|
51311
|
+
if (text4 === void 0)
|
|
50550
51312
|
throw new Error("notification send: --text or --text-file is required.");
|
|
50551
51313
|
const html2 = readBody(this.html, this.htmlFile, "html");
|
|
50552
51314
|
const attachments = readNotificationEmailAttachments(
|
|
@@ -50556,7 +51318,7 @@ var NotificationSendCommand = class extends ClientCommand {
|
|
|
50556
51318
|
);
|
|
50557
51319
|
const response = await this.client().sendNotificationEmail({
|
|
50558
51320
|
subject: this.subject,
|
|
50559
|
-
text:
|
|
51321
|
+
text: text4,
|
|
50560
51322
|
...html2 !== void 0 ? { html: html2 } : {},
|
|
50561
51323
|
...attachments ? { attachments } : {}
|
|
50562
51324
|
});
|
|
@@ -50568,6 +51330,85 @@ var NotificationSendCommand = class extends ClientCommand {
|
|
|
50568
51330
|
};
|
|
50569
51331
|
var NOTIFICATION_COMMANDS = [NotificationSendCommand];
|
|
50570
51332
|
|
|
51333
|
+
// ente/commands/healthData.ts
|
|
51334
|
+
import { readFileSync as readFileSync17 } from "node:fs";
|
|
51335
|
+
async function readStdin2(stdin) {
|
|
51336
|
+
let text4 = "";
|
|
51337
|
+
stdin.setEncoding("utf8");
|
|
51338
|
+
for await (const chunk of stdin) text4 += chunk;
|
|
51339
|
+
return text4;
|
|
51340
|
+
}
|
|
51341
|
+
async function readHealthRequestFile(file2, stdin = process.stdin) {
|
|
51342
|
+
const text4 = file2 === "-" ? await readStdin2(stdin) : readFileSync17(file2, "utf8");
|
|
51343
|
+
try {
|
|
51344
|
+
return JSON.parse(text4);
|
|
51345
|
+
} catch {
|
|
51346
|
+
throw new Error(`health-data record: ${file2 === "-" ? "stdin" : file2} is not valid JSON.`);
|
|
51347
|
+
}
|
|
51348
|
+
}
|
|
51349
|
+
var HealthDataRecord = class extends ClientCommand {
|
|
51350
|
+
static paths = [["health-data", "record"]];
|
|
51351
|
+
static usage = Command.Usage({
|
|
51352
|
+
category: "Health data",
|
|
51353
|
+
description: "Define health series and write, replace or remove points for your calendar health graph",
|
|
51354
|
+
details: "The JSON body has optional lists: series [{key,label,unit?,description?,better,scale?,bands?,resolution?}], points [{series,at,value}], intraday [{series,day,stepMinutes,values}] (a whole day of an intraday series; [] values remove it), remove [{series,at}] and removeSeries [key]. at is YYYY-MM-DD or a local YYYY-MM-DDTHH:MM[:SS][offset]; the wall-clock time is kept as written. Writing the same series and at again replaces the value, so resending a batch is safe. Only your own personal agent may write health data.",
|
|
51355
|
+
examples: [
|
|
51356
|
+
["Send a batch from a file", "$0 health-data record --file ./health.json"],
|
|
51357
|
+
["Pipe a batch", "health-export | $0 health-data record --file - --json"]
|
|
51358
|
+
]
|
|
51359
|
+
});
|
|
51360
|
+
file = options_exports.String("--file", { required: true, description: "JSON request file, or - for stdin" });
|
|
51361
|
+
async run() {
|
|
51362
|
+
const response = await this.client().recordHealthMeasurements(await readHealthRequestFile(this.file, this.context.stdin));
|
|
51363
|
+
const d = response.data;
|
|
51364
|
+
this.emitText(response, () => [
|
|
51365
|
+
`Series: ${d.seriesCreated} created, ${d.seriesUpdated} updated, ${d.seriesRemoved} removed`,
|
|
51366
|
+
`Points: ${d.pointsInserted} inserted, ${d.pointsUpdated} updated, ${d.pointsUnchanged} unchanged, ${d.pointsRemoved} removed`,
|
|
51367
|
+
`Intraday days: ${d.intradayDaysWritten} written, ${d.intradayDaysRemoved} removed`
|
|
51368
|
+
].join("\n"));
|
|
51369
|
+
}
|
|
51370
|
+
};
|
|
51371
|
+
var HealthDataList = class extends ClientCommand {
|
|
51372
|
+
static paths = [["health-data", "list"]];
|
|
51373
|
+
static usage = Command.Usage({
|
|
51374
|
+
category: "Health data",
|
|
51375
|
+
description: "Show your health series and their points between two days",
|
|
51376
|
+
details: `Days are inclusive, at most ${HEALTH_READ_MAX_DAYS} apart. Timed points show the local wall-clock time as written.`,
|
|
51377
|
+
examples: [
|
|
51378
|
+
["One week", "$0 health-data list --from 2026-11-16 --to 2026-11-22"],
|
|
51379
|
+
["Two series as JSON", "$0 health-data list --from 2026-11-01 --to 2026-11-30 --series hrv --series sleep --json"]
|
|
51380
|
+
]
|
|
51381
|
+
});
|
|
51382
|
+
from = options_exports.String("--from", { required: true, description: "First day, YYYY-MM-DD" });
|
|
51383
|
+
to = options_exports.String("--to", { required: true, description: "Last day, YYYY-MM-DD" });
|
|
51384
|
+
series = options_exports.Array("--series", { description: "Only this series key (repeatable)" });
|
|
51385
|
+
async run() {
|
|
51386
|
+
const response = await this.client().listHealthMeasurements({
|
|
51387
|
+
from: this.from,
|
|
51388
|
+
to: this.to,
|
|
51389
|
+
...this.series?.length ? { series: this.series } : {}
|
|
51390
|
+
});
|
|
51391
|
+
const { series, points, intraday } = response.data;
|
|
51392
|
+
this.emitText(response, () => {
|
|
51393
|
+
if (!series.length) return "No health series yet.";
|
|
51394
|
+
const units = new Map(series.map((item) => [item.key, item.unit]));
|
|
51395
|
+
const lines = series.map((item) => `${item.key}: ${item.label}${item.unit ? ` (${item.unit})` : ""}, ${item.resolution === "intraday" ? "intraday" : `${item.better} is better`}${item.description ? ` \xB7 ${item.description}` : ""}`);
|
|
51396
|
+
lines.push("", points.length ? `${points.length} points` : `No points from ${this.from} to ${this.to}.`);
|
|
51397
|
+
for (const point2 of points) {
|
|
51398
|
+
const unit = units.get(point2.series);
|
|
51399
|
+
lines.push(`${formatHealthPointAt({ day: point2.day, minute: point2.minute }).padEnd(16)} ${point2.series} ${point2.value}${unit ? ` ${unit}` : ""}`);
|
|
51400
|
+
}
|
|
51401
|
+
if (intraday.length) lines.push("", `${intraday.length} intraday days`);
|
|
51402
|
+
for (const block of intraday) {
|
|
51403
|
+
const measured = block.values.filter((value) => value !== null).length;
|
|
51404
|
+
lines.push(`${block.day} ${block.series} ${measured} of ${block.values.length} values, every ${block.stepMinutes} min`);
|
|
51405
|
+
}
|
|
51406
|
+
return lines.join("\n");
|
|
51407
|
+
});
|
|
51408
|
+
}
|
|
51409
|
+
};
|
|
51410
|
+
var HEALTH_DATA_COMMANDS = [HealthDataRecord, HealthDataList];
|
|
51411
|
+
|
|
50571
51412
|
// ente/commands/agentTasks.ts
|
|
50572
51413
|
var AgentTasks = class extends ClientCommand {
|
|
50573
51414
|
static paths = [["agent", "tasks"]];
|
|
@@ -50659,10 +51500,20 @@ var mailboxInputs = {
|
|
|
50659
51500
|
sendDraft: external_exports.strictObject({ ...write2, draftId: id20, draftVersion: id20 }),
|
|
50660
51501
|
modifyLabels: external_exports.strictObject({ ...write2, ...target2, labels: external_exports.array(external_exports.enum(["handled", "needs-reply", "archive", "unarchive", "read", "unread"])).max(1), stateVersion: external_exports.number().int().nonnegative().optional() }).refine((value) => value.messageId || value.threadId || value.providerThreadId, { message: "messageId or threadId is required" })
|
|
50661
51502
|
};
|
|
50662
|
-
|
|
50663
|
-
const input2 = external_exports.toJSONSchema(
|
|
50664
|
-
return
|
|
50665
|
-
}
|
|
51503
|
+
function mailboxOperationSchema(name4) {
|
|
51504
|
+
const input2 = external_exports.toJSONSchema(mailboxInputs[name4]);
|
|
51505
|
+
return { ...input2, ...["readThread", "modifyLabels"].includes(name4) ? { anyOf: [{ required: ["messageId"] }, { required: ["threadId"] }, { required: ["providerThreadId"] }] } : {}, type: "object", properties: { operation: { const: name4 }, ...input2.properties }, required: ["operation", ...input2.required ?? []] };
|
|
51506
|
+
}
|
|
51507
|
+
var mailboxOperationSchemas = {
|
|
51508
|
+
listMailboxes: mailboxOperationSchema("listMailboxes"),
|
|
51509
|
+
search: mailboxOperationSchema("search"),
|
|
51510
|
+
readThread: mailboxOperationSchema("readThread"),
|
|
51511
|
+
createDraft: mailboxOperationSchema("createDraft"),
|
|
51512
|
+
loadDraft: mailboxOperationSchema("loadDraft"),
|
|
51513
|
+
discardDraft: mailboxOperationSchema("discardDraft"),
|
|
51514
|
+
sendDraft: mailboxOperationSchema("sendDraft"),
|
|
51515
|
+
modifyLabels: mailboxOperationSchema("modifyLabels")
|
|
51516
|
+
};
|
|
50666
51517
|
var operationResultSchema2 = { type: "object", properties: { mailboxId: { type: "string" }, from: { type: "string" }, permissionUsed: { enum: ["read", "draft", "send", "organize", "allowlist-send"] }, messageCount: { type: "integer", minimum: 0, description: "Total provider messages observed when organize label readback was truncated." }, readbackTruncated: { type: "boolean", description: "True when messages contains a bounded prefix of the actual post-change label readback. Use readThread to inspect more current provider state." } }, required: ["from", "permissionUsed"] };
|
|
50667
51518
|
var mailboxListResultSchema = { type: "object", properties: { accounts: { type: "array", items: { type: "object", properties: { mailboxId: { type: "string" }, from: { type: "string" }, permissionUsed: { const: "read" } }, required: ["mailboxId", "from", "permissionUsed"] } }, permissionUsed: { const: "read" } }, required: ["accounts", "permissionUsed"] };
|
|
50668
51519
|
var mailboxOperationContracts = Object.keys(mailboxInputs).map((name4) => ({
|
|
@@ -50682,7 +51533,7 @@ var mailboxOperationContracts = Object.keys(mailboxInputs).map((name4) => ({
|
|
|
50682
51533
|
availability: { hosted: true, external: true, browserHuman: true, agentConnection: true, executionProfiles: ["full"], runtime: "action", MCP: true, REST: true, CLI: true }
|
|
50683
51534
|
}));
|
|
50684
51535
|
function mailboxOperationDefinition(operation) {
|
|
50685
|
-
return mailboxOperationContracts.find((
|
|
51536
|
+
return mailboxOperationContracts.find((definition7) => definition7.name === operation);
|
|
50686
51537
|
}
|
|
50687
51538
|
function parseMailboxOperation(operation, input2) {
|
|
50688
51539
|
return parseOperationInput(operation, mailboxInputs[operation], input2);
|
|
@@ -50886,7 +51737,7 @@ function parseUserMailboxRequest(input2) {
|
|
|
50886
51737
|
|
|
50887
51738
|
// ente/commands/agentMail.ts
|
|
50888
51739
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
50889
|
-
import { readFileSync as
|
|
51740
|
+
import { readFileSync as readFileSync18 } from "node:fs";
|
|
50890
51741
|
|
|
50891
51742
|
// ente/agentMailContract.ts
|
|
50892
51743
|
var AGENT_MAIL_CLI_SURFACE = {
|
|
@@ -50985,7 +51836,7 @@ function truncateUtf8(value, maxBytes) {
|
|
|
50985
51836
|
}
|
|
50986
51837
|
function safeAttachmentFilename(name4, attachmentId) {
|
|
50987
51838
|
const leaf = name4.split(/[\\/]/u).pop() ?? "";
|
|
50988
|
-
let clean = leaf.normalize("NFC").replace(/[
|
|
51839
|
+
let clean = replaceCharacters(leaf.normalize("NFC"), UNICODE_CONTROLS, "_").replace(/[---<>:"|?*]/gu, "_").replace(/\s+/gu, " ").trim().replace(/^[.\s]+/u, "").replace(/[.\s]+$/u, "");
|
|
50989
51840
|
if (WINDOWS_RESERVED.test(clean)) clean = `_${clean}`;
|
|
50990
51841
|
if (Buffer.byteLength(clean) > MAX_FILENAME_BYTES) {
|
|
50991
51842
|
const ext = extname2(clean);
|
|
@@ -51086,7 +51937,7 @@ function readBody2(inline, file2, label) {
|
|
|
51086
51937
|
if (inline !== void 0 && file2 !== void 0) {
|
|
51087
51938
|
throw new Error(`agent mail: use either --${label} or --${label}-file, not both.`);
|
|
51088
51939
|
}
|
|
51089
|
-
const value = file2 === void 0 ? inline :
|
|
51940
|
+
const value = file2 === void 0 ? inline : readFileSync18(file2, "utf8");
|
|
51090
51941
|
if (value !== void 0 && !value.trim()) {
|
|
51091
51942
|
throw new Error(`agent mail: ${label} body must not be empty.`);
|
|
51092
51943
|
}
|
|
@@ -51100,8 +51951,8 @@ function normalizeAgentMailIdempotencyKey(value) {
|
|
|
51100
51951
|
return key;
|
|
51101
51952
|
}
|
|
51102
51953
|
function readAgentMailBodies(options) {
|
|
51103
|
-
const
|
|
51104
|
-
if (
|
|
51954
|
+
const text4 = readBody2(options.text, options.textFile, "text");
|
|
51955
|
+
if (text4 === void 0) {
|
|
51105
51956
|
throw new Error("agent mail: --text or --text-file is required.");
|
|
51106
51957
|
}
|
|
51107
51958
|
const html2 = readBody2(options.html, options.htmlFile, "html");
|
|
@@ -51136,7 +51987,7 @@ function readAgentMailBodies(options) {
|
|
|
51136
51987
|
const referenceError = agentMailInlineReferenceError(html2, attachments);
|
|
51137
51988
|
if (referenceError) throw new Error(`agent mail: ${referenceError}`);
|
|
51138
51989
|
return {
|
|
51139
|
-
text:
|
|
51990
|
+
text: text4,
|
|
51140
51991
|
...html2 === void 0 ? {} : { html: html2 },
|
|
51141
51992
|
...attachments.length ? { attachments } : {}
|
|
51142
51993
|
};
|
|
@@ -51389,7 +52240,7 @@ Legacy request shapes remain supported.` });
|
|
|
51389
52240
|
return;
|
|
51390
52241
|
}
|
|
51391
52242
|
if (this.request === void 0 === (this.requestFile === void 0)) throw new Error("Use exactly one of --request or --request-file");
|
|
51392
|
-
const input2 = JSON.parse(this.request ??
|
|
52243
|
+
const input2 = JSON.parse(this.request ?? readFileSync18(this.requestFile, "utf8"));
|
|
51393
52244
|
const parsed = parseUserMailboxRequest(this.dryRun ? { ...input2, dryRun: true } : input2);
|
|
51394
52245
|
if ("error" in parsed) throw new Error(parsed.error);
|
|
51395
52246
|
const result = await this.client().userMailbox(parsed.value);
|
|
@@ -51409,18 +52260,18 @@ var AGENT_MAIL_COMMANDS = [
|
|
|
51409
52260
|
|
|
51410
52261
|
// ente/commands/update.ts
|
|
51411
52262
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
51412
|
-
import { existsSync as existsSync8, readFileSync as
|
|
52263
|
+
import { existsSync as existsSync8, readFileSync as readFileSync21, realpathSync as realpathSync2 } from "node:fs";
|
|
51413
52264
|
import path11 from "node:path";
|
|
51414
52265
|
|
|
51415
52266
|
// ente/migrationState.ts
|
|
51416
|
-
import { existsSync as existsSync6, mkdirSync as mkdirSync5, readFileSync as
|
|
52267
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync5, readFileSync as readFileSync19, writeFileSync as writeFileSync8 } from "node:fs";
|
|
51417
52268
|
import path9 from "node:path";
|
|
51418
52269
|
var MIGRATION_STATE_FILE = "registry_migration.json";
|
|
51419
52270
|
function readMigrationState(cacheDir, key) {
|
|
51420
52271
|
try {
|
|
51421
52272
|
const file2 = path9.join(cacheDir, MIGRATION_STATE_FILE);
|
|
51422
52273
|
if (!existsSync6(file2)) return void 0;
|
|
51423
|
-
const value = JSON.parse(
|
|
52274
|
+
const value = JSON.parse(readFileSync19(file2, "utf8"))[key];
|
|
51424
52275
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
51425
52276
|
} catch {
|
|
51426
52277
|
return void 0;
|
|
@@ -51431,7 +52282,7 @@ function writeMigrationState(cacheDir, key, value) {
|
|
|
51431
52282
|
const file2 = path9.join(cacheDir, MIGRATION_STATE_FILE);
|
|
51432
52283
|
let state = {};
|
|
51433
52284
|
try {
|
|
51434
|
-
if (existsSync6(file2)) state = JSON.parse(
|
|
52285
|
+
if (existsSync6(file2)) state = JSON.parse(readFileSync19(file2, "utf8"));
|
|
51435
52286
|
} catch {
|
|
51436
52287
|
}
|
|
51437
52288
|
mkdirSync5(cacheDir, { recursive: true });
|
|
@@ -51444,7 +52295,7 @@ function writeMigrationState(cacheDir, key, value) {
|
|
|
51444
52295
|
|
|
51445
52296
|
// ente/installSource.ts
|
|
51446
52297
|
import { createHash as createHash5 } from "node:crypto";
|
|
51447
|
-
import { existsSync as existsSync7, readFileSync as
|
|
52298
|
+
import { existsSync as existsSync7, readFileSync as readFileSync20 } from "node:fs";
|
|
51448
52299
|
import os3 from "node:os";
|
|
51449
52300
|
import path10 from "node:path";
|
|
51450
52301
|
import { fileURLToPath } from "node:url";
|
|
@@ -51474,9 +52325,9 @@ function installedPackageDir(fromFile) {
|
|
|
51474
52325
|
}
|
|
51475
52326
|
return null;
|
|
51476
52327
|
}
|
|
51477
|
-
function sourceFromLockfile(
|
|
52328
|
+
function sourceFromLockfile(text4) {
|
|
51478
52329
|
try {
|
|
51479
|
-
const lock = JSON.parse(
|
|
52330
|
+
const lock = JSON.parse(text4);
|
|
51480
52331
|
const resolved = lock.packages?.[`node_modules/${PACKAGE_NAME}`]?.resolved;
|
|
51481
52332
|
return typeof resolved === "string" ? classifyRegistryUrl(resolved) : "unknown";
|
|
51482
52333
|
} catch {
|
|
@@ -51498,7 +52349,7 @@ function npmCacheDir(env = process.env) {
|
|
|
51498
52349
|
try {
|
|
51499
52350
|
const file2 = userNpmrcPath(env);
|
|
51500
52351
|
if (existsSync7(file2)) {
|
|
51501
|
-
const match = /^\s*cache\s*=\s*(.+?)\s*$/im.exec(
|
|
52352
|
+
const match = /^\s*cache\s*=\s*(.+?)\s*$/im.exec(readFileSync20(file2, "utf8"));
|
|
51502
52353
|
if (match) return match[1].replace(/^~(?=$|[\\/])/, os3.homedir());
|
|
51503
52354
|
}
|
|
51504
52355
|
} catch {
|
|
@@ -51510,7 +52361,7 @@ function cachedFetchTime(cacheDir, url2) {
|
|
|
51510
52361
|
const bucket = path10.join(cacheDir, "_cacache", "index-v5", hash2.slice(0, 2), hash2.slice(2, 4), hash2.slice(4));
|
|
51511
52362
|
if (!existsSync7(bucket)) return null;
|
|
51512
52363
|
let latest = null;
|
|
51513
|
-
for (const line of
|
|
52364
|
+
for (const line of readFileSync20(bucket, "utf8").split("\n")) {
|
|
51514
52365
|
const tab = line.indexOf(" ");
|
|
51515
52366
|
if (tab < 0) continue;
|
|
51516
52367
|
try {
|
|
@@ -51523,7 +52374,7 @@ function cachedFetchTime(cacheDir, url2) {
|
|
|
51523
52374
|
}
|
|
51524
52375
|
function sourceFromNpmCache(cacheDir, version5, npmInstalledAt) {
|
|
51525
52376
|
const urls = tarballUrls(version5);
|
|
51526
|
-
const newest = (
|
|
52377
|
+
const newest = (list3) => Math.max(-1, ...list3.map((url2) => cachedFetchTime(cacheDir, url2) ?? -1));
|
|
51527
52378
|
const npm = Math.max(newest(urls.npm), npmInstalledAt ?? -1);
|
|
51528
52379
|
const gitea = newest(urls.gitea);
|
|
51529
52380
|
if (npm < 0 && gitea < 0) return "unknown";
|
|
@@ -51535,7 +52386,7 @@ function detectInstallSource(options = {}) {
|
|
|
51535
52386
|
if (!packageDir) return "unknown";
|
|
51536
52387
|
const lockfile = path10.join(path10.dirname(packageDir), ".package-lock.json");
|
|
51537
52388
|
if (existsSync7(lockfile)) {
|
|
51538
|
-
const fromLock = sourceFromLockfile(
|
|
52389
|
+
const fromLock = sourceFromLockfile(readFileSync20(lockfile, "utf8"));
|
|
51539
52390
|
if (fromLock !== "unknown") return fromLock;
|
|
51540
52391
|
}
|
|
51541
52392
|
const version5 = options.version ?? installedVersion(packageDir);
|
|
@@ -51547,7 +52398,7 @@ function detectInstallSource(options = {}) {
|
|
|
51547
52398
|
}
|
|
51548
52399
|
function installedVersion(packageDir) {
|
|
51549
52400
|
try {
|
|
51550
|
-
const version5 = JSON.parse(
|
|
52401
|
+
const version5 = JSON.parse(readFileSync20(path10.join(packageDir, "package.json"), "utf8")).version;
|
|
51551
52402
|
return typeof version5 === "string" && /^[0-9A-Za-z.+-]{1,32}$/.test(version5) ? version5 : null;
|
|
51552
52403
|
} catch {
|
|
51553
52404
|
return null;
|
|
@@ -51560,9 +52411,9 @@ function currentFile() {
|
|
|
51560
52411
|
return "";
|
|
51561
52412
|
}
|
|
51562
52413
|
}
|
|
51563
|
-
function registryFromNpmrc(
|
|
52414
|
+
function registryFromNpmrc(text4) {
|
|
51564
52415
|
let registry2 = null;
|
|
51565
|
-
for (const raw of
|
|
52416
|
+
for (const raw of text4.split(/\r?\n/)) {
|
|
51566
52417
|
const line = raw.trim();
|
|
51567
52418
|
if (!line || line.startsWith("#") || line.startsWith(";")) continue;
|
|
51568
52419
|
const match = /^registry\s*=\s*(.+)$/i.exec(line);
|
|
@@ -51576,7 +52427,7 @@ function userNpmrcPath(env = process.env) {
|
|
|
51576
52427
|
function giteaNpmrcHint(effectiveRegistry, userNpmrcText) {
|
|
51577
52428
|
if (classifyRegistryUrl(effectiveRegistry) !== "gitea") return null;
|
|
51578
52429
|
const inUserFile = classifyRegistryUrl(registryFromNpmrc(userNpmrcText ?? "")) === "gitea";
|
|
51579
|
-
const why = "Your npm config sets registry to
|
|
52430
|
+
const why = "Your npm config sets registry to the Gitea registry, so a plain 'npm i -g ente-cli' (and other npm installs) would still use Gitea. 'ente update' always installs from npm.";
|
|
51580
52431
|
return inUserFile ? `${why} To remove that line from your ~/.npmrc, run: npm config delete registry` : `${why} It is not set in your ~/.npmrc; find where with: npm config ls -l | grep registry`;
|
|
51581
52432
|
}
|
|
51582
52433
|
|
|
@@ -51589,12 +52440,12 @@ function updateShellCommand(prefix = null) {
|
|
|
51589
52440
|
}
|
|
51590
52441
|
function installPrefixOf(scriptPath) {
|
|
51591
52442
|
const parts = scriptPath.split(path11.sep);
|
|
51592
|
-
const
|
|
51593
|
-
if (
|
|
51594
|
-
return parts.slice(0,
|
|
52443
|
+
const at2 = parts.lastIndexOf(ENTE_BRANDING.packageName);
|
|
52444
|
+
if (at2 < 3 || parts[at2 - 1] !== "node_modules" || parts[at2 - 2] !== "lib") return null;
|
|
52445
|
+
return parts.slice(0, at2 - 2).join(path11.sep) || path11.sep;
|
|
51595
52446
|
}
|
|
51596
52447
|
var SHARED_INSTALL_UMASK = 18;
|
|
51597
|
-
var MOVING_TO_NPM_NOTICE = "This ente CLI was installed from
|
|
52448
|
+
var MOVING_TO_NPM_NOTICE = "This ente CLI was installed from the Gitea registry; installing it from npm (registry.npmjs.org) instead.";
|
|
51598
52449
|
var updateRunner = {
|
|
51599
52450
|
run(command, args, json3) {
|
|
51600
52451
|
const previousUmask = process.platform === "win32" ? void 0 : process.umask(SHARED_INSTALL_UMASK);
|
|
@@ -51620,8 +52471,8 @@ var updateRunner = {
|
|
|
51620
52471
|
installSource() {
|
|
51621
52472
|
return detectInstallSource({ npmInstalledAt: readMigrationState(configDir(ENTE_BRANDING), "npm_installed_at") });
|
|
51622
52473
|
},
|
|
51623
|
-
recordNpmInstall(
|
|
51624
|
-
writeMigrationState(configDir(ENTE_BRANDING), "npm_installed_at",
|
|
52474
|
+
recordNpmInstall(at2) {
|
|
52475
|
+
writeMigrationState(configDir(ENTE_BRANDING), "npm_installed_at", at2);
|
|
51625
52476
|
},
|
|
51626
52477
|
/** npm's effective `registry` setting, or null when npm cannot answer. */
|
|
51627
52478
|
npmRegistry() {
|
|
@@ -51640,7 +52491,7 @@ var updateRunner = {
|
|
|
51640
52491
|
userNpmrc() {
|
|
51641
52492
|
try {
|
|
51642
52493
|
const file2 = userNpmrcPath();
|
|
51643
|
-
return existsSync8(file2) ?
|
|
52494
|
+
return existsSync8(file2) ? readFileSync21(file2, "utf8") : null;
|
|
51644
52495
|
} catch {
|
|
51645
52496
|
return null;
|
|
51646
52497
|
}
|
|
@@ -51670,7 +52521,7 @@ var Update = class extends BaseCommand {
|
|
|
51670
52521
|
static usage = Command.Usage({
|
|
51671
52522
|
category: "Help",
|
|
51672
52523
|
description: "Install the latest ente-cli globally from npm",
|
|
51673
|
-
details: `Runs \`${updateShellCommand()}\`, plus \`--prefix\` for the tree this CLI runs from, with umask 022 so a shared install stays readable for other users. The explicit registry means an npmrc pointing elsewhere (such as
|
|
52524
|
+
details: `Runs \`${updateShellCommand()}\`, plus \`--prefix\` for the tree this CLI runs from, with umask 022 so a shared install stays readable for other users. The explicit registry means an npmrc pointing elsewhere (such as the legacy Gitea registry) cannot redirect it; a CLI installed from Gitea moves to npm. Use \`--dry-run\` to print the command instead. Does not contact the ente server.`,
|
|
51674
52525
|
examples: [["Update from npm", "ente update"], ["Print the install command", "ente update --dry-run"]]
|
|
51675
52526
|
});
|
|
51676
52527
|
registry = options_exports.String("--registry", "npm", { description: "Always npm; kept so existing scripts keep working" });
|
|
@@ -51697,8 +52548,8 @@ var UPDATE_COMMANDS = [Update];
|
|
|
51697
52548
|
// ente/registryMigration.ts
|
|
51698
52549
|
import { createInterface } from "node:readline";
|
|
51699
52550
|
var NO_UPDATE_PROMPT_ENV = "ENTE_CLI_NO_UPDATE_PROMPT";
|
|
51700
|
-
var MIGRATION_QUESTION = "This ente CLI was installed from
|
|
51701
|
-
var MIGRATION_NOTICE = "[ente-cli] This CLI was installed from
|
|
52551
|
+
var MIGRATION_QUESTION = "This ente CLI was installed from the Gitea registry. Move to npm now? [Y/n] ";
|
|
52552
|
+
var MIGRATION_NOTICE = "[ente-cli] This CLI was installed from the Gitea registry. Run 'ente update' to move it to npm.";
|
|
51702
52553
|
var DAY_MS = 864e5;
|
|
51703
52554
|
var SKIP_COMMANDS = /* @__PURE__ */ new Set(["", "update", "--version", "-V", "--help", "-h", "help"]);
|
|
51704
52555
|
function commandWord(argv) {
|
|
@@ -51806,6 +52657,7 @@ for (const Cmd of [
|
|
|
51806
52657
|
...CANVAS_COMMANDS,
|
|
51807
52658
|
...FILES_COMMANDS,
|
|
51808
52659
|
...NOTIFICATION_COMMANDS,
|
|
52660
|
+
...HEALTH_DATA_COMMANDS,
|
|
51809
52661
|
...AGENT_MAIL_COMMANDS,
|
|
51810
52662
|
...AGENT_TASK_COMMANDS,
|
|
51811
52663
|
...UPDATE_COMMANDS
|