ente-cli 0.4.108 → 0.4.110
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 +1 -1
- package/dist/SKILL.md +3 -2
- package/dist/cli.mjs +175 -5
- package/dist/cli.mjs.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -192,7 +192,7 @@ Every command supports `--json`. Run `ente --help` or `ente <group> --help`.
|
|
|
192
192
|
| `recording` | `list`, `show`, `inspect`, `rerun`, `orphans`, `backups` (platform key) |
|
|
193
193
|
| `admin` | `tables`, `get`, `page` — read-only inspector over any table (platform key) |
|
|
194
194
|
| `canvas` | `boards`, `html list`, `html get`, `html create`, `html update`, `html delete` |
|
|
195
|
-
| `files` | `list`, `search` (by name, all subfolders), `read` (text of a PDF, DOCX or plain-text file up to 10 MiB, in windows of 50,000 characters), `upload` (local file at most 10 MiB, or an activity attachment), `link`, `create-folder` — the entity's Nextcloud folder via your own connection; personal agent key only (MCP: `entity_files_list`, `entity_files_search`, `entity_file_read`, `entity_file_upload`, `entity_folder_link`, `entity_folder_create`) |
|
|
195
|
+
| `files` | `list`, `search` (by name, all subfolders), `read` (text of a PDF, DOCX or plain-text file up to 10 MiB, in windows of 50,000 characters), `cite` (verbatim PDF quotes → checked Markdown citation links), `upload` (local file at most 10 MiB, or an activity attachment), `link`, `create-folder` — the entity's Nextcloud folder via your own connection; personal agent key only (MCP: `entity_files_list`, `entity_files_search`, `entity_file_read`, `entity_file_cite`, `entity_file_upload`, `entity_folder_link`, `entity_folder_create`) |
|
|
196
196
|
| `notification` | `send` (emails only your own Ente account address; optional HTML, file attachments, and CID inline images) |
|
|
197
197
|
| `agent` | `permissions`, `list`, `threads`, `show`, `new`, `send`, `config show`, `config set-prompt`, `schedules configure` |
|
|
198
198
|
| `agent mail` | `address`, `threads`, `show`, `send`, `reply`, `mark` |
|
package/dist/SKILL.md
CHANGED
|
@@ -254,10 +254,11 @@ ente canvas html delete <boardId> <elementId> [--json]
|
|
|
254
254
|
|
|
255
255
|
# Entity files: the entity's linked Nextcloud folder, through YOUR own Nextcloud
|
|
256
256
|
# connection. Works only with your personal agent's key; shared agents are refused.
|
|
257
|
-
# MCP/REST: entity_files_list, entity_files_search, entity_file_read, entity_file_upload, entity_folder_link, entity_folder_create.
|
|
257
|
+
# MCP/REST: entity_files_list, entity_files_search, entity_file_read, entity_file_cite, entity_file_upload, entity_folder_link, entity_folder_create.
|
|
258
258
|
ente files list <entityId> [--path "03 Unterlagen"] [--json] # --json: linkedFolderPath = the linked folder's path from your Nextcloud root; join it with an item path for the exact file
|
|
259
259
|
ente files search <entityId> "Mietvertrag" [--json] # name search in all subfolders of the linked folder
|
|
260
260
|
ente files read <entityId> "03 Unterlagen/Mietvertrag.pdf" [--offset N] [--max-characters N] [--json] # text of a PDF (text layer), DOCX or plain-text file up to 100 MiB, 50,000 characters per call; a scan without text layer returns notice no_text_layer
|
|
261
|
+
ente files cite <entityId> "03 Unterlagen/Mietvertrag.pdf" --quote "4.200 EUR netto monatlich" [--range START-END] [--candidate N] [--json] # citation links: ok = quoteMarkdown (document wording in „…“ + link) to paste unchanged — never change wording or link text, mark OCR errors only as [sic, OCR]; noText = scan, no link; mismatch = re-quote documentText verbatim; ambiguous = same wording at several places, no link: quote more or pick one with --candidate N (one --quote) or its --range; never build links yourself
|
|
261
262
|
ente files upload <entityId> <local-file> [--folder "03 Unterlagen"] [--name "Vertrag.pdf"] [--mime-type application/pdf] [--json] # at most 10 MiB
|
|
262
263
|
ente files upload <entityId> --activity <activityId> --storage-id <storageId> --name "Vertrag.pdf" [--folder …] [--json] # copy an activity attachment
|
|
263
264
|
ente files link <entityId> "Mandate/2026-017 Zebrafink" [--space <spaceId>] [--json]
|
|
@@ -867,7 +868,7 @@ User and shared inbox sends require an explicit send grant; own mail retains its
|
|
|
867
868
|
exact correspondent allowlist. No draft operation sends mail.
|
|
868
869
|
|
|
869
870
|
- `{"operation":"listMailboxes"}` lists addresses and grants.
|
|
870
|
-
- `{"operation":"search","mailboxId":"...","query":"from:sender@example.com before:2026/07/01"}` searches the provider for connected mail, including unsynced history. Inspect coverage and continue cursors. Gmail
|
|
871
|
+
- `{"operation":"search","mailboxId":"...","query":"from:sender@example.com before:2026/07/01"}` searches the provider for connected mail, including unsynced history. Inspect coverage and continue cursors. Both providers take the same Gmail-style query: words are ANDed, `"exact phrase"`, `-word`, `a OR b`, `{a b}`, parentheses, `from:` `to:` `cc:` `bcc:` `subject:` `after:`/`before:` (YYYY/MM/DD) `older_than:`/`newer_than:` (7d, 3m, 1y) `larger:`/`smaller:` `is:unread|read|starred|unstarred` `has:attachment` and one `in:`/`label:` folder. Unquoted German words also match their spelling variants (Müller/Mueller/Muller, ß/ss). Gmail evaluates the query natively; IMAP compiles it to native SEARCH over bounded UID windows (Inbox, Sent and Archive first) and rejects Gmail-only operators such as `category:` instead of searching less precisely.
|
|
871
872
|
- `{"operation":"readThread","mailboxId":"...","threadId":"provider-thread-id"}` reads bounded content. A provider `messageId` is also accepted. Continue text cursors. IMAP reads the selected message first and discovers its RFC reference conversation; it states bounds and coverage explicitly.
|
|
872
873
|
- `{"operation":"createDraft","mailboxId":"...","messageId":"provider-message-id","body":"Reply text","requestId":"unique-request-1"}` resolves reply recipients, subject and threading headers itself. Search→createDraft takes two calls; search→readThread→createDraft takes three. `to`, `cc`, `bcc`, `subject`, `body` and `html` are top-level fields. `patch.draft.body` belongs only to `editVisible`.
|
|
873
874
|
- `{"operation":"loadDraft","mailboxId":"...","draftId":"..."}` returns its reviewed `draftVersion`.
|
package/dist/cli.mjs
CHANGED
|
@@ -28648,7 +28648,7 @@ function parseOperationAttrs(operation, pairs) {
|
|
|
28648
28648
|
}
|
|
28649
28649
|
|
|
28650
28650
|
// ente/version.ts
|
|
28651
|
-
var VERSION = "0.4.
|
|
28651
|
+
var VERSION = "0.4.110";
|
|
28652
28652
|
|
|
28653
28653
|
// ente/branding.ts
|
|
28654
28654
|
var NPM_REGISTRY = "https://registry.npmjs.org";
|
|
@@ -48795,6 +48795,11 @@ var entityFileSearchResultValidator = v.union(
|
|
|
48795
48795
|
}),
|
|
48796
48796
|
problemStatusValidator
|
|
48797
48797
|
);
|
|
48798
|
+
var pdfAssetWarningsValidator = v.optional(v.array(v.union(
|
|
48799
|
+
v.literal("cmap_unavailable"),
|
|
48800
|
+
v.literal("standard_font_unavailable"),
|
|
48801
|
+
v.literal("wasm_unavailable")
|
|
48802
|
+
)));
|
|
48798
48803
|
var entityFileReadResultValidator = v.union(
|
|
48799
48804
|
v.object({
|
|
48800
48805
|
status: v.literal("ok"),
|
|
@@ -48817,7 +48822,80 @@ var entityFileReadResultValidator = v.union(
|
|
|
48817
48822
|
* not the document's content. OCR in Nextcloud (e.g. workflow_ocr) may add
|
|
48818
48823
|
* a layer as a new file version shortly after upload.
|
|
48819
48824
|
*/
|
|
48820
|
-
notice: v.optional(v.object({ code: v.literal("no_text_layer"), message: v.string() }))
|
|
48825
|
+
notice: v.optional(v.object({ code: v.literal("no_text_layer"), message: v.string() })),
|
|
48826
|
+
/**
|
|
48827
|
+
* PDF only: each page's span in document offsets (the same offsets as
|
|
48828
|
+
* `offset`; pages are joined by one newline). `label` is the printed page
|
|
48829
|
+
* label, else the PDF page number.
|
|
48830
|
+
*/
|
|
48831
|
+
pages: v.optional(v.array(v.object({ page: v.number(), label: v.string(), start: v.number(), end: v.number() }))),
|
|
48832
|
+
warnings: pdfAssetWarningsValidator
|
|
48833
|
+
}),
|
|
48834
|
+
problemStatusValidator
|
|
48835
|
+
);
|
|
48836
|
+
var entityFileCitationValidator = v.union(
|
|
48837
|
+
v.object({
|
|
48838
|
+
status: v.literal("ok"),
|
|
48839
|
+
/** 1-based PDF pages where the quoted passage starts and ends. */
|
|
48840
|
+
page: v.number(),
|
|
48841
|
+
endPage: v.number(),
|
|
48842
|
+
/** The passage in document offsets (entity_file_read's offsets). */
|
|
48843
|
+
start: v.number(),
|
|
48844
|
+
end: v.number(),
|
|
48845
|
+
/** The printed page label (PDF page labels), else the PDF page number. */
|
|
48846
|
+
pageLabel: v.string(),
|
|
48847
|
+
/** Nearest heading before the quote (§ 7 Garantien, Art. 3, 4.2 Haftung), or null when none is certain. */
|
|
48848
|
+
section: v.union(v.string(), v.null()),
|
|
48849
|
+
url: v.string(),
|
|
48850
|
+
/** Ready Markdown link alone. */
|
|
48851
|
+
markdown: v.string(),
|
|
48852
|
+
/** The quote line to show, unchanged: the document's wording in „…“, then the link. */
|
|
48853
|
+
quoteMarkdown: v.string(),
|
|
48854
|
+
/** The document's own wording of the passage. */
|
|
48855
|
+
documentText: v.string(),
|
|
48856
|
+
/** Quote vs document wording: same, whitespace only, or characters (then `note`). */
|
|
48857
|
+
wording: v.union(v.literal("same"), v.literal("whitespace"), v.literal("characters")),
|
|
48858
|
+
/** Set when the wording differs in characters: quote the document text, mark OCR errors [sic, OCR]. */
|
|
48859
|
+
note: v.optional(v.string())
|
|
48860
|
+
}),
|
|
48861
|
+
v.object({
|
|
48862
|
+
status: v.literal("mismatch"),
|
|
48863
|
+
page: v.number(),
|
|
48864
|
+
/** The closest document wording; quote it verbatim and cite again. */
|
|
48865
|
+
documentText: v.string(),
|
|
48866
|
+
hint: v.string()
|
|
48867
|
+
}),
|
|
48868
|
+
v.object({ status: v.literal("notFound"), hint: v.string() }),
|
|
48869
|
+
v.object({
|
|
48870
|
+
status: v.literal("ambiguous"),
|
|
48871
|
+
/** The same wording occurs at several places; no link until one is chosen (candidate or start/end) or the quote is longer. */
|
|
48872
|
+
candidates: v.array(v.object({
|
|
48873
|
+
/** Pass as the quote's candidate to cite this place. */
|
|
48874
|
+
index: v.number(),
|
|
48875
|
+
page: v.number(),
|
|
48876
|
+
pageLabel: v.string(),
|
|
48877
|
+
section: v.union(v.string(), v.null()),
|
|
48878
|
+
/** The place in document offsets, usable as start/end. */
|
|
48879
|
+
start: v.number(),
|
|
48880
|
+
end: v.number(),
|
|
48881
|
+
/** Document text around the place (about 60 characters on each side). */
|
|
48882
|
+
context: v.string()
|
|
48883
|
+
})),
|
|
48884
|
+
/** All places; candidates lists at most ENTITY_FILE_LIMITS.citeCandidates of them. */
|
|
48885
|
+
total: v.number(),
|
|
48886
|
+
hint: v.string()
|
|
48887
|
+
}),
|
|
48888
|
+
/** The file has no text layer (a scan): no link until OCR adds one. */
|
|
48889
|
+
v.object({ status: v.literal("noText"), hint: v.string() })
|
|
48890
|
+
);
|
|
48891
|
+
var entityFileCiteResultValidator = v.union(
|
|
48892
|
+
v.object({
|
|
48893
|
+
status: v.literal("ok"),
|
|
48894
|
+
path: v.string(),
|
|
48895
|
+
name: v.string(),
|
|
48896
|
+
modifiedAt: v.union(v.number(), v.null()),
|
|
48897
|
+
citations: v.array(entityFileCitationValidator),
|
|
48898
|
+
warnings: pdfAssetWarningsValidator
|
|
48821
48899
|
}),
|
|
48822
48900
|
problemStatusValidator
|
|
48823
48901
|
);
|
|
@@ -48828,6 +48906,7 @@ var entityFileResults = {
|
|
|
48828
48906
|
listEntityFiles: entityFileListResultValidator,
|
|
48829
48907
|
searchEntityFiles: entityFileSearchResultValidator,
|
|
48830
48908
|
readEntityFile: entityFileReadResultValidator,
|
|
48909
|
+
citeEntityFile: entityFileCiteResultValidator,
|
|
48831
48910
|
uploadEntityFile: entityFileUploadResultValidator
|
|
48832
48911
|
};
|
|
48833
48912
|
function parseEntityFileResult(operation, raw) {
|
|
@@ -48860,6 +48939,17 @@ var ENTITY_FILE_LIMITS = {
|
|
|
48860
48939
|
readBytes: 100 * 1024 * 1024,
|
|
48861
48940
|
/** Characters readEntityFile returns per call; longer texts are read in windows. */
|
|
48862
48941
|
readCharacters: 5e4,
|
|
48942
|
+
/**
|
|
48943
|
+
* Extracted text kept per read; windows of readCharacters page through it. Bounds
|
|
48944
|
+
* PDF page work: a 400-page, 100 MB PDF with a full text layer measured 1.2 M characters.
|
|
48945
|
+
*/
|
|
48946
|
+
extractedCharacters: 2e6,
|
|
48947
|
+
/** Quotes per citeEntityFile call: one answer's citations of one file. */
|
|
48948
|
+
citeQuotes: 20,
|
|
48949
|
+
/** Characters of one quote; longer passages are cited by their decisive sentence. */
|
|
48950
|
+
citeQuoteCharacters: 2e3,
|
|
48951
|
+
/** Places an ambiguous quote lists (and a candidate index can choose); more mean the quote is too short. */
|
|
48952
|
+
citeCandidates: 10,
|
|
48863
48953
|
nameCharacters: 250,
|
|
48864
48954
|
pathCharacters: 4096,
|
|
48865
48955
|
mimeTypeCharacters: 255
|
|
@@ -48877,6 +48967,9 @@ var path6 = (description) => external_exports.string().max(ENTITY_FILE_LIMITS.pa
|
|
|
48877
48967
|
var base64Content = external_exports.string().max(ENTITY_FILE_LIMITS.base64Characters).regex(/^[A-Za-z0-9+/]*={0,2}$/, "Use standard base64 without a data: prefix").refine((value) => value.length % 4 === 0, "Use padded standard base64").refine((value) => base64DecodedByteLength(value) <= ENTITY_FILE_LIMITS.base64DecodedBytes, "Inline uploads are limited to 10 MiB").describe("Standard padded base64 of the file, at most 10 MiB decoded. Exactly one of base64Content or activityAttachment.");
|
|
48878
48968
|
var activityAttachment = external_exports.strictObject({ activityId: id19, storageId: id19 }).describe("An existing attachment of an Ente activity you can read. Exactly one of base64Content or activityAttachment.");
|
|
48879
48969
|
var spaceId = id19.optional().describe("Space whose Nextcloud the link belongs to. Optional when the entity has exactly one space with Nextcloud.");
|
|
48970
|
+
var quoteText = external_exports.string().trim().min(1).max(ENTITY_FILE_LIMITS.citeQuoteCharacters).describe("Verbatim document wording.");
|
|
48971
|
+
var quotePage = external_exports.number().int().min(1).max(1e5).optional();
|
|
48972
|
+
var docOffset = external_exports.number().int().min(0).max(ENTITY_FILE_LIMITS.extractedCharacters);
|
|
48880
48973
|
var entityFileInputs = {
|
|
48881
48974
|
createEntityFolder: external_exports.strictObject({
|
|
48882
48975
|
entityId: id19,
|
|
@@ -48903,6 +48996,27 @@ var entityFileInputs = {
|
|
|
48903
48996
|
offset: external_exports.number().int().min(0).optional().describe("Character offset to continue a truncated text; defaults to 0."),
|
|
48904
48997
|
maxCharacters: external_exports.number().int().min(1).max(ENTITY_FILE_LIMITS.readCharacters).optional().describe(`Characters to return, at most ${ENTITY_FILE_LIMITS.readCharacters}; defaults to that maximum.`)
|
|
48905
48998
|
}),
|
|
48999
|
+
citeEntityFile: external_exports.strictObject({
|
|
49000
|
+
entityId: id19,
|
|
49001
|
+
path: external_exports.string().min(1).max(ENTITY_FILE_LIMITS.pathCharacters),
|
|
49002
|
+
quotes: external_exports.array(external_exports.union([
|
|
49003
|
+
external_exports.strictObject({
|
|
49004
|
+
text: quoteText,
|
|
49005
|
+
page: quotePage.describe("PDF page; a hint only."),
|
|
49006
|
+
start: docOffset.optional(),
|
|
49007
|
+
end: docOffset.optional(),
|
|
49008
|
+
candidate: external_exports.number().int().min(0).max(ENTITY_FILE_LIMITS.citeCandidates - 1).optional().describe("index from an ambiguous result")
|
|
49009
|
+
}),
|
|
49010
|
+
external_exports.strictObject({ start: docOffset, end: docOffset, page: quotePage })
|
|
49011
|
+
]).superRefine((quote, ctx) => {
|
|
49012
|
+
if ("candidate" in quote && quote.candidate !== void 0 && quote.start !== void 0)
|
|
49013
|
+
ctx.addIssue({ code: "custom", path: ["candidate"], message: "Give candidate or start/end, not both" });
|
|
49014
|
+
else if (quote.start === void 0 !== (quote.end === void 0))
|
|
49015
|
+
ctx.addIssue({ code: "custom", path: ["end"], message: "Give start and end together" });
|
|
49016
|
+
else if (quote.start !== void 0 && quote.end !== void 0 && (quote.end <= quote.start || quote.end - quote.start > ENTITY_FILE_LIMITS.citeQuoteCharacters))
|
|
49017
|
+
ctx.addIssue({ code: "custom", path: ["end"], message: `end must lie after start, at most ${ENTITY_FILE_LIMITS.citeQuoteCharacters} characters` });
|
|
49018
|
+
})).min(1).max(ENTITY_FILE_LIMITS.citeQuotes).describe("text, start/end (document offsets, end exclusive), or both.")
|
|
49019
|
+
}),
|
|
48906
49020
|
uploadEntityFile: external_exports.strictObject({
|
|
48907
49021
|
entityId: id19,
|
|
48908
49022
|
folderPath: path6("Target folder inside the linked folder; defaults to the linked folder itself.").optional(),
|
|
@@ -48921,6 +49035,7 @@ var entityFileAliases = {
|
|
|
48921
49035
|
entity_files_list: "listEntityFiles",
|
|
48922
49036
|
entity_files_search: "searchEntityFiles",
|
|
48923
49037
|
entity_file_read: "readEntityFile",
|
|
49038
|
+
entity_file_cite: "citeEntityFile",
|
|
48924
49039
|
entity_file_upload: "uploadEntityFile"
|
|
48925
49040
|
};
|
|
48926
49041
|
function isEntityFileOperationName(value) {
|
|
@@ -48932,10 +49047,11 @@ var descriptions6 = {
|
|
|
48932
49047
|
linkEntityFolder: `Link an existing folder of your Nextcloud, given by its path, as the entity's file folder. A folder can belong to one entity only. ${personalOnly}`,
|
|
48933
49048
|
listEntityFiles: `List the files and folders in the entity's linked Nextcloud folder. status explains a missing link or connection instead of an empty list. Item paths are relative to the linked folder; linkedFolderPath is the linked folder's own path from your Nextcloud root, so join it with an item path to address that exact file in Nextcloud instead of searching by name. ${personalOnly}`,
|
|
48934
49049
|
searchEntityFiles: `Find files and folders by name anywhere below the entity's linked Nextcloud folder, also in subfolders. status explains a missing link or connection; truncated means more hits exist, so narrow the query. Item paths are relative to the linked folder and go unchanged into entity_file_read. ${personalOnly}`,
|
|
48935
|
-
readEntityFile: `Read the text of one file in the entity's linked Nextcloud folder: PDF (text layer only), DOCX and plain-text formats such as TXT, MD, CSV, JSON or XML, up to ${ENTITY_FILE_LIMITS.readBytes / (1024 * 1024)} MiB. Other formats fail with unsupported_format. Long texts come in windows: when truncated is true, call again with offset set to offset plus the returned text's length. A PDF without a usable text layer (a scan) returns notice.code no_text_layer: its text is not the content; OCR in Nextcloud may add a layer shortly after upload, so read it again later instead of concluding the file is empty. ${personalOnly}`,
|
|
49050
|
+
readEntityFile: `Read the text of one file in the entity's linked Nextcloud folder: PDF (text layer only), DOCX and plain-text formats such as TXT, MD, CSV, JSON or XML, up to ${ENTITY_FILE_LIMITS.readBytes / (1024 * 1024)} MiB. Other formats fail with unsupported_format. Long texts come in windows: when truncated is true, call again with offset set to offset plus the returned text's length. A PDF without a usable text layer (a scan) returns notice.code no_text_layer: its text is not the content; OCR in Nextcloud may add a layer shortly after upload, so read it again later instead of concluding the file is empty. PDF: offset + position in text = document offset; pages = label and offsets per page. To cite, call entity_file_cite; never build links. ${personalOnly}`,
|
|
49051
|
+
citeEntityFile: `Citation links for verbatim PDF quotes, all in one call. ok: paste quoteMarkdown unchanged. mismatch: no link; quote documentText, cite again. ambiguous: no link; quote more or pass candidate. notFound: not in the file. noText: scan, no link. Never build links. ${personalOnly}`,
|
|
48936
49052
|
uploadEntityFile: `Upload a file into the entity's linked Nextcloud folder; a taken name gets a numbered suffix. Send exactly one of base64Content (at most 10 MiB decoded) or activityAttachment (an existing Ente activity attachment). ${personalOnly}`
|
|
48937
49053
|
};
|
|
48938
|
-
var READ_OPERATIONS = /* @__PURE__ */ new Set(["listEntityFiles", "searchEntityFiles", "readEntityFile"]);
|
|
49054
|
+
var READ_OPERATIONS = /* @__PURE__ */ new Set(["listEntityFiles", "searchEntityFiles", "readEntityFile", "citeEntityFile"]);
|
|
48939
49055
|
function isEntityFileReadOperation(operationName) {
|
|
48940
49056
|
return READ_OPERATIONS.has(operationName);
|
|
48941
49057
|
}
|
|
@@ -48983,6 +49099,9 @@ var searchRef = makeFunctionReference2(
|
|
|
48983
49099
|
var readRef = makeFunctionReference2(
|
|
48984
49100
|
"entityFileOperations:read"
|
|
48985
49101
|
);
|
|
49102
|
+
var citeRef = makeFunctionReference2(
|
|
49103
|
+
"entityFileOperations:cite"
|
|
49104
|
+
);
|
|
48986
49105
|
var uploadRef = makeFunctionReference2(
|
|
48987
49106
|
"entityFileOperations:upload"
|
|
48988
49107
|
);
|
|
@@ -49006,6 +49125,10 @@ async function readEntityFile(caller, input2) {
|
|
|
49006
49125
|
const args = parseOperationInput("readEntityFile", entityFileInputs.readEntityFile, input2);
|
|
49007
49126
|
return parseEntityFileResult("readEntityFile", await caller.action(readRef, args));
|
|
49008
49127
|
}
|
|
49128
|
+
async function citeEntityFile(caller, input2) {
|
|
49129
|
+
const args = parseOperationInput("citeEntityFile", entityFileInputs.citeEntityFile, input2);
|
|
49130
|
+
return parseEntityFileResult("citeEntityFile", await caller.action(citeRef, args));
|
|
49131
|
+
}
|
|
49009
49132
|
async function uploadEntityFile(caller, input2) {
|
|
49010
49133
|
const args = parseOperationInput("uploadEntityFile", entityFileInputs.uploadEntityFile, input2);
|
|
49011
49134
|
return parseEntityFileResult("uploadEntityFile", await caller.action(uploadRef, args));
|
|
@@ -49083,6 +49206,53 @@ var FilesReadCmd = class extends ProfileCommand {
|
|
|
49083
49206
|
[${data.offset + data.text.length} of ${data.totalCharacters} characters; continue with --offset ${data.offset + data.text.length}]`] : []].join("\n"));
|
|
49084
49207
|
}
|
|
49085
49208
|
};
|
|
49209
|
+
function citationLine(citation) {
|
|
49210
|
+
switch (citation.status) {
|
|
49211
|
+
case "ok":
|
|
49212
|
+
return citation.note ? `${citation.quoteMarkdown}
|
|
49213
|
+
note: ${citation.note}` : citation.quoteMarkdown;
|
|
49214
|
+
case "noText":
|
|
49215
|
+
return `noText: ${citation.hint}`;
|
|
49216
|
+
case "mismatch":
|
|
49217
|
+
return `mismatch: ${citation.hint} "${citation.documentText}"`;
|
|
49218
|
+
case "notFound":
|
|
49219
|
+
return `notFound: ${citation.hint}`;
|
|
49220
|
+
case "ambiguous":
|
|
49221
|
+
return [
|
|
49222
|
+
`ambiguous: ${citation.hint}`,
|
|
49223
|
+
...citation.candidates.map((place) => ` --candidate ${place.index} | --range ${place.start}-${place.end}: S. ${place.pageLabel}${place.section ? `, ${place.section}` : ""}: "${place.context}"`),
|
|
49224
|
+
...citation.total > citation.candidates.length ? [` (${citation.total - citation.candidates.length} more places not listed)`] : []
|
|
49225
|
+
].join("\n");
|
|
49226
|
+
}
|
|
49227
|
+
}
|
|
49228
|
+
var FilesCiteCmd = class extends ProfileCommand {
|
|
49229
|
+
static paths = [["files", "cite"]];
|
|
49230
|
+
static usage = Command.Usage({ category: "Files", description: "Turn verbatim quotes from a PDF in the entity's linked folder into citation links (Markdown)" });
|
|
49231
|
+
entityId = options_exports.String({ required: true });
|
|
49232
|
+
filePath = options_exports.String({ required: true });
|
|
49233
|
+
quotes = options_exports.Array("--quote", [], { description: "Verbatim wording from files read; repeatable" });
|
|
49234
|
+
ranges = options_exports.Array("--range", [], { description: "Document offsets start-end from files read; repeatable" });
|
|
49235
|
+
candidate = options_exports.String("--candidate", { description: "Index of the place from an ambiguous result; needs exactly one --quote" });
|
|
49236
|
+
async run() {
|
|
49237
|
+
const ranges = this.ranges.map((range) => {
|
|
49238
|
+
const match = /^(\d+)-(\d+)$/.exec(range);
|
|
49239
|
+
if (!match) throw new Error(`--range expects start-end, got ${range}`);
|
|
49240
|
+
return { start: Number(match[1]), end: Number(match[2]) };
|
|
49241
|
+
});
|
|
49242
|
+
let candidate;
|
|
49243
|
+
if (this.candidate !== void 0) {
|
|
49244
|
+
if (!/^\d+$/.test(this.candidate)) throw new Error(`--candidate expects an index, got ${this.candidate}`);
|
|
49245
|
+
if (this.quotes.length !== 1) throw new Error("--candidate needs exactly one --quote");
|
|
49246
|
+
candidate = Number(this.candidate);
|
|
49247
|
+
}
|
|
49248
|
+
const data = await citeEntityFile(await resolveCaller(), {
|
|
49249
|
+
entityId: this.entityId,
|
|
49250
|
+
path: this.filePath,
|
|
49251
|
+
quotes: [...this.quotes.map((text3) => candidate === void 0 ? { text: text3 } : { text: text3, candidate }), ...ranges]
|
|
49252
|
+
});
|
|
49253
|
+
this.emitText({ data }, () => data.status !== "ok" ? `Unavailable: ${data.status}` : data.citations.map((citation, index) => `${index + 1}. ${citationLine(citation)}`).join("\n"));
|
|
49254
|
+
}
|
|
49255
|
+
};
|
|
49086
49256
|
var FilesUploadCmd = class extends ProfileCommand {
|
|
49087
49257
|
static paths = [["files", "upload"]];
|
|
49088
49258
|
static usage = Command.Usage({
|
|
@@ -49144,7 +49314,7 @@ var FilesCreateFolderCmd = class extends ProfileCommand {
|
|
|
49144
49314
|
this.emitText({ data }, () => `Created and linked ${data.path}`);
|
|
49145
49315
|
}
|
|
49146
49316
|
};
|
|
49147
|
-
var FILES_COMMANDS = [FilesListCmd, FilesSearchCmd, FilesReadCmd, FilesUploadCmd, FilesLinkCmd, FilesCreateFolderCmd];
|
|
49317
|
+
var FILES_COMMANDS = [FilesListCmd, FilesSearchCmd, FilesReadCmd, FilesCiteCmd, FilesUploadCmd, FilesLinkCmd, FilesCreateFolderCmd];
|
|
49148
49318
|
|
|
49149
49319
|
// ente/commands/notification.ts
|
|
49150
49320
|
import { readFileSync as readFileSync15 } from "node:fs";
|