ente-cli 0.4.123 → 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 +20 -1
- package/dist/cli.mjs +1235 -688
- 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) });
|
|
@@ -27855,13 +27856,20 @@ var activityFieldFiltersSchema = external_exports.union([activityFieldFilterSche
|
|
|
27855
27856
|
var activityFieldFilterValidator = v.object({ label: v.string(), value: v.string() });
|
|
27856
27857
|
var activityFieldFiltersValidator = v.union(activityFieldFilterValidator, v.array(activityFieldFilterValidator));
|
|
27857
27858
|
var activityFieldReadFields = { fields: v.optional(v.array(externalActivityFieldValueValidator)), fieldIndexReady: v.optional(v.boolean()), fieldConsumerReady: v.optional(v.boolean()) };
|
|
27859
|
+
var labelEvidenceValidator = v.object({ label: v.string(), count: v.number(), at: v.number(), id: v.string() });
|
|
27858
27860
|
var activityFieldPlanSummaryValidator = v.object({
|
|
27859
|
-
variants: v.array(
|
|
27861
|
+
variants: v.array(labelEvidenceValidator),
|
|
27860
27862
|
types: v.array(activityFieldTypeValidator),
|
|
27861
27863
|
textBoolean: v.boolean(),
|
|
27862
27864
|
textNumeric: v.boolean(),
|
|
27865
|
+
// Retained for saved pre-v3 planning rows; new generations use the separate votes below.
|
|
27863
27866
|
configured: v.optional(v.object({ label: v.string(), type: activityFieldTypeValidator, at: v.number(), id: v.string() })),
|
|
27864
|
-
|
|
27867
|
+
configuredLabels: v.optional(v.array(labelEvidenceValidator)),
|
|
27868
|
+
configuredTypes: v.optional(v.array(activityFieldTypeValidator)),
|
|
27869
|
+
canonical: v.optional(v.object({ label: v.string(), type: activityFieldTypeValidator })),
|
|
27870
|
+
existing: v.optional(v.object({ label: v.string(), type: activityFieldTypeValidator })),
|
|
27871
|
+
options: v.optional(v.array(activityFieldOptionValidator)),
|
|
27872
|
+
resolvedLabel: v.optional(v.string())
|
|
27865
27873
|
});
|
|
27866
27874
|
var MAX_ACTIVITY_FIELD_DEFINITION_READ_BYTES = 6 * 1024 * 1024;
|
|
27867
27875
|
|
|
@@ -28056,6 +28064,19 @@ var attributeStringPatch = external_exports.record(external_exports.string(), ex
|
|
|
28056
28064
|
}).meta({ patternProperties: ATTRIBUTE_STRING_PATCH_JSON_SCHEMA.patternProperties, additionalProperties: ATTRIBUTE_STRING_PATCH_JSON_SCHEMA.additionalProperties });
|
|
28057
28065
|
|
|
28058
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
|
+
} };
|
|
28059
28080
|
var MAX_ACTIVITY_AGENT_ASSIGNEES = 20;
|
|
28060
28081
|
var ACTIVITY_TYPE_VALUES = ["note", "conversation", "meeting", "call", "message", "task"];
|
|
28061
28082
|
var ACTIVITY_CREATE_SOURCE_CREATED_AT_DESCRIPTION = SOURCE_CREATED_AT_DESCRIPTION;
|
|
@@ -28074,6 +28095,7 @@ var activityUpdateInputProperties = {
|
|
|
28074
28095
|
description: "Replace linked entities with this non-empty set."
|
|
28075
28096
|
},
|
|
28076
28097
|
type: { type: "string", enum: ACTIVITY_TYPE_VALUES },
|
|
28098
|
+
fields: fieldsJsonSchema,
|
|
28077
28099
|
attributes: {
|
|
28078
28100
|
...ATTRIBUTE_STRING_PATCH_JSON_SCHEMA,
|
|
28079
28101
|
description: "Activity attributes. Set a value to null to remove it."
|
|
@@ -28134,12 +28156,12 @@ var ValidationError = class extends Error {
|
|
|
28134
28156
|
expected;
|
|
28135
28157
|
got;
|
|
28136
28158
|
path;
|
|
28137
|
-
constructor(expected, got,
|
|
28138
|
-
const message3 = `Validator error${
|
|
28159
|
+
constructor(expected, got, path11) {
|
|
28160
|
+
const message3 = `Validator error${path11 ? ` for ${path11}` : ""}: Expected \`${expected}\`, got \`${got}\``;
|
|
28139
28161
|
super(message3);
|
|
28140
28162
|
this.expected = expected;
|
|
28141
28163
|
this.got = got;
|
|
28142
|
-
this.path =
|
|
28164
|
+
this.path = path11;
|
|
28143
28165
|
this.name = "ValidationError";
|
|
28144
28166
|
}
|
|
28145
28167
|
};
|
|
@@ -28222,10 +28244,10 @@ function validate2(validator, value, opts) {
|
|
|
28222
28244
|
break;
|
|
28223
28245
|
}
|
|
28224
28246
|
for (const [index, v3] of value.entries()) {
|
|
28225
|
-
const
|
|
28247
|
+
const path11 = `${opts?._pathPrefix ?? ""}[${index}]`;
|
|
28226
28248
|
valid2 = validate2(validator.element, v3, {
|
|
28227
28249
|
...opts,
|
|
28228
|
-
_pathPrefix:
|
|
28250
|
+
_pathPrefix: path11
|
|
28229
28251
|
});
|
|
28230
28252
|
if (!valid2) {
|
|
28231
28253
|
expected = validator.element.kind;
|
|
@@ -28323,8 +28345,8 @@ function validate2(validator, value, opts) {
|
|
|
28323
28345
|
}
|
|
28324
28346
|
return valid2;
|
|
28325
28347
|
}
|
|
28326
|
-
function appendPath(opts,
|
|
28327
|
-
return opts?._pathPrefix ? `${opts._pathPrefix}.${
|
|
28348
|
+
function appendPath(opts, path11) {
|
|
28349
|
+
return opts?._pathPrefix ? `${opts._pathPrefix}.${path11}` : path11;
|
|
28328
28350
|
}
|
|
28329
28351
|
|
|
28330
28352
|
// ../packages/shared/src/operation-validation.ts
|
|
@@ -28584,6 +28606,28 @@ var ExitWithCode = class extends Error {
|
|
|
28584
28606
|
this.code = code3;
|
|
28585
28607
|
}
|
|
28586
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
|
+
}
|
|
28587
28631
|
|
|
28588
28632
|
// core/output.ts
|
|
28589
28633
|
function emit(stdout, data, json4, rowsFn, headers) {
|
|
@@ -28620,8 +28664,9 @@ function renderTable(rows, headers) {
|
|
|
28620
28664
|
|
|
28621
28665
|
// core/errorOutput.ts
|
|
28622
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);
|
|
28623
28668
|
if (!json4) {
|
|
28624
|
-
stderr.write(`Error: ${
|
|
28669
|
+
stderr.write(`Error: ${message3}
|
|
28625
28670
|
`);
|
|
28626
28671
|
return;
|
|
28627
28672
|
}
|
|
@@ -28629,11 +28674,14 @@ function writeCommandError(stdout, stderr, json4, error62) {
|
|
|
28629
28674
|
const details = data && typeof data === "object" && !Array.isArray(data) ? data : {};
|
|
28630
28675
|
stdout.write(`${JSON.stringify({ error: {
|
|
28631
28676
|
...details,
|
|
28632
|
-
message:
|
|
28677
|
+
message: message3,
|
|
28633
28678
|
...error62 instanceof ApiError ? { statusCode: error62.statusCode } : {}
|
|
28634
28679
|
} }, null, 2)}
|
|
28635
28680
|
`);
|
|
28636
28681
|
}
|
|
28682
|
+
function commandErrorExitCode(error62) {
|
|
28683
|
+
return isUpgradeRequired(error62) ? UPGRADE_REQUIRED_EXIT_CODE : 1;
|
|
28684
|
+
}
|
|
28637
28685
|
|
|
28638
28686
|
// core/command.ts
|
|
28639
28687
|
var BaseCommand = class extends Command {
|
|
@@ -28665,7 +28713,8 @@ var BaseCommand = class extends Command {
|
|
|
28665
28713
|
}
|
|
28666
28714
|
// Template method: every command gets the same error boundary. A thrown
|
|
28667
28715
|
// ExitWithCode is an already-reported exit (no `Error:` line); anything else
|
|
28668
|
-
// 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).
|
|
28669
28718
|
async execute() {
|
|
28670
28719
|
try {
|
|
28671
28720
|
const code3 = await this.run();
|
|
@@ -28673,7 +28722,7 @@ var BaseCommand = class extends Command {
|
|
|
28673
28722
|
} catch (err) {
|
|
28674
28723
|
if (err instanceof ExitWithCode) return err.code;
|
|
28675
28724
|
writeCommandError(this.context.stdout, this.context.stderr, this.json, err);
|
|
28676
|
-
return
|
|
28725
|
+
return commandErrorExitCode(err);
|
|
28677
28726
|
}
|
|
28678
28727
|
}
|
|
28679
28728
|
};
|
|
@@ -28698,7 +28747,7 @@ function parseOperationAttrs(operation, pairs) {
|
|
|
28698
28747
|
}
|
|
28699
28748
|
|
|
28700
28749
|
// ente/version.ts
|
|
28701
|
-
var VERSION = "0.4.
|
|
28750
|
+
var VERSION = "0.4.125";
|
|
28702
28751
|
|
|
28703
28752
|
// ente/branding.ts
|
|
28704
28753
|
var NPM_REGISTRY = "https://registry.npmjs.org";
|
|
@@ -28726,6 +28775,35 @@ var PLATFORM_CREDENTIAL = {
|
|
|
28726
28775
|
profileEnvVar: "ENTE_PLATFORM_PROFILE"
|
|
28727
28776
|
};
|
|
28728
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
|
+
|
|
28729
28807
|
// ../packages/shared/src/input-fields.ts
|
|
28730
28808
|
function isInputRecord(value) {
|
|
28731
28809
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
@@ -28765,6 +28843,8 @@ function parseActivityCreateInput(args, name4 = "activities_create") {
|
|
|
28765
28843
|
if ("createdAt" in args) return invalid(`${name4} createdAt is no longer accepted; use sourceCreatedAt.`);
|
|
28766
28844
|
if (args.sourceCreatedAt !== void 0 && !isSourceCreatedAtInput(args.sourceCreatedAt))
|
|
28767
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);
|
|
28768
28848
|
const entityIds = optionalStringArray(args.entityIds);
|
|
28769
28849
|
if (!entityIds?.length) return invalid(`${name4} requires entityIds to be a non-empty string array`);
|
|
28770
28850
|
if (!isActivityType(args.type)) return invalid(`${name4} requires type to be one of: ${ACTIVITY_TYPE_VALUES.join(", ")}`);
|
|
@@ -28785,6 +28865,7 @@ function parseActivityCreateInput(args, name4 = "activities_create") {
|
|
|
28785
28865
|
deadline: isDeadlineInput(args.deadline) ? args.deadline : void 0,
|
|
28786
28866
|
completed: optionalBoolean(args.completed),
|
|
28787
28867
|
attributes: attributes2,
|
|
28868
|
+
fields: fields4,
|
|
28788
28869
|
sourceCreatedAt: isSourceCreatedAtInput(args.sourceCreatedAt) ? args.sourceCreatedAt : void 0,
|
|
28789
28870
|
tags: optionalStringArray(args.tags),
|
|
28790
28871
|
assigneeIds: optionalStringArray(args.assigneeIds),
|
|
@@ -28799,6 +28880,8 @@ function parseActivityUpdateInput(args, name4 = "activities_update") {
|
|
|
28799
28880
|
return invalid(`${name4} deadline must be a readable deadline object, number, or null`);
|
|
28800
28881
|
if (args.type !== void 0 && !isActivityType(args.type))
|
|
28801
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);
|
|
28802
28885
|
const entityIds = optionalStringArray(args.entityIds);
|
|
28803
28886
|
if (args.entityIds !== void 0 && !entityIds?.length) return invalid(`${name4} entityIds must be a non-empty string array`);
|
|
28804
28887
|
if (args.attributes !== void 0 && !isInputRecord(args.attributes)) return invalid(`${name4} attributes must be an object`);
|
|
@@ -28817,6 +28900,7 @@ function parseActivityUpdateInput(args, name4 = "activities_update") {
|
|
|
28817
28900
|
entityIds,
|
|
28818
28901
|
type: isActivityType(args.type) ? args.type : void 0,
|
|
28819
28902
|
attributes: attributes2,
|
|
28903
|
+
fields: fields4,
|
|
28820
28904
|
assigneeIds: optionalStringArray(args.assigneeIds),
|
|
28821
28905
|
assigneeEmails: optionalStringArray(args.assigneeEmails),
|
|
28822
28906
|
agentAssigneeIds: isBoundedAgentIds(args.agentAssigneeIds) ? args.agentAssigneeIds : void 0
|
|
@@ -28842,11 +28926,11 @@ var nullableDeadline = activityWriteDeadline.nullable();
|
|
|
28842
28926
|
var assignees = { assigneeIds: ids.optional(), assigneeEmails: strings.optional(), agentAssigneeIds: ids.max(MAX_ACTIVITY_AGENT_ASSIGNEES).optional() };
|
|
28843
28927
|
var stringAttributes2 = external_exports.record(attributeKey, external_exports.string());
|
|
28844
28928
|
var patchAttributes = attributeStringPatch;
|
|
28845
|
-
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 };
|
|
28846
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" });
|
|
28847
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" });
|
|
28848
28932
|
var activityWriteInputs = {
|
|
28849
|
-
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() }),
|
|
28850
28934
|
updateActivity: external_exports.strictObject(updateFields),
|
|
28851
28935
|
updateActivityTitle: external_exports.strictObject({ activityId: id4, title: external_exports.string() }),
|
|
28852
28936
|
updateActivityDeadline: external_exports.strictObject({ activityId: id4, deadline: nullableDeadline.optional() }),
|
|
@@ -28855,11 +28939,12 @@ var activityWriteInputs = {
|
|
|
28855
28939
|
updateActivityAssignees: assignment,
|
|
28856
28940
|
toggleActivityCompleted: external_exports.strictObject({ activityId: id4 }),
|
|
28857
28941
|
addActivityMessage: external_exports.strictObject({ activityId: id4, content: external_exports.string().regex(/\S/, "Message content is required") }),
|
|
28942
|
+
deleteActivityMessage: external_exports.strictObject({ messageId: id4 }),
|
|
28858
28943
|
deleteActivity: external_exports.strictObject({ activityId: id4 }),
|
|
28859
28944
|
restoreActivity: external_exports.strictObject({ activityId: id4 }),
|
|
28860
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) })
|
|
28861
28946
|
};
|
|
28862
|
-
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" };
|
|
28863
28948
|
function isActivityWriteOperationName(name4) {
|
|
28864
28949
|
return Object.hasOwn(activityWriteInputs, name4);
|
|
28865
28950
|
}
|
|
@@ -28893,6 +28978,8 @@ function parseActivityWriteRequest(operation, raw) {
|
|
|
28893
28978
|
return { operation, input: parseOperationInput(operation, activityWriteInputs.toggleActivityCompleted, raw) };
|
|
28894
28979
|
case "addActivityMessage":
|
|
28895
28980
|
return { operation, input: parseOperationInput(operation, activityWriteInputs.addActivityMessage, raw) };
|
|
28981
|
+
case "deleteActivityMessage":
|
|
28982
|
+
return { operation, input: parseOperationInput(operation, activityWriteInputs.deleteActivityMessage, raw) };
|
|
28896
28983
|
case "deleteActivity":
|
|
28897
28984
|
return { operation, input: parseOperationInput(operation, activityWriteInputs.deleteActivity, raw) };
|
|
28898
28985
|
case "restoreActivity":
|
|
@@ -28915,6 +29002,7 @@ var activityWriteResults = {
|
|
|
28915
29002
|
updateActivityAssignees: ack,
|
|
28916
29003
|
toggleActivityCompleted: external_exports.strictObject({ completed: external_exports.boolean() }),
|
|
28917
29004
|
addActivityMessage: external_exports.strictObject({ messageId: id5 }),
|
|
29005
|
+
deleteActivityMessage: ack,
|
|
28918
29006
|
deleteActivity: ack,
|
|
28919
29007
|
restoreActivity: ack,
|
|
28920
29008
|
batchUpdateTasks: external_exports.discriminatedUnion("status", [
|
|
@@ -29008,8 +29096,8 @@ function operationResultSchema(validator) {
|
|
|
29008
29096
|
// ../packages/shared/src/activity-write-catalog.ts
|
|
29009
29097
|
var composite = /* @__PURE__ */ new Set(["updateActivityAssignees", "updateActivityAttributes", "toggleActivityCompleted", "batchUpdateTasks"]);
|
|
29010
29098
|
var descriptions = {
|
|
29011
|
-
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.",
|
|
29012
|
-
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.",
|
|
29013
29101
|
updateActivityTitle: "Set or clear an activity title. Existing revision and verified updater bookkeeping stay in the same transaction.",
|
|
29014
29102
|
updateActivityDeadline: "Set a readable or finite epoch deadline; null clears it and omission leaves it unchanged in this profile.",
|
|
29015
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.",
|
|
@@ -29017,6 +29105,7 @@ var descriptions = {
|
|
|
29017
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.",
|
|
29018
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.",
|
|
29019
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.",
|
|
29020
29109
|
deleteActivity: "Archive an activity through the existing lifecycle and task cleanup. Already archived records are unchanged.",
|
|
29021
29110
|
restoreActivity: "Restore an activity through the existing lifecycle, ownership, actor and task index rules. Already active records are unchanged.",
|
|
29022
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."
|
|
@@ -29028,6 +29117,12 @@ function propertySchema(schema) {
|
|
|
29028
29117
|
function definition(name4) {
|
|
29029
29118
|
const schema = external_exports.toJSONSchema(activityWriteInputs[name4], { io: "input" });
|
|
29030
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
|
+
}
|
|
29031
29126
|
const conditions = name4 === "updateActivityAssignees" ? [{ anyOf: [
|
|
29032
29127
|
{ type: "object", properties: { action: { enum: ["add", "remove", "clear"] } } },
|
|
29033
29128
|
{ type: "object", properties: { action: { const: "replace" }, agentAssigneeIds: { type: "array", items: { type: "string", minLength: 1, maxLength: 128 }, maxItems: ACTIVITY_WRITE_LIMITS.agentAssignees } } }
|
|
@@ -29339,12 +29434,12 @@ function createApi(pathParts = []) {
|
|
|
29339
29434
|
`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${found}\``
|
|
29340
29435
|
);
|
|
29341
29436
|
}
|
|
29342
|
-
const
|
|
29437
|
+
const path11 = pathParts.slice(0, -1).join("/");
|
|
29343
29438
|
const exportName = pathParts[pathParts.length - 1];
|
|
29344
29439
|
if (exportName === "default") {
|
|
29345
|
-
return
|
|
29440
|
+
return path11;
|
|
29346
29441
|
} else {
|
|
29347
|
-
return
|
|
29442
|
+
return path11 + ":" + exportName;
|
|
29348
29443
|
}
|
|
29349
29444
|
} else if (prop === Symbol.toStringTag) {
|
|
29350
29445
|
return "FunctionReference";
|
|
@@ -34015,65 +34110,67 @@ var RestClient = class {
|
|
|
34015
34110
|
baseUrl;
|
|
34016
34111
|
apiKey;
|
|
34017
34112
|
timeoutMs;
|
|
34113
|
+
defaultHeaders;
|
|
34018
34114
|
constructor(opts) {
|
|
34019
34115
|
let base = opts.baseUrl.replace(/\/+$/, "");
|
|
34020
34116
|
if (base.endsWith("/api/external")) base = base.slice(0, -"/api/external".length);
|
|
34021
34117
|
this.baseUrl = base;
|
|
34022
34118
|
this.apiKey = opts.apiKey;
|
|
34023
34119
|
this.timeoutMs = opts.timeoutMs ?? 15e3;
|
|
34120
|
+
this.defaultHeaders = opts.defaultHeaders ?? {};
|
|
34024
34121
|
}
|
|
34025
|
-
sendJson(method,
|
|
34026
|
-
return this.request(method,
|
|
34122
|
+
sendJson(method, path11, body) {
|
|
34123
|
+
return this.request(method, path11, body);
|
|
34027
34124
|
}
|
|
34028
|
-
get(
|
|
34029
|
-
return this.request("GET",
|
|
34125
|
+
get(path11, params, opts) {
|
|
34126
|
+
return this.request("GET", path11, void 0, params, opts);
|
|
34030
34127
|
}
|
|
34031
|
-
post(
|
|
34032
|
-
return this.request("POST",
|
|
34128
|
+
post(path11, body, params, opts) {
|
|
34129
|
+
return this.request("POST", path11, body, params, opts);
|
|
34033
34130
|
}
|
|
34034
|
-
patch(
|
|
34035
|
-
return this.request("PATCH",
|
|
34131
|
+
patch(path11, body, params, opts) {
|
|
34132
|
+
return this.request("PATCH", path11, body, params, opts);
|
|
34036
34133
|
}
|
|
34037
|
-
put(
|
|
34038
|
-
return this.request("PUT",
|
|
34134
|
+
put(path11, body, params, opts) {
|
|
34135
|
+
return this.request("PUT", path11, body, params, opts);
|
|
34039
34136
|
}
|
|
34040
|
-
delete(
|
|
34041
|
-
return this.request("DELETE",
|
|
34137
|
+
delete(path11, params, opts) {
|
|
34138
|
+
return this.request("DELETE", path11, void 0, params, opts);
|
|
34042
34139
|
}
|
|
34043
34140
|
/**
|
|
34044
34141
|
* POST raw bytes with an explicit Content-Type (not JSON). Used for binary
|
|
34045
34142
|
* uploads where the request body is the file itself, not a JSON envelope.
|
|
34046
34143
|
*/
|
|
34047
|
-
postRaw(
|
|
34048
|
-
return this.request("POST",
|
|
34144
|
+
postRaw(path11, bytes2, contentType, params, opts) {
|
|
34145
|
+
return this.request("POST", path11, void 0, params, opts, { bytes: bytes2, contentType });
|
|
34049
34146
|
}
|
|
34050
34147
|
/**
|
|
34051
34148
|
* GET a raw byte body, aborting once it exceeds `maxBytes`. Errors still
|
|
34052
34149
|
* parse the structured JSON error envelope.
|
|
34053
34150
|
*/
|
|
34054
|
-
async getBytes(
|
|
34151
|
+
async getBytes(path11, params, opts) {
|
|
34055
34152
|
const timeoutMs = opts.timeoutMs ?? this.timeoutMs;
|
|
34056
34153
|
const controller = new AbortController();
|
|
34057
34154
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
34058
34155
|
try {
|
|
34059
34156
|
let resp;
|
|
34060
34157
|
try {
|
|
34061
|
-
resp = await fetch(this.buildUrl(
|
|
34158
|
+
resp = await fetch(this.buildUrl(path11, params), {
|
|
34062
34159
|
method: "GET",
|
|
34063
|
-
headers: { Authorization: `Bearer ${this.apiKey}`, ...opts.headers },
|
|
34160
|
+
headers: { ...this.defaultHeaders, Authorization: `Bearer ${this.apiKey}`, ...opts.headers },
|
|
34064
34161
|
signal: controller.signal
|
|
34065
34162
|
});
|
|
34066
34163
|
} catch (err) {
|
|
34067
34164
|
if (err instanceof Error && err.name === "AbortError") {
|
|
34068
|
-
throw new Error(`Request to ${
|
|
34165
|
+
throw new Error(`Request to ${path11} timed out after ${timeoutMs}ms.`);
|
|
34069
34166
|
}
|
|
34070
|
-
throw new Error(`Could not reach the ente API (${
|
|
34167
|
+
throw new Error(`Could not reach the ente API (${path11}): ${String(err)}`);
|
|
34071
34168
|
}
|
|
34072
34169
|
const bodyLimit = resp.status >= 400 ? 64 * 1024 : opts.maxBytes;
|
|
34073
34170
|
const declared = Number(resp.headers.get("Content-Length") ?? "0");
|
|
34074
34171
|
if (declared > bodyLimit) {
|
|
34075
34172
|
await resp.body?.cancel();
|
|
34076
|
-
throw new Error(`Response from ${
|
|
34173
|
+
throw new Error(`Response from ${path11} exceeds ${bodyLimit} bytes.`);
|
|
34077
34174
|
}
|
|
34078
34175
|
const chunks = [];
|
|
34079
34176
|
let total = 0;
|
|
@@ -34085,7 +34182,7 @@ var RestClient = class {
|
|
|
34085
34182
|
total += value.byteLength;
|
|
34086
34183
|
if (total > bodyLimit) {
|
|
34087
34184
|
await reader.cancel();
|
|
34088
|
-
throw new Error(`Response from ${
|
|
34185
|
+
throw new Error(`Response from ${path11} exceeds ${bodyLimit} bytes.`);
|
|
34089
34186
|
}
|
|
34090
34187
|
chunks.push(value);
|
|
34091
34188
|
}
|
|
@@ -34102,15 +34199,15 @@ var RestClient = class {
|
|
|
34102
34199
|
return { bytes: bytes2, headers: resp.headers };
|
|
34103
34200
|
} catch (err) {
|
|
34104
34201
|
if (err instanceof Error && err.name === "AbortError") {
|
|
34105
|
-
throw new Error(`Request to ${
|
|
34202
|
+
throw new Error(`Request to ${path11} timed out after ${timeoutMs}ms.`);
|
|
34106
34203
|
}
|
|
34107
34204
|
throw err;
|
|
34108
34205
|
} finally {
|
|
34109
34206
|
clearTimeout(timer);
|
|
34110
34207
|
}
|
|
34111
34208
|
}
|
|
34112
|
-
buildUrl(
|
|
34113
|
-
const url2 = new URL(this.baseUrl +
|
|
34209
|
+
buildUrl(path11, params) {
|
|
34210
|
+
const url2 = new URL(this.baseUrl + path11);
|
|
34114
34211
|
if (params) {
|
|
34115
34212
|
for (const [k, v3] of Object.entries(params)) {
|
|
34116
34213
|
if (v3 !== void 0) url2.searchParams.set(k, v3);
|
|
@@ -34118,15 +34215,16 @@ var RestClient = class {
|
|
|
34118
34215
|
}
|
|
34119
34216
|
return url2.toString();
|
|
34120
34217
|
}
|
|
34121
|
-
async request(method,
|
|
34218
|
+
async request(method, path11, body, params, opts, raw) {
|
|
34122
34219
|
const timeoutMs = opts?.timeoutMs ?? this.timeoutMs;
|
|
34123
34220
|
const controller = new AbortController();
|
|
34124
34221
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
34125
34222
|
let resp;
|
|
34126
34223
|
try {
|
|
34127
|
-
resp = await fetch(this.buildUrl(
|
|
34224
|
+
resp = await fetch(this.buildUrl(path11, params), {
|
|
34128
34225
|
method,
|
|
34129
34226
|
headers: {
|
|
34227
|
+
...this.defaultHeaders,
|
|
34130
34228
|
Authorization: `Bearer ${this.apiKey}`,
|
|
34131
34229
|
"Content-Type": raw ? raw.contentType : "application/json",
|
|
34132
34230
|
...opts?.headers
|
|
@@ -34142,9 +34240,9 @@ var RestClient = class {
|
|
|
34142
34240
|
} catch (err) {
|
|
34143
34241
|
clearTimeout(timer);
|
|
34144
34242
|
if (err instanceof Error && err.name === "AbortError") {
|
|
34145
|
-
throw new Error(`Request to ${
|
|
34243
|
+
throw new Error(`Request to ${path11} timed out after ${timeoutMs}ms.`);
|
|
34146
34244
|
}
|
|
34147
|
-
throw new Error(`Could not reach the ente API (${
|
|
34245
|
+
throw new Error(`Could not reach the ente API (${path11}): ${String(err)}`);
|
|
34148
34246
|
}
|
|
34149
34247
|
clearTimeout(timer);
|
|
34150
34248
|
const text3 = await resp.text();
|
|
@@ -35169,7 +35267,7 @@ var EnteClient = class _EnteClient {
|
|
|
35169
35267
|
/** Build a client from stored/env credentials (throws if not authenticated). */
|
|
35170
35268
|
static fromConfig(branding) {
|
|
35171
35269
|
const { apiUrl, apiKey } = loadCredentials(branding);
|
|
35172
|
-
return new _EnteClient(new RestClient({ baseUrl: apiUrl, apiKey }));
|
|
35270
|
+
return new _EnteClient(new RestClient({ baseUrl: apiUrl, apiKey, defaultHeaders: CLI_REQUEST_HEADERS }));
|
|
35173
35271
|
}
|
|
35174
35272
|
// --- entities -----------------------------------------------------------
|
|
35175
35273
|
/** Installed full-record REST profile, used by internal resolvers/space metadata. */
|
|
@@ -36135,20 +36233,29 @@ function compareSemver(a, b) {
|
|
|
36135
36233
|
async function checkForUpdate(opts) {
|
|
36136
36234
|
try {
|
|
36137
36235
|
const cacheFile = path2.join(opts.cacheDir, "update_check.json");
|
|
36236
|
+
let cache = {};
|
|
36138
36237
|
if (existsSync2(cacheFile)) {
|
|
36139
|
-
|
|
36140
|
-
|
|
36141
|
-
|
|
36142
|
-
|
|
36143
|
-
|
|
36144
|
-
|
|
36145
|
-
|
|
36146
|
-
|
|
36147
|
-
|
|
36148
|
-
|
|
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;
|
|
36149
36257
|
mkdirSync2(opts.cacheDir, { recursive: true });
|
|
36150
|
-
writeFileSync2(cacheFile, JSON.stringify(
|
|
36151
|
-
if (compareSemver(latest, opts.currentVersion) > 0) warn(opts, latest);
|
|
36258
|
+
writeFileSync2(cacheFile, JSON.stringify(cache));
|
|
36152
36259
|
} catch {
|
|
36153
36260
|
}
|
|
36154
36261
|
}
|
|
@@ -36632,15 +36739,15 @@ var require_constants = __commonJS2({
|
|
|
36632
36739
|
var require_node_gyp_build = __commonJS2({
|
|
36633
36740
|
"../node_modules/.pnpm/node-gyp-build@4.8.4/node_modules/node-gyp-build/node-gyp-build.js"(exports, module) {
|
|
36634
36741
|
var fs = __require2("fs");
|
|
36635
|
-
var
|
|
36636
|
-
var
|
|
36742
|
+
var path11 = __require2("path");
|
|
36743
|
+
var os4 = __require2("os");
|
|
36637
36744
|
var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require2;
|
|
36638
36745
|
var vars3 = process.config && process.config.variables || {};
|
|
36639
36746
|
var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
|
|
36640
36747
|
var abi = process.versions.modules;
|
|
36641
36748
|
var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node";
|
|
36642
|
-
var arch = process.env.npm_config_arch ||
|
|
36643
|
-
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();
|
|
36644
36751
|
var libc = process.env.LIBC || (isAlpine(platform) ? "musl" : "glibc");
|
|
36645
36752
|
var armv = process.env.ARM_VERSION || (arch === "arm64" ? "8" : vars3.arm_version) || "";
|
|
36646
36753
|
var uv = (process.versions.uv || "").split(".")[0];
|
|
@@ -36649,21 +36756,21 @@ var require_node_gyp_build = __commonJS2({
|
|
|
36649
36756
|
return runtimeRequire(load.resolve(dir));
|
|
36650
36757
|
}
|
|
36651
36758
|
load.resolve = load.path = function(dir) {
|
|
36652
|
-
dir =
|
|
36759
|
+
dir = path11.resolve(dir || ".");
|
|
36653
36760
|
try {
|
|
36654
|
-
var name4 = runtimeRequire(
|
|
36761
|
+
var name4 = runtimeRequire(path11.join(dir, "package.json")).name.toUpperCase().replace(/-/g, "_");
|
|
36655
36762
|
if (process.env[name4 + "_PREBUILD"]) dir = process.env[name4 + "_PREBUILD"];
|
|
36656
36763
|
} catch (err) {
|
|
36657
36764
|
}
|
|
36658
36765
|
if (!prebuildsOnly) {
|
|
36659
|
-
var release = getFirst(
|
|
36766
|
+
var release = getFirst(path11.join(dir, "build/Release"), matchBuild);
|
|
36660
36767
|
if (release) return release;
|
|
36661
|
-
var debug2 = getFirst(
|
|
36768
|
+
var debug2 = getFirst(path11.join(dir, "build/Debug"), matchBuild);
|
|
36662
36769
|
if (debug2) return debug2;
|
|
36663
36770
|
}
|
|
36664
36771
|
var prebuild = resolve2(dir);
|
|
36665
36772
|
if (prebuild) return prebuild;
|
|
36666
|
-
var nearby = resolve2(
|
|
36773
|
+
var nearby = resolve2(path11.dirname(process.execPath));
|
|
36667
36774
|
if (nearby) return nearby;
|
|
36668
36775
|
var target3 = [
|
|
36669
36776
|
"platform=" + platform,
|
|
@@ -36680,14 +36787,14 @@ var require_node_gyp_build = __commonJS2({
|
|
|
36680
36787
|
].filter(Boolean).join(" ");
|
|
36681
36788
|
throw new Error("No native build was found for " + target3 + "\n loaded from: " + dir + "\n");
|
|
36682
36789
|
function resolve2(dir2) {
|
|
36683
|
-
var tuples = readdirSync2(
|
|
36790
|
+
var tuples = readdirSync2(path11.join(dir2, "prebuilds")).map(parseTuple);
|
|
36684
36791
|
var tuple2 = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0];
|
|
36685
36792
|
if (!tuple2) return;
|
|
36686
|
-
var prebuilds =
|
|
36793
|
+
var prebuilds = path11.join(dir2, "prebuilds", tuple2.name);
|
|
36687
36794
|
var parsed = readdirSync2(prebuilds).map(parseTags);
|
|
36688
36795
|
var candidates = parsed.filter(matchTags(runtime, abi));
|
|
36689
36796
|
var winner = candidates.sort(compareTags(runtime))[0];
|
|
36690
|
-
if (winner) return
|
|
36797
|
+
if (winner) return path11.join(prebuilds, winner.file);
|
|
36691
36798
|
}
|
|
36692
36799
|
};
|
|
36693
36800
|
function readdirSync2(dir) {
|
|
@@ -36699,7 +36806,7 @@ var require_node_gyp_build = __commonJS2({
|
|
|
36699
36806
|
}
|
|
36700
36807
|
function getFirst(dir, filter) {
|
|
36701
36808
|
var files = readdirSync2(dir).filter(filter);
|
|
36702
|
-
return files[0] &&
|
|
36809
|
+
return files[0] && path11.join(dir, files[0]);
|
|
36703
36810
|
}
|
|
36704
36811
|
function matchBuild(name4) {
|
|
36705
36812
|
return /\.node$/.test(name4);
|
|
@@ -39041,7 +39148,7 @@ var require_websocket = __commonJS2({
|
|
|
39041
39148
|
var http = __require2("http");
|
|
39042
39149
|
var net = __require2("net");
|
|
39043
39150
|
var tls = __require2("tls");
|
|
39044
|
-
var { randomBytes: randomBytes3, createHash:
|
|
39151
|
+
var { randomBytes: randomBytes3, createHash: createHash6 } = __require2("crypto");
|
|
39045
39152
|
var { Duplex, Readable } = __require2("stream");
|
|
39046
39153
|
var { URL: URL2 } = __require2("url");
|
|
39047
39154
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
@@ -39709,7 +39816,7 @@ var require_websocket = __commonJS2({
|
|
|
39709
39816
|
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
39710
39817
|
return;
|
|
39711
39818
|
}
|
|
39712
|
-
const digest =
|
|
39819
|
+
const digest = createHash6("sha1").update(key + GUID).digest("base64");
|
|
39713
39820
|
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
39714
39821
|
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
39715
39822
|
return;
|
|
@@ -40072,7 +40179,7 @@ var require_websocket_server = __commonJS2({
|
|
|
40072
40179
|
var EventEmitter = __require2("events");
|
|
40073
40180
|
var http = __require2("http");
|
|
40074
40181
|
var { Duplex } = __require2("stream");
|
|
40075
|
-
var { createHash:
|
|
40182
|
+
var { createHash: createHash6 } = __require2("crypto");
|
|
40076
40183
|
var extension2 = require_extension();
|
|
40077
40184
|
var PerMessageDeflate2 = require_permessage_deflate();
|
|
40078
40185
|
var subprotocol2 = require_subprotocol();
|
|
@@ -40379,7 +40486,7 @@ var require_websocket_server = __commonJS2({
|
|
|
40379
40486
|
);
|
|
40380
40487
|
}
|
|
40381
40488
|
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
40382
|
-
const digest =
|
|
40489
|
+
const digest = createHash6("sha1").update(key + GUID).digest("base64");
|
|
40383
40490
|
const headers = [
|
|
40384
40491
|
"HTTP/1.1 101 Switching Protocols",
|
|
40385
40492
|
"Upgrade: websocket",
|
|
@@ -40969,11 +41076,11 @@ var PLATFORM_TOKEN_ENDPOINT = {
|
|
|
40969
41076
|
path: "/cli/platform-token",
|
|
40970
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'."
|
|
40971
41078
|
};
|
|
40972
|
-
async function exchangeToken(siteUrl, apiKey, endpoint = AGENT_TOKEN_ENDPOINT) {
|
|
41079
|
+
async function exchangeToken(siteUrl, apiKey, endpoint = AGENT_TOKEN_ENDPOINT, headers = {}) {
|
|
40973
41080
|
const url2 = `${siteUrl.replace(/\/+$/, "")}${endpoint.path}`;
|
|
40974
41081
|
let resp;
|
|
40975
41082
|
try {
|
|
40976
|
-
resp = await fetch(url2, { method: "POST", headers: { Authorization: `Bearer ${apiKey}` } });
|
|
41083
|
+
resp = await fetch(url2, { method: "POST", headers: { ...headers, Authorization: `Bearer ${apiKey}` } });
|
|
40977
41084
|
} catch (err) {
|
|
40978
41085
|
const msg = err instanceof Error ? err.message : String(err);
|
|
40979
41086
|
throw new Error(`Could not reach ${url2}: ${msg}`);
|
|
@@ -40981,6 +41088,7 @@ async function exchangeToken(siteUrl, apiKey, endpoint = AGENT_TOKEN_ENDPOINT) {
|
|
|
40981
41088
|
if (resp.status === 401) {
|
|
40982
41089
|
throw new Error(`Key rejected (401) at ${endpoint.path} \u2014 ${endpoint.rejectedHint}`);
|
|
40983
41090
|
}
|
|
41091
|
+
if (resp.status === 426) throw await upgradeRequiredFromResponse(resp, endpoint.path);
|
|
40984
41092
|
if (!resp.ok) {
|
|
40985
41093
|
throw new Error(`${endpoint.path} exchange failed (${resp.status} ${resp.statusText}).`);
|
|
40986
41094
|
}
|
|
@@ -41016,7 +41124,7 @@ function isWriteConflict(err) {
|
|
|
41016
41124
|
var MAX_CONFLICT_ATTEMPTS = 6;
|
|
41017
41125
|
var DEFAULT_CONFLICT_BACKOFF_MS = 250;
|
|
41018
41126
|
async function mintAndCache(opts) {
|
|
41019
|
-
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);
|
|
41020
41128
|
storeJwt(opts.cacheDir, opts.cacheKey, jwt2, expiresAt);
|
|
41021
41129
|
return { jwt: jwt2, expiresAt };
|
|
41022
41130
|
}
|
|
@@ -41116,7 +41224,8 @@ async function resolveCaller() {
|
|
|
41116
41224
|
siteUrl,
|
|
41117
41225
|
apiKey: creds.apiKey,
|
|
41118
41226
|
cacheDir: configDir(ENTE_BRANDING),
|
|
41119
|
-
cacheKey: credentialCacheKey(creds.apiUrl, creds.apiKey)
|
|
41227
|
+
cacheKey: credentialCacheKey(creds.apiUrl, creds.apiKey),
|
|
41228
|
+
requestHeaders: CLI_REQUEST_HEADERS
|
|
41120
41229
|
});
|
|
41121
41230
|
}
|
|
41122
41231
|
function loadPlatformCredentials() {
|
|
@@ -41150,6 +41259,7 @@ async function resolveAdminCaller(allowAgentReads = false) {
|
|
|
41150
41259
|
apiKey: creds.apiKey,
|
|
41151
41260
|
cacheDir: configDir(PLATFORM_CREDENTIAL),
|
|
41152
41261
|
cacheKey: credentialCacheKey(creds.apiUrl, creds.apiKey),
|
|
41262
|
+
requestHeaders: CLI_REQUEST_HEADERS,
|
|
41153
41263
|
tokenEndpoint: PLATFORM_TOKEN_ENDPOINT
|
|
41154
41264
|
});
|
|
41155
41265
|
}
|
|
@@ -41255,7 +41365,7 @@ async function postJson(url2, body) {
|
|
|
41255
41365
|
}
|
|
41256
41366
|
async function verifyCredential(url2, key) {
|
|
41257
41367
|
return await fetch(`${url2}/api/external/auth-context`, {
|
|
41258
|
-
headers: { Authorization: `Bearer ${key}` },
|
|
41368
|
+
headers: { ...CLI_REQUEST_HEADERS, Authorization: `Bearer ${key}` },
|
|
41259
41369
|
signal: AbortSignal.timeout(15e3)
|
|
41260
41370
|
});
|
|
41261
41371
|
}
|
|
@@ -41347,6 +41457,7 @@ var AuthPair = class extends BaseCommand {
|
|
|
41347
41457
|
}
|
|
41348
41458
|
for (const item of pending) {
|
|
41349
41459
|
const response = await verifyCredential(cleanUrl, item.key);
|
|
41460
|
+
if (response.status === 426) throw await upgradeRequiredFromResponse(response, "/api/external/auth-context");
|
|
41350
41461
|
if (!response.ok) {
|
|
41351
41462
|
throw new Error(`Profile '${item.spec.profile}' saved but verification failed (${response.status})`);
|
|
41352
41463
|
}
|
|
@@ -41369,7 +41480,7 @@ function readCredentialsForCleanup(profile, reader = readStoredCredentials, bran
|
|
|
41369
41480
|
}
|
|
41370
41481
|
}
|
|
41371
41482
|
async function validateExternalCredential(cleanUrl, key, signal) {
|
|
41372
|
-
const headers = { Authorization: `Bearer ${key}` };
|
|
41483
|
+
const headers = { ...CLI_REQUEST_HEADERS, Authorization: `Bearer ${key}` };
|
|
41373
41484
|
const authContext = await fetch(`${cleanUrl}${AUTH_CONTEXT_PATH}`, { headers, signal });
|
|
41374
41485
|
if (authContext.status !== 404) return authContext;
|
|
41375
41486
|
const legacyUrl = new URL(`${cleanUrl}${LEGACY_AUTH_PROBE_PATH}`);
|
|
@@ -41419,6 +41530,7 @@ var AuthLogin = class extends BaseCommand {
|
|
|
41419
41530
|
} finally {
|
|
41420
41531
|
clearTimeout(timer);
|
|
41421
41532
|
}
|
|
41533
|
+
if (resp.status === 426) throw await upgradeRequiredFromResponse(resp, AUTH_CONTEXT_PATH);
|
|
41422
41534
|
if (resp.status >= 400) {
|
|
41423
41535
|
throw new Error(`Authentication failed: ${resp.status} ${resp.statusText}`);
|
|
41424
41536
|
}
|
|
@@ -41548,7 +41660,7 @@ var AuthPlatformLogin = class extends BaseCommand {
|
|
|
41548
41660
|
throw new Error("Platform keys start with 'entp_'. Agent keys ('ente_\u2026') belong in 'ente auth login'.");
|
|
41549
41661
|
}
|
|
41550
41662
|
const cleanUrl = this.url.replace(/\/+$/, "");
|
|
41551
|
-
await exchangeToken(resolveConvexEndpoints(cleanUrl).siteUrl, key, PLATFORM_TOKEN_ENDPOINT);
|
|
41663
|
+
await exchangeToken(resolveConvexEndpoints(cleanUrl).siteUrl, key, PLATFORM_TOKEN_ENDPOINT, CLI_REQUEST_HEADERS);
|
|
41552
41664
|
const previous = readCredentialsForCleanup(void 0, readStoredCredentials, PLATFORM_CREDENTIAL);
|
|
41553
41665
|
if (previous) deleteJwt(configDir(PLATFORM_CREDENTIAL), credentialCacheKey(previous.apiUrl, previous.apiKey));
|
|
41554
41666
|
saveCredentials(PLATFORM_CREDENTIAL, cleanUrl, key);
|
|
@@ -42844,6 +42956,27 @@ function requireEntitySelector(operation, value, field) {
|
|
|
42844
42956
|
if (!value.trim()) throw new OperationInputError(operation, [{ path: [field], reason: "too_small" }]);
|
|
42845
42957
|
}
|
|
42846
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
|
+
|
|
42847
42980
|
// ../packages/shared/src/cli-protocol-dtos.ts
|
|
42848
42981
|
var agentIdentity = v.object({ agentId: v.id("agents"), icon: v.optional(v.string()), name: v.string(), color: v.string(), archived: v.boolean() });
|
|
42849
42982
|
var activityRevisionSummaryValidator = v.object({
|
|
@@ -42942,21 +43075,6 @@ function transcriptResult(raw, recordingId) {
|
|
|
42942
43075
|
return result;
|
|
42943
43076
|
}
|
|
42944
43077
|
|
|
42945
|
-
// ../packages/shared/src/activity-content-operation-results.ts
|
|
42946
|
-
var integer2 = external_exports.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
42947
|
-
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");
|
|
42948
|
-
var activityContentResults = {
|
|
42949
|
-
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"),
|
|
42950
|
-
editActivityContent: external_exports.strictObject({ activityId: external_exports.string().min(1), contentVersion: activityContentVersion, changed: external_exports.boolean() })
|
|
42951
|
-
};
|
|
42952
|
-
function parseActivityContentResult(name4, raw) {
|
|
42953
|
-
return parseZodOperationResult(name4, activityContentResults[name4], raw, "Invalid activity content result");
|
|
42954
|
-
}
|
|
42955
|
-
|
|
42956
|
-
// ente/commands/activity.ts
|
|
42957
|
-
import { readFileSync as readFileSync9 } from "node:fs";
|
|
42958
|
-
import { basename as basename2 } from "node:path";
|
|
42959
|
-
|
|
42960
43078
|
// ente/activityType.ts
|
|
42961
43079
|
function parseActivityType(value) {
|
|
42962
43080
|
const type = ACTIVITY_TYPE_VALUES.find((type2) => type2 === value);
|
|
@@ -43068,6 +43186,49 @@ function deadlineChange(deadline, clear) {
|
|
|
43068
43186
|
return null;
|
|
43069
43187
|
}
|
|
43070
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
|
+
|
|
43071
43232
|
// ente/fileAttachments.ts
|
|
43072
43233
|
import { readFileSync as readFileSync8 } from "node:fs";
|
|
43073
43234
|
import { basename, extname } from "node:path";
|
|
@@ -43132,26 +43293,26 @@ function parseInlineImageSpecs(specs, options) {
|
|
|
43132
43293
|
return { contentId, path: spec.slice(separator + 1) };
|
|
43133
43294
|
});
|
|
43134
43295
|
}
|
|
43135
|
-
function readOutgoingEmailAttachment(
|
|
43296
|
+
function readOutgoingEmailAttachment(path11, options) {
|
|
43136
43297
|
let bytes2;
|
|
43137
43298
|
try {
|
|
43138
|
-
bytes2 = readFileSync8(
|
|
43299
|
+
bytes2 = readFileSync8(path11);
|
|
43139
43300
|
} catch (error62) {
|
|
43140
43301
|
const detail = error62 instanceof Error ? error62.message : String(error62);
|
|
43141
|
-
throw new Error(`${options.commandLabel}: could not read attachment '${
|
|
43302
|
+
throw new Error(`${options.commandLabel}: could not read attachment '${path11}': ${detail}`);
|
|
43142
43303
|
}
|
|
43143
43304
|
if (bytes2.byteLength > options.maxBytes) {
|
|
43144
43305
|
throw new Error(
|
|
43145
|
-
`${options.commandLabel}: attachment '${
|
|
43306
|
+
`${options.commandLabel}: attachment '${path11}' must be ${options.maxBytes} bytes or smaller.`
|
|
43146
43307
|
);
|
|
43147
43308
|
}
|
|
43148
43309
|
const detectedImageMimeType = detectImageMimeType(bytes2);
|
|
43149
43310
|
if (options.requireImage && !detectedImageMimeType) {
|
|
43150
43311
|
throw new Error(
|
|
43151
|
-
`${options.commandLabel}: image '${
|
|
43312
|
+
`${options.commandLabel}: image '${path11}' must be PNG, JPEG, GIF, or WebP.`
|
|
43152
43313
|
);
|
|
43153
43314
|
}
|
|
43154
|
-
const filename = basename(
|
|
43315
|
+
const filename = basename(path11);
|
|
43155
43316
|
if (!filename || filename.length > options.maxFilenameLength) {
|
|
43156
43317
|
throw new Error(
|
|
43157
43318
|
`${options.commandLabel}: attachment filename must be 1-${options.maxFilenameLength} characters.`
|
|
@@ -43168,41 +43329,14 @@ function readOutgoingEmailAttachment(path9, options) {
|
|
|
43168
43329
|
}
|
|
43169
43330
|
return {
|
|
43170
43331
|
filename,
|
|
43171
|
-
mimeType: detectedImageMimeType ?? mimeTypeForPath(
|
|
43332
|
+
mimeType: detectedImageMimeType ?? mimeTypeForPath(path11),
|
|
43172
43333
|
data: bytes2.toString("base64"),
|
|
43173
43334
|
...options.contentId ? { contentId: options.contentId } : {}
|
|
43174
43335
|
};
|
|
43175
43336
|
}
|
|
43176
43337
|
|
|
43177
|
-
// ente/
|
|
43178
|
-
|
|
43179
|
-
var DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/;
|
|
43180
|
-
function valid(year, month, day, hour = 0, minute = 0) {
|
|
43181
|
-
if (month < 1 || month > 12 || day < 1 || day > 31 || hour > 23 || minute > 59) return false;
|
|
43182
|
-
const d = new Date(Date.UTC(year, month - 1, day));
|
|
43183
|
-
return d.getUTCFullYear() === year && d.getUTCMonth() + 1 === month && d.getUTCDate() === day;
|
|
43184
|
-
}
|
|
43185
|
-
function parseSourceCreatedAt(value, timezone = "Europe/Berlin") {
|
|
43186
|
-
const dt = DATE_TIME.exec(value);
|
|
43187
|
-
if (dt) {
|
|
43188
|
-
const [year, month, day, hour, minute] = dt.slice(1).map(Number);
|
|
43189
|
-
if (!valid(year, month, day, hour, minute)) throw new Error(`Invalid --source-created-at value: ${value}`);
|
|
43190
|
-
return {
|
|
43191
|
-
date: `${dt[1]}-${dt[2]}-${dt[3]}`,
|
|
43192
|
-
time: `${dt[4]}:${dt[5]}`,
|
|
43193
|
-
timezone
|
|
43194
|
-
};
|
|
43195
|
-
}
|
|
43196
|
-
const d = DATE_ONLY.exec(value);
|
|
43197
|
-
if (d) {
|
|
43198
|
-
const [year, month, day] = d.slice(1).map(Number);
|
|
43199
|
-
if (!valid(year, month, day)) throw new Error(`Invalid --source-created-at value: ${value}`);
|
|
43200
|
-
return { date: `${d[1]}-${d[2]}-${d[3]}`, time: null, timezone };
|
|
43201
|
-
}
|
|
43202
|
-
throw new Error("--source-created-at must be YYYY-MM-DD or YYYY-MM-DDTHH:mm");
|
|
43203
|
-
}
|
|
43204
|
-
|
|
43205
|
-
// ente/commands/activity.ts
|
|
43338
|
+
// ente/commands/activityShared.ts
|
|
43339
|
+
init_server();
|
|
43206
43340
|
var MAX_ACTIVITY_ATTACHMENT_BYTES = 20 * 1024 * 1024;
|
|
43207
43341
|
var activitiesCreate = makeFunctionReference2("activities:create");
|
|
43208
43342
|
var activitiesGetByIdRich = makeFunctionReference2("activities:getByIdRich");
|
|
@@ -43236,296 +43370,8 @@ function formatRevisionLine(rev) {
|
|
|
43236
43370
|
const thread2 = rev.agentThreadId ? ` thread:${rev.agentThreadId}` : "";
|
|
43237
43371
|
return `${formatRevisionTimestamp(rev.createdAt)} [${rev.source}] ${who}${label}${thread2} ${rev._id}`;
|
|
43238
43372
|
}
|
|
43239
|
-
var ActivityList = class extends ClientCommand {
|
|
43240
|
-
static paths = [["activity", "list"]];
|
|
43241
|
-
static usage = Command.Usage({ category: "Activity", description: "List activities" });
|
|
43242
|
-
entity = options_exports.String("--entity", { description: "Filter by entity (name or ID)" });
|
|
43243
|
-
compact = options_exports.Boolean("--compact", false, { description: "Entity-scoped compact page; preserves spaces and continuation. Read full detail with activity get." });
|
|
43244
|
-
cursor = options_exports.String("--cursor", { description: "Opaque nextCursor from the previous entity-scoped page; keep the same entity and filters" });
|
|
43245
|
-
minCount = options_exports.String("--min-count", { description: "Minimum entity history entries, even outside the time window (default 5). Use 0 for a strict window." });
|
|
43246
|
-
type = options_exports.String("--type", { description: "Filter by type (task, call, note, message, conversation, meeting)" });
|
|
43247
|
-
attr = options_exports.Array("--field,--attr", { description: "Indexed label=value filter; --attr is a compatibility alias" });
|
|
43248
|
-
space = options_exports.String("--space", { description: "Narrow indexed field lookup to a space (name or ID)" });
|
|
43249
|
-
onlyOpen = options_exports.Boolean("--only-open", false, { description: "Only show non-completed activities" });
|
|
43250
|
-
hours = options_exports.String("--hours", { description: "Only from the last N hours" });
|
|
43251
|
-
limit = options_exports.String("--limit", { description: "Max results" });
|
|
43252
|
-
sort = options_exports.String("--sort", { description: "Sort by: deadline, created" });
|
|
43253
|
-
before = options_exports.String("--before", { description: "Only activities before this timestamp (ms)" });
|
|
43254
|
-
after = options_exports.String("--after", { description: "Only activities after this timestamp (ms)" });
|
|
43255
|
-
archived = options_exports.Boolean("--archived", false, {
|
|
43256
|
-
description: "Show archived (trashed) activities instead of active ones"
|
|
43257
|
-
});
|
|
43258
|
-
async run() {
|
|
43259
|
-
if (this.archived && !this.attr?.length) {
|
|
43260
|
-
if (this.space) throw new Error("--space requires an indexed --field filter");
|
|
43261
|
-
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.");
|
|
43262
|
-
parseActivityReadRequest("listActivities", { archived: true, limit: this.limit === void 0 ? void 0 : parseOperationNumberParameter("listActivities", "limit", this.limit) });
|
|
43263
|
-
const client = this.client();
|
|
43264
|
-
const params = { archived: "true" };
|
|
43265
|
-
if (this.limit) params.limit = this.limit;
|
|
43266
|
-
const res = await client.listActivities(params);
|
|
43267
|
-
const spaces = await client.listSpaces();
|
|
43268
|
-
this.emitText(
|
|
43269
|
-
jsonWithSpaces(res, spaces),
|
|
43270
|
-
() => this.withFooter(formatActivityList(res.data ?? []), spaces)
|
|
43271
|
-
);
|
|
43272
|
-
return;
|
|
43273
|
-
}
|
|
43274
|
-
await this.runActivityList({
|
|
43275
|
-
archived: this.archived,
|
|
43276
|
-
compact: this.compact,
|
|
43277
|
-
cursor: this.cursor,
|
|
43278
|
-
minCount: this.minCount !== void 0 ? parseOperationNumberParameter("listRecentActivities", "minCount", this.minCount) : void 0,
|
|
43279
|
-
entity: this.entity,
|
|
43280
|
-
typeFilter: this.type,
|
|
43281
|
-
attrFilter: this.attr,
|
|
43282
|
-
space: this.space,
|
|
43283
|
-
onlyOpen: this.onlyOpen,
|
|
43284
|
-
hours: this.hours !== void 0 ? parseOperationNumberParameter("listRecentActivities", "hoursBack", this.hours) : void 0,
|
|
43285
|
-
limit: this.limit !== void 0 ? parseOperationNumberParameter(this.entity ? "listRecentActivities" : "listActivities", "limit", this.limit) : void 0,
|
|
43286
|
-
sort: this.sort,
|
|
43287
|
-
before: this.before !== void 0 ? parseOperationNumberParameter("listActivities", "before", this.before) : void 0,
|
|
43288
|
-
after: this.after !== void 0 ? parseOperationNumberParameter("listActivities", "after", this.after) : void 0
|
|
43289
|
-
});
|
|
43290
|
-
}
|
|
43291
|
-
};
|
|
43292
|
-
var ActivityCreate = class extends ProfileCommand {
|
|
43293
|
-
static paths = [["activity", "create"]];
|
|
43294
|
-
static usage = Command.Usage({ category: "Activity", description: "Create an activity" });
|
|
43295
|
-
type = options_exports.String("--type", { required: true, description: "Activity type (note, conversation, meeting, call, message, task)" });
|
|
43296
|
-
title = options_exports.String("--title", { required: true, description: "Activity title" });
|
|
43297
|
-
entity = options_exports.Array("--entity", { required: true, description: "Linked entities (resolved by name)" });
|
|
43298
|
-
space = options_exports.String("--space", { required: true, description: "Space to create in (name or ID)" });
|
|
43299
|
-
content = options_exports.String("--content", { description: "Activity content" });
|
|
43300
|
-
contentFile = options_exports.String("--content-file", { description: "Read content from a markdown/text file" });
|
|
43301
|
-
sourceCreatedAt = options_exports.String("--source-created-at", {
|
|
43302
|
-
description: "Import/backfill timestamp: YYYY-MM-DD or YYYY-MM-DDTHH:mm"
|
|
43303
|
-
});
|
|
43304
|
-
sourceCreatedAtTimezone = options_exports.String("--source-created-at-timezone", "Europe/Berlin", {
|
|
43305
|
-
description: "IANA timezone for --source-created-at"
|
|
43306
|
-
});
|
|
43307
|
-
tag = options_exports.Array("--tag", { description: "Tags (repeatable)" });
|
|
43308
|
-
agentAssignee = options_exports.Array("--agent-assignee", { description: "Agent ID to assign to this task (repeatable; requires write access)" });
|
|
43309
|
-
autoLink = options_exports.Boolean("--auto-link", false, { description: "Auto-link entities not in target space" });
|
|
43310
|
-
entitySpaceGrantFingerprint = options_exports.String("--entity-space-grant-fingerprint", {
|
|
43311
|
-
description: "Exact grant fingerprint returned by the confirmation-required error"
|
|
43312
|
-
});
|
|
43313
|
-
async run() {
|
|
43314
|
-
const content = graphConvert("content", () => readContentOption(this.content, this.contentFile));
|
|
43315
|
-
const sourceCreatedAt = this.sourceCreatedAt === void 0 ? void 0 : graphConvert("sourceCreatedAt", () => parseSourceCreatedAt(this.sourceCreatedAt, this.sourceCreatedAtTimezone));
|
|
43316
|
-
const intent = graphInput(graphCreateIntent, {
|
|
43317
|
-
space: this.space,
|
|
43318
|
-
entities: this.entity,
|
|
43319
|
-
type: graphConvert("type", () => parseActivityType(this.type)),
|
|
43320
|
-
title: this.title,
|
|
43321
|
-
content,
|
|
43322
|
-
tags: this.tag,
|
|
43323
|
-
agentAssigneeIds: this.agentAssignee,
|
|
43324
|
-
sourceCreatedAt,
|
|
43325
|
-
autoLinkPersonalSpace: this.autoLink,
|
|
43326
|
-
entitySpaceGrantFingerprint: this.entitySpaceGrantFingerprint
|
|
43327
|
-
});
|
|
43328
|
-
const progress = graphProgress(this, "activity.create", ["create", ...sourceCreatedAt ? ["sourceCreatedAt"] : []]);
|
|
43329
|
-
return progress.run(async () => {
|
|
43330
|
-
const caller = await resolveCaller();
|
|
43331
|
-
const entityIds = await resolveEntitiesC(caller, intent.entities);
|
|
43332
|
-
const spaceId2 = await resolveSpaceByNameC(caller, intent.space);
|
|
43333
|
-
parseActivityWriteRequest("createActivity", { ...Object.fromEntries(Object.entries(intent).filter(([key]) => !["space", "entities", "entitySpaceGrantFingerprint"].includes(key))), spaceId: spaceId2, entityIds });
|
|
43334
|
-
const activityId2 = await progress.write("create", () => caller.mutation(activitiesCreate, {
|
|
43335
|
-
entityId: entityIds[0],
|
|
43336
|
-
additionalEntities: entityIds.slice(1),
|
|
43337
|
-
ownerSpaceId: spaceId2,
|
|
43338
|
-
grantMissingEntityAccess: this.autoLink,
|
|
43339
|
-
...this.entitySpaceGrantFingerprint !== void 0 ? { entitySpaceGrantFingerprint: this.entitySpaceGrantFingerprint } : {},
|
|
43340
|
-
type: intent.type,
|
|
43341
|
-
title: intent.title,
|
|
43342
|
-
...intent.agentAssigneeIds?.length ? { agentAssigneeIds: intent.agentAssigneeIds } : {},
|
|
43343
|
-
...content !== void 0 ? { contentMarkdown: content } : {},
|
|
43344
|
-
...intent.tags?.length ? { tags: intent.tags } : {}
|
|
43345
|
-
}), (raw) => graphResult(graphId2, raw), "activityId");
|
|
43346
|
-
if (sourceCreatedAt) await progress.write("sourceCreatedAt", () => caller.mutation(activitiesUpdateCreatedAt, { activityId: activityId2, sourceCreatedAt }), graphAck);
|
|
43347
|
-
const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
|
|
43348
|
-
await progress.observe("output", async () => this.emitText(graphEnvelope(graphCreated, { activityId: activityId2 }, spaces), () => withFooter(`Created ${this.type} '${this.title}' (${activityId2})`, spaces)));
|
|
43349
|
-
});
|
|
43350
|
-
}
|
|
43351
|
-
};
|
|
43352
|
-
var ActivitySearch = class extends ClientCommand {
|
|
43353
|
-
static paths = [["activity", "search"]];
|
|
43354
|
-
static usage = Command.Usage({ category: "Activity", description: "Search activities by title or content" });
|
|
43355
|
-
query = options_exports.String();
|
|
43356
|
-
entity = options_exports.String("--entity", { description: "Filter by entity and bounded direct-child hierarchy (name or ID)" });
|
|
43357
|
-
type = options_exports.String("--type", { description: "Filter by activity type" });
|
|
43358
|
-
limit = options_exports.String("--limit", { description: "Max results" });
|
|
43359
|
-
projection = options_exports.String("--projection", { description: "compact or full public fields" });
|
|
43360
|
-
async run() {
|
|
43361
|
-
const request = parseActivityReadRequest("searchActivities", {
|
|
43362
|
-
query: this.query,
|
|
43363
|
-
type: this.type,
|
|
43364
|
-
limit: this.limit === void 0 ? void 0 : parseOperationNumberParameter("searchActivities", "limit", this.limit),
|
|
43365
|
-
projection: this.projection
|
|
43366
|
-
});
|
|
43367
|
-
if (this.entity !== void 0 && !this.entity.trim()) throw new OperationInputError("searchActivities", [{ path: ["entityId"], reason: "too_small" }]);
|
|
43368
|
-
const client = this.client();
|
|
43369
|
-
const entityId2 = this.entity === void 0 ? void 0 : await resolveEntity(client, this.entity);
|
|
43370
|
-
const { data } = await client.activityRead("searchActivities", { ...request.input, entityId: entityId2 });
|
|
43371
|
-
const spaces = await client.listSpaces();
|
|
43372
|
-
this.emitText(jsonWithSpaces({ data }, spaces), () => this.withFooter(formatActivityList(data.activities), spaces));
|
|
43373
|
-
}
|
|
43374
|
-
};
|
|
43375
|
-
var ActivityGet = class extends ClientCommand {
|
|
43376
|
-
static paths = [["activity", "get"]];
|
|
43377
|
-
static usage = Command.Usage({ category: "Activity", description: "Get a single activity by ID" });
|
|
43378
|
-
id = options_exports.String();
|
|
43379
|
-
projection = options_exports.String("--projection", { description: "compact or full public fields" });
|
|
43380
|
-
async run() {
|
|
43381
|
-
const request = parseActivityReadRequest("getActivity", { activityId: this.id, projection: this.projection });
|
|
43382
|
-
const client = this.client();
|
|
43383
|
-
const { data } = await client.activityRead("getActivity", request.input);
|
|
43384
|
-
if (!data || data.projection === "tombstone") {
|
|
43385
|
-
this.emitText({ data: null }, () => "Activity not found or not accessible");
|
|
43386
|
-
return;
|
|
43387
|
-
}
|
|
43388
|
-
if ("attachments" in data) for (const attachment4 of data.attachments ?? []) attachmentResult(attachment4);
|
|
43389
|
-
const spaces = await client.listSpaces();
|
|
43390
|
-
this.emitText(jsonWithSpaces({ data }, spaces), () => {
|
|
43391
|
-
const detail = this.withFooter(formatActivityDetail(data), spaces);
|
|
43392
|
-
return (data.revisionCount ?? 0) > 1 ? `${detail}
|
|
43393
43373
|
|
|
43394
|
-
|
|
43395
|
-
});
|
|
43396
|
-
}
|
|
43397
|
-
};
|
|
43398
|
-
var ActivityRevisions = class extends ProfileCommand {
|
|
43399
|
-
static paths = [["activity", "revisions"]];
|
|
43400
|
-
static usage = Command.Usage({
|
|
43401
|
-
category: "Activity",
|
|
43402
|
-
description: "List an activity's version history (newest first)"
|
|
43403
|
-
});
|
|
43404
|
-
id = options_exports.String();
|
|
43405
|
-
async run() {
|
|
43406
|
-
graphInput(graphId2, this.id);
|
|
43407
|
-
const caller = await resolveCaller();
|
|
43408
|
-
const revisions = revisionListResult(await caller.query(activitiesListRevisions, { activityId: this.id }), this.id);
|
|
43409
|
-
this.emitText({ data: revisions }, () => {
|
|
43410
|
-
if (revisions.length === 0) return "No versions recorded yet.";
|
|
43411
|
-
const lines = revisions.map(formatRevisionLine);
|
|
43412
|
-
return [
|
|
43413
|
-
`${revisions.length} version(s) \u2014 newest first:`,
|
|
43414
|
-
...lines,
|
|
43415
|
-
"",
|
|
43416
|
-
`View one: ente activity revision ${this.id} <revisionId>`,
|
|
43417
|
-
`Restore one: ente activity restore-revision ${this.id} <revisionId>`
|
|
43418
|
-
].join("\n");
|
|
43419
|
-
});
|
|
43420
|
-
}
|
|
43421
|
-
};
|
|
43422
|
-
var ActivityRevisionShow = class extends ProfileCommand {
|
|
43423
|
-
static paths = [["activity", "revision"]];
|
|
43424
|
-
static usage = Command.Usage({
|
|
43425
|
-
category: "Activity",
|
|
43426
|
-
description: "Show a single past version of an activity (read-only)"
|
|
43427
|
-
});
|
|
43428
|
-
activityId = options_exports.String();
|
|
43429
|
-
revisionId = options_exports.String();
|
|
43430
|
-
async run() {
|
|
43431
|
-
graphInput(graphId2, this.activityId);
|
|
43432
|
-
graphInput(graphId2, this.revisionId);
|
|
43433
|
-
const caller = await resolveCaller();
|
|
43434
|
-
const rev = revisionResult(await caller.query(activitiesGetRevision, { revisionId: this.revisionId }), this.activityId, this.revisionId);
|
|
43435
|
-
if (!rev) throw new Error(`Revision not found or not accessible: ${this.revisionId}`);
|
|
43436
|
-
if (rev.activityId !== this.activityId) {
|
|
43437
|
-
throw new Error(`Revision ${this.revisionId} does not belong to activity ${this.activityId}.`);
|
|
43438
|
-
}
|
|
43439
|
-
this.emitText(
|
|
43440
|
-
{ data: rev },
|
|
43441
|
-
() => [
|
|
43442
|
-
`Version of activity ${rev.activityId}`,
|
|
43443
|
-
`Captured: ${formatRevisionTimestamp(rev.createdAt)} [${rev.source}] ${rev.authorAgent?.name ?? rev.authorName ?? rev.authorAgentId ?? rev.authorId}`,
|
|
43444
|
-
rev.agentThreadId ? `Agent thread: ${rev.agentThreadId}${rev.agentRunId ? ` run: ${rev.agentRunId}` : ""}` : null,
|
|
43445
|
-
rev.summary ? `Note: ${rev.summary}` : null,
|
|
43446
|
-
"",
|
|
43447
|
-
rev.title ? `# ${rev.title}` : null,
|
|
43448
|
-
rev.contentPlainText && rev.contentPlainText.length ? rev.contentPlainText : "(empty body)"
|
|
43449
|
-
].filter((line) => line !== null).join("\n")
|
|
43450
|
-
);
|
|
43451
|
-
}
|
|
43452
|
-
};
|
|
43453
|
-
var ActivityRestoreRevision = class extends ProfileCommand {
|
|
43454
|
-
static paths = [["activity", "restore-revision"]];
|
|
43455
|
-
static usage = Command.Usage({
|
|
43456
|
-
category: "Activity",
|
|
43457
|
-
description: "Restore an activity's body + title to a past version"
|
|
43458
|
-
});
|
|
43459
|
-
activityId = options_exports.String();
|
|
43460
|
-
revisionId = options_exports.String();
|
|
43461
|
-
async run() {
|
|
43462
|
-
graphInput(graphId2, this.activityId);
|
|
43463
|
-
graphInput(graphId2, this.revisionId);
|
|
43464
|
-
const caller = await resolveCaller();
|
|
43465
|
-
const rev = revisionResult(await caller.query(activitiesGetRevision, { revisionId: this.revisionId }), this.activityId, this.revisionId);
|
|
43466
|
-
if (!rev) throw new Error(`Revision not found or not accessible: ${this.revisionId}`);
|
|
43467
|
-
if (rev.activityId !== this.activityId) {
|
|
43468
|
-
throw new Error(`Revision ${this.revisionId} does not belong to activity ${this.activityId}.`);
|
|
43469
|
-
}
|
|
43470
|
-
const progress = graphProgress(this, "activity.restoreRevision", ["restoreRevision"], { activityId: this.activityId, revisionId: this.revisionId });
|
|
43471
|
-
await progress.run(async () => {
|
|
43472
|
-
const result = await progress.write("restoreRevision", () => caller.mutation(activitiesRestoreRevision, { revisionId: this.revisionId }), (raw) => restoredRevisionResult(raw, this.activityId));
|
|
43473
|
-
const spaces = await progress.observe("spacesFooter", () => spacesFooterFromMemberships(caller));
|
|
43474
|
-
await progress.observe("output", async () => this.emitText(
|
|
43475
|
-
graphEnvelope(external_exports.strictObject({ ok: external_exports.literal(true), activityId: graphId2 }), { ok: true, ...result }, spaces),
|
|
43476
|
-
() => withFooter(`Restored activity ${result.activityId} to the version from ${formatRevisionTimestamp(rev.createdAt)}. A new "restored" version was recorded.`, spaces)
|
|
43477
|
-
));
|
|
43478
|
-
});
|
|
43479
|
-
}
|
|
43480
|
-
};
|
|
43481
|
-
var ActivityUpdate = class extends ProfileCommand {
|
|
43482
|
-
static paths = [["activity", "update"]];
|
|
43483
|
-
static usage = Command.Usage({ category: "Activity", description: "Update an activity" });
|
|
43484
|
-
id = options_exports.String();
|
|
43485
|
-
agentAssignee = options_exports.Array("--agent-assignee", { description: "Replace agent assignees with these IDs (repeatable); preserves human assignees" });
|
|
43486
|
-
clearAgentAssignees = options_exports.Boolean("--clear-agent-assignees", false, { description: "Remove all agent assignees" });
|
|
43487
|
-
content = options_exports.String("--content", { description: "Update content" });
|
|
43488
|
-
contentFile = options_exports.String("--content-file", { description: "Read updated content from a markdown/text file" });
|
|
43489
|
-
title = options_exports.String("--title", { description: "Update title" });
|
|
43490
|
-
deadline = options_exports.String("--deadline", { description: "Update deadline (human-friendly)" });
|
|
43491
|
-
clearDeadline = options_exports.Boolean("--clear-deadline", false, { description: "Remove the deadline" });
|
|
43492
|
-
entityAdd = options_exports.Array("--entity-add", { description: "Link additional entities" });
|
|
43493
|
-
entityRemove = options_exports.Array("--entity-remove", { description: "Unlink entities" });
|
|
43494
|
-
async run() {
|
|
43495
|
-
const content = graphConvert("content", () => readContentOption(this.content, this.contentFile));
|
|
43496
|
-
if (this.clearDeadline && this.deadline !== void 0) throw new Error("Use either --deadline or --clear-deadline, not both.");
|
|
43497
|
-
const deadline = graphConvert("deadline", () => deadlineChange(this.deadline, this.clearDeadline));
|
|
43498
|
-
const addNames = this.entityAdd === void 0 ? [] : graphInput(graphSelectors, this.entityAdd);
|
|
43499
|
-
const removeNames = this.entityRemove === void 0 ? [] : graphInput(graphSelectors, this.entityRemove);
|
|
43500
|
-
const hasEntityChange = addNames.length > 0 || removeNames.length > 0;
|
|
43501
|
-
if (this.clearAgentAssignees && this.agentAssignee?.length) throw new Error("Choose --agent-assignee or --clear-agent-assignees");
|
|
43502
|
-
const agentAssigneeIds = this.clearAgentAssignees ? [] : this.agentAssignee;
|
|
43503
|
-
parseActivityWriteRequest("updateActivity", { activityId: this.id, title: this.title, content, ...deadline ? { deadline: deadline.deadline ?? null } : {}, agentAssigneeIds });
|
|
43504
|
-
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.");
|
|
43505
|
-
const steps = [...agentAssigneeIds !== void 0 ? ["agentAssignees"] : [], ...this.title !== void 0 ? ["title"] : [], ...deadline ? ["deadline"] : [], ...content !== void 0 ? ["content"] : [], ...hasEntityChange ? ["entities"] : []];
|
|
43506
|
-
const progress = graphProgress(this, "activity.update", steps, { activityId: this.id });
|
|
43507
|
-
return progress.run(async () => {
|
|
43508
|
-
const caller = await resolveCaller();
|
|
43509
|
-
if (agentAssigneeIds !== void 0) await progress.write("agentAssignees", () => caller.mutation(makeFunctionReference2("taskAgents:updateAssignments"), { activityId: this.id, agentAssigneeIds }), graphAck);
|
|
43510
|
-
if (this.title !== void 0) await progress.write("title", () => caller.mutation(activitiesUpdateTitle, { activityId: this.id, title: this.title }), graphAck);
|
|
43511
|
-
if (deadline) await progress.write("deadline", () => caller.mutation(activitiesUpdateDeadline, { activityId: this.id, ...deadline }), graphAck);
|
|
43512
|
-
if (content !== void 0) await progress.write("content", () => caller.mutation(activitiesSetContentFromMarkdown, { activityId: this.id, markdown: content }), graphAck);
|
|
43513
|
-
if (hasEntityChange) await progress.observe("entityResolution", async () => {
|
|
43514
|
-
const rich = graphResult(graphPublicRich.nullable(), await caller.query(activitiesGetByIdRich, { activityId: this.id }));
|
|
43515
|
-
if (!rich) throw new Error("Activity not found or not accessible");
|
|
43516
|
-
const currentIds = rich.entityDetails.flatMap((entity5) => entity5 ? [entity5._id] : []);
|
|
43517
|
-
const addIds = await resolveEntitiesC(caller, addNames);
|
|
43518
|
-
const removeSet = new Set(await resolveEntitiesC(caller, removeNames));
|
|
43519
|
-
const newIds = currentIds.filter((id21) => !removeSet.has(id21));
|
|
43520
|
-
for (const id21 of addIds) if (!currentIds.includes(id21)) newIds.push(id21);
|
|
43521
|
-
parseActivityWriteRequest("updateActivity", { activityId: this.id, entityIds: newIds });
|
|
43522
|
-
await progress.write("entities", () => caller.mutation(activitiesUpdateEntities, { activityId: this.id, entities: newIds }), graphAck);
|
|
43523
|
-
});
|
|
43524
|
-
const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
|
|
43525
|
-
await progress.observe("output", async () => this.emitText(graphEnvelope(graphContextAck, { success: true, activityId: this.id }, spaces), () => withFooter(`Updated activity ${this.id}`, spaces)));
|
|
43526
|
-
});
|
|
43527
|
-
}
|
|
43528
|
-
};
|
|
43374
|
+
// ente/commands/activityContent.ts
|
|
43529
43375
|
var ActivityContentRead = class extends ProfileCommand {
|
|
43530
43376
|
static paths = [["activity", "content", "read"]];
|
|
43531
43377
|
static usage = Command.Usage({
|
|
@@ -43587,39 +43433,6 @@ var ActivityContentEdit = class extends ProfileCommand {
|
|
|
43587
43433
|
});
|
|
43588
43434
|
}
|
|
43589
43435
|
};
|
|
43590
|
-
var ActivityDelete = class extends ProfileCommand {
|
|
43591
|
-
static paths = [["activity", "delete"]];
|
|
43592
|
-
static usage = Command.Usage({
|
|
43593
|
-
category: "Activity",
|
|
43594
|
-
description: "Move an activity to the trash (soft delete). Use `activity restore` to undo."
|
|
43595
|
-
});
|
|
43596
|
-
id = options_exports.String();
|
|
43597
|
-
async run() {
|
|
43598
|
-
parseActivityWriteRequest("deleteActivity", { activityId: this.id });
|
|
43599
|
-
const progress = graphProgress(this, "activity.deleteActivity", ["deleteActivity"], { activityId: this.id });
|
|
43600
|
-
return progress.run(async () => {
|
|
43601
|
-
const caller = await resolveCaller();
|
|
43602
|
-
await progress.write("deleteActivity", () => caller.mutation(activitiesDeleteActivity, { activityId: this.id }), graphAck);
|
|
43603
|
-
const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
|
|
43604
|
-
await progress.observe("output", async () => this.emitText(graphEnvelope(graphContextAck, { success: true, activityId: this.id }, spaces), () => withFooter(`Trashed activity ${this.id}`, spaces)));
|
|
43605
|
-
});
|
|
43606
|
-
}
|
|
43607
|
-
};
|
|
43608
|
-
var ActivityRestore = class extends ProfileCommand {
|
|
43609
|
-
static paths = [["activity", "restore"]];
|
|
43610
|
-
static usage = Command.Usage({ category: "Activity", description: "Restore a trashed activity" });
|
|
43611
|
-
id = options_exports.String();
|
|
43612
|
-
async run() {
|
|
43613
|
-
parseActivityWriteRequest("restoreActivity", { activityId: this.id });
|
|
43614
|
-
const progress = graphProgress(this, "activity.restoreActivity", ["restoreActivity"], { activityId: this.id });
|
|
43615
|
-
return progress.run(async () => {
|
|
43616
|
-
const caller = await resolveCaller();
|
|
43617
|
-
await progress.write("restoreActivity", () => caller.mutation(activitiesRestoreActivity, { activityId: this.id }), graphAck);
|
|
43618
|
-
const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
|
|
43619
|
-
await progress.observe("output", async () => this.emitText(graphEnvelope(graphContextAck, { success: true, activityId: this.id }, spaces), () => withFooter(`Restored activity ${this.id}`, spaces)));
|
|
43620
|
-
});
|
|
43621
|
-
}
|
|
43622
|
-
};
|
|
43623
43436
|
var ActivityAttachmentUpload = class extends ProfileCommand {
|
|
43624
43437
|
static paths = [["activity", "attachment", "upload"]];
|
|
43625
43438
|
static usage = Command.Usage({
|
|
@@ -43696,6 +43509,8 @@ var ActivityMessageAdd = class extends ProfileCommand {
|
|
|
43696
43509
|
});
|
|
43697
43510
|
}
|
|
43698
43511
|
};
|
|
43512
|
+
|
|
43513
|
+
// ente/commands/activityHtml.ts
|
|
43699
43514
|
var ActivityHtmlList = class extends ProfileCommand {
|
|
43700
43515
|
static paths = [["activity", "html", "list"]];
|
|
43701
43516
|
static usage = Command.Usage({ category: "Activity", description: "List interactive HTML blocks in an activity" });
|
|
@@ -43860,6 +43675,351 @@ var ActivityMessageHtmlUpdate = class extends ProfileCommand {
|
|
|
43860
43675
|
));
|
|
43861
43676
|
}
|
|
43862
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
|
+
};
|
|
43863
44023
|
var ACTIVITY_COMMANDS = [
|
|
43864
44024
|
ActivityList,
|
|
43865
44025
|
ActivityCreate,
|
|
@@ -43885,6 +44045,31 @@ var ACTIVITY_COMMANDS = [
|
|
|
43885
44045
|
ActivityAttachmentUpload
|
|
43886
44046
|
];
|
|
43887
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
|
+
|
|
43888
44073
|
// ente/commands/activityTranscript.ts
|
|
43889
44074
|
init_server();
|
|
43890
44075
|
var listForActivity = makeFunctionReference2(
|
|
@@ -44099,7 +44284,7 @@ var TaskGet = class extends ProfileCommand {
|
|
|
44099
44284
|
this.emitText(graphEnvelope(graphTaskItem, taskItem, spaces, users), () => withFooter(formatTaskDetail(taskItem, users), spaces));
|
|
44100
44285
|
}
|
|
44101
44286
|
};
|
|
44102
|
-
var TaskCreate = class extends
|
|
44287
|
+
var TaskCreate = class extends ClientCommand {
|
|
44103
44288
|
static paths = [["task", "create"]];
|
|
44104
44289
|
static usage = Command.Usage({ category: "Task", description: "Create a task" });
|
|
44105
44290
|
title = options_exports.String();
|
|
@@ -44124,16 +44309,19 @@ var TaskCreate = class extends ProfileCommand {
|
|
|
44124
44309
|
entitySpaceGrantFingerprint = options_exports.String("--entity-space-grant-fingerprint", {
|
|
44125
44310
|
description: "Exact grant fingerprint returned by the confirmation-required error"
|
|
44126
44311
|
});
|
|
44312
|
+
field = options_exports.Array("--field", { description: "Typed field JSON: {label or fieldId, optional type, value}; repeatable, null removes" });
|
|
44127
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.");
|
|
44128
44316
|
if (this.noDeadline && this.deadline !== void 0) throw new Error("Use either --deadline or --no-deadline, not both.");
|
|
44129
44317
|
const deadline = this.noDeadline ? void 0 : graphConvert("deadline", () => this.deadline === void 0 ? defaultDeadline() : parseDeadline(this.deadline));
|
|
44130
44318
|
const attributes2 = graphConvert("attributes", () => parseAttrs(this.attr));
|
|
44131
44319
|
const sourceCreatedAt = this.sourceCreatedAt === void 0 ? void 0 : graphConvert("sourceCreatedAt", () => parseSourceCreatedAt(this.sourceCreatedAt, this.sourceCreatedAtTimezone));
|
|
44132
44320
|
const directAssigneeIds = (this.assignee ?? []).filter((value) => !value.includes("@"));
|
|
44133
44321
|
const emailAssignees = [...(this.assignee ?? []).filter((value) => value.includes("@")), ...this.assigneeEmail ?? []];
|
|
44134
|
-
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 });
|
|
44135
44323
|
const entries = Object.entries(attributes2);
|
|
44136
|
-
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"] : []]);
|
|
44137
44325
|
return progress.run(async () => {
|
|
44138
44326
|
const caller = await resolveCaller();
|
|
44139
44327
|
const entityIds = await resolveEntitiesC(caller, intent.entities);
|
|
@@ -44141,7 +44329,7 @@ var TaskCreate = class extends ProfileCommand {
|
|
|
44141
44329
|
const resolved = await resolveAssigneeEmailsToIds(caller, spaceId2, emailAssignees);
|
|
44142
44330
|
const assigneeIds = [.../* @__PURE__ */ new Set([...directAssigneeIds, ...resolved])];
|
|
44143
44331
|
parseActivityWriteRequest("createActivity", { ...Object.fromEntries(Object.entries(intent).filter(([key]) => !["space", "entities", "entitySpaceGrantFingerprint"].includes(key))), spaceId: spaceId2, entityIds, assigneeIds });
|
|
44144
|
-
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, {
|
|
44145
44333
|
entityId: entityIds[0],
|
|
44146
44334
|
additionalEntities: entityIds.slice(1),
|
|
44147
44335
|
ownerSpaceId: spaceId2,
|
|
@@ -44154,14 +44342,14 @@ var TaskCreate = class extends ProfileCommand {
|
|
|
44154
44342
|
...this.tag?.length ? { tags: this.tag } : {},
|
|
44155
44343
|
...this.content !== void 0 ? { contentMarkdown: this.content } : {}
|
|
44156
44344
|
}), (raw) => graphResult(graphId2, raw), "activityId");
|
|
44157
|
-
for (const [index, [key, value]] of entries.entries()) await progress.write(`attribute[${index}]`, () => caller.mutation(activitiesSetAttribute, { activityId: activityId2, key, value }), graphAck);
|
|
44158
|
-
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);
|
|
44159
44347
|
const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
|
|
44160
44348
|
await progress.observe("output", async () => this.emitText(graphEnvelope(graphCreated, { activityId: activityId2 }, spaces), () => withFooter(`Created task '${this.title}' (${activityId2})`, spaces)));
|
|
44161
44349
|
});
|
|
44162
44350
|
}
|
|
44163
44351
|
};
|
|
44164
|
-
var TaskUpdate = class extends
|
|
44352
|
+
var TaskUpdate = class extends ClientCommand {
|
|
44165
44353
|
static paths = [["task", "update"]];
|
|
44166
44354
|
static usage = Command.Usage({ category: "Task", description: "Update a task" });
|
|
44167
44355
|
id = options_exports.String();
|
|
@@ -44170,23 +44358,29 @@ var TaskUpdate = class extends ProfileCommand {
|
|
|
44170
44358
|
attr = options_exports.Array("--attr", { description: "Set attributes as key=value pairs" });
|
|
44171
44359
|
deadline = options_exports.String("--deadline", { description: "Update deadline (human-friendly)" });
|
|
44172
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" });
|
|
44173
44362
|
async run() {
|
|
44363
|
+
const fields4 = parseActivityFields(this.field);
|
|
44174
44364
|
graphTaskNumber(this.id);
|
|
44175
44365
|
const attributes2 = graphConvert("attributes", () => parseAttrs(this.attr));
|
|
44176
44366
|
if (this.clearDeadline && this.deadline !== void 0) throw new Error("Use either --deadline or --clear-deadline, not both.");
|
|
44177
44367
|
const deadline = graphConvert("deadline", () => deadlineChange(this.deadline, this.clearDeadline));
|
|
44178
|
-
parseActivityWriteRequest("updateActivity", { activityId: this.id, title: this.title, content: this.content, ...deadline ? { deadline: deadline.deadline ?? null } : {}, attributes: attributes2 });
|
|
44179
|
-
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.");
|
|
44180
44370
|
const entries = Object.entries(attributes2);
|
|
44181
|
-
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}]`) : []]);
|
|
44182
44372
|
return progress.run(async () => {
|
|
44183
44373
|
const caller = await resolveCaller();
|
|
44184
44374
|
const activityId2 = await resolveTaskIdC(caller, this.id);
|
|
44185
44375
|
progress.identify(activityId2);
|
|
44186
|
-
if (
|
|
44187
|
-
|
|
44188
|
-
|
|
44189
|
-
|
|
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
|
+
}
|
|
44190
44384
|
const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
|
|
44191
44385
|
await progress.observe("output", async () => this.emitText(graphEnvelope(graphContextAck, { success: true, activityId: activityId2 }, spaces), () => withFooter(`Updated task ${this.id}`, spaces)));
|
|
44192
44386
|
});
|
|
@@ -44244,11 +44438,11 @@ var TaskAssign = class extends ProfileCommand {
|
|
|
44244
44438
|
this.emitText(graphEnvelope(graphContextAck, { success: true, activityId: activityId2, assigneeIds: current, changed: false }), () => "User is already assigned.");
|
|
44245
44439
|
return;
|
|
44246
44440
|
}
|
|
44247
|
-
const
|
|
44248
|
-
parseActivityWriteRequest("updateActivityAssignees", { activityId: activityId2, action: "replace", assigneeIds:
|
|
44249
|
-
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);
|
|
44250
44444
|
const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
|
|
44251
|
-
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)));
|
|
44252
44446
|
});
|
|
44253
44447
|
}
|
|
44254
44448
|
};
|
|
@@ -44277,11 +44471,11 @@ var TaskUnassign = class extends ProfileCommand {
|
|
|
44277
44471
|
this.emitText(graphEnvelope(graphContextAck, { success: true, activityId: activityId2, assigneeIds: current, changed: false }), () => "User is not assigned to this task.");
|
|
44278
44472
|
return;
|
|
44279
44473
|
}
|
|
44280
|
-
const
|
|
44281
|
-
parseActivityWriteRequest("updateActivityAssignees", { activityId: activityId2, action: "replace", assigneeIds:
|
|
44282
|
-
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);
|
|
44283
44477
|
const spaces = await progress.observe("spaces", () => spacesFooterFromMemberships(caller));
|
|
44284
|
-
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)));
|
|
44285
44479
|
});
|
|
44286
44480
|
}
|
|
44287
44481
|
};
|
|
@@ -44368,9 +44562,6 @@ var TASK_COMMANDS = [
|
|
|
44368
44562
|
TasksAlias
|
|
44369
44563
|
];
|
|
44370
44564
|
|
|
44371
|
-
// ente/commands/list.ts
|
|
44372
|
-
import { readFileSync as readFileSync10 } from "node:fs";
|
|
44373
|
-
|
|
44374
44565
|
// ente/entityIcon.ts
|
|
44375
44566
|
var ICONS = [...AGENT_ICON_IDS, ...legacyCustomIconIds];
|
|
44376
44567
|
function parseEntityIcon(value) {
|
|
@@ -44379,9 +44570,6 @@ function parseEntityIcon(value) {
|
|
|
44379
44570
|
return icon2;
|
|
44380
44571
|
}
|
|
44381
44572
|
|
|
44382
|
-
// ente/commands/list.ts
|
|
44383
|
-
init_server();
|
|
44384
|
-
|
|
44385
44573
|
// ../packages/shared/src/database-view.ts
|
|
44386
44574
|
var databaseAttributeTypeValidator = v.union(
|
|
44387
44575
|
v.literal("text"),
|
|
@@ -44779,7 +44967,8 @@ ${failures.map((e) => ` - ${e instanceof Error ? e.message : String(e)}`).join(
|
|
|
44779
44967
|
);
|
|
44780
44968
|
}
|
|
44781
44969
|
|
|
44782
|
-
// ente/commands/
|
|
44970
|
+
// ente/commands/listShared.ts
|
|
44971
|
+
init_server();
|
|
44783
44972
|
var DATABASE_LIST_TABS = ["database", "activities"];
|
|
44784
44973
|
function assertListIcon(icon2, type) {
|
|
44785
44974
|
if (type !== "topic")
|
|
@@ -44975,93 +45164,82 @@ function countActions(results) {
|
|
|
44975
45164
|
unchanged: results.filter((r) => r.action === "unchanged").length
|
|
44976
45165
|
};
|
|
44977
45166
|
}
|
|
44978
|
-
|
|
44979
|
-
|
|
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"]];
|
|
44980
45180
|
static usage = Command.Usage({
|
|
44981
45181
|
category: "List",
|
|
44982
|
-
description: "
|
|
44983
|
-
examples: [
|
|
44984
|
-
[
|
|
44985
|
-
"A Sarah-ideas list with a category column",
|
|
44986
|
-
'ente list create "Sarah \u2013 Ideen" --space Personal --column "kategorie:single-select:Aktivit\xE4t,Essen,Geschenk,Film"'
|
|
44987
|
-
],
|
|
44988
|
-
[
|
|
44989
|
-
"A recipe collection with labelled columns and an icon",
|
|
44990
|
-
'ente list create Rezepte --space "ivo&sarah" --icon book-open --column "protein_g=Protein (g):number" --column "vegan:boolean"'
|
|
44991
|
-
],
|
|
44992
|
-
[
|
|
44993
|
-
"A sync target pinned under a project",
|
|
44994
|
-
'ente list create Firmen --space "ivo&thomas" --pin Recherche --column "repo:text" --column "stage:single-select:Kandidat,in Review,verfolgt,verworfen"'
|
|
44995
|
-
]
|
|
44996
|
-
]
|
|
44997
|
-
});
|
|
44998
|
-
name = options_exports.String();
|
|
44999
|
-
space = options_exports.String("--space", { required: true, description: "Space to create in (name or ID)" });
|
|
45000
|
-
type = options_exports.String("--type", "topic", { description: "Entity type: topic (default) or project" });
|
|
45001
|
-
column = options_exports.Array("--column", {
|
|
45002
|
-
description: "Column: key[=Label]:type[:opt1,opt2] (type \u2208 text|number|boolean|single-select|multi-select)"
|
|
45003
|
-
});
|
|
45004
|
-
description = options_exports.String("--description", { description: "Searchable description for the list" });
|
|
45005
|
-
icon = options_exports.String("--icon", {
|
|
45006
|
-
description: `Topic icon from the web icon picker: ${entityCustomIconIds.join(", ")}`
|
|
45007
|
-
});
|
|
45008
|
-
pin = options_exports.Array("--pin", { description: "Pin the list under parent entities (resolved by name)" });
|
|
45009
|
-
shareParents = options_exports.Boolean("--share-parents", false, {
|
|
45010
|
-
description: "Share pinned parents and ancestors into the list's space when required"
|
|
45011
|
-
});
|
|
45012
|
-
parentSpaceGrantFingerprint = options_exports.String("--parent-space-grant-fingerprint", {
|
|
45013
|
-
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"']]
|
|
45014
45184
|
});
|
|
45185
|
+
list = options_exports.String();
|
|
45186
|
+
columns = options_exports.Rest({ required: 1 });
|
|
45015
45187
|
async run() {
|
|
45016
|
-
|
|
45017
|
-
|
|
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);
|
|
45018
45195
|
}
|
|
45019
|
-
const columns =
|
|
45020
|
-
const
|
|
45021
|
-
|
|
45022
|
-
|
|
45023
|
-
|
|
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() {
|
|
45024
45216
|
const caller = await resolveCaller();
|
|
45025
|
-
const
|
|
45026
|
-
const
|
|
45027
|
-
const
|
|
45028
|
-
|
|
45029
|
-
|
|
45030
|
-
|
|
45031
|
-
const { entityId: entityId2, pins } = await progress.run(async () => {
|
|
45032
|
-
const entityId3 = await progress.write("create", () => databaseWrite(() => caller.mutation(entitiesCreate2, create3)), (raw) => projectEntityWriteResult("createEntity", raw).entityId, "entityId");
|
|
45033
|
-
if (columns.length > 0) {
|
|
45034
|
-
const args = parseDatabaseProtocolInput("entities:updateDatabaseView", databaseConfigurationContracts.updateDatabaseView.args, { id: entityId3, databaseView: initialView });
|
|
45035
|
-
await progress.write("columns", () => databaseWrite(() => caller.mutation(updateDatabaseView, args)), (raw) => parseOperationResult("entities:updateDatabaseView", databaseConfigurationContracts.updateDatabaseView.result, raw));
|
|
45036
|
-
}
|
|
45037
|
-
const tabs2 = parseDatabaseProtocolInput("entities:setEnabledTabs", databaseConfigurationContracts.setEnabledTabs.args, { entityId: entityId3, enabledTabs: DATABASE_LIST_TABS });
|
|
45038
|
-
await progress.write("tabs", () => databaseWrite(() => caller.mutation(setEnabledTabs, tabs2)), (raw) => parseOperationResult("entities:setEnabledTabs", databaseConfigurationContracts.setEnabledTabs.result, raw));
|
|
45039
|
-
if (this.description) {
|
|
45040
|
-
const args = descriptionArgs(entityId3, this.description);
|
|
45041
|
-
await progress.write("description", () => databaseWrite(() => caller.mutation(setDescriptionFromMarkdown, args)), (raw) => projectEntityWriteResult("updateEntity", raw));
|
|
45042
|
-
}
|
|
45043
|
-
if (icon2) {
|
|
45044
|
-
const args = parseDatabaseProtocolInput("entities:setCustomIcon", databaseConfigurationContracts.setCustomIcon.args, { id: entityId3, icon: icon2 });
|
|
45045
|
-
await progress.write("icon", () => databaseWrite(() => caller.mutation(setCustomIcon, args)), (raw) => parseOperationResult("entities:setCustomIcon", databaseConfigurationContracts.setCustomIcon.result, raw));
|
|
45046
|
-
}
|
|
45047
|
-
const pins2 = await progress.observe("pins", () => pinToTargets(caller, entityId3, this.pin ?? [], {
|
|
45048
|
-
shareParents: this.shareParents,
|
|
45049
|
-
...this.parentSpaceGrantFingerprint ? { parentSpaceGrantFingerprint: this.parentSpaceGrantFingerprint } : {}
|
|
45050
|
-
}));
|
|
45051
|
-
const data = { entityId: entityId3, name: this.name, type: this.type, columns, enabledTabs: DATABASE_LIST_TABS };
|
|
45052
|
-
this.emitText(
|
|
45053
|
-
pins2.failures.length ? {
|
|
45054
|
-
data: { ...data, pinFailures: pins2.failures, pinSucceeded: pins2.succeeded },
|
|
45055
|
-
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" }
|
|
45056
|
-
} : { data: { ...data, ...pins2.succeeded.length ? { pinSucceeded: pins2.succeeded } : {} } },
|
|
45057
|
-
() => `Created list '${this.name}' (${entityId3}) with ${columns.length} column${columns.length === 1 ? "" : "s"}; opens on its database view.${pins2.succeeded.length ? `
|
|
45058
|
-
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)"}.`
|
|
45059
45223
|
);
|
|
45060
|
-
|
|
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
|
+
}
|
|
45061
45233
|
});
|
|
45062
|
-
|
|
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
|
+
);
|
|
45063
45238
|
}
|
|
45064
45239
|
};
|
|
45240
|
+
|
|
45241
|
+
// ente/commands/listRows.ts
|
|
45242
|
+
import { readFileSync as readFileSync10 } from "node:fs";
|
|
45065
45243
|
var ListAdd = class extends ProfileCommand {
|
|
45066
45244
|
static paths = [["list", "add"]];
|
|
45067
45245
|
static usage = Command.Usage({
|
|
@@ -45124,15 +45302,6 @@ var ListAdd = class extends ProfileCommand {
|
|
|
45124
45302
|
);
|
|
45125
45303
|
}
|
|
45126
45304
|
};
|
|
45127
|
-
function columnOrThrow(columns, key, listName) {
|
|
45128
|
-
const col = columns.find((c) => c.key === key);
|
|
45129
|
-
if (!col) throw new Error(`--key '${key}' is not a column of list '${listName}'.`);
|
|
45130
|
-
if (col.type !== "text") throw new Error(`--key '${key}' must be a text column (it is ${col.type}).`);
|
|
45131
|
-
return col;
|
|
45132
|
-
}
|
|
45133
|
-
function toExisting(row) {
|
|
45134
|
-
return { rowId: row._id, title: row.title ?? null, attributes: row.attributes ?? {} };
|
|
45135
|
-
}
|
|
45136
45305
|
var ListUpdate = class extends ProfileCommand {
|
|
45137
45306
|
static paths = [["list", "update"]];
|
|
45138
45307
|
static usage = Command.Usage({
|
|
@@ -45282,66 +45451,93 @@ var ListImport = class extends ProfileCommand {
|
|
|
45282
45451
|
}
|
|
45283
45452
|
}
|
|
45284
45453
|
};
|
|
45285
|
-
|
|
45286
|
-
|
|
45454
|
+
|
|
45455
|
+
// ente/commands/list.ts
|
|
45456
|
+
var ListCreate = class extends ProfileCommand {
|
|
45457
|
+
static paths = [["list", "create"]];
|
|
45287
45458
|
static usage = Command.Usage({
|
|
45288
45459
|
category: "List",
|
|
45289
|
-
description: "
|
|
45290
|
-
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
|
+
]
|
|
45291
45475
|
});
|
|
45292
|
-
|
|
45293
|
-
|
|
45294
|
-
|
|
45295
|
-
|
|
45296
|
-
|
|
45297
|
-
|
|
45298
|
-
|
|
45299
|
-
|
|
45300
|
-
|
|
45301
|
-
|
|
45302
|
-
|
|
45303
|
-
|
|
45304
|
-
|
|
45305
|
-
|
|
45306
|
-
|
|
45307
|
-
|
|
45308
|
-
{ data: { entityId: entityId2, added, columns } },
|
|
45309
|
-
() => `Added ${added.length} column${added.length === 1 ? "" : "s"} to '${entity5.name}': ${added.map((c) => c.key).join(", ")}.`
|
|
45310
|
-
);
|
|
45311
|
-
}
|
|
45312
|
-
};
|
|
45313
|
-
var ListColumnRemove = class extends ProfileCommand {
|
|
45314
|
-
static paths = [["list", "column", "remove"]];
|
|
45315
|
-
static usage = Command.Usage({
|
|
45316
|
-
category: "List",
|
|
45317
|
-
description: "Remove columns from a database list; their values are erased from every row",
|
|
45318
|
-
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"
|
|
45319
45492
|
});
|
|
45320
|
-
list = options_exports.String();
|
|
45321
|
-
keys = options_exports.Rest({ required: 1 });
|
|
45322
45493
|
async run() {
|
|
45323
|
-
|
|
45324
|
-
|
|
45325
|
-
const present = new Set(view.columns.map((c) => c.key));
|
|
45326
|
-
const missing = this.keys.filter((key) => !present.has(key));
|
|
45327
|
-
if (missing.length > 0) {
|
|
45328
|
-
throw new Error(
|
|
45329
|
-
`Not a column of '${entity5.name}': ${missing.join(", ")}. Columns: ${[...present].join(", ") || "(none)"}.`
|
|
45330
|
-
);
|
|
45494
|
+
if (this.type !== "topic" && this.type !== "project") {
|
|
45495
|
+
throw new Error(`--type must be 'topic' or 'project' (got '${this.type}').`);
|
|
45331
45496
|
}
|
|
45332
|
-
|
|
45333
|
-
const
|
|
45334
|
-
|
|
45335
|
-
|
|
45336
|
-
|
|
45337
|
-
|
|
45338
|
-
|
|
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));
|
|
45339
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 };
|
|
45340
45539
|
});
|
|
45341
|
-
this.
|
|
45342
|
-
{ data: { entityId: entityId2, removed: this.keys, columns: current.columns } },
|
|
45343
|
-
() => `Removed ${this.keys.length} column${this.keys.length === 1 ? "" : "s"} from '${entity5.name}': ${this.keys.join(", ")}.`
|
|
45344
|
-
);
|
|
45540
|
+
failOnPinFailures((line) => this.err(line), `List '${this.name}'`, entityId2, pins);
|
|
45345
45541
|
}
|
|
45346
45542
|
};
|
|
45347
45543
|
var ListShow = class extends ProfileCommand {
|
|
@@ -49487,20 +49683,20 @@ function readNotificationEmailAttachments(imagePaths = [], inlineImageSpecs = []
|
|
|
49487
49683
|
commandLabel: "notification send"
|
|
49488
49684
|
});
|
|
49489
49685
|
const attachments = [
|
|
49490
|
-
...imagePaths.map((
|
|
49686
|
+
...imagePaths.map((path11) => readOutgoingEmailAttachment(path11, {
|
|
49491
49687
|
maxBytes: CLI_LIMITS.maxAttachmentBytes,
|
|
49492
49688
|
maxFilenameLength: CLI_LIMITS.maxFilenameLength,
|
|
49493
49689
|
requireImage: true,
|
|
49494
49690
|
commandLabel: "notification send"
|
|
49495
49691
|
})),
|
|
49496
|
-
...inlineImages.map(({ contentId, path:
|
|
49692
|
+
...inlineImages.map(({ contentId, path: path11 }) => readOutgoingEmailAttachment(path11, {
|
|
49497
49693
|
maxBytes: CLI_LIMITS.maxAttachmentBytes,
|
|
49498
49694
|
maxFilenameLength: CLI_LIMITS.maxFilenameLength,
|
|
49499
49695
|
contentId,
|
|
49500
49696
|
requireImage: true,
|
|
49501
49697
|
commandLabel: "notification send"
|
|
49502
49698
|
})),
|
|
49503
|
-
...attachmentPaths.map((
|
|
49699
|
+
...attachmentPaths.map((path11) => readOutgoingEmailAttachment(path11, {
|
|
49504
49700
|
maxBytes: CLI_LIMITS.maxAttachmentBytes,
|
|
49505
49701
|
maxFilenameLength: CLI_LIMITS.maxFilenameLength,
|
|
49506
49702
|
commandLabel: "notification send"
|
|
@@ -50122,14 +50318,14 @@ function readAgentMailBodies(options) {
|
|
|
50122
50318
|
);
|
|
50123
50319
|
}
|
|
50124
50320
|
const attachments = [
|
|
50125
|
-
...inlineImages.map(({ path:
|
|
50321
|
+
...inlineImages.map(({ path: path11, contentId }) => readOutgoingEmailAttachment(path11, {
|
|
50126
50322
|
maxBytes: AGENT_MAIL_CLI_SURFACE.limits.maxAttachmentBytes,
|
|
50127
50323
|
maxFilenameLength: AGENT_MAIL_CLI_SURFACE.limits.maxFilenameLength,
|
|
50128
50324
|
contentId,
|
|
50129
50325
|
requireImage: true,
|
|
50130
50326
|
commandLabel: "agent mail"
|
|
50131
50327
|
})),
|
|
50132
|
-
...paths.map((
|
|
50328
|
+
...paths.map((path11) => readOutgoingEmailAttachment(path11, {
|
|
50133
50329
|
maxBytes: AGENT_MAIL_CLI_SURFACE.limits.maxAttachmentBytes,
|
|
50134
50330
|
maxFilenameLength: AGENT_MAIL_CLI_SURFACE.limits.maxFilenameLength,
|
|
50135
50331
|
commandLabel: "agent mail"
|
|
@@ -50413,6 +50609,343 @@ var AGENT_MAIL_COMMANDS = [
|
|
|
50413
50609
|
AgentMailMark
|
|
50414
50610
|
];
|
|
50415
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
|
+
|
|
50416
50949
|
// cli.ts
|
|
50417
50950
|
acceptUnknownResultFields();
|
|
50418
50951
|
var cli = new Cli({
|
|
@@ -50427,6 +50960,7 @@ for (const Cmd of [
|
|
|
50427
50960
|
...IDENTITY_COMMANDS,
|
|
50428
50961
|
...ENTITY_COMMANDS,
|
|
50429
50962
|
...ACTIVITY_COMMANDS,
|
|
50963
|
+
...ACTIVITY_MESSAGE_COMMANDS,
|
|
50430
50964
|
...ACTIVITY_TRANSCRIPT_COMMANDS,
|
|
50431
50965
|
...TASK_COMMANDS,
|
|
50432
50966
|
...LIST_COMMANDS,
|
|
@@ -50445,22 +50979,35 @@ for (const Cmd of [
|
|
|
50445
50979
|
...FILES_COMMANDS,
|
|
50446
50980
|
...NOTIFICATION_COMMANDS,
|
|
50447
50981
|
...AGENT_MAIL_COMMANDS,
|
|
50448
|
-
...AGENT_TASK_COMMANDS
|
|
50982
|
+
...AGENT_TASK_COMMANDS,
|
|
50983
|
+
...UPDATE_COMMANDS
|
|
50449
50984
|
]) {
|
|
50450
50985
|
cli.register(Cmd);
|
|
50451
50986
|
}
|
|
50452
|
-
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"]);
|
|
50453
50989
|
async function main() {
|
|
50454
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
|
+
});
|
|
50455
51000
|
const profileIndex = argv.indexOf("--profile");
|
|
50456
51001
|
const previousProfile = process.env.ENTE_PROFILE;
|
|
50457
51002
|
if (profileIndex >= 0 && argv[profileIndex + 1]) process.env.ENTE_PROFILE = argv[profileIndex + 1];
|
|
50458
51003
|
let adminSetup = false;
|
|
50459
51004
|
try {
|
|
50460
|
-
|
|
50461
|
-
|
|
50462
|
-
|
|
50463
|
-
|
|
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
|
+
}
|
|
50464
51011
|
} catch {
|
|
50465
51012
|
} finally {
|
|
50466
51013
|
if (previousProfile === void 0) delete process.env.ENTE_PROFILE;
|
|
@@ -50472,7 +51019,7 @@ async function main() {
|
|
|
50472
51019
|
if (argv.includes("recording")) for (const Cmd of RECORDINGS_COMMANDS) cli.register(Cmd);
|
|
50473
51020
|
if (argv.includes("health")) for (const Cmd of HEALTH_COMMANDS.filter((Cmd2) => Cmd2.paths[0]?.[0] === "health")) cli.register(Cmd);
|
|
50474
51021
|
if (argv.includes("admin") && argv.some((value) => ["tables", "get", "page"].includes(value))) for (const Cmd of ADMIN_INSPECT_COMMANDS) cli.register(Cmd);
|
|
50475
|
-
if (!SKIP_UPDATE.has(argv[0] ?? "")) {
|
|
51022
|
+
if (!SKIP_UPDATE.has(argv[0] ?? "") && migration !== "migrated") {
|
|
50476
51023
|
await checkForUpdate({
|
|
50477
51024
|
packageName: ENTE_BRANDING.packageName,
|
|
50478
51025
|
registryUrl: ENTE_BRANDING.registryUrl,
|