dsh-over-ssh 0.1.0 → 0.2.0
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 +19 -17
- package/agents/agent-manifest.json +6 -6
- package/agents/linux-amd64/dsh-over-ssh-agent +0 -0
- package/agents/linux-arm64/dsh-over-ssh-agent +0 -0
- package/lib/client.js +422 -337
- package/lib/file-references.js +92 -35
- package/lib/fs.js +295 -113
- package/lib/index.js +6912 -4330
- package/lib/terminal-wrapper.js +9 -4
- package/lib/types/src/config.d.ts +156 -9
- package/lib/types/src/file-references.d.ts +0 -1
- package/lib/types/src/host/app/backend.d.ts +44 -3
- package/lib/types/src/host/app/recycle-bin/recycle-bin-contract.d.ts +0 -1
- package/lib/types/src/host/app/recycle-bin/recycle-bin-service.d.ts +0 -1
- package/lib/types/src/host/app/session-admin/session-admin-contract.d.ts +12 -1
- package/lib/types/src/host/app/session-admin/session-admin-service.d.ts +0 -1
- package/lib/types/src/host/app/transport/transport-selector.d.ts +0 -1
- package/lib/types/src/host/app/transport/transport-service.d.ts +0 -1
- package/lib/types/src/host/domain/capability.d.ts +0 -1
- package/lib/types/src/host/domain/errors.d.ts +0 -1
- package/lib/types/src/host/domain/roots/connection.d.ts +0 -1
- package/lib/types/src/host/domain/roots/root.d.ts +24 -9
- package/lib/types/src/host/domain/roots/session-roots.d.ts +23 -1
- package/lib/types/src/host/domain/roots/ssh-config.d.ts +0 -1
- package/lib/types/src/host/domain/session/session-admin.d.ts +0 -1
- package/lib/types/src/host/domain/transfer/recycle-bin.d.ts +0 -1
- package/lib/types/src/host/domain/transfer/transfer.d.ts +0 -1
- package/lib/types/src/host/infra/transport/agent/agent-installer.d.ts +0 -1
- package/lib/types/src/host/infra/transport/forward.d.ts +75 -0
- package/lib/types/src/host/infra/transport/ssh/ssh2-transport.d.ts +5 -1
- package/lib/types/src/host/infra/transport/transport-base.d.ts +0 -1
- package/lib/types/src/host/infra/transport/transport.d.ts +42 -2
- package/lib/types/src/host/integration/agent/agent-preflight.d.ts +0 -1
- package/lib/types/src/host/integration/fs/file-reference-provider.d.ts +0 -1
- package/lib/types/src/host/integration/fs/fs-provider.d.ts +18 -3
- package/lib/types/src/host/integration/transfer/transfer-service.d.ts +0 -1
- package/lib/types/src/index.d.ts +23 -1
- package/lib/types/src/local-bridge-refs.d.ts +0 -1
- package/lib/types/src/local-bridge.d.ts +0 -1
- package/lib/types/src/shared/root-keys.d.ts +120 -0
- package/lib/types/src/wiring/helpers.d.ts +0 -1
- package/package.json +5 -3
- package/lib/types/src/client/controls.d.ts +0 -131
- package/lib/types/src/client/core/card-focus-trap.d.ts +0 -45
- package/lib/types/src/client/core/controls.d.ts +0 -164
- package/lib/types/src/client/core/latest.d.ts +0 -48
- package/lib/types/src/client/core/locale.d.ts +0 -38
- package/lib/types/src/client/core/message.d.ts +0 -37
- package/lib/types/src/client/core/panel-model.d.ts +0 -134
- package/lib/types/src/client/core/portal.d.ts +0 -266
- package/lib/types/src/client/core/remote.d.ts +0 -84
- package/lib/types/src/client/core/styles.d.ts +0 -458
- package/lib/types/src/client/file-tree-io.d.ts +0 -19
- package/lib/types/src/client/file-tree.d.ts +0 -271
- package/lib/types/src/client/flows/directory-browser.d.ts +0 -587
- package/lib/types/src/client/flows/session-directory.d.ts +0 -415
- package/lib/types/src/client/flows/workspace-directory-flow.d.ts +0 -480
- package/lib/types/src/client/locale.d.ts +0 -31
- package/lib/types/src/client/panel-model.d.ts +0 -37
- package/lib/types/src/client/panel.d.ts +0 -77
- package/lib/types/src/client/roots/connection-test.d.ts +0 -69
- package/lib/types/src/client/roots/roots-panel-state.d.ts +0 -307
- package/lib/types/src/client/roots/roots-panel-view.d.ts +0 -280
- package/lib/types/src/client/roots/roots-panel.d.ts +0 -364
- package/lib/types/src/client/roots/transfer-panel-view.d.ts +0 -35
- package/lib/types/src/client/roots/transfer-panel.d.ts +0 -241
- package/lib/types/src/client/roots/transfer-progress.d.ts +0 -67
- package/lib/types/src/client/roots-panel-view.d.ts +0 -236
- package/lib/types/src/client/roots-panel.d.ts +0 -347
- package/lib/types/src/client/session/session-panel-view.d.ts +0 -336
- package/lib/types/src/client/session/session-panel.d.ts +0 -322
- package/lib/types/src/client/session/session-remote-mark.d.ts +0 -110
- package/lib/types/src/client/session/session-row-actions.d.ts +0 -398
- package/lib/types/src/client/session-panel.d.ts +0 -152
- package/lib/types/src/client/styles.d.ts +0 -252
- package/lib/types/src/client/workspace-directory-flow.d.ts +0 -342
- package/lib/types/src/fs.d.ts +0 -46
- package/lib/types/src/host/app/recycle-bin/recycle-bin-move.d.ts +0 -18
- package/lib/types/src/host/app/recycle-bin/recycle-bin-world.d.ts +0 -38
- package/lib/types/src/host/app/recycle-bin-contract.d.ts +0 -215
- package/lib/types/src/host/app/recycle-bin-move.d.ts +0 -18
- package/lib/types/src/host/app/recycle-bin-service.d.ts +0 -45
- package/lib/types/src/host/app/recycle-bin-world.d.ts +0 -35
- package/lib/types/src/host/app/roots/roots-api-connections.d.ts +0 -49
- package/lib/types/src/host/app/roots/roots-api-contract.d.ts +0 -369
- package/lib/types/src/host/app/roots/roots-api-directories.d.ts +0 -13
- package/lib/types/src/host/app/roots/roots-api-http.d.ts +0 -77
- package/lib/types/src/host/app/roots/roots-api-long-poll.d.ts +0 -130
- package/lib/types/src/host/app/roots/roots-api-projections.d.ts +0 -102
- package/lib/types/src/host/app/roots/roots-api-roots.d.ts +0 -13
- package/lib/types/src/host/app/roots/roots-api-state.d.ts +0 -22
- package/lib/types/src/host/app/roots/roots-api-transfers.d.ts +0 -26
- package/lib/types/src/host/app/roots/roots-api.d.ts +0 -55
- package/lib/types/src/host/app/roots/user-roots.d.ts +0 -552
- package/lib/types/src/host/app/roots-api-connections.d.ts +0 -49
- package/lib/types/src/host/app/roots-api-contract.d.ts +0 -339
- package/lib/types/src/host/app/roots-api-directories.d.ts +0 -13
- package/lib/types/src/host/app/roots-api-http.d.ts +0 -77
- package/lib/types/src/host/app/roots-api-projections.d.ts +0 -102
- package/lib/types/src/host/app/roots-api-roots.d.ts +0 -13
- package/lib/types/src/host/app/roots-api-state.d.ts +0 -22
- package/lib/types/src/host/app/roots-api-support.d.ts +0 -182
- package/lib/types/src/host/app/roots-api-transfers.d.ts +0 -13
- package/lib/types/src/host/app/roots-api.d.ts +0 -55
- package/lib/types/src/host/app/routed-fs.d.ts +0 -239
- package/lib/types/src/host/app/serialize.d.ts +0 -37
- package/lib/types/src/host/app/session-admin/session-admin-context.d.ts +0 -36
- package/lib/types/src/host/app/session-admin/session-admin-delete.d.ts +0 -34
- package/lib/types/src/host/app/session-admin-context.d.ts +0 -36
- package/lib/types/src/host/app/session-admin-contract.d.ts +0 -214
- package/lib/types/src/host/app/session-admin-delete.d.ts +0 -34
- package/lib/types/src/host/app/session-admin-service.d.ts +0 -38
- package/lib/types/src/host/app/takeover/takeover-plan.d.ts +0 -227
- package/lib/types/src/host/app/takeover/takeover-rows.d.ts +0 -55
- package/lib/types/src/host/app/transport-selector.d.ts +0 -98
- package/lib/types/src/host/app/transport-service.d.ts +0 -75
- package/lib/types/src/host/app/user-roots.d.ts +0 -461
- package/lib/types/src/host/domain/bin-location.d.ts +0 -79
- package/lib/types/src/host/domain/connection.d.ts +0 -95
- package/lib/types/src/host/domain/glob-pattern.d.ts +0 -62
- package/lib/types/src/host/domain/literal-text.d.ts +0 -63
- package/lib/types/src/host/domain/path-grammar.d.ts +0 -84
- package/lib/types/src/host/domain/recycle-bin.d.ts +0 -337
- package/lib/types/src/host/domain/root.d.ts +0 -74
- package/lib/types/src/host/domain/roots/bin-location.d.ts +0 -91
- package/lib/types/src/host/domain/roots/route-table.d.ts +0 -102
- package/lib/types/src/host/domain/route-table.d.ts +0 -80
- package/lib/types/src/host/domain/session/terminal-target.d.ts +0 -136
- package/lib/types/src/host/domain/session-admin.d.ts +0 -330
- package/lib/types/src/host/domain/shell.d.ts +0 -47
- package/lib/types/src/host/domain/ssh-config.d.ts +0 -73
- package/lib/types/src/host/domain/terminal-target.d.ts +0 -132
- package/lib/types/src/host/domain/tool-requests.d.ts +0 -369
- package/lib/types/src/host/domain/transfer.d.ts +0 -260
- package/lib/types/src/host/infra/backend/local-backend.d.ts +0 -84
- package/lib/types/src/host/infra/backend/local-version.d.ts +0 -43
- package/lib/types/src/host/infra/backend/platform-local-backend.d.ts +0 -89
- package/lib/types/src/host/infra/backend/remote-backend.d.ts +0 -239
- package/lib/types/src/host/infra/cache/lru.d.ts +0 -52
- package/lib/types/src/host/infra/cache/versioned.d.ts +0 -77
- package/lib/types/src/host/infra/temp-name.d.ts +0 -19
- package/lib/types/src/host/infra/transport/agent/agent-protocol-client.d.ts +0 -132
- package/lib/types/src/host/infra/transport/agent/agent-protocol-codec.d.ts +0 -140
- package/lib/types/src/host/infra/transport/agent/agent-protocol-errors.d.ts +0 -41
- package/lib/types/src/host/infra/transport/agent/agent-protocol-frames.d.ts +0 -197
- package/lib/types/src/host/infra/transport/agent/agent-protocol-types.d.ts +0 -564
- package/lib/types/src/host/infra/transport/agent/agent-transport.d.ts +0 -418
- package/lib/types/src/host/infra/transport/agent-installer.d.ts +0 -121
- package/lib/types/src/host/infra/transport/agent-protocol-client.d.ts +0 -123
- package/lib/types/src/host/infra/transport/agent-protocol-codec.d.ts +0 -131
- package/lib/types/src/host/infra/transport/agent-protocol-errors.d.ts +0 -41
- package/lib/types/src/host/infra/transport/agent-protocol-frames.d.ts +0 -197
- package/lib/types/src/host/infra/transport/agent-protocol-types.d.ts +0 -509
- package/lib/types/src/host/infra/transport/agent-transport.d.ts +0 -353
- package/lib/types/src/host/infra/transport/alias-transport.d.ts +0 -206
- package/lib/types/src/host/infra/transport/askpass-fs.d.ts +0 -20
- package/lib/types/src/host/infra/transport/askpass.d.ts +0 -133
- package/lib/types/src/host/infra/transport/command-pool.d.ts +0 -61
- package/lib/types/src/host/infra/transport/fs-commands.d.ts +0 -140
- package/lib/types/src/host/infra/transport/git-status-route.d.ts +0 -63
- package/lib/types/src/host/infra/transport/git-status.d.ts +0 -101
- package/lib/types/src/host/infra/transport/node-spawn.d.ts +0 -26
- package/lib/types/src/host/infra/transport/session-window.d.ts +0 -51
- package/lib/types/src/host/infra/transport/shell-quote.d.ts +0 -59
- package/lib/types/src/host/infra/transport/ssh/alias-transport.d.ts +0 -206
- package/lib/types/src/host/infra/transport/ssh/askpass-fs.d.ts +0 -20
- package/lib/types/src/host/infra/transport/ssh/askpass.d.ts +0 -133
- package/lib/types/src/host/infra/transport/ssh/shell-quote.d.ts +0 -62
- package/lib/types/src/host/infra/transport/ssh/ssh-argv.d.ts +0 -43
- package/lib/types/src/host/infra/transport/ssh-argv.d.ts +0 -43
- package/lib/types/src/host/infra/transport/ssh2-transport.d.ts +0 -302
- package/lib/types/src/host/integration/agent/agent-install-io.d.ts +0 -33
- package/lib/types/src/host/integration/agent/askpass-registry.d.ts +0 -66
- package/lib/types/src/host/integration/agent-install-io.d.ts +0 -33
- package/lib/types/src/host/integration/agent-preflight.d.ts +0 -56
- package/lib/types/src/host/integration/anchor-directory.d.ts +0 -56
- package/lib/types/src/host/integration/askpass-registry.d.ts +0 -59
- package/lib/types/src/host/integration/bin-root-resolver.d.ts +0 -81
- package/lib/types/src/host/integration/connection-test.d.ts +0 -73
- package/lib/types/src/host/integration/file-reference-provider.d.ts +0 -115
- package/lib/types/src/host/integration/fs/git-status-wiring.d.ts +0 -21
- package/lib/types/src/host/integration/fs/platform-errors.d.ts +0 -94
- package/lib/types/src/host/integration/fs/remote-file-tools.d.ts +0 -369
- package/lib/types/src/host/integration/fs/remote-index.d.ts +0 -177
- package/lib/types/src/host/integration/fs-provider.d.ts +0 -226
- package/lib/types/src/host/integration/lsp/lsp-framing.d.ts +0 -38
- package/lib/types/src/host/integration/lsp/lsp-registry.d.ts +0 -67
- package/lib/types/src/host/integration/lsp/lsp-session.d.ts +0 -130
- package/lib/types/src/host/integration/management-tools.d.ts +0 -64
- package/lib/types/src/host/integration/recycle-bin-service.d.ts +0 -247
- package/lib/types/src/host/integration/remote/connection-test.d.ts +0 -73
- package/lib/types/src/host/integration/remote/remote-face.d.ts +0 -127
- package/lib/types/src/host/integration/remote/remote-tool-backend.d.ts +0 -108
- package/lib/types/src/host/integration/remote-face.d.ts +0 -127
- package/lib/types/src/host/integration/remote-file-tools.d.ts +0 -241
- package/lib/types/src/host/integration/remote-home.d.ts +0 -69
- package/lib/types/src/host/integration/remote-index.d.ts +0 -165
- package/lib/types/src/host/integration/remote-job-tools.d.ts +0 -295
- package/lib/types/src/host/integration/remote-tool-backend.d.ts +0 -97
- package/lib/types/src/host/integration/remote-tools.d.ts +0 -206
- package/lib/types/src/host/integration/root-registry.d.ts +0 -115
- package/lib/types/src/host/integration/roots/anchor-directory.d.ts +0 -56
- package/lib/types/src/host/integration/roots/bin-root-resolver.d.ts +0 -81
- package/lib/types/src/host/integration/roots/remote-home.d.ts +0 -69
- package/lib/types/src/host/integration/roots/root-registry.d.ts +0 -144
- package/lib/types/src/host/integration/roots/roots-wiring.d.ts +0 -219
- package/lib/types/src/host/integration/roots/session-root-index.d.ts +0 -52
- package/lib/types/src/host/integration/roots-api.d.ts +0 -407
- package/lib/types/src/host/integration/roots-wiring.d.ts +0 -211
- package/lib/types/src/host/integration/session/session-api.d.ts +0 -88
- package/lib/types/src/host/integration/session/session-bin-lock.d.ts +0 -80
- package/lib/types/src/host/integration/session/session-header.d.ts +0 -151
- package/lib/types/src/host/integration/session/session-labels.d.ts +0 -56
- package/lib/types/src/host/integration/session/session-route-wiring.d.ts +0 -50
- package/lib/types/src/host/integration/session-admin-service.d.ts +0 -236
- package/lib/types/src/host/integration/session-api.d.ts +0 -81
- package/lib/types/src/host/integration/session-bin-lock.d.ts +0 -80
- package/lib/types/src/host/integration/session-header.d.ts +0 -118
- package/lib/types/src/host/integration/session-labels.d.ts +0 -56
- package/lib/types/src/host/integration/session-route-wiring.d.ts +0 -50
- package/lib/types/src/host/integration/session-scope.d.ts +0 -113
- package/lib/types/src/host/integration/session-tools.d.ts +0 -44
- package/lib/types/src/host/integration/strict-arguments.d.ts +0 -79
- package/lib/types/src/host/integration/takeover/takeover-api.d.ts +0 -62
- package/lib/types/src/host/integration/takeover/takeover-route-wiring.d.ts +0 -60
- package/lib/types/src/host/integration/takeover/takeover-service.d.ts +0 -167
- package/lib/types/src/host/integration/terminal-manifest.d.ts +0 -94
- package/lib/types/src/host/integration/tools/management-tools.d.ts +0 -245
- package/lib/types/src/host/integration/tools/remote-job-tools.d.ts +0 -316
- package/lib/types/src/host/integration/tools/remote-lsp-tools.d.ts +0 -43
- package/lib/types/src/host/integration/tools/remote-tools.d.ts +0 -236
- package/lib/types/src/host/integration/tools/session-target.d.ts +0 -52
- package/lib/types/src/host/integration/tools/session-tools.d.ts +0 -46
- package/lib/types/src/host/integration/tools/strict-arguments.d.ts +0 -79
- package/lib/types/src/host/integration/tools/terminal-manifest.d.ts +0 -94
- package/lib/types/src/host/integration/transfer/remote-copy.d.ts +0 -66
- package/lib/types/src/host/integration/transfer/transfer-adapters.d.ts +0 -48
- package/lib/types/src/host/integration/transfer/transfer-tracker.d.ts +0 -106
- package/lib/types/src/host/integration/transfer-adapters.d.ts +0 -44
- package/lib/types/src/host/integration/transfer-service.d.ts +0 -164
- package/lib/types/src/host/integration/transfer-tracker.d.ts +0 -106
- package/lib/types/src/host/integration/user-roots.d.ts +0 -461
- package/lib/types/src/wiring/connections.d.ts +0 -189
- package/lib/types/src/wiring/fs.d.ts +0 -13
- package/lib/types/src/wiring/install-memo.d.ts +0 -32
- package/lib/types/src/wiring/legacy-dirs.d.ts +0 -62
- package/lib/types/src/wiring/package-paths.d.ts +0 -35
- package/lib/types/src/wiring/roots.d.ts +0 -21
- package/lib/types/src/wiring/state-dir.d.ts +0 -29
- package/lib/types/src/wiring/tools.d.ts +0 -35
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The recycle-bin service: the domain's pure decisions wired to injected I/O primitives.
|
|
3
|
-
*
|
|
4
|
-
* The seam is deliberate (AGENTS.md 红线 3): every path that touches a real filesystem or a real SSH
|
|
5
|
-
* connection arrives as a function, so this module is testable offline and a test can inject a move that fails.
|
|
6
|
-
*
|
|
7
|
-
* Two contracts matter more than the rest:
|
|
8
|
-
*
|
|
9
|
-
* 1. **Move first, then confirm.** In `recycle` mode a success is reported only after `stat` shows the entry
|
|
10
|
-
* inside the bin **and** the original path gone. A move that throws is confirmed before anything is
|
|
11
|
-
* claimed: if the move actually landed (a lost response) it counts as success, otherwise the call fails
|
|
12
|
-
* and nothing is recorded — "deleted but not in the bin" must never be reported as success.
|
|
13
|
-
* 2. **The index write is never swallowed.** If the index cannot be written after a successful move, the move
|
|
14
|
-
* is rolled back and the failure is reported; a physical delete has no rollback, so that case is reported
|
|
15
|
-
* with `purged: true, indexStale: true` instead of being hidden.
|
|
16
|
-
*
|
|
17
|
-
* Other decisions worth knowing:
|
|
18
|
-
*
|
|
19
|
-
* - A `permanent` discard is irreversible by construction and says so in its result (`recoverable: false`),
|
|
20
|
-
* and its undo record is refused as `irreversible`.
|
|
21
|
-
* - Restoring onto an occupied original path is **refused** (`TRANSFER_CONFLICT`, with the informational
|
|
22
|
-
* `suggestedPath` in `details`); this module never silently restores to a different name.
|
|
23
|
-
* - `*Remote` primitives are the **remote world's** mutators. A local root additionally needs `localIo`; when it
|
|
24
|
-
* is missing the call fails with `REMOTE_UNSUPPORTED` rather than reusing remote primitives on local paths.
|
|
25
|
-
* - Every destructive call takes an `AbortSignal`, propagated to every injected primitive.
|
|
26
|
-
* - Error codes are reused from the existing table (no new code is registered): `TRASH_NOT_FOUND` (missing
|
|
27
|
-
* entry, unreadable index), `REMOTE_NOT_FOUND` (target gone), `TRANSFER_CONFLICT` (occupied restore path),
|
|
28
|
-
* `ROOT_OUTSIDE` (symlink target refused), `ROOT_AMBIGUOUS` (one id in two bins), `REMOTE_UNSUPPORTED`
|
|
29
|
-
* (local root without local primitives), `REMOTE_COMMAND_FAILED` (an operation that could not be confirmed),
|
|
30
|
-
* `ROOT_INVALID` (unusable configuration/input), `CANCELLED` (aborted signal).
|
|
31
|
-
*
|
|
32
|
-
* @module dsh-remote-workspace/integration/recycle-bin-service
|
|
33
|
-
*/
|
|
34
|
-
import type { BackendEntry, BackendStat } from '../app/backend.ts';
|
|
35
|
-
import { type RecycleBinEntry, type RecycleBinEntryId } from '../domain/recycle-bin.ts';
|
|
36
|
-
import { type RootRef } from '../domain/root.ts';
|
|
37
|
-
/** Removal options for one physical delete. */
|
|
38
|
-
export interface RecycleBinRemovalOptions {
|
|
39
|
-
/** Whether the target is a directory that must be removed with its content. */
|
|
40
|
-
readonly recursive: boolean;
|
|
41
|
-
/** Caller cancellation. */
|
|
42
|
-
readonly signal?: AbortSignal;
|
|
43
|
-
}
|
|
44
|
-
/** The mutating primitives of one execution world, shaped like the remote group. */
|
|
45
|
-
export interface RecycleBinWorldIo {
|
|
46
|
-
/**
|
|
47
|
-
* Move (rename) a path.
|
|
48
|
-
*
|
|
49
|
-
* Contract: the implementation must create a missing destination parent directory (equivalent to
|
|
50
|
-
* `mkdir -p` + `rename`). A cross-device move that cannot be done by rename must **fail loudly**; silently
|
|
51
|
-
* degrading to copy-then-delete would break the "don't delete until it is in the bin" guarantee.
|
|
52
|
-
*/
|
|
53
|
-
readonly move: (from: string, to: string, signal?: AbortSignal) => Promise<void>;
|
|
54
|
-
/** Physically delete a path. */
|
|
55
|
-
readonly remove: (path: string, options: RecycleBinRemovalOptions) => Promise<void>;
|
|
56
|
-
/** List one directory. */
|
|
57
|
-
readonly list: (dir: string, signal?: AbortSignal) => Promise<readonly BackendEntry[]>;
|
|
58
|
-
/** Read a text file (the index). */
|
|
59
|
-
readonly readText: (path: string, signal?: AbortSignal) => Promise<string>;
|
|
60
|
-
/** Write a text file as UTF-8 **without BOM** (the index). */
|
|
61
|
-
readonly writeText: (path: string, text: string, signal?: AbortSignal) => Promise<void>;
|
|
62
|
-
}
|
|
63
|
-
/** Everything {@link createRecycleBinService} needs; each field is injected so tests need no host. */
|
|
64
|
-
export interface RecycleBinServiceDeps {
|
|
65
|
-
/** Bin root directory for one root; a deployment setting, never hardcoded here. */
|
|
66
|
-
readonly binRootFor: (root: RootRef) => string;
|
|
67
|
-
/** Find a root by its `rootKey()`; `undefined` means the root is no longer registered. */
|
|
68
|
-
readonly resolveRoot: (key: string) => RootRef | undefined;
|
|
69
|
-
/** `stat` in the local world. */
|
|
70
|
-
readonly statLocal: (path: string, signal?: AbortSignal) => Promise<BackendStat>;
|
|
71
|
-
/** `stat` in the remote world. */
|
|
72
|
-
readonly statRemote: (path: string, signal?: AbortSignal) => Promise<BackendStat>;
|
|
73
|
-
/** Move primitive of the remote world. */
|
|
74
|
-
readonly moveRemote: (from: string, to: string, signal?: AbortSignal) => Promise<void>;
|
|
75
|
-
/** Remove primitive of the remote world. */
|
|
76
|
-
readonly removeRemote: (path: string, options: RecycleBinRemovalOptions) => Promise<void>;
|
|
77
|
-
/** List primitive of the remote world. */
|
|
78
|
-
readonly listRemote: (dir: string, signal?: AbortSignal) => Promise<readonly BackendEntry[]>;
|
|
79
|
-
/** Index read primitive of the remote world. */
|
|
80
|
-
readonly readTextRemote: (path: string, signal?: AbortSignal) => Promise<string>;
|
|
81
|
-
/** Index write primitive of the remote world (UTF-8, no BOM). */
|
|
82
|
-
readonly writeTextRemote: (path: string, text: string, signal?: AbortSignal) => Promise<void>;
|
|
83
|
-
/** Clock, injected so a test can pin "now". */
|
|
84
|
-
readonly now: () => number;
|
|
85
|
-
/** Undo depth from configuration (a non-positive value keeps no history). */
|
|
86
|
-
readonly undoDepth: number;
|
|
87
|
-
/** Roots whose bins exist, so `sweep()` can walk them all. */
|
|
88
|
-
readonly knownRoots: () => readonly RootRef[];
|
|
89
|
-
/**
|
|
90
|
-
* Local-world mutators.
|
|
91
|
-
*
|
|
92
|
-
* Optional: a service built for remote work omits it, and touching a local target then fails with
|
|
93
|
-
* `REMOTE_UNSUPPORTED` instead of misapplying the remote primitives to a local path.
|
|
94
|
-
*/
|
|
95
|
-
readonly localIo?: RecycleBinWorldIo;
|
|
96
|
-
}
|
|
97
|
-
/** One deletion target: a root plus a path inside it. */
|
|
98
|
-
export interface RecycleBinTarget {
|
|
99
|
-
readonly root: RootRef;
|
|
100
|
-
/** Absolute path in the root's own spelling. */
|
|
101
|
-
readonly path: string;
|
|
102
|
-
}
|
|
103
|
-
/** A bin view scope: one root, optionally narrowed to targets deleted under one directory. */
|
|
104
|
-
export interface RecycleBinScope {
|
|
105
|
-
readonly root: RootRef;
|
|
106
|
-
/** Optional directory prefix, matched per path segment. */
|
|
107
|
-
readonly path?: string;
|
|
108
|
-
}
|
|
109
|
-
/** How {@link RecycleBinService.discard} removes a target. */
|
|
110
|
-
export type DiscardMode = 'permanent' | 'recycle';
|
|
111
|
-
/** Options for {@link RecycleBinService.discard}. */
|
|
112
|
-
export interface DiscardOptions {
|
|
113
|
-
readonly mode: DiscardMode;
|
|
114
|
-
readonly signal?: AbortSignal;
|
|
115
|
-
}
|
|
116
|
-
/** Result of a discard. */
|
|
117
|
-
export interface DiscardResult {
|
|
118
|
-
readonly mode: DiscardMode;
|
|
119
|
-
/** The bin entry in `recycle` mode; `undefined` for `permanent`. */
|
|
120
|
-
readonly entry: RecycleBinEntry | undefined;
|
|
121
|
-
/** Whether the content can still be recovered. **Always `false` for `permanent`.** */
|
|
122
|
-
readonly recoverable: boolean;
|
|
123
|
-
/** Post-operation confirmation: the original path is gone. */
|
|
124
|
-
readonly verified: boolean;
|
|
125
|
-
/** Human-facing note, mandatory for an irreversible delete. */
|
|
126
|
-
readonly warning: string | undefined;
|
|
127
|
-
}
|
|
128
|
-
/** What a bin actually holds for one root. */
|
|
129
|
-
export interface RecycleBinListing {
|
|
130
|
-
readonly entries: readonly RecycleBinEntry[];
|
|
131
|
-
/** Ids the index knows but the bin directory no longer contains. */
|
|
132
|
-
readonly missing: readonly RecycleBinEntryId[];
|
|
133
|
-
/** Directory names in the bin that no index record claims. */
|
|
134
|
-
readonly orphans: readonly string[];
|
|
135
|
-
/** Index records that were unusable and skipped. */
|
|
136
|
-
readonly skipped: number;
|
|
137
|
-
}
|
|
138
|
-
/** Result of a restore. */
|
|
139
|
-
export interface RestoreResult {
|
|
140
|
-
readonly entry: RecycleBinEntry;
|
|
141
|
-
readonly restoredPath: string;
|
|
142
|
-
readonly verified: boolean;
|
|
143
|
-
}
|
|
144
|
-
/** Result of a physical delete from the bin. */
|
|
145
|
-
export interface PurgeResult {
|
|
146
|
-
readonly id: RecycleBinEntryId;
|
|
147
|
-
readonly sizeBytes: number;
|
|
148
|
-
/** Always true when the call returns; a failed delete throws instead. */
|
|
149
|
-
readonly purged: boolean;
|
|
150
|
-
readonly warning: string;
|
|
151
|
-
}
|
|
152
|
-
/** Options for `list`, `restore`, `purge`, `undo` and `redo`. */
|
|
153
|
-
export interface OperationOptions {
|
|
154
|
-
readonly signal?: AbortSignal;
|
|
155
|
-
}
|
|
156
|
-
/** Result of an undo or redo step. */
|
|
157
|
-
export interface UndoResult {
|
|
158
|
-
/** The action that was executed. */
|
|
159
|
-
readonly action: 'discard' | 'restore';
|
|
160
|
-
readonly entry: RecycleBinEntry;
|
|
161
|
-
/** Human-facing description of what happened. */
|
|
162
|
-
readonly message: string;
|
|
163
|
-
}
|
|
164
|
-
/** Retention limits for one sweep; all optional. */
|
|
165
|
-
export interface SweepOptions {
|
|
166
|
-
/** Keep at most this many entries per bin; non-positive/absent = unlimited. */
|
|
167
|
-
readonly maxEntries?: number;
|
|
168
|
-
/** Keep at most this many bytes per bin; non-positive/absent = unlimited. */
|
|
169
|
-
readonly maxBytes?: number;
|
|
170
|
-
/** Keep entries at most this old; non-positive/absent = unlimited. */
|
|
171
|
-
readonly maxAgeMs?: number;
|
|
172
|
-
readonly signal?: AbortSignal;
|
|
173
|
-
}
|
|
174
|
-
/** One entry physically removed by a sweep. */
|
|
175
|
-
export interface SweepPurge {
|
|
176
|
-
readonly rootKey: string;
|
|
177
|
-
readonly id: RecycleBinEntryId;
|
|
178
|
-
readonly sizeBytes: number;
|
|
179
|
-
readonly dimension: 'age' | 'count' | 'bytes';
|
|
180
|
-
}
|
|
181
|
-
/** One entry a sweep could not delete; the sweep continues with the rest. */
|
|
182
|
-
export interface SweepFailure {
|
|
183
|
-
readonly rootKey: string;
|
|
184
|
-
readonly id?: RecycleBinEntryId;
|
|
185
|
-
readonly message: string;
|
|
186
|
-
}
|
|
187
|
-
/** Per-root summary of a sweep. */
|
|
188
|
-
export interface SweepRootReport {
|
|
189
|
-
readonly rootKey: string;
|
|
190
|
-
readonly considered: number;
|
|
191
|
-
readonly purged: readonly RecycleBinEntryId[];
|
|
192
|
-
readonly kept: readonly RecycleBinEntryId[];
|
|
193
|
-
readonly reasons: readonly {
|
|
194
|
-
readonly id: RecycleBinEntryId;
|
|
195
|
-
readonly dimension: 'age' | 'count' | 'bytes';
|
|
196
|
-
}[];
|
|
197
|
-
}
|
|
198
|
-
/** Outcome of a sweep. */
|
|
199
|
-
export interface SweepReport {
|
|
200
|
-
readonly purged: readonly SweepPurge[];
|
|
201
|
-
readonly roots: readonly SweepRootReport[];
|
|
202
|
-
readonly failures: readonly SweepFailure[];
|
|
203
|
-
/** `false` when no dimension was limited: nothing was touched (an unconfigured 0 must not empty a bin). */
|
|
204
|
-
readonly policyApplied: boolean;
|
|
205
|
-
}
|
|
206
|
-
/** Read-only undo state, for a UI that needs to enable or disable the buttons. */
|
|
207
|
-
export interface RecycleBinHistory {
|
|
208
|
-
readonly canUndo: boolean;
|
|
209
|
-
readonly canRedo: boolean;
|
|
210
|
-
readonly undo: readonly {
|
|
211
|
-
readonly kind: string;
|
|
212
|
-
readonly id: string;
|
|
213
|
-
}[];
|
|
214
|
-
readonly redo: readonly {
|
|
215
|
-
readonly kind: string;
|
|
216
|
-
readonly id: string;
|
|
217
|
-
}[];
|
|
218
|
-
readonly dropped: number;
|
|
219
|
-
readonly undoDepth: number;
|
|
220
|
-
}
|
|
221
|
-
/** The service surface. */
|
|
222
|
-
export interface RecycleBinService {
|
|
223
|
-
/** Delete a target permanently or into the recycle bin. */
|
|
224
|
-
discard(target: RecycleBinTarget, options: DiscardOptions): Promise<DiscardResult>;
|
|
225
|
-
/** List one bin, reconciled against the directory that actually exists. */
|
|
226
|
-
list(scope: RecycleBinScope, options?: OperationOptions): Promise<RecycleBinListing>;
|
|
227
|
-
/** Restore one entry to its original path. */
|
|
228
|
-
restore(id: RecycleBinEntryId, options?: OperationOptions): Promise<RestoreResult>;
|
|
229
|
-
/** Physically delete one entry from the bin. */
|
|
230
|
-
purge(id: RecycleBinEntryId, options?: OperationOptions): Promise<PurgeResult>;
|
|
231
|
-
/** Apply retention limits to every known bin. */
|
|
232
|
-
sweep(options: SweepOptions): Promise<SweepReport>;
|
|
233
|
-
/** Undo the newest operation. */
|
|
234
|
-
undo(options?: OperationOptions): Promise<UndoResult>;
|
|
235
|
-
/** Re-apply the newest undone operation. */
|
|
236
|
-
redo(options?: OperationOptions): Promise<UndoResult>;
|
|
237
|
-
/** Current undo/redo state. */
|
|
238
|
-
history(): RecycleBinHistory;
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Build the service.
|
|
242
|
-
*
|
|
243
|
-
* @param deps - injected I/O, clock, configuration and root lookup.
|
|
244
|
-
* @returns a {@link RecycleBinService}; its undo stack is per-instance, in memory and not persisted.
|
|
245
|
-
*/
|
|
246
|
-
export declare function createRecycleBinService(deps: RecycleBinServiceDeps): RecycleBinService;
|
|
247
|
-
//# sourceMappingURL=recycle-bin-service.d.ts.map
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The connectivity probe behind the panel's 「测试」 button.
|
|
3
|
-
*
|
|
4
|
-
* What "testing a connection" means here, and why it is a real connection rather than a TCP ping:
|
|
5
|
-
*
|
|
6
|
-
* - it goes through the **same transport service** the rest of the plugin uses, so it answers the only question
|
|
7
|
-
* that matters to the user - "would a remote operation work right now" - including the transport the
|
|
8
|
-
* selector picked and whether that pick was a degradation;
|
|
9
|
-
* - the last step is an actual command round-trip (`printf`), so a host that accepts TCP but has no usable
|
|
10
|
-
* shell (or a transport that cannot execute) is reported as a failure, not as a success;
|
|
11
|
-
* - the probe **warms the connection** the caller will use next, because `acquire` is memoized per connection.
|
|
12
|
-
*
|
|
13
|
-
* Everything it needs is injected (红线 3: 外部依赖走注入), so the whole classification is testable without a
|
|
14
|
-
* server, and the entry is the only place that knows about profiles.
|
|
15
|
-
*
|
|
16
|
-
* @module dsh-over-ssh/integration/connection-test
|
|
17
|
-
*/
|
|
18
|
-
/** The slice of `Transport` the probe uses. Narrow on purpose: the probe must not be able to do more. */
|
|
19
|
-
export interface ProbeTransport {
|
|
20
|
-
readonly id: string;
|
|
21
|
-
connect(signal?: AbortSignal): Promise<void>;
|
|
22
|
-
exec(request: {
|
|
23
|
-
readonly argv: readonly string[];
|
|
24
|
-
readonly maxBytes?: number;
|
|
25
|
-
}, signal?: AbortSignal): Promise<{
|
|
26
|
-
readonly exitCode: number;
|
|
27
|
-
readonly stdout: string;
|
|
28
|
-
}>;
|
|
29
|
-
}
|
|
30
|
-
/** One acquisition: the transport plus the decision that produced it. */
|
|
31
|
-
export interface ProbeAcquisition {
|
|
32
|
-
readonly transport: ProbeTransport;
|
|
33
|
-
readonly decision: {
|
|
34
|
-
readonly kind: string;
|
|
35
|
-
readonly degradations?: readonly {
|
|
36
|
-
readonly code: string;
|
|
37
|
-
}[];
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
/** What the probe needs. */
|
|
41
|
-
export interface ConnectionProbeDeps {
|
|
42
|
-
/** Acquire (and, on first use, connect) the connection's transport. Rejects with `CONNECTION_NOT_FOUND` for an unknown id. */
|
|
43
|
-
readonly acquire: (connectionId: string) => Promise<ProbeAcquisition>;
|
|
44
|
-
/** Budget for the whole probe; each transport keeps its own timeouts on top of it. */
|
|
45
|
-
readonly timeoutMs?: number;
|
|
46
|
-
/** Clock, injected so a test can assert the reported milliseconds. */
|
|
47
|
-
readonly now?: () => number;
|
|
48
|
-
}
|
|
49
|
-
/** The wire answer: success carries the facts the row shows, failure carries a reason it can print. */
|
|
50
|
-
export type ConnectionProbeResult = {
|
|
51
|
-
readonly ok: true;
|
|
52
|
-
readonly transport: string;
|
|
53
|
-
readonly degraded: boolean;
|
|
54
|
-
readonly degradation?: string;
|
|
55
|
-
readonly ms: number;
|
|
56
|
-
} | {
|
|
57
|
-
readonly ok: false;
|
|
58
|
-
readonly code: string;
|
|
59
|
-
readonly message: string;
|
|
60
|
-
readonly ms: number;
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* Probe one connection.
|
|
64
|
-
*
|
|
65
|
-
* Never throws: a refused or broken connection is a **result** the panel prints, because a button that rejects
|
|
66
|
-
* leaves the user with nothing to read.
|
|
67
|
-
*
|
|
68
|
-
* @param connectionId - the connection to test.
|
|
69
|
-
* @param deps - the injected acquisition, clock and budget.
|
|
70
|
-
* @returns the outcome, with the elapsed milliseconds either way.
|
|
71
|
-
*/
|
|
72
|
-
export declare function probeConnection(connectionId: string, deps: ConnectionProbeDeps): Promise<ConnectionProbeResult>;
|
|
73
|
-
//# sourceMappingURL=connection-test.d.ts.map
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 宿主数据通道面:把「连接列表 + 每条连接的传输/降级」暴露成 Typert Remote 端点。
|
|
3
|
-
*
|
|
4
|
-
* 这一片只解决「宿主 → 客户端」的**只读**通道,契约见 [`doc/02-platform/remote-data-channel.md`](../../../doc/02-platform/remote-data-channel.md)。
|
|
5
|
-
* 三条设计约束:
|
|
6
|
-
*
|
|
7
|
-
* 1. **不出凭据。** 行只挑 `id/host/transport/degraded/note` 五个字段;`ConnectionProfile.auth`
|
|
8
|
-
* (`keyPath` / `credentialKey`)、`password`、`alias`、`proxyJump` 一律不进返回值——凭据只经
|
|
9
|
-
* `ctx.credentials` 在真正建连时解析。
|
|
10
|
-
* 2. **降级必须可见。** 传输决策与 Tier 2 回退原因都变成一行里的 `degraded` + `note`,用户看到的是
|
|
11
|
-
* 「为什么慢」,而不是一个沉默的默认值。
|
|
12
|
-
* 3. **没有代码生成也不伪造严格契约。** 0.2.0-rc.2 里 `@Remote` 装饰器写下的是一份版本化原型描述符;
|
|
13
|
-
* 本仓库的**测试链路**(`node --test` + Node 24 原生类型剥离)不接受装饰器语法,而红线 1 要求每个源
|
|
14
|
-
* 文件都有测试,所以这里用 {@link markRemoteMethod} 等价地写下同一份描述符。宿主网关据此走 SRC 兜底
|
|
15
|
-
* 路径(`packages/api/gateway/src/index.ts:756-794`),**不需要** `lib/typert.host.js`。
|
|
16
|
-
* 代价写清楚了:SRC 描述符的 codec 是 `src-json`,因此只能承载**零入参**方法;带参数的端点必须
|
|
17
|
-
* 由 Typert 生成器产出严格描述符,本仓库目前产不出来。
|
|
18
|
-
*
|
|
19
|
-
* @module dsh-over-ssh/integration/remote-face
|
|
20
|
-
*/
|
|
21
|
-
import { Service, type Context } from '@deepseek-ai/cordis';
|
|
22
|
-
import { type TypertGatewayBinding } from '@deepseek-ai/dsh-typert-protocol';
|
|
23
|
-
import type { TransportDecision } from '../../app/transport/transport-selector.ts';
|
|
24
|
-
import type { ConnectionProfile, TransportKind } from '../../domain/roots/connection.ts';
|
|
25
|
-
import type { AgentPreflightOutcome } from '../agent/agent-preflight.ts';
|
|
26
|
-
/**
|
|
27
|
-
* 线命名空间。**客户端半有一份同样的常量拷贝**(`src/client/remote.ts`):客户端半与宿主半分属两个
|
|
28
|
-
* tsconfig,不能互相 import,所以这一对常量是手工同步的契约,改一处必须改另一处。
|
|
29
|
-
*/
|
|
30
|
-
export declare const SSH_DEV_REMOTE_NAMESPACE = "sshdev";
|
|
31
|
-
/** 承载本面的 Cordis 服务键;调用方(插件入口)必须原样注册这个名字。 */
|
|
32
|
-
export declare const SSH_DEV_REMOTE_SERVICE = "sshDevRemote";
|
|
33
|
-
/** 端点方法名(`sshdev/connections`)。 */
|
|
34
|
-
export declare const SSH_DEV_REMOTE_CONNECTIONS_METHOD = "connections";
|
|
35
|
-
/** 一条连接在设置页里要显示的东西。**没有凭据字段,也不要加。** */
|
|
36
|
-
export interface ConnectionStatusRow {
|
|
37
|
-
/** 连接 id(profile 主键)。 */
|
|
38
|
-
readonly id: string;
|
|
39
|
-
/** 主机名(`ConnectionProfile.host`,不是别名,也不是密钥路径)。 */
|
|
40
|
-
readonly host: string;
|
|
41
|
-
/** 当前生效的传输;尚未建立过连接时为 `unknown`(选择器只在建连时决策一次)。 */
|
|
42
|
-
readonly transport: TransportKind | 'unknown';
|
|
43
|
-
/** 是否有降级(传输替换 / Tier 2 回退)。 */
|
|
44
|
-
readonly degraded: boolean;
|
|
45
|
-
/** 一句给人看的原因:优先降级原因,其次决策说明,最后是「还没连过」。 */
|
|
46
|
-
readonly note: string;
|
|
47
|
-
}
|
|
48
|
-
/** 构建行所需的三个只读事实源;全部注入,所以这个模块可以离线测。 */
|
|
49
|
-
export interface ConnectionStatusSource {
|
|
50
|
-
/** 当前配置里的全部连接。 */
|
|
51
|
-
readonly profiles: () => readonly ConnectionProfile[];
|
|
52
|
-
/** 该连接**当前生效**的传输决策;从未建连(或已释放)时返回 `undefined`。 */
|
|
53
|
-
readonly decisionFor: (connectionId: string) => TransportDecision | undefined;
|
|
54
|
-
/** Tier 2 安装梯子对这条连接的结果,跑过才有。 */
|
|
55
|
-
readonly agentOutcomeFor: (connectionId: string) => AgentPreflightOutcome | undefined;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* 把三个事实源折叠成面板要显示的行(纯函数)。
|
|
59
|
-
*
|
|
60
|
-
* @param source - 连接、决策、Tier 2 结果三个读取器。
|
|
61
|
-
* @returns 每个连接一行,顺序与 `profiles()` 一致。
|
|
62
|
-
*/
|
|
63
|
-
export declare function buildConnectionStatusRows(source: ConnectionStatusSource): readonly ConnectionStatusRow[];
|
|
64
|
-
/**
|
|
65
|
-
* 在一个类的 prototype 上登记一个直接调用的 Remote 方法——`@Remote` 装饰器的**可擦除等价物**。
|
|
66
|
-
*
|
|
67
|
-
* 为什么不用装饰器(两条实测事实):
|
|
68
|
-
*
|
|
69
|
-
* - `tsc` 本身**不**拒绝它:用本仓库 `tsconfig.json` 的真实选项(含 `erasableSyntaxOnly: true`)编译一个
|
|
70
|
-
* 带标准装饰器的类,语法/语义错误为 0 条;
|
|
71
|
-
* - **测试链路拒绝它**:Node 24 的原生类型剥离直接报 `SyntaxError`(`node --input-type=module-typescript`
|
|
72
|
-
* 试过),而测试运行器就是 `node --test`。红线 1 要求每个源文件都有测试,含装饰器的模块因此无法被任何
|
|
73
|
-
* 测试导入。
|
|
74
|
-
*
|
|
75
|
-
* 这个函数写下的字节与装饰器相同(`version: 1` 描述符,见协议运行时 `lib/index.js:248-268`),并且由
|
|
76
|
-
* `tests/remote-face.test.ts` 用真的 `remoteMethods()` 读回来验证——协议包若改了这个属性名,测试先红。
|
|
77
|
-
*
|
|
78
|
-
* @param prototype - 目标类的 `prototype`。
|
|
79
|
-
* @param method - 公开实例方法名(必须真的存在于该 prototype 上)。
|
|
80
|
-
*/
|
|
81
|
-
export declare function markRemoteMethod(prototype: object, method: string): void;
|
|
82
|
-
/**
|
|
83
|
-
* 数据通道的宿主面。
|
|
84
|
-
*
|
|
85
|
-
* 方法必须写在类里(原型方法),不能是箭头函数字段:宿主网关的 SRC 路径用
|
|
86
|
-
* `Function.prototype.toString()` 解析参数名(`packages/api/gateway/src/index.ts:1434-1468`),
|
|
87
|
-
* 原型上的普通方法才有稳定的 `()` 参数表。
|
|
88
|
-
*/
|
|
89
|
-
export declare class SshDevRemoteFace extends Service {
|
|
90
|
-
#private;
|
|
91
|
-
/** 网关按这个可见绑定把端点认到本服务上(`readBinding`,同文件 1387-1427)。 */
|
|
92
|
-
readonly typertRemote: TypertGatewayBinding<this>;
|
|
93
|
-
/**
|
|
94
|
-
* 注册服务并绑定线命名空间。
|
|
95
|
-
*
|
|
96
|
-
* @param ctx - 宿主插件上下文(必须已提供 `sshDevConnections` / `sshDevTransports` / `sshDevAgent`)。
|
|
97
|
-
* @param source - 三个只读事实源。
|
|
98
|
-
*/
|
|
99
|
-
constructor(ctx: Context, source: ConnectionStatusSource);
|
|
100
|
-
/**
|
|
101
|
-
* 全部连接及其当前传输状态。
|
|
102
|
-
*
|
|
103
|
-
* **零入参是刻意的**:SRC 描述符的入参 codec 是 `src-json`,客户端 Remote 挂载时会因为
|
|
104
|
-
* 「has no strict codec」拒绝带参数的 SRC 描述符(`packages/api/gateway/src/client/index.ts:790-805`),
|
|
105
|
-
* 而零入参的方法不触发那条检查(同文件 449-451 只对 `result.decode` 做严格解码)。
|
|
106
|
-
*
|
|
107
|
-
* @returns 每个连接一行;返回值里没有任何凭据字段。
|
|
108
|
-
*/
|
|
109
|
-
connections(): Promise<readonly ConnectionStatusRow[]>;
|
|
110
|
-
}
|
|
111
|
-
declare module '@deepseek-ai/cordis' {
|
|
112
|
-
interface Context {
|
|
113
|
-
/** 数据通道的宿主面,由 {@link installRemoteFace} 注册(网关按服务键反射调用)。 */
|
|
114
|
-
sshDevRemote: SshDevRemoteFace;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* 安装宿主面:从插件自己提供的三个服务上取事实源。
|
|
119
|
-
*
|
|
120
|
-
* 用 `ctx.get(name)`(宽松读取)而不是 `ctx.<service>`:即使某个服务没挂上,通道也只是少一行数据,
|
|
121
|
-
* 不该让插件在激活期直接抛错。
|
|
122
|
-
*
|
|
123
|
-
* @param ctx - 宿主插件上下文。
|
|
124
|
-
* @returns 已注册的服务实例(调用方通常不需要它)。
|
|
125
|
-
*/
|
|
126
|
-
export declare function installRemoteFace(ctx: Context): SshDevRemoteFace;
|
|
127
|
-
//# sourceMappingURL=remote-face.d.ts.map
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `remote_grep` / `remote_glob` / `remote_exec` backend.
|
|
3
|
-
*
|
|
4
|
-
* Extracted from the plugin entry for two reasons: the entry was growing a second responsibility, and the
|
|
5
|
-
* Tier 2/Tier 1 decision below could not be exercised by any test while it lived inline (the tools'
|
|
6
|
-
* end-to-end verification needs to build exactly this object against a real host).
|
|
7
|
-
*
|
|
8
|
-
* Two decisions worth naming:
|
|
9
|
-
*
|
|
10
|
-
* - **Structural capability checks, not `instanceof`.** The agent path is chosen by asking the transport what
|
|
11
|
-
* it can do (`agentCapabilities.grep` + a `searchGrep` method), so a wrapper or a future transport that
|
|
12
|
-
* speaks the same protocol still gets Tier 2 — and a test can supply one.
|
|
13
|
-
* - **Tier 2 first, Tier 1 always available.** The agent measured ~0.16 ms/file for scans against ~635 ms per
|
|
14
|
-
* per-file round trip (审计 0009), so search prefers it; when it is absent or fails to answer the shell
|
|
15
|
-
* path takes over. Failing over is reported through `strategy`, never hidden.
|
|
16
|
-
*
|
|
17
|
-
* @module dsh-over-ssh/integration/remote-tool-backend
|
|
18
|
-
*/
|
|
19
|
-
import type { Transport } from '../../infra/transport/transport.ts';
|
|
20
|
-
import type { RemoteToolBackend } from '../tools/remote-tools.ts';
|
|
21
|
-
import type { SessionRootOutcome } from '../../domain/roots/session-roots.ts';
|
|
22
|
-
/** One search hit as the agent transport reports it (only the fields this module reads). */
|
|
23
|
-
export interface AgentSearchHit {
|
|
24
|
-
readonly path: string;
|
|
25
|
-
readonly line: number;
|
|
26
|
-
readonly text: string;
|
|
27
|
-
}
|
|
28
|
-
/** The agent search result shape this module consumes. */
|
|
29
|
-
export interface AgentSearchOutcome {
|
|
30
|
-
readonly matches: readonly AgentSearchHit[];
|
|
31
|
-
readonly strategy: string;
|
|
32
|
-
readonly truncated: boolean;
|
|
33
|
-
/** Which bounds stopped the scan (agent `truncatedReasons`); empty when the agent did not say. */
|
|
34
|
-
readonly truncatedReasons?: readonly string[] | undefined;
|
|
35
|
-
/** Candidate files the `include` filters removed; `undefined` when the agent did not say. */
|
|
36
|
-
readonly filesFiltered?: number | undefined;
|
|
37
|
-
}
|
|
38
|
-
/** The slice of an agent-capable transport the backend uses. */
|
|
39
|
-
export interface AgentSearchCapable {
|
|
40
|
-
readonly agentCapabilities: {
|
|
41
|
-
readonly grep?: boolean;
|
|
42
|
-
};
|
|
43
|
-
searchGrep(request: {
|
|
44
|
-
readonly paths: readonly string[];
|
|
45
|
-
readonly query: string;
|
|
46
|
-
readonly literal?: boolean;
|
|
47
|
-
/** Case-insensitive matching; the agent's own default is `true`. */
|
|
48
|
-
readonly ignoreCase?: boolean;
|
|
49
|
-
/** Drop VCS ignore rules and the agent's built-in noise directories (audit 0064 P3). */
|
|
50
|
-
readonly noIgnore?: boolean;
|
|
51
|
-
readonly maxResults?: number;
|
|
52
|
-
/** Filename patterns to keep, e.g. `*.cpp` (audit 0052 P10). */
|
|
53
|
-
readonly include?: readonly string[];
|
|
54
|
-
}, signal?: AbortSignal): Promise<AgentSearchOutcome>;
|
|
55
|
-
}
|
|
56
|
-
/** What the backend needs from its owner. All injected, so it is testable without a real host. */
|
|
57
|
-
export interface RemoteToolBackendDeps {
|
|
58
|
-
/**
|
|
59
|
-
* Resolve a caller's working directory to a remote root.
|
|
60
|
-
*
|
|
61
|
-
* @param cwd - the agent's session cwd.
|
|
62
|
-
* @returns the target, or `undefined` when no remote root contains it.
|
|
63
|
-
*/
|
|
64
|
-
readonly resolveRoot: (cwd: string) => {
|
|
65
|
-
readonly connectionId: string;
|
|
66
|
-
readonly root: string;
|
|
67
|
-
} | undefined;
|
|
68
|
-
/**
|
|
69
|
-
* The remote directories **this session** added with 「添加目录」, used when `resolveRoot` finds none.
|
|
70
|
-
*
|
|
71
|
-
* Optional: a composition that does not track session-scoped roots keeps the pre-existing behaviour
|
|
72
|
-
* (a cwd outside every remote root is an error). The rule lives in `domain/roots/session-roots.ts`.
|
|
73
|
-
*
|
|
74
|
-
* @param cwd - the agent's session cwd, which is the workspace identity the add action wrote.
|
|
75
|
-
* @returns the single added remote root, a refusal naming several, or `none`.
|
|
76
|
-
*/
|
|
77
|
-
readonly resolveSessionRoot?: ((cwd: string, sessionId?: string) => SessionRootOutcome) | undefined;
|
|
78
|
-
/**
|
|
79
|
-
* Acquire the connection's transport.
|
|
80
|
-
*
|
|
81
|
-
* @param connectionId - configured connection id.
|
|
82
|
-
* @returns the transport (the caller owns its lifetime).
|
|
83
|
-
*/
|
|
84
|
-
readonly acquire: (connectionId: string) => Promise<Transport>;
|
|
85
|
-
/**
|
|
86
|
-
* Enumerate a remote root (the shared index).
|
|
87
|
-
*
|
|
88
|
-
* @param connectionId - connection owning the root.
|
|
89
|
-
* @param root - backend-absolute root path.
|
|
90
|
-
* @param signal - caller cancellation.
|
|
91
|
-
* @returns enumerated paths, whether a cap was hit, and which strategy answered.
|
|
92
|
-
*/
|
|
93
|
-
readonly enumerate: (connectionId: string, root: string, signal?: AbortSignal) => Promise<{
|
|
94
|
-
readonly paths: readonly string[];
|
|
95
|
-
readonly truncated: boolean;
|
|
96
|
-
readonly source: string;
|
|
97
|
-
}>;
|
|
98
|
-
}
|
|
99
|
-
/** Whether a transport can answer agent-side searches. */
|
|
100
|
-
export declare function isAgentSearchCapable(transport: unknown): transport is AgentSearchCapable;
|
|
101
|
-
/**
|
|
102
|
-
* Build the tool backend the entry registers.
|
|
103
|
-
*
|
|
104
|
-
* @param deps - injected host wiring.
|
|
105
|
-
* @returns the backend consumed by {@link registerRemoteTools}.
|
|
106
|
-
*/
|
|
107
|
-
export declare function createRemoteToolBackend(deps: RemoteToolBackendDeps): RemoteToolBackend;
|
|
108
|
-
//# sourceMappingURL=remote-tool-backend.d.ts.map
|