ente-cli 0.4.142 → 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 +73 -22
- package/dist/SKILL.md +153 -57
- package/dist/cli.mjs +1167 -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
|
}
|
|
@@ -45062,9 +45702,9 @@ function planUpsert(existing, inputs, keyColumn) {
|
|
|
45062
45702
|
);
|
|
45063
45703
|
return steps;
|
|
45064
45704
|
}
|
|
45065
|
-
function parseImportLines(
|
|
45705
|
+
function parseImportLines(text4) {
|
|
45066
45706
|
const rows = [];
|
|
45067
|
-
for (const [index, source2] of
|
|
45707
|
+
for (const [index, source2] of text4.split(/\r?\n/).entries()) {
|
|
45068
45708
|
if (!source2.trim()) continue;
|
|
45069
45709
|
const line = index + 1;
|
|
45070
45710
|
let parsed;
|
|
@@ -45223,17 +45863,17 @@ async function loadList(caller, listNameOrId) {
|
|
|
45223
45863
|
}
|
|
45224
45864
|
async function fetchMatchingRows(caller, entityId2, where) {
|
|
45225
45865
|
const rows = [];
|
|
45226
|
-
let
|
|
45866
|
+
let cursor2 = null;
|
|
45227
45867
|
for (; ; ) {
|
|
45228
45868
|
const res = databaseListPage(await caller.query(listRows, parseDatabaseProtocolInput("database rows", databaseRowsArgs, {
|
|
45229
45869
|
entityId: entityId2,
|
|
45230
45870
|
ignoreViewFilters: true,
|
|
45231
45871
|
where,
|
|
45232
|
-
paginationOpts: { numItems: ROW_PAGE_SIZE, cursor:
|
|
45872
|
+
paginationOpts: { numItems: ROW_PAGE_SIZE, cursor: cursor2 }
|
|
45233
45873
|
})));
|
|
45234
45874
|
rows.push(...res.page);
|
|
45235
45875
|
if (res.isDone) return rows;
|
|
45236
|
-
|
|
45876
|
+
cursor2 = res.continueCursor;
|
|
45237
45877
|
}
|
|
45238
45878
|
}
|
|
45239
45879
|
async function fetchRowsForKeys(caller, entityId2, inputs, key) {
|
|
@@ -45396,7 +46036,7 @@ var ListColumnRemove = class extends ProfileCommand {
|
|
|
45396
46036
|
};
|
|
45397
46037
|
|
|
45398
46038
|
// ente/commands/listRows.ts
|
|
45399
|
-
import { readFileSync as
|
|
46039
|
+
import { readFileSync as readFileSync11 } from "node:fs";
|
|
45400
46040
|
var ListAdd = class extends ProfileCommand {
|
|
45401
46041
|
static paths = [["list", "add"]];
|
|
45402
46042
|
static usage = Command.Usage({
|
|
@@ -45409,11 +46049,11 @@ var ListAdd = class extends ProfileCommand {
|
|
|
45409
46049
|
],
|
|
45410
46050
|
[
|
|
45411
46051
|
"Add a recipe row whose body is the recipe",
|
|
45412
|
-
'ente list add Rezepte --space "
|
|
46052
|
+
'ente list add Rezepte --space "Personal" --title "Tofu-Wraps" --attr vegan=true --content-file tofu-wraps.md'
|
|
45413
46053
|
],
|
|
45414
46054
|
[
|
|
45415
46055
|
"Upsert by a stable key column",
|
|
45416
|
-
'ente list add Firmen --space "
|
|
46056
|
+
'ente list add Firmen --space "Team" --key repo --title "Acme" --attr repo=firmen.csv#42 --attr stage=Kandidat'
|
|
45417
46057
|
]
|
|
45418
46058
|
]
|
|
45419
46059
|
});
|
|
@@ -45517,8 +46157,8 @@ var ListImport = class extends ProfileCommand {
|
|
|
45517
46157
|
Rows of the list that are not in the file are left alone.
|
|
45518
46158
|
`,
|
|
45519
46159
|
examples: [
|
|
45520
|
-
["Preview a sync", 'ente list import Firmen --space "
|
|
45521
|
-
["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']
|
|
45522
46162
|
]
|
|
45523
46163
|
});
|
|
45524
46164
|
list = options_exports.String();
|
|
@@ -45531,7 +46171,7 @@ var ListImport = class extends ProfileCommand {
|
|
|
45531
46171
|
const concurrency = Number(this.concurrency);
|
|
45532
46172
|
if (!Number.isInteger(concurrency) || concurrency < 1 || concurrency > 16)
|
|
45533
46173
|
throw new Error(`--concurrency must be an integer from 1 to 16 (got '${this.concurrency}').`);
|
|
45534
|
-
const lines = parseImportLines(
|
|
46174
|
+
const lines = parseImportLines(readFileSync11(this.file, "utf8"));
|
|
45535
46175
|
if (this.space !== void 0 && !this.space.trim()) throw new Error("--space must name a space.");
|
|
45536
46176
|
const caller = await resolveCaller();
|
|
45537
46177
|
const { entityId: entityId2, entity: entity5, view } = await loadList(caller, this.list);
|
|
@@ -45552,7 +46192,8 @@ var ListImport = class extends ProfileCommand {
|
|
|
45552
46192
|
const steps = planUpsert(existing, inputs, this.key);
|
|
45553
46193
|
const needsSpace = steps.some((s) => s.action === "create");
|
|
45554
46194
|
const ownerSpaceId = needsSpace ? await resolveOwnerSpace(caller, this.space) : "";
|
|
45555
|
-
const results =
|
|
46195
|
+
const results = [];
|
|
46196
|
+
results.length = steps.length;
|
|
45556
46197
|
let failure2 = null;
|
|
45557
46198
|
const rowFailures = [];
|
|
45558
46199
|
if (this.dryRun) {
|
|
@@ -45622,11 +46263,11 @@ var ListCreate = class extends ProfileCommand {
|
|
|
45622
46263
|
],
|
|
45623
46264
|
[
|
|
45624
46265
|
"A recipe collection with labelled columns and an icon",
|
|
45625
|
-
'ente list create Rezepte --space "
|
|
46266
|
+
'ente list create Rezepte --space "Personal" --icon book-open --column "protein_g=Protein (g):number" --column "vegan:boolean"'
|
|
45626
46267
|
],
|
|
45627
46268
|
[
|
|
45628
46269
|
"A sync target pinned under a project",
|
|
45629
|
-
'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"'
|
|
45630
46271
|
]
|
|
45631
46272
|
]
|
|
45632
46273
|
});
|
|
@@ -45725,19 +46366,19 @@ var ListShow = class extends ProfileCommand {
|
|
|
45725
46366
|
const { entityId: entityId2, entity: entity5, view } = await loadList(caller, this.list);
|
|
45726
46367
|
const clauses = parseWhere(view.columns, this.where ?? [], entity5.name);
|
|
45727
46368
|
const rows = [];
|
|
45728
|
-
let
|
|
46369
|
+
let cursor2 = this.cursor ?? null;
|
|
45729
46370
|
let nextCursor = null;
|
|
45730
46371
|
for (; ; ) {
|
|
45731
46372
|
const res = databaseListPage(await caller.query(listRows, parseDatabaseProtocolInput("database rows", databaseRowsArgs, {
|
|
45732
46373
|
entityId: entityId2,
|
|
45733
46374
|
...this.view ? {} : { ignoreViewFilters: true },
|
|
45734
46375
|
where: clauses,
|
|
45735
|
-
paginationOpts: { numItems, cursor:
|
|
46376
|
+
paginationOpts: { numItems, cursor: cursor2 }
|
|
45736
46377
|
})));
|
|
45737
46378
|
rows.push(...res.page);
|
|
45738
46379
|
nextCursor = res.isDone ? null : res.continueCursor;
|
|
45739
46380
|
if (!this.all || nextCursor === null) break;
|
|
45740
|
-
|
|
46381
|
+
cursor2 = nextCursor;
|
|
45741
46382
|
}
|
|
45742
46383
|
const kept = rows;
|
|
45743
46384
|
this.emitText(
|
|
@@ -45903,15 +46544,15 @@ var resetPassword = makeFunctionReference("admin/users:resetPassword");
|
|
|
45903
46544
|
var changeUserPlan = makeFunctionReference("admin/users:changeUserPlan");
|
|
45904
46545
|
async function listAllUsers(caller, email3) {
|
|
45905
46546
|
const users = [];
|
|
45906
|
-
let
|
|
46547
|
+
let cursor2 = null;
|
|
45907
46548
|
do {
|
|
45908
46549
|
const result = await caller.query(listUsers, parseHumanInput("admin/users:listUsers", adminUserContracts.listUsers.args, {
|
|
45909
|
-
paginationOpts: { numItems: 100, cursor:
|
|
46550
|
+
paginationOpts: { numItems: 100, cursor: cursor2 },
|
|
45910
46551
|
...email3 ? { email: email3 } : {}
|
|
45911
46552
|
})).then((raw) => parseOperationResult("admin/users:listUsers", adminUserContracts.listUsers.result, raw));
|
|
45912
46553
|
users.push(...result.page);
|
|
45913
|
-
|
|
45914
|
-
} while (
|
|
46554
|
+
cursor2 = result.isDone ? null : result.continueCursor;
|
|
46555
|
+
} while (cursor2 !== null);
|
|
45915
46556
|
return users;
|
|
45916
46557
|
}
|
|
45917
46558
|
async function resolveUserByEmail(caller, email3) {
|
|
@@ -46512,37 +47153,53 @@ var fields3 = {
|
|
|
46512
47153
|
since: external_exports.number().nonnegative().optional().meta({ description: "Optional epoch millisecond lower bound for activity evidence." }),
|
|
46513
47154
|
until: external_exports.number().nonnegative().optional().meta({ description: "Optional epoch millisecond upper bound for activity evidence." })
|
|
46514
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
|
+
};
|
|
46515
47168
|
var retrievalInputs = {
|
|
46516
|
-
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." }) }),
|
|
46517
47170
|
ask: external_exports.strictObject(fields3)
|
|
46518
47171
|
};
|
|
46519
47172
|
var legacyFields = { ...fields3, since: external_exports.number().optional(), until: external_exports.number().optional() };
|
|
46520
47173
|
var lexicalLimit = external_exports.custom((value) => typeof value === "number").optional();
|
|
46521
47174
|
var profileInputs = {
|
|
46522
47175
|
"legacy-lexical": external_exports.strictObject({ ...legacyFields, limit: lexicalLimit, mode: external_exports.literal("lexical").optional() }),
|
|
46523
|
-
"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() }),
|
|
46524
47177
|
"legacy-ask": external_exports.strictObject(fields3),
|
|
46525
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() })
|
|
46526
47179
|
};
|
|
46527
47180
|
function retrievalInputSchema(operation, profile) {
|
|
46528
47181
|
if (profile === "tool") return retrievalInputs[operation];
|
|
46529
|
-
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 });
|
|
46530
47183
|
return profileInputs[profile];
|
|
46531
47184
|
}
|
|
46532
|
-
function
|
|
47185
|
+
function invalid4(operation, field) {
|
|
46533
47186
|
throw new OperationInputError(operation, [{ path: [field], reason: "custom" }]);
|
|
46534
47187
|
}
|
|
46535
47188
|
function parseRetrievalInput(operation, raw, profile = "tool") {
|
|
46536
|
-
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");
|
|
46537
47190
|
const input2 = parseOperationInput(operation, retrievalInputSchema(operation, profile), raw);
|
|
46538
|
-
if (input2.since !== void 0 && input2.until !== void 0 && input2.since > input2.until)
|
|
46539
|
-
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");
|
|
46540
47197
|
let question = input2.question.trim();
|
|
46541
47198
|
const mode = input2.mode;
|
|
46542
|
-
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");
|
|
46543
47200
|
if (operation === "query") {
|
|
46544
47201
|
if (profile === "legacy-lexical" || profile !== "legacy-raw-action" && (!mode || mode === "lexical")) question = question.slice(0, RETRIEVAL_QUESTION_LIMIT);
|
|
46545
|
-
else if (question.length > RETRIEVAL_QUESTION_LIMIT)
|
|
47202
|
+
else if (question.length > RETRIEVAL_QUESTION_LIMIT) invalid4(operation, "question");
|
|
46546
47203
|
}
|
|
46547
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)));
|
|
46548
47205
|
return { ...input2, question, limit: limit3 };
|
|
@@ -46563,6 +47220,7 @@ var askSpaceSummaryValidator = v2.object({
|
|
|
46563
47220
|
color: v2.optional(v2.string())
|
|
46564
47221
|
});
|
|
46565
47222
|
var askPassageValidator = v2.object({
|
|
47223
|
+
passageId: v2.optional(v2.id("askPassages")),
|
|
46566
47224
|
sourceHash: v2.string(),
|
|
46567
47225
|
chunker: v2.string(),
|
|
46568
47226
|
embeddingIdentity: v2.optional(v2.string()),
|
|
@@ -46570,6 +47228,37 @@ var askPassageValidator = v2.object({
|
|
|
46570
47228
|
start: v2.number(),
|
|
46571
47229
|
end: v2.number()
|
|
46572
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
|
+
});
|
|
46573
47262
|
var askEvidenceValidator = v2.object({
|
|
46574
47263
|
id: v2.string(),
|
|
46575
47264
|
kind: askEvidenceKindValidator,
|
|
@@ -46595,6 +47284,11 @@ var askEvidenceValidator = v2.object({
|
|
|
46595
47284
|
sourceHash: v2.optional(v2.string()),
|
|
46596
47285
|
sourceFingerprint: v2.optional(v2.string()),
|
|
46597
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"))),
|
|
46598
47292
|
score: v2.number(),
|
|
46599
47293
|
relatedEntityNames: v2.array(v2.string()),
|
|
46600
47294
|
relatedEntityIds: v2.optional(v2.array(v2.id("entities"))),
|
|
@@ -46628,6 +47322,7 @@ var askCitationValidator = v2.object({
|
|
|
46628
47322
|
sourceHash: v2.optional(v2.string()),
|
|
46629
47323
|
sourceFingerprint: v2.optional(v2.string()),
|
|
46630
47324
|
passage: v2.optional(askPassageValidator),
|
|
47325
|
+
passages: v2.optional(v2.array(matchedPassageValidator)),
|
|
46631
47326
|
title: v2.string(),
|
|
46632
47327
|
kind: askEvidenceKindValidator,
|
|
46633
47328
|
entityId: v2.optional(v2.id("entities")),
|
|
@@ -46655,7 +47350,28 @@ var retrievalMetadataValidator = v2.object({
|
|
|
46655
47350
|
usedMode: v2.union(queryModeValidator, v2.literal("unavailable")),
|
|
46656
47351
|
status: v2.union(v2.literal("ready"), v2.literal("fallback"), v2.literal("unavailable")),
|
|
46657
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")) }),
|
|
46658
|
-
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
|
+
}),
|
|
46659
47375
|
truncation: v2.object({ context: v2.boolean(), results: v2.boolean(), activitySources: v2.boolean(), vectorCandidates: v2.boolean() }),
|
|
46660
47376
|
counts: v2.object({ structuredCandidates: v2.number(), structuredReturned: v2.number(), activityCandidates: v2.number(), activityReturned: v2.number() }),
|
|
46661
47377
|
fallbackReason: v2.optional(v2.string()),
|
|
@@ -46663,7 +47379,28 @@ var retrievalMetadataValidator = v2.object({
|
|
|
46663
47379
|
});
|
|
46664
47380
|
var rawQueryResultValidator = v2.object({ ...askEvidenceResultValidator.fields, retrieval: retrievalMetadataValidator });
|
|
46665
47381
|
function parseQueryResult(raw) {
|
|
46666
|
-
|
|
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;
|
|
46667
47404
|
}
|
|
46668
47405
|
function parseAskResult(raw) {
|
|
46669
47406
|
return parseOperationResult("ask", askAnswerResultValidator, raw);
|
|
@@ -46734,12 +47471,10 @@ var ASK_COMMANDS = [AskCmd];
|
|
|
46734
47471
|
|
|
46735
47472
|
// ente/commands/query.ts
|
|
46736
47473
|
init_server();
|
|
46737
|
-
var askQuery = makeFunctionReference("ask:query");
|
|
46738
47474
|
var rawQuery = makeFunctionReference("retrieval/raw:run");
|
|
46739
47475
|
async function retrieveEvidenceC(caller, body, mode) {
|
|
46740
47476
|
const input2 = parseRetrievalInput("query", { ...body, ...mode === void 0 ? {} : { mode } }, "cli");
|
|
46741
|
-
const
|
|
46742
|
-
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 });
|
|
46743
47478
|
return parseQueryResult(raw);
|
|
46744
47479
|
}
|
|
46745
47480
|
function formatEvidence(item, verbose) {
|
|
@@ -46749,9 +47484,12 @@ function formatEvidence(item, verbose) {
|
|
|
46749
47484
|
const related = item.relatedEntityNames ?? [];
|
|
46750
47485
|
if (spaces.length) details.push(`spaces: ${spaces.join(", ")}`);
|
|
46751
47486
|
if (related.length) details.push(`related: ${related.join(", ")}`);
|
|
47487
|
+
if (item.provenance) details.push(`origin: ${item.provenance}`);
|
|
46752
47488
|
if (item.deadline !== void 0) details.push(`deadline: ${item.deadline}`);
|
|
46753
47489
|
if (details.length) lines.push(` ${dim(details.join(" \xB7 "))}`);
|
|
46754
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}`);
|
|
46755
47493
|
return lines;
|
|
46756
47494
|
}
|
|
46757
47495
|
function formatQueryResult(data, verbose) {
|
|
@@ -46761,6 +47499,9 @@ function formatQueryResult(data, verbose) {
|
|
|
46761
47499
|
const retrieval = data.retrieval;
|
|
46762
47500
|
lines.push(`Retrieval: ${retrieval.requestedMode} \u2192 ${retrieval.usedMode}; vectors ${retrieval.vector.searchExecuted ? retrieval.vector.provider : "not executed"}${retrieval.fallbackReason ? ` (${retrieval.fallbackReason})` : ""}`);
|
|
46763
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");
|
|
46764
47505
|
if (!evidence.length) lines.push("No evidence found.");
|
|
46765
47506
|
for (const item of evidence) lines.push(...formatEvidence(item, verbose));
|
|
46766
47507
|
const warnings = data.warnings ?? [];
|
|
@@ -46773,15 +47514,20 @@ var QueryCmd = class extends ProfileCommand {
|
|
|
46773
47514
|
static paths = [["query"]];
|
|
46774
47515
|
static usage = Command.Usage({
|
|
46775
47516
|
category: "Retrieval",
|
|
46776
|
-
description: "Retrieve
|
|
47517
|
+
description: "Retrieve evidence; the server selects hybrid when ready or lexical with a reason"
|
|
46777
47518
|
});
|
|
46778
47519
|
question = options_exports.String();
|
|
46779
|
-
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" });
|
|
46780
47521
|
space = options_exports.String("--space", { description: "Restrict evidence to a space (name or ID)" });
|
|
46781
47522
|
entity = options_exports.String("--entity", { description: "Use an entity (name or ID) as the main graph anchor" });
|
|
46782
47523
|
limit = options_exports.String("--limit", { description: "Maximum evidence items to return" });
|
|
46783
47524
|
since = options_exports.String("--since", { description: "Only include activity evidence after this epoch ms" });
|
|
46784
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" });
|
|
46785
47531
|
verbose = options_exports.Boolean("--verbose,-v", false, { description: "Print full evidence snippets" });
|
|
46786
47532
|
async run() {
|
|
46787
47533
|
const input2 = parseRetrievalInput("query", {
|
|
@@ -46789,11 +47535,18 @@ var QueryCmd = class extends ProfileCommand {
|
|
|
46789
47535
|
...this.mode === void 0 ? {} : { mode: this.mode },
|
|
46790
47536
|
...this.limit === void 0 ? {} : { limit: Number(this.limit.trim() || NaN) },
|
|
46791
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 } : {},
|
|
46792
47545
|
...this.until === void 0 ? {} : { until: Number(this.until.trim() || NaN) }
|
|
46793
47546
|
}, "cli");
|
|
46794
47547
|
const caller = await resolveCaller();
|
|
46795
47548
|
const body = await buildEvidenceBodyC(caller, { ...this, question: input2.question });
|
|
46796
|
-
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);
|
|
46797
47550
|
this.emitText({ data: res }, () => formatQueryResult(res, this.verbose));
|
|
46798
47551
|
if (res.retrieval.status === "unavailable") return 1;
|
|
46799
47552
|
}
|
|
@@ -46802,7 +47555,7 @@ var QUERY_COMMANDS = [QueryCmd];
|
|
|
46802
47555
|
|
|
46803
47556
|
// ente/commands/recordingPipeline.ts
|
|
46804
47557
|
import { spawnSync } from "node:child_process";
|
|
46805
|
-
import { mkdtempSync, readFileSync as
|
|
47558
|
+
import { mkdtempSync, readFileSync as readFileSync12, writeFileSync as writeFileSync6 } from "node:fs";
|
|
46806
47559
|
import { tmpdir } from "node:os";
|
|
46807
47560
|
import path5 from "node:path";
|
|
46808
47561
|
init_server();
|
|
@@ -46823,7 +47576,7 @@ async function resolveValue(cmd, label, current) {
|
|
|
46823
47576
|
if (cmd.edit) return editInEditor(current, label);
|
|
46824
47577
|
if (cmd.file !== void 0) {
|
|
46825
47578
|
if (cmd.file === "-") return await readStdin();
|
|
46826
|
-
return
|
|
47579
|
+
return readFileSync12(cmd.file, "utf8");
|
|
46827
47580
|
}
|
|
46828
47581
|
if (cmd.value !== void 0) return cmd.value;
|
|
46829
47582
|
throw new Error(`No ${label} given. Pass a value, --file <path> (or --file -), or --edit.`);
|
|
@@ -46837,7 +47590,7 @@ function editInEditor(initial, label) {
|
|
|
46837
47590
|
if (res.status !== 0) {
|
|
46838
47591
|
throw new Error(`Editor '${editor}' exited with a non-zero status; ${label} unchanged.`);
|
|
46839
47592
|
}
|
|
46840
|
-
return
|
|
47593
|
+
return readFileSync12(file2, "utf8");
|
|
46841
47594
|
}
|
|
46842
47595
|
function readStdin() {
|
|
46843
47596
|
return new Promise((resolve2, reject) => {
|
|
@@ -47568,7 +48321,7 @@ var agentConfigBrowserInputs = {
|
|
|
47568
48321
|
};
|
|
47569
48322
|
|
|
47570
48323
|
// ente/commands/agent.ts
|
|
47571
|
-
import { readFileSync as
|
|
48324
|
+
import { readFileSync as readFileSync13 } from "node:fs";
|
|
47572
48325
|
import { randomUUID } from "node:crypto";
|
|
47573
48326
|
|
|
47574
48327
|
// ente/agentCaller.ts
|
|
@@ -47706,8 +48459,8 @@ async function boundAgentClient(client, context) {
|
|
|
47706
48459
|
}));
|
|
47707
48460
|
return { data: page3.page, ...!page3.isDone ? { continueCursor: page3.continueCursor } : {} };
|
|
47708
48461
|
},
|
|
47709
|
-
getAgentThread: async (threadId,
|
|
47710
|
-
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 });
|
|
47711
48464
|
if (request.operation !== "agent_thread_get") throw new Error("Invalid agent context operation");
|
|
47712
48465
|
const page3 = encodeAgentContextResult("agent_thread_get", await (await caller()).query(thread, {
|
|
47713
48466
|
threadId: request.input.threadId,
|
|
@@ -47754,14 +48507,14 @@ function fmtTime(ms) {
|
|
|
47754
48507
|
return new Date(ms).toISOString().replace("T", " ").slice(0, 16);
|
|
47755
48508
|
}
|
|
47756
48509
|
function summarizeValue(value, maxLen = 200) {
|
|
47757
|
-
let
|
|
48510
|
+
let text4;
|
|
47758
48511
|
try {
|
|
47759
|
-
|
|
48512
|
+
text4 = typeof value === "string" ? value : JSON.stringify(value);
|
|
47760
48513
|
} catch {
|
|
47761
|
-
|
|
48514
|
+
text4 = String(value);
|
|
47762
48515
|
}
|
|
47763
|
-
if (
|
|
47764
|
-
return
|
|
48516
|
+
if (text4 === void 0) text4 = "";
|
|
48517
|
+
return text4.length > maxLen ? `${text4.slice(0, maxLen - 1)}\u2026` : text4;
|
|
47765
48518
|
}
|
|
47766
48519
|
function isErrorResult(result) {
|
|
47767
48520
|
if (result.isError) return true;
|
|
@@ -47783,15 +48536,15 @@ function normalizeOperatorMessage(message4) {
|
|
|
47783
48536
|
};
|
|
47784
48537
|
}
|
|
47785
48538
|
async function fetchOperatorThread(client, threadId, agentId = "") {
|
|
47786
|
-
let
|
|
48539
|
+
let cursor2;
|
|
47787
48540
|
let thread2;
|
|
47788
48541
|
const messages = [];
|
|
47789
48542
|
do {
|
|
47790
|
-
const response = await client.getAgentThread(threadId,
|
|
48543
|
+
const response = await client.getAgentThread(threadId, cursor2, 50);
|
|
47791
48544
|
thread2 = normalizeOperatorThread(response.data.thread, agentId);
|
|
47792
48545
|
messages.push(...response.data.messages.map(normalizeOperatorMessage));
|
|
47793
|
-
|
|
47794
|
-
} while (
|
|
48546
|
+
cursor2 = response.data.continueCursor;
|
|
48547
|
+
} while (cursor2);
|
|
47795
48548
|
return thread2 ? { thread: thread2, messages } : null;
|
|
47796
48549
|
}
|
|
47797
48550
|
function renderAgentConfiguration(agent3) {
|
|
@@ -47854,17 +48607,17 @@ var AgentThreads = class extends ClientCommand {
|
|
|
47854
48607
|
}
|
|
47855
48608
|
const cap = requestedLimit ?? 200;
|
|
47856
48609
|
const operatorThreads = [];
|
|
47857
|
-
let
|
|
48610
|
+
let cursor2;
|
|
47858
48611
|
do {
|
|
47859
48612
|
const response = await client.listAgentThreads({
|
|
47860
48613
|
includeArchived: this.includeArchived ? "true" : void 0,
|
|
47861
48614
|
limit: String(Math.min(cap - operatorThreads.length, 50)),
|
|
47862
|
-
cursor:
|
|
48615
|
+
cursor: cursor2,
|
|
47863
48616
|
attention: this.attention
|
|
47864
48617
|
});
|
|
47865
48618
|
operatorThreads.push(...response.data);
|
|
47866
|
-
|
|
47867
|
-
} while (
|
|
48619
|
+
cursor2 = response.continueCursor;
|
|
48620
|
+
} while (cursor2 && operatorThreads.length < cap);
|
|
47868
48621
|
threads2 = operatorThreads.map((thread2) => normalizeOperatorThread(thread2, context.data.agentId));
|
|
47869
48622
|
if (status2) threads2 = threads2.filter((thread2) => thread2.status === status2);
|
|
47870
48623
|
} else {
|
|
@@ -48014,7 +48767,7 @@ var AgentSend = class extends ClientCommand {
|
|
|
48014
48767
|
threadId: this.threadId,
|
|
48015
48768
|
claimId,
|
|
48016
48769
|
text: this.message,
|
|
48017
|
-
...this.htmlFile ? { html:
|
|
48770
|
+
...this.htmlFile ? { html: readFileSync13(this.htmlFile, "utf8") } : {},
|
|
48018
48771
|
...this.request === "none" ? {} : { requestKind: this.request },
|
|
48019
48772
|
...this.requestPrompt ? { requestPrompt: this.requestPrompt } : {},
|
|
48020
48773
|
idempotencyKey: this.idempotencyKey ?? randomUUID()
|
|
@@ -48053,7 +48806,7 @@ var AgentNew = class extends ClientCommand {
|
|
|
48053
48806
|
const response = await client.createAgentThread({
|
|
48054
48807
|
title: this.title,
|
|
48055
48808
|
text: this.message,
|
|
48056
|
-
...this.htmlFile ? { html:
|
|
48809
|
+
...this.htmlFile ? { html: readFileSync13(this.htmlFile, "utf8") } : {},
|
|
48057
48810
|
...this.request === "none" ? {} : { requestKind: this.request },
|
|
48058
48811
|
...this.requestPrompt ? { requestPrompt: this.requestPrompt } : {},
|
|
48059
48812
|
idempotencyKey: this.idempotencyKey ?? randomUUID()
|
|
@@ -48072,7 +48825,7 @@ var AgentSetIcon = class extends ClientCommand {
|
|
|
48072
48825
|
reset = options_exports.Boolean("--reset", false);
|
|
48073
48826
|
async run() {
|
|
48074
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.");
|
|
48075
|
-
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 });
|
|
48076
48829
|
const result = await this.client().setAgentIcon(icon2);
|
|
48077
48830
|
this.emitText(result, () => `Agent ${result.data.agentId}: ${result.data.icon?.startsWith("data:") ? "PNG icon" : result.data.icon ?? "default icon"}`);
|
|
48078
48831
|
}
|
|
@@ -48101,7 +48854,7 @@ var AgentConfigSetPrompt = class extends ClientCommand {
|
|
|
48101
48854
|
if (!!this.prompt === !!this.file) {
|
|
48102
48855
|
throw new Error("Provide exactly one of --text or --file.");
|
|
48103
48856
|
}
|
|
48104
|
-
const prompt = this.file ?
|
|
48857
|
+
const prompt = this.file ? readFileSync13(this.file, "utf8") : this.prompt;
|
|
48105
48858
|
const client = await boundAgentClient(this.client(), await this.client().getAuthContext());
|
|
48106
48859
|
const { data } = await client.updateAgentPrompt(prompt);
|
|
48107
48860
|
this.emitText({ data }, () => `Updated Ente prompt configuration for ${data.name}.`);
|
|
@@ -48115,7 +48868,7 @@ var AgentSchedulesConfigure = class extends ClientCommand {
|
|
|
48115
48868
|
});
|
|
48116
48869
|
file = options_exports.String("--file", { required: true, description: "JSON file containing an array of schedules" });
|
|
48117
48870
|
async run() {
|
|
48118
|
-
const parsed = JSON.parse(
|
|
48871
|
+
const parsed = JSON.parse(readFileSync13(this.file, "utf8"));
|
|
48119
48872
|
const request = parseAgentConfigInput("agent_schedules_configure", { schedules: parsed });
|
|
48120
48873
|
if (request.operation !== "agent_schedules_configure") throw new Error("Invalid agent configuration operation");
|
|
48121
48874
|
const client = await boundAgentClient(this.client(), await this.client().getAuthContext());
|
|
@@ -48139,7 +48892,7 @@ var AGENT_COMMANDS = [
|
|
|
48139
48892
|
];
|
|
48140
48893
|
|
|
48141
48894
|
// ente/commands/agenda.ts
|
|
48142
|
-
import { readFileSync as
|
|
48895
|
+
import { readFileSync as readFileSync14 } from "node:fs";
|
|
48143
48896
|
var AgendaPointCreate = class extends ClientCommand {
|
|
48144
48897
|
static paths = [["agenda", "create-point"]];
|
|
48145
48898
|
static usage = Command.Usage({
|
|
@@ -48169,7 +48922,7 @@ var AgendaPointCreate = class extends ClientCommand {
|
|
|
48169
48922
|
async run() {
|
|
48170
48923
|
if (this.content !== void 0 && this.contentFile !== void 0)
|
|
48171
48924
|
throw new Error("Use either --content or --content-file, not both.");
|
|
48172
|
-
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;
|
|
48173
48926
|
const result = await this.client().createAgendaPoint({
|
|
48174
48927
|
meetingActivityId: this.activity,
|
|
48175
48928
|
title: this.title,
|
|
@@ -48339,19 +49092,19 @@ function offsetMs(utcMs, timeZone) {
|
|
|
48339
49092
|
const hour = get2("hour") === 24 ? 0 : get2("hour");
|
|
48340
49093
|
return Date.UTC(get2("year"), get2("month") - 1, get2("day"), hour, get2("minute"), get2("second")) - utcMs;
|
|
48341
49094
|
}
|
|
48342
|
-
function zonedWallTimeToMs({ year, month, day, hour, minute, second = 0 }, timeZone) {
|
|
48343
|
-
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);
|
|
48344
49097
|
const first = offsetMs(naive, timeZone);
|
|
48345
49098
|
let ms = naive - first;
|
|
48346
49099
|
const second2 = offsetMs(ms, timeZone);
|
|
48347
49100
|
if (second2 !== first) ms = naive - second2;
|
|
48348
49101
|
if (ms + offsetMs(ms, timeZone) !== naive)
|
|
48349
|
-
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.`);
|
|
48350
49103
|
return ms;
|
|
48351
49104
|
}
|
|
48352
|
-
function checkedDate(year, month,
|
|
48353
|
-
const date5 = new Date(Date.UTC(year, month - 1,
|
|
48354
|
-
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)
|
|
48355
49108
|
throw new Error(`Invalid date "${raw}".`);
|
|
48356
49109
|
}
|
|
48357
49110
|
function parseInstant(raw, timeZone, flag) {
|
|
@@ -48362,10 +49115,10 @@ function parseInstant(raw, timeZone, flag) {
|
|
|
48362
49115
|
}
|
|
48363
49116
|
const match = WALL_RE.exec(value);
|
|
48364
49117
|
if (match) {
|
|
48365
|
-
const [year, month,
|
|
48366
|
-
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);
|
|
48367
49120
|
if (hour > 23 || minute > 59 || second > 59) throw new Error(`Invalid time in ${flag} "${raw}".`);
|
|
48368
|
-
return zonedWallTimeToMs({ year, month, day, hour, minute, second }, timeZone);
|
|
49121
|
+
return zonedWallTimeToMs({ year, month, day: day2, hour, minute, second }, timeZone);
|
|
48369
49122
|
}
|
|
48370
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.`);
|
|
48371
49124
|
throw new Error(`Invalid ${flag} "${raw}". Use YYYY-MM-DD HH:MM (in --tz), or ISO 8601 with Z/offset.`);
|
|
@@ -48376,12 +49129,12 @@ function parseDay(raw, flag) {
|
|
|
48376
49129
|
checkedDate(Number(match[1]), Number(match[2]), Number(match[3]), raw);
|
|
48377
49130
|
return raw.trim();
|
|
48378
49131
|
}
|
|
48379
|
-
function addDays(
|
|
48380
|
-
const [year, month, date5] =
|
|
49132
|
+
function addDays(day2, days) {
|
|
49133
|
+
const [year, month, date5] = day2.split("-").map(Number);
|
|
48381
49134
|
return new Date(Date.UTC(year, month - 1, date5 + days)).toISOString().slice(0, 10);
|
|
48382
49135
|
}
|
|
48383
|
-
function dayToUtcMs(
|
|
48384
|
-
const [year, month, date5] =
|
|
49136
|
+
function dayToUtcMs(day2) {
|
|
49137
|
+
const [year, month, date5] = day2.split("-").map(Number);
|
|
48385
49138
|
return Date.UTC(year, month - 1, date5);
|
|
48386
49139
|
}
|
|
48387
49140
|
function todayIn(timeZone) {
|
|
@@ -49034,19 +49787,19 @@ var CLI_CONTEXT = {
|
|
|
49034
49787
|
};
|
|
49035
49788
|
var PAGE_SIZE = 50;
|
|
49036
49789
|
var MAX_PAGES2 = 50;
|
|
49037
|
-
async function collectColumn(caller, status2,
|
|
49790
|
+
async function collectColumn(caller, status2, text4, limit3, scope) {
|
|
49038
49791
|
const items2 = [];
|
|
49039
|
-
let
|
|
49792
|
+
let cursor2 = null;
|
|
49040
49793
|
for (let page3 = 0; page3 < MAX_PAGES2; page3 += 1) {
|
|
49041
49794
|
const res = await caller.query(listColumn, parseHumanInput("feedback:listColumn", feedbackContracts.listColumn.args, {
|
|
49042
49795
|
status: status2,
|
|
49043
|
-
paginationOpts: { numItems: Math.min(PAGE_SIZE, limit3 - items2.length), cursor:
|
|
49044
|
-
...
|
|
49796
|
+
paginationOpts: { numItems: Math.min(PAGE_SIZE, limit3 - items2.length), cursor: cursor2 },
|
|
49797
|
+
...text4 ? { text: text4 } : {},
|
|
49045
49798
|
scope
|
|
49046
49799
|
})).then((raw) => parseOperationResult("feedback:listColumn", feedbackContracts.listColumn.result, raw));
|
|
49047
49800
|
items2.push(...res.page);
|
|
49048
49801
|
if (res.isDone || items2.length >= limit3) break;
|
|
49049
|
-
|
|
49802
|
+
cursor2 = res.continueCursor;
|
|
49050
49803
|
}
|
|
49051
49804
|
return items2.slice(0, limit3);
|
|
49052
49805
|
}
|
|
@@ -49258,7 +50011,7 @@ ancestors redundantly.
|
|
|
49258
50011
|
Commands:
|
|
49259
50012
|
ente search <query> Fuzzy search entities
|
|
49260
50013
|
ente ask <question> Experimental opt-in beta answer (not general AI chat)
|
|
49261
|
-
ente query <question>
|
|
50014
|
+
ente query <question> Evidence; server-negotiated hybrid or lexical, no answer synthesis
|
|
49262
50015
|
ente entity create|get|update|duplicate|rename|archive|restore|pin|unpin
|
|
49263
50016
|
ente entity list [--archived]
|
|
49264
50017
|
ente pins list <entity> List pins for an entity
|
|
@@ -49269,6 +50022,7 @@ Commands:
|
|
|
49269
50022
|
ente notification send Email your own Ente account (text, HTML, and images)
|
|
49270
50023
|
ente activity create|list|get|update|delete|restore
|
|
49271
50024
|
ente activity content read|edit
|
|
50025
|
+
ente activity content read --id <A> --id <B> --json
|
|
49272
50026
|
ente activity transcript <activityId> [--grep <text>] Transcript behind an activity \u2014 read it when a note or summary is unclear
|
|
49273
50027
|
ente agenda create-point|link-task
|
|
49274
50028
|
ente activity message add <activityId> --content "..."
|
|
@@ -49404,6 +50158,10 @@ Chronological updates:
|
|
|
49404
50158
|
ente activity message add <activity-id> --content "Requirements changed: export must include archived rows."
|
|
49405
50159
|
|
|
49406
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.
|
|
49407
50165
|
1. ente activity content read <activity-id> --json
|
|
49408
50166
|
2. Write a small JSON operation array using returned targets.
|
|
49409
50167
|
3. ente activity content edit <activity-id> --expected-version <contentVersion> --operations-file edits.json --json
|
|
@@ -49423,8 +50181,8 @@ Archiving (trash):
|
|
|
49423
50181
|
content: `Resolve entities globally first: ente search "Apollo" --json
|
|
49424
50182
|
Use an explicit space when the task specifies one:
|
|
49425
50183
|
ente query "launch decisions" --space "Work" --entity "Apollo" --since 1791763200000 --until 1792368000000 --limit 8 --json
|
|
49426
|
-
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.
|
|
49427
|
-
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.
|
|
49428
50186
|
|
|
49429
50187
|
Read one compact entity-history page:
|
|
49430
50188
|
ente activity list --entity <id> --after 1791763200000 --min-count 0 --limit 10 --compact --json
|
|
@@ -49650,7 +50408,7 @@ var canvasHtmlAliases = {
|
|
|
49650
50408
|
function isCanvasHtmlOperationName(name4) {
|
|
49651
50409
|
return Object.hasOwn(canvasHtmlInputs, name4);
|
|
49652
50410
|
}
|
|
49653
|
-
var
|
|
50411
|
+
var descriptions6 = {
|
|
49654
50412
|
listCanvasBoards: "List accessible persisted boards for an entity.",
|
|
49655
50413
|
listCanvasHtmlPanels: "List HTML panel summaries without source.",
|
|
49656
50414
|
getCanvasHtmlPanel: "Read HTML, version and source hash; null if missing or deleted.",
|
|
@@ -49658,13 +50416,13 @@ var descriptions5 = {
|
|
|
49658
50416
|
updateCanvasHtmlPanel: "Update canvas HTML panel title/source and optional geometry. Use fresh expectedVersion and expectedSourceHash; conflicts preserve content.",
|
|
49659
50417
|
deleteCanvasHtmlPanel: "Delete using fresh expectedVersion and expectedSourceHash."
|
|
49660
50418
|
};
|
|
49661
|
-
function
|
|
50419
|
+
function definition5(name4) {
|
|
49662
50420
|
const schema = external_exports.toJSONSchema(canvasHtmlInputs[name4], { io: "input" });
|
|
49663
50421
|
return {
|
|
49664
50422
|
name: name4,
|
|
49665
50423
|
aliases: operationAliases(canvasHtmlAliases, name4),
|
|
49666
50424
|
actor: "agent",
|
|
49667
|
-
description:
|
|
50425
|
+
description: descriptions6[name4],
|
|
49668
50426
|
inputSchema: { type: "object", properties: schema.properties ?? {}, required: schema.required ?? [], additionalProperties: false },
|
|
49669
50427
|
errorSchema: operationErrorSchema,
|
|
49670
50428
|
resultSchema: operationResultSchema(canvasHtmlResults[name4]),
|
|
@@ -49682,8 +50440,8 @@ function definition4(name4) {
|
|
|
49682
50440
|
limits: CANVAS_HTML_LIMITS
|
|
49683
50441
|
};
|
|
49684
50442
|
}
|
|
49685
|
-
var
|
|
49686
|
-
var canvasHtmlCatalog = [...
|
|
50443
|
+
var definitions5 = new Map(Object.keys(canvasHtmlInputs).filter(isCanvasHtmlOperationName).map((name4) => [name4, definition5(name4)]));
|
|
50444
|
+
var canvasHtmlCatalog = [...definitions5.values()];
|
|
49687
50445
|
|
|
49688
50446
|
// ente/canvasHtml.ts
|
|
49689
50447
|
var listBoardsRef = makeFunctionReference(
|
|
@@ -49862,7 +50620,7 @@ import path8 from "node:path";
|
|
|
49862
50620
|
|
|
49863
50621
|
// ente/entityFiles.ts
|
|
49864
50622
|
init_server();
|
|
49865
|
-
import { readFileSync as
|
|
50623
|
+
import { readFileSync as readFileSync15, statSync as statSync2 } from "node:fs";
|
|
49866
50624
|
import path7 from "node:path";
|
|
49867
50625
|
|
|
49868
50626
|
// ../packages/shared/src/entity-file-operation-results.ts
|
|
@@ -50158,7 +50916,7 @@ function isEntityFileOperationName(value) {
|
|
|
50158
50916
|
return Object.hasOwn(entityFileInputs, value);
|
|
50159
50917
|
}
|
|
50160
50918
|
var personalOnly = "Uses your own Nextcloud connection and is available only to your personal agent.";
|
|
50161
|
-
var
|
|
50919
|
+
var descriptions7 = {
|
|
50162
50920
|
createEntityFolder: `Create a new folder in your Nextcloud below parentPath and link it as the entity's file folder. ${personalOnly}`,
|
|
50163
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}`,
|
|
50164
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}`,
|
|
@@ -50171,13 +50929,13 @@ var READ_OPERATIONS = /* @__PURE__ */ new Set(["listEntityFiles", "searchEntityF
|
|
|
50171
50929
|
function isEntityFileReadOperation(operationName) {
|
|
50172
50930
|
return READ_OPERATIONS.has(operationName);
|
|
50173
50931
|
}
|
|
50174
|
-
function
|
|
50932
|
+
function definition6(operationName) {
|
|
50175
50933
|
const schema = external_exports.toJSONSchema(entityFileInputs[operationName], { io: "input" });
|
|
50176
50934
|
return {
|
|
50177
50935
|
name: operationName,
|
|
50178
50936
|
aliases: operationAliases(entityFileAliases, operationName),
|
|
50179
50937
|
actor: "agent",
|
|
50180
|
-
description:
|
|
50938
|
+
description: descriptions7[operationName],
|
|
50181
50939
|
inputSchema: { type: "object", properties: schema.properties ?? {}, required: schema.required ?? [], additionalProperties: false },
|
|
50182
50940
|
errorSchema: operationErrorSchema,
|
|
50183
50941
|
resultSchema: operationResultSchema(entityFileResults[operationName]),
|
|
@@ -50196,8 +50954,8 @@ function definition5(operationName) {
|
|
|
50196
50954
|
limits: ENTITY_FILE_LIMITS
|
|
50197
50955
|
};
|
|
50198
50956
|
}
|
|
50199
|
-
var
|
|
50200
|
-
var entityFileCatalog = [...
|
|
50957
|
+
var definitions6 = new Map(Object.keys(entityFileInputs).filter(isEntityFileOperationName).map((operationName) => [operationName, definition6(operationName)]));
|
|
50958
|
+
var entityFileCatalog = [...definitions6.values()];
|
|
50201
50959
|
|
|
50202
50960
|
// ente/entityFiles.ts
|
|
50203
50961
|
var createFolderRef = makeFunctionReference(
|
|
@@ -50276,7 +51034,7 @@ function readLocalFileAsBase64(filePath) {
|
|
|
50276
51034
|
if (size > ENTITY_FILE_LIMITS.base64DecodedBytes) {
|
|
50277
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.`);
|
|
50278
51036
|
}
|
|
50279
|
-
return
|
|
51037
|
+
return readFileSync15(filePath).toString("base64");
|
|
50280
51038
|
}
|
|
50281
51039
|
|
|
50282
51040
|
// ente/commands/files.ts
|
|
@@ -50364,7 +51122,7 @@ var FilesCiteCmd = class extends ProfileCommand {
|
|
|
50364
51122
|
const data = await citeEntityFile(await resolveCaller(), {
|
|
50365
51123
|
entityId: this.entityId,
|
|
50366
51124
|
path: this.filePath,
|
|
50367
|
-
quotes: [...this.quotes.map((
|
|
51125
|
+
quotes: [...this.quotes.map((text4) => candidate === void 0 ? { text: text4 } : { text: text4, candidate }), ...ranges]
|
|
50368
51126
|
});
|
|
50369
51127
|
this.emitText({ data }, () => data.status !== "ok" ? `Unavailable: ${data.status}` : data.citations.map((citation, index) => `${index + 1}. ${citationLine(citation)}`).join("\n"));
|
|
50370
51128
|
}
|
|
@@ -50433,7 +51191,7 @@ var FilesCreateFolderCmd = class extends ProfileCommand {
|
|
|
50433
51191
|
var FILES_COMMANDS = [FilesListCmd, FilesSearchCmd, FilesReadCmd, FilesCiteCmd, FilesUploadCmd, FilesLinkCmd, FilesCreateFolderCmd];
|
|
50434
51192
|
|
|
50435
51193
|
// ente/commands/notification.ts
|
|
50436
|
-
import { readFileSync as
|
|
51194
|
+
import { readFileSync as readFileSync16 } from "node:fs";
|
|
50437
51195
|
|
|
50438
51196
|
// ente/notificationEmailContract.ts
|
|
50439
51197
|
var NOTIFICATION_EMAIL_CLI_SURFACE = {
|
|
@@ -50467,7 +51225,7 @@ var CLI_LIMITS = NOTIFICATION_EMAIL_CLI_SURFACE.limits;
|
|
|
50467
51225
|
function readBody(inline, file2, label) {
|
|
50468
51226
|
if (inline !== void 0 && file2 !== void 0)
|
|
50469
51227
|
throw new Error(`notification send: use either --${label} or --${label}-file, not both.`);
|
|
50470
|
-
const value = file2 !== void 0 ?
|
|
51228
|
+
const value = file2 !== void 0 ? readFileSync16(file2, "utf8") : inline;
|
|
50471
51229
|
if (value !== void 0 && !value.trim())
|
|
50472
51230
|
throw new Error(`notification send: ${label} body must not be empty.`);
|
|
50473
51231
|
return value;
|
|
@@ -50549,8 +51307,8 @@ var NotificationSendCommand = class extends ClientCommand {
|
|
|
50549
51307
|
description: "Attach any bounded file (repeatable)"
|
|
50550
51308
|
});
|
|
50551
51309
|
async run() {
|
|
50552
|
-
const
|
|
50553
|
-
if (
|
|
51310
|
+
const text4 = readBody(this.text, this.textFile, "text");
|
|
51311
|
+
if (text4 === void 0)
|
|
50554
51312
|
throw new Error("notification send: --text or --text-file is required.");
|
|
50555
51313
|
const html2 = readBody(this.html, this.htmlFile, "html");
|
|
50556
51314
|
const attachments = readNotificationEmailAttachments(
|
|
@@ -50560,7 +51318,7 @@ var NotificationSendCommand = class extends ClientCommand {
|
|
|
50560
51318
|
);
|
|
50561
51319
|
const response = await this.client().sendNotificationEmail({
|
|
50562
51320
|
subject: this.subject,
|
|
50563
|
-
text:
|
|
51321
|
+
text: text4,
|
|
50564
51322
|
...html2 !== void 0 ? { html: html2 } : {},
|
|
50565
51323
|
...attachments ? { attachments } : {}
|
|
50566
51324
|
});
|
|
@@ -50572,6 +51330,85 @@ var NotificationSendCommand = class extends ClientCommand {
|
|
|
50572
51330
|
};
|
|
50573
51331
|
var NOTIFICATION_COMMANDS = [NotificationSendCommand];
|
|
50574
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
|
+
|
|
50575
51412
|
// ente/commands/agentTasks.ts
|
|
50576
51413
|
var AgentTasks = class extends ClientCommand {
|
|
50577
51414
|
static paths = [["agent", "tasks"]];
|
|
@@ -50663,10 +51500,20 @@ var mailboxInputs = {
|
|
|
50663
51500
|
sendDraft: external_exports.strictObject({ ...write2, draftId: id20, draftVersion: id20 }),
|
|
50664
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" })
|
|
50665
51502
|
};
|
|
50666
|
-
|
|
50667
|
-
const input2 = external_exports.toJSONSchema(
|
|
50668
|
-
return
|
|
50669
|
-
}
|
|
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
|
+
};
|
|
50670
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"] };
|
|
50671
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"] };
|
|
50672
51519
|
var mailboxOperationContracts = Object.keys(mailboxInputs).map((name4) => ({
|
|
@@ -50686,7 +51533,7 @@ var mailboxOperationContracts = Object.keys(mailboxInputs).map((name4) => ({
|
|
|
50686
51533
|
availability: { hosted: true, external: true, browserHuman: true, agentConnection: true, executionProfiles: ["full"], runtime: "action", MCP: true, REST: true, CLI: true }
|
|
50687
51534
|
}));
|
|
50688
51535
|
function mailboxOperationDefinition(operation) {
|
|
50689
|
-
return mailboxOperationContracts.find((
|
|
51536
|
+
return mailboxOperationContracts.find((definition7) => definition7.name === operation);
|
|
50690
51537
|
}
|
|
50691
51538
|
function parseMailboxOperation(operation, input2) {
|
|
50692
51539
|
return parseOperationInput(operation, mailboxInputs[operation], input2);
|
|
@@ -50890,7 +51737,7 @@ function parseUserMailboxRequest(input2) {
|
|
|
50890
51737
|
|
|
50891
51738
|
// ente/commands/agentMail.ts
|
|
50892
51739
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
50893
|
-
import { readFileSync as
|
|
51740
|
+
import { readFileSync as readFileSync18 } from "node:fs";
|
|
50894
51741
|
|
|
50895
51742
|
// ente/agentMailContract.ts
|
|
50896
51743
|
var AGENT_MAIL_CLI_SURFACE = {
|
|
@@ -50989,7 +51836,7 @@ function truncateUtf8(value, maxBytes) {
|
|
|
50989
51836
|
}
|
|
50990
51837
|
function safeAttachmentFilename(name4, attachmentId) {
|
|
50991
51838
|
const leaf = name4.split(/[\\/]/u).pop() ?? "";
|
|
50992
|
-
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, "");
|
|
50993
51840
|
if (WINDOWS_RESERVED.test(clean)) clean = `_${clean}`;
|
|
50994
51841
|
if (Buffer.byteLength(clean) > MAX_FILENAME_BYTES) {
|
|
50995
51842
|
const ext = extname2(clean);
|
|
@@ -51090,7 +51937,7 @@ function readBody2(inline, file2, label) {
|
|
|
51090
51937
|
if (inline !== void 0 && file2 !== void 0) {
|
|
51091
51938
|
throw new Error(`agent mail: use either --${label} or --${label}-file, not both.`);
|
|
51092
51939
|
}
|
|
51093
|
-
const value = file2 === void 0 ? inline :
|
|
51940
|
+
const value = file2 === void 0 ? inline : readFileSync18(file2, "utf8");
|
|
51094
51941
|
if (value !== void 0 && !value.trim()) {
|
|
51095
51942
|
throw new Error(`agent mail: ${label} body must not be empty.`);
|
|
51096
51943
|
}
|
|
@@ -51104,8 +51951,8 @@ function normalizeAgentMailIdempotencyKey(value) {
|
|
|
51104
51951
|
return key;
|
|
51105
51952
|
}
|
|
51106
51953
|
function readAgentMailBodies(options) {
|
|
51107
|
-
const
|
|
51108
|
-
if (
|
|
51954
|
+
const text4 = readBody2(options.text, options.textFile, "text");
|
|
51955
|
+
if (text4 === void 0) {
|
|
51109
51956
|
throw new Error("agent mail: --text or --text-file is required.");
|
|
51110
51957
|
}
|
|
51111
51958
|
const html2 = readBody2(options.html, options.htmlFile, "html");
|
|
@@ -51140,7 +51987,7 @@ function readAgentMailBodies(options) {
|
|
|
51140
51987
|
const referenceError = agentMailInlineReferenceError(html2, attachments);
|
|
51141
51988
|
if (referenceError) throw new Error(`agent mail: ${referenceError}`);
|
|
51142
51989
|
return {
|
|
51143
|
-
text:
|
|
51990
|
+
text: text4,
|
|
51144
51991
|
...html2 === void 0 ? {} : { html: html2 },
|
|
51145
51992
|
...attachments.length ? { attachments } : {}
|
|
51146
51993
|
};
|
|
@@ -51393,7 +52240,7 @@ Legacy request shapes remain supported.` });
|
|
|
51393
52240
|
return;
|
|
51394
52241
|
}
|
|
51395
52242
|
if (this.request === void 0 === (this.requestFile === void 0)) throw new Error("Use exactly one of --request or --request-file");
|
|
51396
|
-
const input2 = JSON.parse(this.request ??
|
|
52243
|
+
const input2 = JSON.parse(this.request ?? readFileSync18(this.requestFile, "utf8"));
|
|
51397
52244
|
const parsed = parseUserMailboxRequest(this.dryRun ? { ...input2, dryRun: true } : input2);
|
|
51398
52245
|
if ("error" in parsed) throw new Error(parsed.error);
|
|
51399
52246
|
const result = await this.client().userMailbox(parsed.value);
|
|
@@ -51413,18 +52260,18 @@ var AGENT_MAIL_COMMANDS = [
|
|
|
51413
52260
|
|
|
51414
52261
|
// ente/commands/update.ts
|
|
51415
52262
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
51416
|
-
import { existsSync as existsSync8, readFileSync as
|
|
52263
|
+
import { existsSync as existsSync8, readFileSync as readFileSync21, realpathSync as realpathSync2 } from "node:fs";
|
|
51417
52264
|
import path11 from "node:path";
|
|
51418
52265
|
|
|
51419
52266
|
// ente/migrationState.ts
|
|
51420
|
-
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";
|
|
51421
52268
|
import path9 from "node:path";
|
|
51422
52269
|
var MIGRATION_STATE_FILE = "registry_migration.json";
|
|
51423
52270
|
function readMigrationState(cacheDir, key) {
|
|
51424
52271
|
try {
|
|
51425
52272
|
const file2 = path9.join(cacheDir, MIGRATION_STATE_FILE);
|
|
51426
52273
|
if (!existsSync6(file2)) return void 0;
|
|
51427
|
-
const value = JSON.parse(
|
|
52274
|
+
const value = JSON.parse(readFileSync19(file2, "utf8"))[key];
|
|
51428
52275
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
51429
52276
|
} catch {
|
|
51430
52277
|
return void 0;
|
|
@@ -51435,7 +52282,7 @@ function writeMigrationState(cacheDir, key, value) {
|
|
|
51435
52282
|
const file2 = path9.join(cacheDir, MIGRATION_STATE_FILE);
|
|
51436
52283
|
let state = {};
|
|
51437
52284
|
try {
|
|
51438
|
-
if (existsSync6(file2)) state = JSON.parse(
|
|
52285
|
+
if (existsSync6(file2)) state = JSON.parse(readFileSync19(file2, "utf8"));
|
|
51439
52286
|
} catch {
|
|
51440
52287
|
}
|
|
51441
52288
|
mkdirSync5(cacheDir, { recursive: true });
|
|
@@ -51448,7 +52295,7 @@ function writeMigrationState(cacheDir, key, value) {
|
|
|
51448
52295
|
|
|
51449
52296
|
// ente/installSource.ts
|
|
51450
52297
|
import { createHash as createHash5 } from "node:crypto";
|
|
51451
|
-
import { existsSync as existsSync7, readFileSync as
|
|
52298
|
+
import { existsSync as existsSync7, readFileSync as readFileSync20 } from "node:fs";
|
|
51452
52299
|
import os3 from "node:os";
|
|
51453
52300
|
import path10 from "node:path";
|
|
51454
52301
|
import { fileURLToPath } from "node:url";
|
|
@@ -51478,9 +52325,9 @@ function installedPackageDir(fromFile) {
|
|
|
51478
52325
|
}
|
|
51479
52326
|
return null;
|
|
51480
52327
|
}
|
|
51481
|
-
function sourceFromLockfile(
|
|
52328
|
+
function sourceFromLockfile(text4) {
|
|
51482
52329
|
try {
|
|
51483
|
-
const lock = JSON.parse(
|
|
52330
|
+
const lock = JSON.parse(text4);
|
|
51484
52331
|
const resolved = lock.packages?.[`node_modules/${PACKAGE_NAME}`]?.resolved;
|
|
51485
52332
|
return typeof resolved === "string" ? classifyRegistryUrl(resolved) : "unknown";
|
|
51486
52333
|
} catch {
|
|
@@ -51502,7 +52349,7 @@ function npmCacheDir(env = process.env) {
|
|
|
51502
52349
|
try {
|
|
51503
52350
|
const file2 = userNpmrcPath(env);
|
|
51504
52351
|
if (existsSync7(file2)) {
|
|
51505
|
-
const match = /^\s*cache\s*=\s*(.+?)\s*$/im.exec(
|
|
52352
|
+
const match = /^\s*cache\s*=\s*(.+?)\s*$/im.exec(readFileSync20(file2, "utf8"));
|
|
51506
52353
|
if (match) return match[1].replace(/^~(?=$|[\\/])/, os3.homedir());
|
|
51507
52354
|
}
|
|
51508
52355
|
} catch {
|
|
@@ -51514,7 +52361,7 @@ function cachedFetchTime(cacheDir, url2) {
|
|
|
51514
52361
|
const bucket = path10.join(cacheDir, "_cacache", "index-v5", hash2.slice(0, 2), hash2.slice(2, 4), hash2.slice(4));
|
|
51515
52362
|
if (!existsSync7(bucket)) return null;
|
|
51516
52363
|
let latest = null;
|
|
51517
|
-
for (const line of
|
|
52364
|
+
for (const line of readFileSync20(bucket, "utf8").split("\n")) {
|
|
51518
52365
|
const tab = line.indexOf(" ");
|
|
51519
52366
|
if (tab < 0) continue;
|
|
51520
52367
|
try {
|
|
@@ -51527,7 +52374,7 @@ function cachedFetchTime(cacheDir, url2) {
|
|
|
51527
52374
|
}
|
|
51528
52375
|
function sourceFromNpmCache(cacheDir, version5, npmInstalledAt) {
|
|
51529
52376
|
const urls = tarballUrls(version5);
|
|
51530
|
-
const newest = (
|
|
52377
|
+
const newest = (list3) => Math.max(-1, ...list3.map((url2) => cachedFetchTime(cacheDir, url2) ?? -1));
|
|
51531
52378
|
const npm = Math.max(newest(urls.npm), npmInstalledAt ?? -1);
|
|
51532
52379
|
const gitea = newest(urls.gitea);
|
|
51533
52380
|
if (npm < 0 && gitea < 0) return "unknown";
|
|
@@ -51539,7 +52386,7 @@ function detectInstallSource(options = {}) {
|
|
|
51539
52386
|
if (!packageDir) return "unknown";
|
|
51540
52387
|
const lockfile = path10.join(path10.dirname(packageDir), ".package-lock.json");
|
|
51541
52388
|
if (existsSync7(lockfile)) {
|
|
51542
|
-
const fromLock = sourceFromLockfile(
|
|
52389
|
+
const fromLock = sourceFromLockfile(readFileSync20(lockfile, "utf8"));
|
|
51543
52390
|
if (fromLock !== "unknown") return fromLock;
|
|
51544
52391
|
}
|
|
51545
52392
|
const version5 = options.version ?? installedVersion(packageDir);
|
|
@@ -51551,7 +52398,7 @@ function detectInstallSource(options = {}) {
|
|
|
51551
52398
|
}
|
|
51552
52399
|
function installedVersion(packageDir) {
|
|
51553
52400
|
try {
|
|
51554
|
-
const version5 = JSON.parse(
|
|
52401
|
+
const version5 = JSON.parse(readFileSync20(path10.join(packageDir, "package.json"), "utf8")).version;
|
|
51555
52402
|
return typeof version5 === "string" && /^[0-9A-Za-z.+-]{1,32}$/.test(version5) ? version5 : null;
|
|
51556
52403
|
} catch {
|
|
51557
52404
|
return null;
|
|
@@ -51564,9 +52411,9 @@ function currentFile() {
|
|
|
51564
52411
|
return "";
|
|
51565
52412
|
}
|
|
51566
52413
|
}
|
|
51567
|
-
function registryFromNpmrc(
|
|
52414
|
+
function registryFromNpmrc(text4) {
|
|
51568
52415
|
let registry2 = null;
|
|
51569
|
-
for (const raw of
|
|
52416
|
+
for (const raw of text4.split(/\r?\n/)) {
|
|
51570
52417
|
const line = raw.trim();
|
|
51571
52418
|
if (!line || line.startsWith("#") || line.startsWith(";")) continue;
|
|
51572
52419
|
const match = /^registry\s*=\s*(.+)$/i.exec(line);
|
|
@@ -51580,7 +52427,7 @@ function userNpmrcPath(env = process.env) {
|
|
|
51580
52427
|
function giteaNpmrcHint(effectiveRegistry, userNpmrcText) {
|
|
51581
52428
|
if (classifyRegistryUrl(effectiveRegistry) !== "gitea") return null;
|
|
51582
52429
|
const inUserFile = classifyRegistryUrl(registryFromNpmrc(userNpmrcText ?? "")) === "gitea";
|
|
51583
|
-
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.";
|
|
51584
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`;
|
|
51585
52432
|
}
|
|
51586
52433
|
|
|
@@ -51593,12 +52440,12 @@ function updateShellCommand(prefix = null) {
|
|
|
51593
52440
|
}
|
|
51594
52441
|
function installPrefixOf(scriptPath) {
|
|
51595
52442
|
const parts = scriptPath.split(path11.sep);
|
|
51596
|
-
const
|
|
51597
|
-
if (
|
|
51598
|
-
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;
|
|
51599
52446
|
}
|
|
51600
52447
|
var SHARED_INSTALL_UMASK = 18;
|
|
51601
|
-
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.";
|
|
51602
52449
|
var updateRunner = {
|
|
51603
52450
|
run(command, args, json3) {
|
|
51604
52451
|
const previousUmask = process.platform === "win32" ? void 0 : process.umask(SHARED_INSTALL_UMASK);
|
|
@@ -51624,8 +52471,8 @@ var updateRunner = {
|
|
|
51624
52471
|
installSource() {
|
|
51625
52472
|
return detectInstallSource({ npmInstalledAt: readMigrationState(configDir(ENTE_BRANDING), "npm_installed_at") });
|
|
51626
52473
|
},
|
|
51627
|
-
recordNpmInstall(
|
|
51628
|
-
writeMigrationState(configDir(ENTE_BRANDING), "npm_installed_at",
|
|
52474
|
+
recordNpmInstall(at2) {
|
|
52475
|
+
writeMigrationState(configDir(ENTE_BRANDING), "npm_installed_at", at2);
|
|
51629
52476
|
},
|
|
51630
52477
|
/** npm's effective `registry` setting, or null when npm cannot answer. */
|
|
51631
52478
|
npmRegistry() {
|
|
@@ -51644,7 +52491,7 @@ var updateRunner = {
|
|
|
51644
52491
|
userNpmrc() {
|
|
51645
52492
|
try {
|
|
51646
52493
|
const file2 = userNpmrcPath();
|
|
51647
|
-
return existsSync8(file2) ?
|
|
52494
|
+
return existsSync8(file2) ? readFileSync21(file2, "utf8") : null;
|
|
51648
52495
|
} catch {
|
|
51649
52496
|
return null;
|
|
51650
52497
|
}
|
|
@@ -51674,7 +52521,7 @@ var Update = class extends BaseCommand {
|
|
|
51674
52521
|
static usage = Command.Usage({
|
|
51675
52522
|
category: "Help",
|
|
51676
52523
|
description: "Install the latest ente-cli globally from npm",
|
|
51677
|
-
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.`,
|
|
51678
52525
|
examples: [["Update from npm", "ente update"], ["Print the install command", "ente update --dry-run"]]
|
|
51679
52526
|
});
|
|
51680
52527
|
registry = options_exports.String("--registry", "npm", { description: "Always npm; kept so existing scripts keep working" });
|
|
@@ -51701,8 +52548,8 @@ var UPDATE_COMMANDS = [Update];
|
|
|
51701
52548
|
// ente/registryMigration.ts
|
|
51702
52549
|
import { createInterface } from "node:readline";
|
|
51703
52550
|
var NO_UPDATE_PROMPT_ENV = "ENTE_CLI_NO_UPDATE_PROMPT";
|
|
51704
|
-
var MIGRATION_QUESTION = "This ente CLI was installed from
|
|
51705
|
-
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.";
|
|
51706
52553
|
var DAY_MS = 864e5;
|
|
51707
52554
|
var SKIP_COMMANDS = /* @__PURE__ */ new Set(["", "update", "--version", "-V", "--help", "-h", "help"]);
|
|
51708
52555
|
function commandWord(argv) {
|
|
@@ -51810,6 +52657,7 @@ for (const Cmd of [
|
|
|
51810
52657
|
...CANVAS_COMMANDS,
|
|
51811
52658
|
...FILES_COMMANDS,
|
|
51812
52659
|
...NOTIFICATION_COMMANDS,
|
|
52660
|
+
...HEALTH_DATA_COMMANDS,
|
|
51813
52661
|
...AGENT_MAIL_COMMANDS,
|
|
51814
52662
|
...AGENT_TASK_COMMANDS,
|
|
51815
52663
|
...UPDATE_COMMANDS
|