ente-cli 0.4.145 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -10
- package/dist/SKILL.md +31 -11
- package/dist/cli.mjs +810 -711
- package/dist/cli.mjs.map +4 -4
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -78,16 +78,16 @@ var require_lib = __commonJS({
|
|
|
78
78
|
return `${(_c = state === null || state === void 0 ? void 0 : state.p) !== null && _c !== void 0 ? _c : `.`}[${JSON.stringify(key)}]`;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
return n === 1 ? singular :
|
|
81
|
+
function plural3(n, singular, plural4) {
|
|
82
|
+
return n === 1 ? singular : plural4;
|
|
83
83
|
}
|
|
84
84
|
var colorStringRegExp = /^#[0-9a-f]{6}$/i;
|
|
85
85
|
var colorStringAlphaRegExp = /^#[0-9a-f]{6}([0-9a-f]{2})?$/i;
|
|
86
86
|
var base64RegExp = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
|
|
87
87
|
var uuid4RegExp = /^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}$/i;
|
|
88
88
|
var iso8601RegExp = /^(?:[1-9]\d{3}(-?)(?:(?:0[1-9]|1[0-2])\1(?:0[1-9]|1\d|2[0-8])|(?:0[13-9]|1[0-2])\1(?:29|30)|(?:0[13578]|1[02])(?:\1)31|00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[0-5]))|(?:[1-9]\d(?:0[48]|[2468][048]|[13579][26])|(?:[2468][048]|[13579][26])00)(?:(-?)02(?:\2)29|-?366))T(?:[01]\d|2[0-3])(:?)[0-5]\d(?:\3[0-5]\d)?(?:Z|[+-][01]\d(?:\3[0-5]\d)?)$/;
|
|
89
|
-
function pushError({ errors, p } = {},
|
|
90
|
-
errors === null || errors === void 0 ? void 0 : errors.push(`${p !== null && p !== void 0 ? p : `.`}: ${
|
|
89
|
+
function pushError({ errors, p } = {}, message3) {
|
|
90
|
+
errors === null || errors === void 0 ? void 0 : errors.push(`${p !== null && p !== void 0 ? p : `.`}: ${message3}`);
|
|
91
91
|
return false;
|
|
92
92
|
}
|
|
93
93
|
function makeSetter(target3, key) {
|
|
@@ -894,7 +894,7 @@ var require_lib = __commonJS({
|
|
|
894
894
|
if (!check2(keys, key, value))
|
|
895
895
|
problems.push(key);
|
|
896
896
|
if (problems.length > 0)
|
|
897
|
-
return pushError(state, `Missing required ${
|
|
897
|
+
return pushError(state, `Missing required ${plural3(problems.length, `property`, `properties`)} ${getPrintableArray(problems, `and`)}`);
|
|
898
898
|
return true;
|
|
899
899
|
}
|
|
900
900
|
});
|
|
@@ -925,7 +925,7 @@ var require_lib = __commonJS({
|
|
|
925
925
|
if (check2(keys, key, value))
|
|
926
926
|
problems.push(key);
|
|
927
927
|
if (problems.length > 0)
|
|
928
|
-
return pushError(state, `Forbidden ${
|
|
928
|
+
return pushError(state, `Forbidden ${plural3(problems.length, `property`, `properties`)} ${getPrintableArray(problems, `and`)}`);
|
|
929
929
|
return true;
|
|
930
930
|
}
|
|
931
931
|
});
|
|
@@ -978,7 +978,7 @@ var require_lib = __commonJS({
|
|
|
978
978
|
if ((check2(keys, key, value) && !skipped.has(value[key])) !== spec.expect)
|
|
979
979
|
problems.push(key);
|
|
980
980
|
if (problems.length >= 1)
|
|
981
|
-
return pushError(state, `Property "${subject}" ${spec.message} ${
|
|
981
|
+
return pushError(state, `Property "${subject}" ${spec.message} ${plural3(problems.length, `property`, `properties`)} ${getPrintableArray(problems, conjunction)}`);
|
|
982
982
|
return true;
|
|
983
983
|
}
|
|
984
984
|
});
|
|
@@ -3186,7 +3186,7 @@ var init_query_impl = __esm({
|
|
|
3186
3186
|
const cursor2 = paginationOpts.cursor;
|
|
3187
3187
|
const endCursor = paginationOpts?.endCursor ?? null;
|
|
3188
3188
|
const maximumRowsRead = paginationOpts.maximumRowsRead ?? null;
|
|
3189
|
-
const { page:
|
|
3189
|
+
const { page: page2, isDone, continueCursor, splitCursor, pageStatus } = await performAsyncSyscall("1.0/queryPage", {
|
|
3190
3190
|
query,
|
|
3191
3191
|
cursor: cursor2,
|
|
3192
3192
|
endCursor,
|
|
@@ -3196,7 +3196,7 @@ var init_query_impl = __esm({
|
|
|
3196
3196
|
version
|
|
3197
3197
|
});
|
|
3198
3198
|
return {
|
|
3199
|
-
page:
|
|
3199
|
+
page: page2.map((json3) => jsonToConvex(json3)),
|
|
3200
3200
|
isDone,
|
|
3201
3201
|
continueCursor,
|
|
3202
3202
|
splitCursor,
|
|
@@ -5242,8 +5242,8 @@ var IS_DEBUG = process.env.DEBUG_CLI === `1`;
|
|
|
5242
5242
|
|
|
5243
5243
|
// node_modules/.pnpm/clipanion@4.0.0-rc.4_typanion@3.14.0/node_modules/clipanion/lib/errors.mjs
|
|
5244
5244
|
var UsageError = class extends Error {
|
|
5245
|
-
constructor(
|
|
5246
|
-
super(
|
|
5245
|
+
constructor(message3) {
|
|
5246
|
+
super(message3);
|
|
5247
5247
|
this.clipanion = { type: `usage` };
|
|
5248
5248
|
this.name = `UsageError`;
|
|
5249
5249
|
}
|
|
@@ -5323,8 +5323,8 @@ function rerouteArguments(a, b) {
|
|
|
5323
5323
|
return [a, b];
|
|
5324
5324
|
}
|
|
5325
5325
|
}
|
|
5326
|
-
function cleanValidationError(
|
|
5327
|
-
const match =
|
|
5326
|
+
function cleanValidationError(message3, { mergeName = false } = {}) {
|
|
5327
|
+
const match = message3.match(/^([^:]+): (.*)$/m);
|
|
5328
5328
|
if (!match)
|
|
5329
5329
|
return `validation failed`;
|
|
5330
5330
|
let [, path12, line] = match;
|
|
@@ -5333,11 +5333,11 @@ function cleanValidationError(message4, { mergeName = false } = {}) {
|
|
|
5333
5333
|
line = path12 !== `.` || !mergeName ? `${path12.replace(/^\.(\[|$)/, `$1`)}: ${line}` : `: ${line}`;
|
|
5334
5334
|
return line;
|
|
5335
5335
|
}
|
|
5336
|
-
function formatError(
|
|
5336
|
+
function formatError(message3, errors) {
|
|
5337
5337
|
if (errors.length === 1) {
|
|
5338
|
-
return new UsageError(`${
|
|
5338
|
+
return new UsageError(`${message3}${cleanValidationError(errors[0], { mergeName: true })}`);
|
|
5339
5339
|
} else {
|
|
5340
|
-
return new UsageError(`${
|
|
5340
|
+
return new UsageError(`${message3}:
|
|
5341
5341
|
${errors.map((error62) => `
|
|
5342
5342
|
- ${cleanValidationError(error62)}`).join(``)}`);
|
|
5343
5343
|
}
|
|
@@ -6841,10 +6841,10 @@ function Rest(opts = {}) {
|
|
|
6841
6841
|
return true;
|
|
6842
6842
|
return false;
|
|
6843
6843
|
};
|
|
6844
|
-
let
|
|
6845
|
-
while (
|
|
6846
|
-
|
|
6847
|
-
return state.positionals.splice(0,
|
|
6844
|
+
let count2 = 0;
|
|
6845
|
+
while (count2 < state.positionals.length && isRestPositional(count2))
|
|
6846
|
+
count2 += 1;
|
|
6847
|
+
return state.positionals.splice(0, count2).map(({ value }) => value);
|
|
6848
6848
|
}
|
|
6849
6849
|
});
|
|
6850
6850
|
}
|
|
@@ -9269,8 +9269,8 @@ function prefixIssues(path12, issues) {
|
|
|
9269
9269
|
return iss;
|
|
9270
9270
|
});
|
|
9271
9271
|
}
|
|
9272
|
-
function unwrapMessage(
|
|
9273
|
-
return typeof
|
|
9272
|
+
function unwrapMessage(message3) {
|
|
9273
|
+
return typeof message3 === "string" ? message3 : message3?.message;
|
|
9274
9274
|
}
|
|
9275
9275
|
function sizeCaps(defChecks) {
|
|
9276
9276
|
const caps = [];
|
|
@@ -9300,7 +9300,7 @@ function finalizeIssue(iss, ctx, config2) {
|
|
|
9300
9300
|
iss.schema = iss.inst;
|
|
9301
9301
|
}
|
|
9302
9302
|
const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
|
|
9303
|
-
const
|
|
9303
|
+
const message3 = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(schemaError?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
|
|
9304
9304
|
const full = {};
|
|
9305
9305
|
for (const k of Object.keys(iss)) {
|
|
9306
9306
|
if (k === "inst" || k === "schema" || k === "continue" || k === "input" || k === "__proto__")
|
|
@@ -9308,7 +9308,7 @@ function finalizeIssue(iss, ctx, config2) {
|
|
|
9308
9308
|
full[k] = iss[k];
|
|
9309
9309
|
}
|
|
9310
9310
|
full.path ?? (full.path = []);
|
|
9311
|
-
full.message =
|
|
9311
|
+
full.message = message3;
|
|
9312
9312
|
if (ctx?.reportInput) {
|
|
9313
9313
|
full.input = iss.input;
|
|
9314
9314
|
}
|
|
@@ -9328,14 +9328,14 @@ function codePointLength(str) {
|
|
|
9328
9328
|
const units = str.length;
|
|
9329
9329
|
if (!highSurrogate.test(str))
|
|
9330
9330
|
return units;
|
|
9331
|
-
let
|
|
9331
|
+
let count2 = units;
|
|
9332
9332
|
for (let i = 0; i < units - 1; i++) {
|
|
9333
9333
|
if ((str.charCodeAt(i) & 64512) === 55296 && (str.charCodeAt(i + 1) & 64512) === 56320) {
|
|
9334
|
-
|
|
9334
|
+
count2--;
|
|
9335
9335
|
i++;
|
|
9336
9336
|
}
|
|
9337
9337
|
}
|
|
9338
|
-
return
|
|
9338
|
+
return count2;
|
|
9339
9339
|
}
|
|
9340
9340
|
function getLengthableOrigin(input2) {
|
|
9341
9341
|
if (Array.isArray(input2))
|
|
@@ -13718,8 +13718,8 @@ function az_default() {
|
|
|
13718
13718
|
}
|
|
13719
13719
|
|
|
13720
13720
|
// ../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/be.js
|
|
13721
|
-
function getBelarusianPlural(
|
|
13722
|
-
const absCount = Math.abs(
|
|
13721
|
+
function getBelarusianPlural(count2, one, few, many) {
|
|
13722
|
+
const absCount = Math.abs(count2);
|
|
13723
13723
|
const lastDigit = absCount % 10;
|
|
13724
13724
|
const lastTwoDigits = absCount % 100;
|
|
13725
13725
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -16366,8 +16366,8 @@ function hu_default() {
|
|
|
16366
16366
|
}
|
|
16367
16367
|
|
|
16368
16368
|
// ../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/hy.js
|
|
16369
|
-
function getArmenianPlural(
|
|
16370
|
-
return Math.abs(
|
|
16369
|
+
function getArmenianPlural(count2, one, many) {
|
|
16370
|
+
return Math.abs(count2) === 1 ? one : many;
|
|
16371
16371
|
}
|
|
16372
16372
|
function withDefiniteArticle(word) {
|
|
16373
16373
|
if (!word)
|
|
@@ -18812,8 +18812,8 @@ var error43 = () => {
|
|
|
18812
18812
|
case "not_multiple_of":
|
|
18813
18813
|
return `N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${issue2.divisor}`;
|
|
18814
18814
|
case "unrecognized_keys": {
|
|
18815
|
-
const
|
|
18816
|
-
return `Chave${
|
|
18815
|
+
const plural3 = issue2.keys.length > 1 ? "s" : "";
|
|
18816
|
+
return `Chave${plural3} inv\xE1lida${plural3}: ${joinValues(issue2.keys, ", ")}`;
|
|
18817
18817
|
}
|
|
18818
18818
|
case "invalid_key":
|
|
18819
18819
|
return `Entrada inv\xE1lida n${translateOriginWithArticle(issue2.origin, "definite")}`;
|
|
@@ -18957,8 +18957,8 @@ var error44 = () => {
|
|
|
18957
18957
|
case "not_multiple_of":
|
|
18958
18958
|
return `N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${issue2.divisor}`;
|
|
18959
18959
|
case "unrecognized_keys": {
|
|
18960
|
-
const
|
|
18961
|
-
return `Chave${
|
|
18960
|
+
const plural3 = issue2.keys.length > 1 ? "s" : "";
|
|
18961
|
+
return `Chave${plural3} inv\xE1lida${plural3}: ${joinValues(issue2.keys, ", ")}`;
|
|
18962
18962
|
}
|
|
18963
18963
|
case "invalid_key":
|
|
18964
18964
|
return `Entrada inv\xE1lida n${translateOriginWithArticle(issue2.origin, "definite")}`;
|
|
@@ -19105,8 +19105,8 @@ function ro_default() {
|
|
|
19105
19105
|
}
|
|
19106
19106
|
|
|
19107
19107
|
// ../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/ru.js
|
|
19108
|
-
function getRussianPlural(
|
|
19109
|
-
const absCount = Math.abs(
|
|
19108
|
+
function getRussianPlural(count2, one, few, many) {
|
|
19109
|
+
const absCount = Math.abs(count2);
|
|
19110
19110
|
const lastDigit = absCount % 10;
|
|
19111
19111
|
const lastTwoDigits = absCount % 100;
|
|
19112
19112
|
if (lastTwoDigits >= 11 && lastTwoDigits <= 19) {
|
|
@@ -21047,8 +21047,8 @@ var globalRegistry = globalThis.__zod_globalRegistry;
|
|
|
21047
21047
|
var INVALID = Symbol.for("zod.compile.invalid");
|
|
21048
21048
|
var FALLBACK_FLAG = Symbol.for("zod.compile.fallback");
|
|
21049
21049
|
var ZodCompileAsyncError = class extends Error {
|
|
21050
|
-
constructor(
|
|
21051
|
-
super(
|
|
21050
|
+
constructor(message3 = "z.compile does not support async refinements, transforms, or checks") {
|
|
21051
|
+
super(message3);
|
|
21052
21052
|
this.name = "ZodCompileAsyncError";
|
|
21053
21053
|
}
|
|
21054
21054
|
};
|
|
@@ -23748,12 +23748,12 @@ function initializeContext(params) {
|
|
|
23748
23748
|
external: params?.external ?? void 0
|
|
23749
23749
|
};
|
|
23750
23750
|
}
|
|
23751
|
-
function handleUnrepresentable(schema, ctx, json3, params,
|
|
23752
|
-
const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({ zodSchema: schema, path: params.path, message:
|
|
23751
|
+
function handleUnrepresentable(schema, ctx, json3, params, message3) {
|
|
23752
|
+
const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({ zodSchema: schema, path: params.path, message: message3 }) : ctx.unrepresentable;
|
|
23753
23753
|
if (result === "any")
|
|
23754
23754
|
return false;
|
|
23755
23755
|
if (result === void 0 || result === "throw")
|
|
23756
|
-
throw new Error(
|
|
23756
|
+
throw new Error(message3);
|
|
23757
23757
|
Object.assign(json3, result);
|
|
23758
23758
|
return true;
|
|
23759
23759
|
}
|
|
@@ -28148,8 +28148,8 @@ var ValidationError = class extends Error {
|
|
|
28148
28148
|
got;
|
|
28149
28149
|
path;
|
|
28150
28150
|
constructor(expected, got, path12) {
|
|
28151
|
-
const
|
|
28152
|
-
super(
|
|
28151
|
+
const message3 = `Validator error${path12 ? ` for ${path12}` : ""}: Expected \`${expected}\`, got \`${got}\``;
|
|
28152
|
+
super(message3);
|
|
28153
28153
|
this.expected = expected;
|
|
28154
28154
|
this.got = got;
|
|
28155
28155
|
this.path = path12;
|
|
@@ -28476,8 +28476,8 @@ function validateOperationResult(validator, raw) {
|
|
|
28476
28476
|
return isJsonOperationValue(raw, /* @__PURE__ */ new Set()) && matchesResultShape(validator, raw);
|
|
28477
28477
|
}
|
|
28478
28478
|
var OperationResultError = class extends Error {
|
|
28479
|
-
constructor(operation,
|
|
28480
|
-
super(
|
|
28479
|
+
constructor(operation, message3 = `Invalid result for ${operation}`) {
|
|
28480
|
+
super(message3);
|
|
28481
28481
|
this.operation = operation;
|
|
28482
28482
|
this.name = "OperationResultError";
|
|
28483
28483
|
}
|
|
@@ -28486,14 +28486,14 @@ var OperationResultError = class extends Error {
|
|
|
28486
28486
|
return { code: this.code, operation: this.operation, message: this.message };
|
|
28487
28487
|
}
|
|
28488
28488
|
};
|
|
28489
|
-
function parseOperationResult(operation, validator, raw,
|
|
28489
|
+
function parseOperationResult(operation, validator, raw, message3) {
|
|
28490
28490
|
const candidate = forResult(validator, raw, describeConvex);
|
|
28491
|
-
if (!isJsonOperationValue(candidate, /* @__PURE__ */ new Set()) || !validate2(validator, candidate)) throw new OperationResultError(operation,
|
|
28491
|
+
if (!isJsonOperationValue(candidate, /* @__PURE__ */ new Set()) || !validate2(validator, candidate)) throw new OperationResultError(operation, message3);
|
|
28492
28492
|
return candidate;
|
|
28493
28493
|
}
|
|
28494
|
-
function parseZodOperationResult(operation, schema, raw,
|
|
28494
|
+
function parseZodOperationResult(operation, schema, raw, message3) {
|
|
28495
28495
|
const parsed = schema.safeParse(forResult(schema, raw, describeZod));
|
|
28496
|
-
if (!parsed.success) throw new OperationResultError(operation,
|
|
28496
|
+
if (!parsed.success) throw new OperationResultError(operation, message3);
|
|
28497
28497
|
return parsed.data;
|
|
28498
28498
|
}
|
|
28499
28499
|
|
|
@@ -28532,6 +28532,16 @@ function parseActivityReadRequest(operation, raw) {
|
|
|
28532
28532
|
}
|
|
28533
28533
|
}
|
|
28534
28534
|
|
|
28535
|
+
// ../packages/shared/src/entity-types.ts
|
|
28536
|
+
var ENTITY_TYPE_VALUES = [
|
|
28537
|
+
"person",
|
|
28538
|
+
"org",
|
|
28539
|
+
"project",
|
|
28540
|
+
"topic",
|
|
28541
|
+
"place",
|
|
28542
|
+
"object"
|
|
28543
|
+
];
|
|
28544
|
+
|
|
28535
28545
|
// ../packages/shared/src/entity-read-limits.ts
|
|
28536
28546
|
var ENTITY_READ_LIMITS = {
|
|
28537
28547
|
searchDefault: 5,
|
|
@@ -28546,7 +28556,10 @@ var ENTITY_READ_LIMITS = {
|
|
|
28546
28556
|
activityContentCharacters: 1500,
|
|
28547
28557
|
activityCountMaximum: 500,
|
|
28548
28558
|
searchOpenTasksMaximum: 10,
|
|
28549
|
-
listTaskEnrichmentEntities: 50
|
|
28559
|
+
listTaskEnrichmentEntities: 50,
|
|
28560
|
+
// One list page. Larger accepted limits return this many entities plus nextCursor.
|
|
28561
|
+
listPageMaximum: 100,
|
|
28562
|
+
listCursorCharacters: 1024
|
|
28550
28563
|
};
|
|
28551
28564
|
|
|
28552
28565
|
// ../packages/shared/src/entity-read-operations.ts
|
|
@@ -28562,7 +28575,15 @@ var entityReadInputs = {
|
|
|
28562
28575
|
limit: external_exports.number().int().min(1).max(ENTITY_READ_LIMITS.activityMaximum).default(ENTITY_READ_LIMITS.activityDefault),
|
|
28563
28576
|
projection: projection2
|
|
28564
28577
|
}),
|
|
28565
|
-
listEntities: external_exports.strictObject({
|
|
28578
|
+
listEntities: external_exports.strictObject({
|
|
28579
|
+
field: external_exports.strictObject({ label: fieldLabelSchema, value: external_exports.string().min(1).refine((value) => new TextEncoder().encode(value).length <= MAX_FIELD_VALUE_BYTES) }).optional(),
|
|
28580
|
+
spaceId: id3.optional(),
|
|
28581
|
+
type: external_exports.enum(ENTITY_TYPE_VALUES).optional(),
|
|
28582
|
+
cursor: external_exports.string().min(1).max(ENTITY_READ_LIMITS.listCursorCharacters).refine((value) => value.trim() === value, "Copy cursor unchanged").optional(),
|
|
28583
|
+
limit: limit2.default(ENTITY_READ_LIMITS.listDefault),
|
|
28584
|
+
archived: external_exports.boolean().default(false),
|
|
28585
|
+
projection: projection2
|
|
28586
|
+
}).refine((input2) => input2.field === void 0 || input2.cursor === void 0, { path: ["cursor"], message: "Field lookups return one bounded page; remove cursor" })
|
|
28566
28587
|
};
|
|
28567
28588
|
function parseEntityReadRequest(operation, raw) {
|
|
28568
28589
|
switch (operation) {
|
|
@@ -28579,11 +28600,11 @@ function parseEntityReadRequest(operation, raw) {
|
|
|
28579
28600
|
var ApiError = class extends Error {
|
|
28580
28601
|
statusCode;
|
|
28581
28602
|
error;
|
|
28582
|
-
constructor(statusCode,
|
|
28583
|
-
super(`HTTP ${statusCode}: ${
|
|
28603
|
+
constructor(statusCode, message3, error62) {
|
|
28604
|
+
super(`HTTP ${statusCode}: ${message3}`);
|
|
28584
28605
|
this.name = "ApiError";
|
|
28585
28606
|
this.statusCode = statusCode;
|
|
28586
|
-
this.detail =
|
|
28607
|
+
this.detail = message3;
|
|
28587
28608
|
this.error = error62 ?? {};
|
|
28588
28609
|
}
|
|
28589
28610
|
/** The backend's human message, without the `HTTP <code>:` prefix. */
|
|
@@ -28600,8 +28621,8 @@ var ExitWithCode = class extends Error {
|
|
|
28600
28621
|
var UPGRADE_REQUIRED_EXIT_CODE = 3;
|
|
28601
28622
|
var UpgradeRequiredError = class extends Error {
|
|
28602
28623
|
data;
|
|
28603
|
-
constructor(
|
|
28604
|
-
super(
|
|
28624
|
+
constructor(message3, data = {}) {
|
|
28625
|
+
super(message3);
|
|
28605
28626
|
this.name = "UpgradeRequiredError";
|
|
28606
28627
|
this.data = data;
|
|
28607
28628
|
}
|
|
@@ -28616,8 +28637,8 @@ async function upgradeRequiredFromResponse(resp, path12) {
|
|
|
28616
28637
|
if (body.error && typeof body.error === "object" && !Array.isArray(body.error)) data = body.error;
|
|
28617
28638
|
} catch {
|
|
28618
28639
|
}
|
|
28619
|
-
const
|
|
28620
|
-
return new UpgradeRequiredError(
|
|
28640
|
+
const message3 = typeof data.message === "string" && data.message ? data.message : `The server refused this client version at ${path12} (426 Upgrade Required). Install the latest version.`;
|
|
28641
|
+
return new UpgradeRequiredError(message3, data);
|
|
28621
28642
|
}
|
|
28622
28643
|
|
|
28623
28644
|
// core/output.ts
|
|
@@ -28636,9 +28657,9 @@ function errorMessage(err) {
|
|
|
28636
28657
|
const data = err.data;
|
|
28637
28658
|
if (typeof data === "string" && data.length > 0) return data;
|
|
28638
28659
|
if (data && typeof data === "object") {
|
|
28639
|
-
const { message:
|
|
28640
|
-
if (typeof
|
|
28641
|
-
return typeof code3 === "string" ? `${
|
|
28660
|
+
const { message: message3, code: code3 } = data;
|
|
28661
|
+
if (typeof message3 === "string" && message3.length > 0) {
|
|
28662
|
+
return typeof code3 === "string" ? `${message3} (${code3})` : message3;
|
|
28642
28663
|
}
|
|
28643
28664
|
return `${err.message}: ${JSON.stringify(data)}`;
|
|
28644
28665
|
}
|
|
@@ -28655,10 +28676,15 @@ function renderTable(rows, headers) {
|
|
|
28655
28676
|
}
|
|
28656
28677
|
|
|
28657
28678
|
// core/errorOutput.ts
|
|
28658
|
-
|
|
28659
|
-
|
|
28679
|
+
var explainError = (error62) => error62;
|
|
28680
|
+
function setErrorExplainer(explain) {
|
|
28681
|
+
explainError = explain;
|
|
28682
|
+
}
|
|
28683
|
+
function writeCommandError(stdout, stderr, json3, raw) {
|
|
28684
|
+
const error62 = explainError(raw);
|
|
28685
|
+
const message3 = error62 instanceof ApiError && isUpgradeRequired(error62) ? error62.detail : isUpgradeRequired(error62) && error62 instanceof Error ? error62.message : errorMessage(error62);
|
|
28660
28686
|
if (!json3) {
|
|
28661
|
-
stderr.write(`Error: ${
|
|
28687
|
+
stderr.write(`Error: ${message3}
|
|
28662
28688
|
`);
|
|
28663
28689
|
return;
|
|
28664
28690
|
}
|
|
@@ -28666,7 +28692,7 @@ function writeCommandError(stdout, stderr, json3, error62) {
|
|
|
28666
28692
|
const details = data && typeof data === "object" && !Array.isArray(data) ? withoutAgentFingerprint(data) : {};
|
|
28667
28693
|
stdout.write(`${JSON.stringify({ error: {
|
|
28668
28694
|
...details,
|
|
28669
|
-
message:
|
|
28695
|
+
message: message3,
|
|
28670
28696
|
...error62 instanceof ApiError ? { statusCode: error62.statusCode } : {}
|
|
28671
28697
|
} }, null, 2)}
|
|
28672
28698
|
`);
|
|
@@ -28751,7 +28777,7 @@ function parseOperationFieldPairs(operation, pairs) {
|
|
|
28751
28777
|
}
|
|
28752
28778
|
|
|
28753
28779
|
// ente/version.ts
|
|
28754
|
-
var VERSION = "0.
|
|
28780
|
+
var VERSION = "0.5.0";
|
|
28755
28781
|
|
|
28756
28782
|
// ente/branding.ts
|
|
28757
28783
|
var NPM_REGISTRY = "https://registry.npmjs.org";
|
|
@@ -28780,7 +28806,7 @@ var PLATFORM_CREDENTIAL = {
|
|
|
28780
28806
|
};
|
|
28781
28807
|
|
|
28782
28808
|
// ../packages/shared/src/cli-compatibility.ts
|
|
28783
|
-
var CLI_COMPATIBILITY_LEVEL =
|
|
28809
|
+
var CLI_COMPATIBILITY_LEVEL = 4;
|
|
28784
28810
|
var CLI_VERSION_HEADER = "X-Ente-CLI-Version";
|
|
28785
28811
|
var CLI_COMPATIBILITY_HEADER = "X-Ente-CLI-Compatibility";
|
|
28786
28812
|
function cliCompatibilityHeaders(version5) {
|
|
@@ -28832,8 +28858,8 @@ function optionalBoolean(value) {
|
|
|
28832
28858
|
function isActivityType(value) {
|
|
28833
28859
|
return typeof value === "string" && ACTIVITY_TYPE_VALUES.some((type) => type === value);
|
|
28834
28860
|
}
|
|
28835
|
-
var invalid = (
|
|
28836
|
-
function parseActivityCreateInput(args, name4 = "
|
|
28861
|
+
var invalid = (message3) => ({ ok: false, message: message3 });
|
|
28862
|
+
function parseActivityCreateInput(args, name4 = "createActivity") {
|
|
28837
28863
|
if (Object.hasOwn(args, "attributes")) return invalid(ACTIVITY_ATTRIBUTES_RETIRED);
|
|
28838
28864
|
if ("createdAt" in args) return invalid(`${name4} createdAt is no longer accepted; use sourceCreatedAt.`);
|
|
28839
28865
|
if (args.sourceCreatedAt !== void 0 && !isSourceCreatedAtInput(args.sourceCreatedAt))
|
|
@@ -28865,7 +28891,7 @@ function parseActivityCreateInput(args, name4 = "activities_create") {
|
|
|
28865
28891
|
autoLinkPersonalSpace: optionalBoolean(args.autoLinkPersonalSpace)
|
|
28866
28892
|
} };
|
|
28867
28893
|
}
|
|
28868
|
-
function parseActivityUpdateInput(args, name4 = "
|
|
28894
|
+
function parseActivityUpdateInput(args, name4 = "updateActivity") {
|
|
28869
28895
|
if (Object.hasOwn(args, "attributes")) return invalid(ACTIVITY_ATTRIBUTES_RETIRED);
|
|
28870
28896
|
if (typeof args.activityId !== "string") return invalid(`${name4} requires string activityId`);
|
|
28871
28897
|
if ("deadline" in args && !isNullableDeadlineInput(args.deadline))
|
|
@@ -28928,7 +28954,6 @@ var activityWriteInputs = {
|
|
|
28928
28954
|
restoreActivity: external_exports.strictObject({ activityId: id4 }),
|
|
28929
28955
|
batchUpdateTasks: external_exports.strictObject({ updates: external_exports.array(external_exports.strictObject({ activityId: id4, completed: external_exports.boolean().optional(), deadline: activityWriteDeadline.optional(), fields: activityFieldInputsSchema.optional() })).max(ACTIVITY_WRITE_LIMITS.wireArray) })
|
|
28930
28956
|
};
|
|
28931
|
-
var activityWriteAliases = { activities_create: "createActivity", activities_update: "updateActivity", activities_assign: "updateActivityAssignees", activities_addMessage: "addActivityMessage", activities_deleteMessage: "deleteActivityMessage", activities_delete: "deleteActivity", activities_restore: "restoreActivity" };
|
|
28932
28957
|
function isActivityWriteOperationName(name4) {
|
|
28933
28958
|
return Object.hasOwn(activityWriteInputs, name4);
|
|
28934
28959
|
}
|
|
@@ -29018,11 +29043,6 @@ function projectActivityWriteResult(operation, raw) {
|
|
|
29018
29043
|
}
|
|
29019
29044
|
}
|
|
29020
29045
|
|
|
29021
|
-
// ../packages/shared/src/operation-contract.ts
|
|
29022
|
-
function operationAliases(mapping, name4, profile = "full") {
|
|
29023
|
-
return Object.entries(mapping).filter(([, target3]) => target3 === name4).map(([alias]) => ({ name: alias, profile }));
|
|
29024
|
-
}
|
|
29025
|
-
|
|
29026
29046
|
// ../packages/shared/src/operation-schema.ts
|
|
29027
29047
|
var operationErrorSchema = {
|
|
29028
29048
|
type: "object",
|
|
@@ -29095,6 +29115,7 @@ function operationResultSchema(validator) {
|
|
|
29095
29115
|
|
|
29096
29116
|
// ../packages/shared/src/activity-write-catalog.ts
|
|
29097
29117
|
var composite = /* @__PURE__ */ new Set(["updateActivityAssignees", "toggleActivityCompleted", "batchUpdateTasks"]);
|
|
29118
|
+
var externalActivityWrites = /* @__PURE__ */ new Set(["createActivity", "updateActivity", "updateActivityAssignees", "addActivityMessage", "deleteActivityMessage", "deleteActivity", "restoreActivity"]);
|
|
29098
29119
|
var descriptions = {
|
|
29099
29120
|
createActivity: "Create in an explicit space with existing owners. externalKey reserves an agent-and-space task key atomically; retries return the first ID without applying changed fields, including completed/deleted tasks. sourceCreatedAt is for imports. fields use label or fieldId, optional type and typed value; null clears. A string list replaces a list field in submitted order (text, url, email, phone, address, multi-select). JSON is serialized text. New labels/options follow writer rules. Missing owner grants require human review.",
|
|
29100
29121
|
updateActivity: "Update supplied fields in the activity's actual space. Fields use label or fieldId with typed values; null clears, a string list replaces a list field in submitted order (text, url, email, phone, postal-address, salutation, job-title, multi-select); give type when a new label holds a list, new select options are implicit, JSON is serialized text. Existing fields cannot be retyped. The removed attributes input is rejected; use fields. Explicit completed is idempotent. Owners must already belong to the activity space. Provider-backed email body and type restrictions remain enforced.",
|
|
@@ -29127,9 +29148,10 @@ function definition(name4) {
|
|
|
29127
29148
|
{ type: "object", properties: { action: { const: "replace" }, agentAssigneeIds: { type: "array", items: { type: "string", minLength: 1, maxLength: 128 }, maxItems: ACTIVITY_WRITE_LIMITS.agentAssignees } } }
|
|
29128
29149
|
] }] : void 0;
|
|
29129
29150
|
const resultSchema3 = external_exports.toJSONSchema(activityWriteResults[name4]);
|
|
29151
|
+
const external = externalActivityWrites.has(name4);
|
|
29130
29152
|
return {
|
|
29131
29153
|
name: name4,
|
|
29132
|
-
aliases:
|
|
29154
|
+
aliases: [],
|
|
29133
29155
|
actor: "agent",
|
|
29134
29156
|
description: descriptions[name4],
|
|
29135
29157
|
inputSchema: { ...schema, type: "object", properties, additionalProperties: false, ...conditions ? { allOf: conditions } : {} },
|
|
@@ -29140,7 +29162,7 @@ function definition(name4) {
|
|
|
29140
29162
|
environment: "content",
|
|
29141
29163
|
executionProfile: "full",
|
|
29142
29164
|
resultProjection: "commit-receipt",
|
|
29143
|
-
availability: { hosted: true, external
|
|
29165
|
+
availability: { hosted: true, external, browserHuman: false, agentConnection: external, executionProfiles: ["full", "public-cli"], runtime: composite.has(name4) ? "action" : "mutation" },
|
|
29144
29166
|
limits: ACTIVITY_WRITE_LIMITS,
|
|
29145
29167
|
profiles: {
|
|
29146
29168
|
rest: { available: ["createActivity", "updateActivity", "updateActivityAssignees", "deleteActivity", "restoreActivity"].includes(name4), result: "commit-receipt" },
|
|
@@ -29148,7 +29170,6 @@ function definition(name4) {
|
|
|
29148
29170
|
publicUi: { primary: false, existingDomainValidators: true, ownerlessCreate: name4 === "createActivity", typedFields: name4 === "updateActivity" },
|
|
29149
29171
|
realtime: { primary: false, available: name4 === "createActivity", source: "verified-session-createTask", speechAndLeaseRequired: true, finishAndResultValidation: "same-transaction" }
|
|
29150
29172
|
},
|
|
29151
|
-
compatibilityAliases: Object.entries(activityWriteAliases).filter(([, operation]) => operation === name4).map(([alias]) => alias),
|
|
29152
29173
|
resourcePolicy: { selector: name4 === "createActivity" ? "explicit-activity-space" : name4 === "batchUpdateTasks" ? "ordered-activity-ids" : "actual-activity-space", creation: "explicit-space-and-headless-owners", existing: "actual-activity-space", runBounds: "intersect-live-write-scope", humanGrants: "required-outside-accepted-owner-Personal-exception", resultValidation: "before-each-commit" }
|
|
29153
29174
|
};
|
|
29154
29175
|
}
|
|
@@ -29171,7 +29192,7 @@ var assignee = external_exports.enum(["all", "me", "meOrUnassigned", "unassigned
|
|
|
29171
29192
|
var entityFilter = external_exports.strictObject({ coverage: external_exports.enum(["all", "tagged", "untagged"]).optional(), type: external_exports.enum(["person", "org", "project", "topic", "place", "object", "any"]).optional(), tags: tags.optional(), noParent: external_exports.boolean().optional() });
|
|
29172
29193
|
var feedFilter = external_exports.strictObject({ activityType: external_exports.enum([...ACTIVITY_TYPE_VALUES, "all"]).optional(), deadlineFilter: text.optional(), sortOrder: external_exports.enum(["created-desc", "deadline-asc", "latest-desc", "latest-message-desc"]).optional(), assigneeFilter: assignee.optional(), assigneeUserId: id6.optional(), assigneeUserIds: external_exports.array(id6).max(100).optional(), entityIds: external_exports.array(id6).max(100).optional(), tags: tags.optional(), attributeFilters: external_exports.array(external_exports.strictObject({ key: text, value: text })).max(100).optional() });
|
|
29173
29194
|
var activityFilter = feedFilter.omit({ assigneeUserId: true }).extend({ deadlineFilter: external_exports.enum(["due-now", "today", "this-week", "this-month", "all", "not-scheduled"]).optional(), taskStatus: external_exports.enum(["open", "completed", "all"]).optional(), search: text.optional() });
|
|
29174
|
-
var tabs = (filters,
|
|
29195
|
+
var tabs = (filters, entity3 = false) => external_exports.strictObject({ activeId: id6, tabs: external_exports.array(external_exports.strictObject({ id: id6, name: external_exports.string().max(80).optional(), filters, ...entity3 ? { view: external_exports.enum(["list", "tree"]).optional() } : {} })).min(1).max(30) }).refine((v3) => new Set(v3.tabs.map((t) => t.id)).size === v3.tabs.length && v3.tabs.some((t) => t.id === v3.activeId), "Invalid tab selection");
|
|
29175
29196
|
function setting(schema, defaultValue, description, examples, scope = "user", content = false) {
|
|
29176
29197
|
return { schema, default: defaultValue, description, examples, scope, adminSettable: true, content };
|
|
29177
29198
|
}
|
|
@@ -29237,14 +29258,6 @@ var workspaceResults = {
|
|
|
29237
29258
|
),
|
|
29238
29259
|
removeSpaceMember: v2.union(v2.object({ kind: v2.literal("removed") }), v2.object({ kind: v2.literal("not-member") }))
|
|
29239
29260
|
};
|
|
29240
|
-
var workspaceAliases = {
|
|
29241
|
-
spaces_list: "listSpaces",
|
|
29242
|
-
space_members_list: "listSpaceMembers",
|
|
29243
|
-
spaces_create: "createSpace",
|
|
29244
|
-
spaces_rename: "updateSpace",
|
|
29245
|
-
space_members_add: "addSpaceMember",
|
|
29246
|
-
space_members_remove: "removeSpaceMember"
|
|
29247
|
-
};
|
|
29248
29261
|
function isWorkspaceOperationName(name4) {
|
|
29249
29262
|
return Object.hasOwn(workspaceInputs, name4);
|
|
29250
29263
|
}
|
|
@@ -29264,19 +29277,15 @@ function parseWorkspaceRequest(operation, raw) {
|
|
|
29264
29277
|
return { operation, input: parseOperationInput(operation, workspaceInputs.removeSpaceMember, raw) };
|
|
29265
29278
|
}
|
|
29266
29279
|
}
|
|
29267
|
-
var
|
|
29268
|
-
var legacyWorkspaceWireResults = {
|
|
29269
|
-
listSpaces: external_exports.array(legacySpace.extend({ role: external_exports.enum(["owner", "admin", "member"]), memberEmails: external_exports.array(external_exports.string()) })),
|
|
29270
|
-
updateSpace: legacySpace
|
|
29271
|
-
};
|
|
29280
|
+
var spaceDocument = external_exports.object({ _id: id7, _creationTime: external_exports.number(), name: external_exports.string(), color: external_exports.string() }).catchall(external_exports.json().optional());
|
|
29272
29281
|
var workspacePublicCliResults = {
|
|
29273
29282
|
createSpaceSource: external_exports.strictObject({ createdSpaceId: id7, createdMembershipId: id7 }),
|
|
29274
29283
|
listSpaces: external_exports.array(external_exports.strictObject({ _id: id7, name: external_exports.string().optional(), role: external_exports.enum(["owner", "admin", "member"]).optional(), memberEmails: external_exports.array(external_exports.string()).optional() })),
|
|
29275
|
-
updateSpace:
|
|
29284
|
+
updateSpace: spaceDocument,
|
|
29276
29285
|
listSpaceMembers: external_exports.array(external_exports.strictObject({ userId: id7.optional(), name: external_exports.string().optional(), email: external_exports.string().optional() }))
|
|
29277
29286
|
};
|
|
29278
29287
|
var descriptions2 = {
|
|
29279
|
-
listSpaces: "List currently accessible active spaces
|
|
29288
|
+
listSpaces: "List currently accessible active spaces with spaceId, name, optional scope and isPersonal.",
|
|
29280
29289
|
listSpaceMembers: "List visible coworker identities in a space. Unavailable to Personal-only agent connections.",
|
|
29281
29290
|
createSpace: "Create a space without changing the active space. Requires spaces:manage and the existing inheriting Personal-agent authority. Color defaults to kale.",
|
|
29282
29291
|
updateSpace: "Update name, color or scope with spaces:manage and current owner/admin authority.",
|
|
@@ -29288,7 +29297,7 @@ var workspaceCatalog = Object.keys(workspaceInputs).filter(isWorkspaceOperationN
|
|
|
29288
29297
|
const resultSchema3 = operationResultSchema(workspaceResults[name4]);
|
|
29289
29298
|
return {
|
|
29290
29299
|
name: name4,
|
|
29291
|
-
aliases:
|
|
29300
|
+
aliases: [],
|
|
29292
29301
|
actor: "agent",
|
|
29293
29302
|
description: descriptions2[name4],
|
|
29294
29303
|
inputSchema: { type: "object", properties: schema.properties ?? {}, required: schema.required ?? [], additionalProperties: false, ...name4 === "updateSpace" ? { anyOf: ["name", "color", "scope"].map((field) => ({ required: [field] })) } : {} },
|
|
@@ -29300,7 +29309,7 @@ var workspaceCatalog = Object.keys(workspaceInputs).filter(isWorkspaceOperationN
|
|
|
29300
29309
|
executionProfile: "full",
|
|
29301
29310
|
environment: "workspace",
|
|
29302
29311
|
resultProjection: name4 === "listSpaces" ? "compact-space" : name4 === "updateSpace" ? "space-summary" : "full",
|
|
29303
|
-
compatibilityProjections: name4 === "listSpaces" ? { "
|
|
29312
|
+
compatibilityProjections: name4 === "listSpaces" ? { "public-cli": "membership-and-space-documents" } : name4 === "updateSpace" ? { "public-cli": "full-space-document" } : name4 === "listSpaceMembers" ? { "public-cli": "membership-and-visible-user-documents" } : name4 === "createSpace" ? { "public-cli": "created-space-and-membership-ids" } : {},
|
|
29304
29313
|
availability: { hosted: name4 === "listSpaces" || name4 === "listSpaceMembers", external: true, browserHuman: false, agentConnection: name4 !== "listSpaceMembers", executionProfiles: name4 === "addSpaceMember" || name4 === "removeSpaceMember" ? ["full"] : ["full", "public-cli"] },
|
|
29305
29314
|
compatibilityProfiles: name4 === "addSpaceMember" || name4 === "removeSpaceMember" ? {} : {
|
|
29306
29315
|
"public-cli": { primary: false, transport: "public-jwt", memberListing: "verified-current-credential; unavailable-emails-omitted", footerMemberLimit: WORKSPACE_FOOTER_MEMBER_LIMIT, resultSchema: name4 === "createSpace" ? resultSchema3 : external_exports.toJSONSchema(workspacePublicCliResults[name4]) }
|
|
@@ -29978,11 +29987,11 @@ function mapPayloads(operation, raw, transform2) {
|
|
|
29978
29987
|
if (operation !== "agent_thread_get") return raw;
|
|
29979
29988
|
if (!matchesResultShape(operatorThreadDetailValidator, raw)) throw new OperationResultError(operation);
|
|
29980
29989
|
if (!raw) return null;
|
|
29981
|
-
return { ...raw, messages: { ...raw.messages, page: raw.messages.page.map((
|
|
29982
|
-
...
|
|
29983
|
-
...
|
|
29984
|
-
...
|
|
29985
|
-
...
|
|
29990
|
+
return { ...raw, messages: { ...raw.messages, page: raw.messages.page.map((message3) => ({
|
|
29991
|
+
...message3,
|
|
29992
|
+
...message3.toolCalls ? { toolCalls: message3.toolCalls.map((call) => ({ ...call, input: transform2(call.input) })) } : {},
|
|
29993
|
+
...message3.toolResults ? { toolResults: message3.toolResults.map((result) => ({ ...result, result: transform2(result.result) })) } : {},
|
|
29994
|
+
...message3.serverToolCalls ? { serverToolCalls: message3.serverToolCalls.map((call) => ({ ...call, input: transform2(call.input) })) } : {}
|
|
29986
29995
|
})) } };
|
|
29987
29996
|
}
|
|
29988
29997
|
function checkPageBounds(operation, data) {
|
|
@@ -30411,10 +30420,9 @@ function parseNotificationRequest(raw) {
|
|
|
30411
30420
|
}
|
|
30412
30421
|
var inputSchema = { type: "object", properties: notificationEmailInputProperties, required: ["subject", "text"], additionalProperties: false };
|
|
30413
30422
|
var resultSchema = operationResultSchema(notificationEmailResultValidator);
|
|
30414
|
-
var notificationAliases = { notifications_email_send: "sendNotificationEmail" };
|
|
30415
30423
|
var notificationDefinition = {
|
|
30416
30424
|
name: "sendNotificationEmail",
|
|
30417
|
-
aliases: [
|
|
30425
|
+
aliases: [{ name: "ente_notification_email_send", profile: "mounted-view" }],
|
|
30418
30426
|
actor: "agent",
|
|
30419
30427
|
title: "Email the current Ente user",
|
|
30420
30428
|
description: "Send a notification email from Ente to the verified account email. The recipient cannot be overridden. Include a plain-text fallback and optionally HTML and bounded file attachments. Inline Content-ID attachments must be PNG, JPEG, GIF, or WebP images. The result records transport acceptance, not inbox delivery. There is no caller idempotency key: do not automatically retry an uncertain send.",
|
|
@@ -30574,10 +30582,9 @@ function parseSpaceChangeOperationResult(command, raw) {
|
|
|
30574
30582
|
return parseZodOperationResult("spaceChange", spaceChangeResults[command], raw);
|
|
30575
30583
|
}
|
|
30576
30584
|
var resultSchema2 = { anyOf: Object.values(spaceChangeResults).map((schema) => external_exports.toJSONSchema(schema)) };
|
|
30577
|
-
var spaceChangeAliases = { space_changes: "spaceChange", spaceChanges: "spaceChange" };
|
|
30578
30585
|
var spaceChangeDefinition = {
|
|
30579
30586
|
name: "spaceChange",
|
|
30580
|
-
aliases: [
|
|
30587
|
+
aliases: [{ name: "ente_space_change", profile: "mounted-view" }],
|
|
30581
30588
|
actor: "agent",
|
|
30582
30589
|
title: "Review and apply space changes",
|
|
30583
30590
|
description: SPACE_CHANGE_DESCRIPTION,
|
|
@@ -30621,16 +30628,6 @@ var spaceChangeBrowserSpec = {
|
|
|
30621
30628
|
}
|
|
30622
30629
|
};
|
|
30623
30630
|
|
|
30624
|
-
// ../packages/shared/src/entity-types.ts
|
|
30625
|
-
var ENTITY_TYPE_VALUES = [
|
|
30626
|
-
"person",
|
|
30627
|
-
"org",
|
|
30628
|
-
"project",
|
|
30629
|
-
"topic",
|
|
30630
|
-
"place",
|
|
30631
|
-
"object"
|
|
30632
|
-
];
|
|
30633
|
-
|
|
30634
30631
|
// ../node_modules/.pnpm/pako@3.0.3/node_modules/pako/dist/pako.mjs
|
|
30635
30632
|
var Z_FIXED$1 = 4;
|
|
30636
30633
|
var Z_BINARY = 0;
|
|
@@ -30981,7 +30978,7 @@ var scan_tree = (s, tree, max_code) => {
|
|
|
30981
30978
|
let prevlen = -1;
|
|
30982
30979
|
let curlen;
|
|
30983
30980
|
let nextlen = tree[1];
|
|
30984
|
-
let
|
|
30981
|
+
let count2 = 0;
|
|
30985
30982
|
let max_count = 7;
|
|
30986
30983
|
let min_count = 4;
|
|
30987
30984
|
if (nextlen === 0) {
|
|
@@ -30992,14 +30989,14 @@ var scan_tree = (s, tree, max_code) => {
|
|
|
30992
30989
|
for (n = 0; n <= max_code; n++) {
|
|
30993
30990
|
curlen = nextlen;
|
|
30994
30991
|
nextlen = tree[(n + 1) * 2 + 1];
|
|
30995
|
-
if (++
|
|
30996
|
-
else if (
|
|
30992
|
+
if (++count2 < max_count && curlen === nextlen) continue;
|
|
30993
|
+
else if (count2 < min_count) s.bl_tree[curlen * 2] += count2;
|
|
30997
30994
|
else if (curlen !== 0) {
|
|
30998
30995
|
if (curlen !== prevlen) s.bl_tree[curlen * 2]++;
|
|
30999
30996
|
s.bl_tree[REP_3_6 * 2]++;
|
|
31000
|
-
} else if (
|
|
30997
|
+
} else if (count2 <= 10) s.bl_tree[REPZ_3_10 * 2]++;
|
|
31001
30998
|
else s.bl_tree[REPZ_11_138 * 2]++;
|
|
31002
|
-
|
|
30999
|
+
count2 = 0;
|
|
31003
31000
|
prevlen = curlen;
|
|
31004
31001
|
if (nextlen === 0) {
|
|
31005
31002
|
max_count = 138;
|
|
@@ -31018,7 +31015,7 @@ var send_tree = (s, tree, max_code) => {
|
|
|
31018
31015
|
let prevlen = -1;
|
|
31019
31016
|
let curlen;
|
|
31020
31017
|
let nextlen = tree[1];
|
|
31021
|
-
let
|
|
31018
|
+
let count2 = 0;
|
|
31022
31019
|
let max_count = 7;
|
|
31023
31020
|
let min_count = 4;
|
|
31024
31021
|
if (nextlen === 0) {
|
|
@@ -31028,25 +31025,25 @@ var send_tree = (s, tree, max_code) => {
|
|
|
31028
31025
|
for (n = 0; n <= max_code; n++) {
|
|
31029
31026
|
curlen = nextlen;
|
|
31030
31027
|
nextlen = tree[(n + 1) * 2 + 1];
|
|
31031
|
-
if (++
|
|
31032
|
-
else if (
|
|
31028
|
+
if (++count2 < max_count && curlen === nextlen) continue;
|
|
31029
|
+
else if (count2 < min_count) do
|
|
31033
31030
|
send_code(s, curlen, s.bl_tree);
|
|
31034
|
-
while (--
|
|
31031
|
+
while (--count2 !== 0);
|
|
31035
31032
|
else if (curlen !== 0) {
|
|
31036
31033
|
if (curlen !== prevlen) {
|
|
31037
31034
|
send_code(s, curlen, s.bl_tree);
|
|
31038
|
-
|
|
31035
|
+
count2--;
|
|
31039
31036
|
}
|
|
31040
31037
|
send_code(s, REP_3_6, s.bl_tree);
|
|
31041
|
-
send_bits(s,
|
|
31042
|
-
} else if (
|
|
31038
|
+
send_bits(s, count2 - 3, 2);
|
|
31039
|
+
} else if (count2 <= 10) {
|
|
31043
31040
|
send_code(s, REPZ_3_10, s.bl_tree);
|
|
31044
|
-
send_bits(s,
|
|
31041
|
+
send_bits(s, count2 - 3, 3);
|
|
31045
31042
|
} else {
|
|
31046
31043
|
send_code(s, REPZ_11_138, s.bl_tree);
|
|
31047
|
-
send_bits(s,
|
|
31044
|
+
send_bits(s, count2 - 11, 7);
|
|
31048
31045
|
}
|
|
31049
|
-
|
|
31046
|
+
count2 = 0;
|
|
31050
31047
|
prevlen = curlen;
|
|
31051
31048
|
if (nextlen === 0) {
|
|
31052
31049
|
max_count = 138;
|
|
@@ -31916,14 +31913,14 @@ var inflate_table = (type, lens, lens_index, codes, table, table_index, work, op
|
|
|
31916
31913
|
let next;
|
|
31917
31914
|
let base = null;
|
|
31918
31915
|
let match;
|
|
31919
|
-
const
|
|
31916
|
+
const count2 = /* @__PURE__ */ new Uint16Array(16);
|
|
31920
31917
|
const offs = /* @__PURE__ */ new Uint16Array(16);
|
|
31921
31918
|
let extra = null;
|
|
31922
31919
|
let here_bits, here_op, here_val;
|
|
31923
|
-
for (len = 0; len <= MAXBITS; len++)
|
|
31924
|
-
for (sym = 0; sym < codes; sym++)
|
|
31920
|
+
for (len = 0; len <= MAXBITS; len++) count2[len] = 0;
|
|
31921
|
+
for (sym = 0; sym < codes; sym++) count2[lens[lens_index + sym]]++;
|
|
31925
31922
|
root = bits;
|
|
31926
|
-
for (max = MAXBITS; max >= 1; max--) if (
|
|
31923
|
+
for (max = MAXBITS; max >= 1; max--) if (count2[max] !== 0) break;
|
|
31927
31924
|
if (root > max) root = max;
|
|
31928
31925
|
if (max === 0) {
|
|
31929
31926
|
table[table_index++] = 20971520;
|
|
@@ -31931,17 +31928,17 @@ var inflate_table = (type, lens, lens_index, codes, table, table_index, work, op
|
|
|
31931
31928
|
opts.bits = 1;
|
|
31932
31929
|
return 0;
|
|
31933
31930
|
}
|
|
31934
|
-
for (min = 1; min < max; min++) if (
|
|
31931
|
+
for (min = 1; min < max; min++) if (count2[min] !== 0) break;
|
|
31935
31932
|
if (root < min) root = min;
|
|
31936
31933
|
left = 1;
|
|
31937
31934
|
for (len = 1; len <= MAXBITS; len++) {
|
|
31938
31935
|
left <<= 1;
|
|
31939
|
-
left -=
|
|
31936
|
+
left -= count2[len];
|
|
31940
31937
|
if (left < 0) return -1;
|
|
31941
31938
|
}
|
|
31942
31939
|
if (left > 0 && (type === CODES$1 || max !== 1)) return -1;
|
|
31943
31940
|
offs[1] = 0;
|
|
31944
|
-
for (len = 1; len < MAXBITS; len++) offs[len + 1] = offs[len] +
|
|
31941
|
+
for (len = 1; len < MAXBITS; len++) offs[len + 1] = offs[len] + count2[len];
|
|
31945
31942
|
for (sym = 0; sym < codes; sym++) if (lens[lens_index + sym] !== 0) work[offs[lens[lens_index + sym]]++] = sym;
|
|
31946
31943
|
if (type === CODES$1) {
|
|
31947
31944
|
base = extra = work;
|
|
@@ -31991,7 +31988,7 @@ var inflate_table = (type, lens, lens_index, codes, table, table_index, work, op
|
|
|
31991
31988
|
huff += incr;
|
|
31992
31989
|
} else huff = 0;
|
|
31993
31990
|
sym++;
|
|
31994
|
-
if (--
|
|
31991
|
+
if (--count2[len] === 0) {
|
|
31995
31992
|
if (len === max) break;
|
|
31996
31993
|
len = lens[lens_index + work[sym]];
|
|
31997
31994
|
}
|
|
@@ -32001,7 +31998,7 @@ var inflate_table = (type, lens, lens_index, codes, table, table_index, work, op
|
|
|
32001
31998
|
curr = len - drop;
|
|
32002
31999
|
left = 1 << curr;
|
|
32003
32000
|
while (curr + drop < max) {
|
|
32004
|
-
left -=
|
|
32001
|
+
left -= count2[curr + drop];
|
|
32005
32002
|
if (left <= 0) break;
|
|
32006
32003
|
curr++;
|
|
32007
32004
|
left <<= 1;
|
|
@@ -33261,8 +33258,9 @@ var selectPublicActivityRead = external_exports.object(activityReadFields);
|
|
|
33261
33258
|
|
|
33262
33259
|
// ../packages/shared/src/entity-read-operation-results.ts
|
|
33263
33260
|
var id11 = external_exports.string().min(1);
|
|
33264
|
-
var
|
|
33265
|
-
var
|
|
33261
|
+
var entityImage = { imageId: id11.optional() };
|
|
33262
|
+
var entityReadDocument = external_exports.strictObject({ ...publicEntityReadDto.shape, ...entityImage });
|
|
33263
|
+
var entityReadRichDocument = external_exports.strictObject({ ...entityReadDocument.shape, displayName: external_exports.string(), parentNames: external_exports.array(external_exports.string()), parentDetails: external_exports.array(readParentDetail) });
|
|
33266
33264
|
var entityReadActivity = publicActivityReadDto;
|
|
33267
33265
|
var parentDetail = readParentDetail;
|
|
33268
33266
|
var space = external_exports.strictObject({ spaceId: id11, spaceName: external_exports.string(), memberEmails: external_exports.array(external_exports.string()), scope: external_exports.string().optional() });
|
|
@@ -33271,15 +33269,17 @@ var task = external_exports.strictObject({ activityId: id11, title: external_exp
|
|
|
33271
33269
|
var pin = external_exports.strictObject({ entityId: id11, name: external_exports.string(), type: external_exports.enum(ENTITY_TYPE_VALUES), role: external_exports.string().optional(), displayOrder: external_exports.number().optional(), includeInAggregation: external_exports.boolean() });
|
|
33272
33270
|
var child = external_exports.strictObject({ entityId: id11, name: external_exports.string(), displayName: external_exports.string(), parentNames: external_exports.array(external_exports.string()), parentDetails: external_exports.array(parentDetail), type: external_exports.enum(ENTITY_TYPE_VALUES) });
|
|
33273
33271
|
var matchFields = { spaceIds: external_exports.array(id11), openTasks: external_exports.array(task), descriptionPlainText: external_exports.string().optional(), activityCount: external_exports.number(), activityCountPartial: external_exports.boolean().optional(), lastActivityAt: external_exports.number().optional() };
|
|
33274
|
-
var
|
|
33272
|
+
var listPageFields = { hasMore: external_exports.boolean().optional(), nextCursor: external_exports.string().min(1).optional() };
|
|
33273
|
+
var entityReadFullList = external_exports.strictObject({ entities: external_exports.array(external_exports.strictObject({ entity: entityReadDocument, ...matchFields })), spaces: external_exports.record(external_exports.string(), space), openTasksPartial: external_exports.boolean().optional(), truncated: external_exports.boolean().optional(), ...listPageFields });
|
|
33275
33274
|
var entityReadFullSearch = external_exports.strictObject({ entities: external_exports.array(external_exports.strictObject({ entity: entityReadRichDocument, ...matchFields, pins: external_exports.array(pin), matchedViaParent: external_exports.strictObject({ entityId: id11, name: external_exports.string() }).optional() })), spaces: external_exports.record(external_exports.string(), space) });
|
|
33276
33275
|
var entityReadFullDetail = external_exports.strictObject({ entity: entityReadRichDocument, pins: external_exports.array(pin), children: external_exports.array(child), childrenTruncated: external_exports.boolean(), aggregationMode: external_exports.enum(["includeDirectChildren", "directOnly"]), activities: external_exports.array(entityReadActivity), openTasks: external_exports.array(task), spaces: external_exports.array(space), descriptionPlainText: external_exports.string().optional() }).nullable();
|
|
33277
33276
|
var selectSpace = external_exports.object(space.shape);
|
|
33278
|
-
var
|
|
33279
|
-
var
|
|
33277
|
+
var selectEntity = external_exports.object({ ...selectPublicEntityRead.shape, ...entityImage });
|
|
33278
|
+
var selectList = external_exports.object({ ...entityReadFullList.shape, entities: external_exports.array(external_exports.object({ entity: selectEntity, ...matchFields })), spaces: external_exports.record(external_exports.string(), selectSpace) });
|
|
33279
|
+
var selectRichEntity = external_exports.object({ ...selectEntity.shape, displayName: external_exports.string(), parentNames: external_exports.array(external_exports.string()), parentDetails: external_exports.array(readParentDetail) });
|
|
33280
33280
|
var selectSearch = external_exports.object({ ...entityReadFullSearch.shape, entities: external_exports.array(external_exports.object({ entity: selectRichEntity, ...matchFields, pins: external_exports.array(pin), matchedViaParent: external_exports.strictObject({ entityId: id11, name: external_exports.string() }).optional() })), spaces: external_exports.record(external_exports.string(), selectSpace) });
|
|
33281
33281
|
var selectDetail = external_exports.object({ ...entityReadFullDetail.unwrap().shape, entity: selectRichEntity, activities: external_exports.array(selectPublicActivityRead), spaces: external_exports.array(selectSpace) }).nullable();
|
|
33282
|
-
var compactEntity = external_exports.strictObject(entityReadRichDocument.shape).pick({ _id: true, name: true, displayName: true, parentNames: true, parentDetails: true, type: true, descriptionPlainText: true, tags: true, aliases: true, lastActivityAt: true, fields: true }).partial({ displayName: true, parentNames: true, parentDetails: true });
|
|
33282
|
+
var compactEntity = external_exports.strictObject(entityReadRichDocument.shape).pick({ _id: true, name: true, displayName: true, parentNames: true, parentDetails: true, type: true, imageId: true, descriptionPlainText: true, tags: true, aliases: true, lastActivityAt: true, fields: true }).partial({ displayName: true, parentNames: true, parentDetails: true });
|
|
33283
33283
|
var compactActivity = entityReadActivity.pick({ fields: true, _id: true, shortId: true, title: true, type: true, contentPlainText: true, deadline: true, completed: true, tags: true, createdAt: true, updatedAt: true, spaceId: true });
|
|
33284
33284
|
var compactList = entityReadFullList.extend({ entities: external_exports.array(external_exports.strictObject({ entity: compactEntity, ...matchFields })), spaces: external_exports.record(external_exports.string(), compactSpace) });
|
|
33285
33285
|
var compactSearch = entityReadFullSearch.extend({ entities: external_exports.array(external_exports.strictObject({ entity: compactEntity, ...matchFields, pins: external_exports.array(pin), matchedViaParent: external_exports.strictObject({ entityId: id11, name: external_exports.string() }).optional() })), spaces: external_exports.record(external_exports.string(), compactSpace) });
|
|
@@ -33355,8 +33355,8 @@ var ENTITY_CREATE_INPUT_SCHEMA = {
|
|
|
33355
33355
|
function isEntityType(value) {
|
|
33356
33356
|
return typeof value === "string" && ENTITY_TYPE_VALUES.some((type) => type === value);
|
|
33357
33357
|
}
|
|
33358
|
-
var invalid2 = (
|
|
33359
|
-
function parseEntityCreateInput(args, name4 = "
|
|
33358
|
+
var invalid2 = (message3) => ({ ok: false, message: message3 });
|
|
33359
|
+
function parseEntityCreateInput(args, name4 = "createEntity") {
|
|
33360
33360
|
if (Object.hasOwn(args, "attributes")) return invalid2(LEGACY_ENTITY_ATTRIBUTES_ERROR);
|
|
33361
33361
|
if (args.parentEntityId !== void 0 && (typeof args.parentEntityId !== "string" || !args.parentEntityId.trim()))
|
|
33362
33362
|
return invalid2("parentEntityId must be a non-empty string");
|
|
@@ -33386,7 +33386,7 @@ function parseEntityCreateInput(args, name4 = "entities_create") {
|
|
|
33386
33386
|
...spaceIds?.length ? { spaceIds } : {}
|
|
33387
33387
|
} };
|
|
33388
33388
|
}
|
|
33389
|
-
function parseEntityUpdateInput(args, name4 = "
|
|
33389
|
+
function parseEntityUpdateInput(args, name4 = "updateEntity") {
|
|
33390
33390
|
if (Object.hasOwn(args, "attributes")) return invalid2(LEGACY_ENTITY_ATTRIBUTES_ERROR);
|
|
33391
33391
|
if (args.allowNonExclusiveChildren !== void 0 && typeof args.allowNonExclusiveChildren !== "boolean") return invalid2("allowNonExclusiveChildren must be a boolean");
|
|
33392
33392
|
if (typeof args.entityId !== "string") return invalid2(`${name4} requires string entityId`);
|
|
@@ -33411,8 +33411,8 @@ var ENTITY_IMAGE_MAX_DIMENSION = 256;
|
|
|
33411
33411
|
var ENTITY_IMAGE_OUTPUT_SIZE = 192;
|
|
33412
33412
|
var ENTITY_IMAGE_DATA_URI_MAX_LENGTH = 23 + Math.ceil(ENTITY_IMAGE_MAX_BYTES / 3) * 4;
|
|
33413
33413
|
var EntityImageError = class extends Error {
|
|
33414
|
-
constructor(
|
|
33415
|
-
super(
|
|
33414
|
+
constructor(message3) {
|
|
33415
|
+
super(message3);
|
|
33416
33416
|
this.name = "EntityImageError";
|
|
33417
33417
|
}
|
|
33418
33418
|
};
|
|
@@ -33530,7 +33530,8 @@ var entityWriteInputs = {
|
|
|
33530
33530
|
removeFieldValue: external_exports.strictObject({ valueId: id12 }),
|
|
33531
33531
|
archiveEntity: external_exports.strictObject({ entityId: id12 }),
|
|
33532
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() })
|
|
33533
|
+
setEntityImage: external_exports.strictObject({ entityId: id12, spaceId: id12.optional(), image: external_exports.string().max(ENTITY_IMAGE_DATA_URI_MAX_LENGTH).nullable() }),
|
|
33534
|
+
mergeEntity: external_exports.strictObject({ sourceEntityId: id12, targetEntityId: id12, dryRun: external_exports.boolean().default(false), grantMissingParentAccess: external_exports.boolean().optional(), parentSpaceGrantFingerprint: external_exports.string().trim().min(1).optional() })
|
|
33534
33535
|
};
|
|
33535
33536
|
function parserMismatch2(operation) {
|
|
33536
33537
|
throw new OperationInputError(operation, [{ path: [], reason: "custom" }]);
|
|
@@ -33568,6 +33569,8 @@ function parseEntityWriteRequest(operation, raw) {
|
|
|
33568
33569
|
return { operation, input: parseOperationInput(operation, entityWriteInputs.restoreEntity, raw) };
|
|
33569
33570
|
case "setEntityImage":
|
|
33570
33571
|
return { operation, input: parseOperationInput(operation, entityWriteInputs.setEntityImage, raw) };
|
|
33572
|
+
case "mergeEntity":
|
|
33573
|
+
return { operation, input: parseOperationInput(operation, entityWriteInputs.mergeEntity, raw) };
|
|
33571
33574
|
}
|
|
33572
33575
|
}
|
|
33573
33576
|
function rejectLegacyEntityAttributes(operation, raw) {
|
|
@@ -33585,6 +33588,22 @@ var ENTITY_DUPLICATION_DESCRIPTION = `Duplicate an entity shell in a selected sp
|
|
|
33585
33588
|
// ../packages/shared/src/entity-write-operation-results.ts
|
|
33586
33589
|
var entityId = external_exports.string().min(1);
|
|
33587
33590
|
var success2 = external_exports.strictObject({ success: external_exports.literal(true) });
|
|
33591
|
+
var count = external_exports.number().int().min(0);
|
|
33592
|
+
var spaceRef = external_exports.strictObject({ spaceId: entityId, name: external_exports.string() });
|
|
33593
|
+
var entityMergeSummary = external_exports.strictObject({
|
|
33594
|
+
dryRun: external_exports.boolean(),
|
|
33595
|
+
entityId,
|
|
33596
|
+
name: external_exports.string(),
|
|
33597
|
+
sourceEntityId: entityId,
|
|
33598
|
+
sourceName: external_exports.string(),
|
|
33599
|
+
moved: external_exports.strictObject({ activities: count, relationships: count, whiteboards: count, calendarEvents: count, fieldValues: count, tags: count, aliases: count, description: external_exports.boolean() }),
|
|
33600
|
+
image: external_exports.enum(["target", "source", "none"]),
|
|
33601
|
+
targetSpacesAdded: external_exports.array(spaceRef),
|
|
33602
|
+
sourceSpacesAdded: external_exports.array(spaceRef),
|
|
33603
|
+
parentSpaceGrants: external_exports.array(external_exports.strictObject({ entityId, name: external_exports.string(), missingSpaces: external_exports.array(spaceRef.extend({ memberCount: count, membersTruncated: external_exports.boolean() })) })),
|
|
33604
|
+
parentSpaceGrantFingerprint: external_exports.string().nullable(),
|
|
33605
|
+
requiresPerson: external_exports.boolean()
|
|
33606
|
+
});
|
|
33588
33607
|
var entityWriteResults = {
|
|
33589
33608
|
createEntity: external_exports.strictObject({ entityId }),
|
|
33590
33609
|
updateEntity: success2,
|
|
@@ -33595,7 +33614,8 @@ var entityWriteResults = {
|
|
|
33595
33614
|
addFieldValue: external_exports.strictObject({ valueId: entityId, added: external_exports.boolean() }),
|
|
33596
33615
|
updateFieldValue: success2,
|
|
33597
33616
|
removeFieldValue: success2,
|
|
33598
|
-
setEntityImage: external_exports.strictObject({ entityId, imageId: external_exports.string().min(1).nullable() })
|
|
33617
|
+
setEntityImage: external_exports.strictObject({ entityId, imageId: external_exports.string().min(1).nullable() }),
|
|
33618
|
+
mergeEntity: entityMergeSummary
|
|
33599
33619
|
};
|
|
33600
33620
|
var nativeEntityWriteResults = {
|
|
33601
33621
|
...entityWriteResults,
|
|
@@ -33613,7 +33633,8 @@ var publicCliEntityWriteResults = {
|
|
|
33613
33633
|
updateEntityName: success2.extend({ entityId, name: external_exports.string() }),
|
|
33614
33634
|
archiveEntity: success2.extend({ entityId }),
|
|
33615
33635
|
restoreEntity: success2.extend({ entityId }),
|
|
33616
|
-
setEntityImage: entityWriteResults.setEntityImage
|
|
33636
|
+
setEntityImage: entityWriteResults.setEntityImage,
|
|
33637
|
+
mergeEntity: entityMergeSummary
|
|
33617
33638
|
};
|
|
33618
33639
|
function parsePublicCliEntityWriteResult(operation, raw) {
|
|
33619
33640
|
return checked3(publicCliEntityWriteResults[operation], raw);
|
|
@@ -33634,6 +33655,8 @@ function projectEntityWriteResult(operation, raw) {
|
|
|
33634
33655
|
return checked3(entityWriteResults.addFieldValue, raw);
|
|
33635
33656
|
case "setEntityImage":
|
|
33636
33657
|
return checked3(entityWriteResults.setEntityImage, raw);
|
|
33658
|
+
case "mergeEntity":
|
|
33659
|
+
return checked3(entityWriteResults.mergeEntity, raw);
|
|
33637
33660
|
default:
|
|
33638
33661
|
if (raw !== null) throw new OperationResultError(operation, "Invalid entity write result");
|
|
33639
33662
|
return checked3(success2, { success: true });
|
|
@@ -33682,6 +33705,14 @@ var selectPage = external_exports.object({ activities: external_exports.array(se
|
|
|
33682
33705
|
var fullPage = activityReadFullPage.extend({ projection: external_exports.literal("full") });
|
|
33683
33706
|
var compactPage = activityReadFullPage.extend({ activities: external_exports.array(compactActivity2), projection: external_exports.literal("compact") });
|
|
33684
33707
|
var pages = external_exports.discriminatedUnion("projection", [fullPage, compactPage]);
|
|
33708
|
+
var cliSpace = external_exports.strictObject({ spaceId: id13, spaceName: external_exports.string(), memberEmails: external_exports.array(external_exports.string()), scope: external_exports.string().optional() });
|
|
33709
|
+
var publicCliActivityListEnvelope = external_exports.strictObject({
|
|
33710
|
+
data: external_exports.array(external_exports.union([publicActivityRecordDto, compactActivity2])),
|
|
33711
|
+
hasMore: external_exports.boolean().optional(),
|
|
33712
|
+
nextCursor: external_exports.string().optional(),
|
|
33713
|
+
projection: external_exports.literal("compact").optional(),
|
|
33714
|
+
spaces: external_exports.record(external_exports.string(), cliSpace).optional()
|
|
33715
|
+
});
|
|
33685
33716
|
var taskLookupTombstone = external_exports.strictObject({ projection: external_exports.literal("tombstone"), _id: id13, spaceId: id13, type: external_exports.literal("task"), completed: external_exports.boolean(), deletedAt: external_exports.number() });
|
|
33686
33717
|
var activityReadResults = {
|
|
33687
33718
|
getActivity: external_exports.union([taskLookupTombstone, publicActivityDetailDto.extend({ projection: external_exports.literal("full") }), compactDetail2.extend({ projection: external_exports.literal("compact") }), external_exports.null()]),
|
|
@@ -33700,6 +33731,33 @@ function parseActivityReadResult(name4, raw) {
|
|
|
33700
33731
|
function checked4(schema, raw) {
|
|
33701
33732
|
return parseZodOperationResult("activityRead", schema, raw, "Invalid activity read result");
|
|
33702
33733
|
}
|
|
33734
|
+
var richAttachment = external_exports.object({ ...publicActivityReadDto.shape.attachments.unwrap().element.shape, url: external_exports.string().nullable().optional(), attachmentId: external_exports.string().optional() });
|
|
33735
|
+
var richUser = external_exports.object(publicActivityDetailDto.shape.createdByUser.unwrap().shape);
|
|
33736
|
+
var richAgent = external_exports.object(publicActivityDetailDto.shape.createdByAgent.unwrap().unwrap().shape);
|
|
33737
|
+
var richAgentCreator = external_exports.object(publicActivityDetailDto.shape.createdByAgentCreatorUser.unwrap().unwrap().shape);
|
|
33738
|
+
var richAgenda = external_exports.object(publicActivityDetailDto.shape.agendaPoints.element.shape);
|
|
33739
|
+
var richMessage = external_exports.object({
|
|
33740
|
+
...publicActivityDetailDto.shape.messages.element.shape,
|
|
33741
|
+
createdByUser: richUser.nullable(),
|
|
33742
|
+
createdByAgent: richAgent.nullable().optional(),
|
|
33743
|
+
updatedByAgent: richAgent.nullable().optional()
|
|
33744
|
+
});
|
|
33745
|
+
var activityRichRecord = external_exports.object({
|
|
33746
|
+
...publicActivityReadDto.shape,
|
|
33747
|
+
attachments: external_exports.array(richAttachment).optional(),
|
|
33748
|
+
entityIds: external_exports.array(external_exports.string()).optional(),
|
|
33749
|
+
entityDetails: external_exports.array(selectPublicEntityRead.nullable()).optional(),
|
|
33750
|
+
agendaPoints: external_exports.array(richAgenda).optional(),
|
|
33751
|
+
messages: external_exports.array(richMessage).optional(),
|
|
33752
|
+
createdByUser: richUser.nullable().optional(),
|
|
33753
|
+
createdViaAgent: richAgent.nullable().optional(),
|
|
33754
|
+
updatedViaAgent: richAgent.nullable().optional(),
|
|
33755
|
+
createdByPersonalAgent: external_exports.boolean().optional(),
|
|
33756
|
+
createdByAgent: richAgent.nullable().optional(),
|
|
33757
|
+
updatedByAgent: richAgent.nullable().optional(),
|
|
33758
|
+
createdByAgentCreatorUser: richAgentCreator.nullable().optional(),
|
|
33759
|
+
assignees: external_exports.array(external_exports.object({ userId: external_exports.string(), name: external_exports.string().optional(), email: external_exports.string().optional() })).optional()
|
|
33760
|
+
});
|
|
33703
33761
|
|
|
33704
33762
|
// ../packages/shared/src/agent-tasks.ts
|
|
33705
33763
|
var AGENT_TASK_PAGE_MAX = 100;
|
|
@@ -33743,7 +33801,7 @@ var fields2 = {
|
|
|
33743
33801
|
release: ["assignmentId", "claimToken"]
|
|
33744
33802
|
};
|
|
33745
33803
|
function validateAgentTaskInput(raw) {
|
|
33746
|
-
const invalid5 = (
|
|
33804
|
+
const invalid5 = (message3) => ({ ok: false, message: message3 });
|
|
33747
33805
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return invalid5("Task input must be an object");
|
|
33748
33806
|
const input2 = raw;
|
|
33749
33807
|
if (!AGENT_TASK_OPERATIONS.includes(input2.operation)) return invalid5("Unknown task operation");
|
|
@@ -34085,6 +34143,26 @@ function parseAgentSelfTaskDiagnosticRequest(operation, raw) {
|
|
|
34085
34143
|
}
|
|
34086
34144
|
}
|
|
34087
34145
|
|
|
34146
|
+
// ../packages/shared/src/task-read-operations.ts
|
|
34147
|
+
var TASK_READ_LIMITS = { results: 200, children: 100, childLinks: 1e3, childSources: 400 };
|
|
34148
|
+
var id14 = external_exports.string().min(1).max(128);
|
|
34149
|
+
var list = { field: activityFieldFiltersSchema.optional(), spaceId: id14.optional(), entityId: id14.optional(), onlyOpen: external_exports.boolean().default(true), dueBy: activityWriteDeadline.optional(), assignee: external_exports.enum(["me", "meOrUnassigned", "unassigned"]).optional(), assigneeUserId: id14.optional(), assigneeEmail: external_exports.string().optional(), assigneeAgentId: id14.optional(), agentTaskDisplay: external_exports.enum(["show", "dim", "hideAgentOnly", "hideAllWithAgent"]).optional() };
|
|
34150
|
+
var taskReadInputs = {
|
|
34151
|
+
listTasks: external_exports.strictObject(list),
|
|
34152
|
+
getTaskByNumber: external_exports.strictObject({ number: external_exports.number().int().positive().max(Number.MAX_SAFE_INTEGER), spaceId: id14.optional() }),
|
|
34153
|
+
listOpenTasks: external_exports.strictObject({ spaceId: id14 }),
|
|
34154
|
+
listTasksDueBy: external_exports.strictObject({ spaceId: id14, deadline: activityWriteDeadline, includeOverdue: external_exports.boolean().default(true) }),
|
|
34155
|
+
listOpenTasksForEntity: external_exports.strictObject({ entityId: id14 })
|
|
34156
|
+
};
|
|
34157
|
+
|
|
34158
|
+
// ../packages/shared/src/task-read-operation-results.ts
|
|
34159
|
+
var taskReadEntity = external_exports.strictObject({ entityId: external_exports.string().min(1), name: external_exports.string(), type: external_exports.enum(ENTITY_TYPE_VALUES) });
|
|
34160
|
+
var taskReadItem = external_exports.strictObject({ activity: publicActivityReadDto.extend({ type: external_exports.literal("task") }), entities: external_exports.array(taskReadEntity) });
|
|
34161
|
+
var selectTask = selectPublicActivityRead.extend({ type: external_exports.literal("task"), attachments: external_exports.array(external_exports.object(publicActivityReadDto.shape.attachments.unwrap().element.shape)).optional() });
|
|
34162
|
+
var selection = external_exports.object({ activity: selectTask, entities: external_exports.array(external_exports.object(taskReadEntity.shape)) });
|
|
34163
|
+
var tasks = external_exports.array(taskReadItem).max(TASK_READ_LIMITS.results);
|
|
34164
|
+
var taskReadResults = { listTasks: tasks, getTaskByNumber: taskReadItem.nullable(), listOpenTasks: tasks, listTasksDueBy: tasks, listOpenTasksForEntity: tasks };
|
|
34165
|
+
|
|
34088
34166
|
// ../packages/shared/src/agenda-operation-results.ts
|
|
34089
34167
|
var AGENDA_TASK_RESULT_LIMIT = 20;
|
|
34090
34168
|
var AGENDA_TASK_OWNER_LIMIT = 8;
|
|
@@ -34143,8 +34221,8 @@ function parseAgendaCreateResponse(raw) {
|
|
|
34143
34221
|
}
|
|
34144
34222
|
|
|
34145
34223
|
// ../packages/shared/src/agenda-operations.ts
|
|
34146
|
-
var
|
|
34147
|
-
var activityId =
|
|
34224
|
+
var id15 = external_exports.string().min(1).max(128).refine((value) => value.trim() === value, "Copy IDs unchanged");
|
|
34225
|
+
var activityId = id15.describe("Existing activity ID of any type; the legacy field name remains compatible.");
|
|
34148
34226
|
var title = external_exports.string().trim().min(1);
|
|
34149
34227
|
var version4 = external_exports.number().int().nonnegative().nullable();
|
|
34150
34228
|
var agendaInputs = {
|
|
@@ -34152,29 +34230,22 @@ var agendaInputs = {
|
|
|
34152
34230
|
meetingActivityId: activityId,
|
|
34153
34231
|
title: title.describe("Agenda title. Entity mentions use [entity](ente://entity/<entityId>)."),
|
|
34154
34232
|
contentMarkdown: external_exports.string().describe(ACTIVITY_BODY_MARKDOWN_DESCRIPTION).optional(),
|
|
34155
|
-
parentPointId:
|
|
34156
|
-
afterPointId:
|
|
34233
|
+
parentPointId: id15.optional(),
|
|
34234
|
+
afterPointId: id15.optional()
|
|
34157
34235
|
}),
|
|
34158
34236
|
getMeetingAgenda: external_exports.strictObject({ meetingActivityId: activityId }),
|
|
34159
34237
|
updateAgendaPointTitle: external_exports.strictObject({
|
|
34160
|
-
agendaPointId:
|
|
34238
|
+
agendaPointId: id15,
|
|
34161
34239
|
title,
|
|
34162
34240
|
expectedUpdatedAt: external_exports.number().nonnegative()
|
|
34163
34241
|
}),
|
|
34164
34242
|
replaceAgendaPointContent: external_exports.strictObject({
|
|
34165
|
-
agendaPointId:
|
|
34243
|
+
agendaPointId: id15,
|
|
34166
34244
|
contentMarkdown: external_exports.string().describe(ACTIVITY_BODY_MARKDOWN_DESCRIPTION),
|
|
34167
34245
|
expectedContentVersion: version4
|
|
34168
34246
|
}),
|
|
34169
34247
|
searchMeetingTasks: external_exports.strictObject({ meetingActivityId: activityId, query: external_exports.string().trim().min(1) })
|
|
34170
34248
|
};
|
|
34171
|
-
var agendaAliases = {
|
|
34172
|
-
agenda_points_create: "createAgendaPoint",
|
|
34173
|
-
agenda_points_get: "getMeetingAgenda",
|
|
34174
|
-
agenda_points_update_title: "updateAgendaPointTitle",
|
|
34175
|
-
agenda_points_replace_content: "replaceAgendaPointContent",
|
|
34176
|
-
meeting_tasks_search: "searchMeetingTasks"
|
|
34177
|
-
};
|
|
34178
34249
|
var descriptions3 = {
|
|
34179
34250
|
createAgendaPoint: "Create a titled agenda point with optional Markdown on an existing activity of any type. Prefer agenda points for structured content unless the user's prompt requests another format.",
|
|
34180
34251
|
getMeetingAgenda: "Read the ordered agenda of an existing activity of any type, including nested point IDs, plain and Markdown titles, markdown content, versions and timestamps. Read before updating a point.",
|
|
@@ -34189,7 +34260,7 @@ function buildAgendaDefinition(name4) {
|
|
|
34189
34260
|
const schema = external_exports.toJSONSchema(agendaInputs[name4], { io: "input" });
|
|
34190
34261
|
return {
|
|
34191
34262
|
name: name4,
|
|
34192
|
-
aliases:
|
|
34263
|
+
aliases: [],
|
|
34193
34264
|
actor: "agent",
|
|
34194
34265
|
description: descriptions3[name4],
|
|
34195
34266
|
inputSchema: {
|
|
@@ -34223,7 +34294,7 @@ var HEALTH_SERIES_KEY_PATTERN = /^[a-z][a-z0-9_]{0,39}$/;
|
|
|
34223
34294
|
var HEALTH_SERIES_LABEL_MAX_LENGTH = 60;
|
|
34224
34295
|
var HEALTH_SERIES_UNIT_MAX_LENGTH = 16;
|
|
34225
34296
|
var HEALTH_SERIES_DESCRIPTION_MAX_LENGTH = 160;
|
|
34226
|
-
var HEALTH_SERIES_MAX_PER_USER =
|
|
34297
|
+
var HEALTH_SERIES_MAX_PER_USER = 50;
|
|
34227
34298
|
var HEALTH_RECORD_MAX_POINTS = 500;
|
|
34228
34299
|
var HEALTH_RECORD_MAX_REMOVALS = 500;
|
|
34229
34300
|
var HEALTH_READ_MAX_DAYS = 800;
|
|
@@ -34232,14 +34303,15 @@ var HEALTH_SERIES_REMOVE_MAX_POINTS = 4e3;
|
|
|
34232
34303
|
var HEALTH_VALUE_ABS_MAX = 1e9;
|
|
34233
34304
|
var HEALTH_INTRADAY_MAX_DAYS_PER_RECORD = 14;
|
|
34234
34305
|
var HEALTH_INTRADAY_READ_MAX_VALUES = 2e4;
|
|
34306
|
+
var HEALTH_BETTER_VALUES = ["higher", "lower", "neutral"];
|
|
34235
34307
|
var HealthMeasurementError = class extends Error {
|
|
34236
|
-
constructor(
|
|
34237
|
-
super(
|
|
34308
|
+
constructor(message3) {
|
|
34309
|
+
super(message3);
|
|
34238
34310
|
this.name = "HealthMeasurementError";
|
|
34239
34311
|
}
|
|
34240
34312
|
};
|
|
34241
|
-
var fail = (
|
|
34242
|
-
throw new HealthMeasurementError(
|
|
34313
|
+
var fail = (message3) => {
|
|
34314
|
+
throw new HealthMeasurementError(message3);
|
|
34243
34315
|
};
|
|
34244
34316
|
var DAY_PATTERN = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
34245
34317
|
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})?$/;
|
|
@@ -34311,12 +34383,13 @@ function parseHealthSeriesKey(value, field = "series") {
|
|
|
34311
34383
|
}
|
|
34312
34384
|
function parseHealthSeriesDefinition(value, field = "series") {
|
|
34313
34385
|
const raw = record2(value, field);
|
|
34314
|
-
onlyKeys(raw, ["key", "label", "unit", "description", "better", "scale", "bands", "resolution"], field);
|
|
34386
|
+
onlyKeys(raw, ["key", "label", "unit", "description", "better", "scale", "bands", "resolution", "hidden"], field);
|
|
34315
34387
|
const key = parseHealthSeriesKey(raw.key, `${field}.key`);
|
|
34316
34388
|
const label = text2(raw.label, `${field}.label`, HEALTH_SERIES_LABEL_MAX_LENGTH, true);
|
|
34317
34389
|
const unit = text2(raw.unit, `${field}.unit`, HEALTH_SERIES_UNIT_MAX_LENGTH, false);
|
|
34318
34390
|
const description = text2(raw.description, `${field}.description`, HEALTH_SERIES_DESCRIPTION_MAX_LENGTH, false);
|
|
34319
|
-
if (
|
|
34391
|
+
if (!HEALTH_BETTER_VALUES.includes(raw.better)) fail(`${field}.better must be "higher", "lower" or "neutral"`);
|
|
34392
|
+
if (raw.hidden !== void 0 && raw.hidden !== null && typeof raw.hidden !== "boolean") fail(`${field}.hidden must be true or false`);
|
|
34320
34393
|
const better2 = raw.better;
|
|
34321
34394
|
let scale;
|
|
34322
34395
|
if (raw.scale !== void 0 && raw.scale !== null) {
|
|
@@ -34344,10 +34417,11 @@ function parseHealthSeriesDefinition(value, field = "series") {
|
|
|
34344
34417
|
...description ? { description } : {},
|
|
34345
34418
|
...scale ? { scale } : {},
|
|
34346
34419
|
...bands ? { bands } : {},
|
|
34347
|
-
...raw.resolution === "intraday" ? { resolution: "intraday" } : {}
|
|
34420
|
+
...raw.resolution === "intraday" ? { resolution: "intraday" } : {},
|
|
34421
|
+
...raw.hidden === true ? { hidden: true } : {}
|
|
34348
34422
|
};
|
|
34349
34423
|
}
|
|
34350
|
-
function
|
|
34424
|
+
function list2(value, field, max) {
|
|
34351
34425
|
if (value === void 0 || value === null) return [];
|
|
34352
34426
|
if (!Array.isArray(value)) return fail(`${field} must be a list`);
|
|
34353
34427
|
if (value.length > max) fail(`${field} accepts at most ${max} items`);
|
|
@@ -34377,14 +34451,14 @@ var positionKey = (series, position) => `${series}|${position.day}|${position.mi
|
|
|
34377
34451
|
function parseHealthRecordRequest(value) {
|
|
34378
34452
|
const raw = record2(value, "request");
|
|
34379
34453
|
onlyKeys(raw, ["series", "points", "intraday", "remove", "removeSeries"], "request");
|
|
34380
|
-
const series =
|
|
34454
|
+
const series = list2(raw.series, "series", HEALTH_SERIES_MAX_PER_USER).map((item, index) => parseHealthSeriesDefinition(item, `series[${index}]`));
|
|
34381
34455
|
const seriesKeys = /* @__PURE__ */ new Set();
|
|
34382
34456
|
for (const definition7 of series) {
|
|
34383
34457
|
if (seriesKeys.has(definition7.key)) fail(`series ${definition7.key} is defined twice`);
|
|
34384
34458
|
seriesKeys.add(definition7.key);
|
|
34385
34459
|
}
|
|
34386
34460
|
const seen = /* @__PURE__ */ new Set();
|
|
34387
|
-
const points =
|
|
34461
|
+
const points = list2(raw.points, "points", HEALTH_RECORD_MAX_POINTS).map((item, index) => {
|
|
34388
34462
|
const field = `points[${index}]`;
|
|
34389
34463
|
const point2 = record2(item, field);
|
|
34390
34464
|
onlyKeys(point2, ["series", "at", "value"], field);
|
|
@@ -34398,7 +34472,7 @@ function parseHealthRecordRequest(value) {
|
|
|
34398
34472
|
seen.add(key);
|
|
34399
34473
|
return parsed;
|
|
34400
34474
|
});
|
|
34401
|
-
const remove =
|
|
34475
|
+
const remove = list2(raw.remove, "remove", HEALTH_RECORD_MAX_REMOVALS).map((item, index) => {
|
|
34402
34476
|
const field = `remove[${index}]`;
|
|
34403
34477
|
const ref = record2(item, field);
|
|
34404
34478
|
onlyKeys(ref, ["series", "at"], field);
|
|
@@ -34406,13 +34480,13 @@ function parseHealthRecordRequest(value) {
|
|
|
34406
34480
|
if (seen.has(positionKey(parsed.series, parsed.position))) fail(`${field} also appears in points`);
|
|
34407
34481
|
return parsed;
|
|
34408
34482
|
});
|
|
34409
|
-
const removeSeries =
|
|
34483
|
+
const removeSeries = list2(raw.removeSeries, "removeSeries", HEALTH_SERIES_MAX_PER_USER).map((item, index) => parseHealthSeriesKey(item, `removeSeries[${index}]`));
|
|
34410
34484
|
for (const key of removeSeries) {
|
|
34411
34485
|
if (seriesKeys.has(key)) fail(`series ${key} cannot be defined and removed in one request`);
|
|
34412
34486
|
if (points.some((point2) => point2.series === key)) fail(`series ${key} cannot receive points and be removed in one request`);
|
|
34413
34487
|
}
|
|
34414
34488
|
const intradaySeen = /* @__PURE__ */ new Set();
|
|
34415
|
-
const intraday =
|
|
34489
|
+
const intraday = list2(raw.intraday, "intraday", HEALTH_INTRADAY_MAX_DAYS_PER_RECORD).map((item, index) => {
|
|
34416
34490
|
const block = parseHealthIntradayDay(item, `intraday[${index}]`);
|
|
34417
34491
|
const key = `${block.series}|${block.day}`;
|
|
34418
34492
|
if (intradaySeen.has(key)) fail(`intraday[${index}] repeats ${block.series} on ${block.day}`);
|
|
@@ -34433,12 +34507,12 @@ function parseHealthListRequest(value) {
|
|
|
34433
34507
|
const span = healthDayDiff(from, to);
|
|
34434
34508
|
if (span < 0) fail("to must not be before from");
|
|
34435
34509
|
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 :
|
|
34510
|
+
const series = raw.series === void 0 || raw.series === null ? void 0 : list2(raw.series, "series", HEALTH_SERIES_MAX_PER_USER).map((item, index) => parseHealthSeriesKey(item, `series[${index}]`));
|
|
34437
34511
|
return { from, to, ...series ? { series } : {} };
|
|
34438
34512
|
}
|
|
34439
34513
|
|
|
34440
34514
|
// ../packages/shared/src/health-measurement-operations.ts
|
|
34441
|
-
var better = v2.union(v2.literal("higher"), v2.literal("lower"));
|
|
34515
|
+
var better = v2.union(v2.literal("higher"), v2.literal("lower"), v2.literal("neutral"));
|
|
34442
34516
|
var healthSeriesViewValidator = v2.object({
|
|
34443
34517
|
key: v2.string(),
|
|
34444
34518
|
label: v2.string(),
|
|
@@ -34484,10 +34558,6 @@ var healthMeasurementResults = {
|
|
|
34484
34558
|
recordHealthMeasurements: healthRecordResultValidator,
|
|
34485
34559
|
listHealthMeasurements: healthListResultValidator
|
|
34486
34560
|
};
|
|
34487
|
-
var healthMeasurementAliases = {
|
|
34488
|
-
health_measurements_record: "recordHealthMeasurements",
|
|
34489
|
-
health_measurements_list: "listHealthMeasurements"
|
|
34490
|
-
};
|
|
34491
34561
|
function invalid3(operation, error62) {
|
|
34492
34562
|
if (error62 instanceof HealthMeasurementError) throw new OperationInputError(operation, [{ path: [], reason: "custom" }], error62.message);
|
|
34493
34563
|
throw error62;
|
|
@@ -34504,7 +34574,7 @@ function parseHealthMeasurementRequest(operation, raw) {
|
|
|
34504
34574
|
}
|
|
34505
34575
|
}
|
|
34506
34576
|
var seriesRef = { type: "string" };
|
|
34507
|
-
var at = { type: "string", description: "YYYY-MM-DD or local YYYY-MM-DDTHH:MM
|
|
34577
|
+
var at = { type: "string", description: "YYYY-MM-DD or local YYYY-MM-DDTHH:MM" };
|
|
34508
34578
|
var pair2 = (lower, upper) => ({
|
|
34509
34579
|
type: "object",
|
|
34510
34580
|
additionalProperties: false,
|
|
@@ -34527,10 +34597,11 @@ var recordInputSchema = {
|
|
|
34527
34597
|
label: { type: "string", minLength: 1, maxLength: HEALTH_SERIES_LABEL_MAX_LENGTH },
|
|
34528
34598
|
unit: { type: "string", maxLength: HEALTH_SERIES_UNIT_MAX_LENGTH },
|
|
34529
34599
|
description: { type: "string", maxLength: HEALTH_SERIES_DESCRIPTION_MAX_LENGTH },
|
|
34530
|
-
better: { enum: ["higher", "lower"] },
|
|
34600
|
+
better: { enum: ["higher", "lower", "neutral"] },
|
|
34531
34601
|
scale: pair2("min", "max"),
|
|
34532
34602
|
bands: { ...pair2("lower", "upper"), description: "Omit for personal bands" },
|
|
34533
|
-
resolution: { enum: ["day", "intraday"] }
|
|
34603
|
+
resolution: { enum: ["day", "intraday"] },
|
|
34604
|
+
hidden: { type: "boolean" }
|
|
34534
34605
|
}
|
|
34535
34606
|
}
|
|
34536
34607
|
},
|
|
@@ -34569,21 +34640,21 @@ var listInputSchema = {
|
|
|
34569
34640
|
additionalProperties: false,
|
|
34570
34641
|
properties: {
|
|
34571
34642
|
from: day,
|
|
34572
|
-
to: { ...day, description: `Inclusive
|
|
34643
|
+
to: { ...day, description: `Inclusive, at most ${HEALTH_READ_MAX_DAYS} days after from` },
|
|
34573
34644
|
series: { type: "array", maxItems: HEALTH_SERIES_MAX_PER_USER, items: seriesRef }
|
|
34574
34645
|
},
|
|
34575
34646
|
required: ["from", "to"]
|
|
34576
34647
|
};
|
|
34577
34648
|
var ownerOnly = " Owner's own personal agent only.";
|
|
34578
34649
|
var descriptions4 = {
|
|
34579
|
-
recordHealthMeasurements: "Write the owner's health
|
|
34650
|
+
recordHealthMeasurements: "Write the owner's calendar health data: define series, then send points or intraday days. Same series+at replaces; remove/removeSeries delete." + ownerOnly,
|
|
34580
34651
|
listHealthMeasurements: `Read the owner's health series, points and intraday days from..to (inclusive), max ${HEALTH_READ_MAX_POINTS} points.` + ownerOnly
|
|
34581
34652
|
};
|
|
34582
34653
|
function definition2(name4, inputSchema2) {
|
|
34583
34654
|
const resultSchema3 = operationResultSchema(healthMeasurementResults[name4]);
|
|
34584
34655
|
return {
|
|
34585
34656
|
name: name4,
|
|
34586
|
-
aliases:
|
|
34657
|
+
aliases: [],
|
|
34587
34658
|
actor: "agent",
|
|
34588
34659
|
description: descriptions4[name4],
|
|
34589
34660
|
inputSchema: inputSchema2,
|
|
@@ -34773,7 +34844,7 @@ var RestClient = class {
|
|
|
34773
34844
|
}
|
|
34774
34845
|
};
|
|
34775
34846
|
function toApiError(status2, statusText, text4) {
|
|
34776
|
-
let
|
|
34847
|
+
let message3 = statusText || "Unknown error";
|
|
34777
34848
|
let structured = {};
|
|
34778
34849
|
if (text4) {
|
|
34779
34850
|
try {
|
|
@@ -34782,14 +34853,14 @@ function toApiError(status2, statusText, text4) {
|
|
|
34782
34853
|
if (raw && typeof raw === "object") {
|
|
34783
34854
|
structured = raw;
|
|
34784
34855
|
const m = raw.message;
|
|
34785
|
-
if (typeof m === "string")
|
|
34856
|
+
if (typeof m === "string") message3 = m;
|
|
34786
34857
|
} else if (typeof raw === "string") {
|
|
34787
|
-
|
|
34858
|
+
message3 = raw;
|
|
34788
34859
|
}
|
|
34789
34860
|
} catch {
|
|
34790
34861
|
}
|
|
34791
34862
|
}
|
|
34792
|
-
return new ApiError(status2,
|
|
34863
|
+
return new ApiError(status2, message3, structured);
|
|
34793
34864
|
}
|
|
34794
34865
|
|
|
34795
34866
|
// core/config.ts
|
|
@@ -34837,10 +34908,10 @@ var TomlError = class _TomlError extends Error {
|
|
|
34837
34908
|
line;
|
|
34838
34909
|
column;
|
|
34839
34910
|
codeblock;
|
|
34840
|
-
constructor(
|
|
34911
|
+
constructor(message3, options) {
|
|
34841
34912
|
const [line, column] = getLineColFromPtr(options.toml, options.ptr);
|
|
34842
34913
|
const codeblock = makeCodeBlock(options.toml, line, column);
|
|
34843
|
-
super(`Invalid TOML document: ${
|
|
34914
|
+
super(`Invalid TOML document: ${message3}
|
|
34844
34915
|
|
|
34845
34916
|
${codeblock}`, options);
|
|
34846
34917
|
this.line = line;
|
|
@@ -34848,8 +34919,8 @@ ${codeblock}`, options);
|
|
|
34848
34919
|
this.codeblock = codeblock;
|
|
34849
34920
|
}
|
|
34850
34921
|
/** @internal */
|
|
34851
|
-
static x(
|
|
34852
|
-
throw new _TomlError(
|
|
34922
|
+
static x(message3, ctx, ptr) {
|
|
34923
|
+
throw new _TomlError(message3, { toml: ctx.s, ptr: ptr ?? ctx.p });
|
|
34853
34924
|
}
|
|
34854
34925
|
};
|
|
34855
34926
|
|
|
@@ -35579,6 +35650,10 @@ function normalizeProfileName(value) {
|
|
|
35579
35650
|
}
|
|
35580
35651
|
return normalized2;
|
|
35581
35652
|
}
|
|
35653
|
+
function nearestBinding(branding, cwd = process.cwd()) {
|
|
35654
|
+
const canonical = canonicalFolder(cwd);
|
|
35655
|
+
return listProfileBindings(branding).filter((entry) => canonical === entry.path || canonical.startsWith(entry.path.endsWith(path.sep) ? entry.path : entry.path + path.sep)).sort((a, b) => b.path.length - a.path.length)[0];
|
|
35656
|
+
}
|
|
35582
35657
|
function bindingsPath(branding) {
|
|
35583
35658
|
return path.join(configDir(branding), "bindings.json");
|
|
35584
35659
|
}
|
|
@@ -35597,11 +35672,15 @@ function listProfileBindings(branding) {
|
|
|
35597
35672
|
const seen = /* @__PURE__ */ new Set();
|
|
35598
35673
|
const bindings = [];
|
|
35599
35674
|
for (const value of data) {
|
|
35600
|
-
if (!value || typeof value !== "object" || typeof value.path !== "string" || !path.isAbsolute(value.path) || typeof value.profile !== "string" || !value.profile.trim()) throw new Error("invalid binding");
|
|
35675
|
+
if (!value || typeof value !== "object" || typeof value.path !== "string" || !path.isAbsolute(value.path) || typeof value.profile !== "string" || !value.profile.trim() || value.currentTask !== void 0 && (typeof value.currentTask !== "string" || !value.currentTask.trim())) throw new Error("invalid binding");
|
|
35601
35676
|
const folder = canonicalFolder(value.path);
|
|
35602
35677
|
if (seen.has(folder)) throw new Error("duplicate binding");
|
|
35603
35678
|
seen.add(folder);
|
|
35604
|
-
bindings.push({
|
|
35679
|
+
bindings.push({
|
|
35680
|
+
path: folder,
|
|
35681
|
+
profile: normalizeProfileName(value.profile) ?? "default",
|
|
35682
|
+
...value.currentTask === void 0 ? {} : { currentTask: value.currentTask }
|
|
35683
|
+
});
|
|
35605
35684
|
}
|
|
35606
35685
|
return bindings.sort((a, b) => a.path.localeCompare(b.path));
|
|
35607
35686
|
} catch {
|
|
@@ -35619,14 +35698,17 @@ function saveProfileBindings(branding, bindings) {
|
|
|
35619
35698
|
rmSync(temporary, { force: true });
|
|
35620
35699
|
}
|
|
35621
35700
|
}
|
|
35622
|
-
function bindProfile(branding, folder, profile) {
|
|
35701
|
+
function bindProfile(branding, folder, profile, currentTask) {
|
|
35623
35702
|
if (!profile.trim()) throw new Error("Profile cannot be empty");
|
|
35624
35703
|
const name4 = normalizeProfileName(profile) ?? "default";
|
|
35625
35704
|
if (!readStoredCredentials(branding, name4)) throw new Error(`Profile '${name4}' is not authenticated. Run auth login or auth pair first.`);
|
|
35626
35705
|
const canonical = realpathSync(path.resolve(folder));
|
|
35627
35706
|
if (!statSync(canonical).isDirectory()) throw new Error("Bind a directory, not a file");
|
|
35628
|
-
const
|
|
35629
|
-
const
|
|
35707
|
+
const existing = listProfileBindings(branding);
|
|
35708
|
+
const rule = currentTask === void 0 ? existing.find((entry) => entry.path === canonical)?.currentTask : currentTask ?? void 0;
|
|
35709
|
+
if (rule !== void 0 && !rule.trim()) throw new Error("The current task rule cannot be empty");
|
|
35710
|
+
const binding = { path: canonical, profile: name4, ...rule === void 0 ? {} : { currentTask: rule } };
|
|
35711
|
+
const bindings = existing.filter((entry) => entry.path !== canonical);
|
|
35630
35712
|
saveProfileBindings(branding, [...bindings, binding]);
|
|
35631
35713
|
return binding;
|
|
35632
35714
|
}
|
|
@@ -35643,8 +35725,7 @@ function resolveProfileSelection(branding, explicit, cwd = process.cwd()) {
|
|
|
35643
35725
|
const env = process.env[branding.profileEnvVar];
|
|
35644
35726
|
if (env !== void 0) return { profile: normalizeProfileName(env) ?? "default", source: "env" };
|
|
35645
35727
|
if (branding.directoryBindings !== false) {
|
|
35646
|
-
const
|
|
35647
|
-
const nearest = listProfileBindings(branding).filter((entry) => canonical === entry.path || canonical.startsWith(entry.path.endsWith(path.sep) ? entry.path : entry.path + path.sep)).sort((a, b) => b.path.length - a.path.length)[0];
|
|
35728
|
+
const nearest = nearestBinding(branding, cwd);
|
|
35648
35729
|
if (nearest) return { profile: nearest.profile, source: "directory", directory: nearest.path };
|
|
35649
35730
|
}
|
|
35650
35731
|
return { profile: "default", source: "default" };
|
|
@@ -35778,8 +35859,6 @@ function listStoredProfiles(branding) {
|
|
|
35778
35859
|
}
|
|
35779
35860
|
|
|
35780
35861
|
// ente/client.ts
|
|
35781
|
-
var ASK_TIMEOUT_MS = 9e4;
|
|
35782
|
-
var UPLOAD_TIMEOUT_MS = 3e5;
|
|
35783
35862
|
var EnteClient = class _EnteClient {
|
|
35784
35863
|
rest;
|
|
35785
35864
|
constructor(rest) {
|
|
@@ -35791,12 +35870,7 @@ var EnteClient = class _EnteClient {
|
|
|
35791
35870
|
return new _EnteClient(new RestClient({ baseUrl: apiUrl, apiKey, defaultHeaders: CLI_REQUEST_HEADERS }));
|
|
35792
35871
|
}
|
|
35793
35872
|
// --- entities -----------------------------------------------------------
|
|
35794
|
-
/**
|
|
35795
|
-
listEntities(params) {
|
|
35796
|
-
return this.rest.get("/api/external/entities", params);
|
|
35797
|
-
}
|
|
35798
|
-
/** Primary typed reads use the existing MCP route, including detail, which has
|
|
35799
|
-
* no REST endpoint. Old installed REST helpers keep their declared profile. */
|
|
35873
|
+
/** Typed entity reads use the MCP route, including detail, which has no REST endpoint. */
|
|
35800
35874
|
async entityRead(operation, input2) {
|
|
35801
35875
|
const request = parseEntityReadRequest(operation, input2);
|
|
35802
35876
|
return { data: parseEntityReadResult(operation, await this.operationData(operation, request.input)) };
|
|
@@ -35840,87 +35914,22 @@ var EnteClient = class _EnteClient {
|
|
|
35840
35914
|
if (!record3(rpc) || !record3(rpc.result) || rpc.result.isError === true || !record3(rpc.result.structuredContent)) throw new OperationResultError(operation);
|
|
35841
35915
|
return rpc.result.structuredContent.data;
|
|
35842
35916
|
}
|
|
35843
|
-
|
|
35844
|
-
return this.rest.post("/api/external/entities", body);
|
|
35845
|
-
}
|
|
35846
|
-
updateEntity(id21, body) {
|
|
35847
|
-
const input2 = parseEntityWriteRequest("updateEntity", body !== null && typeof body === "object" && !Array.isArray(body) ? { ...body, entityId: id21 } : body).input;
|
|
35848
|
-
return this.rest.patch("/api/external/entities", input2);
|
|
35849
|
-
}
|
|
35850
|
-
archiveEntity(id21) {
|
|
35851
|
-
return this.rest.delete("/api/external/entities", { id: id21 });
|
|
35852
|
-
}
|
|
35853
|
-
restoreEntity(id21) {
|
|
35854
|
-
return this.rest.post("/api/external/entities/restore", void 0, { id: id21 });
|
|
35855
|
-
}
|
|
35856
|
-
removeFromSpace(entityId2, spaceId2) {
|
|
35857
|
-
return this.rest.delete("/api/external/entity-spaces", { entityId: entityId2, spaceId: spaceId2 });
|
|
35858
|
-
}
|
|
35859
|
-
/** Spaces map (id → {spaceName, memberEmails}) via a minimal entities call. */
|
|
35917
|
+
/** Spaces map (id → {spaceName, memberEmails}) via a minimal full entity list. */
|
|
35860
35918
|
async listSpaces() {
|
|
35861
|
-
const
|
|
35862
|
-
return
|
|
35863
|
-
}
|
|
35864
|
-
/** Installed MCP full-space profile with the caller's role and member emails. */
|
|
35865
|
-
async listSpacesFull() {
|
|
35866
|
-
return { data: parseZodOperationResult("listSpaces", legacyWorkspaceWireResults.listSpaces, await this.operationData("spaces_list", {})) };
|
|
35867
|
-
}
|
|
35868
|
-
createSpace(body) {
|
|
35869
|
-
return this.workspaceOperation("createSpace", { ...body, color: body.color ?? "kale" });
|
|
35870
|
-
}
|
|
35871
|
-
async renameSpace(spaceId2, name4) {
|
|
35872
|
-
const request = parseWorkspaceRequest("updateSpace", { spaceId: spaceId2, name: name4 });
|
|
35873
|
-
return { data: parseZodOperationResult("updateSpace", legacyWorkspaceWireResults.updateSpace, await this.operationData("spaces_rename", request.input)) };
|
|
35919
|
+
const { data } = await this.entityRead("listEntities", { limit: 1, projection: "full" });
|
|
35920
|
+
return data.spaces;
|
|
35874
35921
|
}
|
|
35875
35922
|
// --- pins ---------------------------------------------------------------
|
|
35876
|
-
createPin(sourceEntityId, targetEntityId, spaceId2) {
|
|
35877
|
-
return this.rest.post("/api/external/pins", {
|
|
35878
|
-
sourceEntityId,
|
|
35879
|
-
targetEntityId,
|
|
35880
|
-
...spaceId2 ? { spaceId: spaceId2 } : {}
|
|
35881
|
-
});
|
|
35882
|
-
}
|
|
35883
|
-
deletePin(sourceEntityId, targetEntityId, spaceId2) {
|
|
35884
|
-
return this.rest.delete("/api/external/pins", {
|
|
35885
|
-
sourceEntityId,
|
|
35886
|
-
targetEntityId,
|
|
35887
|
-
...spaceId2 ? { spaceId: spaceId2 } : {}
|
|
35888
|
-
});
|
|
35889
|
-
}
|
|
35890
|
-
listPins(entityId2) {
|
|
35891
|
-
return this.rest.get("/api/external/pins", { entityId: entityId2 });
|
|
35892
|
-
}
|
|
35893
35923
|
// --- activities ---------------------------------------------------------
|
|
35894
|
-
|
|
35895
|
-
|
|
35896
|
-
|
|
35897
|
-
|
|
35898
|
-
return this.rest.get("/api/external/activity", { id: id21 });
|
|
35899
|
-
}
|
|
35900
|
-
createActivity(body) {
|
|
35901
|
-
return this.rest.post("/api/external/activities", body);
|
|
35902
|
-
}
|
|
35903
|
-
updateActivity(id21, body) {
|
|
35904
|
-
return this.rest.patch("/api/external/activities", body, { id: id21 });
|
|
35905
|
-
}
|
|
35906
|
-
deleteActivity(id21) {
|
|
35907
|
-
return this.rest.delete("/api/external/activities", { id: id21 });
|
|
35908
|
-
}
|
|
35909
|
-
restoreActivity(id21) {
|
|
35910
|
-
return this.rest.post("/api/external/activities/restore", void 0, { id: id21 });
|
|
35911
|
-
}
|
|
35912
|
-
searchActivities(params) {
|
|
35913
|
-
return this.rest.get("/api/external/activities/search", params);
|
|
35924
|
+
/** Global list or entity history; full records unless params select compact. */
|
|
35925
|
+
async listActivities(params) {
|
|
35926
|
+
const response = await this.rest.get("/api/external/activities", { projection: "full", ...params });
|
|
35927
|
+
return { data: parseActivityReadResult("listActivities", response.data) };
|
|
35914
35928
|
}
|
|
35915
35929
|
// --- tasks --------------------------------------------------------------
|
|
35916
|
-
listTasks(params) {
|
|
35917
|
-
|
|
35918
|
-
|
|
35919
|
-
taskByNumber(num, spaceId2) {
|
|
35920
|
-
return this.rest.get("/api/external/tasks/number", {
|
|
35921
|
-
number: String(num),
|
|
35922
|
-
...spaceId2 ? { spaceId: spaceId2 } : {}
|
|
35923
|
-
});
|
|
35930
|
+
async listTasks(params) {
|
|
35931
|
+
const response = await this.rest.get("/api/external/tasks", params);
|
|
35932
|
+
return { data: parseZodOperationResult("listTasks", taskReadResults.listTasks, response.data) };
|
|
35924
35933
|
}
|
|
35925
35934
|
// --- activity agendas ---------------------------------------------------
|
|
35926
35935
|
async createAgendaPoint(body) {
|
|
@@ -35928,21 +35937,7 @@ var EnteClient = class _EnteClient {
|
|
|
35928
35937
|
const response = await this.rest.post("/api/external/agenda-points", input2);
|
|
35929
35938
|
return parseAgendaCreateResponse(response);
|
|
35930
35939
|
}
|
|
35931
|
-
uploadAttachment(activityId2, bytes2, name4, mimeType) {
|
|
35932
|
-
return this.rest.postRaw(
|
|
35933
|
-
"/api/external/activities/upload",
|
|
35934
|
-
bytes2,
|
|
35935
|
-
mimeType,
|
|
35936
|
-
{ id: activityId2, name: name4 },
|
|
35937
|
-
{ timeoutMs: UPLOAD_TIMEOUT_MS }
|
|
35938
|
-
);
|
|
35939
|
-
}
|
|
35940
35940
|
// --- ask / query (evidence retrieval) -----------------------------------
|
|
35941
|
-
ask(body) {
|
|
35942
|
-
return this.rest.post("/api/external/ask", body, void 0, {
|
|
35943
|
-
timeoutMs: ASK_TIMEOUT_MS
|
|
35944
|
-
});
|
|
35945
|
-
}
|
|
35946
35941
|
query(body) {
|
|
35947
35942
|
return this.rest.post("/api/external/query", body);
|
|
35948
35943
|
}
|
|
@@ -35990,11 +35985,10 @@ var EnteClient = class _EnteClient {
|
|
|
35990
35985
|
getAgentConfiguration() {
|
|
35991
35986
|
return this.rest.get("/api/external/agent");
|
|
35992
35987
|
}
|
|
35993
|
-
|
|
35994
|
-
|
|
35995
|
-
|
|
35996
|
-
|
|
35997
|
-
);
|
|
35988
|
+
/** Writes return a commit receipt; the configuration is read again afterwards. */
|
|
35989
|
+
async updateAgentPrompt(prompt) {
|
|
35990
|
+
await this.rest.patch("/api/external/agent", { prompt });
|
|
35991
|
+
return this.getAgentConfiguration();
|
|
35998
35992
|
}
|
|
35999
35993
|
listAgentThreads(params) {
|
|
36000
35994
|
return this.rest.get("/api/external/agent/threads", params);
|
|
@@ -36018,11 +36012,9 @@ var EnteClient = class _EnteClient {
|
|
|
36018
36012
|
replyAgentThread(body) {
|
|
36019
36013
|
return this.rest.post("/api/external/agent/thread/reply", body);
|
|
36020
36014
|
}
|
|
36021
|
-
configureAgentSchedules(schedules) {
|
|
36022
|
-
|
|
36023
|
-
|
|
36024
|
-
{ schedules }
|
|
36025
|
-
);
|
|
36015
|
+
async configureAgentSchedules(schedules) {
|
|
36016
|
+
await this.rest.put("/api/external/agent/schedules", { schedules });
|
|
36017
|
+
return this.getAgentConfiguration();
|
|
36026
36018
|
}
|
|
36027
36019
|
// --- agent mail --------------------------------------------------------
|
|
36028
36020
|
userMailbox(request) {
|
|
@@ -36164,17 +36156,18 @@ function jsonWithSpaces(data, spaces) {
|
|
|
36164
36156
|
function formatEntityList(entities, spaces) {
|
|
36165
36157
|
if (entities.length === 0) return "No entities found.";
|
|
36166
36158
|
const rows = entities.map((e) => {
|
|
36167
|
-
const
|
|
36159
|
+
const entity3 = e.entity;
|
|
36168
36160
|
const spaceIds = e.spaceIds ?? [];
|
|
36169
36161
|
const spaceNames = spaces && spaceIds.length ? spaceIds.map((sid) => spaces[sid]?.spaceName ?? sid).join(", ") : "";
|
|
36170
36162
|
return {
|
|
36171
|
-
name:
|
|
36172
|
-
type: `(${
|
|
36163
|
+
name: entity3.displayName ?? entity3.name ?? "",
|
|
36164
|
+
type: `(${entity3.type ?? ""})`,
|
|
36173
36165
|
space: spaceNames,
|
|
36174
|
-
id:
|
|
36166
|
+
id: entity3._id ?? "",
|
|
36175
36167
|
descriptionPlainText: e.descriptionPlainText,
|
|
36176
|
-
hiddenFromGraph:
|
|
36177
|
-
|
|
36168
|
+
hiddenFromGraph: entity3.hiddenFromGraph,
|
|
36169
|
+
imageId: entity3.imageId,
|
|
36170
|
+
aliases: entity3.aliases && entity3.aliases.length ? entity3.aliases : void 0,
|
|
36178
36171
|
activityCount: e.activityCount ?? 0,
|
|
36179
36172
|
lastActivityAt: e.lastActivityAt,
|
|
36180
36173
|
openTasks: e.openTasks ?? []
|
|
@@ -36193,6 +36186,7 @@ function formatEntityList(entities, spaces) {
|
|
|
36193
36186
|
const parts = [];
|
|
36194
36187
|
if (r.descriptionPlainText) parts.push(`description: ${truncate(r.descriptionPlainText, 120)}`);
|
|
36195
36188
|
if (r.hiddenFromGraph) parts.push("hidden from graph");
|
|
36189
|
+
if (r.imageId) parts.push(`image: ${r.imageId}`);
|
|
36196
36190
|
if (r.aliases) parts.push(`aka: ${r.aliases.join(", ")}`);
|
|
36197
36191
|
if (r.activityCount > 0) parts.push(`${r.activityCount} activities`);
|
|
36198
36192
|
if (r.lastActivityAt) parts.push(`last: ${formatRelativeDate(r.lastActivityAt)}`);
|
|
@@ -36212,6 +36206,7 @@ function formatEntityDetail(data) {
|
|
|
36212
36206
|
if (data.aggregationMode === "directOnly")
|
|
36213
36207
|
lines.push("Aggregation: direct only (more than 20 active direct children)");
|
|
36214
36208
|
if (e.hiddenFromGraph) lines.push("Graph: hidden");
|
|
36209
|
+
if (e.imageId) lines.push(`Image: ${e.imageId}`);
|
|
36215
36210
|
if (e.aliases && e.aliases.length) lines.push(`Aliases: ${e.aliases.join(", ")}`);
|
|
36216
36211
|
if (e.tags && e.tags.length) lines.push(`Tags: ${e.tags.join(", ")}`);
|
|
36217
36212
|
for (const field of e.fields ?? []) lines.push(` ${field.label} (${field.type}): ${field.value} [${field.valueId}]`);
|
|
@@ -36253,7 +36248,7 @@ function formatPinsList(pins) {
|
|
|
36253
36248
|
return `${parentLabel} (${p.type ?? ""}) ${p.entityId ?? ""}`.trim();
|
|
36254
36249
|
}).join("\n");
|
|
36255
36250
|
}
|
|
36256
|
-
function formatTaskList(tasks2
|
|
36251
|
+
function formatTaskList(tasks2) {
|
|
36257
36252
|
if (tasks2.length === 0) return "No tasks found.";
|
|
36258
36253
|
const rows = tasks2.map((t) => {
|
|
36259
36254
|
const a = t.activity ?? {};
|
|
@@ -36326,10 +36321,10 @@ function formatActivityDetail(a) {
|
|
|
36326
36321
|
}
|
|
36327
36322
|
if (a.attachments?.length) {
|
|
36328
36323
|
lines.push("Attachments:");
|
|
36329
|
-
for (const
|
|
36330
|
-
const size =
|
|
36331
|
-
lines.push(` ${
|
|
36332
|
-
if (
|
|
36324
|
+
for (const attachment3 of a.attachments) {
|
|
36325
|
+
const size = attachment3.sizeBytes > 0 ? `, ${(attachment3.sizeBytes / 1024).toFixed(1)} KB` : "";
|
|
36326
|
+
lines.push(` ${attachment3.name} (${attachment3.mimeType}${size})`);
|
|
36327
|
+
if (attachment3.url) lines.push(` ${attachment3.url}`);
|
|
36333
36328
|
}
|
|
36334
36329
|
}
|
|
36335
36330
|
if (a.contentPlainText) {
|
|
@@ -36354,11 +36349,11 @@ function formatActivityDetail(a) {
|
|
|
36354
36349
|
if (a.messages?.length) {
|
|
36355
36350
|
lines.push("");
|
|
36356
36351
|
lines.push(`Messages (${a.messages.length}):`);
|
|
36357
|
-
for (const
|
|
36358
|
-
const indent = " ".repeat(
|
|
36359
|
-
const author =
|
|
36360
|
-
const contentLines =
|
|
36361
|
-
const replyTarget =
|
|
36352
|
+
for (const message3 of a.messages) {
|
|
36353
|
+
const indent = " ".repeat(message3.depth ?? 0);
|
|
36354
|
+
const author = message3.createdByUser?.name || message3.createdByUser?.email || message3.createdBy;
|
|
36355
|
+
const contentLines = message3.contentPlainText.split("\n");
|
|
36356
|
+
const replyTarget = message3.parentMessageId ? ` [reply to ${message3.parentMessageId}]` : "";
|
|
36362
36357
|
lines.push(`${indent}${author}: ${contentLines[0] ?? ""}${replyTarget}`);
|
|
36363
36358
|
for (const contentLine of contentLines.slice(1))
|
|
36364
36359
|
lines.push(`${indent} ${contentLine}`);
|
|
@@ -36413,16 +36408,15 @@ function looksLikeConvexId(value) {
|
|
|
36413
36408
|
}
|
|
36414
36409
|
async function resolveEntity(client, nameOrId) {
|
|
36415
36410
|
if (looksLikeConvexId(nameOrId)) return nameOrId;
|
|
36416
|
-
const
|
|
36417
|
-
|
|
36418
|
-
return resolveEntityCandidate(matches.map(({ entity: entity5 }) => entity5), nameOrId);
|
|
36411
|
+
const { data } = await client.entityRead("searchEntities", { query: nameOrId, limit: 10, projection: "full" });
|
|
36412
|
+
return resolveEntityCandidate(data.entities.map(({ entity: entity3 }) => entity3), nameOrId);
|
|
36419
36413
|
}
|
|
36420
36414
|
async function resolveSpaceByName(client, nameOrId) {
|
|
36421
36415
|
if (looksLikeConvexId(nameOrId)) return nameOrId;
|
|
36422
36416
|
const spaces = await client.listSpaces();
|
|
36423
36417
|
const lower = nameOrId.toLowerCase();
|
|
36424
|
-
for (const [spaceId2,
|
|
36425
|
-
if ((
|
|
36418
|
+
for (const [spaceId2, space2] of Object.entries(spaces)) {
|
|
36419
|
+
if ((space2.spaceName ?? "").toLowerCase() === lower) return spaceId2;
|
|
36426
36420
|
}
|
|
36427
36421
|
const partial2 = Object.entries(spaces).filter(
|
|
36428
36422
|
([, s]) => (s.spaceName ?? "").toLowerCase().includes(lower)
|
|
@@ -36443,6 +36437,7 @@ Use the full space ID to be specific.`
|
|
|
36443
36437
|
var VALID_SORT = /* @__PURE__ */ new Set(["deadline", "created"]);
|
|
36444
36438
|
var MAX_PAGINATED_ITEMS = 1e4;
|
|
36445
36439
|
var MAX_PAGES = 50;
|
|
36440
|
+
var MAX_ENTITY_LIST_PAGES = 1e3;
|
|
36446
36441
|
var ProfileCommand = class extends BaseCommand {
|
|
36447
36442
|
profile = options_exports.String("--profile", {
|
|
36448
36443
|
description: "Use a named credential profile (or set ENTE_PROFILE)"
|
|
@@ -36480,20 +36475,45 @@ ${footer}` : body;
|
|
|
36480
36475
|
if (separator < 1 || opts.query !== void 0) throw new Error("Use --field label=value without --query");
|
|
36481
36476
|
field = { label: opts.field.slice(0, separator), value: opts.field.slice(separator + 1) };
|
|
36482
36477
|
}
|
|
36483
|
-
const
|
|
36478
|
+
const search = opts.query !== void 0 && !opts.archived;
|
|
36479
|
+
if (search && (opts.cursor !== void 0 || opts.all)) throw new Error("--cursor and --all page entity lists; remove --query");
|
|
36480
|
+
if (field && (opts.cursor !== void 0 || opts.all)) throw new Error("Field lookups return one bounded page; remove --cursor and --all");
|
|
36481
|
+
if (opts.all && opts.cursor !== void 0) throw new Error("Use either --all or --cursor");
|
|
36482
|
+
const request = search ? parseEntityReadRequest("searchEntities", { query: opts.query, limit: opts.limit, projection: opts.projection }) : parseEntityReadRequest("listEntities", { field, type: opts.typeFilter, cursor: opts.cursor, limit: opts.limit, archived: opts.archived, projection: opts.projection });
|
|
36484
36483
|
if (opts.space !== void 0 && !opts.space.trim())
|
|
36485
36484
|
throw new OperationInputError(request.operation, [{ path: ["spaceId"], reason: "too_small" }]);
|
|
36486
36485
|
const client = this.client();
|
|
36487
36486
|
const spaceId2 = opts.space ? await resolveSpaceByName(client, opts.space) : void 0;
|
|
36488
|
-
|
|
36489
|
-
|
|
36490
|
-
|
|
36491
|
-
|
|
36492
|
-
|
|
36493
|
-
|
|
36494
|
-
|
|
36495
|
-
|
|
36496
|
-
|
|
36487
|
+
if (request.operation === "searchEntities") {
|
|
36488
|
+
const { data: data2 } = await client.entityRead(request.operation, { ...request.input, spaceId: spaceId2 });
|
|
36489
|
+
const entities = opts.typeFilter ? data2.entities.filter((e) => e.entity.type === opts.typeFilter) : data2.entities;
|
|
36490
|
+
this.emitText(jsonWithSpaces({ data: { ...data2, entities } }, data2.spaces), () => this.withFooter(formatEntityList(entities, data2.spaces), data2.spaces));
|
|
36491
|
+
return;
|
|
36492
|
+
}
|
|
36493
|
+
let { data } = await client.entityRead(request.operation, { ...request.input, spaceId: spaceId2 });
|
|
36494
|
+
if (opts.all) {
|
|
36495
|
+
const entities = [...data.entities];
|
|
36496
|
+
const spaces2 = { ...data.spaces };
|
|
36497
|
+
let openTasksPartial = data.openTasksPartial === true;
|
|
36498
|
+
const seen = /* @__PURE__ */ new Set();
|
|
36499
|
+
for (let pages2 = 1; data.hasMore; pages2++) {
|
|
36500
|
+
const cursor2 = data.nextCursor;
|
|
36501
|
+
if (cursor2 === void 0 || seen.has(cursor2) || pages2 >= MAX_ENTITY_LIST_PAGES)
|
|
36502
|
+
throw new Error("Entity list paging did not advance; rerun with --cursor from the last page");
|
|
36503
|
+
seen.add(cursor2);
|
|
36504
|
+
({ data } = await client.entityRead(request.operation, { ...request.input, spaceId: spaceId2, cursor: cursor2 }));
|
|
36505
|
+
entities.push(...data.entities);
|
|
36506
|
+
Object.assign(spaces2, data.spaces);
|
|
36507
|
+
openTasksPartial ||= data.openTasksPartial === true;
|
|
36508
|
+
}
|
|
36509
|
+
data = { ...data, entities, spaces: spaces2, hasMore: false, ...openTasksPartial ? { openTasksPartial } : {} };
|
|
36510
|
+
}
|
|
36511
|
+
const spaces = data.spaces;
|
|
36512
|
+
this.emitText(jsonWithSpaces({ data }, spaces), () => {
|
|
36513
|
+
const body = this.withFooter(formatEntityList(data.entities, spaces), spaces);
|
|
36514
|
+
return data.nextCursor ? `${body}
|
|
36515
|
+
More entities: add --cursor ${data.nextCursor} (or use --all)` : body;
|
|
36516
|
+
});
|
|
36497
36517
|
}
|
|
36498
36518
|
// --- shared: activity list (used by `activity list` and `tasks`) --------
|
|
36499
36519
|
async runActivityList(opts) {
|
|
@@ -36529,11 +36549,11 @@ ${footer}` : body;
|
|
|
36529
36549
|
const res = await client2.listTasks(params);
|
|
36530
36550
|
let tasks2 = res.data ?? [];
|
|
36531
36551
|
if (opts.limit) tasks2 = tasks2.slice(0, opts.limit);
|
|
36532
|
-
this.emitText(jsonWithSpaces({ ...res, data: tasks2 }, spaces2), () => this.withFooter(formatTaskList(tasks2
|
|
36552
|
+
this.emitText(jsonWithSpaces({ ...res, data: tasks2 }, spaces2), () => this.withFooter(formatTaskList(tasks2), spaces2));
|
|
36533
36553
|
} else {
|
|
36534
36554
|
for (const [key, value] of Object.entries(request.input)) if (key !== "field" && key !== "projection" && value !== void 0) params[key] = String(value);
|
|
36535
36555
|
const res = await client2.listActivities(params);
|
|
36536
|
-
this.emitText(jsonWithSpaces(res, spaces2), () => this.withFooter(formatActivityList(res.data
|
|
36556
|
+
this.emitText(jsonWithSpaces({ data: res.data.activities, hasMore: res.data.hasMore }, spaces2), () => this.withFooter(formatActivityList(res.data.activities), spaces2));
|
|
36537
36557
|
}
|
|
36538
36558
|
return;
|
|
36539
36559
|
}
|
|
@@ -36572,8 +36592,7 @@ ${footer}` : body;
|
|
|
36572
36592
|
if (entityId2) params.entityId = entityId2;
|
|
36573
36593
|
applyAssignee(params, opts.assignee);
|
|
36574
36594
|
const res = await client.listTasks(params);
|
|
36575
|
-
let tasks2 = res.data
|
|
36576
|
-
const users = res.users ?? {};
|
|
36595
|
+
let tasks2 = res.data;
|
|
36577
36596
|
if (opts.hours) {
|
|
36578
36597
|
const cutoff = Date.now() - opts.hours * 36e5;
|
|
36579
36598
|
tasks2 = tasks2.filter((t) => (t.activity?.createdAt ?? 0) >= cutoff);
|
|
@@ -36587,8 +36606,8 @@ ${footer}` : body;
|
|
|
36587
36606
|
}
|
|
36588
36607
|
if (opts.limit) tasks2 = tasks2.slice(0, opts.limit);
|
|
36589
36608
|
this.emitText(
|
|
36590
|
-
jsonWithSpaces({ data: tasks2
|
|
36591
|
-
() => this.withFooter(formatTaskList(tasks2
|
|
36609
|
+
jsonWithSpaces({ data: tasks2 }, spaces),
|
|
36610
|
+
() => this.withFooter(formatTaskList(tasks2), spaces)
|
|
36592
36611
|
);
|
|
36593
36612
|
return;
|
|
36594
36613
|
}
|
|
@@ -36605,13 +36624,13 @@ ${footer}` : body;
|
|
|
36605
36624
|
let pages2 = 0;
|
|
36606
36625
|
let hitCap = false;
|
|
36607
36626
|
for (; ; ) {
|
|
36608
|
-
const
|
|
36609
|
-
if (entityId2)
|
|
36610
|
-
if (opaqueCursor !== void 0)
|
|
36611
|
-
else if (cursorBefore !== void 0)
|
|
36612
|
-
if (opts.after !== void 0)
|
|
36613
|
-
const res = await client.listActivities(
|
|
36614
|
-
let pageData = res.data
|
|
36627
|
+
const page2 = { limit: "10" };
|
|
36628
|
+
if (entityId2) page2.entityId = entityId2;
|
|
36629
|
+
if (opaqueCursor !== void 0) page2.cursor = opaqueCursor;
|
|
36630
|
+
else if (cursorBefore !== void 0) page2.before = String(cursorBefore);
|
|
36631
|
+
if (opts.after !== void 0) page2.after = String(opts.after);
|
|
36632
|
+
const res = await client.listActivities(page2);
|
|
36633
|
+
let pageData = res.data.activities;
|
|
36615
36634
|
if (hoursCutoff) {
|
|
36616
36635
|
const filtered = pageData.filter((a) => (a.createdAt ?? 0) >= hoursCutoff);
|
|
36617
36636
|
if (filtered.length < pageData.length) {
|
|
@@ -36622,12 +36641,12 @@ ${footer}` : body;
|
|
|
36622
36641
|
}
|
|
36623
36642
|
activities.push(...pageData);
|
|
36624
36643
|
pages2 += 1;
|
|
36625
|
-
if (!res.hasMore || pageData.length === 0) break;
|
|
36644
|
+
if (!res.data.hasMore || pageData.length === 0) break;
|
|
36626
36645
|
if (activities.length >= MAX_PAGINATED_ITEMS || pages2 >= MAX_PAGES) {
|
|
36627
36646
|
hitCap = true;
|
|
36628
36647
|
break;
|
|
36629
36648
|
}
|
|
36630
|
-
if (res.nextCursor) opaqueCursor = res.nextCursor;
|
|
36649
|
+
if (res.data.nextCursor) opaqueCursor = res.data.nextCursor;
|
|
36631
36650
|
else cursorBefore = pageData[pageData.length - 1].createdAt;
|
|
36632
36651
|
}
|
|
36633
36652
|
if (hitCap) {
|
|
@@ -36643,13 +36662,13 @@ ${footer}` : body;
|
|
|
36643
36662
|
if (opts.before !== void 0) params.before = String(opts.before);
|
|
36644
36663
|
if (opts.after !== void 0) params.after = String(opts.after);
|
|
36645
36664
|
if (opts.cursor !== void 0) params.cursor = opts.cursor;
|
|
36646
|
-
if (opts.compact) params.
|
|
36665
|
+
if (opts.compact) params.projection = "compact";
|
|
36647
36666
|
if (opts.minCount !== void 0) params.minCount = String(opts.minCount);
|
|
36648
36667
|
const res = await client.listActivities(params);
|
|
36649
|
-
activities = res.data
|
|
36650
|
-
serverHasMore = res.hasMore;
|
|
36651
|
-
nextCursor = res.nextCursor;
|
|
36652
|
-
projection3 = res.projection;
|
|
36668
|
+
activities = res.data.activities;
|
|
36669
|
+
serverHasMore = res.data.hasMore;
|
|
36670
|
+
nextCursor = res.data.nextCursor;
|
|
36671
|
+
if (res.data.projection === "compact") projection3 = res.data.projection;
|
|
36653
36672
|
}
|
|
36654
36673
|
if (opts.typeFilter) activities = activities.filter((a) => a.type === opts.typeFilter);
|
|
36655
36674
|
if (opts.onlyOpen) activities = activities.filter((a) => !a.completed);
|
|
@@ -36788,24 +36807,24 @@ function instantiateDefaultLogger(options) {
|
|
|
36788
36807
|
function instantiateNoopLogger(options) {
|
|
36789
36808
|
return new DefaultLogger(options);
|
|
36790
36809
|
}
|
|
36791
|
-
function logForFunction(logger, type, source2, udfPath,
|
|
36810
|
+
function logForFunction(logger, type, source2, udfPath, message3) {
|
|
36792
36811
|
const prefix = prefix_for_source(source2);
|
|
36793
|
-
if (typeof
|
|
36794
|
-
|
|
36812
|
+
if (typeof message3 === "object") {
|
|
36813
|
+
message3 = `ConvexError ${JSON.stringify(message3.errorData, null, 2)}`;
|
|
36795
36814
|
}
|
|
36796
36815
|
if (type === "info") {
|
|
36797
|
-
const match =
|
|
36816
|
+
const match = message3.match(/^\[.*?\] /);
|
|
36798
36817
|
if (match === null) {
|
|
36799
36818
|
logger.error(
|
|
36800
36819
|
`[CONVEX ${prefix}(${udfPath})] Could not parse console.log`
|
|
36801
36820
|
);
|
|
36802
36821
|
return;
|
|
36803
36822
|
}
|
|
36804
|
-
const level =
|
|
36805
|
-
const args =
|
|
36823
|
+
const level = message3.slice(1, match[0].length - 2);
|
|
36824
|
+
const args = message3.slice(match[0].length);
|
|
36806
36825
|
logger.log(`%c[CONVEX ${prefix}(${udfPath})] [${level}]`, INFO_COLOR, args);
|
|
36807
36826
|
} else {
|
|
36808
|
-
logger.error(`[CONVEX ${prefix}(${udfPath})] ${
|
|
36827
|
+
logger.error(`[CONVEX ${prefix}(${udfPath})] ${message3}`);
|
|
36809
36828
|
}
|
|
36810
36829
|
}
|
|
36811
36830
|
|
|
@@ -38504,11 +38523,11 @@ var require_receiver = __commonJS2({
|
|
|
38504
38523
|
* @return {(Error|RangeError)} The error
|
|
38505
38524
|
* @private
|
|
38506
38525
|
*/
|
|
38507
|
-
createError(ErrorCtor,
|
|
38526
|
+
createError(ErrorCtor, message3, prefix, statusCode, errorCode) {
|
|
38508
38527
|
this._loop = false;
|
|
38509
38528
|
this._errored = true;
|
|
38510
38529
|
const err = new ErrorCtor(
|
|
38511
|
-
prefix ? `Invalid WebSocket frame: ${
|
|
38530
|
+
prefix ? `Invalid WebSocket frame: ${message3}` : message3
|
|
38512
38531
|
);
|
|
38513
38532
|
Error.captureStackTrace(err, this.createError);
|
|
38514
38533
|
err.code = errorCode;
|
|
@@ -39170,10 +39189,10 @@ var require_event_target = __commonJS2({
|
|
|
39170
39189
|
callListener(handler, this, event);
|
|
39171
39190
|
};
|
|
39172
39191
|
} else if (type === "close") {
|
|
39173
|
-
wrapper = function onClose(code3,
|
|
39192
|
+
wrapper = function onClose(code3, message3) {
|
|
39174
39193
|
const event = new CloseEvent("close", {
|
|
39175
39194
|
code: code3,
|
|
39176
|
-
reason:
|
|
39195
|
+
reason: message3.toString(),
|
|
39177
39196
|
wasClean: this._closeFrameReceived && this._closeFrameSent
|
|
39178
39197
|
});
|
|
39179
39198
|
event[kTarget] = this;
|
|
@@ -40088,29 +40107,29 @@ var require_websocket = __commonJS2({
|
|
|
40088
40107
|
const secWebSocketExtensions = res.headers["sec-websocket-extensions"];
|
|
40089
40108
|
if (secWebSocketExtensions !== void 0) {
|
|
40090
40109
|
if (!perMessageDeflate) {
|
|
40091
|
-
const
|
|
40092
|
-
abortHandshake(websocket, socket,
|
|
40110
|
+
const message3 = "Server sent a Sec-WebSocket-Extensions header but no extension was requested";
|
|
40111
|
+
abortHandshake(websocket, socket, message3);
|
|
40093
40112
|
return;
|
|
40094
40113
|
}
|
|
40095
40114
|
let extensions;
|
|
40096
40115
|
try {
|
|
40097
40116
|
extensions = parse4(secWebSocketExtensions);
|
|
40098
40117
|
} catch (err) {
|
|
40099
|
-
const
|
|
40100
|
-
abortHandshake(websocket, socket,
|
|
40118
|
+
const message3 = "Invalid Sec-WebSocket-Extensions header";
|
|
40119
|
+
abortHandshake(websocket, socket, message3);
|
|
40101
40120
|
return;
|
|
40102
40121
|
}
|
|
40103
40122
|
const extensionNames = Object.keys(extensions);
|
|
40104
40123
|
if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate2.extensionName) {
|
|
40105
|
-
const
|
|
40106
|
-
abortHandshake(websocket, socket,
|
|
40124
|
+
const message3 = "Server indicated an extension that was not requested";
|
|
40125
|
+
abortHandshake(websocket, socket, message3);
|
|
40107
40126
|
return;
|
|
40108
40127
|
}
|
|
40109
40128
|
try {
|
|
40110
40129
|
perMessageDeflate.accept(extensions[PerMessageDeflate2.extensionName]);
|
|
40111
40130
|
} catch (err) {
|
|
40112
|
-
const
|
|
40113
|
-
abortHandshake(websocket, socket,
|
|
40131
|
+
const message3 = "Invalid Sec-WebSocket-Extensions header";
|
|
40132
|
+
abortHandshake(websocket, socket, message3);
|
|
40114
40133
|
return;
|
|
40115
40134
|
}
|
|
40116
40135
|
websocket._extensions[PerMessageDeflate2.extensionName] = perMessageDeflate;
|
|
@@ -40147,9 +40166,9 @@ var require_websocket = __commonJS2({
|
|
|
40147
40166
|
}
|
|
40148
40167
|
return tls.connect(options);
|
|
40149
40168
|
}
|
|
40150
|
-
function abortHandshake(websocket, stream,
|
|
40169
|
+
function abortHandshake(websocket, stream, message3) {
|
|
40151
40170
|
websocket._readyState = WebSocket2.CLOSING;
|
|
40152
|
-
const err = new Error(
|
|
40171
|
+
const err = new Error(message3);
|
|
40153
40172
|
Error.captureStackTrace(err, abortHandshake);
|
|
40154
40173
|
if (stream.setHeader) {
|
|
40155
40174
|
stream[kAborted] = true;
|
|
@@ -40311,7 +40330,7 @@ var require_stream = __commonJS2({
|
|
|
40311
40330
|
objectMode: false,
|
|
40312
40331
|
writableObjectMode: false
|
|
40313
40332
|
});
|
|
40314
|
-
ws.on("message", function
|
|
40333
|
+
ws.on("message", function message3(msg, isBinary) {
|
|
40315
40334
|
const data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
|
|
40316
40335
|
if (!duplex.push(data)) ws.pause();
|
|
40317
40336
|
});
|
|
@@ -40630,23 +40649,23 @@ var require_websocket_server = __commonJS2({
|
|
|
40630
40649
|
const upgrade = req.headers.upgrade;
|
|
40631
40650
|
const version5 = +req.headers["sec-websocket-version"];
|
|
40632
40651
|
if (req.method !== "GET") {
|
|
40633
|
-
const
|
|
40634
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 405,
|
|
40652
|
+
const message3 = "Invalid HTTP method";
|
|
40653
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 405, message3);
|
|
40635
40654
|
return;
|
|
40636
40655
|
}
|
|
40637
40656
|
if (upgrade === void 0 || upgrade.toLowerCase() !== "websocket") {
|
|
40638
|
-
const
|
|
40639
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400,
|
|
40657
|
+
const message3 = "Invalid Upgrade header";
|
|
40658
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message3);
|
|
40640
40659
|
return;
|
|
40641
40660
|
}
|
|
40642
40661
|
if (key === void 0 || !keyRegex.test(key)) {
|
|
40643
|
-
const
|
|
40644
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400,
|
|
40662
|
+
const message3 = "Missing or invalid Sec-WebSocket-Key header";
|
|
40663
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message3);
|
|
40645
40664
|
return;
|
|
40646
40665
|
}
|
|
40647
40666
|
if (version5 !== 13 && version5 !== 8) {
|
|
40648
|
-
const
|
|
40649
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400,
|
|
40667
|
+
const message3 = "Missing or invalid Sec-WebSocket-Version header";
|
|
40668
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message3, {
|
|
40650
40669
|
"Sec-WebSocket-Version": "13, 8"
|
|
40651
40670
|
});
|
|
40652
40671
|
return;
|
|
@@ -40661,8 +40680,8 @@ var require_websocket_server = __commonJS2({
|
|
|
40661
40680
|
try {
|
|
40662
40681
|
protocols = subprotocol2.parse(secWebSocketProtocol);
|
|
40663
40682
|
} catch (err) {
|
|
40664
|
-
const
|
|
40665
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400,
|
|
40683
|
+
const message3 = "Invalid Sec-WebSocket-Protocol header";
|
|
40684
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message3);
|
|
40666
40685
|
return;
|
|
40667
40686
|
}
|
|
40668
40687
|
}
|
|
@@ -40681,8 +40700,8 @@ var require_websocket_server = __commonJS2({
|
|
|
40681
40700
|
extensions[PerMessageDeflate2.extensionName] = perMessageDeflate;
|
|
40682
40701
|
}
|
|
40683
40702
|
} catch (err) {
|
|
40684
|
-
const
|
|
40685
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400,
|
|
40703
|
+
const message3 = "Invalid or unacceptable Sec-WebSocket-Extensions header";
|
|
40704
|
+
abortHandshakeOrEmitwsClientError(this, req, socket, 400, message3);
|
|
40686
40705
|
return;
|
|
40687
40706
|
}
|
|
40688
40707
|
}
|
|
@@ -40693,9 +40712,9 @@ var require_websocket_server = __commonJS2({
|
|
|
40693
40712
|
req
|
|
40694
40713
|
};
|
|
40695
40714
|
if (this.options.verifyClient.length === 2) {
|
|
40696
|
-
this.options.verifyClient(info, (verified, code3,
|
|
40715
|
+
this.options.verifyClient(info, (verified, code3, message3, headers) => {
|
|
40697
40716
|
if (!verified) {
|
|
40698
|
-
return abortHandshake(socket, code3 || 401,
|
|
40717
|
+
return abortHandshake(socket, code3 || 401, message3, headers);
|
|
40699
40718
|
}
|
|
40700
40719
|
this.completeUpgrade(
|
|
40701
40720
|
extensions,
|
|
@@ -40795,27 +40814,27 @@ var require_websocket_server = __commonJS2({
|
|
|
40795
40814
|
function socketOnError() {
|
|
40796
40815
|
this.destroy();
|
|
40797
40816
|
}
|
|
40798
|
-
function abortHandshake(socket, code3,
|
|
40799
|
-
|
|
40817
|
+
function abortHandshake(socket, code3, message3, headers) {
|
|
40818
|
+
message3 = message3 || http.STATUS_CODES[code3];
|
|
40800
40819
|
headers = {
|
|
40801
40820
|
Connection: "close",
|
|
40802
40821
|
"Content-Type": "text/html",
|
|
40803
|
-
"Content-Length": Buffer.byteLength(
|
|
40822
|
+
"Content-Length": Buffer.byteLength(message3),
|
|
40804
40823
|
...headers
|
|
40805
40824
|
};
|
|
40806
40825
|
socket.once("finish", socket.destroy);
|
|
40807
40826
|
socket.end(
|
|
40808
40827
|
`HTTP/1.1 ${code3} ${http.STATUS_CODES[code3]}\r
|
|
40809
|
-
` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" +
|
|
40828
|
+
` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message3
|
|
40810
40829
|
);
|
|
40811
40830
|
}
|
|
40812
|
-
function abortHandshakeOrEmitwsClientError(server, req, socket, code3,
|
|
40831
|
+
function abortHandshakeOrEmitwsClientError(server, req, socket, code3, message3, headers) {
|
|
40813
40832
|
if (server.listenerCount("wsClientError")) {
|
|
40814
|
-
const err = new Error(
|
|
40833
|
+
const err = new Error(message3);
|
|
40815
40834
|
Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
|
|
40816
40835
|
server.emit("wsClientError", err, socket, req);
|
|
40817
40836
|
} else {
|
|
40818
|
-
abortHandshake(socket, code3,
|
|
40837
|
+
abortHandshake(socket, code3, message3, headers);
|
|
40819
40838
|
}
|
|
40820
40839
|
}
|
|
40821
40840
|
}
|
|
@@ -41357,9 +41376,9 @@ function isAuthError(err, structuredOnly = false) {
|
|
|
41357
41376
|
if (structuredOnly) return false;
|
|
41358
41377
|
return /\b(401|403|unauthenticated|unauthorized|not authenticated)\b/i.test(msg);
|
|
41359
41378
|
}
|
|
41360
|
-
function convexHttpErrorCode(
|
|
41379
|
+
function convexHttpErrorCode(message3) {
|
|
41361
41380
|
try {
|
|
41362
|
-
const body = JSON.parse(
|
|
41381
|
+
const body = JSON.parse(message3);
|
|
41363
41382
|
return body && typeof body === "object" && "code" in body && typeof body.code === "string" ? body.code : null;
|
|
41364
41383
|
} catch {
|
|
41365
41384
|
return null;
|
|
@@ -41482,9 +41501,9 @@ async function resolveAdminCaller(allowAgentReads = false) {
|
|
|
41482
41501
|
const creds = allowAgentReads && selected ? void 0 : loadPlatformCredentials();
|
|
41483
41502
|
if (!creds) {
|
|
41484
41503
|
if (!allowAgentReads) throw new Error("These admin commands need a platform key. Agent Platform access covers tables, get and page only.");
|
|
41485
|
-
const
|
|
41504
|
+
const agent2 = await resolveCaller();
|
|
41486
41505
|
return {
|
|
41487
|
-
...
|
|
41506
|
+
...agent2,
|
|
41488
41507
|
query: async (reference, args) => {
|
|
41489
41508
|
const { getFunctionName: getFunctionName3 } = await Promise.resolve().then(() => (init_server(), server_exports));
|
|
41490
41509
|
const name4 = getFunctionName3(reference);
|
|
@@ -41492,9 +41511,9 @@ async function resolveAdminCaller(allowAgentReads = false) {
|
|
|
41492
41511
|
if (!name4.startsWith("admin/inspect:") || !["tables", "get", "page"].includes(operation)) {
|
|
41493
41512
|
throw new Error("Agent Platform access covers admin tables, get and page only");
|
|
41494
41513
|
}
|
|
41495
|
-
if (operation === "tables") return
|
|
41496
|
-
if (operation === "get") return
|
|
41497
|
-
return
|
|
41514
|
+
if (operation === "tables") return agent2.mutation(makeFunctionReference("admin/inspect:agentTables"), {});
|
|
41515
|
+
if (operation === "get") return agent2.mutation(makeFunctionReference("admin/inspect:agentGet"), args);
|
|
41516
|
+
return agent2.mutation(makeFunctionReference("admin/inspect:agentPage"), args);
|
|
41498
41517
|
}
|
|
41499
41518
|
};
|
|
41500
41519
|
}
|
|
@@ -41612,7 +41631,6 @@ var activityFieldConfigureResult = v2.union(
|
|
|
41612
41631
|
v2.object({ command: v2.literal("setLayout") }),
|
|
41613
41632
|
v2.object({ command: v2.literal("copyLayout"), copied: v2.number(), conflicts: v2.array(conflict) })
|
|
41614
41633
|
);
|
|
41615
|
-
var activityFieldAliases = { activity_fields_get: "getActivityFields", activity_fields_configure: "configureActivityFields" };
|
|
41616
41634
|
function parseActivityFieldRequest(name4, validator, raw) {
|
|
41617
41635
|
if (!validate2(validator, raw)) throw new OperationInputError(name4, [{ path: [], reason: "custom" }]);
|
|
41618
41636
|
return raw;
|
|
@@ -41622,7 +41640,7 @@ function definition3(name4) {
|
|
|
41622
41640
|
const resultSchema3 = operationResultSchema(read ? activityFieldReadResult : activityFieldConfigureResult);
|
|
41623
41641
|
return {
|
|
41624
41642
|
name: name4,
|
|
41625
|
-
aliases: [
|
|
41643
|
+
aliases: [{ name: read ? "ente_activity_fields_get" : "ente_activity_fields_configure", profile: "mounted-view" }],
|
|
41626
41644
|
actor: "agent",
|
|
41627
41645
|
title: read ? "Read activity fields and layouts" : "Configure activity fields and layouts",
|
|
41628
41646
|
description: read ? "Get activity definitions/layout or preview copy. Generic read scope and membership required; excludes task-only keys." : "Owner/admin with generic write scope required (Personal: owner); excludes task-only keys. Create field; setLayout orders pins, hides editor fields, lists card fields; perFieldLine defaults false. Task card fields may be unpinned. setCardVisibility changes only card visibility. Hidden values remain readable. Copy requires unchanged fingerprints and confirmOverwrite for existing layout.",
|
|
@@ -41990,20 +42008,20 @@ var AgentPermissions = class extends ClientCommand {
|
|
|
41990
42008
|
if (this.check !== void 0) {
|
|
41991
42009
|
const query = this.check.trim();
|
|
41992
42010
|
if (!query) throw new Error("--check requires a non-empty space name or ID");
|
|
41993
|
-
const matches = permissions.filter((
|
|
42011
|
+
const matches = permissions.filter((space3) => space3.spaceId === query || space3.name.toLocaleLowerCase() === query.toLocaleLowerCase());
|
|
41994
42012
|
if (matches.length !== 1) throw new Error(matches.length ? `Space '${query}' is ambiguous; use its ID.` : `Space '${query}' was not found in this account; check its ID and account membership.`);
|
|
41995
|
-
const
|
|
41996
|
-
const allowed = this.action === "write" ?
|
|
41997
|
-
const
|
|
41998
|
-
this.emitText({ ...selection2, allowed, action: this.action, ...
|
|
42013
|
+
const space2 = matches[0];
|
|
42014
|
+
const allowed = this.action === "write" ? space2.canWrite : space2.canRead;
|
|
42015
|
+
const message3 = allowed ? `${this.action} allowed in '${space2.name}' for agent '${identity2.name}'.` : `${this.action} denied in '${space2.name}' for agent '${identity2.name}' (effective access: ${space2.access}). In the web app, check this agent's per-space 'Agent actions' setting and this key's read/write scopes in Connections. Connection and OAuth consent limits also apply.`;
|
|
42016
|
+
this.emitText({ ...selection2, allowed, action: this.action, ...space2, message: message3 }, () => message3);
|
|
41999
42017
|
return allowed ? 0 : 1;
|
|
42000
42018
|
}
|
|
42001
|
-
this.print({ ...selection2, identity: identity2, data: permissions }, (result) => result.data.map((
|
|
42002
|
-
Space:
|
|
42003
|
-
ID:
|
|
42004
|
-
"Agent actions":
|
|
42005
|
-
Read:
|
|
42006
|
-
Write:
|
|
42019
|
+
this.print({ ...selection2, identity: identity2, data: permissions }, (result) => result.data.map((space2) => ({
|
|
42020
|
+
Space: space2.name,
|
|
42021
|
+
ID: space2.spaceId,
|
|
42022
|
+
"Agent actions": space2.access,
|
|
42023
|
+
Read: space2.canRead ? "yes" : "no",
|
|
42024
|
+
Write: space2.canWrite ? "yes" : "no",
|
|
42007
42025
|
"Panel access (account)": result.identity.panelAccess,
|
|
42008
42026
|
"Platform access": result.identity.platformLevel ?? "none",
|
|
42009
42027
|
"Platform expiry": result.identity.platformExpiresAt ? new Date(result.identity.platformExpiresAt).toISOString() : "none"
|
|
@@ -42012,6 +42030,109 @@ var AgentPermissions = class extends ClientCommand {
|
|
|
42012
42030
|
};
|
|
42013
42031
|
var IDENTITY_COMMANDS = [AuthWhoami, AgentPermissions];
|
|
42014
42032
|
|
|
42033
|
+
// ente/currentTask.ts
|
|
42034
|
+
var CURRENT_TASK_TOKEN = "@current";
|
|
42035
|
+
var CURRENT_TASK_ENV = "ENTE_CURRENT_TASK";
|
|
42036
|
+
var PLACEHOLDER = /\$\{([^}]*)\}/g;
|
|
42037
|
+
var VARIABLE = /^[A-Za-z_][A-Za-z0-9_]*$/u;
|
|
42038
|
+
var EXAMPLE = "t3_threads=t3code://threads/<installation>/${T3CODE_THREAD_ID}";
|
|
42039
|
+
function parseCurrentTaskRule(raw) {
|
|
42040
|
+
const rule = raw.trim();
|
|
42041
|
+
const split = rule.indexOf("=");
|
|
42042
|
+
if (split < 0) {
|
|
42043
|
+
if (!looksLikeConvexId2(rule)) throw new Error(`Current task rule '${rule}' is neither a task ID nor label=value (e.g. ${EXAMPLE}).`);
|
|
42044
|
+
return { kind: "task", activityId: rule };
|
|
42045
|
+
}
|
|
42046
|
+
const label = rule.slice(0, split).trim();
|
|
42047
|
+
const template = rule.slice(split + 1).trim();
|
|
42048
|
+
if (!label || !template) throw new Error(`A current task lookup needs label=value (e.g. ${EXAMPLE}).`);
|
|
42049
|
+
for (const [, name4] of template.matchAll(PLACEHOLDER)) {
|
|
42050
|
+
if (!VARIABLE.test(name4 ?? "")) throw new Error(`Invalid placeholder \${${name4}} in the current task rule; use \${NAME} with letters, digits and underscores.`);
|
|
42051
|
+
}
|
|
42052
|
+
if (template.replace(PLACEHOLDER, "").includes("${")) throw new Error("Unclosed ${ placeholder in the current task rule.");
|
|
42053
|
+
return { kind: "lookup", label, template };
|
|
42054
|
+
}
|
|
42055
|
+
function expandCurrentTaskValue(template, env = process.env) {
|
|
42056
|
+
const missing = [];
|
|
42057
|
+
const value = template.replace(PLACEHOLDER, (_, name4) => {
|
|
42058
|
+
const found = env[name4];
|
|
42059
|
+
if (!found) missing.push(name4);
|
|
42060
|
+
return found ?? "";
|
|
42061
|
+
});
|
|
42062
|
+
if (missing.length) {
|
|
42063
|
+
throw new Error(`@current: environment variable ${missing.join(", ")} is not set, so the rule '${template}' cannot identify this session. Pass the task ID instead.`);
|
|
42064
|
+
}
|
|
42065
|
+
return value;
|
|
42066
|
+
}
|
|
42067
|
+
function currentTaskSetting(env = process.env, cwd = process.cwd()) {
|
|
42068
|
+
const fromEnv = env[CURRENT_TASK_ENV]?.trim();
|
|
42069
|
+
if (fromEnv) return { rule: fromEnv, source: "env" };
|
|
42070
|
+
const binding = nearestBinding(ENTE_BRANDING, cwd);
|
|
42071
|
+
return binding?.currentTask ? { rule: binding.currentTask, source: "directory", directory: binding.path } : null;
|
|
42072
|
+
}
|
|
42073
|
+
async function resolveCurrentTask(lookup3, { env = process.env, cwd = process.cwd() } = {}) {
|
|
42074
|
+
const setting2 = currentTaskSetting(env, cwd);
|
|
42075
|
+
if (!setting2) {
|
|
42076
|
+
throw new Error(`${CURRENT_TASK_TOKEN} is not configured here. Pass the task ID, set ${CURRENT_TASK_ENV}, or bind a rule with 'ente auth bind <folder> <profile> --current-task <task-id | label=value>'.`);
|
|
42077
|
+
}
|
|
42078
|
+
const where = setting2.source === "env" ? CURRENT_TASK_ENV : `the binding of ${setting2.directory}`;
|
|
42079
|
+
let rule;
|
|
42080
|
+
try {
|
|
42081
|
+
rule = parseCurrentTaskRule(setting2.rule);
|
|
42082
|
+
} catch (error62) {
|
|
42083
|
+
throw new Error(`${where}: ${error62 instanceof Error ? error62.message : String(error62)}`);
|
|
42084
|
+
}
|
|
42085
|
+
const base = { source: setting2.source, ...setting2.directory ? { directory: setting2.directory } : {} };
|
|
42086
|
+
if (rule.kind === "task") return { activityId: rule.activityId, ...base };
|
|
42087
|
+
const field = { label: rule.label, value: expandCurrentTaskValue(rule.template, env) };
|
|
42088
|
+
const matches = await lookup3(field);
|
|
42089
|
+
if (!matches.length) {
|
|
42090
|
+
throw new Error(`@current: no task has ${field.label}=${field.value} (rule from ${where}). Nothing was changed; @current never creates a task.`);
|
|
42091
|
+
}
|
|
42092
|
+
const newest = matches.reduce((best, match) => match.createdAt > best.createdAt ? match : best);
|
|
42093
|
+
return { activityId: newest.activityId, ...base, field, matches: matches.length };
|
|
42094
|
+
}
|
|
42095
|
+
function profileFromArgv(argv) {
|
|
42096
|
+
for (let i = 0; i < argv.length; i++) {
|
|
42097
|
+
const arg = argv[i];
|
|
42098
|
+
if (arg === "--") return void 0;
|
|
42099
|
+
if (arg === "--profile") return argv[i + 1] || void 0;
|
|
42100
|
+
if (arg.startsWith("--profile=")) return arg.slice("--profile=".length) || void 0;
|
|
42101
|
+
}
|
|
42102
|
+
return void 0;
|
|
42103
|
+
}
|
|
42104
|
+
function isToken(arg) {
|
|
42105
|
+
return arg === CURRENT_TASK_TOKEN || /^--[^=]+=@current$/u.test(arg);
|
|
42106
|
+
}
|
|
42107
|
+
function usesCurrentTask(argv) {
|
|
42108
|
+
return argv.some(isToken);
|
|
42109
|
+
}
|
|
42110
|
+
function substituteCurrentTask(argv, activityId2) {
|
|
42111
|
+
return argv.map((arg) => arg === CURRENT_TASK_TOKEN ? activityId2 : isToken(arg) ? `${arg.slice(0, -CURRENT_TASK_TOKEN.length)}${activityId2}` : arg);
|
|
42112
|
+
}
|
|
42113
|
+
function restCurrentTaskLookup(client) {
|
|
42114
|
+
return async (field) => {
|
|
42115
|
+
const res = await client.listTasks({ onlyOpen: "false", field: JSON.stringify(field) });
|
|
42116
|
+
return (res.data ?? []).flatMap((row) => row.activity?._id ? [{ activityId: row.activity._id, createdAt: row.activity.createdAt ?? 0 }] : []);
|
|
42117
|
+
};
|
|
42118
|
+
}
|
|
42119
|
+
var ACTIVITY_GONE_MESSAGE = "Activity not found: it was deleted or merged into another activity, or this profile cannot access it. Look the task up again (for example with @current) instead of retrying this ID.";
|
|
42120
|
+
function explainActivityNotFound(error62) {
|
|
42121
|
+
if (!(error62 instanceof Error)) return error62;
|
|
42122
|
+
const status2 = error62.statusCode;
|
|
42123
|
+
const data = error62.data ?? error62.error;
|
|
42124
|
+
const code3 = data && typeof data === "object" ? data.code : void 0;
|
|
42125
|
+
const detail = error62.detail;
|
|
42126
|
+
const text4 = data && typeof data === "object" && typeof data.message === "string" ? data.message : typeof detail === "string" ? detail : error62.message;
|
|
42127
|
+
const match = /^Activity not found(?::\s*(\S+))?$/u.exec(text4.trim());
|
|
42128
|
+
if (status2 !== 404 && code3 !== "NOT_FOUND" || !match) return error62;
|
|
42129
|
+
const message3 = match[1] ? ACTIVITY_GONE_MESSAGE.replace("Activity not found", `Activity ${match[1]} not found`) : ACTIVITY_GONE_MESSAGE;
|
|
42130
|
+
return Object.assign(new Error(message3), {
|
|
42131
|
+
messageIsComplete: true,
|
|
42132
|
+
data: { ...data && typeof data === "object" ? data : {}, code: "NOT_FOUND", message: message3, ...typeof status2 === "number" ? { statusCode: status2 } : {} }
|
|
42133
|
+
});
|
|
42134
|
+
}
|
|
42135
|
+
|
|
42015
42136
|
// ente/commands/authPair.ts
|
|
42016
42137
|
import { createHash as createHash3, randomBytes, randomInt } from "node:crypto";
|
|
42017
42138
|
import { existsSync as existsSync5, readFileSync as readFileSync5, rmSync as rmSync3, writeFileSync as writeFileSync5 } from "node:fs";
|
|
@@ -42295,6 +42416,12 @@ var AuthLogin = class extends BaseCommand {
|
|
|
42295
42416
|
this.out(` Config saved to ${configPath(ENTE_BRANDING, this.profile)}`);
|
|
42296
42417
|
}
|
|
42297
42418
|
};
|
|
42419
|
+
function currentTaskStatus() {
|
|
42420
|
+
const setting2 = currentTaskSetting();
|
|
42421
|
+
if (!setting2) return null;
|
|
42422
|
+
const missingVariables = [...setting2.rule.matchAll(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g)].flatMap(([, name4]) => name4 && !process.env[name4] ? [name4] : []);
|
|
42423
|
+
return { rule: setting2.rule, source: setting2.source, directory: setting2.directory ?? null, missingVariables };
|
|
42424
|
+
}
|
|
42298
42425
|
var AuthStatus = class extends BaseCommand {
|
|
42299
42426
|
static paths = [["auth", "status"]];
|
|
42300
42427
|
static usage = Command.Usage({
|
|
@@ -42315,11 +42442,14 @@ var AuthStatus = class extends BaseCommand {
|
|
|
42315
42442
|
profileSource: selection2.source,
|
|
42316
42443
|
boundDirectory: selection2.directory ?? null,
|
|
42317
42444
|
source: credentials?.source ?? null,
|
|
42318
|
-
url: credentials?.apiUrl ?? null
|
|
42445
|
+
url: credentials?.apiUrl ?? null,
|
|
42446
|
+
currentTask: currentTaskStatus()
|
|
42319
42447
|
};
|
|
42448
|
+
const current = status2.currentTask ? `
|
|
42449
|
+
@current: ${status2.currentTask.rule} (${status2.currentTask.source})${status2.currentTask.missingVariables.length ? `; not set here: ${status2.currentTask.missingVariables.join(", ")}` : ""}` : "";
|
|
42320
42450
|
this.emitText(status2, () => credentials ? `Profile: ${status2.profile} (${status2.profileSource})
|
|
42321
42451
|
Source: ${status2.source}
|
|
42322
|
-
URL: ${status2.url}
|
|
42452
|
+
URL: ${status2.url}${current}
|
|
42323
42453
|
Credentials configured; run a read-only command to verify server access.` : `Profile '${status2.profile}' is not authenticated.
|
|
42324
42454
|
Run 'ente auth bind <path> <profile>' to select an existing profile, or see https://ente.fast/cli.md for local login.`);
|
|
42325
42455
|
}
|
|
@@ -42365,9 +42495,14 @@ var AuthBind = class extends BaseCommand {
|
|
|
42365
42495
|
folder = options_exports.String({ name: "path" });
|
|
42366
42496
|
profileName = options_exports.String({ name: "profile" });
|
|
42367
42497
|
profile = options_exports.String("--profile", { description: "Accepted for consistency; the positional profile is bound" });
|
|
42498
|
+
currentTask = options_exports.String("--current-task", { description: "What @current means in this folder: a task ID, or label=value with ${VAR} placeholders (newest task whose field holds the value)" });
|
|
42499
|
+
clearCurrentTask = options_exports.Boolean("--clear-current-task", false, { description: "Remove the folder's @current rule" });
|
|
42368
42500
|
async run() {
|
|
42369
|
-
|
|
42370
|
-
this.
|
|
42501
|
+
if (this.currentTask !== void 0 && this.clearCurrentTask) throw new Error("Use either --current-task or --clear-current-task, not both.");
|
|
42502
|
+
if (this.currentTask !== void 0) parseCurrentTaskRule(this.currentTask);
|
|
42503
|
+
const binding = bindProfile(ENTE_BRANDING, this.folder, this.profileName, this.clearCurrentTask ? null : this.currentTask?.trim());
|
|
42504
|
+
this.emitText(binding, () => `Bound ${binding.path} to profile '${binding.profile}'${binding.currentTask ? `
|
|
42505
|
+
@current: ${binding.currentTask}` : ""}`);
|
|
42371
42506
|
}
|
|
42372
42507
|
};
|
|
42373
42508
|
var AuthUnbind = class extends BaseCommand {
|
|
@@ -42386,7 +42521,7 @@ var AuthBindings = class extends BaseCommand {
|
|
|
42386
42521
|
profile = options_exports.String("--profile", { description: "Accepted for consistency; bindings are machine-local" });
|
|
42387
42522
|
async run() {
|
|
42388
42523
|
const bindings = listProfileBindings(ENTE_BRANDING);
|
|
42389
|
-
this.print(bindings, (data) => data.map((binding) => ({ Path: binding.path, Profile: binding.profile })));
|
|
42524
|
+
this.print(bindings, (data) => data.map((binding) => ({ Path: binding.path, Profile: binding.profile, "@current": binding.currentTask ?? "" })));
|
|
42390
42525
|
}
|
|
42391
42526
|
};
|
|
42392
42527
|
var AuthPlatformLogin = class extends BaseCommand {
|
|
@@ -42458,22 +42593,22 @@ var AUTH_COMMANDS = [
|
|
|
42458
42593
|
];
|
|
42459
42594
|
|
|
42460
42595
|
// ../packages/shared/src/relationship-operation-results.ts
|
|
42461
|
-
var
|
|
42462
|
-
var relationshipSummary = external_exports.strictObject({ entityId:
|
|
42463
|
-
var relationshipAddReceipt = external_exports.strictObject({ action: external_exports.literal("add"), pinId:
|
|
42596
|
+
var id16 = external_exports.string().min(1);
|
|
42597
|
+
var relationshipSummary = external_exports.strictObject({ entityId: id16, name: external_exports.string(), type: external_exports.enum(ENTITY_TYPE_VALUES), role: external_exports.string().max(RELATIONSHIP_LIMITS.role).optional(), displayOrder: external_exports.number().finite().optional(), includeInAggregation: external_exports.boolean() });
|
|
42598
|
+
var relationshipAddReceipt = external_exports.strictObject({ action: external_exports.literal("add"), pinId: id16, alreadyExists: external_exports.boolean() });
|
|
42464
42599
|
var relationshipRemoveReceipt = external_exports.strictObject({ action: external_exports.literal("remove"), success: external_exports.literal(true) });
|
|
42465
42600
|
var relationshipResults = { listPins: external_exports.array(relationshipSummary).max(RELATIONSHIP_LIMITS.rows), managePins: external_exports.discriminatedUnion("action", [relationshipAddReceipt, relationshipRemoveReceipt]) };
|
|
42466
42601
|
function checkRelationshipResult(schema, raw) {
|
|
42467
42602
|
return parseZodOperationResult("relationship", schema, raw, "Invalid relationship result");
|
|
42468
42603
|
}
|
|
42469
|
-
var relationshipCliSummary = external_exports.strictObject({ entityId:
|
|
42604
|
+
var relationshipCliSummary = external_exports.strictObject({ entityId: id16, name: external_exports.string().optional(), type: external_exports.enum(ENTITY_TYPE_VALUES).optional(), role: external_exports.string().optional() });
|
|
42470
42605
|
var relationshipPublicListRow = external_exports.strictObject({
|
|
42471
|
-
_id:
|
|
42472
|
-
targetEntityId:
|
|
42606
|
+
_id: id16,
|
|
42607
|
+
targetEntityId: id16,
|
|
42473
42608
|
role: external_exports.string().max(RELATIONSHIP_LIMITS.role).optional(),
|
|
42474
42609
|
displayOrder: external_exports.number().finite().optional(),
|
|
42475
42610
|
includeInAggregation: external_exports.boolean(),
|
|
42476
|
-
targetEntity: external_exports.strictObject({ _id:
|
|
42611
|
+
targetEntity: external_exports.strictObject({ _id: id16, name: external_exports.string(), type: external_exports.enum(ENTITY_TYPE_VALUES), customIcon: entityReadFields.customIcon, customIconColor: entityReadFields.customIconColor, imageId: id16.optional(), displayName: external_exports.string(), parentNames: external_exports.array(external_exports.string()), parentDetails: external_exports.array(readParentDetail) }).nullable()
|
|
42477
42612
|
});
|
|
42478
42613
|
var relationshipPublicList = external_exports.array(relationshipPublicListRow).max(RELATIONSHIP_LIMITS.rows);
|
|
42479
42614
|
function projectRelationshipCliList(raw) {
|
|
@@ -42504,78 +42639,6 @@ var uploadRetryInstructions = [
|
|
|
42504
42639
|
"Use a validated storage ID only for a confirmed remaining link step; an unknown upload response may already have stored the file."
|
|
42505
42640
|
];
|
|
42506
42641
|
|
|
42507
|
-
// ../packages/shared/src/task-read-operations.ts
|
|
42508
|
-
var TASK_READ_LIMITS = { results: 200, children: 100, childLinks: 1e3, childSources: 400 };
|
|
42509
|
-
var id16 = external_exports.string().min(1).max(128);
|
|
42510
|
-
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() };
|
|
42511
|
-
var taskReadInputs = {
|
|
42512
|
-
listTasks: external_exports.strictObject(list2),
|
|
42513
|
-
getTaskByNumber: external_exports.strictObject({ number: external_exports.number().int().positive().max(Number.MAX_SAFE_INTEGER), spaceId: id16.optional() }),
|
|
42514
|
-
listOpenTasks: external_exports.strictObject({ spaceId: id16 }),
|
|
42515
|
-
listTasksDueBy: external_exports.strictObject({ spaceId: id16, deadline: activityWriteDeadline, includeOverdue: external_exports.boolean().default(true) }),
|
|
42516
|
-
listOpenTasksForEntity: external_exports.strictObject({ entityId: id16 })
|
|
42517
|
-
};
|
|
42518
|
-
|
|
42519
|
-
// ../packages/shared/src/activity-read-transport-results.ts
|
|
42520
|
-
var attachment2 = external_exports.object({ ...publicActivityReadDto.shape.attachments.unwrap().element.shape, url: external_exports.string().nullable().optional(), attachmentId: external_exports.string().optional() });
|
|
42521
|
-
var user2 = external_exports.object(publicActivityDetailDto.shape.createdByUser.unwrap().shape);
|
|
42522
|
-
var agent2 = external_exports.object(publicActivityDetailDto.shape.createdByAgent.unwrap().unwrap().shape);
|
|
42523
|
-
var agentCreator = external_exports.object(publicActivityDetailDto.shape.createdByAgentCreatorUser.unwrap().unwrap().shape);
|
|
42524
|
-
var agenda2 = external_exports.object(publicActivityDetailDto.shape.agendaPoints.element.shape);
|
|
42525
|
-
var message2 = external_exports.object({
|
|
42526
|
-
...publicActivityDetailDto.shape.messages.element.shape,
|
|
42527
|
-
createdByUser: user2.nullable(),
|
|
42528
|
-
createdByAgent: agent2.nullable().optional(),
|
|
42529
|
-
updatedByAgent: agent2.nullable().optional()
|
|
42530
|
-
});
|
|
42531
|
-
var activityReadRecord = external_exports.object({
|
|
42532
|
-
...publicActivityReadDto.shape,
|
|
42533
|
-
attachments: external_exports.array(attachment2).optional(),
|
|
42534
|
-
entityIds: external_exports.array(external_exports.string()).optional(),
|
|
42535
|
-
entityDetails: external_exports.array(selectPublicEntityRead.nullable()).optional(),
|
|
42536
|
-
agendaPoints: external_exports.array(agenda2).optional(),
|
|
42537
|
-
messages: external_exports.array(message2).optional(),
|
|
42538
|
-
createdByUser: user2.nullable().optional(),
|
|
42539
|
-
createdViaAgent: agent2.nullable().optional(),
|
|
42540
|
-
updatedViaAgent: agent2.nullable().optional(),
|
|
42541
|
-
createdByPersonalAgent: external_exports.boolean().optional(),
|
|
42542
|
-
createdByAgent: agent2.nullable().optional(),
|
|
42543
|
-
updatedByAgent: agent2.nullable().optional(),
|
|
42544
|
-
createdByAgentCreatorUser: agentCreator.nullable().optional(),
|
|
42545
|
-
assignees: external_exports.array(external_exports.object({ userId: external_exports.string(), name: external_exports.string().optional(), email: external_exports.string().optional() })).optional()
|
|
42546
|
-
});
|
|
42547
|
-
var compactMetadata = external_exports.strictObject({ mode: external_exports.literal("compact"), contentExcerptChars: external_exports.number(), omittedFields: external_exports.array(external_exports.string()), fullDetail: external_exports.strictObject({ cli: external_exports.string(), mcp: external_exports.string(), agent: external_exports.string() }) });
|
|
42548
|
-
var space2 = external_exports.strictObject({ spaceId: external_exports.string(), spaceName: external_exports.string(), memberEmails: external_exports.array(external_exports.string()), scope: external_exports.string().optional() });
|
|
42549
|
-
var page2 = external_exports.strictObject({ activities: external_exports.array(activityReadRecord), hasMore: external_exports.boolean(), nextCursor: external_exports.string().optional(), projection: compactMetadata.optional(), spaces: external_exports.record(external_exports.string(), space2).optional() });
|
|
42550
|
-
var activityReadTransportResults = { getActivity: activityReadRecord.nullable(), listActivities: page2, searchActivities: external_exports.array(activityReadRecord), listRecentActivities: page2 };
|
|
42551
|
-
var historyFields = { hasMore: page2.shape.hasMore, nextCursor: page2.shape.nextCursor, projection: page2.shape.projection, spaces: page2.shape.spaces };
|
|
42552
|
-
var activityMcpEnvelopes = {
|
|
42553
|
-
getActivity: external_exports.strictObject({ data: activityReadRecord }),
|
|
42554
|
-
listActivities: external_exports.strictObject({ data: external_exports.array(activityReadRecord), hasMore: external_exports.boolean() }),
|
|
42555
|
-
searchActivities: external_exports.strictObject({ data: external_exports.array(activityReadRecord) }),
|
|
42556
|
-
listRecentActivities: external_exports.strictObject({ activities: external_exports.array(activityReadRecord), ...historyFields })
|
|
42557
|
-
};
|
|
42558
|
-
var activityRestEnvelopes = {
|
|
42559
|
-
getActivity: activityMcpEnvelopes.getActivity,
|
|
42560
|
-
listActivities: external_exports.strictObject({ data: external_exports.array(activityReadRecord), ...historyFields }),
|
|
42561
|
-
listRecentActivities: external_exports.strictObject({ data: external_exports.array(activityReadRecord), ...historyFields })
|
|
42562
|
-
};
|
|
42563
|
-
var publicCliActivityListEnvelope = activityRestEnvelopes.listActivities.partial({ hasMore: true });
|
|
42564
|
-
|
|
42565
|
-
// ../packages/shared/src/task-read-operation-results.ts
|
|
42566
|
-
var entity2 = external_exports.strictObject({ entityId: external_exports.string().min(1), name: external_exports.string(), type: external_exports.enum(ENTITY_TYPE_VALUES) });
|
|
42567
|
-
var taskReadItem = external_exports.strictObject({ activity: publicActivityReadDto.extend({ type: external_exports.literal("task") }), entities: external_exports.array(entity2) });
|
|
42568
|
-
var selectTask = selectPublicActivityRead.extend({ type: external_exports.literal("task"), attachments: external_exports.array(external_exports.object(publicActivityReadDto.shape.attachments.unwrap().element.shape)).optional() });
|
|
42569
|
-
var selection = external_exports.object({ activity: selectTask, entities: external_exports.array(external_exports.object(entity2.shape)) });
|
|
42570
|
-
var taskReadTransportItem = external_exports.strictObject({ activity: activityReadRecord.extend({ type: external_exports.literal("task") }), entities: external_exports.array(entity2) });
|
|
42571
|
-
var tasks = external_exports.array(taskReadItem).max(TASK_READ_LIMITS.results);
|
|
42572
|
-
var transportTasks = external_exports.array(taskReadTransportItem).max(TASK_READ_LIMITS.results);
|
|
42573
|
-
var taskReadResults = { listTasks: tasks, getTaskByNumber: taskReadItem.nullable(), listOpenTasks: tasks, listTasksDueBy: tasks, listOpenTasksForEntity: tasks };
|
|
42574
|
-
var taskReadTransportResults = { listTasks: transportTasks, getTaskByNumber: taskReadTransportItem.nullable(), listOpenTasks: transportTasks, listTasksDueBy: transportTasks, listOpenTasksForEntity: transportTasks };
|
|
42575
|
-
var user3 = external_exports.strictObject({ userId: external_exports.string(), name: external_exports.string(), email: external_exports.string() });
|
|
42576
|
-
var taskReadEnrichedItem = taskReadTransportItem.extend({ activity: taskReadTransportItem.shape.activity.extend({ assignees: external_exports.array(user3) }) });
|
|
42577
|
-
var taskReadUsers = external_exports.record(external_exports.string(), user3);
|
|
42578
|
-
|
|
42579
42642
|
// ../packages/shared/src/activity-content-operations.ts
|
|
42580
42643
|
var ACTIVITY_CONTENT_LIMITS = { defaultBlocks: 20, maxBlocks: 50, defaultCharacters: 12e3, maxCharacters: 5e4, maxEditOperations: 20, maxEditCharacters: 1e5 };
|
|
42581
42644
|
var safeInteger = external_exports.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
@@ -42620,24 +42683,10 @@ var activityContentInputs = {
|
|
|
42620
42683
|
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) }),
|
|
42621
42684
|
editActivityContent: external_exports.strictObject({ activityId: readFields.activityId, expectedContentVersion: activityContentVersion, operations })
|
|
42622
42685
|
};
|
|
42623
|
-
var legacyActivityContentReadInput = external_exports.strictObject({ ...readFields, maxBlocks: safeInteger.min(1).optional(), maxCharacters: safeInteger.min(1).optional() });
|
|
42624
|
-
var activityContentAliases = { activities_contentsRead: "readActivityContents", activities_contentRead: "readActivityContent", activities_contentEdit: "editActivityContent" };
|
|
42625
|
-
function isActivityContentAlias(value) {
|
|
42626
|
-
return Object.hasOwn(activityContentAliases, value);
|
|
42627
|
-
}
|
|
42628
42686
|
function parseActivityContentRequest(operation, raw) {
|
|
42629
42687
|
if (operation === "readActivityContents") return { operation, input: parseOperationInput(operation, activityContentInputs.readActivityContents, raw) };
|
|
42630
42688
|
return operation === "readActivityContent" ? { operation, input: parseOperationInput(operation, activityContentInputs.readActivityContent, raw) } : { operation, input: parseOperationInput(operation, activityContentInputs.editActivityContent, raw) };
|
|
42631
42689
|
}
|
|
42632
|
-
function parseLegacyActivityContentRequest(name4, raw) {
|
|
42633
|
-
const operation = isActivityContentAlias(name4) ? activityContentAliases[name4] : name4;
|
|
42634
|
-
if (operation === "readActivityContents") return parseActivityContentRequest(operation, raw);
|
|
42635
|
-
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return parseActivityContentRequest(operation, raw);
|
|
42636
|
-
const input2 = Object.fromEntries(Object.entries(raw).filter(([key]) => Object.hasOwn(activityContentInputs[operation].shape, key)));
|
|
42637
|
-
if (operation === "editActivityContent") return parseActivityContentRequest(operation, input2);
|
|
42638
|
-
const parsed = parseOperationInput(operation, legacyActivityContentReadInput, input2);
|
|
42639
|
-
return parseActivityContentRequest(operation, { ...parsed, maxBlocks: Math.min(parsed.maxBlocks ?? ACTIVITY_CONTENT_LIMITS.defaultBlocks, ACTIVITY_CONTENT_LIMITS.maxBlocks), maxCharacters: Math.min(parsed.maxCharacters ?? ACTIVITY_CONTENT_LIMITS.defaultCharacters, ACTIVITY_CONTENT_LIMITS.maxCharacters) });
|
|
42640
|
-
}
|
|
42641
42690
|
function parseActivityContentVersionText(raw) {
|
|
42642
42691
|
if (raw === "null") return null;
|
|
42643
42692
|
if (!/^\d+$/.test(raw)) return void 0;
|
|
@@ -42673,8 +42722,8 @@ function graphAck(raw) {
|
|
|
42673
42722
|
var graphContextAck = activityWriteResults.updateActivity.extend({ activityId: graphId2, assigneeIds: external_exports.array(graphId2).optional(), changed: external_exports.literal(false).optional() });
|
|
42674
42723
|
var graphCreated = external_exports.strictObject({ activityId: graphId2 });
|
|
42675
42724
|
var graphMessage = activityWriteResults.addActivityMessage.extend({ activityId: graphId2 });
|
|
42676
|
-
var
|
|
42677
|
-
var graphPublicRich =
|
|
42725
|
+
var entity2 = external_exports.object({ _id: graphId2, name: taskReadEntity.shape.name, type: taskReadEntity.shape.type }).catchall(external_exports.json().optional());
|
|
42726
|
+
var graphPublicRich = activityRichRecord.extend({ type: activityWriteInputs.createActivity.shape.type, entityDetails: external_exports.array(entity2.nullable()) });
|
|
42678
42727
|
var graphMembers = external_exports.array(external_exports.object({
|
|
42679
42728
|
membership: external_exports.object({ _id: graphId2, userId: graphId2, spaceId: graphId2, role: external_exports.enum(["owner", "admin", "member"]) }).catchall(external_exports.json().optional()),
|
|
42680
42729
|
user: external_exports.object({ _id: graphId2, name: external_exports.string().optional(), email: external_exports.string().optional() }).catchall(external_exports.json().optional()).nullable()
|
|
@@ -42761,6 +42810,7 @@ var GraphProgress = class {
|
|
|
42761
42810
|
raw = await call();
|
|
42762
42811
|
} catch (error62) {
|
|
42763
42812
|
if (error62 instanceof Error && "data" in error62 && error62.data && typeof error62.data === "object" && "code" in error62.data) this.outcome = "rejected";
|
|
42813
|
+
if (error62 instanceof ApiError && error62.statusCode === 404) this.outcome = "rejected";
|
|
42764
42814
|
throw error62;
|
|
42765
42815
|
}
|
|
42766
42816
|
if (confirmsWrite) {
|
|
@@ -42882,12 +42932,6 @@ var htmlInputs = {
|
|
|
42882
42932
|
updateHtmlBlock: external_exports.strictObject({ ...write, blockId: selector3, artifactId: selector3, expectedVersionId: selector3 })
|
|
42883
42933
|
};
|
|
42884
42934
|
var htmlCliUpdateInput = htmlInputs.updateHtmlBlock.omit({ artifactId: true, expectedVersionId: true }).partial({ title: true, height: true });
|
|
42885
|
-
var htmlAliases = {
|
|
42886
|
-
html_blocks_list: "listHtmlBlocks",
|
|
42887
|
-
html_blocks_add: "addHtmlBlock",
|
|
42888
|
-
html_blocks_get: "getHtmlBlock",
|
|
42889
|
-
html_blocks_update: "updateHtmlBlock"
|
|
42890
|
-
};
|
|
42891
42935
|
function isHtmlOperationName(name4) {
|
|
42892
42936
|
return Object.hasOwn(htmlInputs, name4);
|
|
42893
42937
|
}
|
|
@@ -42901,7 +42945,7 @@ function definition4(name4) {
|
|
|
42901
42945
|
const schema = external_exports.toJSONSchema(htmlInputs[name4], { io: "input" });
|
|
42902
42946
|
return {
|
|
42903
42947
|
name: name4,
|
|
42904
|
-
aliases:
|
|
42948
|
+
aliases: [],
|
|
42905
42949
|
actor: "agent",
|
|
42906
42950
|
description: descriptions5[name4],
|
|
42907
42951
|
inputSchema: { type: "object", properties: schema.properties ?? {}, required: schema.required ?? [], additionalProperties: false },
|
|
@@ -43116,7 +43160,9 @@ var EntityList = class extends ClientCommand {
|
|
|
43116
43160
|
query = options_exports.String("--query", { description: "Fuzzy name search" });
|
|
43117
43161
|
type = options_exports.String("--type", { description: `Filter by type (${ENTITY_TYPE_VALUES.join(", ")})` });
|
|
43118
43162
|
space = options_exports.String("--space", { description: "Filter by space (name or ID)" });
|
|
43119
|
-
limit = options_exports.String("--limit", { description: "Max results (default: 50)" });
|
|
43163
|
+
limit = options_exports.String("--limit", { description: "Max results per page (default: 50; list pages hold at most 100)" });
|
|
43164
|
+
cursor = options_exports.String("--cursor", { description: "Continue a list from the previous page's nextCursor (same --space, --type, --archived)" });
|
|
43165
|
+
all = options_exports.Boolean("--all", false, { description: "Read every list page; prints all entities at once" });
|
|
43120
43166
|
projection = options_exports.String("--projection", { description: "compact or full public fields" });
|
|
43121
43167
|
archived = options_exports.Boolean("--archived", false, {
|
|
43122
43168
|
description: "Show archived (trashed) entities instead of active ones"
|
|
@@ -43129,7 +43175,9 @@ var EntityList = class extends ClientCommand {
|
|
|
43129
43175
|
space: this.space,
|
|
43130
43176
|
limit: this.limit === void 0 ? void 0 : parseOperationNumberParameter(this.query !== void 0 && !this.archived ? "searchEntities" : "listEntities", "limit", this.limit),
|
|
43131
43177
|
archived: this.archived,
|
|
43132
|
-
projection: this.projection
|
|
43178
|
+
projection: this.projection,
|
|
43179
|
+
cursor: this.cursor,
|
|
43180
|
+
all: this.all
|
|
43133
43181
|
});
|
|
43134
43182
|
}
|
|
43135
43183
|
};
|
|
@@ -43230,16 +43278,16 @@ var EntityGet = class extends ClientCommand {
|
|
|
43230
43278
|
this.emitText({ data: null }, () => "Entity not found or not accessible");
|
|
43231
43279
|
return;
|
|
43232
43280
|
}
|
|
43233
|
-
const spaces = Object.fromEntries(data.spaces.map((
|
|
43234
|
-
const textActivities = data.activities.map((
|
|
43235
|
-
_id:
|
|
43236
|
-
type:
|
|
43237
|
-
title:
|
|
43238
|
-
contentPlainText:
|
|
43239
|
-
createdAt:
|
|
43240
|
-
deadline:
|
|
43241
|
-
completed:
|
|
43242
|
-
shortId:
|
|
43281
|
+
const spaces = Object.fromEntries(data.spaces.map((space2) => [space2.spaceId, space2]));
|
|
43282
|
+
const textActivities = data.activities.map((activity) => ({
|
|
43283
|
+
_id: activity._id,
|
|
43284
|
+
type: activity.type,
|
|
43285
|
+
title: activity.title,
|
|
43286
|
+
contentPlainText: activity.contentPlainText,
|
|
43287
|
+
createdAt: activity.createdAt,
|
|
43288
|
+
deadline: activity.deadline,
|
|
43289
|
+
completed: activity.completed,
|
|
43290
|
+
shortId: activity.shortId
|
|
43243
43291
|
}));
|
|
43244
43292
|
this.emitText(jsonWithSpaces({ data }, spaces), () => withFooter(formatEntityDetail({ ...data, activities: textActivities }), spaces));
|
|
43245
43293
|
}
|
|
@@ -43696,6 +43744,64 @@ function requireEntitySelector(operation, value, field) {
|
|
|
43696
43744
|
if (!value.trim()) throw new OperationInputError(operation, [{ path: [field], reason: "too_small" }]);
|
|
43697
43745
|
}
|
|
43698
43746
|
|
|
43747
|
+
// ente/commands/entityMerge.ts
|
|
43748
|
+
function plural2(count2, word, many = `${word}s`) {
|
|
43749
|
+
return `${count2} ${count2 === 1 ? word : many}`;
|
|
43750
|
+
}
|
|
43751
|
+
function formatMergeSummary(summary) {
|
|
43752
|
+
const { moved } = summary;
|
|
43753
|
+
const lines = [
|
|
43754
|
+
summary.dryRun ? `Dry run: merging "${summary.sourceName}" (${summary.sourceEntityId}) into "${summary.name}" (${summary.entityId}) would move:` : `Merged "${summary.sourceName}" into "${summary.name}" (${summary.entityId}). Moved:`,
|
|
43755
|
+
` ${plural2(moved.activities, "activity", "activities")}, ${plural2(moved.relationships, "relationship")}, ${plural2(moved.whiteboards, "whiteboard")}, ${plural2(moved.calendarEvents, "calendar event")}`,
|
|
43756
|
+
` ${plural2(moved.fieldValues, "field value")}, ${plural2(moved.tags, "tag")}, ${plural2(moved.aliases, "alias", "aliases")}${moved.description ? ", description" : ""}`,
|
|
43757
|
+
` Image: ${summary.image === "target" ? "target keeps its own" : summary.image === "source" ? "target adopts the source image" : "none"}`
|
|
43758
|
+
];
|
|
43759
|
+
if (summary.targetSpacesAdded.length > 0) lines.push(` "${summary.name}" joins: ${summary.targetSpacesAdded.map((space2) => space2.name).join(", ")}`);
|
|
43760
|
+
if (summary.sourceSpacesAdded.length > 0) lines.push(` "${summary.sourceName}" content becomes visible in: ${summary.sourceSpacesAdded.map((space2) => space2.name).join(", ")}`);
|
|
43761
|
+
for (const grant of summary.parentSpaceGrants)
|
|
43762
|
+
lines.push(` Parent "${grant.name}" must be shared into: ${grant.missingSpaces.map((space2) => `${space2.name} (${space2.memberCount} members)`).join(", ")}`);
|
|
43763
|
+
if (summary.dryRun && summary.parentSpaceGrantFingerprint && !summary.requiresPerson)
|
|
43764
|
+
lines.push(` To confirm the parent grants: --share-parents --parent-space-grant-fingerprint ${summary.parentSpaceGrantFingerprint}`);
|
|
43765
|
+
if (summary.requiresPerson) lines.push(" A person must approve this sharing: merge in the Ente app (entity Settings \u2192 Merge into another entity).");
|
|
43766
|
+
if (!summary.dryRun) lines.push(` "${summary.sourceName}" was deleted; links to it now open "${summary.name}".`);
|
|
43767
|
+
return lines.join("\n");
|
|
43768
|
+
}
|
|
43769
|
+
var EntityMerge = class extends ClientCommand {
|
|
43770
|
+
static paths = [["entity", "merge"]];
|
|
43771
|
+
static usage = Command.Usage({
|
|
43772
|
+
category: "Entity",
|
|
43773
|
+
description: "Merge a source entity into a target entity (source is deleted)",
|
|
43774
|
+
details: "Same operation as the app's entity Settings \u2192 Merge into another entity. Activities, relationships, the description, whiteboards, calendar events, tags, aliases (including the source name) and field values move to the target. The target keeps its image and adopts the source image only when it has none. Run --dry-run first. Use IDs when both entities share a name.",
|
|
43775
|
+
examples: [
|
|
43776
|
+
["Preview a merge", "$0 entity merge <sourceId> <targetId> --dry-run"],
|
|
43777
|
+
["Merge", "$0 entity merge <sourceId> <targetId>"],
|
|
43778
|
+
["Confirm the parent grants from the dry run", "$0 entity merge <sourceId> <targetId> --share-parents --parent-space-grant-fingerprint <fingerprint>"]
|
|
43779
|
+
]
|
|
43780
|
+
});
|
|
43781
|
+
source = options_exports.String();
|
|
43782
|
+
target = options_exports.String();
|
|
43783
|
+
dryRun = options_exports.Boolean("--dry-run", false, { description: "Report what would move and which grants are needed, without writing" });
|
|
43784
|
+
shareParents = options_exports.Boolean("--share-parents", false, {
|
|
43785
|
+
description: "Confirm the parent grants the dry run listed (agent keys: only into spaces where you are the sole member)"
|
|
43786
|
+
});
|
|
43787
|
+
parentSpaceGrantFingerprint = options_exports.String("--parent-space-grant-fingerprint", {
|
|
43788
|
+
description: "Exact parentSpaceGrantFingerprint from the dry run; a changed grant set fails"
|
|
43789
|
+
});
|
|
43790
|
+
async run() {
|
|
43791
|
+
if (this.shareParents && !this.parentSpaceGrantFingerprint)
|
|
43792
|
+
throw new Error("--share-parents needs --parent-space-grant-fingerprint from `ente entity merge --dry-run`.");
|
|
43793
|
+
const confirmation = this.shareParents ? { grantMissingParentAccess: true, parentSpaceGrantFingerprint: this.parentSpaceGrantFingerprint } : {};
|
|
43794
|
+
parseEntityWriteRequest("mergeEntity", { sourceEntityId: "pending-source", targetEntityId: "pending-target", dryRun: this.dryRun, ...confirmation });
|
|
43795
|
+
const client = this.client();
|
|
43796
|
+
const sourceEntityId = await resolveEntity(client, this.source);
|
|
43797
|
+
const targetEntityId = await resolveEntity(client, this.target);
|
|
43798
|
+
if (sourceEntityId === targetEntityId) throw new Error("Source and target resolve to the same entity; pass both IDs.");
|
|
43799
|
+
const { data } = await client.entityWrite("mergeEntity", { sourceEntityId, targetEntityId, dryRun: this.dryRun, ...confirmation });
|
|
43800
|
+
this.emitText({ data }, () => formatMergeSummary(data));
|
|
43801
|
+
}
|
|
43802
|
+
};
|
|
43803
|
+
var ENTITY_MERGE_COMMANDS = [EntityMerge];
|
|
43804
|
+
|
|
43699
43805
|
// ente/activity-fields.ts
|
|
43700
43806
|
function parseActivityFields(flags, pairs = []) {
|
|
43701
43807
|
if (flags === void 0 && !pairs.length) return void 0;
|
|
@@ -44178,7 +44284,7 @@ Next: --id ${item.activityId} --cursor '${item.nextCursor}' --expected-version $
|
|
|
44178
44284
|
return;
|
|
44179
44285
|
}
|
|
44180
44286
|
if (!this.id) throw new Error("Supply an activity ID or repeat --id for a bulk read");
|
|
44181
|
-
const request =
|
|
44287
|
+
const request = parseActivityContentRequest("readActivityContent", {
|
|
44182
44288
|
activityId: this.id,
|
|
44183
44289
|
cursor: this.cursor,
|
|
44184
44290
|
expectedContentVersion: this.expectedVersion === void 0 ? void 0 : graphVersion(this.expectedVersion),
|
|
@@ -44584,8 +44690,8 @@ var ActivityList = class extends ClientCommand {
|
|
|
44584
44690
|
const res = await client.listActivities(params);
|
|
44585
44691
|
const spaces = await client.listSpaces();
|
|
44586
44692
|
this.emitText(
|
|
44587
|
-
jsonWithSpaces(res, spaces),
|
|
44588
|
-
() => this.withFooter(formatActivityList(res.data
|
|
44693
|
+
jsonWithSpaces({ data: res.data.activities, hasMore: res.data.hasMore }, spaces),
|
|
44694
|
+
() => this.withFooter(formatActivityList(res.data.activities), spaces)
|
|
44589
44695
|
);
|
|
44590
44696
|
return;
|
|
44591
44697
|
}
|
|
@@ -44707,7 +44813,7 @@ var ActivityGet = class extends ClientCommand {
|
|
|
44707
44813
|
this.emitText({ data: null }, () => "Activity not found or not accessible");
|
|
44708
44814
|
return;
|
|
44709
44815
|
}
|
|
44710
|
-
if ("attachments" in data) for (const
|
|
44816
|
+
if ("attachments" in data) for (const attachment3 of data.attachments ?? []) attachmentResult(attachment3);
|
|
44711
44817
|
const spaces = await client.listSpaces();
|
|
44712
44818
|
this.emitText(jsonWithSpaces({ data }, spaces), () => {
|
|
44713
44819
|
const detail = this.withFooter(formatActivityDetail(data), spaces);
|
|
@@ -44752,7 +44858,7 @@ var ActivityUpdate = class extends ClientCommand {
|
|
|
44752
44858
|
if (hasEntityChange) {
|
|
44753
44859
|
const rich = graphResult(graphPublicRich.nullable(), await caller.query(activitiesGetByIdRich, { activityId: this.id }));
|
|
44754
44860
|
if (!rich) throw new Error("Activity not found or not accessible");
|
|
44755
|
-
const current = rich.entityDetails.flatMap((
|
|
44861
|
+
const current = rich.entityDetails.flatMap((entity3) => entity3 ? [entity3._id] : []);
|
|
44756
44862
|
const removed = new Set(await resolveEntitiesC(caller, removeNames));
|
|
44757
44863
|
entityIds = [.../* @__PURE__ */ new Set([...current.filter((id21) => !removed.has(id21)), ...await resolveEntitiesC(caller, addNames)])];
|
|
44758
44864
|
}
|
|
@@ -44765,7 +44871,7 @@ var ActivityUpdate = class extends ClientCommand {
|
|
|
44765
44871
|
if (hasEntityChange) await progress.observe("entityResolution", async () => {
|
|
44766
44872
|
const rich = graphResult(graphPublicRich.nullable(), await caller.query(activitiesGetByIdRich, { activityId: this.id }));
|
|
44767
44873
|
if (!rich) throw new Error("Activity not found or not accessible");
|
|
44768
|
-
const currentIds = rich.entityDetails.flatMap((
|
|
44874
|
+
const currentIds = rich.entityDetails.flatMap((entity3) => entity3 ? [entity3._id] : []);
|
|
44769
44875
|
const addIds = await resolveEntitiesC(caller, addNames);
|
|
44770
44876
|
const removeSet = new Set(await resolveEntitiesC(caller, removeNames));
|
|
44771
44877
|
const newIds = currentIds.filter((id21) => !removeSet.has(id21));
|
|
@@ -45035,15 +45141,14 @@ var TaskListCmd = class extends ClientCommand {
|
|
|
45035
45141
|
throw new Error(`Unknown --due value: '${this.due}'. Use: today, overdue, or all.`);
|
|
45036
45142
|
}
|
|
45037
45143
|
const res = await client.listTasks(params);
|
|
45038
|
-
const tasks2 =
|
|
45039
|
-
const users = res.users ?? {};
|
|
45144
|
+
const tasks2 = res.data.slice();
|
|
45040
45145
|
const spaces = await client.listSpaces();
|
|
45041
45146
|
tasks2.sort(
|
|
45042
45147
|
(a, b) => (a.activity?.deadline ?? Number.POSITIVE_INFINITY) - (b.activity?.deadline ?? Number.POSITIVE_INFINITY)
|
|
45043
45148
|
);
|
|
45044
45149
|
this.emitText(
|
|
45045
45150
|
jsonWithSpaces(res, spaces),
|
|
45046
|
-
() => this.withFooter(formatTaskList(tasks2
|
|
45151
|
+
() => this.withFooter(formatTaskList(tasks2), spaces)
|
|
45047
45152
|
);
|
|
45048
45153
|
}
|
|
45049
45154
|
};
|
|
@@ -45477,23 +45582,14 @@ function parseDatabaseProtocolInput(name4, validator, raw) {
|
|
|
45477
45582
|
return raw;
|
|
45478
45583
|
}
|
|
45479
45584
|
|
|
45480
|
-
// ../packages/shared/src/entity-
|
|
45585
|
+
// ../packages/shared/src/entity-record-results.ts
|
|
45481
45586
|
var json2 = external_exports.json().optional();
|
|
45482
|
-
function
|
|
45587
|
+
function entityRecordWithoutFieldStorage(raw) {
|
|
45483
45588
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return raw;
|
|
45484
45589
|
const { fieldValues: _fieldValues, layout: _layout, actingSpaceId: _acting, ...value } = raw;
|
|
45485
45590
|
return value;
|
|
45486
45591
|
}
|
|
45487
|
-
var
|
|
45488
|
-
var entity4 = external_exports.preprocess(legacyEntityRecord, legacyEntityObject);
|
|
45489
|
-
var activity = external_exports.object({ ...activityReadFields, _creationTime: external_exports.number() }).catchall(json2);
|
|
45490
|
-
var searchRow = entityReadFullSearch.shape.entities.element;
|
|
45491
|
-
var listRow = entityReadFullList.shape.entities.element;
|
|
45492
|
-
var legacyEntityReadResults = {
|
|
45493
|
-
searchEntities: entityReadFullSearch.extend({ entities: external_exports.array(searchRow.extend({ entity: entity4 })) }),
|
|
45494
|
-
listEntities: entityReadFullList.extend({ entities: external_exports.array(listRow.extend({ entity: entity4 })) }),
|
|
45495
|
-
getEntity: entityReadFullDetail.unwrap().extend({ entity: entity4, activities: external_exports.array(activity) }).nullable()
|
|
45496
|
-
};
|
|
45592
|
+
var entityRecordObject = external_exports.object({ ...entityReadFields, _creationTime: external_exports.number() }).catchall(json2);
|
|
45497
45593
|
|
|
45498
45594
|
// ../packages/shared/src/database-view-scalars.ts
|
|
45499
45595
|
var customIconColorValidator = v2.union(
|
|
@@ -45524,22 +45620,22 @@ var databaseConfigurationContracts = createDatabaseConfigurationContracts({ tab:
|
|
|
45524
45620
|
var readView = external_exports.unknown().transform((raw) => parseOperationResult("database read view", entityDatabaseViewConfigValidator, raw));
|
|
45525
45621
|
var { fields: _externalFields, ...richDocument } = entityReadRichDocument.shape;
|
|
45526
45622
|
var databaseListEntity = external_exports.preprocess(
|
|
45527
|
-
|
|
45528
|
-
|
|
45623
|
+
entityRecordWithoutFieldStorage,
|
|
45624
|
+
entityRecordObject.omit({ fields: true }).extend({ ...richDocument, databaseView: readView.optional() })
|
|
45529
45625
|
);
|
|
45530
45626
|
var readUser = graphMembers.element.shape.user.unwrap().extend({ _creationTime: external_exports.number(), avatarInitials: external_exports.string().optional(), image: external_exports.string().optional() });
|
|
45531
|
-
var
|
|
45627
|
+
var attachment2 = external_exports.unknown().transform((raw) => parseOperationResult("database row attachment", activityAttachmentViewValidator, raw));
|
|
45532
45628
|
var databaseListRow = graphPublicRich.extend({
|
|
45533
45629
|
_id: graphId2,
|
|
45534
45630
|
_creationTime: external_exports.number(),
|
|
45535
45631
|
entityDetails: external_exports.array(databaseListEntity.nullable()),
|
|
45536
45632
|
createdByUser: readUser.nullable(),
|
|
45537
|
-
attachments: external_exports.array(
|
|
45633
|
+
attachments: external_exports.array(attachment2).optional()
|
|
45538
45634
|
});
|
|
45539
45635
|
function databaseListPage(raw) {
|
|
45540
45636
|
const envelope = graphResult(external_exports.object({ page: external_exports.array(databaseListRow) }).catchall(external_exports.json().optional()), raw);
|
|
45541
|
-
const { page:
|
|
45542
|
-
return { ...parseOperationResult("database page metadata", databasePageMetadataValidator, metadata), page:
|
|
45637
|
+
const { page: page2, ...metadata } = envelope;
|
|
45638
|
+
return { ...parseOperationResult("database page metadata", databasePageMetadataValidator, metadata), page: page2 };
|
|
45543
45639
|
}
|
|
45544
45640
|
function parseDatabaseWriteView(raw) {
|
|
45545
45641
|
const view = parseDatabaseView(raw);
|
|
@@ -45848,13 +45944,13 @@ function rowStages(ctx, step) {
|
|
|
45848
45944
|
}
|
|
45849
45945
|
async function loadList(caller, listNameOrId) {
|
|
45850
45946
|
const entityId2 = await resolveEntityC(caller, listNameOrId);
|
|
45851
|
-
const
|
|
45852
|
-
if (!
|
|
45853
|
-
if (
|
|
45854
|
-
const stored =
|
|
45947
|
+
const entity3 = graphResult(databaseListEntity.nullable(), await caller.query(findById, { id: graphInput(graphId2, entityId2) }));
|
|
45948
|
+
if (!entity3) throw new Error(`List '${listNameOrId}' not found or not accessible.`);
|
|
45949
|
+
if (entity3._id !== entityId2) throw new OperationResultError("database list", "Invalid entity result context");
|
|
45950
|
+
const stored = entity3.databaseView;
|
|
45855
45951
|
return {
|
|
45856
45952
|
entityId: entityId2,
|
|
45857
|
-
entity:
|
|
45953
|
+
entity: entity3,
|
|
45858
45954
|
view: {
|
|
45859
45955
|
version: 1,
|
|
45860
45956
|
columns: stored?.columns ?? [],
|
|
@@ -45897,9 +45993,9 @@ async function fetchRowsForKeys(caller, entityId2, inputs, key) {
|
|
|
45897
45993
|
}
|
|
45898
45994
|
return [...rows.values()];
|
|
45899
45995
|
}
|
|
45900
|
-
async function resolveOwnerSpace(caller,
|
|
45901
|
-
if (!
|
|
45902
|
-
return resolveSpaceByNameC(caller,
|
|
45996
|
+
async function resolveOwnerSpace(caller, space2) {
|
|
45997
|
+
if (!space2?.trim()) throw new Error("New list rows require --space (name or ID), including dry runs.");
|
|
45998
|
+
return resolveSpaceByNameC(caller, space2);
|
|
45903
45999
|
}
|
|
45904
46000
|
function rowJson(row) {
|
|
45905
46001
|
return {
|
|
@@ -45985,11 +46081,11 @@ var ListColumnAdd = class extends ProfileCommand {
|
|
|
45985
46081
|
columns = options_exports.Rest({ required: 1 });
|
|
45986
46082
|
async run() {
|
|
45987
46083
|
const caller = await resolveCaller();
|
|
45988
|
-
const { entityId: entityId2, entity:
|
|
46084
|
+
const { entityId: entityId2, entity: entity3, view } = await loadList(caller, this.list);
|
|
45989
46085
|
const added = this.columns.map(parseColumn);
|
|
45990
46086
|
const taken = new Set(view.columns.map((c) => c.key));
|
|
45991
46087
|
for (const col of added) {
|
|
45992
|
-
if (taken.has(col.key)) throw new Error(`'${col.key}' is already a column of '${
|
|
46088
|
+
if (taken.has(col.key)) throw new Error(`'${col.key}' is already a column of '${entity3.name}'.`);
|
|
45993
46089
|
taken.add(col.key);
|
|
45994
46090
|
}
|
|
45995
46091
|
const columns = [...view.columns, ...added];
|
|
@@ -45998,7 +46094,7 @@ var ListColumnAdd = class extends ProfileCommand {
|
|
|
45998
46094
|
await progress.run(() => progress.write("columns", () => databaseWrite(() => caller.mutation(updateDatabaseView, args)), (raw) => parseOperationResult("entities:updateDatabaseView", databaseConfigurationContracts.updateDatabaseView.result, raw)));
|
|
45999
46095
|
this.emitText(
|
|
46000
46096
|
{ data: { entityId: entityId2, added, columns } },
|
|
46001
|
-
() => `Added ${added.length} column${added.length === 1 ? "" : "s"} to '${
|
|
46097
|
+
() => `Added ${added.length} column${added.length === 1 ? "" : "s"} to '${entity3.name}': ${added.map((c) => c.key).join(", ")}.`
|
|
46002
46098
|
);
|
|
46003
46099
|
}
|
|
46004
46100
|
};
|
|
@@ -46013,12 +46109,12 @@ var ListColumnRemove = class extends ProfileCommand {
|
|
|
46013
46109
|
keys = options_exports.Rest({ required: 1 });
|
|
46014
46110
|
async run() {
|
|
46015
46111
|
const caller = await resolveCaller();
|
|
46016
|
-
const { entityId: entityId2, entity:
|
|
46112
|
+
const { entityId: entityId2, entity: entity3, view } = await loadList(caller, this.list);
|
|
46017
46113
|
const present = new Set(view.columns.map((c) => c.key));
|
|
46018
46114
|
const missing = this.keys.filter((key) => !present.has(key));
|
|
46019
46115
|
if (missing.length > 0) {
|
|
46020
46116
|
throw new Error(
|
|
46021
|
-
`Not a column of '${
|
|
46117
|
+
`Not a column of '${entity3.name}': ${missing.join(", ")}. Columns: ${[...present].join(", ") || "(none)"}.`
|
|
46022
46118
|
);
|
|
46023
46119
|
}
|
|
46024
46120
|
let current = view;
|
|
@@ -46032,7 +46128,7 @@ var ListColumnRemove = class extends ProfileCommand {
|
|
|
46032
46128
|
});
|
|
46033
46129
|
this.emitText(
|
|
46034
46130
|
{ data: { entityId: entityId2, removed: this.keys, columns: current.columns } },
|
|
46035
|
-
() => `Removed ${this.keys.length} column${this.keys.length === 1 ? "" : "s"} from '${
|
|
46131
|
+
() => `Removed ${this.keys.length} column${this.keys.length === 1 ? "" : "s"} from '${entity3.name}': ${this.keys.join(", ")}.`
|
|
46036
46132
|
);
|
|
46037
46133
|
}
|
|
46038
46134
|
};
|
|
@@ -46076,8 +46172,8 @@ var ListAdd = class extends ProfileCommand {
|
|
|
46076
46172
|
}
|
|
46077
46173
|
if (this.space !== void 0 && !this.space.trim()) throw new Error("--space must name a space.");
|
|
46078
46174
|
const caller = await resolveCaller();
|
|
46079
|
-
const { entityId: entityId2, entity:
|
|
46080
|
-
const fields4 = coerceFields(view.columns, parseFieldPairs(this.attr),
|
|
46175
|
+
const { entityId: entityId2, entity: entity3, view } = await loadList(caller, this.list);
|
|
46176
|
+
const fields4 = coerceFields(view.columns, parseFieldPairs(this.attr), entity3.name);
|
|
46081
46177
|
const content = readContentOption(this.content, this.contentFile);
|
|
46082
46178
|
const input2 = {
|
|
46083
46179
|
line: 1,
|
|
@@ -46085,7 +46181,7 @@ var ListAdd = class extends ProfileCommand {
|
|
|
46085
46181
|
...this.title !== void 0 ? { title: this.title } : {},
|
|
46086
46182
|
...content !== void 0 ? { content } : {}
|
|
46087
46183
|
};
|
|
46088
|
-
if (this.key !== void 0) columnOrThrow(view.columns, this.key,
|
|
46184
|
+
if (this.key !== void 0) columnOrThrow(view.columns, this.key, entity3.name);
|
|
46089
46185
|
const existing = this.key !== void 0 ? (await fetchRowsForKeys(caller, entityId2, [input2], this.key)).map(({ row, match }) => toExisting(row, view.columns, match)) : [];
|
|
46090
46186
|
const keyColumn = this.key ?? "";
|
|
46091
46187
|
const step = this.key !== void 0 ? planUpsert(existing, [input2], keyColumn)[0] : { action: "create", input: input2, key: "" };
|
|
@@ -46097,7 +46193,7 @@ var ListAdd = class extends ProfileCommand {
|
|
|
46097
46193
|
const result = stepResult(step, rowId);
|
|
46098
46194
|
this.emitText(
|
|
46099
46195
|
{ data: { ...result, activityId: rowId, entityId: entityId2, title: this.title ?? null, fields: fields4 } },
|
|
46100
|
-
() => result.action === "created" ? `Added row '${this.title ?? "(untitled)"}' (${rowId}) to '${
|
|
46196
|
+
() => result.action === "created" ? `Added row '${this.title ?? "(untitled)"}' (${rowId}) to '${entity3.name}'.` : result.action === "updated" ? `Updated row ${rowId} in '${entity3.name}': ${(result.changed ?? []).join(", ")}.${result.contentIgnored ? " (body left unchanged)" : ""}` : `Row ${rowId} in '${entity3.name}' is unchanged.`
|
|
46101
46197
|
);
|
|
46102
46198
|
}
|
|
46103
46199
|
};
|
|
@@ -46118,13 +46214,13 @@ var ListUpdate = class extends ProfileCommand {
|
|
|
46118
46214
|
async run() {
|
|
46119
46215
|
if (!this.attr?.length && this.title === void 0) throw new Error("Nothing to update. Pass --attr and/or --title.");
|
|
46120
46216
|
const caller = await resolveCaller();
|
|
46121
|
-
const { entityId: entityId2, entity:
|
|
46122
|
-
const fields4 = coerceFields(view.columns, parseFieldPairs(this.attr),
|
|
46217
|
+
const { entityId: entityId2, entity: entity3, view } = await loadList(caller, this.list);
|
|
46218
|
+
const fields4 = coerceFields(view.columns, parseFieldPairs(this.attr), entity3.name);
|
|
46123
46219
|
const row = graphResult(databaseListRow.nullable(), await caller.query(activitiesGetByIdRich3, { activityId: graphInput(graphId2, this.rowId) }));
|
|
46124
46220
|
if (!row) throw new Error(`Row ${this.rowId} not found or not accessible.`);
|
|
46125
46221
|
if (row._id !== this.rowId) throw new OperationResultError("database row", "Invalid row result context");
|
|
46126
46222
|
if (!(row.entityDetails ?? []).some((e) => e?._id === entityId2))
|
|
46127
|
-
throw new Error(`Activity ${this.rowId} is not a row of list '${
|
|
46223
|
+
throw new Error(`Activity ${this.rowId} is not a row of list '${entity3.name}'.`);
|
|
46128
46224
|
const stages = [...this.title !== void 0 ? ["title"] : [], ...Object.keys(fields4).map((_, i) => `cell:${i + 1}`)];
|
|
46129
46225
|
const progress = graphProgress(this, "list update", stages, { entityId: entityId2, activityId: row._id });
|
|
46130
46226
|
await progress.run(async () => {
|
|
@@ -46139,7 +46235,7 @@ var ListUpdate = class extends ProfileCommand {
|
|
|
46139
46235
|
});
|
|
46140
46236
|
this.emitText(
|
|
46141
46237
|
{ data: { rowId: this.rowId, entityId: entityId2, ...this.title !== void 0 ? { title: this.title } : {}, fields: fields4 } },
|
|
46142
|
-
() => `Updated row ${this.rowId} in '${
|
|
46238
|
+
() => `Updated row ${this.rowId} in '${entity3.name}': ${[
|
|
46143
46239
|
...this.title !== void 0 ? ["title"] : [],
|
|
46144
46240
|
...Object.keys(fields4)
|
|
46145
46241
|
].join(", ")}.`
|
|
@@ -46176,13 +46272,13 @@ var ListImport = class extends ProfileCommand {
|
|
|
46176
46272
|
const lines = parseImportLines(readFileSync11(this.file, "utf8"));
|
|
46177
46273
|
if (this.space !== void 0 && !this.space.trim()) throw new Error("--space must name a space.");
|
|
46178
46274
|
const caller = await resolveCaller();
|
|
46179
|
-
const { entityId: entityId2, entity:
|
|
46180
|
-
columnOrThrow(view.columns, this.key,
|
|
46275
|
+
const { entityId: entityId2, entity: entity3, view } = await loadList(caller, this.list);
|
|
46276
|
+
columnOrThrow(view.columns, this.key, entity3.name);
|
|
46181
46277
|
const inputs = lines.map((l) => {
|
|
46182
46278
|
try {
|
|
46183
46279
|
return {
|
|
46184
46280
|
line: l.line,
|
|
46185
|
-
fields: coerceImportFields(view.columns, l.fields,
|
|
46281
|
+
fields: coerceImportFields(view.columns, l.fields, entity3.name),
|
|
46186
46282
|
...l.title !== void 0 ? { title: l.title } : {},
|
|
46187
46283
|
...l.content !== void 0 ? { content: l.content } : {}
|
|
46188
46284
|
};
|
|
@@ -46239,7 +46335,7 @@ var ListImport = class extends ProfileCommand {
|
|
|
46239
46335
|
this.emitText(
|
|
46240
46336
|
failure2 ? { data: payload, error: { message: failure2, code: "IMPORT_FAILED" } } : { data: payload },
|
|
46241
46337
|
() => {
|
|
46242
|
-
const head = `${this.dryRun ? "Dry run \u2014 would be " : ""}${counts.created} created, ${counts.updated} updated, ${counts.unchanged} unchanged in '${
|
|
46338
|
+
const head = `${this.dryRun ? "Dry run \u2014 would be " : ""}${counts.created} created, ${counts.updated} updated, ${counts.unchanged} unchanged in '${entity3.name}'.`;
|
|
46243
46339
|
const changed = written.filter((r) => r.action !== "unchanged").map((r) => ` ${r.action.padEnd(8)} ${r.key} ${r.rowId ?? ""}${r.changed ? ` (${r.changed.join(", ")})` : ""}`);
|
|
46244
46340
|
return [head, ...changed].join("\n");
|
|
46245
46341
|
}
|
|
@@ -46365,8 +46461,8 @@ var ListShow = class extends ProfileCommand {
|
|
|
46365
46461
|
if (!Number.isInteger(numItems) || numItems < 1 || numItems > 200)
|
|
46366
46462
|
throw new Error(`--limit must be an integer from 1 to 200 (got '${this.limit}').`);
|
|
46367
46463
|
const caller = await resolveCaller();
|
|
46368
|
-
const { entityId: entityId2, entity:
|
|
46369
|
-
const clauses = parseWhere(view.columns, this.where ?? [],
|
|
46464
|
+
const { entityId: entityId2, entity: entity3, view } = await loadList(caller, this.list);
|
|
46465
|
+
const clauses = parseWhere(view.columns, this.where ?? [], entity3.name);
|
|
46370
46466
|
const rows = [];
|
|
46371
46467
|
let cursor2 = this.cursor ?? null;
|
|
46372
46468
|
let nextCursor = null;
|
|
@@ -46600,12 +46696,12 @@ var UsersSetAdminCommand = class extends BaseCommand {
|
|
|
46600
46696
|
off = options_exports.Boolean("--off", { description: "Revoke admin instead of granting it" });
|
|
46601
46697
|
async run() {
|
|
46602
46698
|
const caller = await resolveAdminCaller();
|
|
46603
|
-
const
|
|
46699
|
+
const user2 = await resolveUserByEmail(caller, this.email);
|
|
46604
46700
|
const isAdmin = !this.off;
|
|
46605
|
-
await caller.mutation(setAdmin, parseHumanInput("admin/users:setAdmin", adminUserContracts.setAdmin.args, { userId:
|
|
46701
|
+
await caller.mutation(setAdmin, parseHumanInput("admin/users:setAdmin", adminUserContracts.setAdmin.args, { userId: user2.id, isAdmin })).then((raw) => parseOperationResult("admin/users:setAdmin", adminUserContracts.setAdmin.result, raw));
|
|
46606
46702
|
this.emitText(
|
|
46607
|
-
{ data: { id:
|
|
46608
|
-
() => `${isAdmin ? "Granted" : "Revoked"} admin for ${
|
|
46703
|
+
{ data: { id: user2.id, email: user2.email, isAdmin } },
|
|
46704
|
+
() => `${isAdmin ? "Granted" : "Revoked"} admin for ${user2.email}.`
|
|
46609
46705
|
);
|
|
46610
46706
|
}
|
|
46611
46707
|
};
|
|
@@ -46621,14 +46717,14 @@ var UsersResetPasswordCommand = class extends BaseCommand {
|
|
|
46621
46717
|
});
|
|
46622
46718
|
async run() {
|
|
46623
46719
|
const caller = await resolveAdminCaller();
|
|
46624
|
-
const
|
|
46720
|
+
const user2 = await resolveUserByEmail(caller, this.email);
|
|
46625
46721
|
const res = await caller.action(resetPassword, parseHumanInput("admin/users:resetPassword", adminUserContracts.resetPassword.args, {
|
|
46626
|
-
userId:
|
|
46722
|
+
userId: user2.id,
|
|
46627
46723
|
...this.password !== void 0 ? { newPassword: this.password } : {}
|
|
46628
46724
|
})).then((raw) => parseOperationResult("admin/users:resetPassword", adminUserContracts.resetPassword.result, raw));
|
|
46629
46725
|
this.emitText(
|
|
46630
|
-
{ data: { id:
|
|
46631
|
-
() => `Reset password for ${
|
|
46726
|
+
{ data: { id: user2.id, email: user2.email, password: res.password } },
|
|
46727
|
+
() => `Reset password for ${user2.email}.
|
|
46632
46728
|
New password: ${res.password}`
|
|
46633
46729
|
);
|
|
46634
46730
|
}
|
|
@@ -46659,15 +46755,15 @@ var UsersSetPlanCommand = class extends BaseCommand {
|
|
|
46659
46755
|
throw new Error("company_managed needs --company <billing account id>.");
|
|
46660
46756
|
}
|
|
46661
46757
|
const caller = await resolveAdminCaller();
|
|
46662
|
-
const
|
|
46758
|
+
const user2 = await resolveUserByEmail(caller, this.email);
|
|
46663
46759
|
const res = await caller.mutation(changeUserPlan, parseHumanInput("admin/users:changeUserPlan", adminUserContracts.changeUserPlan.args, {
|
|
46664
|
-
userId:
|
|
46760
|
+
userId: user2.id,
|
|
46665
46761
|
planKey,
|
|
46666
46762
|
...planKey === "company_managed" ? { companyBillingAccountId: this.company } : {}
|
|
46667
46763
|
})).then((raw) => parseOperationResult("admin/users:changeUserPlan", adminUserContracts.changeUserPlan.result, raw));
|
|
46668
46764
|
this.emitText(
|
|
46669
|
-
{ data: { id:
|
|
46670
|
-
() => res.changed ? `Set plan for ${
|
|
46765
|
+
{ data: { id: user2.id, email: user2.email, ...res } },
|
|
46766
|
+
() => res.changed ? `Set plan for ${user2.email} to ${res.planKey}.` : `${user2.email} already has plan ${res.planKey}.`
|
|
46671
46767
|
);
|
|
46672
46768
|
}
|
|
46673
46769
|
};
|
|
@@ -47987,7 +48083,7 @@ var RecordingInspectCommand = class extends BaseCommand {
|
|
|
47987
48083
|
if (container === "mp4") {
|
|
47988
48084
|
lines.push(`fragmented: ${fragmented ? `yes (${counts.moof} moof boxes)` : "no"}`);
|
|
47989
48085
|
lines.push(
|
|
47990
|
-
`boxes: ${Object.entries(counts).map(([type,
|
|
48086
|
+
`boxes: ${Object.entries(counts).map(([type, count2]) => `${type}\xD7${count2}`).join(", ")}`
|
|
47991
48087
|
);
|
|
47992
48088
|
}
|
|
47993
48089
|
return lines.join("\n");
|
|
@@ -48041,7 +48137,7 @@ var RecordingRerunCommand = class extends BaseCommand {
|
|
|
48041
48137
|
rawReceipt = await caller.mutation(rerunRecording, args);
|
|
48042
48138
|
} catch (error62) {
|
|
48043
48139
|
if (error62 instanceof ConvexError) throw error62;
|
|
48044
|
-
const
|
|
48140
|
+
const message3 = errorMessage(error62);
|
|
48045
48141
|
const checkStatusCommand = `ente recording show ${before.id}`;
|
|
48046
48142
|
this.emitText(
|
|
48047
48143
|
{
|
|
@@ -48050,9 +48146,9 @@ var RecordingRerunCommand = class extends BaseCommand {
|
|
|
48050
48146
|
rerunStarted: null,
|
|
48051
48147
|
outcome: "unknown",
|
|
48052
48148
|
checkStatusCommand,
|
|
48053
|
-
error: { message:
|
|
48149
|
+
error: { message: message3 }
|
|
48054
48150
|
},
|
|
48055
|
-
() => `Re-run attempted for ${before.id}; start and final outcome unknown: ${
|
|
48151
|
+
() => `Re-run attempted for ${before.id}; start and final outcome unknown: ${message3}
|
|
48056
48152
|
Check with: ${checkStatusCommand}. No rerun was retried.`
|
|
48057
48153
|
);
|
|
48058
48154
|
return 1;
|
|
@@ -48075,11 +48171,11 @@ Check with: ${checkStatusCommand}. No rerun was retried.`
|
|
|
48075
48171
|
}
|
|
48076
48172
|
});
|
|
48077
48173
|
} catch (error62) {
|
|
48078
|
-
const
|
|
48174
|
+
const message3 = errorMessage(error62);
|
|
48079
48175
|
const details = error62 instanceof Error && "data" in error62 && error62.data && typeof error62.data === "object" ? error62.data : {};
|
|
48080
48176
|
this.emitText(
|
|
48081
|
-
{ id: before.id, rerunStarted: true, outcome: "unknown", error: { ...details, message:
|
|
48082
|
-
() => `Re-run started for ${before.id}; final outcome unknown: ${
|
|
48177
|
+
{ id: before.id, rerunStarted: true, outcome: "unknown", error: { ...details, message: message3 } },
|
|
48178
|
+
() => `Re-run started for ${before.id}; final outcome unknown: ${message3}
|
|
48083
48179
|
Check with: ente recording show ${before.id}. No rerun was retried.`
|
|
48084
48180
|
);
|
|
48085
48181
|
return 1;
|
|
@@ -48341,7 +48437,7 @@ var AGENT_THREAD_IDEMPOTENCY_KEY_MAX_CHARACTERS = 200;
|
|
|
48341
48437
|
var id17 = external_exports.string().min(1).regex(/\S/);
|
|
48342
48438
|
var capped = (maximum) => external_exports.string().max(maximum).refine((value) => value.length <= maximum);
|
|
48343
48439
|
var optionalTrimmed = (maximum) => capped(maximum).transform((value) => value.trim() || void 0).optional();
|
|
48344
|
-
var
|
|
48440
|
+
var message2 = {
|
|
48345
48441
|
text: external_exports.string().trim().min(1).max(AGENT_THREAD_MESSAGE_MAX_CHARACTERS).refine((value) => value.length <= AGENT_THREAD_MESSAGE_MAX_CHARACTERS),
|
|
48346
48442
|
html: capped(AGENT_THREAD_HTML_MAX_CHARACTERS).optional(),
|
|
48347
48443
|
requestKind: external_exports.enum(["ack", "text"]).optional(),
|
|
@@ -48349,9 +48445,9 @@ var message3 = {
|
|
|
48349
48445
|
idempotencyKey: capped(AGENT_THREAD_IDEMPOTENCY_KEY_MAX_CHARACTERS).refine((value) => value.length >= AGENT_THREAD_IDEMPOTENCY_KEY_MIN_CHARACTERS).meta({ minLength: AGENT_THREAD_IDEMPOTENCY_KEY_MIN_CHARACTERS, "x-ente-length-unit": "utf16-code-units" })
|
|
48350
48446
|
};
|
|
48351
48447
|
var agentConversationInputs = {
|
|
48352
|
-
agent_thread_create: external_exports.strictObject({ title: optionalTrimmed(AGENT_THREAD_TITLE_MAX_CHARACTERS), ...
|
|
48448
|
+
agent_thread_create: external_exports.strictObject({ title: optionalTrimmed(AGENT_THREAD_TITLE_MAX_CHARACTERS), ...message2 }),
|
|
48353
48449
|
agent_thread_claim: external_exports.strictObject({ threadId: id17, attentionVersion: external_exports.number().int().nonnegative() }),
|
|
48354
|
-
agent_thread_reply: external_exports.strictObject({ threadId: id17, claimId: external_exports.string().optional(), ...
|
|
48450
|
+
agent_thread_reply: external_exports.strictObject({ threadId: id17, claimId: external_exports.string().optional(), ...message2 })
|
|
48355
48451
|
};
|
|
48356
48452
|
function parseAgentConversationInput(operation, raw) {
|
|
48357
48453
|
switch (operation) {
|
|
@@ -48364,11 +48460,11 @@ function parseAgentConversationInput(operation, raw) {
|
|
|
48364
48460
|
}
|
|
48365
48461
|
}
|
|
48366
48462
|
var browserMessage = {
|
|
48367
|
-
text:
|
|
48368
|
-
html:
|
|
48369
|
-
request_kind:
|
|
48370
|
-
request_prompt:
|
|
48371
|
-
idempotency_key:
|
|
48463
|
+
text: message2.text,
|
|
48464
|
+
html: message2.html,
|
|
48465
|
+
request_kind: message2.requestKind,
|
|
48466
|
+
request_prompt: message2.requestPrompt,
|
|
48467
|
+
idempotency_key: message2.idempotencyKey
|
|
48372
48468
|
};
|
|
48373
48469
|
var agentConversationBrowserInputs = {
|
|
48374
48470
|
agent_thread_create: external_exports.strictObject({ agent_id: id17, title: agentConversationInputs.agent_thread_create.shape.title, ...browserMessage }),
|
|
@@ -48389,12 +48485,12 @@ var agentConversationResponseValidator = v2.union(
|
|
|
48389
48485
|
);
|
|
48390
48486
|
function mapPayloads2(operation, raw, transform2) {
|
|
48391
48487
|
if (operation === "agent_thread_claim" || !raw || !("message" in raw)) return raw;
|
|
48392
|
-
const
|
|
48488
|
+
const message3 = raw.message;
|
|
48393
48489
|
return { ...raw, message: {
|
|
48394
|
-
...
|
|
48395
|
-
...
|
|
48396
|
-
...
|
|
48397
|
-
...
|
|
48490
|
+
...message3,
|
|
48491
|
+
...message3.toolCalls ? { toolCalls: message3.toolCalls.map((call) => ({ ...call, input: transform2(call.input) })) } : {},
|
|
48492
|
+
...message3.toolResults ? { toolResults: message3.toolResults.map((result) => ({ ...result, result: transform2(result.result) })) } : {},
|
|
48493
|
+
...message3.serverToolCalls ? { serverToolCalls: message3.serverToolCalls.map((call) => ({ ...call, input: transform2(call.input) })) } : {}
|
|
48398
48494
|
} };
|
|
48399
48495
|
}
|
|
48400
48496
|
function parseAgentConversationResult(operation, raw) {
|
|
@@ -48454,26 +48550,26 @@ async function boundAgentClient(client, context) {
|
|
|
48454
48550
|
limit: Number(wire.limit ?? 20)
|
|
48455
48551
|
});
|
|
48456
48552
|
if (request.operation !== "agent_threads_list") throw new Error("Invalid agent context operation");
|
|
48457
|
-
const
|
|
48553
|
+
const page2 = encodeAgentContextResult("agent_threads_list", await (await caller()).query(threads, {
|
|
48458
48554
|
includeArchived: request.input.includeArchived,
|
|
48459
48555
|
attention: request.input.attention,
|
|
48460
48556
|
paginationOpts: { cursor: request.input.cursor ?? null, numItems: request.input.limit }
|
|
48461
48557
|
}));
|
|
48462
|
-
return { data:
|
|
48558
|
+
return { data: page2.page, ...!page2.isDone ? { continueCursor: page2.continueCursor } : {} };
|
|
48463
48559
|
},
|
|
48464
48560
|
getAgentThread: async (threadId, cursor2, limit3 = 50) => {
|
|
48465
48561
|
const request = parseAgentContextInput("agent_thread_get", { threadId, cursor: cursor2, limit: limit3 });
|
|
48466
48562
|
if (request.operation !== "agent_thread_get") throw new Error("Invalid agent context operation");
|
|
48467
|
-
const
|
|
48563
|
+
const page2 = encodeAgentContextResult("agent_thread_get", await (await caller()).query(thread, {
|
|
48468
48564
|
threadId: request.input.threadId,
|
|
48469
48565
|
paginationOpts: { cursor: request.input.cursor ?? null, numItems: request.input.limit }
|
|
48470
48566
|
}));
|
|
48471
|
-
if (!
|
|
48567
|
+
if (!page2) throw new Error(`Thread not found or not accessible: ${threadId}`);
|
|
48472
48568
|
return { data: {
|
|
48473
|
-
thread:
|
|
48474
|
-
messages:
|
|
48475
|
-
requests:
|
|
48476
|
-
...!
|
|
48569
|
+
thread: page2.thread,
|
|
48570
|
+
messages: page2.messages.page,
|
|
48571
|
+
requests: page2.requests,
|
|
48572
|
+
...!page2.messages.isDone ? { continueCursor: page2.messages.continueCursor } : {}
|
|
48477
48573
|
} };
|
|
48478
48574
|
},
|
|
48479
48575
|
createAgentThread: async (args) => {
|
|
@@ -48529,12 +48625,12 @@ function normalizeOperatorThread(thread2, agentId = "") {
|
|
|
48529
48625
|
agentId
|
|
48530
48626
|
};
|
|
48531
48627
|
}
|
|
48532
|
-
function normalizeOperatorMessage(
|
|
48628
|
+
function normalizeOperatorMessage(message3) {
|
|
48533
48629
|
return {
|
|
48534
|
-
...
|
|
48535
|
-
_id:
|
|
48536
|
-
toolCalls:
|
|
48537
|
-
toolResults:
|
|
48630
|
+
...message3,
|
|
48631
|
+
_id: message3.messageId,
|
|
48632
|
+
toolCalls: message3.toolCalls,
|
|
48633
|
+
toolResults: message3.toolResults
|
|
48538
48634
|
};
|
|
48539
48635
|
}
|
|
48540
48636
|
async function fetchOperatorThread(client, threadId, agentId = "") {
|
|
@@ -48549,18 +48645,18 @@ async function fetchOperatorThread(client, threadId, agentId = "") {
|
|
|
48549
48645
|
} while (cursor2);
|
|
48550
48646
|
return thread2 ? { thread: thread2, messages } : null;
|
|
48551
48647
|
}
|
|
48552
|
-
function renderAgentConfiguration(
|
|
48648
|
+
function renderAgentConfiguration(agent2) {
|
|
48553
48649
|
const lines = [
|
|
48554
|
-
`${
|
|
48555
|
-
`Space: ${
|
|
48556
|
-
`Mailbox: ${
|
|
48650
|
+
`${agent2.name} ${agent2.agentId}`,
|
|
48651
|
+
`Space: ${agent2.spaceId}`,
|
|
48652
|
+
`Mailbox: ${agent2.mailbox?.status === "active" ? agent2.mailbox.address : "not active"}`,
|
|
48557
48653
|
"",
|
|
48558
48654
|
"Ente prompt configuration:",
|
|
48559
|
-
|
|
48655
|
+
agent2.prompt || "(empty)",
|
|
48560
48656
|
"",
|
|
48561
|
-
`Ente scheduled runs: ${
|
|
48657
|
+
`Ente scheduled runs: ${agent2.schedules.length}`
|
|
48562
48658
|
];
|
|
48563
|
-
for (const schedule of
|
|
48659
|
+
for (const schedule of agent2.schedules) {
|
|
48564
48660
|
const time3 = schedule.timeMinutes === void 0 ? schedule.scheduleType : `${String(Math.floor(schedule.timeMinutes / 60)).padStart(2, "0")}:${String(schedule.timeMinutes % 60).padStart(2, "0")} ${schedule.timezone ?? ""}`.trim();
|
|
48565
48661
|
const condition = schedule.runCondition ?? schedule.mailPurpose;
|
|
48566
48662
|
lines.push(
|
|
@@ -48574,8 +48670,8 @@ var AgentList = class extends ClientCommand {
|
|
|
48574
48670
|
static usage = Command.Usage({ category: "Agent", description: "Show the agent bound to this key" });
|
|
48575
48671
|
async run() {
|
|
48576
48672
|
const context = await this.client().getAuthContext();
|
|
48577
|
-
const
|
|
48578
|
-
this.emitText({ data: [
|
|
48673
|
+
const agent2 = await boundAgentIdentity(this.client(), context);
|
|
48674
|
+
this.emitText({ data: [agent2] }, () => `${agent2.name} (bound agent) ${agent2.agentId}`);
|
|
48579
48675
|
}
|
|
48580
48676
|
};
|
|
48581
48677
|
var AgentThreads = class extends ClientCommand {
|
|
@@ -48724,7 +48820,7 @@ var AgentAnalyze = class extends ClientCommand {
|
|
|
48724
48820
|
for (const t of errorThreads) lines.push(` \u2717 ${t.id}${t.message ? ` \u2014 ${t.message}` : ""}`);
|
|
48725
48821
|
lines.push("");
|
|
48726
48822
|
lines.push(`Failed tool calls by tool: ${rankedToolErrors.length === 0 ? "(none)" : ""}`);
|
|
48727
|
-
for (const [name4,
|
|
48823
|
+
for (const [name4, count2] of rankedToolErrors) lines.push(` ${count2}\xD7 ${name4}`);
|
|
48728
48824
|
if (errorSamples.length) {
|
|
48729
48825
|
lines.push("", "Sample failures:");
|
|
48730
48826
|
for (const s of errorSamples) lines.push(` - ${s}`);
|
|
@@ -49267,10 +49363,10 @@ function parseDuration(raw) {
|
|
|
49267
49363
|
if (!Number.isInteger(minutes) || minutes <= 0) throw new Error("--duration must be a positive number of minutes.");
|
|
49268
49364
|
return minutes;
|
|
49269
49365
|
}
|
|
49270
|
-
async function meetingRequest(caller,
|
|
49271
|
-
if (!
|
|
49366
|
+
async function meetingRequest(caller, space2, entities, title4) {
|
|
49367
|
+
if (!space2) throw new Error("--meeting needs --space <name|id> (the space the meeting activity belongs to).");
|
|
49272
49368
|
return {
|
|
49273
|
-
spaceId: await resolveSpaceByNameC(caller,
|
|
49369
|
+
spaceId: await resolveSpaceByNameC(caller, space2),
|
|
49274
49370
|
entityIds: await resolveEntitiesC(caller, entities),
|
|
49275
49371
|
...title4 ? { title: title4 } : {}
|
|
49276
49372
|
};
|
|
@@ -49792,7 +49888,7 @@ var MAX_PAGES2 = 50;
|
|
|
49792
49888
|
async function collectColumn(caller, status2, text4, limit3, scope) {
|
|
49793
49889
|
const items2 = [];
|
|
49794
49890
|
let cursor2 = null;
|
|
49795
|
-
for (let
|
|
49891
|
+
for (let page2 = 0; page2 < MAX_PAGES2; page2 += 1) {
|
|
49796
49892
|
const res = await caller.query(listColumn, parseHumanInput("feedback:listColumn", feedbackContracts.listColumn.args, {
|
|
49797
49893
|
status: status2,
|
|
49798
49894
|
paginationOpts: { numItems: Math.min(PAGE_SIZE, limit3 - items2.length), cursor: cursor2 },
|
|
@@ -50015,7 +50111,7 @@ Commands:
|
|
|
50015
50111
|
ente ask <question> Experimental opt-in beta answer (not general AI chat)
|
|
50016
50112
|
ente query <question> Evidence; server-negotiated hybrid or lexical, no answer synthesis
|
|
50017
50113
|
ente entity create|get|update|duplicate|rename|archive|restore|pin|unpin
|
|
50018
|
-
ente entity list [--archived]
|
|
50114
|
+
ente entity list [--type <type>] [--space <name>] [--cursor <c> | --all] [--archived]
|
|
50019
50115
|
ente pins list <entity> List pins for an entity
|
|
50020
50116
|
ente task list|get|create|update|done|assign|unassign|set-assignees|clear-assignees
|
|
50021
50117
|
ente space members
|
|
@@ -50264,9 +50360,12 @@ Cross-space activity linking \u2014 BOUNDED:
|
|
|
50264
50360
|
has you as its sole member, retry with --auto-link --entity-space-grant-fingerprint
|
|
50265
50361
|
<token>; otherwise a person shares the entities in the Ente app.
|
|
50266
50362
|
|
|
50267
|
-
Merging duplicates \u2014
|
|
50268
|
-
|
|
50269
|
-
|
|
50363
|
+
Merging duplicates \u2014 BOUNDED:
|
|
50364
|
+
\`entity merge <source> <target> --dry-run\` lists what would move and which
|
|
50365
|
+
spaces would gain access. Without --dry-run it merges, like the web UI: the
|
|
50366
|
+
source is deleted and its links redirect to the target. An agent key may only
|
|
50367
|
+
widen access into spaces where you are the sole member; otherwise the result
|
|
50368
|
+
says requiresPerson and a person merges in the web UI.
|
|
50270
50369
|
|
|
50271
50370
|
Adding an entity to a shared space \u2014 UI ONLY:
|
|
50272
50371
|
An agent key adds an existing entity only to a space whose sole member is you
|
|
@@ -50399,14 +50498,6 @@ var canvasHtmlInputs = {
|
|
|
50399
50498
|
updateCanvasHtmlPanel: external_exports.strictObject({ ...mutation, title: title3, html, ...geometry }),
|
|
50400
50499
|
deleteCanvasHtmlPanel: external_exports.strictObject(mutation)
|
|
50401
50500
|
};
|
|
50402
|
-
var canvasHtmlAliases = {
|
|
50403
|
-
canvas_boards_list: "listCanvasBoards",
|
|
50404
|
-
canvas_html_list: "listCanvasHtmlPanels",
|
|
50405
|
-
canvas_html_get: "getCanvasHtmlPanel",
|
|
50406
|
-
canvas_html_create: "createCanvasHtmlPanel",
|
|
50407
|
-
canvas_html_update: "updateCanvasHtmlPanel",
|
|
50408
|
-
canvas_html_delete: "deleteCanvasHtmlPanel"
|
|
50409
|
-
};
|
|
50410
50501
|
function isCanvasHtmlOperationName(name4) {
|
|
50411
50502
|
return Object.hasOwn(canvasHtmlInputs, name4);
|
|
50412
50503
|
}
|
|
@@ -50422,7 +50513,7 @@ function definition5(name4) {
|
|
|
50422
50513
|
const schema = external_exports.toJSONSchema(canvasHtmlInputs[name4], { io: "input" });
|
|
50423
50514
|
return {
|
|
50424
50515
|
name: name4,
|
|
50425
|
-
aliases:
|
|
50516
|
+
aliases: [],
|
|
50426
50517
|
actor: "agent",
|
|
50427
50518
|
description: descriptions6[name4],
|
|
50428
50519
|
inputSchema: { type: "object", properties: schema.properties ?? {}, required: schema.required ?? [], additionalProperties: false },
|
|
@@ -50715,7 +50806,7 @@ var entityFileCitationValidator = v2.union(
|
|
|
50715
50806
|
/** 1-based PDF pages where the quoted passage starts and ends. */
|
|
50716
50807
|
page: v2.number(),
|
|
50717
50808
|
endPage: v2.number(),
|
|
50718
|
-
/** The passage in document offsets (
|
|
50809
|
+
/** The passage in document offsets (readEntityFile's offsets). */
|
|
50719
50810
|
start: v2.number(),
|
|
50720
50811
|
end: v2.number(),
|
|
50721
50812
|
/** The printed page label (PDF page labels), else the PDF page number. */
|
|
@@ -50868,7 +50959,7 @@ var entityFileInputs = {
|
|
|
50868
50959
|
}),
|
|
50869
50960
|
readEntityFile: external_exports.strictObject({
|
|
50870
50961
|
entityId: id19,
|
|
50871
|
-
path: external_exports.string().min(1).max(ENTITY_FILE_LIMITS.pathCharacters).describe("File inside the linked folder, as
|
|
50962
|
+
path: external_exports.string().min(1).max(ENTITY_FILE_LIMITS.pathCharacters).describe("File inside the linked folder, as listEntityFiles or searchEntityFiles return it, for example 03 Unterlagen/Mietvertrag.pdf."),
|
|
50872
50963
|
offset: external_exports.number().int().min(0).optional().describe("Character offset to continue a truncated text; defaults to 0."),
|
|
50873
50964
|
maxCharacters: external_exports.number().int().min(1).max(ENTITY_FILE_LIMITS.readCharacters).optional().describe(`Characters to return, at most ${ENTITY_FILE_LIMITS.readCharacters}; defaults to that maximum.`)
|
|
50874
50965
|
}),
|
|
@@ -50905,15 +50996,6 @@ var entityFileInputs = {
|
|
|
50905
50996
|
ctx.addIssue({ code: "custom", path: ["base64Content"], message: "Provide exactly one of base64Content or activityAttachment" });
|
|
50906
50997
|
})
|
|
50907
50998
|
};
|
|
50908
|
-
var entityFileAliases = {
|
|
50909
|
-
entity_folder_create: "createEntityFolder",
|
|
50910
|
-
entity_folder_link: "linkEntityFolder",
|
|
50911
|
-
entity_files_list: "listEntityFiles",
|
|
50912
|
-
entity_files_search: "searchEntityFiles",
|
|
50913
|
-
entity_file_read: "readEntityFile",
|
|
50914
|
-
entity_file_cite: "citeEntityFile",
|
|
50915
|
-
entity_file_upload: "uploadEntityFile"
|
|
50916
|
-
};
|
|
50917
50999
|
function isEntityFileOperationName(value) {
|
|
50918
51000
|
return Object.hasOwn(entityFileInputs, value);
|
|
50919
51001
|
}
|
|
@@ -50922,8 +51004,8 @@ var descriptions7 = {
|
|
|
50922
51004
|
createEntityFolder: `Create a new folder in your Nextcloud below parentPath and link it as the entity's file folder. ${personalOnly}`,
|
|
50923
51005
|
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}`,
|
|
50924
51006
|
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}`,
|
|
50925
|
-
searchEntityFiles: `Find files and folders by name anywhere below the entity's linked Nextcloud folder, also in subfolders. status explains a missing link or connection; truncated means more hits exist, so narrow the query. Item paths are relative to the linked folder and go unchanged into
|
|
50926
|
-
readEntityFile: `Read the text of one file in the entity's linked Nextcloud folder: PDF (text layer only), DOCX and plain-text formats such as TXT, MD, CSV, JSON or XML, up to ${ENTITY_FILE_LIMITS.readBytes / (1024 * 1024)} MiB. Other formats fail with unsupported_format. Long texts come in windows: when truncated is true, call again with offset set to offset plus the returned text's length. A PDF without a usable text layer (a scan) returns notice.code no_text_layer: its text is not the content; OCR in Nextcloud may add a layer shortly after upload, so read it again later instead of concluding the file is empty. PDF: offset + position in text = document offset; pages = label and offsets per page. To cite, call
|
|
51007
|
+
searchEntityFiles: `Find files and folders by name anywhere below the entity's linked Nextcloud folder, also in subfolders. status explains a missing link or connection; truncated means more hits exist, so narrow the query. Item paths are relative to the linked folder and go unchanged into readEntityFile. ${personalOnly}`,
|
|
51008
|
+
readEntityFile: `Read the text of one file in the entity's linked Nextcloud folder: PDF (text layer only), DOCX and plain-text formats such as TXT, MD, CSV, JSON or XML, up to ${ENTITY_FILE_LIMITS.readBytes / (1024 * 1024)} MiB. Other formats fail with unsupported_format. Long texts come in windows: when truncated is true, call again with offset set to offset plus the returned text's length. A PDF without a usable text layer (a scan) returns notice.code no_text_layer: its text is not the content; OCR in Nextcloud may add a layer shortly after upload, so read it again later instead of concluding the file is empty. PDF: offset + position in text = document offset; pages = label and offsets per page. To cite, call citeEntityFile; never build links. ${personalOnly}`,
|
|
50927
51009
|
citeEntityFile: `Citation links for verbatim PDF quotes, all in one call. ok: paste quoteMarkdown unchanged. mismatch: no link; quote documentText, cite again. ambiguous: no link; quote more or pass candidate. notFound: not in the file. noText: scan, no link. Never build links. ${personalOnly}`,
|
|
50928
51010
|
uploadEntityFile: `Upload a file into the entity's linked Nextcloud folder; a taken name gets a numbered suffix. Send exactly one of base64Content (at most 10 MiB decoded) or activityAttachment (an existing Ente activity attachment). ${personalOnly}`
|
|
50929
51011
|
};
|
|
@@ -50935,7 +51017,7 @@ function definition6(operationName) {
|
|
|
50935
51017
|
const schema = external_exports.toJSONSchema(entityFileInputs[operationName], { io: "input" });
|
|
50936
51018
|
return {
|
|
50937
51019
|
name: operationName,
|
|
50938
|
-
aliases:
|
|
51020
|
+
aliases: [],
|
|
50939
51021
|
actor: "agent",
|
|
50940
51022
|
description: descriptions7[operationName],
|
|
50941
51023
|
inputSchema: { type: "object", properties: schema.properties ?? {}, required: schema.required ?? [], additionalProperties: false },
|
|
@@ -51233,9 +51315,9 @@ function readBody(inline, file2, label) {
|
|
|
51233
51315
|
return value;
|
|
51234
51316
|
}
|
|
51235
51317
|
function readNotificationEmailAttachments(imagePaths = [], inlineImageSpecs = [], attachmentPaths = []) {
|
|
51236
|
-
const
|
|
51237
|
-
if (
|
|
51238
|
-
if (
|
|
51318
|
+
const count2 = imagePaths.length + inlineImageSpecs.length + attachmentPaths.length;
|
|
51319
|
+
if (count2 === 0) return void 0;
|
|
51320
|
+
if (count2 > CLI_LIMITS.maxAttachments) {
|
|
51239
51321
|
throw new Error(
|
|
51240
51322
|
`notification send: at most ${CLI_LIMITS.maxAttachments} files may be attached.`
|
|
51241
51323
|
);
|
|
@@ -51353,7 +51435,7 @@ var HealthDataRecord = class extends ClientCommand {
|
|
|
51353
51435
|
static usage = Command.Usage({
|
|
51354
51436
|
category: "Health data",
|
|
51355
51437
|
description: "Define health series and write, replace or remove points for your calendar health graph",
|
|
51356
|
-
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.",
|
|
51438
|
+
details: "The JSON body has optional lists: series [{key,label,unit?,description?,better (higher|lower|neutral),scale?,bands?,resolution?,hidden?}], 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. hidden: true starts a new series unchecked in the graph menu. 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.",
|
|
51357
51439
|
examples: [
|
|
51358
51440
|
["Send a batch from a file", "$0 health-data record --file ./health.json"],
|
|
51359
51441
|
["Pipe a batch", "health-export | $0 health-data record --file - --json"]
|
|
@@ -51394,7 +51476,7 @@ var HealthDataList = class extends ClientCommand {
|
|
|
51394
51476
|
this.emitText(response, () => {
|
|
51395
51477
|
if (!series.length) return "No health series yet.";
|
|
51396
51478
|
const units = new Map(series.map((item) => [item.key, item.unit]));
|
|
51397
|
-
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}` : ""}`);
|
|
51479
|
+
const lines = series.map((item) => `${item.key}: ${item.label}${item.unit ? ` (${item.unit})` : ""}, ${item.resolution === "intraday" ? "intraday" : item.better === "neutral" ? "no better direction" : `${item.better} is better`}${item.description ? ` \xB7 ${item.description}` : ""}`);
|
|
51398
51480
|
lines.push("", points.length ? `${points.length} points` : `No points from ${this.from} to ${this.to}.`);
|
|
51399
51481
|
for (const point2 of points) {
|
|
51400
51482
|
const unit = units.get(point2.series);
|
|
@@ -51750,7 +51832,7 @@ var AGENT_MAIL_CLI_SURFACE = {
|
|
|
51750
51832
|
text: { flags: ["--text", "--text-file"] },
|
|
51751
51833
|
html: { flags: ["--html", "--html-file"] },
|
|
51752
51834
|
attachments: { flags: ["--attachment", "--inline-image"] },
|
|
51753
|
-
|
|
51835
|
+
idempotencyKey: { flags: ["--idempotency-key"] }
|
|
51754
51836
|
},
|
|
51755
51837
|
replyInputProperties: {
|
|
51756
51838
|
threadId: { source: "positional argument" },
|
|
@@ -51760,7 +51842,7 @@ var AGENT_MAIL_CLI_SURFACE = {
|
|
|
51760
51842
|
text: { flags: ["--text", "--text-file"] },
|
|
51761
51843
|
html: { flags: ["--html", "--html-file"] },
|
|
51762
51844
|
attachments: { flags: ["--attachment", "--inline-image"] },
|
|
51763
|
-
|
|
51845
|
+
idempotencyKey: { flags: ["--idempotency-key"] }
|
|
51764
51846
|
},
|
|
51765
51847
|
attachmentProperties: {
|
|
51766
51848
|
filename: { source: "file basename" },
|
|
@@ -52023,16 +52105,16 @@ function renderThread(thread2) {
|
|
|
52023
52105
|
const unread = thread2.hasUnread ? ` unread:${thread2.unreadCount}` : "";
|
|
52024
52106
|
return `${fmtTime2(thread2.latestAt)} [${thread2.state}]${unread} ${thread2.subject} ${thread2.threadId}`;
|
|
52025
52107
|
}
|
|
52026
|
-
function renderMessage2(
|
|
52027
|
-
const direction =
|
|
52028
|
-
const date5 =
|
|
52029
|
-
const body =
|
|
52030
|
-
${
|
|
52031
|
-
const cc =
|
|
52032
|
-
CC: ${
|
|
52033
|
-
const files = (
|
|
52108
|
+
function renderMessage2(message3) {
|
|
52109
|
+
const direction = message3.direction === "inbound" ? "\u2190" : "\u2192";
|
|
52110
|
+
const date5 = message3.receivedAt ?? message3.sentAt;
|
|
52111
|
+
const body = message3.text ? `
|
|
52112
|
+
${message3.text}` : "";
|
|
52113
|
+
const cc = message3.cc?.length ? `
|
|
52114
|
+
CC: ${message3.cc.join(", ")}` : "";
|
|
52115
|
+
const files = (message3.attachments ?? []).map((file2) => `
|
|
52034
52116
|
Attachment: ${JSON.stringify(file2.filename)} ${file2.mimeType} ${file2.size} bytes ${file2.attachmentId}`).join("");
|
|
52035
|
-
return `${direction} ${fmtTime2(date5)} ${
|
|
52117
|
+
return `${direction} ${fmtTime2(date5)} ${message3.from ?? "unknown"} [${message3.deliveryStatus}] ${message3.messageId}${cc}${files}${body}`;
|
|
52036
52118
|
}
|
|
52037
52119
|
var AgentMailAddress = class extends ClientCommand {
|
|
52038
52120
|
static paths = [["agent", "mail", "address"]];
|
|
@@ -52627,6 +52709,7 @@ Continuing with your command.
|
|
|
52627
52709
|
|
|
52628
52710
|
// cli.ts
|
|
52629
52711
|
acceptUnknownResultFields();
|
|
52712
|
+
setErrorExplainer(explainActivityNotFound);
|
|
52630
52713
|
var cli = new Cli({
|
|
52631
52714
|
binaryLabel: "Ente knowledge-graph / relationship-manager CLI (ente.fast)",
|
|
52632
52715
|
binaryName: "ente",
|
|
@@ -52638,6 +52721,7 @@ for (const Cmd of [
|
|
|
52638
52721
|
...AUTH_COMMANDS,
|
|
52639
52722
|
...IDENTITY_COMMANDS,
|
|
52640
52723
|
...ENTITY_COMMANDS,
|
|
52724
|
+
...ENTITY_MERGE_COMMANDS,
|
|
52641
52725
|
...ACTIVITY_COMMANDS,
|
|
52642
52726
|
...ACTIVITY_FIELD_COMMANDS,
|
|
52643
52727
|
...ACTIVITY_MESSAGE_COMMANDS,
|
|
@@ -52679,9 +52763,9 @@ async function main() {
|
|
|
52679
52763
|
stderr: process.stderr,
|
|
52680
52764
|
cacheDir: configDir(ENTE_BRANDING)
|
|
52681
52765
|
});
|
|
52682
|
-
const
|
|
52766
|
+
const flagProfile = profileFromArgv(argv);
|
|
52683
52767
|
const previousProfile = process.env.ENTE_PROFILE;
|
|
52684
|
-
if (
|
|
52768
|
+
if (flagProfile) process.env.ENTE_PROFILE = flagProfile;
|
|
52685
52769
|
let adminSetup = false;
|
|
52686
52770
|
try {
|
|
52687
52771
|
if (!OFFLINE.has(argv[0] ?? "")) {
|
|
@@ -52710,7 +52794,22 @@ async function main() {
|
|
|
52710
52794
|
upgradeCommand: ENTE_BRANDING.upgradeCommand
|
|
52711
52795
|
});
|
|
52712
52796
|
}
|
|
52713
|
-
|
|
52797
|
+
let args = argv;
|
|
52798
|
+
if (usesCurrentTask(argv) && !argv.some((value) => ["--help", "-h"].includes(value))) {
|
|
52799
|
+
if (flagProfile) process.env.ENTE_PROFILE = flagProfile;
|
|
52800
|
+
try {
|
|
52801
|
+
const current = await resolveCurrentTask(restCurrentTaskLookup(EnteClient.fromConfig(ENTE_BRANDING)));
|
|
52802
|
+
args = substituteCurrentTask(argv, current.activityId);
|
|
52803
|
+
} catch (error62) {
|
|
52804
|
+
writeCommandError(process.stdout, process.stderr, argv.includes("--json"), error62);
|
|
52805
|
+
process.exitCode = 1;
|
|
52806
|
+
return;
|
|
52807
|
+
} finally {
|
|
52808
|
+
if (previousProfile === void 0) delete process.env.ENTE_PROFILE;
|
|
52809
|
+
else process.env.ENTE_PROFILE = previousProfile;
|
|
52810
|
+
}
|
|
52811
|
+
}
|
|
52812
|
+
process.exitCode = await runCli(cli, args, { stdout: process.stdout, stderr: process.stderr });
|
|
52714
52813
|
}
|
|
52715
52814
|
void main();
|
|
52716
52815
|
/*! Bundled license information:
|