ente-cli 0.4.124 → 0.4.125
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 +42 -7
- package/dist/SKILL.md +19 -0
- package/dist/cli.mjs +1226 -686
- package/dist/cli.mjs.map +4 -4
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -2440,12 +2440,12 @@ function createApi2(pathParts = []) {
|
|
|
2440
2440
|
`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${found}\``
|
|
2441
2441
|
);
|
|
2442
2442
|
}
|
|
2443
|
-
const
|
|
2443
|
+
const path11 = pathParts.slice(0, -1).join("/");
|
|
2444
2444
|
const exportName = pathParts[pathParts.length - 1];
|
|
2445
2445
|
if (exportName === "default") {
|
|
2446
|
-
return
|
|
2446
|
+
return path11;
|
|
2447
2447
|
} else {
|
|
2448
|
-
return
|
|
2448
|
+
return path11 + ":" + exportName;
|
|
2449
2449
|
}
|
|
2450
2450
|
} else if (prop === Symbol.toStringTag) {
|
|
2451
2451
|
return "FunctionReference";
|
|
@@ -4384,8 +4384,8 @@ var init_router = __esm({
|
|
|
4384
4384
|
__publicField19(this, "getRoutes", () => {
|
|
4385
4385
|
const exactPaths = [...this.exactRoutes.keys()].sort();
|
|
4386
4386
|
const exact = exactPaths.flatMap(
|
|
4387
|
-
(
|
|
4388
|
-
(method) => [
|
|
4387
|
+
(path11) => [...this.exactRoutes.get(path11).keys()].sort().map(
|
|
4388
|
+
(method) => [path11, method, this.exactRoutes.get(path11).get(method)]
|
|
4389
4389
|
)
|
|
4390
4390
|
);
|
|
4391
4391
|
const prefixPathMethods = [...this.prefixRoutes.keys()].sort();
|
|
@@ -4400,16 +4400,16 @@ var init_router = __esm({
|
|
|
4400
4400
|
);
|
|
4401
4401
|
return [...exact, ...prefixes];
|
|
4402
4402
|
});
|
|
4403
|
-
__publicField19(this, "lookup", (
|
|
4403
|
+
__publicField19(this, "lookup", (path11, method) => {
|
|
4404
4404
|
method = normalizeMethod(method);
|
|
4405
|
-
const exactMatch = this.exactRoutes.get(
|
|
4406
|
-
if (exactMatch) return [exactMatch, method,
|
|
4405
|
+
const exactMatch = this.exactRoutes.get(path11)?.get(method);
|
|
4406
|
+
if (exactMatch) return [exactMatch, method, path11];
|
|
4407
4407
|
const prefixes = this.prefixRoutes.get(method) || /* @__PURE__ */ new Map();
|
|
4408
4408
|
const prefixesSorted = [...prefixes.entries()].sort(
|
|
4409
4409
|
([prefixA, _a5], [prefixB, _b3]) => prefixB.length - prefixA.length
|
|
4410
4410
|
);
|
|
4411
4411
|
for (const [pathPrefix, endpoint] of prefixesSorted) {
|
|
4412
|
-
if (
|
|
4412
|
+
if (path11.startsWith(pathPrefix)) {
|
|
4413
4413
|
return [endpoint, method, `${pathPrefix}*`];
|
|
4414
4414
|
}
|
|
4415
4415
|
}
|
|
@@ -4601,14 +4601,14 @@ function serializeChildComponents(childComponents) {
|
|
|
4601
4601
|
}
|
|
4602
4602
|
}
|
|
4603
4603
|
}
|
|
4604
|
-
const
|
|
4605
|
-
if (!
|
|
4604
|
+
const path11 = definition5.componentDefinitionPath;
|
|
4605
|
+
if (!path11)
|
|
4606
4606
|
throw new Error(
|
|
4607
4607
|
"no .componentPath for component definition " + JSON.stringify(definition5, null, 2)
|
|
4608
4608
|
);
|
|
4609
4609
|
return {
|
|
4610
4610
|
name: name4,
|
|
4611
|
-
path:
|
|
4611
|
+
path: path11,
|
|
4612
4612
|
args: [],
|
|
4613
4613
|
env
|
|
4614
4614
|
};
|
|
@@ -5327,10 +5327,10 @@ function cleanValidationError(message3, { mergeName = false } = {}) {
|
|
|
5327
5327
|
const match = message3.match(/^([^:]+): (.*)$/m);
|
|
5328
5328
|
if (!match)
|
|
5329
5329
|
return `validation failed`;
|
|
5330
|
-
let [,
|
|
5330
|
+
let [, path11, line] = match;
|
|
5331
5331
|
if (mergeName)
|
|
5332
5332
|
line = line[0].toLowerCase() + line.slice(1);
|
|
5333
|
-
line =
|
|
5333
|
+
line = path11 !== `.` || !mergeName ? `${path11.replace(/^\.(\[|$)/, `$1`)}: ${line}` : `: ${line}`;
|
|
5334
5334
|
return line;
|
|
5335
5335
|
}
|
|
5336
5336
|
function formatError(message3, errors) {
|
|
@@ -5834,9 +5834,9 @@ var reducers = {
|
|
|
5834
5834
|
return { ...state, options, tokens };
|
|
5835
5835
|
},
|
|
5836
5836
|
pushPath: (state, segment, segmentIndex) => {
|
|
5837
|
-
const
|
|
5837
|
+
const path11 = state.path.concat(segment);
|
|
5838
5838
|
const tokens = state.tokens.concat({ segmentIndex, type: `path` });
|
|
5839
|
-
return { ...state, path:
|
|
5839
|
+
return { ...state, path: path11, tokens };
|
|
5840
5840
|
},
|
|
5841
5841
|
pushPositional: (state, segment, segmentIndex) => {
|
|
5842
5842
|
const positionals = state.positionals.concat({ value: segment, extra: false });
|
|
@@ -5921,8 +5921,8 @@ var CommandBuilder = class {
|
|
|
5921
5921
|
this.cliIndex = cliIndex;
|
|
5922
5922
|
this.cliOpts = cliOpts;
|
|
5923
5923
|
}
|
|
5924
|
-
addPath(
|
|
5925
|
-
this.paths.push(
|
|
5924
|
+
addPath(path11) {
|
|
5925
|
+
this.paths.push(path11);
|
|
5926
5926
|
}
|
|
5927
5927
|
setArity({ leading = this.arity.leading, trailing = this.arity.trailing, extra = this.arity.extra, proxy = this.arity.proxy }) {
|
|
5928
5928
|
Object.assign(this.arity, { leading, trailing, extra, proxy });
|
|
@@ -6010,19 +6010,19 @@ var CommandBuilder = class {
|
|
|
6010
6010
|
registerStatic(machine, NodeType.InitialNode, SpecialToken.StartOfInput, firstNode, [`setCandidateState`, { candidateUsage, requiredOptions }]);
|
|
6011
6011
|
const positionalArgument = this.arity.proxy ? `always` : `isNotOptionLike`;
|
|
6012
6012
|
const paths = this.paths.length > 0 ? this.paths : [[]];
|
|
6013
|
-
for (const
|
|
6013
|
+
for (const path11 of paths) {
|
|
6014
6014
|
let lastPathNode = firstNode;
|
|
6015
|
-
if (
|
|
6015
|
+
if (path11.length > 0) {
|
|
6016
6016
|
const optionPathNode = injectNode(machine, makeNode());
|
|
6017
6017
|
registerShortcut(machine, lastPathNode, optionPathNode);
|
|
6018
6018
|
this.registerOptions(machine, optionPathNode);
|
|
6019
6019
|
lastPathNode = optionPathNode;
|
|
6020
6020
|
}
|
|
6021
|
-
for (let t = 0; t <
|
|
6021
|
+
for (let t = 0; t < path11.length; ++t) {
|
|
6022
6022
|
const nextPathNode = injectNode(machine, makeNode());
|
|
6023
|
-
registerStatic(machine, lastPathNode,
|
|
6023
|
+
registerStatic(machine, lastPathNode, path11[t], nextPathNode, `pushPath`);
|
|
6024
6024
|
lastPathNode = nextPathNode;
|
|
6025
|
-
if (t + 1 <
|
|
6025
|
+
if (t + 1 < path11.length) {
|
|
6026
6026
|
const helpNode = injectNode(machine, makeNode());
|
|
6027
6027
|
registerDynamic(machine, lastPathNode, `isHelp`, helpNode, [`useHelp`, this.cliIndex]);
|
|
6028
6028
|
registerStatic(machine, helpNode, SpecialToken.EndOfInput, NodeType.SuccessNode, [`setSelectedIndex`, HELP_COMMAND_INDEX]);
|
|
@@ -6328,8 +6328,8 @@ var Cli = class _Cli {
|
|
|
6328
6328
|
const index = builder.cliIndex;
|
|
6329
6329
|
const paths = (_a5 = commandClass.paths) !== null && _a5 !== void 0 ? _a5 : command.paths;
|
|
6330
6330
|
if (typeof paths !== `undefined`)
|
|
6331
|
-
for (const
|
|
6332
|
-
builder.addPath(
|
|
6331
|
+
for (const path11 of paths)
|
|
6332
|
+
builder.addPath(path11);
|
|
6333
6333
|
this.registrations.set(commandClass, { specs, builder, index });
|
|
6334
6334
|
for (const [key, { definition: definition5 }] of specs.entries())
|
|
6335
6335
|
definition5(builder, key);
|
|
@@ -6427,13 +6427,13 @@ var Cli = class _Cli {
|
|
|
6427
6427
|
definition(commandClass, { colored = false } = {}) {
|
|
6428
6428
|
if (!commandClass.usage)
|
|
6429
6429
|
return null;
|
|
6430
|
-
const { usage:
|
|
6430
|
+
const { usage: path11 } = this.getUsageByRegistration(commandClass, { detailed: false });
|
|
6431
6431
|
const { usage, options } = this.getUsageByRegistration(commandClass, { detailed: true, inlineOptions: false });
|
|
6432
6432
|
const category = typeof commandClass.usage.category !== `undefined` ? formatMarkdownish(commandClass.usage.category, { format: this.format(colored), paragraphs: false }) : void 0;
|
|
6433
6433
|
const description = typeof commandClass.usage.description !== `undefined` ? formatMarkdownish(commandClass.usage.description, { format: this.format(colored), paragraphs: false }) : void 0;
|
|
6434
6434
|
const details = typeof commandClass.usage.details !== `undefined` ? formatMarkdownish(commandClass.usage.details, { format: this.format(colored), paragraphs: true }) : void 0;
|
|
6435
6435
|
const examples = typeof commandClass.usage.examples !== `undefined` ? commandClass.usage.examples.map(([label, cli2]) => [formatMarkdownish(label, { format: this.format(colored), paragraphs: false }), cli2.replace(/\$0/g, this.binaryName)]) : void 0;
|
|
6436
|
-
return { path:
|
|
6436
|
+
return { path: path11, usage, category, description, details, examples, options };
|
|
6437
6437
|
}
|
|
6438
6438
|
definitions({ colored = false } = {}) {
|
|
6439
6439
|
const data = [];
|
|
@@ -6452,7 +6452,7 @@ var Cli = class _Cli {
|
|
|
6452
6452
|
const paths = commandClass2.paths;
|
|
6453
6453
|
const isDocumented = typeof commandClass2.usage !== `undefined`;
|
|
6454
6454
|
const isExclusivelyDefault = !paths || paths.length === 0 || paths.length === 1 && paths[0].length === 0;
|
|
6455
|
-
const isDefault = isExclusivelyDefault || ((_a5 = paths === null || paths === void 0 ? void 0 : paths.some((
|
|
6455
|
+
const isDefault = isExclusivelyDefault || ((_a5 = paths === null || paths === void 0 ? void 0 : paths.some((path11) => path11.length === 0)) !== null && _a5 !== void 0 ? _a5 : false);
|
|
6456
6456
|
if (isDefault) {
|
|
6457
6457
|
if (command) {
|
|
6458
6458
|
command = null;
|
|
@@ -8915,10 +8915,10 @@ function mergeDefs(...defs) {
|
|
|
8915
8915
|
function cloneDef(schema) {
|
|
8916
8916
|
return mergeDefs(schema._zod.def);
|
|
8917
8917
|
}
|
|
8918
|
-
function getElementAtPath(obj,
|
|
8919
|
-
if (!
|
|
8918
|
+
function getElementAtPath(obj, path11) {
|
|
8919
|
+
if (!path11)
|
|
8920
8920
|
return obj;
|
|
8921
|
-
return
|
|
8921
|
+
return path11.reduce((acc, key) => acc?.[key], obj);
|
|
8922
8922
|
}
|
|
8923
8923
|
function promiseAllObject(promisesObj) {
|
|
8924
8924
|
const keys = Object.keys(promisesObj);
|
|
@@ -9258,11 +9258,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
9258
9258
|
}
|
|
9259
9259
|
return false;
|
|
9260
9260
|
}
|
|
9261
|
-
function prefixIssues(
|
|
9261
|
+
function prefixIssues(path11, issues) {
|
|
9262
9262
|
return issues.map((iss) => {
|
|
9263
9263
|
var _a5;
|
|
9264
9264
|
(_a5 = iss).path ?? (_a5.path = []);
|
|
9265
|
-
iss.path.unshift(
|
|
9265
|
+
iss.path.unshift(path11);
|
|
9266
9266
|
return iss;
|
|
9267
9267
|
});
|
|
9268
9268
|
}
|
|
@@ -9724,16 +9724,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
|
|
|
9724
9724
|
}
|
|
9725
9725
|
function formatError2(error62, mapper = (issue2) => issue2.message) {
|
|
9726
9726
|
const fieldErrors = { _errors: [] };
|
|
9727
|
-
const processError = (error63,
|
|
9727
|
+
const processError = (error63, path11 = []) => {
|
|
9728
9728
|
for (const issue2 of error63.issues) {
|
|
9729
9729
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
9730
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
9730
|
+
issue2.errors.map((issues) => processError({ issues }, [...path11, ...issue2.path]));
|
|
9731
9731
|
} else if (issue2.code === "invalid_key") {
|
|
9732
|
-
processError({ issues: issue2.issues }, [...
|
|
9732
|
+
processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
|
|
9733
9733
|
} else if (issue2.code === "invalid_element") {
|
|
9734
|
-
processError({ issues: issue2.issues }, [...
|
|
9734
|
+
processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
|
|
9735
9735
|
} else {
|
|
9736
|
-
const fullpath = [...
|
|
9736
|
+
const fullpath = [...path11, ...issue2.path];
|
|
9737
9737
|
if (fullpath.length === 0) {
|
|
9738
9738
|
fieldErrors._errors.push(mapper(issue2));
|
|
9739
9739
|
} else {
|
|
@@ -9772,17 +9772,17 @@ function formatError2(error62, mapper = (issue2) => issue2.message) {
|
|
|
9772
9772
|
}
|
|
9773
9773
|
function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
9774
9774
|
const result = { errors: [] };
|
|
9775
|
-
const processError = (error63,
|
|
9775
|
+
const processError = (error63, path11 = []) => {
|
|
9776
9776
|
var _a5;
|
|
9777
9777
|
for (const issue2 of error63.issues) {
|
|
9778
9778
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
9779
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
9779
|
+
issue2.errors.map((issues) => processError({ issues }, [...path11, ...issue2.path]));
|
|
9780
9780
|
} else if (issue2.code === "invalid_key") {
|
|
9781
|
-
processError({ issues: issue2.issues }, [...
|
|
9781
|
+
processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
|
|
9782
9782
|
} else if (issue2.code === "invalid_element") {
|
|
9783
|
-
processError({ issues: issue2.issues }, [...
|
|
9783
|
+
processError({ issues: issue2.issues }, [...path11, ...issue2.path]);
|
|
9784
9784
|
} else {
|
|
9785
|
-
const fullpath = [...
|
|
9785
|
+
const fullpath = [...path11, ...issue2.path];
|
|
9786
9786
|
if (fullpath.length === 0) {
|
|
9787
9787
|
result.errors.push(mapper(issue2));
|
|
9788
9788
|
continue;
|
|
@@ -9821,8 +9821,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
|
9821
9821
|
}
|
|
9822
9822
|
function toDotPath(_path) {
|
|
9823
9823
|
const segs = [];
|
|
9824
|
-
const
|
|
9825
|
-
for (const seg of
|
|
9824
|
+
const path11 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
9825
|
+
for (const seg of path11) {
|
|
9826
9826
|
if (typeof seg === "number")
|
|
9827
9827
|
segs.push(`[${seg}]`);
|
|
9828
9828
|
else if (typeof seg === "symbol")
|
|
@@ -26960,13 +26960,13 @@ function resolveRef(ref, ctx) {
|
|
|
26960
26960
|
if (!ref.startsWith("#")) {
|
|
26961
26961
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
26962
26962
|
}
|
|
26963
|
-
const
|
|
26964
|
-
if (
|
|
26963
|
+
const path11 = ref.slice(1).split("/").filter(Boolean);
|
|
26964
|
+
if (path11.length === 0) {
|
|
26965
26965
|
return ctx.rootSchema;
|
|
26966
26966
|
}
|
|
26967
26967
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
26968
|
-
if (
|
|
26969
|
-
const key =
|
|
26968
|
+
if (path11[0] === defsKey) {
|
|
26969
|
+
const key = path11[1] === void 0 ? void 0 : decodeJSONPointerSegment(path11[1]);
|
|
26970
26970
|
if (!key || !ctx.defs[key]) {
|
|
26971
26971
|
throw new Error(`Reference not found: ${ref}`);
|
|
26972
26972
|
}
|
|
@@ -27848,6 +27848,7 @@ var ACTIVITY_FIELD_TYPE_VALUES = [...FIELD_TYPE_VALUES, "number", "boolean", "si
|
|
|
27848
27848
|
var activityFieldTypeValidator = v.union(...ACTIVITY_FIELD_TYPE_VALUES.map((type) => v.literal(type)));
|
|
27849
27849
|
var activityFieldTypeSchema = external_exports.enum(ACTIVITY_FIELD_TYPE_VALUES);
|
|
27850
27850
|
var activityFieldOptionValidator = v.object({ value: v.string(), label: v.optional(v.string()), color: v.optional(v.string()) });
|
|
27851
|
+
var MAX_ACTIVITY_FIELD_VALUES = 1e3;
|
|
27851
27852
|
var externalActivityFieldValueSchema = external_exports.strictObject({ valueId: external_exports.string(), fieldId: external_exports.string(), label: external_exports.string(), type: activityFieldTypeSchema, value: external_exports.string() });
|
|
27852
27853
|
var externalActivityFieldValueValidator = v.object({ valueId: v.string(), fieldId: v.string(), label: v.string(), type: activityFieldTypeValidator, value: v.string() });
|
|
27853
27854
|
var activityFieldFilterSchema = external_exports.strictObject({ label: external_exports.string().trim().min(1).max(100), value: external_exports.string().min(1).max(16384) });
|
|
@@ -28063,6 +28064,19 @@ var attributeStringPatch = external_exports.record(external_exports.string(), ex
|
|
|
28063
28064
|
}).meta({ patternProperties: ATTRIBUTE_STRING_PATCH_JSON_SCHEMA.patternProperties, additionalProperties: ATTRIBUTE_STRING_PATCH_JSON_SCHEMA.additionalProperties });
|
|
28064
28065
|
|
|
28065
28066
|
// ../packages/shared/src/activity-contracts.ts
|
|
28067
|
+
var ACTIVITY_FIELD_TYPE_VALUES2 = ["text", "email", "phone", "url", "postal-address", "date", "salutation", "job-title", "json", "number", "boolean", "single-select", "multi-select"];
|
|
28068
|
+
var fieldsJsonSchema = { type: "array", maxItems: 1e3, items: {
|
|
28069
|
+
type: "object",
|
|
28070
|
+
additionalProperties: false,
|
|
28071
|
+
required: ["value"],
|
|
28072
|
+
properties: {
|
|
28073
|
+
label: { type: "string", minLength: 1, maxLength: 100 },
|
|
28074
|
+
fieldId: { type: "string", minLength: 1, maxLength: 128 },
|
|
28075
|
+
type: { type: "string", enum: ACTIVITY_FIELD_TYPE_VALUES2 },
|
|
28076
|
+
value: { anyOf: [{ type: "string" }, { type: "number" }, { type: "boolean" }, { type: "array", maxItems: 1e3, items: { type: "string" } }, { type: "null" }] }
|
|
28077
|
+
},
|
|
28078
|
+
oneOf: [{ required: ["label"] }, { required: ["fieldId"] }]
|
|
28079
|
+
} };
|
|
28066
28080
|
var MAX_ACTIVITY_AGENT_ASSIGNEES = 20;
|
|
28067
28081
|
var ACTIVITY_TYPE_VALUES = ["note", "conversation", "meeting", "call", "message", "task"];
|
|
28068
28082
|
var ACTIVITY_CREATE_SOURCE_CREATED_AT_DESCRIPTION = SOURCE_CREATED_AT_DESCRIPTION;
|
|
@@ -28081,6 +28095,7 @@ var activityUpdateInputProperties = {
|
|
|
28081
28095
|
description: "Replace linked entities with this non-empty set."
|
|
28082
28096
|
},
|
|
28083
28097
|
type: { type: "string", enum: ACTIVITY_TYPE_VALUES },
|
|
28098
|
+
fields: fieldsJsonSchema,
|
|
28084
28099
|
attributes: {
|
|
28085
28100
|
...ATTRIBUTE_STRING_PATCH_JSON_SCHEMA,
|
|
28086
28101
|
description: "Activity attributes. Set a value to null to remove it."
|
|
@@ -28141,12 +28156,12 @@ var ValidationError = class extends Error {
|
|
|
28141
28156
|
expected;
|
|
28142
28157
|
got;
|
|
28143
28158
|
path;
|
|
28144
|
-
constructor(expected, got,
|
|
28145
|
-
const message3 = `Validator error${
|
|
28159
|
+
constructor(expected, got, path11) {
|
|
28160
|
+
const message3 = `Validator error${path11 ? ` for ${path11}` : ""}: Expected \`${expected}\`, got \`${got}\``;
|
|
28146
28161
|
super(message3);
|
|
28147
28162
|
this.expected = expected;
|
|
28148
28163
|
this.got = got;
|
|
28149
|
-
this.path =
|
|
28164
|
+
this.path = path11;
|
|
28150
28165
|
this.name = "ValidationError";
|
|
28151
28166
|
}
|
|
28152
28167
|
};
|
|
@@ -28229,10 +28244,10 @@ function validate2(validator, value, opts) {
|
|
|
28229
28244
|
break;
|
|
28230
28245
|
}
|
|
28231
28246
|
for (const [index, v3] of value.entries()) {
|
|
28232
|
-
const
|
|
28247
|
+
const path11 = `${opts?._pathPrefix ?? ""}[${index}]`;
|
|
28233
28248
|
valid2 = validate2(validator.element, v3, {
|
|
28234
28249
|
...opts,
|
|
28235
|
-
_pathPrefix:
|
|
28250
|
+
_pathPrefix: path11
|
|
28236
28251
|
});
|
|
28237
28252
|
if (!valid2) {
|
|
28238
28253
|
expected = validator.element.kind;
|
|
@@ -28330,8 +28345,8 @@ function validate2(validator, value, opts) {
|
|
|
28330
28345
|
}
|
|
28331
28346
|
return valid2;
|
|
28332
28347
|
}
|
|
28333
|
-
function appendPath(opts,
|
|
28334
|
-
return opts?._pathPrefix ? `${opts._pathPrefix}.${
|
|
28348
|
+
function appendPath(opts, path11) {
|
|
28349
|
+
return opts?._pathPrefix ? `${opts._pathPrefix}.${path11}` : path11;
|
|
28335
28350
|
}
|
|
28336
28351
|
|
|
28337
28352
|
// ../packages/shared/src/operation-validation.ts
|
|
@@ -28591,6 +28606,28 @@ var ExitWithCode = class extends Error {
|
|
|
28591
28606
|
this.code = code3;
|
|
28592
28607
|
}
|
|
28593
28608
|
};
|
|
28609
|
+
var UPGRADE_REQUIRED_EXIT_CODE = 3;
|
|
28610
|
+
var UpgradeRequiredError = class extends Error {
|
|
28611
|
+
data;
|
|
28612
|
+
constructor(message3, data = {}) {
|
|
28613
|
+
super(message3);
|
|
28614
|
+
this.name = "UpgradeRequiredError";
|
|
28615
|
+
this.data = data;
|
|
28616
|
+
}
|
|
28617
|
+
};
|
|
28618
|
+
function isUpgradeRequired(err) {
|
|
28619
|
+
return err instanceof UpgradeRequiredError || err instanceof ApiError && err.statusCode === 426;
|
|
28620
|
+
}
|
|
28621
|
+
async function upgradeRequiredFromResponse(resp, path11) {
|
|
28622
|
+
let data = {};
|
|
28623
|
+
try {
|
|
28624
|
+
const body = await resp.json();
|
|
28625
|
+
if (body.error && typeof body.error === "object" && !Array.isArray(body.error)) data = body.error;
|
|
28626
|
+
} catch {
|
|
28627
|
+
}
|
|
28628
|
+
const message3 = typeof data.message === "string" && data.message ? data.message : `The server refused this client version at ${path11} (426 Upgrade Required). Install the latest version.`;
|
|
28629
|
+
return new UpgradeRequiredError(message3, data);
|
|
28630
|
+
}
|
|
28594
28631
|
|
|
28595
28632
|
// core/output.ts
|
|
28596
28633
|
function emit(stdout, data, json4, rowsFn, headers) {
|
|
@@ -28627,8 +28664,9 @@ function renderTable(rows, headers) {
|
|
|
28627
28664
|
|
|
28628
28665
|
// core/errorOutput.ts
|
|
28629
28666
|
function writeCommandError(stdout, stderr, json4, error62) {
|
|
28667
|
+
const message3 = error62 instanceof ApiError && isUpgradeRequired(error62) ? error62.detail : isUpgradeRequired(error62) && error62 instanceof Error ? error62.message : errorMessage(error62);
|
|
28630
28668
|
if (!json4) {
|
|
28631
|
-
stderr.write(`Error: ${
|
|
28669
|
+
stderr.write(`Error: ${message3}
|
|
28632
28670
|
`);
|
|
28633
28671
|
return;
|
|
28634
28672
|
}
|
|
@@ -28636,11 +28674,14 @@ function writeCommandError(stdout, stderr, json4, error62) {
|
|
|
28636
28674
|
const details = data && typeof data === "object" && !Array.isArray(data) ? data : {};
|
|
28637
28675
|
stdout.write(`${JSON.stringify({ error: {
|
|
28638
28676
|
...details,
|
|
28639
|
-
message:
|
|
28677
|
+
message: message3,
|
|
28640
28678
|
...error62 instanceof ApiError ? { statusCode: error62.statusCode } : {}
|
|
28641
28679
|
} }, null, 2)}
|
|
28642
28680
|
`);
|
|
28643
28681
|
}
|
|
28682
|
+
function commandErrorExitCode(error62) {
|
|
28683
|
+
return isUpgradeRequired(error62) ? UPGRADE_REQUIRED_EXIT_CODE : 1;
|
|
28684
|
+
}
|
|
28644
28685
|
|
|
28645
28686
|
// core/command.ts
|
|
28646
28687
|
var BaseCommand = class extends Command {
|
|
@@ -28672,7 +28713,8 @@ var BaseCommand = class extends Command {
|
|
|
28672
28713
|
}
|
|
28673
28714
|
// Template method: every command gets the same error boundary. A thrown
|
|
28674
28715
|
// ExitWithCode is an already-reported exit (no `Error:` line); anything else
|
|
28675
|
-
// is surfaced as `Error: <message>` on stderr with exit 1
|
|
28716
|
+
// is surfaced as `Error: <message>` on stderr with exit 1 (3 when the server
|
|
28717
|
+
// requires a newer client).
|
|
28676
28718
|
async execute() {
|
|
28677
28719
|
try {
|
|
28678
28720
|
const code3 = await this.run();
|
|
@@ -28680,7 +28722,7 @@ var BaseCommand = class extends Command {
|
|
|
28680
28722
|
} catch (err) {
|
|
28681
28723
|
if (err instanceof ExitWithCode) return err.code;
|
|
28682
28724
|
writeCommandError(this.context.stdout, this.context.stderr, this.json, err);
|
|
28683
|
-
return
|
|
28725
|
+
return commandErrorExitCode(err);
|
|
28684
28726
|
}
|
|
28685
28727
|
}
|
|
28686
28728
|
};
|
|
@@ -28705,7 +28747,7 @@ function parseOperationAttrs(operation, pairs) {
|
|
|
28705
28747
|
}
|
|
28706
28748
|
|
|
28707
28749
|
// ente/version.ts
|
|
28708
|
-
var VERSION = "0.4.
|
|
28750
|
+
var VERSION = "0.4.125";
|
|
28709
28751
|
|
|
28710
28752
|
// ente/branding.ts
|
|
28711
28753
|
var NPM_REGISTRY = "https://registry.npmjs.org";
|
|
@@ -28733,6 +28775,35 @@ var PLATFORM_CREDENTIAL = {
|
|
|
28733
28775
|
profileEnvVar: "ENTE_PLATFORM_PROFILE"
|
|
28734
28776
|
};
|
|
28735
28777
|
|
|
28778
|
+
// ../packages/shared/src/cli-compatibility.ts
|
|
28779
|
+
var CLI_COMPATIBILITY_LEVEL = 1;
|
|
28780
|
+
var CLI_VERSION_HEADER = "X-Ente-CLI-Version";
|
|
28781
|
+
var CLI_COMPATIBILITY_HEADER = "X-Ente-CLI-Compatibility";
|
|
28782
|
+
function cliCompatibilityHeaders(version5) {
|
|
28783
|
+
return {
|
|
28784
|
+
[CLI_VERSION_HEADER]: version5,
|
|
28785
|
+
[CLI_COMPATIBILITY_HEADER]: String(CLI_COMPATIBILITY_LEVEL)
|
|
28786
|
+
};
|
|
28787
|
+
}
|
|
28788
|
+
|
|
28789
|
+
// ente/clientIdentity.ts
|
|
28790
|
+
var CLI_REQUEST_HEADERS = Object.freeze(cliCompatibilityHeaders(VERSION));
|
|
28791
|
+
|
|
28792
|
+
// ../packages/shared/src/activity-field-inputs.ts
|
|
28793
|
+
var activityFieldInputSchema = external_exports.strictObject({
|
|
28794
|
+
label: fieldLabelSchema.optional(),
|
|
28795
|
+
fieldId: external_exports.string().min(1).max(128).optional(),
|
|
28796
|
+
type: activityFieldTypeSchema.optional(),
|
|
28797
|
+
value: external_exports.union([external_exports.string(), external_exports.number().finite(), external_exports.boolean(), external_exports.array(external_exports.string()).max(MAX_ACTIVITY_FIELD_VALUES), external_exports.null()])
|
|
28798
|
+
}).refine((input2) => Number(input2.label !== void 0) + Number(input2.fieldId !== void 0) === 1, "Choose label or fieldId");
|
|
28799
|
+
var activityFieldInputsSchema = external_exports.array(activityFieldInputSchema).max(MAX_ACTIVITY_FIELD_VALUES);
|
|
28800
|
+
var activityFieldInputValidator = v.object({
|
|
28801
|
+
label: v.optional(v.string()),
|
|
28802
|
+
fieldId: v.optional(v.id("fields")),
|
|
28803
|
+
type: v.optional(activityFieldTypeValidator),
|
|
28804
|
+
value: v.union(v.string(), v.number(), v.boolean(), v.array(v.string()), v.null())
|
|
28805
|
+
});
|
|
28806
|
+
|
|
28736
28807
|
// ../packages/shared/src/input-fields.ts
|
|
28737
28808
|
function isInputRecord(value) {
|
|
28738
28809
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
@@ -28772,6 +28843,8 @@ function parseActivityCreateInput(args, name4 = "activities_create") {
|
|
|
28772
28843
|
if ("createdAt" in args) return invalid(`${name4} createdAt is no longer accepted; use sourceCreatedAt.`);
|
|
28773
28844
|
if (args.sourceCreatedAt !== void 0 && !isSourceCreatedAtInput(args.sourceCreatedAt))
|
|
28774
28845
|
return invalid(`${name4} sourceCreatedAt must be an object: { date: "YYYY-MM-DD", time?: "HH:mm" | null, timezone?: string }`);
|
|
28846
|
+
if (args.fields !== void 0 && !activityFieldInputsSchema.safeParse(args.fields).success) return invalid(`${name4} fields must contain label or fieldId and typed value`);
|
|
28847
|
+
const fields4 = args.fields === void 0 ? void 0 : activityFieldInputsSchema.parse(args.fields);
|
|
28775
28848
|
const entityIds = optionalStringArray(args.entityIds);
|
|
28776
28849
|
if (!entityIds?.length) return invalid(`${name4} requires entityIds to be a non-empty string array`);
|
|
28777
28850
|
if (!isActivityType(args.type)) return invalid(`${name4} requires type to be one of: ${ACTIVITY_TYPE_VALUES.join(", ")}`);
|
|
@@ -28792,6 +28865,7 @@ function parseActivityCreateInput(args, name4 = "activities_create") {
|
|
|
28792
28865
|
deadline: isDeadlineInput(args.deadline) ? args.deadline : void 0,
|
|
28793
28866
|
completed: optionalBoolean(args.completed),
|
|
28794
28867
|
attributes: attributes2,
|
|
28868
|
+
fields: fields4,
|
|
28795
28869
|
sourceCreatedAt: isSourceCreatedAtInput(args.sourceCreatedAt) ? args.sourceCreatedAt : void 0,
|
|
28796
28870
|
tags: optionalStringArray(args.tags),
|
|
28797
28871
|
assigneeIds: optionalStringArray(args.assigneeIds),
|
|
@@ -28806,6 +28880,8 @@ function parseActivityUpdateInput(args, name4 = "activities_update") {
|
|
|
28806
28880
|
return invalid(`${name4} deadline must be a readable deadline object, number, or null`);
|
|
28807
28881
|
if (args.type !== void 0 && !isActivityType(args.type))
|
|
28808
28882
|
return invalid(`${name4} type must be one of: ${ACTIVITY_TYPE_VALUES.join(", ")}`);
|
|
28883
|
+
if (args.fields !== void 0 && !activityFieldInputsSchema.safeParse(args.fields).success) return invalid(`${name4} fields must contain label or fieldId and typed value`);
|
|
28884
|
+
const fields4 = args.fields === void 0 ? void 0 : activityFieldInputsSchema.parse(args.fields);
|
|
28809
28885
|
const entityIds = optionalStringArray(args.entityIds);
|
|
28810
28886
|
if (args.entityIds !== void 0 && !entityIds?.length) return invalid(`${name4} entityIds must be a non-empty string array`);
|
|
28811
28887
|
if (args.attributes !== void 0 && !isInputRecord(args.attributes)) return invalid(`${name4} attributes must be an object`);
|
|
@@ -28824,6 +28900,7 @@ function parseActivityUpdateInput(args, name4 = "activities_update") {
|
|
|
28824
28900
|
entityIds,
|
|
28825
28901
|
type: isActivityType(args.type) ? args.type : void 0,
|
|
28826
28902
|
attributes: attributes2,
|
|
28903
|
+
fields: fields4,
|
|
28827
28904
|
assigneeIds: optionalStringArray(args.assigneeIds),
|
|
28828
28905
|
assigneeEmails: optionalStringArray(args.assigneeEmails),
|
|
28829
28906
|
agentAssigneeIds: isBoundedAgentIds(args.agentAssigneeIds) ? args.agentAssigneeIds : void 0
|
|
@@ -28849,11 +28926,11 @@ var nullableDeadline = activityWriteDeadline.nullable();
|
|
|
28849
28926
|
var assignees = { assigneeIds: ids.optional(), assigneeEmails: strings.optional(), agentAssigneeIds: ids.max(MAX_ACTIVITY_AGENT_ASSIGNEES).optional() };
|
|
28850
28927
|
var stringAttributes2 = external_exports.record(attributeKey, external_exports.string());
|
|
28851
28928
|
var patchAttributes = attributeStringPatch;
|
|
28852
|
-
var updateFields = { onBehalfOfAgentId: id4.describe("Direct task principal; live grant and credential scope/space restrictions apply.").optional(), activityId: id4, title: external_exports.string().optional(), content: external_exports.string().describe(ACTIVITY_BODY_MARKDOWN_DESCRIPTION).optional(), deadline: nullableDeadline.optional(), completed: external_exports.boolean().optional(), entityIds: ids.min(1).optional(), type: external_exports.enum(ACTIVITY_TYPE_VALUES).optional(), attributes: patchAttributes.optional(), ...assignees };
|
|
28929
|
+
var updateFields = { onBehalfOfAgentId: id4.describe("Direct task principal; live grant and credential scope/space restrictions apply.").optional(), activityId: id4, title: external_exports.string().optional(), content: external_exports.string().describe(ACTIVITY_BODY_MARKDOWN_DESCRIPTION).optional(), deadline: nullableDeadline.optional(), completed: external_exports.boolean().optional(), entityIds: ids.min(1).optional(), type: external_exports.enum(ACTIVITY_TYPE_VALUES).optional(), attributes: patchAttributes.optional(), fields: activityFieldInputsSchema.optional(), ...assignees };
|
|
28853
28930
|
var assignment = external_exports.strictObject({ onBehalfOfAgentId: id4.describe("Direct task principal; live grant and credential scope/space restrictions apply.").optional(), activityId: id4, action: external_exports.enum(["replace", "add", "remove", "clear"]), assigneeIds: ids.optional(), assigneeEmails: strings.optional(), agentAssigneeIds: ids.describe("At most 20 IDs for replace. Add/remove/clear retain the installed bounded wire array; add deduplicates before enforcing at most 20 assigned agents in the resulting task. Assignment grants no access.").optional() }).refine((value) => value.action !== "replace" || value.agentAssigneeIds === void 0 || value.agentAssigneeIds.length <= MAX_ACTIVITY_AGENT_ASSIGNEES, { path: ["agentAssigneeIds"], message: "Too many replacement agent assignees" });
|
|
28854
28931
|
var attributes = external_exports.strictObject({ activityId: id4, action: external_exports.enum(["set", "remove", "replace", "clear"]), attributes: stringAttributes2.optional(), keys: strings.optional() }).refine((value) => value.action !== "set" || value.attributes !== void 0 && Object.keys(value.attributes).length > 0, { path: ["attributes"], message: "set requires attributes" }).refine((value) => value.action !== "remove" || value.keys !== void 0 && value.keys.length > 0, { path: ["keys"], message: "remove requires keys" });
|
|
28855
28932
|
var activityWriteInputs = {
|
|
28856
|
-
createActivity: external_exports.strictObject({ onBehalfOfAgentId: id4.describe("Direct task principal; live grant and credential scope/space restrictions apply.").optional(), externalKey: external_exports.string().trim().min(1).max(512).optional(), spaceId: id4.describe("Explicit destination space ID; choose it before creating this activity."), entityIds: ids.min(1), type: external_exports.enum(ACTIVITY_TYPE_VALUES), title: external_exports.string().optional(), content: external_exports.string().describe(ACTIVITY_BODY_MARKDOWN_DESCRIPTION).optional(), deadline: activityWriteDeadline.optional(), completed: external_exports.boolean().optional(), attributes: stringAttributes2.optional(), sourceCreatedAt: readableActivityDate.describe(ACTIVITY_CREATE_SOURCE_CREATED_AT_DESCRIPTION).optional(), tags: strings.optional(), ...assignees, autoLinkPersonalSpace: external_exports.boolean().optional() }),
|
|
28933
|
+
createActivity: external_exports.strictObject({ onBehalfOfAgentId: id4.describe("Direct task principal; live grant and credential scope/space restrictions apply.").optional(), externalKey: external_exports.string().trim().min(1).max(512).optional(), spaceId: id4.describe("Explicit destination space ID; choose it before creating this activity."), entityIds: ids.min(1), type: external_exports.enum(ACTIVITY_TYPE_VALUES), title: external_exports.string().optional(), content: external_exports.string().describe(ACTIVITY_BODY_MARKDOWN_DESCRIPTION).optional(), deadline: activityWriteDeadline.optional(), completed: external_exports.boolean().optional(), attributes: stringAttributes2.optional(), fields: activityFieldInputsSchema.optional(), sourceCreatedAt: readableActivityDate.describe(ACTIVITY_CREATE_SOURCE_CREATED_AT_DESCRIPTION).optional(), tags: strings.optional(), ...assignees, autoLinkPersonalSpace: external_exports.boolean().optional() }),
|
|
28857
28934
|
updateActivity: external_exports.strictObject(updateFields),
|
|
28858
28935
|
updateActivityTitle: external_exports.strictObject({ activityId: id4, title: external_exports.string() }),
|
|
28859
28936
|
updateActivityDeadline: external_exports.strictObject({ activityId: id4, deadline: nullableDeadline.optional() }),
|
|
@@ -28862,11 +28939,12 @@ var activityWriteInputs = {
|
|
|
28862
28939
|
updateActivityAssignees: assignment,
|
|
28863
28940
|
toggleActivityCompleted: external_exports.strictObject({ activityId: id4 }),
|
|
28864
28941
|
addActivityMessage: external_exports.strictObject({ activityId: id4, content: external_exports.string().regex(/\S/, "Message content is required") }),
|
|
28942
|
+
deleteActivityMessage: external_exports.strictObject({ messageId: id4 }),
|
|
28865
28943
|
deleteActivity: external_exports.strictObject({ activityId: id4 }),
|
|
28866
28944
|
restoreActivity: external_exports.strictObject({ activityId: id4 }),
|
|
28867
28945
|
batchUpdateTasks: external_exports.strictObject({ updates: external_exports.array(external_exports.strictObject({ activityId: id4, completed: external_exports.boolean().optional(), deadline: activityWriteDeadline.optional(), attributes: patchAttributes.optional() })).max(ACTIVITY_WRITE_LIMITS.wireArray) })
|
|
28868
28946
|
};
|
|
28869
|
-
var activityWriteAliases = { activities_create: "createActivity", activities_update: "updateActivity", activities_assign: "updateActivityAssignees", activities_addMessage: "addActivityMessage", activities_delete: "deleteActivity", activities_restore: "restoreActivity" };
|
|
28947
|
+
var activityWriteAliases = { activities_create: "createActivity", activities_update: "updateActivity", activities_assign: "updateActivityAssignees", activities_addMessage: "addActivityMessage", activities_deleteMessage: "deleteActivityMessage", activities_delete: "deleteActivity", activities_restore: "restoreActivity" };
|
|
28870
28948
|
function isActivityWriteOperationName(name4) {
|
|
28871
28949
|
return Object.hasOwn(activityWriteInputs, name4);
|
|
28872
28950
|
}
|
|
@@ -28900,6 +28978,8 @@ function parseActivityWriteRequest(operation, raw) {
|
|
|
28900
28978
|
return { operation, input: parseOperationInput(operation, activityWriteInputs.toggleActivityCompleted, raw) };
|
|
28901
28979
|
case "addActivityMessage":
|
|
28902
28980
|
return { operation, input: parseOperationInput(operation, activityWriteInputs.addActivityMessage, raw) };
|
|
28981
|
+
case "deleteActivityMessage":
|
|
28982
|
+
return { operation, input: parseOperationInput(operation, activityWriteInputs.deleteActivityMessage, raw) };
|
|
28903
28983
|
case "deleteActivity":
|
|
28904
28984
|
return { operation, input: parseOperationInput(operation, activityWriteInputs.deleteActivity, raw) };
|
|
28905
28985
|
case "restoreActivity":
|
|
@@ -28922,6 +29002,7 @@ var activityWriteResults = {
|
|
|
28922
29002
|
updateActivityAssignees: ack,
|
|
28923
29003
|
toggleActivityCompleted: external_exports.strictObject({ completed: external_exports.boolean() }),
|
|
28924
29004
|
addActivityMessage: external_exports.strictObject({ messageId: id5 }),
|
|
29005
|
+
deleteActivityMessage: ack,
|
|
28925
29006
|
deleteActivity: ack,
|
|
28926
29007
|
restoreActivity: ack,
|
|
28927
29008
|
batchUpdateTasks: external_exports.discriminatedUnion("status", [
|
|
@@ -29015,8 +29096,8 @@ function operationResultSchema(validator) {
|
|
|
29015
29096
|
// ../packages/shared/src/activity-write-catalog.ts
|
|
29016
29097
|
var composite = /* @__PURE__ */ new Set(["updateActivityAssignees", "updateActivityAttributes", "toggleActivityCompleted", "batchUpdateTasks"]);
|
|
29017
29098
|
var descriptions = {
|
|
29018
|
-
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. Missing owner grants require human review.",
|
|
29019
|
-
updateActivity: "Update supplied fields in the activity's actual space. Attributes merge
|
|
29099
|
+
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. JSON is serialized text. New labels/options follow writer rules. Missing owner grants require human review.",
|
|
29100
|
+
updateActivity: "Update supplied fields in the activity's actual space. Fields use label or fieldId with typed values; null clears, new select options are implicit, JSON is serialized text. Existing fields cannot be retyped; overlap with attributes is rejected. Attributes merge strings and delete null-valued keys. Explicit completed is idempotent. Owners must already belong to the activity space. Provider-backed email body and type restrictions remain enforced.",
|
|
29020
29101
|
updateActivityTitle: "Set or clear an activity title. Existing revision and verified updater bookkeeping stay in the same transaction.",
|
|
29021
29102
|
updateActivityDeadline: "Set a readable or finite epoch deadline; null clears it and omission leaves it unchanged in this profile.",
|
|
29022
29103
|
updateActivityContent: "Replace the ordinary activity body with markdown, preserving revisions and read-only provider-email policy. Version-window editing is a separate operation family.",
|
|
@@ -29024,6 +29105,7 @@ var descriptions = {
|
|
|
29024
29105
|
updateActivityAssignees: "Replace/add/remove/clear task assignees. Replace clears omitted humans and preserves omitted agents; clear removes both. Add deduplicates. Assignment grants no access. Concurrent changes may overwrite the prior read. Receipt reports commit; legacy enrichment is later.",
|
|
29025
29106
|
toggleActivityCompleted: "Toggle using the native read-then-set profile. The inverse is selected before the write, so concurrent toggles are not serialized as repeated atomic flips. Receipt reports the completed value committed by this write. Explicit updateActivity.completed remains idempotent.",
|
|
29026
29107
|
addActivityMessage: "Append an ordinary activity discussion message with verified author and agent identity. This is separate from human-only Native Messenger and from edits to the parent activity body.",
|
|
29108
|
+
deleteActivityMessage: "Permanently delete an activity message you authored. Agents delete only their own agent's messages.",
|
|
29027
29109
|
deleteActivity: "Archive an activity through the existing lifecycle and task cleanup. Already archived records are unchanged.",
|
|
29028
29110
|
restoreActivity: "Restore an activity through the existing lifecycle, ownership, actor and task index rules. Already active records are unchanged.",
|
|
29029
29111
|
batchUpdateTasks: "Validate the complete batch structure before dispatch, then commit each item sequentially through the ordinary activity update. Stop at the first failure and report committed IDs/count and failed index. Earlier commits remain; later items never run. No automatic retry or whole-batch rollback."
|
|
@@ -29035,6 +29117,12 @@ function propertySchema(schema) {
|
|
|
29035
29117
|
function definition(name4) {
|
|
29036
29118
|
const schema = external_exports.toJSONSchema(activityWriteInputs[name4], { io: "input" });
|
|
29037
29119
|
const properties = schema.properties ?? {};
|
|
29120
|
+
if (name4 === "createActivity" || name4 === "updateActivity") {
|
|
29121
|
+
const fields4 = propertySchema(properties.fields), item = propertySchema(fields4.items);
|
|
29122
|
+
item.additionalProperties = false;
|
|
29123
|
+
item.oneOf = [{ type: "object", properties: item.properties, additionalProperties: false, required: ["label"] }, { type: "object", properties: item.properties, additionalProperties: false, required: ["fieldId"] }];
|
|
29124
|
+
if (item.properties?.label) Object.assign(propertySchema(item.properties.label), { minLength: 1, maxLength: 100 });
|
|
29125
|
+
}
|
|
29038
29126
|
const conditions = name4 === "updateActivityAssignees" ? [{ anyOf: [
|
|
29039
29127
|
{ type: "object", properties: { action: { enum: ["add", "remove", "clear"] } } },
|
|
29040
29128
|
{ type: "object", properties: { action: { const: "replace" }, agentAssigneeIds: { type: "array", items: { type: "string", minLength: 1, maxLength: 128 }, maxItems: ACTIVITY_WRITE_LIMITS.agentAssignees } } }
|
|
@@ -29346,12 +29434,12 @@ function createApi(pathParts = []) {
|
|
|
29346
29434
|
`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${found}\``
|
|
29347
29435
|
);
|
|
29348
29436
|
}
|
|
29349
|
-
const
|
|
29437
|
+
const path11 = pathParts.slice(0, -1).join("/");
|
|
29350
29438
|
const exportName = pathParts[pathParts.length - 1];
|
|
29351
29439
|
if (exportName === "default") {
|
|
29352
|
-
return
|
|
29440
|
+
return path11;
|
|
29353
29441
|
} else {
|
|
29354
|
-
return
|
|
29442
|
+
return path11 + ":" + exportName;
|
|
29355
29443
|
}
|
|
29356
29444
|
} else if (prop === Symbol.toStringTag) {
|
|
29357
29445
|
return "FunctionReference";
|
|
@@ -34022,65 +34110,67 @@ var RestClient = class {
|
|
|
34022
34110
|
baseUrl;
|
|
34023
34111
|
apiKey;
|
|
34024
34112
|
timeoutMs;
|
|
34113
|
+
defaultHeaders;
|
|
34025
34114
|
constructor(opts) {
|
|
34026
34115
|
let base = opts.baseUrl.replace(/\/+$/, "");
|
|
34027
34116
|
if (base.endsWith("/api/external")) base = base.slice(0, -"/api/external".length);
|
|
34028
34117
|
this.baseUrl = base;
|
|
34029
34118
|
this.apiKey = opts.apiKey;
|
|
34030
34119
|
this.timeoutMs = opts.timeoutMs ?? 15e3;
|
|
34120
|
+
this.defaultHeaders = opts.defaultHeaders ?? {};
|
|
34031
34121
|
}
|
|
34032
|
-
sendJson(method,
|
|
34033
|
-
return this.request(method,
|
|
34122
|
+
sendJson(method, path11, body) {
|
|
34123
|
+
return this.request(method, path11, body);
|
|
34034
34124
|
}
|
|
34035
|
-
get(
|
|
34036
|
-
return this.request("GET",
|
|
34125
|
+
get(path11, params, opts) {
|
|
34126
|
+
return this.request("GET", path11, void 0, params, opts);
|
|
34037
34127
|
}
|
|
34038
|
-
post(
|
|
34039
|
-
return this.request("POST",
|
|
34128
|
+
post(path11, body, params, opts) {
|
|
34129
|
+
return this.request("POST", path11, body, params, opts);
|
|
34040
34130
|
}
|
|
34041
|
-
patch(
|
|
34042
|
-
return this.request("PATCH",
|
|
34131
|
+
patch(path11, body, params, opts) {
|
|
34132
|
+
return this.request("PATCH", path11, body, params, opts);
|
|
34043
34133
|
}
|
|
34044
|
-
put(
|
|
34045
|
-
return this.request("PUT",
|
|
34134
|
+
put(path11, body, params, opts) {
|
|
34135
|
+
return this.request("PUT", path11, body, params, opts);
|
|
34046
34136
|
}
|
|
34047
|
-
delete(
|
|
34048
|
-
return this.request("DELETE",
|
|
34137
|
+
delete(path11, params, opts) {
|
|
34138
|
+
return this.request("DELETE", path11, void 0, params, opts);
|
|
34049
34139
|
}
|
|
34050
34140
|
/**
|
|
34051
34141
|
* POST raw bytes with an explicit Content-Type (not JSON). Used for binary
|
|
34052
34142
|
* uploads where the request body is the file itself, not a JSON envelope.
|
|
34053
34143
|
*/
|
|
34054
|
-
postRaw(
|
|
34055
|
-
return this.request("POST",
|
|
34144
|
+
postRaw(path11, bytes2, contentType, params, opts) {
|
|
34145
|
+
return this.request("POST", path11, void 0, params, opts, { bytes: bytes2, contentType });
|
|
34056
34146
|
}
|
|
34057
34147
|
/**
|
|
34058
34148
|
* GET a raw byte body, aborting once it exceeds `maxBytes`. Errors still
|
|
34059
34149
|
* parse the structured JSON error envelope.
|
|
34060
34150
|
*/
|
|
34061
|
-
async getBytes(
|
|
34151
|
+
async getBytes(path11, params, opts) {
|
|
34062
34152
|
const timeoutMs = opts.timeoutMs ?? this.timeoutMs;
|
|
34063
34153
|
const controller = new AbortController();
|
|
34064
34154
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
34065
34155
|
try {
|
|
34066
34156
|
let resp;
|
|
34067
34157
|
try {
|
|
34068
|
-
resp = await fetch(this.buildUrl(
|
|
34158
|
+
resp = await fetch(this.buildUrl(path11, params), {
|
|
34069
34159
|
method: "GET",
|
|
34070
|
-
headers: { Authorization: `Bearer ${this.apiKey}`, ...opts.headers },
|
|
34160
|
+
headers: { ...this.defaultHeaders, Authorization: `Bearer ${this.apiKey}`, ...opts.headers },
|
|
34071
34161
|
signal: controller.signal
|
|
34072
34162
|
});
|
|
34073
34163
|
} catch (err) {
|
|
34074
34164
|
if (err instanceof Error && err.name === "AbortError") {
|
|
34075
|
-
throw new Error(`Request to ${
|
|
34165
|
+
throw new Error(`Request to ${path11} timed out after ${timeoutMs}ms.`);
|
|
34076
34166
|
}
|
|
34077
|
-
throw new Error(`Could not reach the ente API (${
|
|
34167
|
+
throw new Error(`Could not reach the ente API (${path11}): ${String(err)}`);
|
|
34078
34168
|
}
|
|
34079
34169
|
const bodyLimit = resp.status >= 400 ? 64 * 1024 : opts.maxBytes;
|
|
34080
34170
|
const declared = Number(resp.headers.get("Content-Length") ?? "0");
|
|
34081
34171
|
if (declared > bodyLimit) {
|
|
34082
34172
|
await resp.body?.cancel();
|
|
34083
|
-
throw new Error(`Response from ${
|
|
34173
|
+
throw new Error(`Response from ${path11} exceeds ${bodyLimit} bytes.`);
|
|
34084
34174
|
}
|
|
34085
34175
|
const chunks = [];
|
|
34086
34176
|
let total = 0;
|
|
@@ -34092,7 +34182,7 @@ var RestClient = class {
|
|
|
34092
34182
|
total += value.byteLength;
|
|
34093
34183
|
if (total > bodyLimit) {
|
|
34094
34184
|
await reader.cancel();
|
|
34095
|
-
throw new Error(`Response from ${
|
|
34185
|
+
throw new Error(`Response from ${path11} exceeds ${bodyLimit} bytes.`);
|
|
34096
34186
|
}
|
|
34097
34187
|
chunks.push(value);
|
|
34098
34188
|
}
|
|
@@ -34109,15 +34199,15 @@ var RestClient = class {
|
|
|
34109
34199
|
return { bytes: bytes2, headers: resp.headers };
|
|
34110
34200
|
} catch (err) {
|
|
34111
34201
|
if (err instanceof Error && err.name === "AbortError") {
|
|
34112
|
-
throw new Error(`Request to ${
|
|
34202
|
+
throw new Error(`Request to ${path11} timed out after ${timeoutMs}ms.`);
|
|
34113
34203
|
}
|
|
34114
34204
|
throw err;
|
|
34115
34205
|
} finally {
|
|
34116
34206
|
clearTimeout(timer);
|
|
34117
34207
|
}
|
|
34118
34208
|
}
|
|
34119
|
-
buildUrl(
|
|
34120
|
-
const url2 = new URL(this.baseUrl +
|
|
34209
|
+
buildUrl(path11, params) {
|
|
34210
|
+
const url2 = new URL(this.baseUrl + path11);
|
|
34121
34211
|
if (params) {
|
|
34122
34212
|
for (const [k, v3] of Object.entries(params)) {
|
|
34123
34213
|
if (v3 !== void 0) url2.searchParams.set(k, v3);
|
|
@@ -34125,15 +34215,16 @@ var RestClient = class {
|
|
|
34125
34215
|
}
|
|
34126
34216
|
return url2.toString();
|
|
34127
34217
|
}
|
|
34128
|
-
async request(method,
|
|
34218
|
+
async request(method, path11, body, params, opts, raw) {
|
|
34129
34219
|
const timeoutMs = opts?.timeoutMs ?? this.timeoutMs;
|
|
34130
34220
|
const controller = new AbortController();
|
|
34131
34221
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
34132
34222
|
let resp;
|
|
34133
34223
|
try {
|
|
34134
|
-
resp = await fetch(this.buildUrl(
|
|
34224
|
+
resp = await fetch(this.buildUrl(path11, params), {
|
|
34135
34225
|
method,
|
|
34136
34226
|
headers: {
|
|
34227
|
+
...this.defaultHeaders,
|
|
34137
34228
|
Authorization: `Bearer ${this.apiKey}`,
|
|
34138
34229
|
"Content-Type": raw ? raw.contentType : "application/json",
|
|
34139
34230
|
...opts?.headers
|
|
@@ -34149,9 +34240,9 @@ var RestClient = class {
|
|
|
34149
34240
|
} catch (err) {
|
|
34150
34241
|
clearTimeout(timer);
|
|
34151
34242
|
if (err instanceof Error && err.name === "AbortError") {
|
|
34152
|
-
throw new Error(`Request to ${
|
|
34243
|
+
throw new Error(`Request to ${path11} timed out after ${timeoutMs}ms.`);
|
|
34153
34244
|
}
|
|
34154
|
-
throw new Error(`Could not reach the ente API (${
|
|
34245
|
+
throw new Error(`Could not reach the ente API (${path11}): ${String(err)}`);
|
|
34155
34246
|
}
|
|
34156
34247
|
clearTimeout(timer);
|
|
34157
34248
|
const text3 = await resp.text();
|
|
@@ -35176,7 +35267,7 @@ var EnteClient = class _EnteClient {
|
|
|
35176
35267
|
/** Build a client from stored/env credentials (throws if not authenticated). */
|
|
35177
35268
|
static fromConfig(branding) {
|
|
35178
35269
|
const { apiUrl, apiKey } = loadCredentials(branding);
|
|
35179
|
-
return new _EnteClient(new RestClient({ baseUrl: apiUrl, apiKey }));
|
|
35270
|
+
return new _EnteClient(new RestClient({ baseUrl: apiUrl, apiKey, defaultHeaders: CLI_REQUEST_HEADERS }));
|
|
35180
35271
|
}
|
|
35181
35272
|
// --- entities -----------------------------------------------------------
|
|
35182
35273
|
/** Installed full-record REST profile, used by internal resolvers/space metadata. */
|
|
@@ -36142,20 +36233,29 @@ function compareSemver(a, b) {
|
|
|
36142
36233
|
async function checkForUpdate(opts) {
|
|
36143
36234
|
try {
|
|
36144
36235
|
const cacheFile = path2.join(opts.cacheDir, "update_check.json");
|
|
36236
|
+
let cache = {};
|
|
36145
36237
|
if (existsSync2(cacheFile)) {
|
|
36146
|
-
|
|
36147
|
-
|
|
36148
|
-
|
|
36149
|
-
|
|
36150
|
-
|
|
36151
|
-
|
|
36152
|
-
|
|
36153
|
-
|
|
36154
|
-
|
|
36155
|
-
|
|
36238
|
+
cache = JSON.parse(readFileSync2(cacheFile, "utf8"));
|
|
36239
|
+
}
|
|
36240
|
+
let latest = cache.latest;
|
|
36241
|
+
let changed = false;
|
|
36242
|
+
if (!cache.last_check || Date.now() - cache.last_check >= CHECK_INTERVAL_MS) {
|
|
36243
|
+
const fetched = await fetchLatest(opts);
|
|
36244
|
+
if (!fetched) return;
|
|
36245
|
+
latest = fetched;
|
|
36246
|
+
cache = { ...cache, last_check: Date.now(), latest };
|
|
36247
|
+
changed = true;
|
|
36248
|
+
}
|
|
36249
|
+
const noticeDue = !cache.last_notice || Date.now() - cache.last_notice >= CHECK_INTERVAL_MS;
|
|
36250
|
+
const newer = latest !== void 0 && compareSemver(latest, opts.currentVersion) > 0;
|
|
36251
|
+
if (newer && noticeDue) {
|
|
36252
|
+
warn(opts, latest);
|
|
36253
|
+
cache = { ...cache, last_notice: Date.now() };
|
|
36254
|
+
changed = true;
|
|
36255
|
+
}
|
|
36256
|
+
if (!changed) return;
|
|
36156
36257
|
mkdirSync2(opts.cacheDir, { recursive: true });
|
|
36157
|
-
writeFileSync2(cacheFile, JSON.stringify(
|
|
36158
|
-
if (compareSemver(latest, opts.currentVersion) > 0) warn(opts, latest);
|
|
36258
|
+
writeFileSync2(cacheFile, JSON.stringify(cache));
|
|
36159
36259
|
} catch {
|
|
36160
36260
|
}
|
|
36161
36261
|
}
|
|
@@ -36639,15 +36739,15 @@ var require_constants = __commonJS2({
|
|
|
36639
36739
|
var require_node_gyp_build = __commonJS2({
|
|
36640
36740
|
"../node_modules/.pnpm/node-gyp-build@4.8.4/node_modules/node-gyp-build/node-gyp-build.js"(exports, module) {
|
|
36641
36741
|
var fs = __require2("fs");
|
|
36642
|
-
var
|
|
36643
|
-
var
|
|
36742
|
+
var path11 = __require2("path");
|
|
36743
|
+
var os4 = __require2("os");
|
|
36644
36744
|
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require2;
|
|
36645
36745
|
var vars3 = process.config && process.config.variables || {};
|
|
36646
36746
|
var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
|
|
36647
36747
|
var abi = process.versions.modules;
|
|
36648
36748
|
var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node";
|
|
36649
|
-
var arch = process.env.npm_config_arch ||
|
|
36650
|
-
var platform = process.env.npm_config_platform ||
|
|
36749
|
+
var arch = process.env.npm_config_arch || os4.arch();
|
|
36750
|
+
var platform = process.env.npm_config_platform || os4.platform();
|
|
36651
36751
|
var libc = process.env.LIBC || (isAlpine(platform) ? "musl" : "glibc");
|
|
36652
36752
|
var armv = process.env.ARM_VERSION || (arch === "arm64" ? "8" : vars3.arm_version) || "";
|
|
36653
36753
|
var uv = (process.versions.uv || "").split(".")[0];
|
|
@@ -36656,21 +36756,21 @@ var require_node_gyp_build = __commonJS2({
|
|
|
36656
36756
|
return runtimeRequire(load.resolve(dir));
|
|
36657
36757
|
}
|
|
36658
36758
|
load.resolve = load.path = function(dir) {
|
|
36659
|
-
dir =
|
|
36759
|
+
dir = path11.resolve(dir || ".");
|
|
36660
36760
|
try {
|
|
36661
|
-
var name4 = runtimeRequire(
|
|
36761
|
+
var name4 = runtimeRequire(path11.join(dir, "package.json")).name.toUpperCase().replace(/-/g, "_");
|
|
36662
36762
|
if (process.env[name4 + "_PREBUILD"]) dir = process.env[name4 + "_PREBUILD"];
|
|
36663
36763
|
} catch (err) {
|
|
36664
36764
|
}
|
|
36665
36765
|
if (!prebuildsOnly) {
|
|
36666
|
-
var release = getFirst(
|
|
36766
|
+
var release = getFirst(path11.join(dir, "build/Release"), matchBuild);
|
|
36667
36767
|
if (release) return release;
|
|
36668
|
-
var debug2 = getFirst(
|
|
36768
|
+
var debug2 = getFirst(path11.join(dir, "build/Debug"), matchBuild);
|
|
36669
36769
|
if (debug2) return debug2;
|
|
36670
36770
|
}
|
|
36671
36771
|
var prebuild = resolve2(dir);
|
|
36672
36772
|
if (prebuild) return prebuild;
|
|
36673
|
-
var nearby = resolve2(
|
|
36773
|
+
var nearby = resolve2(path11.dirname(process.execPath));
|
|
36674
36774
|
if (nearby) return nearby;
|
|
36675
36775
|
var target3 = [
|
|
36676
36776
|
"platform=" + platform,
|
|
@@ -36687,14 +36787,14 @@ var require_node_gyp_build = __commonJS2({
|
|
|
36687
36787
|
].filter(Boolean).join(" ");
|
|
36688
36788
|
throw new Error("No native build was found for " + target3 + "\n loaded from: " + dir + "\n");
|
|
36689
36789
|
function resolve2(dir2) {
|
|
36690
|
-
var tuples = readdirSync2(
|
|
36790
|
+
var tuples = readdirSync2(path11.join(dir2, "prebuilds")).map(parseTuple);
|
|
36691
36791
|
var tuple2 = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0];
|
|
36692
36792
|
if (!tuple2) return;
|
|
36693
|
-
var prebuilds =
|
|
36793
|
+
var prebuilds = path11.join(dir2, "prebuilds", tuple2.name);
|
|
36694
36794
|
var parsed = readdirSync2(prebuilds).map(parseTags);
|
|
36695
36795
|
var candidates = parsed.filter(matchTags(runtime, abi));
|
|
36696
36796
|
var winner = candidates.sort(compareTags(runtime))[0];
|
|
36697
|
-
if (winner) return
|
|
36797
|
+
if (winner) return path11.join(prebuilds, winner.file);
|
|
36698
36798
|
}
|
|
36699
36799
|
};
|
|
36700
36800
|
function readdirSync2(dir) {
|
|
@@ -36706,7 +36806,7 @@ var require_node_gyp_build = __commonJS2({
|
|
|
36706
36806
|
}
|
|
36707
36807
|
function getFirst(dir, filter) {
|
|
36708
36808
|
var files = readdirSync2(dir).filter(filter);
|
|
36709
|
-
return files[0] &&
|
|
36809
|
+
return files[0] && path11.join(dir, files[0]);
|
|
36710
36810
|
}
|
|
36711
36811
|
function matchBuild(name4) {
|
|
36712
36812
|
return /\.node$/.test(name4);
|
|
@@ -39048,7 +39148,7 @@ var require_websocket = __commonJS2({
|
|
|
39048
39148
|
var http = __require2("http");
|
|
39049
39149
|
var net = __require2("net");
|
|
39050
39150
|
var tls = __require2("tls");
|
|
39051
|
-
var { randomBytes: randomBytes3, createHash:
|
|
39151
|
+
var { randomBytes: randomBytes3, createHash: createHash6 } = __require2("crypto");
|
|
39052
39152
|
var { Duplex, Readable } = __require2("stream");
|
|
39053
39153
|
var { URL: URL2 } = __require2("url");
|
|
39054
39154
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
@@ -39716,7 +39816,7 @@ var require_websocket = __commonJS2({
|
|
|
39716
39816
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
39717
39817
|
return;
|
|
39718
39818
|
}
|
|
39719
|
-
const digest =
|
|
39819
|
+
const digest = createHash6("sha1").update(key + GUID).digest("base64");
|
|
39720
39820
|
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
39721
39821
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
39722
39822
|
return;
|
|
@@ -40079,7 +40179,7 @@ var require_websocket_server = __commonJS2({
|
|
|
40079
40179
|
var EventEmitter = __require2("events");
|
|
40080
40180
|
var http = __require2("http");
|
|
40081
40181
|
var { Duplex } = __require2("stream");
|
|
40082
|
-
var { createHash:
|
|
40182
|
+
var { createHash: createHash6 } = __require2("crypto");
|
|
40083
40183
|
var extension2 = require_extension();
|
|
40084
40184
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
40085
40185
|
var subprotocol2 = require_subprotocol();
|
|
@@ -40386,7 +40486,7 @@ var require_websocket_server = __commonJS2({
|
|
|
40386
40486
|
);
|
|
40387
40487
|
}
|
|
40388
40488
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
40389
|
-
const digest =
|
|
40489
|
+
const digest = createHash6("sha1").update(key + GUID).digest("base64");
|
|
40390
40490
|
const headers = [
|
|
40391
40491
|
"HTTP/1.1 101 Switching Protocols",
|
|
40392
40492
|
"Upgrade: websocket",
|
|
@@ -40976,11 +41076,11 @@ var PLATFORM_TOKEN_ENDPOINT = {
|
|
|
40976
41076
|
path: "/cli/platform-token",
|
|
40977
41077
|
rejectedHint: "the platform key is unknown, revoked, or its owner is no longer an admin. Issue a new one in the web app under Admin \u2192 Platform keys and run 'ente auth platform login'."
|
|
40978
41078
|
};
|
|
40979
|
-
async function exchangeToken(siteUrl, apiKey, endpoint = AGENT_TOKEN_ENDPOINT) {
|
|
41079
|
+
async function exchangeToken(siteUrl, apiKey, endpoint = AGENT_TOKEN_ENDPOINT, headers = {}) {
|
|
40980
41080
|
const url2 = `${siteUrl.replace(/\/+$/, "")}${endpoint.path}`;
|
|
40981
41081
|
let resp;
|
|
40982
41082
|
try {
|
|
40983
|
-
resp = await fetch(url2, { method: "POST", headers: { Authorization: `Bearer ${apiKey}` } });
|
|
41083
|
+
resp = await fetch(url2, { method: "POST", headers: { ...headers, Authorization: `Bearer ${apiKey}` } });
|
|
40984
41084
|
} catch (err) {
|
|
40985
41085
|
const msg = err instanceof Error ? err.message : String(err);
|
|
40986
41086
|
throw new Error(`Could not reach ${url2}: ${msg}`);
|
|
@@ -40988,6 +41088,7 @@ async function exchangeToken(siteUrl, apiKey, endpoint = AGENT_TOKEN_ENDPOINT) {
|
|
|
40988
41088
|
if (resp.status === 401) {
|
|
40989
41089
|
throw new Error(`Key rejected (401) at ${endpoint.path} \u2014 ${endpoint.rejectedHint}`);
|
|
40990
41090
|
}
|
|
41091
|
+
if (resp.status === 426) throw await upgradeRequiredFromResponse(resp, endpoint.path);
|
|
40991
41092
|
if (!resp.ok) {
|
|
40992
41093
|
throw new Error(`${endpoint.path} exchange failed (${resp.status} ${resp.statusText}).`);
|
|
40993
41094
|
}
|
|
@@ -41023,7 +41124,7 @@ function isWriteConflict(err) {
|
|
|
41023
41124
|
var MAX_CONFLICT_ATTEMPTS = 6;
|
|
41024
41125
|
var DEFAULT_CONFLICT_BACKOFF_MS = 250;
|
|
41025
41126
|
async function mintAndCache(opts) {
|
|
41026
|
-
const { jwt: jwt2, expiresAt } = await exchangeToken(opts.siteUrl, opts.apiKey, opts.tokenEndpoint);
|
|
41127
|
+
const { jwt: jwt2, expiresAt } = await exchangeToken(opts.siteUrl, opts.apiKey, opts.tokenEndpoint, opts.requestHeaders);
|
|
41027
41128
|
storeJwt(opts.cacheDir, opts.cacheKey, jwt2, expiresAt);
|
|
41028
41129
|
return { jwt: jwt2, expiresAt };
|
|
41029
41130
|
}
|
|
@@ -41123,7 +41224,8 @@ async function resolveCaller() {
|
|
|
41123
41224
|
siteUrl,
|
|
41124
41225
|
apiKey: creds.apiKey,
|
|
41125
41226
|
cacheDir: configDir(ENTE_BRANDING),
|
|
41126
|
-
cacheKey: credentialCacheKey(creds.apiUrl, creds.apiKey)
|
|
41227
|
+
cacheKey: credentialCacheKey(creds.apiUrl, creds.apiKey),
|
|
41228
|
+
requestHeaders: CLI_REQUEST_HEADERS
|
|
41127
41229
|
});
|
|
41128
41230
|
}
|
|
41129
41231
|
function loadPlatformCredentials() {
|
|
@@ -41157,6 +41259,7 @@ async function resolveAdminCaller(allowAgentReads = false) {
|
|
|
41157
41259
|
apiKey: creds.apiKey,
|
|
41158
41260
|
cacheDir: configDir(PLATFORM_CREDENTIAL),
|
|
41159
41261
|
cacheKey: credentialCacheKey(creds.apiUrl, creds.apiKey),
|
|
41262
|
+
requestHeaders: CLI_REQUEST_HEADERS,
|
|
41160
41263
|
tokenEndpoint: PLATFORM_TOKEN_ENDPOINT
|
|
41161
41264
|
});
|
|
41162
41265
|
}
|
|
@@ -41262,7 +41365,7 @@ async function postJson(url2, body) {
|
|
|
41262
41365
|
}
|
|
41263
41366
|
async function verifyCredential(url2, key) {
|
|
41264
41367
|
return await fetch(`${url2}/api/external/auth-context`, {
|
|
41265
|
-
headers: { Authorization: `Bearer ${key}` },
|
|
41368
|
+
headers: { ...CLI_REQUEST_HEADERS, Authorization: `Bearer ${key}` },
|
|
41266
41369
|
signal: AbortSignal.timeout(15e3)
|
|
41267
41370
|
});
|
|
41268
41371
|
}
|
|
@@ -41354,6 +41457,7 @@ var AuthPair = class extends BaseCommand {
|
|
|
41354
41457
|
}
|
|
41355
41458
|
for (const item of pending) {
|
|
41356
41459
|
const response = await verifyCredential(cleanUrl, item.key);
|
|
41460
|
+
if (response.status === 426) throw await upgradeRequiredFromResponse(response, "/api/external/auth-context");
|
|
41357
41461
|
if (!response.ok) {
|
|
41358
41462
|
throw new Error(`Profile '${item.spec.profile}' saved but verification failed (${response.status})`);
|
|
41359
41463
|
}
|
|
@@ -41376,7 +41480,7 @@ function readCredentialsForCleanup(profile, reader = readStoredCredentials, bran
|
|
|
41376
41480
|
}
|
|
41377
41481
|
}
|
|
41378
41482
|
async function validateExternalCredential(cleanUrl, key, signal) {
|
|
41379
|
-
const headers = { Authorization: `Bearer ${key}` };
|
|
41483
|
+
const headers = { ...CLI_REQUEST_HEADERS, Authorization: `Bearer ${key}` };
|
|
41380
41484
|
const authContext = await fetch(`${cleanUrl}${AUTH_CONTEXT_PATH}`, { headers, signal });
|
|
41381
41485
|
if (authContext.status !== 404) return authContext;
|
|
41382
41486
|
const legacyUrl = new URL(`${cleanUrl}${LEGACY_AUTH_PROBE_PATH}`);
|
|
@@ -41426,6 +41530,7 @@ var AuthLogin = class extends BaseCommand {
|
|
|
41426
41530
|
} finally {
|
|
41427
41531
|
clearTimeout(timer);
|
|
41428
41532
|
}
|
|
41533
|
+
if (resp.status === 426) throw await upgradeRequiredFromResponse(resp, AUTH_CONTEXT_PATH);
|
|
41429
41534
|
if (resp.status >= 400) {
|
|
41430
41535
|
throw new Error(`Authentication failed: ${resp.status} ${resp.statusText}`);
|
|
41431
41536
|
}
|
|
@@ -41555,7 +41660,7 @@ var AuthPlatformLogin = class extends BaseCommand {
|
|
|
41555
41660
|
throw new Error("Platform keys start with 'entp_'. Agent keys ('ente_\u2026') belong in 'ente auth login'.");
|
|
41556
41661
|
}
|
|
41557
41662
|
const cleanUrl = this.url.replace(/\/+$/, "");
|
|
41558
|
-
await exchangeToken(resolveConvexEndpoints(cleanUrl).siteUrl, key, PLATFORM_TOKEN_ENDPOINT);
|
|
41663
|
+
await exchangeToken(resolveConvexEndpoints(cleanUrl).siteUrl, key, PLATFORM_TOKEN_ENDPOINT, CLI_REQUEST_HEADERS);
|
|
41559
41664
|
const previous = readCredentialsForCleanup(void 0, readStoredCredentials, PLATFORM_CREDENTIAL);
|
|
41560
41665
|
if (previous) deleteJwt(configDir(PLATFORM_CREDENTIAL), credentialCacheKey(previous.apiUrl, previous.apiKey));
|
|
41561
41666
|
saveCredentials(PLATFORM_CREDENTIAL, cleanUrl, key);
|
|
@@ -42851,6 +42956,27 @@ function requireEntitySelector(operation, value, field) {
|
|
|
42851
42956
|
if (!value.trim()) throw new OperationInputError(operation, [{ path: [field], reason: "too_small" }]);
|
|
42852
42957
|
}
|
|
42853
42958
|
|
|
42959
|
+
// ente/activity-fields.ts
|
|
42960
|
+
function parseActivityFields(flags) {
|
|
42961
|
+
if (flags === void 0) return void 0;
|
|
42962
|
+
const inputs = flags.map((flag, index) => {
|
|
42963
|
+
try {
|
|
42964
|
+
return JSON.parse(flag);
|
|
42965
|
+
} catch {
|
|
42966
|
+
throw new OperationInputError("activityFields", [{ path: ["fields", String(index)], reason: "invalid_type" }]);
|
|
42967
|
+
}
|
|
42968
|
+
});
|
|
42969
|
+
return parseOperationInput("activityFields", activityFieldInputsSchema, inputs);
|
|
42970
|
+
}
|
|
42971
|
+
var created = external_exports.strictObject({ data: activityWriteResults.createActivity });
|
|
42972
|
+
var updated = external_exports.strictObject({ data: activityWriteResults.updateActivity });
|
|
42973
|
+
function fieldCreateReceipt(raw) {
|
|
42974
|
+
return parseZodOperationResult("createActivity", created, raw, "Invalid activity create receipt").data.activityId;
|
|
42975
|
+
}
|
|
42976
|
+
function fieldUpdateReceipt(raw) {
|
|
42977
|
+
return parseZodOperationResult("updateActivity", updated, raw, "Invalid activity update receipt").data;
|
|
42978
|
+
}
|
|
42979
|
+
|
|
42854
42980
|
// ../packages/shared/src/cli-protocol-dtos.ts
|
|
42855
42981
|
var agentIdentity = v.object({ agentId: v.id("agents"), icon: v.optional(v.string()), name: v.string(), color: v.string(), archived: v.boolean() });
|
|
42856
42982
|
var activityRevisionSummaryValidator = v.object({
|
|
@@ -42949,21 +43075,6 @@ function transcriptResult(raw, recordingId) {
|
|
|
42949
43075
|
return result;
|
|
42950
43076
|
}
|
|
42951
43077
|
|
|
42952
|
-
// ../packages/shared/src/activity-content-operation-results.ts
|
|
42953
|
-
var integer2 = external_exports.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
42954
|
-
var activityContentBlock = external_exports.strictObject({ target: external_exports.string().min(1), blockType: external_exports.string(), format: external_exports.enum(["markdown", "plain_text"]), content: external_exports.string(), start: integer2, end: integer2, totalCharacters: integer2, canReplaceText: external_exports.boolean() }).refine((value) => value.start <= value.end && value.end <= value.totalCharacters && value.end - value.start === value.content.length, "Invalid UTF16 content range");
|
|
42955
|
-
var activityContentResults = {
|
|
42956
|
-
readActivityContent: external_exports.strictObject({ activityId: external_exports.string().min(1), contentVersion: activityContentVersion, blocks: external_exports.array(activityContentBlock).max(ACTIVITY_CONTENT_LIMITS.maxBlocks), nextCursor: external_exports.string().optional() }).refine((value) => value.blocks.reduce((sum, block) => sum + block.content.length, 0) <= ACTIVITY_CONTENT_LIMITS.maxCharacters + 1 && (value.nextCursor === void 0 || decodeActivityContentCursor(value.nextCursor)?.version === value.contentVersion), "Invalid bounded content window"),
|
|
42957
|
-
editActivityContent: external_exports.strictObject({ activityId: external_exports.string().min(1), contentVersion: activityContentVersion, changed: external_exports.boolean() })
|
|
42958
|
-
};
|
|
42959
|
-
function parseActivityContentResult(name4, raw) {
|
|
42960
|
-
return parseZodOperationResult(name4, activityContentResults[name4], raw, "Invalid activity content result");
|
|
42961
|
-
}
|
|
42962
|
-
|
|
42963
|
-
// ente/commands/activity.ts
|
|
42964
|
-
import { readFileSync as readFileSync9 } from "node:fs";
|
|
42965
|
-
import { basename as basename2 } from "node:path";
|
|
42966
|
-
|
|
42967
43078
|
// ente/activityType.ts
|
|
42968
43079
|
function parseActivityType(value) {
|
|
42969
43080
|
const type = ACTIVITY_TYPE_VALUES.find((type2) => type2 === value);
|
|
@@ -43075,6 +43186,49 @@ function deadlineChange(deadline, clear) {
|
|
|
43075
43186
|
return null;
|
|
43076
43187
|
}
|
|
43077
43188
|
|
|
43189
|
+
// ente/source-created-at.ts
|
|
43190
|
+
var DATE_ONLY = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
43191
|
+
var DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/;
|
|
43192
|
+
function valid(year, month, day, hour = 0, minute = 0) {
|
|
43193
|
+
if (month < 1 || month > 12 || day < 1 || day > 31 || hour > 23 || minute > 59) return false;
|
|
43194
|
+
const d = new Date(Date.UTC(year, month - 1, day));
|
|
43195
|
+
return d.getUTCFullYear() === year && d.getUTCMonth() + 1 === month && d.getUTCDate() === day;
|
|
43196
|
+
}
|
|
43197
|
+
function parseSourceCreatedAt(value, timezone = "Europe/Berlin") {
|
|
43198
|
+
const dt = DATE_TIME.exec(value);
|
|
43199
|
+
if (dt) {
|
|
43200
|
+
const [year, month, day, hour, minute] = dt.slice(1).map(Number);
|
|
43201
|
+
if (!valid(year, month, day, hour, minute)) throw new Error(`Invalid --source-created-at value: ${value}`);
|
|
43202
|
+
return {
|
|
43203
|
+
date: `${dt[1]}-${dt[2]}-${dt[3]}`,
|
|
43204
|
+
time: `${dt[4]}:${dt[5]}`,
|
|
43205
|
+
timezone
|
|
43206
|
+
};
|
|
43207
|
+
}
|
|
43208
|
+
const d = DATE_ONLY.exec(value);
|
|
43209
|
+
if (d) {
|
|
43210
|
+
const [year, month, day] = d.slice(1).map(Number);
|
|
43211
|
+
if (!valid(year, month, day)) throw new Error(`Invalid --source-created-at value: ${value}`);
|
|
43212
|
+
return { date: `${d[1]}-${d[2]}-${d[3]}`, time: null, timezone };
|
|
43213
|
+
}
|
|
43214
|
+
throw new Error("--source-created-at must be YYYY-MM-DD or YYYY-MM-DDTHH:mm");
|
|
43215
|
+
}
|
|
43216
|
+
|
|
43217
|
+
// ../packages/shared/src/activity-content-operation-results.ts
|
|
43218
|
+
var integer2 = external_exports.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
43219
|
+
var activityContentBlock = external_exports.strictObject({ target: external_exports.string().min(1), blockType: external_exports.string(), format: external_exports.enum(["markdown", "plain_text"]), content: external_exports.string(), start: integer2, end: integer2, totalCharacters: integer2, canReplaceText: external_exports.boolean() }).refine((value) => value.start <= value.end && value.end <= value.totalCharacters && value.end - value.start === value.content.length, "Invalid UTF16 content range");
|
|
43220
|
+
var activityContentResults = {
|
|
43221
|
+
readActivityContent: external_exports.strictObject({ activityId: external_exports.string().min(1), contentVersion: activityContentVersion, blocks: external_exports.array(activityContentBlock).max(ACTIVITY_CONTENT_LIMITS.maxBlocks), nextCursor: external_exports.string().optional() }).refine((value) => value.blocks.reduce((sum, block) => sum + block.content.length, 0) <= ACTIVITY_CONTENT_LIMITS.maxCharacters + 1 && (value.nextCursor === void 0 || decodeActivityContentCursor(value.nextCursor)?.version === value.contentVersion), "Invalid bounded content window"),
|
|
43222
|
+
editActivityContent: external_exports.strictObject({ activityId: external_exports.string().min(1), contentVersion: activityContentVersion, changed: external_exports.boolean() })
|
|
43223
|
+
};
|
|
43224
|
+
function parseActivityContentResult(name4, raw) {
|
|
43225
|
+
return parseZodOperationResult(name4, activityContentResults[name4], raw, "Invalid activity content result");
|
|
43226
|
+
}
|
|
43227
|
+
|
|
43228
|
+
// ente/commands/activityContent.ts
|
|
43229
|
+
import { readFileSync as readFileSync9 } from "node:fs";
|
|
43230
|
+
import { basename as basename2 } from "node:path";
|
|
43231
|
+
|
|
43078
43232
|
// ente/fileAttachments.ts
|
|
43079
43233
|
import { readFileSync as readFileSync8 } from "node:fs";
|
|
43080
43234
|
import { basename, extname } from "node:path";
|
|
@@ -43139,26 +43293,26 @@ function parseInlineImageSpecs(specs, options) {
|
|
|
43139
43293
|
return { contentId, path: spec.slice(separator + 1) };
|
|
43140
43294
|
});
|
|
43141
43295
|
}
|
|
43142
|
-
function readOutgoingEmailAttachment(
|
|
43296
|
+
function readOutgoingEmailAttachment(path11, options) {
|
|
43143
43297
|
let bytes2;
|
|
43144
43298
|
try {
|
|
43145
|
-
bytes2 = readFileSync8(
|
|
43299
|
+
bytes2 = readFileSync8(path11);
|
|
43146
43300
|
} catch (error62) {
|
|
43147
43301
|
const detail = error62 instanceof Error ? error62.message : String(error62);
|
|
43148
|
-
throw new Error(`${options.commandLabel}: could not read attachment '${
|
|
43302
|
+
throw new Error(`${options.commandLabel}: could not read attachment '${path11}': ${detail}`);
|
|
43149
43303
|
}
|
|
43150
43304
|
if (bytes2.byteLength > options.maxBytes) {
|
|
43151
43305
|
throw new Error(
|
|
43152
|
-
`${options.commandLabel}: attachment '${
|
|
43306
|
+
`${options.commandLabel}: attachment '${path11}' must be ${options.maxBytes} bytes or smaller.`
|
|
43153
43307
|
);
|
|
43154
43308
|
}
|
|
43155
43309
|
const detectedImageMimeType = detectImageMimeType(bytes2);
|
|
43156
43310
|
if (options.requireImage && !detectedImageMimeType) {
|
|
43157
43311
|
throw new Error(
|
|
43158
|
-
`${options.commandLabel}: image '${
|
|
43312
|
+
`${options.commandLabel}: image '${path11}' must be PNG, JPEG, GIF, or WebP.`
|
|
43159
43313
|
);
|
|
43160
43314
|
}
|
|
43161
|
-
const filename = basename(
|
|
43315
|
+
const filename = basename(path11);
|
|
43162
43316
|
if (!filename || filename.length > options.maxFilenameLength) {
|
|
43163
43317
|
throw new Error(
|
|
43164
43318
|
`${options.commandLabel}: attachment filename must be 1-${options.maxFilenameLength} characters.`
|
|
@@ -43175,41 +43329,14 @@ function readOutgoingEmailAttachment(path9, options) {
|
|
|
43175
43329
|
}
|
|
43176
43330
|
return {
|
|
43177
43331
|
filename,
|
|
43178
|
-
mimeType: detectedImageMimeType ?? mimeTypeForPath(
|
|
43332
|
+
mimeType: detectedImageMimeType ?? mimeTypeForPath(path11),
|
|
43179
43333
|
data: bytes2.toString("base64"),
|
|
43180
43334
|
...options.contentId ? { contentId: options.contentId } : {}
|
|
43181
43335
|
};
|
|
43182
43336
|
}
|
|
43183
43337
|
|
|
43184
|
-
// ente/
|
|
43185
|
-
|
|
43186
|
-
var DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/;
|
|
43187
|
-
function valid(year, month, day, hour = 0, minute = 0) {
|
|
43188
|
-
if (month < 1 || month > 12 || day < 1 || day > 31 || hour > 23 || minute > 59) return false;
|
|
43189
|
-
const d = new Date(Date.UTC(year, month - 1, day));
|
|
43190
|
-
return d.getUTCFullYear() === year && d.getUTCMonth() + 1 === month && d.getUTCDate() === day;
|
|
43191
|
-
}
|
|
43192
|
-
function parseSourceCreatedAt(value, timezone = "Europe/Berlin") {
|
|
43193
|
-
const dt = DATE_TIME.exec(value);
|
|
43194
|
-
if (dt) {
|
|
43195
|
-
const [year, month, day, hour, minute] = dt.slice(1).map(Number);
|
|
43196
|
-
if (!valid(year, month, day, hour, minute)) throw new Error(`Invalid --source-created-at value: ${value}`);
|
|
43197
|
-
return {
|
|
43198
|
-
date: `${dt[1]}-${dt[2]}-${dt[3]}`,
|
|
43199
|
-
time: `${dt[4]}:${dt[5]}`,
|
|
43200
|
-
timezone
|
|
43201
|
-
};
|
|
43202
|
-
}
|
|
43203
|
-
const d = DATE_ONLY.exec(value);
|
|
43204
|
-
if (d) {
|
|
43205
|
-
const [year, month, day] = d.slice(1).map(Number);
|
|
43206
|
-
if (!valid(year, month, day)) throw new Error(`Invalid --source-created-at value: ${value}`);
|
|
43207
|
-
return { date: `${d[1]}-${d[2]}-${d[3]}`, time: null, timezone };
|
|
43208
|
-
}
|
|
43209
|
-
throw new Error("--source-created-at must be YYYY-MM-DD or YYYY-MM-DDTHH:mm");
|
|
43210
|
-
}
|
|
43211
|
-
|
|
43212
|
-
// ente/commands/activity.ts
|
|
43338
|
+
// ente/commands/activityShared.ts
|
|
43339
|
+
init_server();
|
|
43213
43340
|
var MAX_ACTIVITY_ATTACHMENT_BYTES = 20 * 1024 * 1024;
|
|
43214
43341
|
var activitiesCreate = makeFunctionReference2("activities:create");
|
|
43215
43342
|
var activitiesGetByIdRich = makeFunctionReference2("activities:getByIdRich");
|
|
@@ -43243,296 +43370,8 @@ function formatRevisionLine(rev) {
|
|
|
43243
43370
|
const thread2 = rev.agentThreadId ? ` thread:${rev.agentThreadId}` : "";
|
|
43244
43371
|
return `${formatRevisionTimestamp(rev.createdAt)} [${rev.source}] ${who}${label}${thread2} ${rev._id}`;
|
|
43245
43372
|
}
|
|
43246
|
-
var ActivityList = class extends ClientCommand {
|
|
43247
|
-
static paths = [["activity", "list"]];
|
|
43248
|
-
static usage = Command.Usage({ category: "Activity", description: "List activities" });
|
|
43249
|
-
entity = options_exports.String("--entity", { description: "Filter by entity (name or ID)" });
|
|
43250
|
-
compact = options_exports.Boolean("--compact", false, { description: "Entity-scoped compact page; preserves spaces and continuation. Read full detail with activity get." });
|
|
43251
|
-
cursor = options_exports.String("--cursor", { description: "Opaque nextCursor from the previous entity-scoped page; keep the same entity and filters" });
|
|
43252
|
-
minCount = options_exports.String("--min-count", { description: "Minimum entity history entries, even outside the time window (default 5). Use 0 for a strict window." });
|
|
43253
|
-
type = options_exports.String("--type", { description: "Filter by type (task, call, note, message, conversation, meeting)" });
|
|
43254
|
-
attr = options_exports.Array("--field,--attr", { description: "Indexed label=value filter; --attr is a compatibility alias" });
|
|
43255
|
-
space = options_exports.String("--space", { description: "Narrow indexed field lookup to a space (name or ID)" });
|
|
43256
|
-
onlyOpen = options_exports.Boolean("--only-open", false, { description: "Only show non-completed activities" });
|
|
43257
|
-
hours = options_exports.String("--hours", { description: "Only from the last N hours" });
|
|
43258
|
-
limit = options_exports.String("--limit", { description: "Max results" });
|
|
43259
|
-
sort = options_exports.String("--sort", { description: "Sort by: deadline, created" });
|
|
43260
|
-
before = options_exports.String("--before", { description: "Only activities before this timestamp (ms)" });
|
|
43261
|
-
after = options_exports.String("--after", { description: "Only activities after this timestamp (ms)" });
|
|
43262
|
-
archived = options_exports.Boolean("--archived", false, {
|
|
43263
|
-
description: "Show archived (trashed) activities instead of active ones"
|
|
43264
|
-
});
|
|
43265
|
-
async run() {
|
|
43266
|
-
if (this.archived && !this.attr?.length) {
|
|
43267
|
-
if (this.space) throw new Error("--space requires an indexed --field filter");
|
|
43268
|
-
if (this.compact || this.cursor !== void 0 || this.minCount !== void 0) throw new Error("--compact/--cursor/--min-count require an active entity-scoped activity list.");
|
|
43269
|
-
parseActivityReadRequest("listActivities", { archived: true, limit: this.limit === void 0 ? void 0 : parseOperationNumberParameter("listActivities", "limit", this.limit) });
|
|
43270
|
-
const client = this.client();
|
|
43271
|
-
const params = { archived: "true" };
|
|
43272
|
-
if (this.limit) params.limit = this.limit;
|
|
43273
|
-
const res = await client.listActivities(params);
|
|
43274
|
-
const spaces = await client.listSpaces();
|
|
43275
|
-
this.emitText(
|
|
43276
|
-
jsonWithSpaces(res, spaces),
|
|
43277
|
-
() => this.withFooter(formatActivityList(res.data ?? []), spaces)
|
|
43278
|
-
);
|
|
43279
|
-
return;
|
|
43280
|
-
}
|
|
43281
|
-
await this.runActivityList({
|
|
43282
|
-
archived: this.archived,
|
|
43283
|
-
compact: this.compact,
|
|
43284
|
-
cursor: this.cursor,
|
|
43285
|
-
minCount: this.minCount !== void 0 ? parseOperationNumberParameter("listRecentActivities", "minCount", this.minCount) : void 0,
|
|
43286
|
-
entity: this.entity,
|
|
43287
|
-
typeFilter: this.type,
|
|
43288
|
-
attrFilter: this.attr,
|
|
43289
|
-
space: this.space,
|
|
43290
|
-
onlyOpen: this.onlyOpen,
|
|
43291
|
-
hours: this.hours !== void 0 ? parseOperationNumberParameter("listRecentActivities", "hoursBack", this.hours) : void 0,
|
|
43292
|
-
limit: this.limit !== void 0 ? parseOperationNumberParameter(this.entity ? "listRecentActivities" : "listActivities", "limit", this.limit) : void 0,
|
|
43293
|
-
sort: this.sort,
|
|
43294
|
-
before: this.before !== void 0 ? parseOperationNumberParameter("listActivities", "before", this.before) : void 0,
|
|
43295
|
-
after: this.after !== void 0 ? parseOperationNumberParameter("listActivities", "after", this.after) : void 0
|
|
43296
|
-
});
|
|
43297
|
-
}
|
|
43298
|
-
};
|
|
43299
|
-
var ActivityCreate = class extends ProfileCommand {
|
|
43300
|
-
static paths = [["activity", "create"]];
|
|
43301
|
-
static usage = Command.Usage({ category: "Activity", description: "Create an activity" });
|
|
43302
|
-
type = options_exports.String("--type", { required: true, description: "Activity type (note, conversation, meeting, call, message, task)" });
|
|
43303
|
-
title = options_exports.String("--title", { required: true, description: "Activity title" });
|
|
43304
|
-
entity = options_exports.Array("--entity", { required: true, description: "Linked entities (resolved by name)" });
|
|
43305
|
-
space = options_exports.String("--space", { required: true, description: "Space to create in (name or ID)" });
|
|
43306
|
-
content = options_exports.String("--content", { description: "Activity content" });
|
|
43307
|
-
contentFile = options_exports.String("--content-file", { description: "Read content from a markdown/text file" });
|
|
43308
|
-
sourceCreatedAt = options_exports.String("--source-created-at", {
|
|
43309
|
-
description: "Import/backfill timestamp: YYYY-MM-DD or YYYY-MM-DDTHH:mm"
|
|
43310
|
-
});
|
|
43311
|
-
sourceCreatedAtTimezone = options_exports.String("--source-created-at-timezone", "Europe/Berlin", {
|
|
43312
|
-
description: "IANA timezone for --source-created-at"
|
|
43313
|
-
});
|
|
43314
|
-
tag = options_exports.Array("--tag", { description: "Tags (repeatable)" });
|
|
43315
|
-
agentAssignee = options_exports.Array("--agent-assignee", { description: "Agent ID to assign to this task (repeatable; requires write access)" });
|
|
43316
|
-
autoLink = options_exports.Boolean("--auto-link", false, { description: "Auto-link entities not in target space" });
|
|
43317
|
-
entitySpaceGrantFingerprint = options_exports.String("--entity-space-grant-fingerprint", {
|
|
43318
|
-
description: "Exact grant fingerprint returned by the confirmation-required error"
|
|
43319
|
-
});
|
|
43320
|
-
async run() {
|
|
43321
|
-
const content = graphConvert("content", () => readContentOption(this.content, this.contentFile));
|
|
43322
|
-
const sourceCreatedAt = this.sourceCreatedAt === void 0 ? void 0 : graphConvert("sourceCreatedAt", () => parseSourceCreatedAt(this.sourceCreatedAt, this.sourceCreatedAtTimezone));
|
|
43323
|
-
const intent = graphInput(graphCreateIntent, {
|
|
43324
|
-
space: this.space,
|
|
43325
|
-
entities: this.entity,
|
|
43326
|
-
type: graphConvert("type", () => parseActivityType(this.type)),
|
|
43327
|
-
title: this.title,
|
|
43328
|
-
content,
|
|
43329
|
-
tags: this.tag,
|
|
43330
|
-
agentAssigneeIds: this.agentAssignee,
|
|
43331
|
-
sourceCreatedAt,
|
|
43332
|
-
autoLinkPersonalSpace: this.autoLink,
|
|
43333
|
-
entitySpaceGrantFingerprint: this.entitySpaceGrantFingerprint
|
|
43334
|
-
});
|
|
43335
|
-
const progress = graphProgress(this, "activity.create", ["create", ...sourceCreatedAt ? ["sourceCreatedAt"] : []]);
|
|
43336
|
-
return progress.run(async () => {
|
|
43337
|
-
const caller = await resolveCaller();
|
|
43338
|
-
const entityIds = await resolveEntitiesC(caller, intent.entities);
|
|
43339
|
-
const spaceId2 = await resolveSpaceByNameC(caller, intent.space);
|
|
43340
|
-
parseActivityWriteRequest("createActivity", { ...Object.fromEntries(Object.entries(intent).filter(([key]) => !["space", "entities", "entitySpaceGrantFingerprint"].includes(key))), spaceId: spaceId2, entityIds });
|
|
43341
|
-
const activityId2 = await progress.write("create", () => caller.mutation(activitiesCreate, {
|
|
43342
|
-
entityId: entityIds[0],
|
|
43343
|
-
additionalEntities: entityIds.slice(1),
|
|
43344
|
-
ownerSpaceId: spaceId2,
|
|
43345
|
-
grantMissingEntityAccess: this.autoLink,
|
|
43346
|
-
...this.entitySpaceGrantFingerprint !== void 0 ? { entitySpaceGrantFingerprint: this.entitySpaceGrantFingerprint } : {},
|
|
43347
|
-
type: intent.type,
|
|
43348
|
-
title: intent.title,
|
|
43349
|
-
...intent.agentAssigneeIds?.length ? { agentAssigneeIds: intent.agentAssigneeIds } : {},
|
|
43350
|
-
...content !== void 0 ? { contentMarkdown: content } : {},
|
|
43351
|
-
...intent.tags?.length ? { tags: intent.tags } : {}
|
|
43352
|
-
}), (raw) => graphResult(graphId2, raw), "activityId");
|
|
43353
|
-
if (sourceCreatedAt) await progress.write("sourceCreatedAt", () => caller.mutation(activitiesUpdateCreatedAt, { activityId: activityId2, sourceCreatedAt }), graphAck);
|
|
43354
|
-
const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
|
|
43355
|
-
await progress.observe("output", async () => this.emitText(graphEnvelope(graphCreated, { activityId: activityId2 }, spaces), () => withFooter(`Created ${this.type} '${this.title}' (${activityId2})`, spaces)));
|
|
43356
|
-
});
|
|
43357
|
-
}
|
|
43358
|
-
};
|
|
43359
|
-
var ActivitySearch = class extends ClientCommand {
|
|
43360
|
-
static paths = [["activity", "search"]];
|
|
43361
|
-
static usage = Command.Usage({ category: "Activity", description: "Search activities by title or content" });
|
|
43362
|
-
query = options_exports.String();
|
|
43363
|
-
entity = options_exports.String("--entity", { description: "Filter by entity and bounded direct-child hierarchy (name or ID)" });
|
|
43364
|
-
type = options_exports.String("--type", { description: "Filter by activity type" });
|
|
43365
|
-
limit = options_exports.String("--limit", { description: "Max results" });
|
|
43366
|
-
projection = options_exports.String("--projection", { description: "compact or full public fields" });
|
|
43367
|
-
async run() {
|
|
43368
|
-
const request = parseActivityReadRequest("searchActivities", {
|
|
43369
|
-
query: this.query,
|
|
43370
|
-
type: this.type,
|
|
43371
|
-
limit: this.limit === void 0 ? void 0 : parseOperationNumberParameter("searchActivities", "limit", this.limit),
|
|
43372
|
-
projection: this.projection
|
|
43373
|
-
});
|
|
43374
|
-
if (this.entity !== void 0 && !this.entity.trim()) throw new OperationInputError("searchActivities", [{ path: ["entityId"], reason: "too_small" }]);
|
|
43375
|
-
const client = this.client();
|
|
43376
|
-
const entityId2 = this.entity === void 0 ? void 0 : await resolveEntity(client, this.entity);
|
|
43377
|
-
const { data } = await client.activityRead("searchActivities", { ...request.input, entityId: entityId2 });
|
|
43378
|
-
const spaces = await client.listSpaces();
|
|
43379
|
-
this.emitText(jsonWithSpaces({ data }, spaces), () => this.withFooter(formatActivityList(data.activities), spaces));
|
|
43380
|
-
}
|
|
43381
|
-
};
|
|
43382
|
-
var ActivityGet = class extends ClientCommand {
|
|
43383
|
-
static paths = [["activity", "get"]];
|
|
43384
|
-
static usage = Command.Usage({ category: "Activity", description: "Get a single activity by ID" });
|
|
43385
|
-
id = options_exports.String();
|
|
43386
|
-
projection = options_exports.String("--projection", { description: "compact or full public fields" });
|
|
43387
|
-
async run() {
|
|
43388
|
-
const request = parseActivityReadRequest("getActivity", { activityId: this.id, projection: this.projection });
|
|
43389
|
-
const client = this.client();
|
|
43390
|
-
const { data } = await client.activityRead("getActivity", request.input);
|
|
43391
|
-
if (!data || data.projection === "tombstone") {
|
|
43392
|
-
this.emitText({ data: null }, () => "Activity not found or not accessible");
|
|
43393
|
-
return;
|
|
43394
|
-
}
|
|
43395
|
-
if ("attachments" in data) for (const attachment4 of data.attachments ?? []) attachmentResult(attachment4);
|
|
43396
|
-
const spaces = await client.listSpaces();
|
|
43397
|
-
this.emitText(jsonWithSpaces({ data }, spaces), () => {
|
|
43398
|
-
const detail = this.withFooter(formatActivityDetail(data), spaces);
|
|
43399
|
-
return (data.revisionCount ?? 0) > 1 ? `${detail}
|
|
43400
43373
|
|
|
43401
|
-
|
|
43402
|
-
});
|
|
43403
|
-
}
|
|
43404
|
-
};
|
|
43405
|
-
var ActivityRevisions = class extends ProfileCommand {
|
|
43406
|
-
static paths = [["activity", "revisions"]];
|
|
43407
|
-
static usage = Command.Usage({
|
|
43408
|
-
category: "Activity",
|
|
43409
|
-
description: "List an activity's version history (newest first)"
|
|
43410
|
-
});
|
|
43411
|
-
id = options_exports.String();
|
|
43412
|
-
async run() {
|
|
43413
|
-
graphInput(graphId2, this.id);
|
|
43414
|
-
const caller = await resolveCaller();
|
|
43415
|
-
const revisions = revisionListResult(await caller.query(activitiesListRevisions, { activityId: this.id }), this.id);
|
|
43416
|
-
this.emitText({ data: revisions }, () => {
|
|
43417
|
-
if (revisions.length === 0) return "No versions recorded yet.";
|
|
43418
|
-
const lines = revisions.map(formatRevisionLine);
|
|
43419
|
-
return [
|
|
43420
|
-
`${revisions.length} version(s) \u2014 newest first:`,
|
|
43421
|
-
...lines,
|
|
43422
|
-
"",
|
|
43423
|
-
`View one: ente activity revision ${this.id} <revisionId>`,
|
|
43424
|
-
`Restore one: ente activity restore-revision ${this.id} <revisionId>`
|
|
43425
|
-
].join("\n");
|
|
43426
|
-
});
|
|
43427
|
-
}
|
|
43428
|
-
};
|
|
43429
|
-
var ActivityRevisionShow = class extends ProfileCommand {
|
|
43430
|
-
static paths = [["activity", "revision"]];
|
|
43431
|
-
static usage = Command.Usage({
|
|
43432
|
-
category: "Activity",
|
|
43433
|
-
description: "Show a single past version of an activity (read-only)"
|
|
43434
|
-
});
|
|
43435
|
-
activityId = options_exports.String();
|
|
43436
|
-
revisionId = options_exports.String();
|
|
43437
|
-
async run() {
|
|
43438
|
-
graphInput(graphId2, this.activityId);
|
|
43439
|
-
graphInput(graphId2, this.revisionId);
|
|
43440
|
-
const caller = await resolveCaller();
|
|
43441
|
-
const rev = revisionResult(await caller.query(activitiesGetRevision, { revisionId: this.revisionId }), this.activityId, this.revisionId);
|
|
43442
|
-
if (!rev) throw new Error(`Revision not found or not accessible: ${this.revisionId}`);
|
|
43443
|
-
if (rev.activityId !== this.activityId) {
|
|
43444
|
-
throw new Error(`Revision ${this.revisionId} does not belong to activity ${this.activityId}.`);
|
|
43445
|
-
}
|
|
43446
|
-
this.emitText(
|
|
43447
|
-
{ data: rev },
|
|
43448
|
-
() => [
|
|
43449
|
-
`Version of activity ${rev.activityId}`,
|
|
43450
|
-
`Captured: ${formatRevisionTimestamp(rev.createdAt)} [${rev.source}] ${rev.authorAgent?.name ?? rev.authorName ?? rev.authorAgentId ?? rev.authorId}`,
|
|
43451
|
-
rev.agentThreadId ? `Agent thread: ${rev.agentThreadId}${rev.agentRunId ? ` run: ${rev.agentRunId}` : ""}` : null,
|
|
43452
|
-
rev.summary ? `Note: ${rev.summary}` : null,
|
|
43453
|
-
"",
|
|
43454
|
-
rev.title ? `# ${rev.title}` : null,
|
|
43455
|
-
rev.contentPlainText && rev.contentPlainText.length ? rev.contentPlainText : "(empty body)"
|
|
43456
|
-
].filter((line) => line !== null).join("\n")
|
|
43457
|
-
);
|
|
43458
|
-
}
|
|
43459
|
-
};
|
|
43460
|
-
var ActivityRestoreRevision = class extends ProfileCommand {
|
|
43461
|
-
static paths = [["activity", "restore-revision"]];
|
|
43462
|
-
static usage = Command.Usage({
|
|
43463
|
-
category: "Activity",
|
|
43464
|
-
description: "Restore an activity's body + title to a past version"
|
|
43465
|
-
});
|
|
43466
|
-
activityId = options_exports.String();
|
|
43467
|
-
revisionId = options_exports.String();
|
|
43468
|
-
async run() {
|
|
43469
|
-
graphInput(graphId2, this.activityId);
|
|
43470
|
-
graphInput(graphId2, this.revisionId);
|
|
43471
|
-
const caller = await resolveCaller();
|
|
43472
|
-
const rev = revisionResult(await caller.query(activitiesGetRevision, { revisionId: this.revisionId }), this.activityId, this.revisionId);
|
|
43473
|
-
if (!rev) throw new Error(`Revision not found or not accessible: ${this.revisionId}`);
|
|
43474
|
-
if (rev.activityId !== this.activityId) {
|
|
43475
|
-
throw new Error(`Revision ${this.revisionId} does not belong to activity ${this.activityId}.`);
|
|
43476
|
-
}
|
|
43477
|
-
const progress = graphProgress(this, "activity.restoreRevision", ["restoreRevision"], { activityId: this.activityId, revisionId: this.revisionId });
|
|
43478
|
-
await progress.run(async () => {
|
|
43479
|
-
const result = await progress.write("restoreRevision", () => caller.mutation(activitiesRestoreRevision, { revisionId: this.revisionId }), (raw) => restoredRevisionResult(raw, this.activityId));
|
|
43480
|
-
const spaces = await progress.observe("spacesFooter", () => spacesFooterFromMemberships(caller));
|
|
43481
|
-
await progress.observe("output", async () => this.emitText(
|
|
43482
|
-
graphEnvelope(external_exports.strictObject({ ok: external_exports.literal(true), activityId: graphId2 }), { ok: true, ...result }, spaces),
|
|
43483
|
-
() => withFooter(`Restored activity ${result.activityId} to the version from ${formatRevisionTimestamp(rev.createdAt)}. A new "restored" version was recorded.`, spaces)
|
|
43484
|
-
));
|
|
43485
|
-
});
|
|
43486
|
-
}
|
|
43487
|
-
};
|
|
43488
|
-
var ActivityUpdate = class extends ProfileCommand {
|
|
43489
|
-
static paths = [["activity", "update"]];
|
|
43490
|
-
static usage = Command.Usage({ category: "Activity", description: "Update an activity" });
|
|
43491
|
-
id = options_exports.String();
|
|
43492
|
-
agentAssignee = options_exports.Array("--agent-assignee", { description: "Replace agent assignees with these IDs (repeatable); preserves human assignees" });
|
|
43493
|
-
clearAgentAssignees = options_exports.Boolean("--clear-agent-assignees", false, { description: "Remove all agent assignees" });
|
|
43494
|
-
content = options_exports.String("--content", { description: "Update content" });
|
|
43495
|
-
contentFile = options_exports.String("--content-file", { description: "Read updated content from a markdown/text file" });
|
|
43496
|
-
title = options_exports.String("--title", { description: "Update title" });
|
|
43497
|
-
deadline = options_exports.String("--deadline", { description: "Update deadline (human-friendly)" });
|
|
43498
|
-
clearDeadline = options_exports.Boolean("--clear-deadline", false, { description: "Remove the deadline" });
|
|
43499
|
-
entityAdd = options_exports.Array("--entity-add", { description: "Link additional entities" });
|
|
43500
|
-
entityRemove = options_exports.Array("--entity-remove", { description: "Unlink entities" });
|
|
43501
|
-
async run() {
|
|
43502
|
-
const content = graphConvert("content", () => readContentOption(this.content, this.contentFile));
|
|
43503
|
-
if (this.clearDeadline && this.deadline !== void 0) throw new Error("Use either --deadline or --clear-deadline, not both.");
|
|
43504
|
-
const deadline = graphConvert("deadline", () => deadlineChange(this.deadline, this.clearDeadline));
|
|
43505
|
-
const addNames = this.entityAdd === void 0 ? [] : graphInput(graphSelectors, this.entityAdd);
|
|
43506
|
-
const removeNames = this.entityRemove === void 0 ? [] : graphInput(graphSelectors, this.entityRemove);
|
|
43507
|
-
const hasEntityChange = addNames.length > 0 || removeNames.length > 0;
|
|
43508
|
-
if (this.clearAgentAssignees && this.agentAssignee?.length) throw new Error("Choose --agent-assignee or --clear-agent-assignees");
|
|
43509
|
-
const agentAssigneeIds = this.clearAgentAssignees ? [] : this.agentAssignee;
|
|
43510
|
-
parseActivityWriteRequest("updateActivity", { activityId: this.id, title: this.title, content, ...deadline ? { deadline: deadline.deadline ?? null } : {}, agentAssigneeIds });
|
|
43511
|
-
if (content === void 0 && this.title === void 0 && deadline === null && !hasEntityChange && agentAssigneeIds === void 0) throw new Error("Nothing to update. Specify content, title, deadline, entity links or agent assignees.");
|
|
43512
|
-
const steps = [...agentAssigneeIds !== void 0 ? ["agentAssignees"] : [], ...this.title !== void 0 ? ["title"] : [], ...deadline ? ["deadline"] : [], ...content !== void 0 ? ["content"] : [], ...hasEntityChange ? ["entities"] : []];
|
|
43513
|
-
const progress = graphProgress(this, "activity.update", steps, { activityId: this.id });
|
|
43514
|
-
return progress.run(async () => {
|
|
43515
|
-
const caller = await resolveCaller();
|
|
43516
|
-
if (agentAssigneeIds !== void 0) await progress.write("agentAssignees", () => caller.mutation(makeFunctionReference2("taskAgents:updateAssignments"), { activityId: this.id, agentAssigneeIds }), graphAck);
|
|
43517
|
-
if (this.title !== void 0) await progress.write("title", () => caller.mutation(activitiesUpdateTitle, { activityId: this.id, title: this.title }), graphAck);
|
|
43518
|
-
if (deadline) await progress.write("deadline", () => caller.mutation(activitiesUpdateDeadline, { activityId: this.id, ...deadline }), graphAck);
|
|
43519
|
-
if (content !== void 0) await progress.write("content", () => caller.mutation(activitiesSetContentFromMarkdown, { activityId: this.id, markdown: content }), graphAck);
|
|
43520
|
-
if (hasEntityChange) await progress.observe("entityResolution", async () => {
|
|
43521
|
-
const rich = graphResult(graphPublicRich.nullable(), await caller.query(activitiesGetByIdRich, { activityId: this.id }));
|
|
43522
|
-
if (!rich) throw new Error("Activity not found or not accessible");
|
|
43523
|
-
const currentIds = rich.entityDetails.flatMap((entity5) => entity5 ? [entity5._id] : []);
|
|
43524
|
-
const addIds = await resolveEntitiesC(caller, addNames);
|
|
43525
|
-
const removeSet = new Set(await resolveEntitiesC(caller, removeNames));
|
|
43526
|
-
const newIds = currentIds.filter((id21) => !removeSet.has(id21));
|
|
43527
|
-
for (const id21 of addIds) if (!currentIds.includes(id21)) newIds.push(id21);
|
|
43528
|
-
parseActivityWriteRequest("updateActivity", { activityId: this.id, entityIds: newIds });
|
|
43529
|
-
await progress.write("entities", () => caller.mutation(activitiesUpdateEntities, { activityId: this.id, entities: newIds }), graphAck);
|
|
43530
|
-
});
|
|
43531
|
-
const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
|
|
43532
|
-
await progress.observe("output", async () => this.emitText(graphEnvelope(graphContextAck, { success: true, activityId: this.id }, spaces), () => withFooter(`Updated activity ${this.id}`, spaces)));
|
|
43533
|
-
});
|
|
43534
|
-
}
|
|
43535
|
-
};
|
|
43374
|
+
// ente/commands/activityContent.ts
|
|
43536
43375
|
var ActivityContentRead = class extends ProfileCommand {
|
|
43537
43376
|
static paths = [["activity", "content", "read"]];
|
|
43538
43377
|
static usage = Command.Usage({
|
|
@@ -43594,39 +43433,6 @@ var ActivityContentEdit = class extends ProfileCommand {
|
|
|
43594
43433
|
});
|
|
43595
43434
|
}
|
|
43596
43435
|
};
|
|
43597
|
-
var ActivityDelete = class extends ProfileCommand {
|
|
43598
|
-
static paths = [["activity", "delete"]];
|
|
43599
|
-
static usage = Command.Usage({
|
|
43600
|
-
category: "Activity",
|
|
43601
|
-
description: "Move an activity to the trash (soft delete). Use `activity restore` to undo."
|
|
43602
|
-
});
|
|
43603
|
-
id = options_exports.String();
|
|
43604
|
-
async run() {
|
|
43605
|
-
parseActivityWriteRequest("deleteActivity", { activityId: this.id });
|
|
43606
|
-
const progress = graphProgress(this, "activity.deleteActivity", ["deleteActivity"], { activityId: this.id });
|
|
43607
|
-
return progress.run(async () => {
|
|
43608
|
-
const caller = await resolveCaller();
|
|
43609
|
-
await progress.write("deleteActivity", () => caller.mutation(activitiesDeleteActivity, { activityId: this.id }), graphAck);
|
|
43610
|
-
const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
|
|
43611
|
-
await progress.observe("output", async () => this.emitText(graphEnvelope(graphContextAck, { success: true, activityId: this.id }, spaces), () => withFooter(`Trashed activity ${this.id}`, spaces)));
|
|
43612
|
-
});
|
|
43613
|
-
}
|
|
43614
|
-
};
|
|
43615
|
-
var ActivityRestore = class extends ProfileCommand {
|
|
43616
|
-
static paths = [["activity", "restore"]];
|
|
43617
|
-
static usage = Command.Usage({ category: "Activity", description: "Restore a trashed activity" });
|
|
43618
|
-
id = options_exports.String();
|
|
43619
|
-
async run() {
|
|
43620
|
-
parseActivityWriteRequest("restoreActivity", { activityId: this.id });
|
|
43621
|
-
const progress = graphProgress(this, "activity.restoreActivity", ["restoreActivity"], { activityId: this.id });
|
|
43622
|
-
return progress.run(async () => {
|
|
43623
|
-
const caller = await resolveCaller();
|
|
43624
|
-
await progress.write("restoreActivity", () => caller.mutation(activitiesRestoreActivity, { activityId: this.id }), graphAck);
|
|
43625
|
-
const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
|
|
43626
|
-
await progress.observe("output", async () => this.emitText(graphEnvelope(graphContextAck, { success: true, activityId: this.id }, spaces), () => withFooter(`Restored activity ${this.id}`, spaces)));
|
|
43627
|
-
});
|
|
43628
|
-
}
|
|
43629
|
-
};
|
|
43630
43436
|
var ActivityAttachmentUpload = class extends ProfileCommand {
|
|
43631
43437
|
static paths = [["activity", "attachment", "upload"]];
|
|
43632
43438
|
static usage = Command.Usage({
|
|
@@ -43703,6 +43509,8 @@ var ActivityMessageAdd = class extends ProfileCommand {
|
|
|
43703
43509
|
});
|
|
43704
43510
|
}
|
|
43705
43511
|
};
|
|
43512
|
+
|
|
43513
|
+
// ente/commands/activityHtml.ts
|
|
43706
43514
|
var ActivityHtmlList = class extends ProfileCommand {
|
|
43707
43515
|
static paths = [["activity", "html", "list"]];
|
|
43708
43516
|
static usage = Command.Usage({ category: "Activity", description: "List interactive HTML blocks in an activity" });
|
|
@@ -43867,6 +43675,351 @@ var ActivityMessageHtmlUpdate = class extends ProfileCommand {
|
|
|
43867
43675
|
));
|
|
43868
43676
|
}
|
|
43869
43677
|
};
|
|
43678
|
+
|
|
43679
|
+
// ente/commands/activityRevisions.ts
|
|
43680
|
+
var ActivityRevisions = class extends ProfileCommand {
|
|
43681
|
+
static paths = [["activity", "revisions"]];
|
|
43682
|
+
static usage = Command.Usage({
|
|
43683
|
+
category: "Activity",
|
|
43684
|
+
description: "List an activity's version history (newest first)"
|
|
43685
|
+
});
|
|
43686
|
+
id = options_exports.String();
|
|
43687
|
+
async run() {
|
|
43688
|
+
graphInput(graphId2, this.id);
|
|
43689
|
+
const caller = await resolveCaller();
|
|
43690
|
+
const revisions = revisionListResult(await caller.query(activitiesListRevisions, { activityId: this.id }), this.id);
|
|
43691
|
+
this.emitText({ data: revisions }, () => {
|
|
43692
|
+
if (revisions.length === 0) return "No versions recorded yet.";
|
|
43693
|
+
const lines = revisions.map(formatRevisionLine);
|
|
43694
|
+
return [
|
|
43695
|
+
`${revisions.length} version(s) \u2014 newest first:`,
|
|
43696
|
+
...lines,
|
|
43697
|
+
"",
|
|
43698
|
+
`View one: ente activity revision ${this.id} <revisionId>`,
|
|
43699
|
+
`Restore one: ente activity restore-revision ${this.id} <revisionId>`
|
|
43700
|
+
].join("\n");
|
|
43701
|
+
});
|
|
43702
|
+
}
|
|
43703
|
+
};
|
|
43704
|
+
var ActivityRevisionShow = class extends ProfileCommand {
|
|
43705
|
+
static paths = [["activity", "revision"]];
|
|
43706
|
+
static usage = Command.Usage({
|
|
43707
|
+
category: "Activity",
|
|
43708
|
+
description: "Show a single past version of an activity (read-only)"
|
|
43709
|
+
});
|
|
43710
|
+
activityId = options_exports.String();
|
|
43711
|
+
revisionId = options_exports.String();
|
|
43712
|
+
async run() {
|
|
43713
|
+
graphInput(graphId2, this.activityId);
|
|
43714
|
+
graphInput(graphId2, this.revisionId);
|
|
43715
|
+
const caller = await resolveCaller();
|
|
43716
|
+
const rev = revisionResult(await caller.query(activitiesGetRevision, { revisionId: this.revisionId }), this.activityId, this.revisionId);
|
|
43717
|
+
if (!rev) throw new Error(`Revision not found or not accessible: ${this.revisionId}`);
|
|
43718
|
+
if (rev.activityId !== this.activityId) {
|
|
43719
|
+
throw new Error(`Revision ${this.revisionId} does not belong to activity ${this.activityId}.`);
|
|
43720
|
+
}
|
|
43721
|
+
this.emitText(
|
|
43722
|
+
{ data: rev },
|
|
43723
|
+
() => [
|
|
43724
|
+
`Version of activity ${rev.activityId}`,
|
|
43725
|
+
`Captured: ${formatRevisionTimestamp(rev.createdAt)} [${rev.source}] ${rev.authorAgent?.name ?? rev.authorName ?? rev.authorAgentId ?? rev.authorId}`,
|
|
43726
|
+
rev.agentThreadId ? `Agent thread: ${rev.agentThreadId}${rev.agentRunId ? ` run: ${rev.agentRunId}` : ""}` : null,
|
|
43727
|
+
rev.summary ? `Note: ${rev.summary}` : null,
|
|
43728
|
+
"",
|
|
43729
|
+
rev.title ? `# ${rev.title}` : null,
|
|
43730
|
+
rev.contentPlainText && rev.contentPlainText.length ? rev.contentPlainText : "(empty body)"
|
|
43731
|
+
].filter((line) => line !== null).join("\n")
|
|
43732
|
+
);
|
|
43733
|
+
}
|
|
43734
|
+
};
|
|
43735
|
+
var ActivityRestoreRevision = class extends ProfileCommand {
|
|
43736
|
+
static paths = [["activity", "restore-revision"]];
|
|
43737
|
+
static usage = Command.Usage({
|
|
43738
|
+
category: "Activity",
|
|
43739
|
+
description: "Restore an activity's body + title to a past version"
|
|
43740
|
+
});
|
|
43741
|
+
activityId = options_exports.String();
|
|
43742
|
+
revisionId = options_exports.String();
|
|
43743
|
+
async run() {
|
|
43744
|
+
graphInput(graphId2, this.activityId);
|
|
43745
|
+
graphInput(graphId2, this.revisionId);
|
|
43746
|
+
const caller = await resolveCaller();
|
|
43747
|
+
const rev = revisionResult(await caller.query(activitiesGetRevision, { revisionId: this.revisionId }), this.activityId, this.revisionId);
|
|
43748
|
+
if (!rev) throw new Error(`Revision not found or not accessible: ${this.revisionId}`);
|
|
43749
|
+
if (rev.activityId !== this.activityId) {
|
|
43750
|
+
throw new Error(`Revision ${this.revisionId} does not belong to activity ${this.activityId}.`);
|
|
43751
|
+
}
|
|
43752
|
+
const progress = graphProgress(this, "activity.restoreRevision", ["restoreRevision"], { activityId: this.activityId, revisionId: this.revisionId });
|
|
43753
|
+
await progress.run(async () => {
|
|
43754
|
+
const result = await progress.write("restoreRevision", () => caller.mutation(activitiesRestoreRevision, { revisionId: this.revisionId }), (raw) => restoredRevisionResult(raw, this.activityId));
|
|
43755
|
+
const spaces = await progress.observe("spacesFooter", () => spacesFooterFromMemberships(caller));
|
|
43756
|
+
await progress.observe("output", async () => this.emitText(
|
|
43757
|
+
graphEnvelope(external_exports.strictObject({ ok: external_exports.literal(true), activityId: graphId2 }), { ok: true, ...result }, spaces),
|
|
43758
|
+
() => withFooter(`Restored activity ${result.activityId} to the version from ${formatRevisionTimestamp(rev.createdAt)}. A new "restored" version was recorded.`, spaces)
|
|
43759
|
+
));
|
|
43760
|
+
});
|
|
43761
|
+
}
|
|
43762
|
+
};
|
|
43763
|
+
|
|
43764
|
+
// ente/commands/activity.ts
|
|
43765
|
+
var ActivityList = class extends ClientCommand {
|
|
43766
|
+
static paths = [["activity", "list"]];
|
|
43767
|
+
static usage = Command.Usage({ category: "Activity", description: "List activities" });
|
|
43768
|
+
entity = options_exports.String("--entity", { description: "Filter by entity (name or ID)" });
|
|
43769
|
+
compact = options_exports.Boolean("--compact", false, { description: "Entity-scoped compact page; preserves spaces and continuation. Read full detail with activity get." });
|
|
43770
|
+
cursor = options_exports.String("--cursor", { description: "Opaque nextCursor from the previous entity-scoped page; keep the same entity and filters" });
|
|
43771
|
+
minCount = options_exports.String("--min-count", { description: "Minimum entity history entries, even outside the time window (default 5). Use 0 for a strict window." });
|
|
43772
|
+
type = options_exports.String("--type", { description: "Filter by type (task, call, note, message, conversation, meeting)" });
|
|
43773
|
+
attr = options_exports.Array("--field,--attr", { description: "Indexed label=value filter; --attr is a compatibility alias" });
|
|
43774
|
+
space = options_exports.String("--space", { description: "Narrow indexed field lookup to a space (name or ID)" });
|
|
43775
|
+
onlyOpen = options_exports.Boolean("--only-open", false, { description: "Only show non-completed activities" });
|
|
43776
|
+
hours = options_exports.String("--hours", { description: "Only from the last N hours" });
|
|
43777
|
+
limit = options_exports.String("--limit", { description: "Max results" });
|
|
43778
|
+
sort = options_exports.String("--sort", { description: "Sort by: deadline, created" });
|
|
43779
|
+
before = options_exports.String("--before", { description: "Only activities before this timestamp (ms)" });
|
|
43780
|
+
after = options_exports.String("--after", { description: "Only activities after this timestamp (ms)" });
|
|
43781
|
+
archived = options_exports.Boolean("--archived", false, {
|
|
43782
|
+
description: "Show archived (trashed) activities instead of active ones"
|
|
43783
|
+
});
|
|
43784
|
+
async run() {
|
|
43785
|
+
if (this.archived && !this.attr?.length) {
|
|
43786
|
+
if (this.space) throw new Error("--space requires an indexed --field filter");
|
|
43787
|
+
if (this.compact || this.cursor !== void 0 || this.minCount !== void 0) throw new Error("--compact/--cursor/--min-count require an active entity-scoped activity list.");
|
|
43788
|
+
parseActivityReadRequest("listActivities", { archived: true, limit: this.limit === void 0 ? void 0 : parseOperationNumberParameter("listActivities", "limit", this.limit) });
|
|
43789
|
+
const client = this.client();
|
|
43790
|
+
const params = { archived: "true" };
|
|
43791
|
+
if (this.limit) params.limit = this.limit;
|
|
43792
|
+
const res = await client.listActivities(params);
|
|
43793
|
+
const spaces = await client.listSpaces();
|
|
43794
|
+
this.emitText(
|
|
43795
|
+
jsonWithSpaces(res, spaces),
|
|
43796
|
+
() => this.withFooter(formatActivityList(res.data ?? []), spaces)
|
|
43797
|
+
);
|
|
43798
|
+
return;
|
|
43799
|
+
}
|
|
43800
|
+
await this.runActivityList({
|
|
43801
|
+
archived: this.archived,
|
|
43802
|
+
compact: this.compact,
|
|
43803
|
+
cursor: this.cursor,
|
|
43804
|
+
minCount: this.minCount !== void 0 ? parseOperationNumberParameter("listRecentActivities", "minCount", this.minCount) : void 0,
|
|
43805
|
+
entity: this.entity,
|
|
43806
|
+
typeFilter: this.type,
|
|
43807
|
+
attrFilter: this.attr,
|
|
43808
|
+
space: this.space,
|
|
43809
|
+
onlyOpen: this.onlyOpen,
|
|
43810
|
+
hours: this.hours !== void 0 ? parseOperationNumberParameter("listRecentActivities", "hoursBack", this.hours) : void 0,
|
|
43811
|
+
limit: this.limit !== void 0 ? parseOperationNumberParameter(this.entity ? "listRecentActivities" : "listActivities", "limit", this.limit) : void 0,
|
|
43812
|
+
sort: this.sort,
|
|
43813
|
+
before: this.before !== void 0 ? parseOperationNumberParameter("listActivities", "before", this.before) : void 0,
|
|
43814
|
+
after: this.after !== void 0 ? parseOperationNumberParameter("listActivities", "after", this.after) : void 0
|
|
43815
|
+
});
|
|
43816
|
+
}
|
|
43817
|
+
};
|
|
43818
|
+
var ActivityCreate = class extends ClientCommand {
|
|
43819
|
+
static paths = [["activity", "create"]];
|
|
43820
|
+
static usage = Command.Usage({ category: "Activity", description: "Create an activity" });
|
|
43821
|
+
type = options_exports.String("--type", { required: true, description: "Activity type (note, conversation, meeting, call, message, task)" });
|
|
43822
|
+
title = options_exports.String("--title", { required: true, description: "Activity title" });
|
|
43823
|
+
entity = options_exports.Array("--entity", { required: true, description: "Linked entities (resolved by name)" });
|
|
43824
|
+
space = options_exports.String("--space", { required: true, description: "Space to create in (name or ID)" });
|
|
43825
|
+
content = options_exports.String("--content", { description: "Activity content" });
|
|
43826
|
+
contentFile = options_exports.String("--content-file", { description: "Read content from a markdown/text file" });
|
|
43827
|
+
sourceCreatedAt = options_exports.String("--source-created-at", {
|
|
43828
|
+
description: "Import/backfill timestamp: YYYY-MM-DD or YYYY-MM-DDTHH:mm"
|
|
43829
|
+
});
|
|
43830
|
+
sourceCreatedAtTimezone = options_exports.String("--source-created-at-timezone", "Europe/Berlin", {
|
|
43831
|
+
description: "IANA timezone for --source-created-at"
|
|
43832
|
+
});
|
|
43833
|
+
tag = options_exports.Array("--tag", { description: "Tags (repeatable)" });
|
|
43834
|
+
agentAssignee = options_exports.Array("--agent-assignee", { description: "Agent ID to assign to this task (repeatable; requires write access)" });
|
|
43835
|
+
autoLink = options_exports.Boolean("--auto-link", false, { description: "Auto-link entities not in target space" });
|
|
43836
|
+
entitySpaceGrantFingerprint = options_exports.String("--entity-space-grant-fingerprint", {
|
|
43837
|
+
description: "Exact grant fingerprint returned by the confirmation-required error"
|
|
43838
|
+
});
|
|
43839
|
+
field = options_exports.Array("--field", { description: "Typed field JSON: {label or fieldId, optional type, value}; repeatable, null removes" });
|
|
43840
|
+
async run() {
|
|
43841
|
+
const fields4 = parseActivityFields(this.field);
|
|
43842
|
+
if (fields4 !== void 0 && (this.autoLink || this.entitySpaceGrantFingerprint !== void 0)) throw new Error("--field requires owners already in the destination space; complete sharing separately before using --field.");
|
|
43843
|
+
const content = graphConvert("content", () => readContentOption(this.content, this.contentFile));
|
|
43844
|
+
const sourceCreatedAt = this.sourceCreatedAt === void 0 ? void 0 : graphConvert("sourceCreatedAt", () => parseSourceCreatedAt(this.sourceCreatedAt, this.sourceCreatedAtTimezone));
|
|
43845
|
+
const intent = graphInput(graphCreateIntent, {
|
|
43846
|
+
space: this.space,
|
|
43847
|
+
entities: this.entity,
|
|
43848
|
+
type: graphConvert("type", () => parseActivityType(this.type)),
|
|
43849
|
+
title: this.title,
|
|
43850
|
+
content,
|
|
43851
|
+
fields: fields4,
|
|
43852
|
+
tags: this.tag,
|
|
43853
|
+
agentAssigneeIds: this.agentAssignee,
|
|
43854
|
+
sourceCreatedAt,
|
|
43855
|
+
autoLinkPersonalSpace: this.autoLink,
|
|
43856
|
+
entitySpaceGrantFingerprint: this.entitySpaceGrantFingerprint
|
|
43857
|
+
});
|
|
43858
|
+
const progress = graphProgress(this, "activity.create", ["create", ...sourceCreatedAt && fields4 === void 0 ? ["sourceCreatedAt"] : []]);
|
|
43859
|
+
return progress.run(async () => {
|
|
43860
|
+
const caller = await resolveCaller();
|
|
43861
|
+
const entityIds = await resolveEntitiesC(caller, intent.entities);
|
|
43862
|
+
const spaceId2 = await resolveSpaceByNameC(caller, intent.space);
|
|
43863
|
+
parseActivityWriteRequest("createActivity", { ...Object.fromEntries(Object.entries(intent).filter(([key]) => !["space", "entities", "entitySpaceGrantFingerprint"].includes(key))), spaceId: spaceId2, entityIds });
|
|
43864
|
+
const activityId2 = fields4 !== void 0 ? await progress.write("create", () => this.client().activityWrite("createActivity", { spaceId: spaceId2, entityIds, type: intent.type, title: intent.title, content, tags: intent.tags, agentAssigneeIds: intent.agentAssigneeIds, sourceCreatedAt, autoLinkPersonalSpace: intent.autoLinkPersonalSpace, fields: fields4 }), fieldCreateReceipt, "activityId") : await progress.write("create", () => caller.mutation(activitiesCreate, {
|
|
43865
|
+
entityId: entityIds[0],
|
|
43866
|
+
additionalEntities: entityIds.slice(1),
|
|
43867
|
+
ownerSpaceId: spaceId2,
|
|
43868
|
+
grantMissingEntityAccess: this.autoLink,
|
|
43869
|
+
...this.entitySpaceGrantFingerprint !== void 0 ? { entitySpaceGrantFingerprint: this.entitySpaceGrantFingerprint } : {},
|
|
43870
|
+
type: intent.type,
|
|
43871
|
+
title: intent.title,
|
|
43872
|
+
...intent.agentAssigneeIds?.length ? { agentAssigneeIds: intent.agentAssigneeIds } : {},
|
|
43873
|
+
...content !== void 0 ? { contentMarkdown: content } : {},
|
|
43874
|
+
...intent.tags?.length ? { tags: intent.tags } : {}
|
|
43875
|
+
}), (raw) => graphResult(graphId2, raw), "activityId");
|
|
43876
|
+
if (sourceCreatedAt && fields4 === void 0) await progress.write("sourceCreatedAt", () => caller.mutation(activitiesUpdateCreatedAt, { activityId: activityId2, sourceCreatedAt }), graphAck);
|
|
43877
|
+
const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
|
|
43878
|
+
await progress.observe("output", async () => this.emitText(graphEnvelope(graphCreated, { activityId: activityId2 }, spaces), () => withFooter(`Created ${this.type} '${this.title}' (${activityId2})`, spaces)));
|
|
43879
|
+
});
|
|
43880
|
+
}
|
|
43881
|
+
};
|
|
43882
|
+
var ActivitySearch = class extends ClientCommand {
|
|
43883
|
+
static paths = [["activity", "search"]];
|
|
43884
|
+
static usage = Command.Usage({ category: "Activity", description: "Search activities by title or content" });
|
|
43885
|
+
query = options_exports.String();
|
|
43886
|
+
entity = options_exports.String("--entity", { description: "Filter by entity and bounded direct-child hierarchy (name or ID)" });
|
|
43887
|
+
type = options_exports.String("--type", { description: "Filter by activity type" });
|
|
43888
|
+
limit = options_exports.String("--limit", { description: "Max results" });
|
|
43889
|
+
projection = options_exports.String("--projection", { description: "compact or full public fields" });
|
|
43890
|
+
async run() {
|
|
43891
|
+
const request = parseActivityReadRequest("searchActivities", {
|
|
43892
|
+
query: this.query,
|
|
43893
|
+
type: this.type,
|
|
43894
|
+
limit: this.limit === void 0 ? void 0 : parseOperationNumberParameter("searchActivities", "limit", this.limit),
|
|
43895
|
+
projection: this.projection
|
|
43896
|
+
});
|
|
43897
|
+
if (this.entity !== void 0 && !this.entity.trim()) throw new OperationInputError("searchActivities", [{ path: ["entityId"], reason: "too_small" }]);
|
|
43898
|
+
const client = this.client();
|
|
43899
|
+
const entityId2 = this.entity === void 0 ? void 0 : await resolveEntity(client, this.entity);
|
|
43900
|
+
const { data } = await client.activityRead("searchActivities", { ...request.input, entityId: entityId2 });
|
|
43901
|
+
const spaces = await client.listSpaces();
|
|
43902
|
+
this.emitText(jsonWithSpaces({ data }, spaces), () => this.withFooter(formatActivityList(data.activities), spaces));
|
|
43903
|
+
}
|
|
43904
|
+
};
|
|
43905
|
+
var ActivityGet = class extends ClientCommand {
|
|
43906
|
+
static paths = [["activity", "get"]];
|
|
43907
|
+
static usage = Command.Usage({ category: "Activity", description: "Get a single activity by ID" });
|
|
43908
|
+
id = options_exports.String();
|
|
43909
|
+
projection = options_exports.String("--projection", { description: "compact or full public fields" });
|
|
43910
|
+
async run() {
|
|
43911
|
+
const request = parseActivityReadRequest("getActivity", { activityId: this.id, projection: this.projection });
|
|
43912
|
+
const client = this.client();
|
|
43913
|
+
const { data } = await client.activityRead("getActivity", request.input);
|
|
43914
|
+
if (!data || data.projection === "tombstone") {
|
|
43915
|
+
this.emitText({ data: null }, () => "Activity not found or not accessible");
|
|
43916
|
+
return;
|
|
43917
|
+
}
|
|
43918
|
+
if ("attachments" in data) for (const attachment4 of data.attachments ?? []) attachmentResult(attachment4);
|
|
43919
|
+
const spaces = await client.listSpaces();
|
|
43920
|
+
this.emitText(jsonWithSpaces({ data }, spaces), () => {
|
|
43921
|
+
const detail = this.withFooter(formatActivityDetail(data), spaces);
|
|
43922
|
+
return (data.revisionCount ?? 0) > 1 ? `${detail}
|
|
43923
|
+
|
|
43924
|
+
${data.revisionCount} versions available \u2014 view with: ente activity revisions ${this.id}` : detail;
|
|
43925
|
+
});
|
|
43926
|
+
}
|
|
43927
|
+
};
|
|
43928
|
+
var ActivityUpdate = class extends ClientCommand {
|
|
43929
|
+
static paths = [["activity", "update"]];
|
|
43930
|
+
static usage = Command.Usage({ category: "Activity", description: "Update an activity" });
|
|
43931
|
+
id = options_exports.String();
|
|
43932
|
+
agentAssignee = options_exports.Array("--agent-assignee", { description: "Replace agent assignees with these IDs (repeatable); preserves human assignees" });
|
|
43933
|
+
clearAgentAssignees = options_exports.Boolean("--clear-agent-assignees", false, { description: "Remove all agent assignees" });
|
|
43934
|
+
content = options_exports.String("--content", { description: "Update content" });
|
|
43935
|
+
contentFile = options_exports.String("--content-file", { description: "Read updated content from a markdown/text file" });
|
|
43936
|
+
title = options_exports.String("--title", { description: "Update title" });
|
|
43937
|
+
deadline = options_exports.String("--deadline", { description: "Update deadline (human-friendly)" });
|
|
43938
|
+
clearDeadline = options_exports.Boolean("--clear-deadline", false, { description: "Remove the deadline" });
|
|
43939
|
+
entityAdd = options_exports.Array("--entity-add", { description: "Link additional entities" });
|
|
43940
|
+
entityRemove = options_exports.Array("--entity-remove", { description: "Unlink entities" });
|
|
43941
|
+
field = options_exports.Array("--field", { description: "Typed field JSON: {label or fieldId, optional type, value}; repeatable, null removes" });
|
|
43942
|
+
async run() {
|
|
43943
|
+
const fields4 = parseActivityFields(this.field);
|
|
43944
|
+
const content = graphConvert("content", () => readContentOption(this.content, this.contentFile));
|
|
43945
|
+
if (this.clearDeadline && this.deadline !== void 0) throw new Error("Use either --deadline or --clear-deadline, not both.");
|
|
43946
|
+
const deadline = graphConvert("deadline", () => deadlineChange(this.deadline, this.clearDeadline));
|
|
43947
|
+
const addNames = this.entityAdd === void 0 ? [] : graphInput(graphSelectors, this.entityAdd);
|
|
43948
|
+
const removeNames = this.entityRemove === void 0 ? [] : graphInput(graphSelectors, this.entityRemove);
|
|
43949
|
+
const hasEntityChange = addNames.length > 0 || removeNames.length > 0;
|
|
43950
|
+
if (this.clearAgentAssignees && this.agentAssignee?.length) throw new Error("Choose --agent-assignee or --clear-agent-assignees");
|
|
43951
|
+
const agentAssigneeIds = this.clearAgentAssignees ? [] : this.agentAssignee;
|
|
43952
|
+
parseActivityWriteRequest("updateActivity", { activityId: this.id, title: this.title, content, ...deadline ? { deadline: deadline.deadline ?? null } : {}, agentAssigneeIds, fields: fields4 });
|
|
43953
|
+
if (content === void 0 && this.title === void 0 && deadline === null && !hasEntityChange && agentAssigneeIds === void 0 && fields4 === void 0) throw new Error("Nothing to update. Specify content, title, deadline, entity links or agent assignees.");
|
|
43954
|
+
const steps = fields4 !== void 0 ? ["fields"] : [...agentAssigneeIds !== void 0 ? ["agentAssignees"] : [], ...this.title !== void 0 ? ["title"] : [], ...deadline ? ["deadline"] : [], ...content !== void 0 ? ["content"] : [], ...hasEntityChange ? ["entities"] : []];
|
|
43955
|
+
const progress = graphProgress(this, "activity.update", steps, { activityId: this.id });
|
|
43956
|
+
return progress.run(async () => {
|
|
43957
|
+
const caller = await resolveCaller();
|
|
43958
|
+
if (fields4 !== void 0) {
|
|
43959
|
+
let entityIds;
|
|
43960
|
+
if (hasEntityChange) {
|
|
43961
|
+
const rich = graphResult(graphPublicRich.nullable(), await caller.query(activitiesGetByIdRich, { activityId: this.id }));
|
|
43962
|
+
if (!rich) throw new Error("Activity not found or not accessible");
|
|
43963
|
+
const current = rich.entityDetails.flatMap((entity5) => entity5 ? [entity5._id] : []);
|
|
43964
|
+
const removed = new Set(await resolveEntitiesC(caller, removeNames));
|
|
43965
|
+
entityIds = [.../* @__PURE__ */ new Set([...current.filter((id21) => !removed.has(id21)), ...await resolveEntitiesC(caller, addNames)])];
|
|
43966
|
+
}
|
|
43967
|
+
await progress.write("fields", () => this.client().activityWrite("updateActivity", { activityId: this.id, title: this.title, content, ...deadline ? { deadline: deadline.deadline ?? null } : {}, agentAssigneeIds, entityIds, fields: fields4 }), fieldUpdateReceipt);
|
|
43968
|
+
} else {
|
|
43969
|
+
if (agentAssigneeIds !== void 0) await progress.write("agentAssignees", () => caller.mutation(makeFunctionReference2("taskAgents:updateAssignments"), { activityId: this.id, agentAssigneeIds }), graphAck);
|
|
43970
|
+
if (this.title !== void 0) await progress.write("title", () => caller.mutation(activitiesUpdateTitle, { activityId: this.id, title: this.title }), graphAck);
|
|
43971
|
+
if (deadline) await progress.write("deadline", () => caller.mutation(activitiesUpdateDeadline, { activityId: this.id, ...deadline }), graphAck);
|
|
43972
|
+
if (content !== void 0) await progress.write("content", () => caller.mutation(activitiesSetContentFromMarkdown, { activityId: this.id, markdown: content }), graphAck);
|
|
43973
|
+
if (hasEntityChange) await progress.observe("entityResolution", async () => {
|
|
43974
|
+
const rich = graphResult(graphPublicRich.nullable(), await caller.query(activitiesGetByIdRich, { activityId: this.id }));
|
|
43975
|
+
if (!rich) throw new Error("Activity not found or not accessible");
|
|
43976
|
+
const currentIds = rich.entityDetails.flatMap((entity5) => entity5 ? [entity5._id] : []);
|
|
43977
|
+
const addIds = await resolveEntitiesC(caller, addNames);
|
|
43978
|
+
const removeSet = new Set(await resolveEntitiesC(caller, removeNames));
|
|
43979
|
+
const newIds = currentIds.filter((id21) => !removeSet.has(id21));
|
|
43980
|
+
for (const id21 of addIds) if (!currentIds.includes(id21)) newIds.push(id21);
|
|
43981
|
+
parseActivityWriteRequest("updateActivity", { activityId: this.id, entityIds: newIds });
|
|
43982
|
+
await progress.write("entities", () => caller.mutation(activitiesUpdateEntities, { activityId: this.id, entities: newIds }), graphAck);
|
|
43983
|
+
});
|
|
43984
|
+
}
|
|
43985
|
+
const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
|
|
43986
|
+
await progress.observe("output", async () => this.emitText(graphEnvelope(graphContextAck, { success: true, activityId: this.id }, spaces), () => withFooter(`Updated activity ${this.id}`, spaces)));
|
|
43987
|
+
});
|
|
43988
|
+
}
|
|
43989
|
+
};
|
|
43990
|
+
var ActivityDelete = class extends ProfileCommand {
|
|
43991
|
+
static paths = [["activity", "delete"]];
|
|
43992
|
+
static usage = Command.Usage({
|
|
43993
|
+
category: "Activity",
|
|
43994
|
+
description: "Move an activity to the trash (soft delete). Use `activity restore` to undo."
|
|
43995
|
+
});
|
|
43996
|
+
id = options_exports.String();
|
|
43997
|
+
async run() {
|
|
43998
|
+
parseActivityWriteRequest("deleteActivity", { activityId: this.id });
|
|
43999
|
+
const progress = graphProgress(this, "activity.deleteActivity", ["deleteActivity"], { activityId: this.id });
|
|
44000
|
+
return progress.run(async () => {
|
|
44001
|
+
const caller = await resolveCaller();
|
|
44002
|
+
await progress.write("deleteActivity", () => caller.mutation(activitiesDeleteActivity, { activityId: this.id }), graphAck);
|
|
44003
|
+
const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
|
|
44004
|
+
await progress.observe("output", async () => this.emitText(graphEnvelope(graphContextAck, { success: true, activityId: this.id }, spaces), () => withFooter(`Trashed activity ${this.id}`, spaces)));
|
|
44005
|
+
});
|
|
44006
|
+
}
|
|
44007
|
+
};
|
|
44008
|
+
var ActivityRestore = class extends ProfileCommand {
|
|
44009
|
+
static paths = [["activity", "restore"]];
|
|
44010
|
+
static usage = Command.Usage({ category: "Activity", description: "Restore a trashed activity" });
|
|
44011
|
+
id = options_exports.String();
|
|
44012
|
+
async run() {
|
|
44013
|
+
parseActivityWriteRequest("restoreActivity", { activityId: this.id });
|
|
44014
|
+
const progress = graphProgress(this, "activity.restoreActivity", ["restoreActivity"], { activityId: this.id });
|
|
44015
|
+
return progress.run(async () => {
|
|
44016
|
+
const caller = await resolveCaller();
|
|
44017
|
+
await progress.write("restoreActivity", () => caller.mutation(activitiesRestoreActivity, { activityId: this.id }), graphAck);
|
|
44018
|
+
const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
|
|
44019
|
+
await progress.observe("output", async () => this.emitText(graphEnvelope(graphContextAck, { success: true, activityId: this.id }, spaces), () => withFooter(`Restored activity ${this.id}`, spaces)));
|
|
44020
|
+
});
|
|
44021
|
+
}
|
|
44022
|
+
};
|
|
43870
44023
|
var ACTIVITY_COMMANDS = [
|
|
43871
44024
|
ActivityList,
|
|
43872
44025
|
ActivityCreate,
|
|
@@ -43892,6 +44045,31 @@ var ACTIVITY_COMMANDS = [
|
|
|
43892
44045
|
ActivityAttachmentUpload
|
|
43893
44046
|
];
|
|
43894
44047
|
|
|
44048
|
+
// ente/commands/activityMessage.ts
|
|
44049
|
+
init_server();
|
|
44050
|
+
var messagesDeleteOwn = makeFunctionReference2("messages:deleteOwn");
|
|
44051
|
+
var graphMessageDeleted = activityWriteResults.deleteActivityMessage.extend({ messageId: graphId2 });
|
|
44052
|
+
var ActivityMessageDelete = class extends ProfileCommand {
|
|
44053
|
+
static paths = [["activity", "message", "delete"]];
|
|
44054
|
+
static usage = Command.Usage({
|
|
44055
|
+
category: "Activity",
|
|
44056
|
+
description: "Delete an activity message you authored",
|
|
44057
|
+
details: "Agent credentials can delete only messages their own agent posted. The deletion is permanent."
|
|
44058
|
+
});
|
|
44059
|
+
id = options_exports.String();
|
|
44060
|
+
async run() {
|
|
44061
|
+
parseActivityWriteRequest("deleteActivityMessage", { messageId: this.id });
|
|
44062
|
+
const progress = graphProgress(this, "activity.message.delete", ["deleteMessage"]);
|
|
44063
|
+
return progress.run(async () => {
|
|
44064
|
+
const caller = await resolveCaller();
|
|
44065
|
+
await progress.write("deleteMessage", () => caller.mutation(messagesDeleteOwn, { messageId: this.id }), graphAck);
|
|
44066
|
+
const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
|
|
44067
|
+
await progress.observe("output", async () => this.emitText(graphEnvelope(graphMessageDeleted, { success: true, messageId: this.id }, spaces), () => withFooter(`Deleted message ${this.id}`, spaces)));
|
|
44068
|
+
});
|
|
44069
|
+
}
|
|
44070
|
+
};
|
|
44071
|
+
var ACTIVITY_MESSAGE_COMMANDS = [ActivityMessageDelete];
|
|
44072
|
+
|
|
43895
44073
|
// ente/commands/activityTranscript.ts
|
|
43896
44074
|
init_server();
|
|
43897
44075
|
var listForActivity = makeFunctionReference2(
|
|
@@ -44106,7 +44284,7 @@ var TaskGet = class extends ProfileCommand {
|
|
|
44106
44284
|
this.emitText(graphEnvelope(graphTaskItem, taskItem, spaces, users), () => withFooter(formatTaskDetail(taskItem, users), spaces));
|
|
44107
44285
|
}
|
|
44108
44286
|
};
|
|
44109
|
-
var TaskCreate = class extends
|
|
44287
|
+
var TaskCreate = class extends ClientCommand {
|
|
44110
44288
|
static paths = [["task", "create"]];
|
|
44111
44289
|
static usage = Command.Usage({ category: "Task", description: "Create a task" });
|
|
44112
44290
|
title = options_exports.String();
|
|
@@ -44131,16 +44309,19 @@ var TaskCreate = class extends ProfileCommand {
|
|
|
44131
44309
|
entitySpaceGrantFingerprint = options_exports.String("--entity-space-grant-fingerprint", {
|
|
44132
44310
|
description: "Exact grant fingerprint returned by the confirmation-required error"
|
|
44133
44311
|
});
|
|
44312
|
+
field = options_exports.Array("--field", { description: "Typed field JSON: {label or fieldId, optional type, value}; repeatable, null removes" });
|
|
44134
44313
|
async run() {
|
|
44314
|
+
const fields4 = parseActivityFields(this.field);
|
|
44315
|
+
if (fields4 !== void 0 && (this.autoLink || this.entitySpaceGrantFingerprint !== void 0)) throw new Error("--field requires owners already in the destination space; complete sharing separately before using --field.");
|
|
44135
44316
|
if (this.noDeadline && this.deadline !== void 0) throw new Error("Use either --deadline or --no-deadline, not both.");
|
|
44136
44317
|
const deadline = this.noDeadline ? void 0 : graphConvert("deadline", () => this.deadline === void 0 ? defaultDeadline() : parseDeadline(this.deadline));
|
|
44137
44318
|
const attributes2 = graphConvert("attributes", () => parseAttrs(this.attr));
|
|
44138
44319
|
const sourceCreatedAt = this.sourceCreatedAt === void 0 ? void 0 : graphConvert("sourceCreatedAt", () => parseSourceCreatedAt(this.sourceCreatedAt, this.sourceCreatedAtTimezone));
|
|
44139
44320
|
const directAssigneeIds = (this.assignee ?? []).filter((value) => !value.includes("@"));
|
|
44140
44321
|
const emailAssignees = [...(this.assignee ?? []).filter((value) => value.includes("@")), ...this.assigneeEmail ?? []];
|
|
44141
|
-
const intent = graphInput(graphCreateIntent, { space: this.space, entities: this.entity, type: "task", title: this.title, deadline, attributes: attributes2, content: this.content, tags: this.tag, assigneeIds: directAssigneeIds, assigneeEmails: emailAssignees, sourceCreatedAt, autoLinkPersonalSpace: this.autoLink, entitySpaceGrantFingerprint: this.entitySpaceGrantFingerprint });
|
|
44322
|
+
const intent = graphInput(graphCreateIntent, { space: this.space, entities: this.entity, type: "task", title: this.title, deadline, attributes: attributes2, fields: fields4, content: this.content, tags: this.tag, assigneeIds: directAssigneeIds, assigneeEmails: emailAssignees, sourceCreatedAt, autoLinkPersonalSpace: this.autoLink, entitySpaceGrantFingerprint: this.entitySpaceGrantFingerprint });
|
|
44142
44323
|
const entries = Object.entries(attributes2);
|
|
44143
|
-
const progress = graphProgress(this, "task.create", ["create", ...entries.map((_, index) => `attribute[${index}]`), ...sourceCreatedAt ? ["sourceCreatedAt"] : []]);
|
|
44324
|
+
const progress = graphProgress(this, "task.create", ["create", ...fields4 === void 0 ? entries.map((_, index) => `attribute[${index}]`) : [], ...sourceCreatedAt && fields4 === void 0 ? ["sourceCreatedAt"] : []]);
|
|
44144
44325
|
return progress.run(async () => {
|
|
44145
44326
|
const caller = await resolveCaller();
|
|
44146
44327
|
const entityIds = await resolveEntitiesC(caller, intent.entities);
|
|
@@ -44148,7 +44329,7 @@ var TaskCreate = class extends ProfileCommand {
|
|
|
44148
44329
|
const resolved = await resolveAssigneeEmailsToIds(caller, spaceId2, emailAssignees);
|
|
44149
44330
|
const assigneeIds = [.../* @__PURE__ */ new Set([...directAssigneeIds, ...resolved])];
|
|
44150
44331
|
parseActivityWriteRequest("createActivity", { ...Object.fromEntries(Object.entries(intent).filter(([key]) => !["space", "entities", "entitySpaceGrantFingerprint"].includes(key))), spaceId: spaceId2, entityIds, assigneeIds });
|
|
44151
|
-
const activityId2 = await progress.write("create", () => caller.mutation(activitiesCreate2, {
|
|
44332
|
+
const activityId2 = fields4 !== void 0 ? await progress.write("create", () => this.client().activityWrite("createActivity", { spaceId: spaceId2, entityIds, type: "task", title: intent.title, content: intent.content, deadline, attributes: attributes2, fields: fields4, tags: intent.tags, assigneeIds, sourceCreatedAt, autoLinkPersonalSpace: intent.autoLinkPersonalSpace }), fieldCreateReceipt, "activityId") : await progress.write("create", () => caller.mutation(activitiesCreate2, {
|
|
44152
44333
|
entityId: entityIds[0],
|
|
44153
44334
|
additionalEntities: entityIds.slice(1),
|
|
44154
44335
|
ownerSpaceId: spaceId2,
|
|
@@ -44161,14 +44342,14 @@ var TaskCreate = class extends ProfileCommand {
|
|
|
44161
44342
|
...this.tag?.length ? { tags: this.tag } : {},
|
|
44162
44343
|
...this.content !== void 0 ? { contentMarkdown: this.content } : {}
|
|
44163
44344
|
}), (raw) => graphResult(graphId2, raw), "activityId");
|
|
44164
|
-
for (const [index, [key, value]] of entries.entries()) await progress.write(`attribute[${index}]`, () => caller.mutation(activitiesSetAttribute, { activityId: activityId2, key, value }), graphAck);
|
|
44165
|
-
if (sourceCreatedAt) await progress.write("sourceCreatedAt", () => caller.mutation(activitiesUpdateCreatedAt2, { activityId: activityId2, sourceCreatedAt }), graphAck);
|
|
44345
|
+
if (fields4 === void 0) for (const [index, [key, value]] of entries.entries()) await progress.write(`attribute[${index}]`, () => caller.mutation(activitiesSetAttribute, { activityId: activityId2, key, value }), graphAck);
|
|
44346
|
+
if (sourceCreatedAt && fields4 === void 0) await progress.write("sourceCreatedAt", () => caller.mutation(activitiesUpdateCreatedAt2, { activityId: activityId2, sourceCreatedAt }), graphAck);
|
|
44166
44347
|
const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
|
|
44167
44348
|
await progress.observe("output", async () => this.emitText(graphEnvelope(graphCreated, { activityId: activityId2 }, spaces), () => withFooter(`Created task '${this.title}' (${activityId2})`, spaces)));
|
|
44168
44349
|
});
|
|
44169
44350
|
}
|
|
44170
44351
|
};
|
|
44171
|
-
var TaskUpdate = class extends
|
|
44352
|
+
var TaskUpdate = class extends ClientCommand {
|
|
44172
44353
|
static paths = [["task", "update"]];
|
|
44173
44354
|
static usage = Command.Usage({ category: "Task", description: "Update a task" });
|
|
44174
44355
|
id = options_exports.String();
|
|
@@ -44177,23 +44358,29 @@ var TaskUpdate = class extends ProfileCommand {
|
|
|
44177
44358
|
attr = options_exports.Array("--attr", { description: "Set attributes as key=value pairs" });
|
|
44178
44359
|
deadline = options_exports.String("--deadline", { description: "Update deadline (human-friendly)" });
|
|
44179
44360
|
clearDeadline = options_exports.Boolean("--clear-deadline", false, { description: "Remove the deadline" });
|
|
44361
|
+
field = options_exports.Array("--field", { description: "Typed field JSON: {label or fieldId, optional type, value}; repeatable, null removes" });
|
|
44180
44362
|
async run() {
|
|
44363
|
+
const fields4 = parseActivityFields(this.field);
|
|
44181
44364
|
graphTaskNumber(this.id);
|
|
44182
44365
|
const attributes2 = graphConvert("attributes", () => parseAttrs(this.attr));
|
|
44183
44366
|
if (this.clearDeadline && this.deadline !== void 0) throw new Error("Use either --deadline or --clear-deadline, not both.");
|
|
44184
44367
|
const deadline = graphConvert("deadline", () => deadlineChange(this.deadline, this.clearDeadline));
|
|
44185
|
-
parseActivityWriteRequest("updateActivity", { activityId: this.id, title: this.title, content: this.content, ...deadline ? { deadline: deadline.deadline ?? null } : {}, attributes: attributes2 });
|
|
44186
|
-
if (this.title === void 0 && this.content === void 0 && deadline === null && Object.keys(attributes2).length === 0) throw new Error("Nothing to update. Specify --title, --content, --attr, --deadline, or --clear-deadline.");
|
|
44368
|
+
parseActivityWriteRequest("updateActivity", { activityId: this.id, title: this.title, content: this.content, ...deadline ? { deadline: deadline.deadline ?? null } : {}, attributes: attributes2, fields: fields4 });
|
|
44369
|
+
if (this.title === void 0 && this.content === void 0 && deadline === null && Object.keys(attributes2).length === 0 && fields4 === void 0) throw new Error("Nothing to update. Specify --title, --content, --attr, --field, --deadline, or --clear-deadline.");
|
|
44187
44370
|
const entries = Object.entries(attributes2);
|
|
44188
|
-
const progress = graphProgress(this, "task.update", [...this.title !== void 0 ? ["title"] : [], ...this.content !== void 0 ? ["content"] : [], ...deadline ? ["deadline"] : [], ...entries.map((_, index) => `attribute[${index}]`)]);
|
|
44371
|
+
const progress = graphProgress(this, "task.update", fields4 !== void 0 ? ["fields"] : [...this.title !== void 0 ? ["title"] : [], ...this.content !== void 0 ? ["content"] : [], ...deadline ? ["deadline"] : [], ...fields4 === void 0 ? entries.map((_, index) => `attribute[${index}]`) : []]);
|
|
44189
44372
|
return progress.run(async () => {
|
|
44190
44373
|
const caller = await resolveCaller();
|
|
44191
44374
|
const activityId2 = await resolveTaskIdC(caller, this.id);
|
|
44192
44375
|
progress.identify(activityId2);
|
|
44193
|
-
if (
|
|
44194
|
-
|
|
44195
|
-
|
|
44196
|
-
|
|
44376
|
+
if (fields4 !== void 0) {
|
|
44377
|
+
await progress.write("fields", () => this.client().activityWrite("updateActivity", { activityId: activityId2, title: this.title, content: this.content, ...deadline ? { deadline: deadline.deadline ?? null } : {}, attributes: attributes2, fields: fields4 }), fieldUpdateReceipt);
|
|
44378
|
+
} else {
|
|
44379
|
+
if (this.title !== void 0) await progress.write("title", () => caller.mutation(activitiesUpdateTitle2, { activityId: activityId2, title: this.title }), graphAck);
|
|
44380
|
+
if (this.content !== void 0) await progress.write("content", () => caller.mutation(activitiesSetContentFromMarkdown2, { activityId: activityId2, markdown: this.content }), graphAck);
|
|
44381
|
+
if (deadline) await progress.write("deadline", () => caller.mutation(activitiesUpdateDeadline2, { activityId: activityId2, ...deadline }), graphAck);
|
|
44382
|
+
for (const [index, [key, value]] of entries.entries()) await progress.write(`attribute[${index}]`, () => caller.mutation(activitiesSetAttribute, { activityId: activityId2, key, value }), graphAck);
|
|
44383
|
+
}
|
|
44197
44384
|
const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
|
|
44198
44385
|
await progress.observe("output", async () => this.emitText(graphEnvelope(graphContextAck, { success: true, activityId: activityId2 }, spaces), () => withFooter(`Updated task ${this.id}`, spaces)));
|
|
44199
44386
|
});
|
|
@@ -44251,11 +44438,11 @@ var TaskAssign = class extends ProfileCommand {
|
|
|
44251
44438
|
this.emitText(graphEnvelope(graphContextAck, { success: true, activityId: activityId2, assigneeIds: current, changed: false }), () => "User is already assigned.");
|
|
44252
44439
|
return;
|
|
44253
44440
|
}
|
|
44254
|
-
const
|
|
44255
|
-
parseActivityWriteRequest("updateActivityAssignees", { activityId: activityId2, action: "replace", assigneeIds:
|
|
44256
|
-
await progress.write("assignees", () => caller.mutation(activitiesUpdateAssignees, { activityId: activityId2, assigneeIds:
|
|
44441
|
+
const updated2 = [...current, newUserId];
|
|
44442
|
+
parseActivityWriteRequest("updateActivityAssignees", { activityId: activityId2, action: "replace", assigneeIds: updated2 });
|
|
44443
|
+
await progress.write("assignees", () => caller.mutation(activitiesUpdateAssignees, { activityId: activityId2, assigneeIds: updated2 }), graphAck);
|
|
44257
44444
|
const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
|
|
44258
|
-
await progress.observe("output", async () => this.emitText(graphEnvelope(graphContextAck, { success: true, activityId: activityId2, assigneeIds:
|
|
44445
|
+
await progress.observe("output", async () => this.emitText(graphEnvelope(graphContextAck, { success: true, activityId: activityId2, assigneeIds: updated2 }, spaces), () => withFooter(`Assigned ${this.userId} to task ${this.id}.`, spaces)));
|
|
44259
44446
|
});
|
|
44260
44447
|
}
|
|
44261
44448
|
};
|
|
@@ -44284,11 +44471,11 @@ var TaskUnassign = class extends ProfileCommand {
|
|
|
44284
44471
|
this.emitText(graphEnvelope(graphContextAck, { success: true, activityId: activityId2, assigneeIds: current, changed: false }), () => "User is not assigned to this task.");
|
|
44285
44472
|
return;
|
|
44286
44473
|
}
|
|
44287
|
-
const
|
|
44288
|
-
parseActivityWriteRequest("updateActivityAssignees", { activityId: activityId2, action: "replace", assigneeIds:
|
|
44289
|
-
await progress.write("assignees", () => caller.mutation(activitiesUpdateAssignees, { activityId: activityId2, assigneeIds:
|
|
44474
|
+
const updated2 = current.filter((id21) => id21 !== targetId);
|
|
44475
|
+
parseActivityWriteRequest("updateActivityAssignees", { activityId: activityId2, action: "replace", assigneeIds: updated2 });
|
|
44476
|
+
await progress.write("assignees", () => caller.mutation(activitiesUpdateAssignees, { activityId: activityId2, assigneeIds: updated2 }), graphAck);
|
|
44290
44477
|
const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
|
|
44291
|
-
await progress.observe("output", async () => this.emitText(graphEnvelope(graphContextAck, { success: true, activityId: activityId2, assigneeIds:
|
|
44478
|
+
await progress.observe("output", async () => this.emitText(graphEnvelope(graphContextAck, { success: true, activityId: activityId2, assigneeIds: updated2 }, spaces), () => withFooter(`Unassigned ${this.userId} from task ${this.id}.`, spaces)));
|
|
44292
44479
|
});
|
|
44293
44480
|
}
|
|
44294
44481
|
};
|
|
@@ -44375,9 +44562,6 @@ var TASK_COMMANDS = [
|
|
|
44375
44562
|
TasksAlias
|
|
44376
44563
|
];
|
|
44377
44564
|
|
|
44378
|
-
// ente/commands/list.ts
|
|
44379
|
-
import { readFileSync as readFileSync10 } from "node:fs";
|
|
44380
|
-
|
|
44381
44565
|
// ente/entityIcon.ts
|
|
44382
44566
|
var ICONS = [...AGENT_ICON_IDS, ...legacyCustomIconIds];
|
|
44383
44567
|
function parseEntityIcon(value) {
|
|
@@ -44386,9 +44570,6 @@ function parseEntityIcon(value) {
|
|
|
44386
44570
|
return icon2;
|
|
44387
44571
|
}
|
|
44388
44572
|
|
|
44389
|
-
// ente/commands/list.ts
|
|
44390
|
-
init_server();
|
|
44391
|
-
|
|
44392
44573
|
// ../packages/shared/src/database-view.ts
|
|
44393
44574
|
var databaseAttributeTypeValidator = v.union(
|
|
44394
44575
|
v.literal("text"),
|
|
@@ -44786,7 +44967,8 @@ ${failures.map((e) => ` - ${e instanceof Error ? e.message : String(e)}`).join(
|
|
|
44786
44967
|
);
|
|
44787
44968
|
}
|
|
44788
44969
|
|
|
44789
|
-
// ente/commands/
|
|
44970
|
+
// ente/commands/listShared.ts
|
|
44971
|
+
init_server();
|
|
44790
44972
|
var DATABASE_LIST_TABS = ["database", "activities"];
|
|
44791
44973
|
function assertListIcon(icon2, type) {
|
|
44792
44974
|
if (type !== "topic")
|
|
@@ -44982,93 +45164,82 @@ function countActions(results) {
|
|
|
44982
45164
|
unchanged: results.filter((r) => r.action === "unchanged").length
|
|
44983
45165
|
};
|
|
44984
45166
|
}
|
|
44985
|
-
|
|
44986
|
-
|
|
45167
|
+
function columnOrThrow(columns, key, listName) {
|
|
45168
|
+
const col = columns.find((c) => c.key === key);
|
|
45169
|
+
if (!col) throw new Error(`--key '${key}' is not a column of list '${listName}'.`);
|
|
45170
|
+
if (col.type !== "text") throw new Error(`--key '${key}' must be a text column (it is ${col.type}).`);
|
|
45171
|
+
return col;
|
|
45172
|
+
}
|
|
45173
|
+
function toExisting(row) {
|
|
45174
|
+
return { rowId: row._id, title: row.title ?? null, attributes: row.attributes ?? {} };
|
|
45175
|
+
}
|
|
45176
|
+
|
|
45177
|
+
// ente/commands/listColumns.ts
|
|
45178
|
+
var ListColumnAdd = class extends ProfileCommand {
|
|
45179
|
+
static paths = [["list", "column", "add"]];
|
|
44987
45180
|
static usage = Command.Usage({
|
|
44988
45181
|
category: "List",
|
|
44989
|
-
description: "
|
|
44990
|
-
examples: [
|
|
44991
|
-
[
|
|
44992
|
-
"A Sarah-ideas list with a category column",
|
|
44993
|
-
'ente list create "Sarah \u2013 Ideen" --space Personal --column "kategorie:single-select:Aktivit\xE4t,Essen,Geschenk,Film"'
|
|
44994
|
-
],
|
|
44995
|
-
[
|
|
44996
|
-
"A recipe collection with labelled columns and an icon",
|
|
44997
|
-
'ente list create Rezepte --space "ivo&sarah" --icon book-open --column "protein_g=Protein (g):number" --column "vegan:boolean"'
|
|
44998
|
-
],
|
|
44999
|
-
[
|
|
45000
|
-
"A sync target pinned under a project",
|
|
45001
|
-
'ente list create Firmen --space "ivo&thomas" --pin Recherche --column "repo:text" --column "stage:single-select:Kandidat,in Review,verfolgt,verworfen"'
|
|
45002
|
-
]
|
|
45003
|
-
]
|
|
45004
|
-
});
|
|
45005
|
-
name = options_exports.String();
|
|
45006
|
-
space = options_exports.String("--space", { required: true, description: "Space to create in (name or ID)" });
|
|
45007
|
-
type = options_exports.String("--type", "topic", { description: "Entity type: topic (default) or project" });
|
|
45008
|
-
column = options_exports.Array("--column", {
|
|
45009
|
-
description: "Column: key[=Label]:type[:opt1,opt2] (type \u2208 text|number|boolean|single-select|multi-select)"
|
|
45010
|
-
});
|
|
45011
|
-
description = options_exports.String("--description", { description: "Searchable description for the list" });
|
|
45012
|
-
icon = options_exports.String("--icon", {
|
|
45013
|
-
description: `Topic icon from the web icon picker: ${entityCustomIconIds.join(", ")}`
|
|
45014
|
-
});
|
|
45015
|
-
pin = options_exports.Array("--pin", { description: "Pin the list under parent entities (resolved by name)" });
|
|
45016
|
-
shareParents = options_exports.Boolean("--share-parents", false, {
|
|
45017
|
-
description: "Share pinned parents and ancestors into the list's space when required"
|
|
45018
|
-
});
|
|
45019
|
-
parentSpaceGrantFingerprint = options_exports.String("--parent-space-grant-fingerprint", {
|
|
45020
|
-
description: "Exact grantFingerprint returned by the confirmation-required error"
|
|
45182
|
+
description: "Add columns to an existing database list (filters and sorts are kept)",
|
|
45183
|
+
examples: [["Add a labelled number column", 'ente list column add Rezepte "zeit_min=Zeit (min):number"']]
|
|
45021
45184
|
});
|
|
45185
|
+
list = options_exports.String();
|
|
45186
|
+
columns = options_exports.Rest({ required: 1 });
|
|
45022
45187
|
async run() {
|
|
45023
|
-
|
|
45024
|
-
|
|
45188
|
+
const caller = await resolveCaller();
|
|
45189
|
+
const { entityId: entityId2, entity: entity5, view } = await loadList(caller, this.list);
|
|
45190
|
+
const added = this.columns.map(parseColumn);
|
|
45191
|
+
const taken = new Set(view.columns.map((c) => c.key));
|
|
45192
|
+
for (const col of added) {
|
|
45193
|
+
if (taken.has(col.key)) throw new Error(`'${col.key}' is already a column of '${entity5.name}'.`);
|
|
45194
|
+
taken.add(col.key);
|
|
45025
45195
|
}
|
|
45026
|
-
const columns =
|
|
45027
|
-
const
|
|
45028
|
-
|
|
45029
|
-
|
|
45030
|
-
|
|
45196
|
+
const columns = [...view.columns, ...added];
|
|
45197
|
+
const args = parseDatabaseProtocolInput("entities:updateDatabaseView", databaseConfigurationContracts.updateDatabaseView.args, { id: entityId2, databaseView: parseDatabaseWriteView({ ...view, columns }) });
|
|
45198
|
+
const progress = graphProgress(this, "list column add", ["columns"], { entityId: entityId2 });
|
|
45199
|
+
await progress.run(() => progress.write("columns", () => databaseWrite(() => caller.mutation(updateDatabaseView, args)), (raw) => parseOperationResult("entities:updateDatabaseView", databaseConfigurationContracts.updateDatabaseView.result, raw)));
|
|
45200
|
+
this.emitText(
|
|
45201
|
+
{ data: { entityId: entityId2, added, columns } },
|
|
45202
|
+
() => `Added ${added.length} column${added.length === 1 ? "" : "s"} to '${entity5.name}': ${added.map((c) => c.key).join(", ")}.`
|
|
45203
|
+
);
|
|
45204
|
+
}
|
|
45205
|
+
};
|
|
45206
|
+
var ListColumnRemove = class extends ProfileCommand {
|
|
45207
|
+
static paths = [["list", "column", "remove"]];
|
|
45208
|
+
static usage = Command.Usage({
|
|
45209
|
+
category: "List",
|
|
45210
|
+
description: "Remove columns from a database list; their values are erased from every row",
|
|
45211
|
+
examples: [["Drop two columns", "ente list column remove Rezepte quelle kueche"]]
|
|
45212
|
+
});
|
|
45213
|
+
list = options_exports.String();
|
|
45214
|
+
keys = options_exports.Rest({ required: 1 });
|
|
45215
|
+
async run() {
|
|
45031
45216
|
const caller = await resolveCaller();
|
|
45032
|
-
const
|
|
45033
|
-
const
|
|
45034
|
-
const
|
|
45035
|
-
|
|
45036
|
-
|
|
45037
|
-
|
|
45038
|
-
const { entityId: entityId2, pins } = await progress.run(async () => {
|
|
45039
|
-
const entityId3 = await progress.write("create", () => databaseWrite(() => caller.mutation(entitiesCreate2, create3)), (raw) => projectEntityWriteResult("createEntity", raw).entityId, "entityId");
|
|
45040
|
-
if (columns.length > 0) {
|
|
45041
|
-
const args = parseDatabaseProtocolInput("entities:updateDatabaseView", databaseConfigurationContracts.updateDatabaseView.args, { id: entityId3, databaseView: initialView });
|
|
45042
|
-
await progress.write("columns", () => databaseWrite(() => caller.mutation(updateDatabaseView, args)), (raw) => parseOperationResult("entities:updateDatabaseView", databaseConfigurationContracts.updateDatabaseView.result, raw));
|
|
45043
|
-
}
|
|
45044
|
-
const tabs2 = parseDatabaseProtocolInput("entities:setEnabledTabs", databaseConfigurationContracts.setEnabledTabs.args, { entityId: entityId3, enabledTabs: DATABASE_LIST_TABS });
|
|
45045
|
-
await progress.write("tabs", () => databaseWrite(() => caller.mutation(setEnabledTabs, tabs2)), (raw) => parseOperationResult("entities:setEnabledTabs", databaseConfigurationContracts.setEnabledTabs.result, raw));
|
|
45046
|
-
if (this.description) {
|
|
45047
|
-
const args = descriptionArgs(entityId3, this.description);
|
|
45048
|
-
await progress.write("description", () => databaseWrite(() => caller.mutation(setDescriptionFromMarkdown, args)), (raw) => projectEntityWriteResult("updateEntity", raw));
|
|
45049
|
-
}
|
|
45050
|
-
if (icon2) {
|
|
45051
|
-
const args = parseDatabaseProtocolInput("entities:setCustomIcon", databaseConfigurationContracts.setCustomIcon.args, { id: entityId3, icon: icon2 });
|
|
45052
|
-
await progress.write("icon", () => databaseWrite(() => caller.mutation(setCustomIcon, args)), (raw) => parseOperationResult("entities:setCustomIcon", databaseConfigurationContracts.setCustomIcon.result, raw));
|
|
45053
|
-
}
|
|
45054
|
-
const pins2 = await progress.observe("pins", () => pinToTargets(caller, entityId3, this.pin ?? [], {
|
|
45055
|
-
shareParents: this.shareParents,
|
|
45056
|
-
...this.parentSpaceGrantFingerprint ? { parentSpaceGrantFingerprint: this.parentSpaceGrantFingerprint } : {}
|
|
45057
|
-
}));
|
|
45058
|
-
const data = { entityId: entityId3, name: this.name, type: this.type, columns, enabledTabs: DATABASE_LIST_TABS };
|
|
45059
|
-
this.emitText(
|
|
45060
|
-
pins2.failures.length ? {
|
|
45061
|
-
data: { ...data, pinFailures: pins2.failures, pinSucceeded: pins2.succeeded },
|
|
45062
|
-
error: { message: pins2.failures.some((failure2) => failure2.outcome === "unknown" || failure2.outcome === "committed-unvalidated") ? "List created, but some parent relationships need inspection." : "List created, but some parent relationships failed.", code: "PARTIAL_SUCCESS" }
|
|
45063
|
-
} : { data: { ...data, ...pins2.succeeded.length ? { pinSucceeded: pins2.succeeded } : {} } },
|
|
45064
|
-
() => `Created list '${this.name}' (${entityId3}) with ${columns.length} column${columns.length === 1 ? "" : "s"}; opens on its database view.${pins2.succeeded.length ? `
|
|
45065
|
-
Pinned to: ${pins2.succeeded.join(", ")}` : ""}`
|
|
45217
|
+
const { entityId: entityId2, entity: entity5, view } = await loadList(caller, this.list);
|
|
45218
|
+
const present = new Set(view.columns.map((c) => c.key));
|
|
45219
|
+
const missing = this.keys.filter((key) => !present.has(key));
|
|
45220
|
+
if (missing.length > 0) {
|
|
45221
|
+
throw new Error(
|
|
45222
|
+
`Not a column of '${entity5.name}': ${missing.join(", ")}. Columns: ${[...present].join(", ") || "(none)"}.`
|
|
45066
45223
|
);
|
|
45067
|
-
|
|
45224
|
+
}
|
|
45225
|
+
let current = view;
|
|
45226
|
+
const progress = graphProgress(this, "list column remove", this.keys.map((_, i) => `column:${i + 1}`), { entityId: entityId2 });
|
|
45227
|
+
await progress.run(async () => {
|
|
45228
|
+
for (const [index, key] of this.keys.entries()) {
|
|
45229
|
+
const args = parseDatabaseProtocolInput("entities:removeDatabaseColumn", databaseConfigurationContracts.removeDatabaseColumn.args, { id: entityId2, key, databaseView: current });
|
|
45230
|
+
await progress.write(`column:${index + 1}`, () => databaseWrite(() => caller.mutation(removeDatabaseColumn, args)), (raw) => parseOperationResult("entities:removeDatabaseColumn", databaseConfigurationContracts.removeDatabaseColumn.result, raw));
|
|
45231
|
+
current = { ...current, columns: current.columns.filter((c) => c.key !== key) };
|
|
45232
|
+
}
|
|
45068
45233
|
});
|
|
45069
|
-
|
|
45234
|
+
this.emitText(
|
|
45235
|
+
{ data: { entityId: entityId2, removed: this.keys, columns: current.columns } },
|
|
45236
|
+
() => `Removed ${this.keys.length} column${this.keys.length === 1 ? "" : "s"} from '${entity5.name}': ${this.keys.join(", ")}.`
|
|
45237
|
+
);
|
|
45070
45238
|
}
|
|
45071
45239
|
};
|
|
45240
|
+
|
|
45241
|
+
// ente/commands/listRows.ts
|
|
45242
|
+
import { readFileSync as readFileSync10 } from "node:fs";
|
|
45072
45243
|
var ListAdd = class extends ProfileCommand {
|
|
45073
45244
|
static paths = [["list", "add"]];
|
|
45074
45245
|
static usage = Command.Usage({
|
|
@@ -45131,15 +45302,6 @@ var ListAdd = class extends ProfileCommand {
|
|
|
45131
45302
|
);
|
|
45132
45303
|
}
|
|
45133
45304
|
};
|
|
45134
|
-
function columnOrThrow(columns, key, listName) {
|
|
45135
|
-
const col = columns.find((c) => c.key === key);
|
|
45136
|
-
if (!col) throw new Error(`--key '${key}' is not a column of list '${listName}'.`);
|
|
45137
|
-
if (col.type !== "text") throw new Error(`--key '${key}' must be a text column (it is ${col.type}).`);
|
|
45138
|
-
return col;
|
|
45139
|
-
}
|
|
45140
|
-
function toExisting(row) {
|
|
45141
|
-
return { rowId: row._id, title: row.title ?? null, attributes: row.attributes ?? {} };
|
|
45142
|
-
}
|
|
45143
45305
|
var ListUpdate = class extends ProfileCommand {
|
|
45144
45306
|
static paths = [["list", "update"]];
|
|
45145
45307
|
static usage = Command.Usage({
|
|
@@ -45289,66 +45451,93 @@ var ListImport = class extends ProfileCommand {
|
|
|
45289
45451
|
}
|
|
45290
45452
|
}
|
|
45291
45453
|
};
|
|
45292
|
-
|
|
45293
|
-
|
|
45454
|
+
|
|
45455
|
+
// ente/commands/list.ts
|
|
45456
|
+
var ListCreate = class extends ProfileCommand {
|
|
45457
|
+
static paths = [["list", "create"]];
|
|
45294
45458
|
static usage = Command.Usage({
|
|
45295
45459
|
category: "List",
|
|
45296
|
-
description: "
|
|
45297
|
-
examples: [
|
|
45460
|
+
description: "Create a database list (an entity with a databaseView; opens on its database view by default)",
|
|
45461
|
+
examples: [
|
|
45462
|
+
[
|
|
45463
|
+
"A Sarah-ideas list with a category column",
|
|
45464
|
+
'ente list create "Sarah \u2013 Ideen" --space Personal --column "kategorie:single-select:Aktivit\xE4t,Essen,Geschenk,Film"'
|
|
45465
|
+
],
|
|
45466
|
+
[
|
|
45467
|
+
"A recipe collection with labelled columns and an icon",
|
|
45468
|
+
'ente list create Rezepte --space "ivo&sarah" --icon book-open --column "protein_g=Protein (g):number" --column "vegan:boolean"'
|
|
45469
|
+
],
|
|
45470
|
+
[
|
|
45471
|
+
"A sync target pinned under a project",
|
|
45472
|
+
'ente list create Firmen --space "ivo&thomas" --pin Recherche --column "repo:text" --column "stage:single-select:Kandidat,in Review,verfolgt,verworfen"'
|
|
45473
|
+
]
|
|
45474
|
+
]
|
|
45298
45475
|
});
|
|
45299
|
-
|
|
45300
|
-
|
|
45301
|
-
|
|
45302
|
-
|
|
45303
|
-
|
|
45304
|
-
|
|
45305
|
-
|
|
45306
|
-
|
|
45307
|
-
|
|
45308
|
-
|
|
45309
|
-
|
|
45310
|
-
|
|
45311
|
-
|
|
45312
|
-
|
|
45313
|
-
|
|
45314
|
-
|
|
45315
|
-
{ data: { entityId: entityId2, added, columns } },
|
|
45316
|
-
() => `Added ${added.length} column${added.length === 1 ? "" : "s"} to '${entity5.name}': ${added.map((c) => c.key).join(", ")}.`
|
|
45317
|
-
);
|
|
45318
|
-
}
|
|
45319
|
-
};
|
|
45320
|
-
var ListColumnRemove = class extends ProfileCommand {
|
|
45321
|
-
static paths = [["list", "column", "remove"]];
|
|
45322
|
-
static usage = Command.Usage({
|
|
45323
|
-
category: "List",
|
|
45324
|
-
description: "Remove columns from a database list; their values are erased from every row",
|
|
45325
|
-
examples: [["Drop two columns", "ente list column remove Rezepte quelle kueche"]]
|
|
45476
|
+
name = options_exports.String();
|
|
45477
|
+
space = options_exports.String("--space", { required: true, description: "Space to create in (name or ID)" });
|
|
45478
|
+
type = options_exports.String("--type", "topic", { description: "Entity type: topic (default) or project" });
|
|
45479
|
+
column = options_exports.Array("--column", {
|
|
45480
|
+
description: "Column: key[=Label]:type[:opt1,opt2] (type \u2208 text|number|boolean|single-select|multi-select)"
|
|
45481
|
+
});
|
|
45482
|
+
description = options_exports.String("--description", { description: "Searchable description for the list" });
|
|
45483
|
+
icon = options_exports.String("--icon", {
|
|
45484
|
+
description: `Topic icon from the web icon picker: ${entityCustomIconIds.join(", ")}`
|
|
45485
|
+
});
|
|
45486
|
+
pin = options_exports.Array("--pin", { description: "Pin the list under parent entities (resolved by name)" });
|
|
45487
|
+
shareParents = options_exports.Boolean("--share-parents", false, {
|
|
45488
|
+
description: "Share pinned parents and ancestors into the list's space when required"
|
|
45489
|
+
});
|
|
45490
|
+
parentSpaceGrantFingerprint = options_exports.String("--parent-space-grant-fingerprint", {
|
|
45491
|
+
description: "Exact grantFingerprint returned by the confirmation-required error"
|
|
45326
45492
|
});
|
|
45327
|
-
list = options_exports.String();
|
|
45328
|
-
keys = options_exports.Rest({ required: 1 });
|
|
45329
45493
|
async run() {
|
|
45330
|
-
|
|
45331
|
-
|
|
45332
|
-
const present = new Set(view.columns.map((c) => c.key));
|
|
45333
|
-
const missing = this.keys.filter((key) => !present.has(key));
|
|
45334
|
-
if (missing.length > 0) {
|
|
45335
|
-
throw new Error(
|
|
45336
|
-
`Not a column of '${entity5.name}': ${missing.join(", ")}. Columns: ${[...present].join(", ") || "(none)"}.`
|
|
45337
|
-
);
|
|
45494
|
+
if (this.type !== "topic" && this.type !== "project") {
|
|
45495
|
+
throw new Error(`--type must be 'topic' or 'project' (got '${this.type}').`);
|
|
45338
45496
|
}
|
|
45339
|
-
|
|
45340
|
-
const
|
|
45341
|
-
|
|
45342
|
-
|
|
45343
|
-
|
|
45344
|
-
|
|
45345
|
-
|
|
45497
|
+
const columns = (this.column ?? []).map(parseColumn);
|
|
45498
|
+
const initialView = parseDatabaseWriteView({ version: 1, columns, filters: [], sorts: [] });
|
|
45499
|
+
parseEntityWriteRequest("createEntity", { name: this.name, type: this.type, spaceId: "pending-space-resolution" });
|
|
45500
|
+
if (this.icon !== void 0) assertListIcon(this.icon, this.type);
|
|
45501
|
+
const icon2 = this.icon !== void 0 ? parseEntityIcon(this.icon) : void 0;
|
|
45502
|
+
const caller = await resolveCaller();
|
|
45503
|
+
const spaceId2 = await resolveSpaceByNameC(caller, this.space);
|
|
45504
|
+
const listType = this.type === "project" ? "project" : "topic";
|
|
45505
|
+
const create3 = { spaceId: spaceId2, name: this.name, type: listType };
|
|
45506
|
+
parseEntityWriteRequest("createEntity", create3);
|
|
45507
|
+
const planned = ["create", ...columns.length ? ["columns"] : [], "tabs", ...this.description ? ["description"] : [], ...icon2 ? ["icon"] : [], "pins"];
|
|
45508
|
+
const progress = graphProgress(this, "list create", planned);
|
|
45509
|
+
const { entityId: entityId2, pins } = await progress.run(async () => {
|
|
45510
|
+
const entityId3 = await progress.write("create", () => databaseWrite(() => caller.mutation(entitiesCreate2, create3)), (raw) => projectEntityWriteResult("createEntity", raw).entityId, "entityId");
|
|
45511
|
+
if (columns.length > 0) {
|
|
45512
|
+
const args = parseDatabaseProtocolInput("entities:updateDatabaseView", databaseConfigurationContracts.updateDatabaseView.args, { id: entityId3, databaseView: initialView });
|
|
45513
|
+
await progress.write("columns", () => databaseWrite(() => caller.mutation(updateDatabaseView, args)), (raw) => parseOperationResult("entities:updateDatabaseView", databaseConfigurationContracts.updateDatabaseView.result, raw));
|
|
45514
|
+
}
|
|
45515
|
+
const tabs2 = parseDatabaseProtocolInput("entities:setEnabledTabs", databaseConfigurationContracts.setEnabledTabs.args, { entityId: entityId3, enabledTabs: DATABASE_LIST_TABS });
|
|
45516
|
+
await progress.write("tabs", () => databaseWrite(() => caller.mutation(setEnabledTabs, tabs2)), (raw) => parseOperationResult("entities:setEnabledTabs", databaseConfigurationContracts.setEnabledTabs.result, raw));
|
|
45517
|
+
if (this.description) {
|
|
45518
|
+
const args = descriptionArgs(entityId3, this.description);
|
|
45519
|
+
await progress.write("description", () => databaseWrite(() => caller.mutation(setDescriptionFromMarkdown, args)), (raw) => projectEntityWriteResult("updateEntity", raw));
|
|
45520
|
+
}
|
|
45521
|
+
if (icon2) {
|
|
45522
|
+
const args = parseDatabaseProtocolInput("entities:setCustomIcon", databaseConfigurationContracts.setCustomIcon.args, { id: entityId3, icon: icon2 });
|
|
45523
|
+
await progress.write("icon", () => databaseWrite(() => caller.mutation(setCustomIcon, args)), (raw) => parseOperationResult("entities:setCustomIcon", databaseConfigurationContracts.setCustomIcon.result, raw));
|
|
45346
45524
|
}
|
|
45525
|
+
const pins2 = await progress.observe("pins", () => pinToTargets(caller, entityId3, this.pin ?? [], {
|
|
45526
|
+
shareParents: this.shareParents,
|
|
45527
|
+
...this.parentSpaceGrantFingerprint ? { parentSpaceGrantFingerprint: this.parentSpaceGrantFingerprint } : {}
|
|
45528
|
+
}));
|
|
45529
|
+
const data = { entityId: entityId3, name: this.name, type: this.type, columns, enabledTabs: DATABASE_LIST_TABS };
|
|
45530
|
+
this.emitText(
|
|
45531
|
+
pins2.failures.length ? {
|
|
45532
|
+
data: { ...data, pinFailures: pins2.failures, pinSucceeded: pins2.succeeded },
|
|
45533
|
+
error: { message: pins2.failures.some((failure2) => failure2.outcome === "unknown" || failure2.outcome === "committed-unvalidated") ? "List created, but some parent relationships need inspection." : "List created, but some parent relationships failed.", code: "PARTIAL_SUCCESS" }
|
|
45534
|
+
} : { data: { ...data, ...pins2.succeeded.length ? { pinSucceeded: pins2.succeeded } : {} } },
|
|
45535
|
+
() => `Created list '${this.name}' (${entityId3}) with ${columns.length} column${columns.length === 1 ? "" : "s"}; opens on its database view.${pins2.succeeded.length ? `
|
|
45536
|
+
Pinned to: ${pins2.succeeded.join(", ")}` : ""}`
|
|
45537
|
+
);
|
|
45538
|
+
return { entityId: entityId3, pins: pins2 };
|
|
45347
45539
|
});
|
|
45348
|
-
this.
|
|
45349
|
-
{ data: { entityId: entityId2, removed: this.keys, columns: current.columns } },
|
|
45350
|
-
() => `Removed ${this.keys.length} column${this.keys.length === 1 ? "" : "s"} from '${entity5.name}': ${this.keys.join(", ")}.`
|
|
45351
|
-
);
|
|
45540
|
+
failOnPinFailures((line) => this.err(line), `List '${this.name}'`, entityId2, pins);
|
|
45352
45541
|
}
|
|
45353
45542
|
};
|
|
45354
45543
|
var ListShow = class extends ProfileCommand {
|
|
@@ -49494,20 +49683,20 @@ function readNotificationEmailAttachments(imagePaths = [], inlineImageSpecs = []
|
|
|
49494
49683
|
commandLabel: "notification send"
|
|
49495
49684
|
});
|
|
49496
49685
|
const attachments = [
|
|
49497
|
-
...imagePaths.map((
|
|
49686
|
+
...imagePaths.map((path11) => readOutgoingEmailAttachment(path11, {
|
|
49498
49687
|
maxBytes: CLI_LIMITS.maxAttachmentBytes,
|
|
49499
49688
|
maxFilenameLength: CLI_LIMITS.maxFilenameLength,
|
|
49500
49689
|
requireImage: true,
|
|
49501
49690
|
commandLabel: "notification send"
|
|
49502
49691
|
})),
|
|
49503
|
-
...inlineImages.map(({ contentId, path:
|
|
49692
|
+
...inlineImages.map(({ contentId, path: path11 }) => readOutgoingEmailAttachment(path11, {
|
|
49504
49693
|
maxBytes: CLI_LIMITS.maxAttachmentBytes,
|
|
49505
49694
|
maxFilenameLength: CLI_LIMITS.maxFilenameLength,
|
|
49506
49695
|
contentId,
|
|
49507
49696
|
requireImage: true,
|
|
49508
49697
|
commandLabel: "notification send"
|
|
49509
49698
|
})),
|
|
49510
|
-
...attachmentPaths.map((
|
|
49699
|
+
...attachmentPaths.map((path11) => readOutgoingEmailAttachment(path11, {
|
|
49511
49700
|
maxBytes: CLI_LIMITS.maxAttachmentBytes,
|
|
49512
49701
|
maxFilenameLength: CLI_LIMITS.maxFilenameLength,
|
|
49513
49702
|
commandLabel: "notification send"
|
|
@@ -50129,14 +50318,14 @@ function readAgentMailBodies(options) {
|
|
|
50129
50318
|
);
|
|
50130
50319
|
}
|
|
50131
50320
|
const attachments = [
|
|
50132
|
-
...inlineImages.map(({ path:
|
|
50321
|
+
...inlineImages.map(({ path: path11, contentId }) => readOutgoingEmailAttachment(path11, {
|
|
50133
50322
|
maxBytes: AGENT_MAIL_CLI_SURFACE.limits.maxAttachmentBytes,
|
|
50134
50323
|
maxFilenameLength: AGENT_MAIL_CLI_SURFACE.limits.maxFilenameLength,
|
|
50135
50324
|
contentId,
|
|
50136
50325
|
requireImage: true,
|
|
50137
50326
|
commandLabel: "agent mail"
|
|
50138
50327
|
})),
|
|
50139
|
-
...paths.map((
|
|
50328
|
+
...paths.map((path11) => readOutgoingEmailAttachment(path11, {
|
|
50140
50329
|
maxBytes: AGENT_MAIL_CLI_SURFACE.limits.maxAttachmentBytes,
|
|
50141
50330
|
maxFilenameLength: AGENT_MAIL_CLI_SURFACE.limits.maxFilenameLength,
|
|
50142
50331
|
commandLabel: "agent mail"
|
|
@@ -50420,6 +50609,343 @@ var AGENT_MAIL_COMMANDS = [
|
|
|
50420
50609
|
AgentMailMark
|
|
50421
50610
|
];
|
|
50422
50611
|
|
|
50612
|
+
// ente/commands/update.ts
|
|
50613
|
+
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
50614
|
+
import { existsSync as existsSync8, readFileSync as readFileSync19 } from "node:fs";
|
|
50615
|
+
|
|
50616
|
+
// ente/migrationState.ts
|
|
50617
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync5, readFileSync as readFileSync17, writeFileSync as writeFileSync8 } from "node:fs";
|
|
50618
|
+
import path9 from "node:path";
|
|
50619
|
+
var MIGRATION_STATE_FILE = "registry_migration.json";
|
|
50620
|
+
function readMigrationState(cacheDir, key) {
|
|
50621
|
+
try {
|
|
50622
|
+
const file2 = path9.join(cacheDir, MIGRATION_STATE_FILE);
|
|
50623
|
+
if (!existsSync6(file2)) return void 0;
|
|
50624
|
+
const value = JSON.parse(readFileSync17(file2, "utf8"))[key];
|
|
50625
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
50626
|
+
} catch {
|
|
50627
|
+
return void 0;
|
|
50628
|
+
}
|
|
50629
|
+
}
|
|
50630
|
+
function writeMigrationState(cacheDir, key, value) {
|
|
50631
|
+
try {
|
|
50632
|
+
const file2 = path9.join(cacheDir, MIGRATION_STATE_FILE);
|
|
50633
|
+
let state = {};
|
|
50634
|
+
try {
|
|
50635
|
+
if (existsSync6(file2)) state = JSON.parse(readFileSync17(file2, "utf8"));
|
|
50636
|
+
} catch {
|
|
50637
|
+
}
|
|
50638
|
+
mkdirSync5(cacheDir, { recursive: true });
|
|
50639
|
+
writeFileSync8(file2, JSON.stringify({ ...state, [key]: value }));
|
|
50640
|
+
return true;
|
|
50641
|
+
} catch {
|
|
50642
|
+
return false;
|
|
50643
|
+
}
|
|
50644
|
+
}
|
|
50645
|
+
|
|
50646
|
+
// ente/installSource.ts
|
|
50647
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
50648
|
+
import { existsSync as existsSync7, readFileSync as readFileSync18 } from "node:fs";
|
|
50649
|
+
import os3 from "node:os";
|
|
50650
|
+
import path10 from "node:path";
|
|
50651
|
+
import { fileURLToPath } from "node:url";
|
|
50652
|
+
var NPM_REGISTRY_URL = "https://registry.npmjs.org";
|
|
50653
|
+
var GITEA_REGISTRY_HOST = "gitea.i.ivo-zilkenat.de";
|
|
50654
|
+
var GITEA_REGISTRY_URL = `https://${GITEA_REGISTRY_HOST}/api/packages/ivo.zilkenat/npm`;
|
|
50655
|
+
var PACKAGE_NAME = "ente-cli";
|
|
50656
|
+
function classifyRegistryUrl(url2) {
|
|
50657
|
+
if (!url2) return "unknown";
|
|
50658
|
+
let host;
|
|
50659
|
+
try {
|
|
50660
|
+
host = new URL(url2.trim()).hostname.toLowerCase();
|
|
50661
|
+
} catch {
|
|
50662
|
+
return "unknown";
|
|
50663
|
+
}
|
|
50664
|
+
if (host === GITEA_REGISTRY_HOST) return "gitea";
|
|
50665
|
+
if (host === "registry.npmjs.org" || host === "registry.npmjs.com") return "npm";
|
|
50666
|
+
return "unknown";
|
|
50667
|
+
}
|
|
50668
|
+
function installedPackageDir(fromFile) {
|
|
50669
|
+
let dir = path10.dirname(fromFile);
|
|
50670
|
+
for (let depth = 0; depth < 4; depth += 1) {
|
|
50671
|
+
if (path10.basename(dir) === PACKAGE_NAME && path10.basename(path10.dirname(dir)) === "node_modules") return dir;
|
|
50672
|
+
const parent = path10.dirname(dir);
|
|
50673
|
+
if (parent === dir) break;
|
|
50674
|
+
dir = parent;
|
|
50675
|
+
}
|
|
50676
|
+
return null;
|
|
50677
|
+
}
|
|
50678
|
+
function sourceFromLockfile(text3) {
|
|
50679
|
+
try {
|
|
50680
|
+
const lock = JSON.parse(text3);
|
|
50681
|
+
const resolved = lock.packages?.[`node_modules/${PACKAGE_NAME}`]?.resolved;
|
|
50682
|
+
return typeof resolved === "string" ? classifyRegistryUrl(resolved) : "unknown";
|
|
50683
|
+
} catch {
|
|
50684
|
+
return "unknown";
|
|
50685
|
+
}
|
|
50686
|
+
}
|
|
50687
|
+
function tarballUrls(version5) {
|
|
50688
|
+
return {
|
|
50689
|
+
npm: [`${NPM_REGISTRY_URL}/${PACKAGE_NAME}/-/${PACKAGE_NAME}-${version5}.tgz`],
|
|
50690
|
+
gitea: [
|
|
50691
|
+
`${GITEA_REGISTRY_URL}/${PACKAGE_NAME}/-/${PACKAGE_NAME}-${version5}.tgz`,
|
|
50692
|
+
`${GITEA_REGISTRY_URL}/${PACKAGE_NAME}/-/${version5}/${PACKAGE_NAME}-${version5}.tgz`
|
|
50693
|
+
]
|
|
50694
|
+
};
|
|
50695
|
+
}
|
|
50696
|
+
function npmCacheDir(env = process.env) {
|
|
50697
|
+
const fromEnv = env.npm_config_cache || env.NPM_CONFIG_CACHE;
|
|
50698
|
+
if (fromEnv) return fromEnv;
|
|
50699
|
+
try {
|
|
50700
|
+
const file2 = userNpmrcPath(env);
|
|
50701
|
+
if (existsSync7(file2)) {
|
|
50702
|
+
const match = /^\s*cache\s*=\s*(.+?)\s*$/im.exec(readFileSync18(file2, "utf8"));
|
|
50703
|
+
if (match) return match[1].replace(/^~(?=$|[\\/])/, os3.homedir());
|
|
50704
|
+
}
|
|
50705
|
+
} catch {
|
|
50706
|
+
}
|
|
50707
|
+
return process.platform === "win32" && env.LOCALAPPDATA ? path10.join(env.LOCALAPPDATA, "npm-cache") : path10.join(os3.homedir(), ".npm");
|
|
50708
|
+
}
|
|
50709
|
+
function cachedFetchTime(cacheDir, url2) {
|
|
50710
|
+
const hash2 = createHash5("sha256").update(`make-fetch-happen:request-cache:${url2}`).digest("hex");
|
|
50711
|
+
const bucket = path10.join(cacheDir, "_cacache", "index-v5", hash2.slice(0, 2), hash2.slice(2, 4), hash2.slice(4));
|
|
50712
|
+
if (!existsSync7(bucket)) return null;
|
|
50713
|
+
let latest = null;
|
|
50714
|
+
for (const line of readFileSync18(bucket, "utf8").split("\n")) {
|
|
50715
|
+
const tab = line.indexOf(" ");
|
|
50716
|
+
if (tab < 0) continue;
|
|
50717
|
+
try {
|
|
50718
|
+
const entry = JSON.parse(line.slice(tab + 1));
|
|
50719
|
+
if (typeof entry.time === "number" && entry.integrity !== null) latest = Math.max(latest ?? 0, entry.time);
|
|
50720
|
+
} catch {
|
|
50721
|
+
}
|
|
50722
|
+
}
|
|
50723
|
+
return latest;
|
|
50724
|
+
}
|
|
50725
|
+
function sourceFromNpmCache(cacheDir, version5, npmInstalledAt) {
|
|
50726
|
+
const urls = tarballUrls(version5);
|
|
50727
|
+
const newest = (list2) => Math.max(-1, ...list2.map((url2) => cachedFetchTime(cacheDir, url2) ?? -1));
|
|
50728
|
+
const npm = Math.max(newest(urls.npm), npmInstalledAt ?? -1);
|
|
50729
|
+
const gitea = newest(urls.gitea);
|
|
50730
|
+
if (npm < 0 && gitea < 0) return "unknown";
|
|
50731
|
+
return gitea > npm ? "gitea" : "npm";
|
|
50732
|
+
}
|
|
50733
|
+
function detectInstallSource(options = {}) {
|
|
50734
|
+
try {
|
|
50735
|
+
const packageDir = installedPackageDir(options.fromFile ?? currentFile());
|
|
50736
|
+
if (!packageDir) return "unknown";
|
|
50737
|
+
const lockfile = path10.join(path10.dirname(packageDir), ".package-lock.json");
|
|
50738
|
+
if (existsSync7(lockfile)) {
|
|
50739
|
+
const fromLock = sourceFromLockfile(readFileSync18(lockfile, "utf8"));
|
|
50740
|
+
if (fromLock !== "unknown") return fromLock;
|
|
50741
|
+
}
|
|
50742
|
+
const version5 = options.version ?? installedVersion(packageDir);
|
|
50743
|
+
if (!version5) return "unknown";
|
|
50744
|
+
return sourceFromNpmCache(options.cacheDir ?? npmCacheDir(), version5, options.npmInstalledAt);
|
|
50745
|
+
} catch {
|
|
50746
|
+
return "unknown";
|
|
50747
|
+
}
|
|
50748
|
+
}
|
|
50749
|
+
function installedVersion(packageDir) {
|
|
50750
|
+
try {
|
|
50751
|
+
const version5 = JSON.parse(readFileSync18(path10.join(packageDir, "package.json"), "utf8")).version;
|
|
50752
|
+
return typeof version5 === "string" && /^[0-9A-Za-z.+-]{1,32}$/.test(version5) ? version5 : null;
|
|
50753
|
+
} catch {
|
|
50754
|
+
return null;
|
|
50755
|
+
}
|
|
50756
|
+
}
|
|
50757
|
+
function currentFile() {
|
|
50758
|
+
try {
|
|
50759
|
+
return fileURLToPath(import.meta.url);
|
|
50760
|
+
} catch {
|
|
50761
|
+
return "";
|
|
50762
|
+
}
|
|
50763
|
+
}
|
|
50764
|
+
function registryFromNpmrc(text3) {
|
|
50765
|
+
let registry2 = null;
|
|
50766
|
+
for (const raw of text3.split(/\r?\n/)) {
|
|
50767
|
+
const line = raw.trim();
|
|
50768
|
+
if (!line || line.startsWith("#") || line.startsWith(";")) continue;
|
|
50769
|
+
const match = /^registry\s*=\s*(.+)$/i.exec(line);
|
|
50770
|
+
if (match) registry2 = match[1].trim().replace(/^["']|["']$/g, "");
|
|
50771
|
+
}
|
|
50772
|
+
return registry2;
|
|
50773
|
+
}
|
|
50774
|
+
function userNpmrcPath(env = process.env) {
|
|
50775
|
+
return env.NPM_CONFIG_USERCONFIG || env.npm_config_userconfig || path10.join(os3.homedir(), ".npmrc");
|
|
50776
|
+
}
|
|
50777
|
+
function giteaNpmrcHint(effectiveRegistry, userNpmrcText) {
|
|
50778
|
+
if (classifyRegistryUrl(effectiveRegistry) !== "gitea") return null;
|
|
50779
|
+
const inUserFile = classifyRegistryUrl(registryFromNpmrc(userNpmrcText ?? "")) === "gitea";
|
|
50780
|
+
const why = "Your npm config sets registry to Ivo's Gitea registry, so a plain 'npm i -g ente-cli' (and other npm installs) would still use Gitea. 'ente update' always installs from npm.";
|
|
50781
|
+
return inUserFile ? `${why} To remove that line from your ~/.npmrc, run: npm config delete registry` : `${why} It is not set in your ~/.npmrc; find where with: npm config ls -l | grep registry`;
|
|
50782
|
+
}
|
|
50783
|
+
|
|
50784
|
+
// ente/commands/update.ts
|
|
50785
|
+
function updateCommandArgs() {
|
|
50786
|
+
return ["i", "-g", `${ENTE_BRANDING.packageName}@latest`, "--registry", NPM_REGISTRY_URL];
|
|
50787
|
+
}
|
|
50788
|
+
var UPDATE_SHELL_COMMAND = ["npm", ...updateCommandArgs()].join(" ");
|
|
50789
|
+
var MOVING_TO_NPM_NOTICE = "This ente CLI was installed from Ivo's Gitea registry; installing it from npm (registry.npmjs.org) instead.";
|
|
50790
|
+
var updateRunner = {
|
|
50791
|
+
run(command, args, json4) {
|
|
50792
|
+
return spawnSync2(command, args, {
|
|
50793
|
+
stdio: json4 ? ["ignore", 2, 2] : "inherit",
|
|
50794
|
+
shell: process.platform === "win32"
|
|
50795
|
+
});
|
|
50796
|
+
},
|
|
50797
|
+
installSource() {
|
|
50798
|
+
return detectInstallSource({ npmInstalledAt: readMigrationState(configDir(ENTE_BRANDING), "npm_installed_at") });
|
|
50799
|
+
},
|
|
50800
|
+
recordNpmInstall(at) {
|
|
50801
|
+
writeMigrationState(configDir(ENTE_BRANDING), "npm_installed_at", at);
|
|
50802
|
+
},
|
|
50803
|
+
/** npm's effective `registry` setting, or null when npm cannot answer. */
|
|
50804
|
+
npmRegistry() {
|
|
50805
|
+
try {
|
|
50806
|
+
const result = spawnSync2("npm", ["config", "get", "registry"], {
|
|
50807
|
+
encoding: "utf8",
|
|
50808
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
50809
|
+
timeout: 1e4,
|
|
50810
|
+
shell: process.platform === "win32"
|
|
50811
|
+
});
|
|
50812
|
+
return result.status === 0 ? result.stdout.trim() || null : null;
|
|
50813
|
+
} catch {
|
|
50814
|
+
return null;
|
|
50815
|
+
}
|
|
50816
|
+
},
|
|
50817
|
+
userNpmrc() {
|
|
50818
|
+
try {
|
|
50819
|
+
const file2 = userNpmrcPath();
|
|
50820
|
+
return existsSync8(file2) ? readFileSync19(file2, "utf8") : null;
|
|
50821
|
+
} catch {
|
|
50822
|
+
return null;
|
|
50823
|
+
}
|
|
50824
|
+
}
|
|
50825
|
+
};
|
|
50826
|
+
function installLatestFromNpm(stderr, json4, options = {}) {
|
|
50827
|
+
const installSource = updateRunner.installSource();
|
|
50828
|
+
if (installSource === "gitea" && options.announceMove !== false) stderr.write(`${MOVING_TO_NPM_NOTICE}
|
|
50829
|
+
`);
|
|
50830
|
+
if (!json4) stderr.write(`Running: ${UPDATE_SHELL_COMMAND}
|
|
50831
|
+
`);
|
|
50832
|
+
const result = updateRunner.run("npm", updateCommandArgs(), json4);
|
|
50833
|
+
if (result.error || result.status !== 0) {
|
|
50834
|
+
const reason = result.error ? result.error.message : `npm exited with ${result.status ?? "a signal"}`;
|
|
50835
|
+
throw new Error(`Could not update ente-cli (${reason}). Run it yourself: ${UPDATE_SHELL_COMMAND}`);
|
|
50836
|
+
}
|
|
50837
|
+
updateRunner.recordNpmInstall(Date.now());
|
|
50838
|
+
const npmrcHint = giteaNpmrcHint(updateRunner.npmRegistry(), updateRunner.userNpmrc());
|
|
50839
|
+
if (npmrcHint) stderr.write(`${npmrcHint}
|
|
50840
|
+
`);
|
|
50841
|
+
return { command: UPDATE_SHELL_COMMAND, installSource, npmrcHint };
|
|
50842
|
+
}
|
|
50843
|
+
var Update = class extends BaseCommand {
|
|
50844
|
+
static paths = [["update"]];
|
|
50845
|
+
static usage = Command.Usage({
|
|
50846
|
+
category: "Help",
|
|
50847
|
+
description: "Install the latest ente-cli globally from npm",
|
|
50848
|
+
details: `Runs \`${UPDATE_SHELL_COMMAND}\`. The explicit registry means an npmrc pointing elsewhere (such as Ivo's legacy Gitea registry) cannot redirect it; a CLI installed from Gitea moves to npm. Use \`--dry-run\` to print the command instead. Does not contact the ente server.`,
|
|
50849
|
+
examples: [["Update from npm", "ente update"], ["Print the install command", "ente update --dry-run"]]
|
|
50850
|
+
});
|
|
50851
|
+
registry = options_exports.String("--registry", "npm", { description: "Always npm; kept so existing scripts keep working" });
|
|
50852
|
+
dryRun = options_exports.Boolean("--dry-run", false, { description: "Print the install command without running it" });
|
|
50853
|
+
async run() {
|
|
50854
|
+
if (this.registry !== "npm") {
|
|
50855
|
+
throw new Error(`'ente update' installs only from npm; '--registry ${this.registry}' is no longer supported. Run 'ente update'.`);
|
|
50856
|
+
}
|
|
50857
|
+
const previousVersion = ENTE_BRANDING.version;
|
|
50858
|
+
if (this.dryRun) {
|
|
50859
|
+
this.emitText({ command: UPDATE_SHELL_COMMAND, previousVersion, ran: false }, () => UPDATE_SHELL_COMMAND);
|
|
50860
|
+
return;
|
|
50861
|
+
}
|
|
50862
|
+
const result = installLatestFromNpm(this.context.stderr, this.json);
|
|
50863
|
+
this.emitText(
|
|
50864
|
+
{ ...result, previousVersion, ran: true },
|
|
50865
|
+
() => `Updated ente-cli (was ${previousVersion}). Run 'ente --version' to confirm.`
|
|
50866
|
+
);
|
|
50867
|
+
}
|
|
50868
|
+
};
|
|
50869
|
+
var UPDATE_COMMANDS = [Update];
|
|
50870
|
+
|
|
50871
|
+
// ente/registryMigration.ts
|
|
50872
|
+
import { createInterface } from "node:readline";
|
|
50873
|
+
var NO_UPDATE_PROMPT_ENV = "ENTE_CLI_NO_UPDATE_PROMPT";
|
|
50874
|
+
var MIGRATION_QUESTION = "This ente CLI was installed from Ivo's Gitea registry. Move to npm now? [Y/n] ";
|
|
50875
|
+
var MIGRATION_NOTICE = "[ente-cli] This CLI was installed from Ivo's Gitea registry. Run 'ente update' to move it to npm.";
|
|
50876
|
+
var DAY_MS = 864e5;
|
|
50877
|
+
var SKIP_COMMANDS = /* @__PURE__ */ new Set(["", "update", "--version", "-V", "--help", "-h", "help"]);
|
|
50878
|
+
function commandWord(argv) {
|
|
50879
|
+
return (argv[0] === "--profile" ? argv[2] : argv[0]) ?? "";
|
|
50880
|
+
}
|
|
50881
|
+
function wantsJson(argv) {
|
|
50882
|
+
return argv.some((arg) => arg === "--json" || arg.startsWith("--json="));
|
|
50883
|
+
}
|
|
50884
|
+
function truthyEnv(value) {
|
|
50885
|
+
return value !== void 0 && value !== "" && value !== "0" && value.toLowerCase() !== "false";
|
|
50886
|
+
}
|
|
50887
|
+
function isInteractive(options) {
|
|
50888
|
+
return options.stdin.isTTY === true && options.stdout.isTTY === true && options.stderr.isTTY === true && !wantsJson(options.argv) && !truthyEnv(options.env.CI);
|
|
50889
|
+
}
|
|
50890
|
+
function askOnTty(stdin, stderr, question) {
|
|
50891
|
+
return new Promise((resolve2) => {
|
|
50892
|
+
const rl = createInterface({ input: stdin, output: stderr, terminal: true });
|
|
50893
|
+
let answered = false;
|
|
50894
|
+
rl.question(question, (answer) => {
|
|
50895
|
+
answered = true;
|
|
50896
|
+
rl.close();
|
|
50897
|
+
resolve2(answer);
|
|
50898
|
+
});
|
|
50899
|
+
rl.on("SIGINT", () => {
|
|
50900
|
+
answered = true;
|
|
50901
|
+
rl.close();
|
|
50902
|
+
stderr.write("\n");
|
|
50903
|
+
process.exit(130);
|
|
50904
|
+
});
|
|
50905
|
+
rl.on("close", () => {
|
|
50906
|
+
if (!answered) resolve2("n");
|
|
50907
|
+
});
|
|
50908
|
+
});
|
|
50909
|
+
}
|
|
50910
|
+
async function offerRegistryMigration(options) {
|
|
50911
|
+
try {
|
|
50912
|
+
if (options.source !== "gitea" || SKIP_COMMANDS.has(commandWord(options.argv))) return "none";
|
|
50913
|
+
const now = options.now ?? Date.now();
|
|
50914
|
+
const promptAllowed = isInteractive(options) && !truthyEnv(options.env[NO_UPDATE_PROMPT_ENV]);
|
|
50915
|
+
const key = promptAllowed ? "last_prompt" : "last_notice";
|
|
50916
|
+
const last = readMigrationState(options.cacheDir, key);
|
|
50917
|
+
if (last !== void 0 && last <= now && now - last < DAY_MS) return "none";
|
|
50918
|
+
if (!writeMigrationState(options.cacheDir, key, now)) return "none";
|
|
50919
|
+
if (!promptAllowed) {
|
|
50920
|
+
options.stderr.write(`${MIGRATION_NOTICE}
|
|
50921
|
+
`);
|
|
50922
|
+
return "notice";
|
|
50923
|
+
}
|
|
50924
|
+
const ask = options.ask ?? ((question) => askOnTty(options.stdin, options.stderr, question));
|
|
50925
|
+
const answer = (await ask(MIGRATION_QUESTION)).trim().toLowerCase();
|
|
50926
|
+
if (answer !== "" && answer !== "y" && answer !== "yes") {
|
|
50927
|
+
options.stderr.write(`Not now. Run 'ente update' any time to move to npm (asked again tomorrow; set ${NO_UPDATE_PROMPT_ENV}=1 to stop asking).
|
|
50928
|
+
`);
|
|
50929
|
+
return "declined";
|
|
50930
|
+
}
|
|
50931
|
+
const migrate = options.migrate ?? (() => {
|
|
50932
|
+
installLatestFromNpm(options.stderr, false, { announceMove: false });
|
|
50933
|
+
});
|
|
50934
|
+
try {
|
|
50935
|
+
migrate();
|
|
50936
|
+
} catch (error62) {
|
|
50937
|
+
options.stderr.write(`${errorMessage(error62)}
|
|
50938
|
+
Continuing with your command.
|
|
50939
|
+
`);
|
|
50940
|
+
return "failed";
|
|
50941
|
+
}
|
|
50942
|
+
options.stderr.write("Moved ente-cli to npm. Continuing with your command; the new version runs from the next command on.\n");
|
|
50943
|
+
return "migrated";
|
|
50944
|
+
} catch {
|
|
50945
|
+
return "none";
|
|
50946
|
+
}
|
|
50947
|
+
}
|
|
50948
|
+
|
|
50423
50949
|
// cli.ts
|
|
50424
50950
|
acceptUnknownResultFields();
|
|
50425
50951
|
var cli = new Cli({
|
|
@@ -50434,6 +50960,7 @@ for (const Cmd of [
|
|
|
50434
50960
|
...IDENTITY_COMMANDS,
|
|
50435
50961
|
...ENTITY_COMMANDS,
|
|
50436
50962
|
...ACTIVITY_COMMANDS,
|
|
50963
|
+
...ACTIVITY_MESSAGE_COMMANDS,
|
|
50437
50964
|
...ACTIVITY_TRANSCRIPT_COMMANDS,
|
|
50438
50965
|
...TASK_COMMANDS,
|
|
50439
50966
|
...LIST_COMMANDS,
|
|
@@ -50452,22 +50979,35 @@ for (const Cmd of [
|
|
|
50452
50979
|
...FILES_COMMANDS,
|
|
50453
50980
|
...NOTIFICATION_COMMANDS,
|
|
50454
50981
|
...AGENT_MAIL_COMMANDS,
|
|
50455
|
-
...AGENT_TASK_COMMANDS
|
|
50982
|
+
...AGENT_TASK_COMMANDS,
|
|
50983
|
+
...UPDATE_COMMANDS
|
|
50456
50984
|
]) {
|
|
50457
50985
|
cli.register(Cmd);
|
|
50458
50986
|
}
|
|
50459
|
-
var SKIP_UPDATE = /* @__PURE__ */ new Set(["auth", "--help", "-h", "--version", "-V"]);
|
|
50987
|
+
var SKIP_UPDATE = /* @__PURE__ */ new Set(["auth", "update", "--help", "-h", "--version", "-V"]);
|
|
50988
|
+
var OFFLINE = /* @__PURE__ */ new Set(["update", "--version", "-V"]);
|
|
50460
50989
|
async function main() {
|
|
50461
50990
|
const argv = process.argv.slice(2);
|
|
50991
|
+
const migration = await offerRegistryMigration({
|
|
50992
|
+
argv,
|
|
50993
|
+
source: updateRunner.installSource(),
|
|
50994
|
+
env: process.env,
|
|
50995
|
+
stdin: process.stdin,
|
|
50996
|
+
stdout: process.stdout,
|
|
50997
|
+
stderr: process.stderr,
|
|
50998
|
+
cacheDir: configDir(ENTE_BRANDING)
|
|
50999
|
+
});
|
|
50462
51000
|
const profileIndex = argv.indexOf("--profile");
|
|
50463
51001
|
const previousProfile = process.env.ENTE_PROFILE;
|
|
50464
51002
|
if (profileIndex >= 0 && argv[profileIndex + 1]) process.env.ENTE_PROFILE = argv[profileIndex + 1];
|
|
50465
51003
|
let adminSetup = false;
|
|
50466
51004
|
try {
|
|
50467
|
-
|
|
50468
|
-
|
|
50469
|
-
|
|
50470
|
-
|
|
51005
|
+
if (!OFFLINE.has(argv[0] ?? "")) {
|
|
51006
|
+
const context = await EnteClient.fromConfig(ENTE_BRANDING).getAuthContext();
|
|
51007
|
+
adminSetup = context.data.capabilities?.includes("accountSetup") === true;
|
|
51008
|
+
if (context.data.capabilities?.includes("globalHealth")) for (const Cmd of HEALTH_COMMANDS.filter((Cmd2) => Cmd2.paths[0]?.[0] === "diagnostics")) cli.register(Cmd);
|
|
51009
|
+
if (adminSetup) for (const Cmd of ADMIN_SETTINGS_COMMANDS) cli.register(Cmd);
|
|
51010
|
+
}
|
|
50471
51011
|
} catch {
|
|
50472
51012
|
} finally {
|
|
50473
51013
|
if (previousProfile === void 0) delete process.env.ENTE_PROFILE;
|
|
@@ -50479,7 +51019,7 @@ async function main() {
|
|
|
50479
51019
|
if (argv.includes("recording")) for (const Cmd of RECORDINGS_COMMANDS) cli.register(Cmd);
|
|
50480
51020
|
if (argv.includes("health")) for (const Cmd of HEALTH_COMMANDS.filter((Cmd2) => Cmd2.paths[0]?.[0] === "health")) cli.register(Cmd);
|
|
50481
51021
|
if (argv.includes("admin") && argv.some((value) => ["tables", "get", "page"].includes(value))) for (const Cmd of ADMIN_INSPECT_COMMANDS) cli.register(Cmd);
|
|
50482
|
-
if (!SKIP_UPDATE.has(argv[0] ?? "")) {
|
|
51022
|
+
if (!SKIP_UPDATE.has(argv[0] ?? "") && migration !== "migrated") {
|
|
50483
51023
|
await checkForUpdate({
|
|
50484
51024
|
packageName: ENTE_BRANDING.packageName,
|
|
50485
51025
|
registryUrl: ENTE_BRANDING.registryUrl,
|