@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.
Files changed (64) hide show
  1. package/README.md +123 -53
  2. package/docs/access-control-design.md +7 -5
  3. package/docs/attachment-pipeline-v2.md +310 -0
  4. package/docs/feasibility-and-design.md +1 -1
  5. package/docs/feishu-onboarding.md +127 -21
  6. package/docs/persistence.md +6 -4
  7. package/docs/refactor-plan.md +2 -2
  8. package/docs/workspace-isolation-design.md +13 -11
  9. package/lib/client.js +179 -288
  10. package/lib/client.js.map +1 -1
  11. package/lib/index.js +12125 -6382
  12. package/lib/index.js.map +1 -1
  13. package/package.json +1 -1
  14. package/src/access/cards.ts +9 -9
  15. package/src/access/controller.ts +10 -10
  16. package/src/access/index.ts +1 -0
  17. package/src/access/policy.ts +10 -10
  18. package/src/access/requests.ts +32 -31
  19. package/src/access/store.ts +12 -12
  20. package/src/access/targets.ts +56 -0
  21. package/src/cards/approval.ts +96 -26
  22. package/src/cards/index.ts +1 -0
  23. package/src/cards/onboarding.ts +1 -0
  24. package/src/cards/picker.ts +115 -0
  25. package/src/cards/streaming.ts +56 -7
  26. package/src/client/api.ts +5 -25
  27. package/src/client/panel/access-card.tsx +24 -15
  28. package/src/client/panel/access-tab.tsx +3 -3
  29. package/src/client/panel/connection-tab.tsx +70 -1
  30. package/src/client/panel/index.tsx +11 -62
  31. package/src/client/panel/shared.tsx +0 -23
  32. package/src/client/panel/workspace-tab.tsx +2 -18
  33. package/src/client/styles.ts +2 -0
  34. package/src/commands/registry.ts +2 -2
  35. package/src/config.ts +190 -32
  36. package/src/domain.ts +28 -18
  37. package/src/feishu/agent-context.ts +65 -19
  38. package/src/feishu/inbound-attachments.ts +440 -3
  39. package/src/feishu/manifest.ts +247 -0
  40. package/src/feishu/message-read.ts +1330 -0
  41. package/src/feishu/native-attachments.ts +998 -0
  42. package/src/feishu/scopes.ts +171 -0
  43. package/src/feishu/send-file.ts +543 -0
  44. package/src/feishu/slash-commands.ts +134 -0
  45. package/src/feishu/tools.ts +2305 -0
  46. package/src/feishu-channel.ts +322 -6
  47. package/src/host/agent.ts +55 -0
  48. package/src/host/attachments.ts +210 -0
  49. package/src/host/index.ts +1 -0
  50. package/src/index.ts +5 -4
  51. package/src/interactions/approvals.ts +187 -7
  52. package/src/interactions/pending.ts +3 -3
  53. package/src/routing/inbound.ts +620 -49
  54. package/src/service.ts +808 -375
  55. package/src/session/manager.ts +67 -13
  56. package/src/session/routes.ts +2 -3
  57. package/src/settings/contract.ts +90 -89
  58. package/src/settings/overlay.ts +124 -13
  59. package/src/settings/routes.ts +3 -17
  60. package/src/settings/surface.ts +156 -82
  61. package/src/streamer.ts +94 -5
  62. package/src/workspaces.ts +39 -26
  63. package/src/cleanup.ts +0 -535
  64. 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
- }