ente-cli 0.4.108 → 0.4.109
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 +172 -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 = ready Markdown link to paste unchanged; 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.109";
|
|
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,79 @@ 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, to be placed unchanged after the statement. */
|
|
48851
|
+
markdown: v.string(),
|
|
48852
|
+
/** The document's own wording of the passage. */
|
|
48853
|
+
documentText: v.string()
|
|
48854
|
+
}),
|
|
48855
|
+
v.object({
|
|
48856
|
+
status: v.literal("mismatch"),
|
|
48857
|
+
page: v.number(),
|
|
48858
|
+
/** The closest document wording; quote it verbatim and cite again. */
|
|
48859
|
+
documentText: v.string(),
|
|
48860
|
+
hint: v.string()
|
|
48861
|
+
}),
|
|
48862
|
+
v.object({ status: v.literal("notFound"), hint: v.string() }),
|
|
48863
|
+
v.object({
|
|
48864
|
+
status: v.literal("ambiguous"),
|
|
48865
|
+
/** The same wording occurs at several places; no link until one is chosen (candidate or start/end) or the quote is longer. */
|
|
48866
|
+
candidates: v.array(v.object({
|
|
48867
|
+
/** Pass as the quote's candidate to cite this place. */
|
|
48868
|
+
index: v.number(),
|
|
48869
|
+
page: v.number(),
|
|
48870
|
+
pageLabel: v.string(),
|
|
48871
|
+
section: v.union(v.string(), v.null()),
|
|
48872
|
+
/** The place in document offsets, usable as start/end. */
|
|
48873
|
+
start: v.number(),
|
|
48874
|
+
end: v.number(),
|
|
48875
|
+
/** Document text around the place (about 60 characters on each side). */
|
|
48876
|
+
context: v.string()
|
|
48877
|
+
})),
|
|
48878
|
+
/** All places; candidates lists at most ENTITY_FILE_LIMITS.citeCandidates of them. */
|
|
48879
|
+
total: v.number(),
|
|
48880
|
+
hint: v.string()
|
|
48881
|
+
}),
|
|
48882
|
+
v.object({
|
|
48883
|
+
status: v.literal("noText"),
|
|
48884
|
+
/** Opens the file on the page without a highlight. */
|
|
48885
|
+
url: v.string(),
|
|
48886
|
+
markdown: v.string(),
|
|
48887
|
+
hint: v.string()
|
|
48888
|
+
})
|
|
48889
|
+
);
|
|
48890
|
+
var entityFileCiteResultValidator = v.union(
|
|
48891
|
+
v.object({
|
|
48892
|
+
status: v.literal("ok"),
|
|
48893
|
+
path: v.string(),
|
|
48894
|
+
name: v.string(),
|
|
48895
|
+
modifiedAt: v.union(v.number(), v.null()),
|
|
48896
|
+
citations: v.array(entityFileCitationValidator),
|
|
48897
|
+
warnings: pdfAssetWarningsValidator
|
|
48821
48898
|
}),
|
|
48822
48899
|
problemStatusValidator
|
|
48823
48900
|
);
|
|
@@ -48828,6 +48905,7 @@ var entityFileResults = {
|
|
|
48828
48905
|
listEntityFiles: entityFileListResultValidator,
|
|
48829
48906
|
searchEntityFiles: entityFileSearchResultValidator,
|
|
48830
48907
|
readEntityFile: entityFileReadResultValidator,
|
|
48908
|
+
citeEntityFile: entityFileCiteResultValidator,
|
|
48831
48909
|
uploadEntityFile: entityFileUploadResultValidator
|
|
48832
48910
|
};
|
|
48833
48911
|
function parseEntityFileResult(operation, raw) {
|
|
@@ -48860,6 +48938,17 @@ var ENTITY_FILE_LIMITS = {
|
|
|
48860
48938
|
readBytes: 100 * 1024 * 1024,
|
|
48861
48939
|
/** Characters readEntityFile returns per call; longer texts are read in windows. */
|
|
48862
48940
|
readCharacters: 5e4,
|
|
48941
|
+
/**
|
|
48942
|
+
* Extracted text kept per read; windows of readCharacters page through it. Bounds
|
|
48943
|
+
* PDF page work: a 400-page, 100 MB PDF with a full text layer measured 1.2 M characters.
|
|
48944
|
+
*/
|
|
48945
|
+
extractedCharacters: 2e6,
|
|
48946
|
+
/** Quotes per citeEntityFile call: one answer's citations of one file. */
|
|
48947
|
+
citeQuotes: 20,
|
|
48948
|
+
/** Characters of one quote; longer passages are cited by their decisive sentence. */
|
|
48949
|
+
citeQuoteCharacters: 2e3,
|
|
48950
|
+
/** Places an ambiguous quote lists (and a candidate index can choose); more mean the quote is too short. */
|
|
48951
|
+
citeCandidates: 10,
|
|
48863
48952
|
nameCharacters: 250,
|
|
48864
48953
|
pathCharacters: 4096,
|
|
48865
48954
|
mimeTypeCharacters: 255
|
|
@@ -48877,6 +48966,9 @@ var path6 = (description) => external_exports.string().max(ENTITY_FILE_LIMITS.pa
|
|
|
48877
48966
|
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
48967
|
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
48968
|
var spaceId = id19.optional().describe("Space whose Nextcloud the link belongs to. Optional when the entity has exactly one space with Nextcloud.");
|
|
48969
|
+
var quoteText = external_exports.string().trim().min(1).max(ENTITY_FILE_LIMITS.citeQuoteCharacters).describe("Verbatim document wording.");
|
|
48970
|
+
var quotePage = external_exports.number().int().min(1).max(1e5).optional();
|
|
48971
|
+
var docOffset = external_exports.number().int().min(0).max(ENTITY_FILE_LIMITS.extractedCharacters);
|
|
48880
48972
|
var entityFileInputs = {
|
|
48881
48973
|
createEntityFolder: external_exports.strictObject({
|
|
48882
48974
|
entityId: id19,
|
|
@@ -48903,6 +48995,27 @@ var entityFileInputs = {
|
|
|
48903
48995
|
offset: external_exports.number().int().min(0).optional().describe("Character offset to continue a truncated text; defaults to 0."),
|
|
48904
48996
|
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
48997
|
}),
|
|
48998
|
+
citeEntityFile: external_exports.strictObject({
|
|
48999
|
+
entityId: id19,
|
|
49000
|
+
path: external_exports.string().min(1).max(ENTITY_FILE_LIMITS.pathCharacters),
|
|
49001
|
+
quotes: external_exports.array(external_exports.union([
|
|
49002
|
+
external_exports.strictObject({
|
|
49003
|
+
text: quoteText,
|
|
49004
|
+
page: quotePage.describe("PDF page; a hint only."),
|
|
49005
|
+
start: docOffset.optional(),
|
|
49006
|
+
end: docOffset.optional(),
|
|
49007
|
+
candidate: external_exports.number().int().min(0).max(ENTITY_FILE_LIMITS.citeCandidates - 1).optional().describe("index from an ambiguous result")
|
|
49008
|
+
}),
|
|
49009
|
+
external_exports.strictObject({ start: docOffset, end: docOffset, page: quotePage })
|
|
49010
|
+
]).superRefine((quote, ctx) => {
|
|
49011
|
+
if ("candidate" in quote && quote.candidate !== void 0 && quote.start !== void 0)
|
|
49012
|
+
ctx.addIssue({ code: "custom", path: ["candidate"], message: "Give candidate or start/end, not both" });
|
|
49013
|
+
else if (quote.start === void 0 !== (quote.end === void 0))
|
|
49014
|
+
ctx.addIssue({ code: "custom", path: ["end"], message: "Give start and end together" });
|
|
49015
|
+
else if (quote.start !== void 0 && quote.end !== void 0 && (quote.end <= quote.start || quote.end - quote.start > ENTITY_FILE_LIMITS.citeQuoteCharacters))
|
|
49016
|
+
ctx.addIssue({ code: "custom", path: ["end"], message: `end must lie after start, at most ${ENTITY_FILE_LIMITS.citeQuoteCharacters} characters` });
|
|
49017
|
+
})).min(1).max(ENTITY_FILE_LIMITS.citeQuotes).describe("text, start/end (document offsets, end exclusive), or both.")
|
|
49018
|
+
}),
|
|
48906
49019
|
uploadEntityFile: external_exports.strictObject({
|
|
48907
49020
|
entityId: id19,
|
|
48908
49021
|
folderPath: path6("Target folder inside the linked folder; defaults to the linked folder itself.").optional(),
|
|
@@ -48921,6 +49034,7 @@ var entityFileAliases = {
|
|
|
48921
49034
|
entity_files_list: "listEntityFiles",
|
|
48922
49035
|
entity_files_search: "searchEntityFiles",
|
|
48923
49036
|
entity_file_read: "readEntityFile",
|
|
49037
|
+
entity_file_cite: "citeEntityFile",
|
|
48924
49038
|
entity_file_upload: "uploadEntityFile"
|
|
48925
49039
|
};
|
|
48926
49040
|
function isEntityFileOperationName(value) {
|
|
@@ -48932,10 +49046,11 @@ var descriptions6 = {
|
|
|
48932
49046
|
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
49047
|
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
49048
|
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}`,
|
|
49049
|
+
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}`,
|
|
49050
|
+
citeEntityFile: `Citation links for verbatim PDF quotes, all in one call. ok: paste markdown unchanged after the statement. mismatch: no link; quote documentText, cite again. ambiguous: no link; quote more or pass candidate. notFound: not in the file. noText: scan, page link only. Never build links. ${personalOnly}`,
|
|
48936
49051
|
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
49052
|
};
|
|
48938
|
-
var READ_OPERATIONS = /* @__PURE__ */ new Set(["listEntityFiles", "searchEntityFiles", "readEntityFile"]);
|
|
49053
|
+
var READ_OPERATIONS = /* @__PURE__ */ new Set(["listEntityFiles", "searchEntityFiles", "readEntityFile", "citeEntityFile"]);
|
|
48939
49054
|
function isEntityFileReadOperation(operationName) {
|
|
48940
49055
|
return READ_OPERATIONS.has(operationName);
|
|
48941
49056
|
}
|
|
@@ -48983,6 +49098,9 @@ var searchRef = makeFunctionReference2(
|
|
|
48983
49098
|
var readRef = makeFunctionReference2(
|
|
48984
49099
|
"entityFileOperations:read"
|
|
48985
49100
|
);
|
|
49101
|
+
var citeRef = makeFunctionReference2(
|
|
49102
|
+
"entityFileOperations:cite"
|
|
49103
|
+
);
|
|
48986
49104
|
var uploadRef = makeFunctionReference2(
|
|
48987
49105
|
"entityFileOperations:upload"
|
|
48988
49106
|
);
|
|
@@ -49006,6 +49124,10 @@ async function readEntityFile(caller, input2) {
|
|
|
49006
49124
|
const args = parseOperationInput("readEntityFile", entityFileInputs.readEntityFile, input2);
|
|
49007
49125
|
return parseEntityFileResult("readEntityFile", await caller.action(readRef, args));
|
|
49008
49126
|
}
|
|
49127
|
+
async function citeEntityFile(caller, input2) {
|
|
49128
|
+
const args = parseOperationInput("citeEntityFile", entityFileInputs.citeEntityFile, input2);
|
|
49129
|
+
return parseEntityFileResult("citeEntityFile", await caller.action(citeRef, args));
|
|
49130
|
+
}
|
|
49009
49131
|
async function uploadEntityFile(caller, input2) {
|
|
49010
49132
|
const args = parseOperationInput("uploadEntityFile", entityFileInputs.uploadEntityFile, input2);
|
|
49011
49133
|
return parseEntityFileResult("uploadEntityFile", await caller.action(uploadRef, args));
|
|
@@ -49083,6 +49205,51 @@ var FilesReadCmd = class extends ProfileCommand {
|
|
|
49083
49205
|
[${data.offset + data.text.length} of ${data.totalCharacters} characters; continue with --offset ${data.offset + data.text.length}]`] : []].join("\n"));
|
|
49084
49206
|
}
|
|
49085
49207
|
};
|
|
49208
|
+
function citationLine(citation) {
|
|
49209
|
+
switch (citation.status) {
|
|
49210
|
+
case "ok":
|
|
49211
|
+
case "noText":
|
|
49212
|
+
return citation.markdown;
|
|
49213
|
+
case "mismatch":
|
|
49214
|
+
return `mismatch: ${citation.hint} "${citation.documentText}"`;
|
|
49215
|
+
case "notFound":
|
|
49216
|
+
return `notFound: ${citation.hint}`;
|
|
49217
|
+
case "ambiguous":
|
|
49218
|
+
return [
|
|
49219
|
+
`ambiguous: ${citation.hint}`,
|
|
49220
|
+
...citation.candidates.map((place) => ` --candidate ${place.index} | --range ${place.start}-${place.end}: S. ${place.pageLabel}${place.section ? `, ${place.section}` : ""}: "${place.context}"`),
|
|
49221
|
+
...citation.total > citation.candidates.length ? [` (${citation.total - citation.candidates.length} more places not listed)`] : []
|
|
49222
|
+
].join("\n");
|
|
49223
|
+
}
|
|
49224
|
+
}
|
|
49225
|
+
var FilesCiteCmd = class extends ProfileCommand {
|
|
49226
|
+
static paths = [["files", "cite"]];
|
|
49227
|
+
static usage = Command.Usage({ category: "Files", description: "Turn verbatim quotes from a PDF in the entity's linked folder into citation links (Markdown)" });
|
|
49228
|
+
entityId = options_exports.String({ required: true });
|
|
49229
|
+
filePath = options_exports.String({ required: true });
|
|
49230
|
+
quotes = options_exports.Array("--quote", [], { description: "Verbatim wording from files read; repeatable" });
|
|
49231
|
+
ranges = options_exports.Array("--range", [], { description: "Document offsets start-end from files read; repeatable" });
|
|
49232
|
+
candidate = options_exports.String("--candidate", { description: "Index of the place from an ambiguous result; needs exactly one --quote" });
|
|
49233
|
+
async run() {
|
|
49234
|
+
const ranges = this.ranges.map((range) => {
|
|
49235
|
+
const match = /^(\d+)-(\d+)$/.exec(range);
|
|
49236
|
+
if (!match) throw new Error(`--range expects start-end, got ${range}`);
|
|
49237
|
+
return { start: Number(match[1]), end: Number(match[2]) };
|
|
49238
|
+
});
|
|
49239
|
+
let candidate;
|
|
49240
|
+
if (this.candidate !== void 0) {
|
|
49241
|
+
if (!/^\d+$/.test(this.candidate)) throw new Error(`--candidate expects an index, got ${this.candidate}`);
|
|
49242
|
+
if (this.quotes.length !== 1) throw new Error("--candidate needs exactly one --quote");
|
|
49243
|
+
candidate = Number(this.candidate);
|
|
49244
|
+
}
|
|
49245
|
+
const data = await citeEntityFile(await resolveCaller(), {
|
|
49246
|
+
entityId: this.entityId,
|
|
49247
|
+
path: this.filePath,
|
|
49248
|
+
quotes: [...this.quotes.map((text3) => candidate === void 0 ? { text: text3 } : { text: text3, candidate }), ...ranges]
|
|
49249
|
+
});
|
|
49250
|
+
this.emitText({ data }, () => data.status !== "ok" ? `Unavailable: ${data.status}` : data.citations.map((citation, index) => `${index + 1}. ${citationLine(citation)}`).join("\n"));
|
|
49251
|
+
}
|
|
49252
|
+
};
|
|
49086
49253
|
var FilesUploadCmd = class extends ProfileCommand {
|
|
49087
49254
|
static paths = [["files", "upload"]];
|
|
49088
49255
|
static usage = Command.Usage({
|
|
@@ -49144,7 +49311,7 @@ var FilesCreateFolderCmd = class extends ProfileCommand {
|
|
|
49144
49311
|
this.emitText({ data }, () => `Created and linked ${data.path}`);
|
|
49145
49312
|
}
|
|
49146
49313
|
};
|
|
49147
|
-
var FILES_COMMANDS = [FilesListCmd, FilesSearchCmd, FilesReadCmd, FilesUploadCmd, FilesLinkCmd, FilesCreateFolderCmd];
|
|
49314
|
+
var FILES_COMMANDS = [FilesListCmd, FilesSearchCmd, FilesReadCmd, FilesCiteCmd, FilesUploadCmd, FilesLinkCmd, FilesCreateFolderCmd];
|
|
49148
49315
|
|
|
49149
49316
|
// ente/commands/notification.ts
|
|
49150
49317
|
import { readFileSync as readFileSync15 } from "node:fs";
|