@modesto_ma/dsh-channels 0.3.0 → 0.5.0-beta.1
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 +123 -53
- package/docs/access-control-design.md +7 -5
- package/docs/attachment-pipeline-v2.md +310 -0
- package/docs/feasibility-and-design.md +1 -1
- package/docs/feishu-onboarding.md +127 -21
- package/docs/persistence.md +6 -4
- package/docs/refactor-plan.md +2 -2
- package/docs/workspace-isolation-design.md +13 -11
- package/lib/client.js +179 -288
- package/lib/client.js.map +1 -1
- package/lib/index.js +12125 -6382
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/access/cards.ts +9 -9
- package/src/access/controller.ts +10 -10
- package/src/access/index.ts +1 -0
- package/src/access/policy.ts +10 -10
- package/src/access/requests.ts +32 -31
- package/src/access/store.ts +12 -12
- package/src/access/targets.ts +56 -0
- package/src/cards/approval.ts +96 -26
- package/src/cards/index.ts +1 -0
- package/src/cards/onboarding.ts +1 -0
- package/src/cards/picker.ts +115 -0
- package/src/cards/streaming.ts +56 -7
- package/src/client/api.ts +5 -25
- package/src/client/panel/access-card.tsx +24 -15
- package/src/client/panel/access-tab.tsx +3 -3
- package/src/client/panel/connection-tab.tsx +70 -1
- package/src/client/panel/index.tsx +11 -62
- package/src/client/panel/shared.tsx +0 -23
- package/src/client/panel/workspace-tab.tsx +2 -18
- package/src/client/styles.ts +2 -0
- package/src/commands/registry.ts +2 -2
- package/src/config.ts +190 -32
- package/src/domain.ts +28 -18
- package/src/feishu/agent-context.ts +65 -19
- package/src/feishu/inbound-attachments.ts +440 -3
- package/src/feishu/manifest.ts +247 -0
- package/src/feishu/message-read.ts +1330 -0
- package/src/feishu/native-attachments.ts +998 -0
- package/src/feishu/scopes.ts +171 -0
- package/src/feishu/send-file.ts +543 -0
- package/src/feishu/slash-commands.ts +134 -0
- package/src/feishu/tools.ts +2305 -0
- package/src/feishu-channel.ts +322 -6
- package/src/host/agent.ts +55 -0
- package/src/host/attachments.ts +210 -0
- package/src/host/index.ts +1 -0
- package/src/index.ts +5 -4
- package/src/interactions/approvals.ts +187 -7
- package/src/interactions/pending.ts +3 -3
- package/src/routing/inbound.ts +620 -49
- package/src/service.ts +808 -375
- package/src/session/manager.ts +67 -13
- package/src/session/routes.ts +2 -3
- package/src/settings/contract.ts +90 -89
- package/src/settings/overlay.ts +124 -13
- package/src/settings/routes.ts +3 -17
- package/src/settings/surface.ts +156 -82
- package/src/streamer.ts +94 -5
- package/src/workspaces.ts +39 -26
- package/src/cleanup.ts +0 -535
- package/src/client/panel/cleanup-card.tsx +0 -106
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 目录清理卡:展示清理预览(保留期 / 自动清理 / 候选数量与空间),
|
|
3
|
-
* 执行前二次确认,结果与部分失败逐条展示。`cleanup.error` 非空时
|
|
4
|
-
* (例如未连接、无法扫描工作区)按钮天然禁用并显示原因。
|
|
5
|
-
*
|
|
6
|
-
* @module dsh-channels/client/panel/cleanup-card
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { PANEL_COPY } from '../../settings/contract.ts'
|
|
10
|
-
import type { CleanupPreviewWire, CleanupRunWire, PanelWire } from '../../settings/contract.ts'
|
|
11
|
-
import { formatBytes, retentionLabel } from './shared.tsx'
|
|
12
|
-
import type { BusyAction } from './shared.tsx'
|
|
13
|
-
|
|
14
|
-
export function CleanupCard(props: {
|
|
15
|
-
panel: PanelWire
|
|
16
|
-
cleanup: CleanupPreviewWire
|
|
17
|
-
busy: BusyAction | null
|
|
18
|
-
locked: boolean
|
|
19
|
-
result: CleanupRunWire | null
|
|
20
|
-
error: string | null
|
|
21
|
-
onRun: () => void
|
|
22
|
-
}): JSX.Element {
|
|
23
|
-
const { panel, cleanup, busy, locked, result, error, onRun } = props
|
|
24
|
-
const autoText = cleanup.retention === 'off'
|
|
25
|
-
? PANEL_COPY.cleanupAutoInactive
|
|
26
|
-
: cleanup.auto ? PANEL_COPY.cleanupAutoOn : PANEL_COPY.cleanupAutoOff
|
|
27
|
-
const blocked = cleanup.error !== undefined
|
|
28
|
-
? `${PANEL_COPY.cleanupPreviewFailed}:${cleanup.error}`
|
|
29
|
-
: cleanup.retention === 'off'
|
|
30
|
-
? PANEL_COPY.cleanupDisabledOff
|
|
31
|
-
: cleanup.candidates === 0
|
|
32
|
-
? PANEL_COPY.cleanupDisabledEmpty
|
|
33
|
-
: null
|
|
34
|
-
const facts = [
|
|
35
|
-
{ label: PANEL_COPY.cleanupRetention, value: retentionLabel(panel, cleanup) },
|
|
36
|
-
{ label: PANEL_COPY.cleanupAutoLabel, value: autoText },
|
|
37
|
-
{ label: PANEL_COPY.cleanupCandidates, value: `${cleanup.candidates} 个` },
|
|
38
|
-
{ label: PANEL_COPY.cleanupWorkspaces, value: `${cleanup.workspaces} 个` },
|
|
39
|
-
{ label: PANEL_COPY.cleanupCandidateBytes, value: formatBytes(cleanup.candidateBytes) },
|
|
40
|
-
]
|
|
41
|
-
const running = busy === 'cleanup'
|
|
42
|
-
const failed = result !== null && (!result.ok || error !== null)
|
|
43
|
-
return (
|
|
44
|
-
<section className="dsh-channels-cfg__card">
|
|
45
|
-
<div className="dsh-channels-cfg__cardHead">
|
|
46
|
-
<span className="dsh-channels-cfg__cardTitle">{PANEL_COPY.cleanupCard}</span>
|
|
47
|
-
<span className="dsh-channels-cfg__cardMeta">{retentionLabel(panel, cleanup)}</span>
|
|
48
|
-
</div>
|
|
49
|
-
<span className="dsh-channels-cfg__help">{PANEL_COPY.cleanupCardHelp}</span>
|
|
50
|
-
<div className="dsh-channels-cfg__facts">
|
|
51
|
-
{facts.map(fact => (
|
|
52
|
-
<div className="dsh-channels-cfg__fact" key={fact.label}>
|
|
53
|
-
<span className="dsh-channels-cfg__factLabel">{fact.label}</span>
|
|
54
|
-
<span className="dsh-channels-cfg__factValue">{fact.value}</span>
|
|
55
|
-
</div>
|
|
56
|
-
))}
|
|
57
|
-
</div>
|
|
58
|
-
{blocked === null ? null : <span className="dsh-channels-cfg__help">{blocked}</span>}
|
|
59
|
-
{result === null
|
|
60
|
-
? null
|
|
61
|
-
: (
|
|
62
|
-
<div className={`dsh-channels-cfg__notice dsh-channels-cfg__notice--${failed ? 'error' : 'ok'}`}>
|
|
63
|
-
{result.ok
|
|
64
|
-
? (
|
|
65
|
-
<span>
|
|
66
|
-
{PANEL_COPY.cleanupDone}:{PANEL_COPY.cleanupDeleted} {result.deletedWorkspaces} 个,
|
|
67
|
-
{PANEL_COPY.cleanupDeletedDirs} {result.deletedSessionDirs} 个,
|
|
68
|
-
{PANEL_COPY.cleanupRetired} {result.retiredRoutes} 条,
|
|
69
|
-
{PANEL_COPY.cleanupFreed} {formatBytes(result.freedBytes)}。
|
|
70
|
-
</span>
|
|
71
|
-
)
|
|
72
|
-
: (
|
|
73
|
-
<span>
|
|
74
|
-
{PANEL_COPY.cleanupFailed}
|
|
75
|
-
{result.error === undefined ? '' : `:${result.error}`}
|
|
76
|
-
</span>
|
|
77
|
-
)}
|
|
78
|
-
{result.failures.length === 0
|
|
79
|
-
? null
|
|
80
|
-
: (
|
|
81
|
-
<>
|
|
82
|
-
<span>{PANEL_COPY.cleanupFailures}</span>
|
|
83
|
-
<ul className="dsh-channels-cfg__issues">
|
|
84
|
-
{result.failures.map((failure, index) => (
|
|
85
|
-
<li key={`${index}-${failure}`} className="dsh-channels-cfg__mono">{failure}</li>
|
|
86
|
-
))}
|
|
87
|
-
</ul>
|
|
88
|
-
</>
|
|
89
|
-
)}
|
|
90
|
-
</div>
|
|
91
|
-
)}
|
|
92
|
-
{error === null ? null : <span className="dsh-channels-cfg__fieldError">{error}</span>}
|
|
93
|
-
<div className="dsh-channels-cfg__actions">
|
|
94
|
-
<button
|
|
95
|
-
type="button"
|
|
96
|
-
className="dsh-channels-cfg__btn dsh-channels-cfg__btn--danger"
|
|
97
|
-
onClick={onRun}
|
|
98
|
-
disabled={running || busy !== null || locked || blocked !== null}
|
|
99
|
-
>
|
|
100
|
-
{running ? PANEL_COPY.cleanupRunning : PANEL_COPY.cleanupNow}
|
|
101
|
-
</button>
|
|
102
|
-
<span className="dsh-channels-cfg__help">{PANEL_COPY.cleanupConfirmHint}</span>
|
|
103
|
-
</div>
|
|
104
|
-
</section>
|
|
105
|
-
)
|
|
106
|
-
}
|