@yu_robotics/remote-cli-router 1.6.225 → 1.6.227
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 +9 -1
- package/dist/feishu/FeishuLongConnHandler.d.ts +5 -0
- package/dist/feishu/FeishuLongConnHandler.d.ts.map +1 -1
- package/dist/feishu/FeishuLongConnHandler.js +47 -12
- package/dist/feishu/FeishuLongConnHandler.js.map +1 -1
- package/dist/output/InlineFileCards.d.ts +66 -0
- package/dist/output/InlineFileCards.d.ts.map +1 -0
- package/dist/output/InlineFileCards.js +364 -0
- package/dist/output/InlineFileCards.js.map +1 -0
- package/dist/output/OutputTransfers.d.ts +11 -2
- package/dist/output/OutputTransfers.d.ts.map +1 -1
- package/dist/output/OutputTransfers.js +94 -59
- package/dist/output/OutputTransfers.js.map +1 -1
- package/dist/output/Protocol.d.ts +6 -0
- package/dist/output/Protocol.d.ts.map +1 -1
- package/dist/output/Protocol.js +9 -0
- package/dist/output/Protocol.js.map +1 -1
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +70 -2
- package/dist/server.js.map +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -819,7 +819,15 @@ Restricted Claude Code threads use the same approval card flow, titled Permissio
|
|
|
819
819
|
|
|
820
820
|
## Retrieve Output Files
|
|
821
821
|
|
|
822
|
-
|
|
822
|
+
From CLI and Router 1.6.227, new attachments use a compact Files panel inside the original assistant execution card, with four rows per page when space allows. All selections remain reachable through pagination. Retrieval starts only on a manual Get file click; transfer state and valid retries update that same card. The Router binds controls to the actual final card in a long reply and privately journals the complete body and owner/device/thread boundary for late offers and restart recovery (100 parents, 8 MiB total). Hint-only parents expire 24 hours after admission. A parent with verified owned references is retained through their latest fixed snapshot expiry, measured from capture; clicks and restarts never renew that expiry. Recovery checks durable source/reference ownership, and only a matching unpublished pending binding may move to a recovery card. Orphaned references with a missing parent journal stay held rather than being attached to a replacement card. Capacity pressure evicts dormant reply bodies without verified file references first. If the complete body or binding cannot be recovered safely, controls remain held; no replacement standalone file card is created. Existing published standalone cards and transfer receipts remain usable without retargeting. Unknown send outcomes never trigger blind replay.
|
|
823
|
+
|
|
824
|
+
A negotiated display-only hint can show a grey unavailable control when file retrieval is disabled, approval is pending, or the CLI lacks file support. Hints contain sanitized basenames only, do not prove file existence, and never authorize file reads. The CLI does not snapshot candidate files while file capability is disabled. Approved offline references can still queue or use a verified Router copy. Preparation failures stay quiet rather than producing standalone count-only alerts; an unprepared attachment remains unavailable rather than being marked delivered. Internal diagnostics contain bounded reason codes and hashed request/path correlations, without filenames, paths, contents, or raw errors.
|
|
825
|
+
|
|
826
|
+
Prepare intended deliverables in a visible path within the current approved workspace, such as `output/report.csv`, or an already explicitly authorized export root. Continue using the exact Markdown title `attachment`. Hidden directories, application state, and unapproved temporary locations retain their existing guards; do not copy protected files elsewhere to bypass them. Ordinary citations and private worker discoveries remain silent.
|
|
827
|
+
|
|
828
|
+
From CLI 1.6.226, a newly offered attachment requires a trusted assistant link with the exact Markdown title `attachment`, for example `[Report](./report.md "attachment")`. Ordinary untitled source citations, line-position links, tools, thinking, stderr, web links, and code examples create neither Get file offers nor unavailable notices. Attachments select whole files without fragments or line positions; source files can be deliberate attachments too. Capability-enabled coordinator requests receive this syntax as per-request guidance, including continuations, without modifying saved settings. Worker links remain private snapshots even when marked; only explicit coordinator selection promotes an authorized snapshot or verified export after reclamation. Existing published cards and receipts retain their permissions, transfer behavior, and expiry. In CLI 1.6.226, missing or denied deliberate attachments could still produce bounded notices; 1.6.227 suppresses these preparation alerts. Upgrade the CLI to activate selection; the existing Router capability and text/image presentation remain unchanged.
|
|
829
|
+
|
|
830
|
+
Worker file links are captured as private snapshots before temporary workspaces are reclaimed. Worker output does not directly create file cards or export-failure notices. A file becomes visible only when the coordinator explicitly selects it in its reply; selection uses the existing snapshot or a verified export instead of rereading a removed worker path. Unselected worker snapshots stay hidden across timers, reconnects and restarts, and retain the same quotas and expiry. Preparation failures now remain quiet; unavailable attachment hints do not claim delivery. Previously published receipts remain usable so existing file cards are not withdrawn. New worker receipts use a private filename format that older clients do not load; a hidden snapshot does not become public merely by downgrading the CLI.
|
|
823
831
|
|
|
824
832
|
From CLI and Router 1.6.224, existing initialized devices automatically request file-key approval over a supported HTTPS connection when Router files are enabled. Feishu sends the existing bound owner one approval card; no terminal enrollment command or copied binding code is needed. Devices that already authenticate with an approved key do not show another card. Preparing a local key alone does not approve it. Text operation remains available while approval is pending; successful approval reconnects the CLI with its saved key.
|
|
825
833
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { InlineFileCards } from '../output/InlineFileCards';
|
|
1
2
|
import { BindingManager, type DeviceEnrollmentBoundary } from '../binding/BindingManager';
|
|
2
3
|
import { ConnectionHub } from '../websocket/ConnectionHub';
|
|
3
4
|
import { ThreadSummary, QueueConfirmationInfo } from '../types';
|
|
@@ -97,6 +98,8 @@ export declare class FeishuLongConnHandler {
|
|
|
97
98
|
onApprovalAction?: (openId: string, requestId: string, cardId: string, decision: string) => Promise<string>;
|
|
98
99
|
onMaintenanceAction?: (openId: string, id: string, cardId: string, action: string, offset?: number) => Promise<string>;
|
|
99
100
|
onTipsCommand?: (openId: string, content: string) => Promise<void>;
|
|
101
|
+
inlineFiles?: InlineFileCards;
|
|
102
|
+
onInlineFilePage?: (openId: string, cardId: string, payload: unknown) => Promise<string>;
|
|
100
103
|
onOutputFileAction?: (openId: string, cardId: string, payload: unknown) => Promise<string>;
|
|
101
104
|
onAutomaticFileEnrollment?: (openId: string, cardId: string, payload: unknown) => Promise<string>;
|
|
102
105
|
onTipsAction?: (openId: string, cardId: string, payload: unknown) => Promise<string>;
|
|
@@ -298,6 +301,8 @@ export declare class FeishuLongConnHandler {
|
|
|
298
301
|
/** A single passive send: never fall back, execute examples, or register task routes. */
|
|
299
302
|
sendTipCard(openId: string, elements: any[], header: Record<string, unknown>, deliveryKey: string): Promise<string | null>;
|
|
300
303
|
updateTipCard(cardId: string, elements: any[], header: Record<string, unknown>): Promise<void>;
|
|
304
|
+
private patchAssistantCard;
|
|
305
|
+
patchInlineOutputCard(cardId: string, content: string): Promise<void>;
|
|
301
306
|
private readonly outputLogger;
|
|
302
307
|
/** A per-operation deadline also aborts SDK token requests and the actual HTTP transport. */
|
|
303
308
|
private outputRequest;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeishuLongConnHandler.d.ts","sourceRoot":"","sources":["../../src/feishu/FeishuLongConnHandler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FeishuLongConnHandler.d.ts","sourceRoot":"","sources":["../../src/feishu/FeishuLongConnHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAKjE,OAAO,EAAE,cAAc,EAAE,KAAK,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAA4B,aAAa,EAAc,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACtG,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAIxE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAKjD,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,MAAM,CAAC;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;IAahE,OAAO,CAAC,8BAA8B;YASxB,2BAA2B;IAsBzC;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA4C5B;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAgC3B;;OAEG;IACH,iBAAiB,IAAI,cAAc;CAGpC"}
|
|
@@ -156,6 +156,8 @@ class FeishuLongConnHandler {
|
|
|
156
156
|
onApprovalAction;
|
|
157
157
|
onMaintenanceAction;
|
|
158
158
|
onTipsCommand;
|
|
159
|
+
inlineFiles;
|
|
160
|
+
onInlineFilePage;
|
|
159
161
|
onOutputFileAction;
|
|
160
162
|
onAutomaticFileEnrollment;
|
|
161
163
|
onTipsAction;
|
|
@@ -1105,7 +1107,7 @@ Examples:
|
|
|
1105
1107
|
* @param trailingElements Final controls and footer elements that must remain together
|
|
1106
1108
|
* @returns Array of element chunks, each satisfying Feishu's limits
|
|
1107
1109
|
*/
|
|
1108
|
-
splitElementsIntoChunks(elements, continuationHeaderElements = [], trailingElements = [], activityTail, keepCompletionWithBody = false) {
|
|
1110
|
+
splitElementsIntoChunks(elements, continuationHeaderElements = [], trailingElements = [], activityTail, keepCompletionWithBody = false, reserveFiles = false) {
|
|
1109
1111
|
// If empty or very small, return as-is
|
|
1110
1112
|
if (elements.length === 0) {
|
|
1111
1113
|
return [activityTail ? [activityTail] : elements];
|
|
@@ -1140,8 +1142,8 @@ Examples:
|
|
|
1140
1142
|
const finalGroup = finalBodyStart >= continuationHeaderElements.length
|
|
1141
1143
|
? elements.slice(finalBodyStart) : [];
|
|
1142
1144
|
const keepFinalBody = finalGroup.length > trailingElements.length
|
|
1143
|
-
&& finalGroup.reduce((sum, item) => sum + this.countTaggedNodes(item, true), 0) + continuationIndicatorCount <= this.CARD_ELEMENT_LIMIT
|
|
1144
|
-
&& finalGroup.reduce((sum, item) => sum + JSON.stringify(item).length, 0) + continuationIndicatorSize <= this.CARD_DATA_SIZE_LIMIT - this.CARD_SIZE_BUFFER
|
|
1145
|
+
&& finalGroup.reduce((sum, item) => sum + this.countTaggedNodes(item, true), 0) + continuationIndicatorCount <= (this.CARD_ELEMENT_LIMIT - (reserveFiles ? 40 : 0))
|
|
1146
|
+
&& finalGroup.reduce((sum, item) => sum + JSON.stringify(item).length, 0) + continuationIndicatorSize <= this.CARD_DATA_SIZE_LIMIT - this.CARD_SIZE_BUFFER - (reserveFiles ? 32_768 : 0)
|
|
1145
1147
|
&& (0, CardTables_1.countCardTables)(finalGroup) + headerTables <= CardTables_1.CARD_TABLE_LIMIT;
|
|
1146
1148
|
for (let i = 0; i < elements.length; i++) {
|
|
1147
1149
|
const element = elements[i];
|
|
@@ -1162,9 +1164,9 @@ Examples:
|
|
|
1162
1164
|
const groupTables = (0, CardTables_1.countCardTables)(group);
|
|
1163
1165
|
// Check if adding this element would exceed limits
|
|
1164
1166
|
// Reserve space for continuation indicators
|
|
1165
|
-
const wouldExceedElementLimit = currentChunkTaggedNodes + groupTaggedNodes > (this.CARD_ELEMENT_LIMIT - continuationIndicatorCount);
|
|
1167
|
+
const wouldExceedElementLimit = currentChunkTaggedNodes + groupTaggedNodes > ((this.CARD_ELEMENT_LIMIT - (reserveFiles ? 40 : 0)) - continuationIndicatorCount);
|
|
1166
1168
|
const wouldExceedSizeLimit = currentChunkSize + groupSize + continuationIndicatorSize >
|
|
1167
|
-
(this.CARD_DATA_SIZE_LIMIT - this.CARD_SIZE_BUFFER);
|
|
1169
|
+
(this.CARD_DATA_SIZE_LIMIT - this.CARD_SIZE_BUFFER - (reserveFiles ? 32_768 : 0));
|
|
1168
1170
|
const wouldExceedTableLimit = currentChunkTables + groupTables + headerTables > CardTables_1.CARD_TABLE_LIMIT;
|
|
1169
1171
|
if (currentChunk.length > 0 && (wouldExceedElementLimit || wouldExceedSizeLimit || wouldExceedTableLimit)) {
|
|
1170
1172
|
// Start a new chunk
|
|
@@ -1308,6 +1310,8 @@ Examples:
|
|
|
1308
1310
|
content: body,
|
|
1309
1311
|
},
|
|
1310
1312
|
});
|
|
1313
|
+
if (response.code === 0 && response.data?.message_id)
|
|
1314
|
+
this.inlineFiles?.remember(response.data.message_id, rootId ?? response.data.message_id, body);
|
|
1311
1315
|
if (!response.code && response.data?.message_id)
|
|
1312
1316
|
this.workerContexts?.remember(response.data.message_id, rootId ?? response.data.message_id, body);
|
|
1313
1317
|
return response;
|
|
@@ -1370,6 +1374,16 @@ Examples:
|
|
|
1370
1374
|
throw new Error('Could not update tip card.');
|
|
1371
1375
|
});
|
|
1372
1376
|
}
|
|
1377
|
+
async patchAssistantCard(cardId, rootId, content) {
|
|
1378
|
+
const send = (body) => this.client.im.message.patch({ path: { message_id: cardId }, data: { content: body } });
|
|
1379
|
+
return this.inlineFiles ? this.inlineFiles.write(cardId, rootId, content, send) : send(content);
|
|
1380
|
+
}
|
|
1381
|
+
async patchInlineOutputCard(cardId, content) {
|
|
1382
|
+
const body = this.workerContexts?.decorate(content) ?? content;
|
|
1383
|
+
const result = await this.outputRequest(6000, client => client.im.message.patch({ path: { message_id: cardId }, data: { content: body } }));
|
|
1384
|
+
if (result?.code !== 0)
|
|
1385
|
+
throw new Error('Inline card update unconfirmed.');
|
|
1386
|
+
}
|
|
1373
1387
|
outputLogger = (0, DeliveryDiagnostics_1.safeSdkLogger)();
|
|
1374
1388
|
/** A per-operation deadline also aborts SDK token requests and the actual HTTP transport. */
|
|
1375
1389
|
async outputRequest(timeout, run) {
|
|
@@ -1528,7 +1542,7 @@ Examples:
|
|
|
1528
1542
|
// Split elements into chunks based on Feishu Card 2.0 limits
|
|
1529
1543
|
const shell = this.activityShells.get(messageId);
|
|
1530
1544
|
const activityTail = shell && shell.finishedAt === undefined ? (0, ActivityProgress_1.createActivityElement)(shell.activity) : undefined;
|
|
1531
|
-
const chunks = this.splitElementsIntoChunks(elements, continuationHeaderElements, trailingElements, activityTail, keepCompletionWithBody);
|
|
1545
|
+
const chunks = this.splitElementsIntoChunks(elements, continuationHeaderElements, trailingElements, activityTail, keepCompletionWithBody, this.inlineFiles?.hasRoot(messageId));
|
|
1532
1546
|
const tailIndex = activityTail ? chunks.length - 1 : -1;
|
|
1533
1547
|
console.log(`[FeishuHandler] Need ${chunks.length} card(s), currently have ${chain.length} card(s)`);
|
|
1534
1548
|
let hashes = this.cardContentHashes.get(messageId);
|
|
@@ -1550,7 +1564,7 @@ Examples:
|
|
|
1550
1564
|
const fallback = fallbackCards.has(index);
|
|
1551
1565
|
const content = JSON.stringify({ schema: '2.0', body: { elements: fallback ? (0, CardTables_1.plainTextCard)(elements) : elements } });
|
|
1552
1566
|
await this.sendCardRequest(content, async (body) => {
|
|
1553
|
-
const result = await this.
|
|
1567
|
+
const result = await this.patchAssistantCard(cardId, messageId, body);
|
|
1554
1568
|
if (!result?.code)
|
|
1555
1569
|
this.workerContexts?.remember(cardId, messageId, body);
|
|
1556
1570
|
return result;
|
|
@@ -1607,7 +1621,7 @@ Examples:
|
|
|
1607
1621
|
return;
|
|
1608
1622
|
}
|
|
1609
1623
|
await this.sendCardRequest(payloads[index], async (content) => {
|
|
1610
|
-
const result = await this.
|
|
1624
|
+
const result = await this.patchAssistantCard(chain[index], messageId, content);
|
|
1611
1625
|
if (!result?.code)
|
|
1612
1626
|
this.workerContexts?.remember(chain[index], messageId, content);
|
|
1613
1627
|
return result;
|
|
@@ -1728,10 +1742,20 @@ Examples:
|
|
|
1728
1742
|
if (delivered && delivered.length > 0)
|
|
1729
1743
|
await options.onDelivered([...delivered]);
|
|
1730
1744
|
}
|
|
1745
|
+
if (!bare && this.inlineFiles) {
|
|
1746
|
+
const chunks = this.splitElementsIntoChunks(finalElements, headerElements, trailingElements, undefined, keepCompletionWithBody, this.inlineFiles?.hasRoot(messageId));
|
|
1747
|
+
const cardId = this.messageChains.get(messageId)?.[chunks.length - 1];
|
|
1748
|
+
if (cardId) {
|
|
1749
|
+
try {
|
|
1750
|
+
await this.inlineFiles.bind(messageId, cardId);
|
|
1751
|
+
}
|
|
1752
|
+
catch { /* Hold file controls if the complete durable parent binding is unavailable. */ }
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1731
1755
|
// Store thread switch card state for later refresh (before cleanup)
|
|
1732
1756
|
if (!bare && threads && threads.length >= 1) {
|
|
1733
1757
|
const chain = this.messageChains.get(messageId);
|
|
1734
|
-
const chunks = this.splitElementsIntoChunks(finalElements, headerElements, trailingElements, undefined, keepCompletionWithBody);
|
|
1758
|
+
const chunks = this.splitElementsIntoChunks(finalElements, headerElements, trailingElements, undefined, keepCompletionWithBody, this.inlineFiles?.hasRoot(messageId));
|
|
1735
1759
|
const lastChunkIndex = chunks.length - 1;
|
|
1736
1760
|
const lastCardId = chain?.[lastChunkIndex];
|
|
1737
1761
|
if (lastCardId) {
|
|
@@ -1901,7 +1925,7 @@ Examples:
|
|
|
1901
1925
|
* Re-patches the card with updated button states (new active thread highlighted).
|
|
1902
1926
|
*/
|
|
1903
1927
|
async refreshThreadSwitchButtons(cardMessageId, newActiveThreadId) {
|
|
1904
|
-
const rootId = this.workerContexts?.rootFor(cardMessageId) ?? cardMessageId;
|
|
1928
|
+
const rootId = this.workerContexts?.rootFor(cardMessageId) ?? this.inlineFiles?.rootFor(cardMessageId) ?? cardMessageId;
|
|
1905
1929
|
await this.withMessageLock(rootId, async () => {
|
|
1906
1930
|
const state = this.threadSwitchCardState.get(cardMessageId);
|
|
1907
1931
|
if (!state) {
|
|
@@ -1913,7 +1937,7 @@ Examples:
|
|
|
1913
1937
|
...this.createThreadSwitchElements(state.threads, newActiveThreadId, state.replyLabel),
|
|
1914
1938
|
];
|
|
1915
1939
|
await this.sendCardRequest(JSON.stringify({ schema: '2.0', body: { elements: updatedElements } }), async (content) => {
|
|
1916
|
-
const result = await this.
|
|
1940
|
+
const result = await this.patchAssistantCard(cardMessageId, rootId, content);
|
|
1917
1941
|
if (!result?.code)
|
|
1918
1942
|
this.workerContexts?.remember(cardMessageId, rootId, content);
|
|
1919
1943
|
return result;
|
|
@@ -1927,7 +1951,7 @@ Examples:
|
|
|
1927
1951
|
if (!content)
|
|
1928
1952
|
return;
|
|
1929
1953
|
await this.sendCardRequest(content, async (body) => {
|
|
1930
|
-
const result = await this.
|
|
1954
|
+
const result = await this.patchAssistantCard(cardId, rootId, body);
|
|
1931
1955
|
if (!result?.code)
|
|
1932
1956
|
this.workerContexts?.remember(cardId, rootId, body);
|
|
1933
1957
|
return result;
|
|
@@ -1966,6 +1990,17 @@ Examples:
|
|
|
1966
1990
|
return { toast: { type: 'error', content: 'File approval could not be completed. Existing text access is unchanged.' } };
|
|
1967
1991
|
}
|
|
1968
1992
|
}
|
|
1993
|
+
if (parsed.action === 'output_page') {
|
|
1994
|
+
const cardId = data?.context?.open_message_id;
|
|
1995
|
+
if (typeof cardId !== 'string' || !this.onInlineFilePage)
|
|
1996
|
+
return { toast: { type: 'error', content: 'File controls unavailable.' } };
|
|
1997
|
+
try {
|
|
1998
|
+
return { toast: { type: 'info', content: await this.onInlineFilePage(openId, cardId, parsed) } };
|
|
1999
|
+
}
|
|
2000
|
+
catch {
|
|
2001
|
+
return { toast: { type: 'error', content: 'File controls unavailable.' } };
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
1969
2004
|
if (parsed.action === 'output_file') {
|
|
1970
2005
|
const cardId = data?.context?.open_message_id;
|
|
1971
2006
|
if (typeof cardId !== 'string' || !this.onOutputFileAction)
|