@dsh-workbench/core 0.3.3 → 0.3.5

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 (71) hide show
  1. package/client.js +1749 -114
  2. package/cordis.patch.yml +32 -0
  3. package/dist/client/client.body.js +1749 -114
  4. package/dist/client/index.js +1749 -114
  5. package/dist/host/index.js +3101 -1156
  6. package/dist/types/app/client.d.ts +306 -60
  7. package/dist/types/app/layouts/approval-detail.d.ts +13 -0
  8. package/dist/types/app/layouts/sidebar/RecordFooterAction.d.ts +16 -0
  9. package/dist/types/app/layouts/sidebar/record-footer.d.ts +4 -0
  10. package/dist/types/modules/panels/client.d.ts +1 -0
  11. package/dist/types/modules/panels/model/diy-components.d.ts +3 -0
  12. package/dist/types/modules/panels/model/diy-components.test.d.ts +1 -0
  13. package/dist/types/modules/panels/model/diy-context.d.ts +4 -5
  14. package/dist/types/modules/panels/model/diy-observers.d.ts +2 -2
  15. package/dist/types/modules/panels/model/diy-page.d.ts +1 -1
  16. package/dist/types/modules/panels/model/diy-record-bar.test.d.ts +1 -0
  17. package/dist/types/modules/panels/model/diy-record-capture.d.ts +27 -0
  18. package/dist/types/modules/panels/model/diy-record-capture.test.d.ts +1 -0
  19. package/dist/types/modules/panels/model/diy-record-failure.test.d.ts +1 -0
  20. package/dist/types/modules/panels/model/diy-record-routes.d.ts +2 -0
  21. package/dist/types/modules/panels/model/diy-record-routes.test.d.ts +1 -0
  22. package/dist/types/modules/panels/model/diy-record-scripts.d.ts +6 -0
  23. package/dist/types/modules/panels/model/diy-record-text.d.ts +89 -0
  24. package/dist/types/modules/panels/model/diy-record-text.test.d.ts +1 -0
  25. package/dist/types/modules/panels/model/diy-record-tools.d.ts +2 -0
  26. package/dist/types/modules/panels/model/diy-record.d.ts +76 -0
  27. package/dist/types/modules/panels/model/diy-record.test.d.ts +1 -0
  28. package/dist/types/modules/panels/model/handoff.d.ts +1 -0
  29. package/dist/types/modules/panels/unit.d.ts +10 -5
  30. package/dist/types/shared/api/context-chips.d.ts +20 -0
  31. package/dist/types/shared/api/host/diy-acts.d.ts +4 -0
  32. package/dist/types/shared/api/host/diy-components.d.ts +65 -0
  33. package/dist/types/shared/api/host/diy-debug-act.d.ts +24 -7
  34. package/dist/types/shared/api/host/diy-record-act.d.ts +19 -0
  35. package/dist/types/shared/api/host/diy-workshop.d.ts +1 -3
  36. package/dist/types/shared/api/host/mount-units.d.ts +4 -0
  37. package/dist/types/shared/api/host/preset-scope.d.ts +16 -0
  38. package/dist/types/shared/api/host/tool-scope.d.ts +6 -2
  39. package/dist/types/shared/api/host/workshop-root.d.ts +7 -0
  40. package/dist/types/shared/components/BlockerState.d.ts +12 -0
  41. package/dist/types/shared/components/PanelFoot.d.ts +9 -0
  42. package/dist/types/shared/components/Tip.d.ts +8 -0
  43. package/dist/types/shared/hooks/bundle-queries.d.ts +12 -0
  44. package/dist/types/shared/hooks/fact-transports.d.ts +4 -0
  45. package/dist/types/shared/hooks/panel-state-report.d.ts +12 -0
  46. package/dist/types/shared/hooks/use-api-resource.d.ts +22 -0
  47. package/dist/types/shared/hooks/use-blocker-actions.d.ts +8 -0
  48. package/dist/types/shared/hooks/use-capabilities.d.ts +55 -0
  49. package/dist/types/shared/hooks/use-capability-gate.d.ts +16 -0
  50. package/dist/types/shared/hooks/use-card-summary.d.ts +7 -0
  51. package/dist/types/shared/hooks/use-diy-debug.d.ts +13 -0
  52. package/dist/types/shared/hooks/use-diy-record.d.ts +21 -0
  53. package/dist/types/shared/hooks/use-facts.d.ts +10 -0
  54. package/dist/types/shared/hooks/use-host-write.d.ts +12 -0
  55. package/dist/types/shared/hooks/use-long-task.d.ts +8 -0
  56. package/dist/types/shared/hooks/use-unit-board.d.ts +17 -0
  57. package/dist/types/shared/hooks/use-visible-busy.d.ts +17 -0
  58. package/package.json +2 -2
  59. package/scripts/seed-workshop.sh +42 -2
  60. package/skills/workbench-module-diy/BUILD.md +4 -3
  61. package/skills/workbench-module-diy/DATASOURCE.md +2 -2
  62. package/skills/workbench-module-diy/DESIGN.md +26 -1
  63. package/skills/workbench-module-diy/FAMILY.md +56 -0
  64. package/skills/workbench-module-diy/KIT.md +111 -96
  65. package/skills/workbench-module-diy/PANEL.md +24 -13
  66. package/skills/workbench-module-diy/REVIEW.md +9 -8
  67. package/skills/workbench-module-diy/SKILL.md +16 -6
  68. package/skills/workbench-module-diy/TOOLING.md +5 -2
  69. package/skills/workbench-module-diy/TOOLS.md +7 -41
  70. package/skills/workbench-module-diy/WIRING.md +14 -6
  71. package/skills/workbench-module-diy/WRITES.md +47 -6
@@ -0,0 +1,13 @@
1
+ import type { ApprovalInput, ReactNode, Translate } from '@dsh-workbench/shared';
2
+ export interface ApprovalRow {
3
+ readonly label: string;
4
+ readonly value: string;
5
+ }
6
+ export declare function recordApprovalRows(args: Readonly<Record<string, unknown>>, t: Translate): readonly ApprovalRow[];
7
+ export interface ApprovalPlanView {
8
+ readonly rows: readonly ApprovalRow[];
9
+ readonly warn?: string | undefined;
10
+ }
11
+ export declare function shellClaimsApprovalDetail(tool: string): boolean;
12
+ export declare function shellApprovalPlan(input: ApprovalInput, t: Translate): ApprovalPlanView | undefined;
13
+ export declare function shellApprovalDetail(input: ApprovalInput, t: Translate): ReactNode;
@@ -0,0 +1,16 @@
1
+ import type { RecordIntent, RecordState, Translate } from '@dsh-workbench/shared';
2
+ export interface RecordFooterActionProps {
3
+ readonly wide?: boolean | undefined;
4
+ readonly t: Translate;
5
+ }
6
+ export interface RecordActView {
7
+ readonly intent: RecordIntent;
8
+ readonly label: string;
9
+ }
10
+ export interface RecordFooterView {
11
+ readonly label: string;
12
+ readonly note: string;
13
+ readonly acts: readonly RecordActView[];
14
+ }
15
+ export declare function recordFooterView(state: RecordState, t: Translate): RecordFooterView;
16
+ export declare function RecordFooterAction({ wide, t }: RecordFooterActionProps): JSX.Element | null;
@@ -0,0 +1,4 @@
1
+ import type { DshClientContext } from '@dsh-workbench/shared';
2
+ export declare const RECORD_FOOTER_ID = "workbench-record";
3
+ export declare const RECORD_FOOTER_ORDER = 11;
4
+ export declare function registerRecordFooter(ctx: DshClientContext): void;
@@ -0,0 +1 @@
1
+ export { ALL_TOOLS, DIY_RECORD_PREPARE_TOOL, DIY_RECORD_READ_TOOL } from './unit';
@@ -0,0 +1,3 @@
1
+ import type { DshHostContext, DshToolDefinition, DshToolRegistry } from '@dsh-workbench/shared';
2
+ export declare function componentsTool(ctx: DshHostContext): DshToolDefinition;
3
+ export declare function registerComponentsTool(ctx: DshHostContext, tools: DshToolRegistry): readonly (() => void)[];
@@ -1,5 +1,4 @@
1
1
  import type { DshHostContext, DshToolRunContext } from '@dsh-workbench/shared';
2
- import { type BrowserFindResult, type BrowserReadResult } from '@dsh-workbench/shared/host';
3
2
  import type { BundleChange } from '../../../shared/api/bundle-install';
4
3
  import type { PanelsService } from './service';
5
4
  export declare const OUTPUT_SCHEMA: {
@@ -85,18 +84,18 @@ export declare function asNumber(value: unknown): number | undefined;
85
84
  export declare function asText(value: unknown): string;
86
85
  export declare function plainJson<T>(value: T): T;
87
86
  export declare function verdictOf(change: BundleChange): string;
88
- export declare function renderProbe(out: BrowserReadResult): string;
89
- export declare function renderFind(out: BrowserFindResult): string;
90
87
  export declare function showOrReason(panels: PanelsService, unit: string, workspace: string | null): {
91
88
  readonly ok: boolean;
92
89
  readonly reason?: string;
93
90
  };
94
- export declare function workshopOf(ctx: DshHostContext, exec: DshToolRunContext): {
91
+ export declare function workshopOf(ctx: DshHostContext, exec: DshToolRunContext): Promise<{
95
92
  readonly packagesDir: string;
96
93
  readonly workspace: string | null;
97
- };
94
+ readonly title: string;
95
+ }>;
98
96
  export declare function modulesOf(ctx: DshHostContext, packagesDir: string): {
99
97
  installed: string[];
100
98
  modules: readonly import("@/shared/api/host/diy-workshop").WorkshopModule[];
101
99
  };
100
+ export declare function moduleDirsOf(packagesDir: string): readonly string[];
102
101
  export declare function panelEntriesOf(panels: PanelsService, workspace: string | null): import("./config").PanelEntry[];
@@ -7,5 +7,5 @@ export interface ObserverCleanup {
7
7
  export interface CleanupLog {
8
8
  warn?(message: string): void;
9
9
  }
10
- export declare function stopObservers(ctx: DshHostContext, session?: string): Promise<ObserverCleanup>;
11
- export declare function withObserverCleanup(store: DebugStore, cleanup: () => Promise<ObserverCleanup>, logger?: CleanupLog | undefined): DebugStore;
10
+ export declare function stopObservers(ctx: DshHostContext, workspace: string | null | undefined, session?: string): Promise<ObserverCleanup>;
11
+ export declare function withObserverCleanup(store: DebugStore, cleanup: (workspace: string | null) => Promise<ObserverCleanup>, logger?: CleanupLog | undefined): DebugStore;
@@ -26,5 +26,5 @@ export declare function debugForeignPactText(held: DebugState): string;
26
26
  export declare function debugOffBoardText(held: DebugState, situation?: BoardSituation): string;
27
27
  export declare function boardProbeOf(page: WorkbenchPage): BoardProbe;
28
28
  export declare function boardStateOf(page: WorkbenchPage, workshop: string | null): BoardState;
29
- export declare function boardGateText(situation: BoardSituation, unit: string, page: WorkbenchPage): string;
29
+ export declare function boardGateText(situation: BoardSituation, unit: string, page: WorkbenchPage, title?: string): string;
30
30
  export declare function pageAt(ctx: DshHostContext, exec: DshToolRunContext, raw: unknown, options?: PageOptions): Promise<PageHandle>;
@@ -0,0 +1,27 @@
1
+ import type { RecordCall } from './diy-record-text';
2
+ export declare const SEGMENT_SLACK_MS = 1500;
3
+ export interface CaptureEntry {
4
+ readonly key: string;
5
+ readonly at: number;
6
+ readonly method: string;
7
+ readonly url: string;
8
+ readonly status: number;
9
+ readonly ct: string;
10
+ readonly size: number;
11
+ readonly request: string;
12
+ readonly response: string;
13
+ readonly requestFullSize: number;
14
+ readonly responseFullSize: number;
15
+ readonly requestSizeExact: boolean;
16
+ readonly responseSizeExact: boolean;
17
+ readonly headers: string;
18
+ }
19
+ export declare function captureEntriesOf(text: string): readonly CaptureEntry[];
20
+ export declare function segmentOf(entries: readonly CaptureEntry[], t0: number | null, t1: number | null): {
21
+ readonly inside: readonly CaptureEntry[];
22
+ readonly outside: number;
23
+ };
24
+ export declare function captureCallsOf(entries: readonly CaptureEntry[]): readonly RecordCall[];
25
+ export declare function mergeCalls(hook: readonly RecordCall[], captured: readonly RecordCall[]): readonly RecordCall[];
26
+ export declare function pickAllOf(entries: readonly CaptureEntry[], key: string): readonly CaptureEntry[];
27
+ export declare function pickOf(entries: readonly CaptureEntry[], key: string, at?: number | null): CaptureEntry | null;
@@ -0,0 +1,2 @@
1
+ import type { RecordStore, RouteTable } from '@dsh-workbench/shared/host';
2
+ export declare function diyRecordRoutes(store: RecordStore): RouteTable;
@@ -0,0 +1,6 @@
1
+ export declare const RECORD_KEY = "__dshDiyRecord";
2
+ export declare const RECORD_KEEP_KEY = "__dshDiyRecordKeep";
3
+ export declare const RECORD_OFF_KEY = "__dshDiyRecordOff";
4
+ export declare const RECORD_ARM_SCRIPT: string;
5
+ export declare const RECORD_READ_SCRIPT: string;
6
+ export declare const RECORD_STOP_SCRIPT: string;
@@ -0,0 +1,89 @@
1
+ import type { RecordExpect, RecordMove, RecordRefusal, RecordState } from '@dsh-workbench/shared';
2
+ export interface RecordCall {
3
+ readonly key: string;
4
+ readonly method: string;
5
+ readonly url: string;
6
+ readonly body: string;
7
+ readonly status: number;
8
+ readonly ct: string;
9
+ readonly response: string;
10
+ readonly at: number;
11
+ readonly source: 'hook' | 'capture';
12
+ }
13
+ export interface RecordPageRead {
14
+ readonly ok: boolean;
15
+ readonly code: string;
16
+ readonly phase: string;
17
+ readonly t0: number | null;
18
+ readonly t1: number | null;
19
+ readonly href: string;
20
+ readonly here: string;
21
+ readonly dropped: number;
22
+ readonly unhooked: boolean;
23
+ readonly calls: readonly RecordCall[];
24
+ }
25
+ export declare function recordPageOf(payload: Record<string, unknown> | undefined): RecordPageRead;
26
+ export declare function filterTextOf(expect: RecordExpect | null): string;
27
+ export declare function probeCommandOf(calls: readonly RecordCall[]): string;
28
+ export declare function bodyMissingOf(calls: readonly RecordCall[]): boolean;
29
+ export declare function recordRefusalText(code: RecordRefusal, held?: RecordState): string;
30
+ export declare function recordMissingText(): string;
31
+ export declare function recordTalkOf(): string;
32
+ export interface RecordListRow {
33
+ readonly index: number;
34
+ readonly key: string;
35
+ readonly at: number;
36
+ readonly method: string;
37
+ readonly url: string;
38
+ readonly status: number;
39
+ readonly ct: string;
40
+ readonly size: number;
41
+ readonly source: 'hook' | 'capture';
42
+ readonly hasRequest: boolean;
43
+ readonly hasResponse: boolean;
44
+ readonly likelyWrite: boolean;
45
+ readonly marked: boolean;
46
+ }
47
+ export declare function listRowsOf(calls: readonly RecordCall[], expect: RecordExpect | null): readonly RecordListRow[];
48
+ export interface RecordReadFacts {
49
+ readonly phase: string;
50
+ readonly armed: boolean;
51
+ readonly hookCaught: number;
52
+ readonly rows: readonly RecordListRow[];
53
+ readonly merged: number;
54
+ readonly capturedLines: number;
55
+ readonly capturedInSegment: number;
56
+ readonly capturedOutside: number;
57
+ readonly capturedTotalLines: number;
58
+ readonly capturedTruncated: boolean;
59
+ readonly capturedTailLimit: number;
60
+ readonly dropped: number;
61
+ readonly nav: boolean;
62
+ readonly filter: string;
63
+ readonly captureRound: string;
64
+ }
65
+ export declare function renderRecordRead(input: RecordReadFacts): string;
66
+ export interface RecordDetailFacts {
67
+ readonly found: boolean;
68
+ readonly where: string;
69
+ readonly method: string;
70
+ readonly url: string;
71
+ readonly status: number;
72
+ readonly ct: string;
73
+ readonly at: number;
74
+ readonly request: string;
75
+ readonly response: string;
76
+ readonly headers: string;
77
+ readonly requestFullSize: number;
78
+ readonly responseFullSize: number;
79
+ readonly requestSizeExact: boolean;
80
+ readonly responseSizeExact: boolean;
81
+ readonly ambiguous: number;
82
+ readonly source: string;
83
+ readonly maxBytes: number;
84
+ readonly note: string;
85
+ }
86
+ export declare function renderRecordDetail(input: RecordDetailFacts): string;
87
+ export declare function moveOrThrow(move: RecordMove, held: RecordState | null): RecordState;
88
+ export declare function domainOf(url: string): string;
89
+ export declare function readDomainsOf(design: unknown): readonly string[];
@@ -0,0 +1,2 @@
1
+ import type { DshHostContext, RecordStore } from '@dsh-workbench/shared';
2
+ export declare function registerRecordTools(ctx: DshHostContext, store: RecordStore): readonly (() => void)[];
@@ -0,0 +1,76 @@
1
+ import type { DshHostContext, DshShell, RecordState, RecordStore } from '@dsh-workbench/shared';
2
+ import type { CaptureEntry } from './diy-record-capture';
3
+ import type { RecordCall, RecordListRow, RecordPageRead } from './diy-record-text';
4
+ export declare const OPEN_TIMEOUT_MS = 30000;
5
+ export declare const SETTLE_MS = 2000;
6
+ export declare const WAIT_CAP_MS: number;
7
+ export declare const POLL_MS = 1000;
8
+ export declare const DETAIL_MAX_BYTES = 60000;
9
+ export declare const pauseFor: (ms: number) => Promise<void>;
10
+ export declare function waitOf(value: unknown): number;
11
+ export declare function foreignDomainText(design: unknown, url: string): string;
12
+ export declare function captureFileOf(packagesDir: string, unit: string): string;
13
+ export declare function lastCaptureFileOf(file: string): string;
14
+ export declare function startRecordCapture(shell: DshShell, command: string, session: string, file: string): Promise<boolean>;
15
+ export interface WatchFinishDeps {
16
+ readonly ctx: DshHostContext;
17
+ readonly shell: DshShell;
18
+ readonly command: string;
19
+ readonly sessionId: string;
20
+ readonly store: RecordStore;
21
+ readonly url: string;
22
+ readonly captureFile: string;
23
+ }
24
+ export declare function watchFinishStepOf(input: WatchFinishDeps): Promise<{
25
+ readonly stop: boolean;
26
+ readonly delivered: boolean;
27
+ }>;
28
+ export declare function watchRecordFinish(input: WatchFinishDeps): void;
29
+ export interface CaptureRead {
30
+ readonly text: string;
31
+ readonly totalLines: number;
32
+ readonly tailLimit: number;
33
+ readonly truncated: boolean;
34
+ readonly round: string;
35
+ }
36
+ export declare function captureLinesOf(shell: DshShell, file: string, timeoutMs?: number): Promise<number>;
37
+ export declare function captureRoundOf(shell: DshShell, file: string, timeoutMs?: number): Promise<string>;
38
+ export declare function captureTextOf(shell: DshShell, file: string, timeoutMs?: number): Promise<{
39
+ readonly text: string;
40
+ readonly truncated: boolean;
41
+ }>;
42
+ export declare function captureReadOf(shell: DshShell, file: string, timeoutMs?: number): Promise<CaptureRead>;
43
+ export declare function keepCaptureOf(shell: DshShell, file: string, timeoutMs?: number): Promise<boolean>;
44
+ export declare function captureLinesWithKeyOf(shell: DshShell, file: string, key: string, timeoutMs?: number): Promise<string>;
45
+ export interface SegmentBundle {
46
+ readonly capture: CaptureRead;
47
+ readonly entries: readonly CaptureEntry[];
48
+ readonly inside: readonly CaptureEntry[];
49
+ readonly outside: number;
50
+ readonly merged: readonly RecordCall[];
51
+ readonly rows: readonly RecordListRow[];
52
+ }
53
+ export declare function bundleOf(capture: CaptureRead, page: RecordPageRead, state: RecordState): SegmentBundle;
54
+ export declare function hookCallOf(page: RecordPageRead, key: string): RecordCall | null;
55
+ export declare function detailOfEntry(entry: CaptureEntry, maxBytes: number, ambiguous?: number): Record<string, unknown>;
56
+ export declare function detailOfCall(call: RecordCall, maxBytes: number): Record<string, unknown>;
57
+ export declare function releaseRecord(input: {
58
+ readonly shell: DshShell;
59
+ readonly command: string;
60
+ readonly session: string;
61
+ readonly url: string;
62
+ readonly captureFile: string;
63
+ }): Promise<{
64
+ readonly tab: boolean;
65
+ readonly capture: boolean;
66
+ }>;
67
+ export declare function releaseQuietly(input: {
68
+ readonly shell: DshShell;
69
+ readonly command: string;
70
+ readonly session: string;
71
+ readonly url: string;
72
+ readonly captureFile: string;
73
+ }): Promise<{
74
+ readonly tab: boolean;
75
+ readonly capture: boolean;
76
+ }>;
@@ -3,6 +3,7 @@ import type { HandoffEntry } from '@dsh-workbench/shared/host';
3
3
  import type { UnitManifest } from '@dsh-workbench/shared/host';
4
4
  export declare const PANELS_FACT = "panels";
5
5
  export declare const DIY_DEBUG_FACT = "diy-debug";
6
+ export declare const DIY_RECORD_FACT = "diy-record";
6
7
  export declare function panelsHandoffEntry(target?: {
7
8
  readonly path?: string | undefined;
8
9
  }): HandoffEntry | undefined;
@@ -17,9 +17,9 @@ export declare const MODULES_UPDATE_WORKBENCH_TOOL = "workbench_modules_update_w
17
17
  export declare const DIY_LIST_TOOL = "workbench_diy_list";
18
18
  export declare const DIY_STATUS_TOOL = "workbench_diy_status";
19
19
  export declare const DIY_PANEL_TOOL = "workbench_diy_panel";
20
+ export declare const DIY_COMPONENTS_TOOL = "workbench_diy_components";
20
21
  export declare const DIY_RECON_TOOL = "workbench_diy_recon";
21
22
  export declare const DIY_SPEC_TOOL = "workbench_diy_spec";
22
- export declare const DIY_PROBE_TOOL = "workbench_diy_probe";
23
23
  export declare const DIY_INSTALL_TOOL = "workbench_diy_install";
24
24
  export declare const DIY_SHOW_TOOL = "workbench_diy_show";
25
25
  export declare const DIY_STATE_TOOL = "workbench_diy_state";
@@ -39,14 +39,19 @@ export declare const DIY_DIALOG_TOOL = "workbench_diy_dialog";
39
39
  export declare const DIY_LOGS_WATCH_TOOL = "workbench_diy_logs_watch";
40
40
  export declare const DIY_LOGS_READ_TOOL = "workbench_diy_logs_read";
41
41
  export declare const DIY_LOGS_STOP_TOOL = "workbench_diy_logs_stop";
42
+ export declare const DIY_RECORD_PREPARE_TOOL = "workbench_diy_record_prepare";
43
+ export declare const DIY_RECORD_READ_TOOL = "workbench_diy_record_read";
44
+ export declare const DIY_RECORD_DETAIL_TOOL = "workbench_diy_record_detail";
45
+ export declare const DIY_RECORD_STOP_TOOL = "workbench_diy_record_stop";
42
46
  export declare const DIY_DEBUG_START_TOOL = "workbench_diy_debug_start";
43
47
  export declare const DIY_DEBUG_PAUSE_TOOL = "workbench_diy_debug_pause";
44
48
  export declare const DIY_DEBUG_RESUME_TOOL = "workbench_diy_debug_resume";
45
49
  export declare const DIY_DEBUG_STOP_TOOL = "workbench_diy_debug_stop";
46
- export declare const ALL_TOOLS: readonly ["workbench_panels_list", "workbench_panels_show", "workbench_panels_hide", "workbench_panels_move", "workbench_panels_reset", "workbench_panels_follow", "workbench_modules_list", "workbench_modules_install", "workbench_modules_update", "workbench_modules_uninstall", "workbench_modules_install_bundle", "workbench_modules_update_dependency", "workbench_modules_update_plugin", "workbench_modules_uninstall_plugin", "workbench_modules_update_workbench", "workbench_diy_list", "workbench_diy_status", "workbench_diy_panel", "workbench_diy_recon", "workbench_diy_spec", "workbench_diy_probe", "workbench_diy_install", "workbench_diy_show", "workbench_diy_state", "workbench_diy_html", "workbench_diy_find", "workbench_diy_click", "workbench_diy_hover", "workbench_diy_type", "workbench_diy_fill", "workbench_diy_keys", "workbench_diy_scroll", "workbench_diy_wait", "workbench_diy_eval", "workbench_diy_screenshot", "workbench_diy_network", "workbench_diy_dialog", "workbench_diy_logs_watch", "workbench_diy_logs_read", "workbench_diy_logs_stop", "workbench_diy_debug_start", "workbench_diy_debug_pause", "workbench_diy_debug_resume", "workbench_diy_debug_stop"];
50
+ export declare const ALL_TOOLS: readonly ["workbench_panels_list", "workbench_panels_show", "workbench_panels_hide", "workbench_panels_move", "workbench_panels_reset", "workbench_panels_follow", "workbench_modules_list", "workbench_modules_install", "workbench_modules_update", "workbench_modules_uninstall", "workbench_modules_install_bundle", "workbench_modules_update_dependency", "workbench_modules_update_plugin", "workbench_modules_uninstall_plugin", "workbench_modules_update_workbench", "workbench_diy_list", "workbench_diy_status", "workbench_diy_panel", "workbench_diy_components", "workbench_diy_recon", "workbench_diy_spec", "workbench_diy_install", "workbench_diy_show", "workbench_diy_state", "workbench_diy_html", "workbench_diy_find", "workbench_diy_click", "workbench_diy_hover", "workbench_diy_type", "workbench_diy_fill", "workbench_diy_keys", "workbench_diy_scroll", "workbench_diy_wait", "workbench_diy_eval", "workbench_diy_screenshot", "workbench_diy_network", "workbench_diy_dialog", "workbench_diy_logs_watch", "workbench_diy_logs_read", "workbench_diy_logs_stop", "workbench_diy_record_prepare", "workbench_diy_record_read", "workbench_diy_record_detail", "workbench_diy_record_stop", "workbench_diy_debug_start", "workbench_diy_debug_pause", "workbench_diy_debug_resume", "workbench_diy_debug_stop"];
47
51
  export type PanelsToolName = (typeof ALL_TOOLS)[number];
48
- export declare const READ_TOOLS: readonly ["workbench_panels_list", "workbench_modules_list", "workbench_diy_list", "workbench_diy_status", "workbench_diy_panel", "workbench_diy_recon", "workbench_diy_spec", "workbench_diy_probe", "workbench_diy_state", "workbench_diy_html", "workbench_diy_find", "workbench_diy_click", "workbench_diy_hover", "workbench_diy_type", "workbench_diy_fill", "workbench_diy_keys", "workbench_diy_scroll", "workbench_diy_wait", "workbench_diy_eval", "workbench_diy_screenshot", "workbench_diy_network", "workbench_diy_dialog", "workbench_diy_logs_watch", "workbench_diy_logs_read", "workbench_diy_logs_stop"];
49
- export declare const WRITE_TOOLS: readonly ["workbench_panels_show", "workbench_panels_hide", "workbench_panels_move", "workbench_panels_reset", "workbench_panels_follow", "workbench_modules_install", "workbench_modules_update", "workbench_modules_uninstall", "workbench_modules_install_bundle", "workbench_modules_update_dependency", "workbench_modules_update_plugin", "workbench_modules_uninstall_plugin", "workbench_modules_update_workbench", "workbench_diy_install", "workbench_diy_show", "workbench_diy_debug_start", "workbench_diy_debug_pause", "workbench_diy_debug_resume", "workbench_diy_debug_stop"];
50
- export declare const DIY_TOOLS: readonly ["workbench_diy_list", "workbench_diy_status", "workbench_diy_panel", "workbench_diy_recon", "workbench_diy_spec", "workbench_diy_probe", "workbench_diy_install", "workbench_diy_show", "workbench_diy_state", "workbench_diy_html", "workbench_diy_find", "workbench_diy_click", "workbench_diy_hover", "workbench_diy_type", "workbench_diy_fill", "workbench_diy_keys", "workbench_diy_scroll", "workbench_diy_wait", "workbench_diy_eval", "workbench_diy_screenshot", "workbench_diy_network", "workbench_diy_dialog", "workbench_diy_logs_watch", "workbench_diy_logs_read", "workbench_diy_logs_stop"];
52
+ export declare const READ_TOOLS: readonly ["workbench_panels_list", "workbench_modules_list", "workbench_diy_list", "workbench_diy_status", "workbench_diy_panel", "workbench_diy_components", "workbench_diy_recon", "workbench_diy_spec", "workbench_diy_state", "workbench_diy_html", "workbench_diy_find", "workbench_diy_click", "workbench_diy_hover", "workbench_diy_type", "workbench_diy_fill", "workbench_diy_keys", "workbench_diy_scroll", "workbench_diy_wait", "workbench_diy_eval", "workbench_diy_screenshot", "workbench_diy_network", "workbench_diy_dialog", "workbench_diy_logs_watch", "workbench_diy_logs_read", "workbench_diy_logs_stop", "workbench_diy_record_read", "workbench_diy_record_detail", "workbench_diy_record_stop"];
53
+ export declare const WRITE_TOOLS: readonly ["workbench_panels_show", "workbench_panels_hide", "workbench_panels_move", "workbench_panels_reset", "workbench_panels_follow", "workbench_modules_install", "workbench_modules_update", "workbench_modules_uninstall", "workbench_modules_install_bundle", "workbench_modules_update_dependency", "workbench_modules_update_plugin", "workbench_modules_uninstall_plugin", "workbench_modules_update_workbench", "workbench_diy_install", "workbench_diy_show", "workbench_diy_record_prepare", "workbench_diy_debug_start", "workbench_diy_debug_pause", "workbench_diy_debug_resume", "workbench_diy_debug_stop"];
54
+ export declare const DIY_TOOLS: readonly ["workbench_diy_list", "workbench_diy_status", "workbench_diy_panel", "workbench_diy_components", "workbench_diy_recon", "workbench_diy_spec", "workbench_diy_install", "workbench_diy_show", "workbench_diy_state", "workbench_diy_html", "workbench_diy_find", "workbench_diy_click", "workbench_diy_hover", "workbench_diy_type", "workbench_diy_fill", "workbench_diy_keys", "workbench_diy_scroll", "workbench_diy_wait", "workbench_diy_eval", "workbench_diy_screenshot", "workbench_diy_network", "workbench_diy_dialog", "workbench_diy_logs_watch", "workbench_diy_logs_read", "workbench_diy_logs_stop"];
55
+ export declare const DIY_RECORD_TOOLS: readonly ["workbench_diy_record_prepare", "workbench_diy_record_read", "workbench_diy_record_detail", "workbench_diy_record_stop"];
51
56
  export declare const DIY_DEBUG_TOOLS: readonly ["workbench_diy_debug_start", "workbench_diy_debug_pause", "workbench_diy_debug_resume", "workbench_diy_debug_stop"];
52
57
  export declare const panelsUnit: UnitManifest;
@@ -1,10 +1,30 @@
1
1
  import type { DshClientContext } from '@dsh-workbench/shared';
2
2
  import { type ContextRef } from '@dsh-workbench/shared';
3
+ /**
4
+ * 对话 `@` 引用源报名用的名字:引用、lexicon 与编解码都挂在这个 source 名下。
5
+ */
3
6
  export declare const CONTEXT_SOURCE = "workbench";
7
+ /**
8
+ * `addContextChip` 的结果:`inserted` 真插进输入框了、`unavailable` 这台 dsh 缺服务或当时插不进去。
9
+ */
4
10
  export type ChipResult = 'inserted' | 'unavailable';
11
+ /**
12
+ * 装引用源要的外壳依赖:现在这个会话是哪一个 —— 拿不到 session id 就插不了。
13
+ */
5
14
  export interface ContextChipsDeps {
6
15
  currentSessionId(): string | undefined;
7
16
  }
17
+ /**
18
+ * 外壳启动、拿到 dsh 的 client context 之后调一次:把 `@` 引用源注册进对话输入框;
19
+ * dsh 没给 `inputTriggers` 时不装、也不报错。
20
+ */
8
21
  export declare function installContextChips(ctx: DshClientContext, deps: ContextChipsDeps): void;
22
+ /**
23
+ * 要往当前对话输入框插一条 `@` 引用时调用(卡片上“发到对话”那类动作):同步返回,只反映当场这一拍 ——
24
+ * 没插进去会自己再试几拍,后面成功了也不会回头改这个返回值。没装过 / 没会话 / 拿不到输入框都回 `unavailable`。
25
+ */
9
26
  export declare function addContextChip(ref: ContextRef, label: string): ChipResult;
27
+ /**
28
+ * 把编好的引用串码成带 `@` 的标记文本(输入框里显示与复制到剪贴板都是这一份);认不出的串原样加个 `@`。
29
+ */
10
30
  export declare function serializeChipRef(encoded: string): string;
@@ -0,0 +1,4 @@
1
+ import type { DshHostContext } from '@dsh-workbench/shared';
2
+ export declare function registerDiyActs(ctx: DshHostContext, facts: {
3
+ bump(names: readonly string[]): unknown;
4
+ }): () => void;
@@ -0,0 +1,65 @@
1
+ import type { DshShell } from '@dsh-workbench/shared';
2
+ export declare const SURFACE_TIMEOUT_MS = 30000;
3
+ export declare const EXCERPT_LINES = 60;
4
+ export declare const SUMMARY_PER_BUCKET = 12;
5
+ export declare const NEAR_LIMIT = 8;
6
+ export declare const PRUNE_CHARS = 8192;
7
+ export declare const PRIMITIVES_PKG = "@deepseek-ai/dsh-client-ui-primitives";
8
+ export declare const MANIFEST_TAIL = "//# sourceMappingURL=";
9
+ export type SurfaceScope = 'all' | 'primitives' | 'kit';
10
+ export interface SurfacePayload {
11
+ readonly [key: string]: unknown;
12
+ }
13
+ export interface SurfaceQuery {
14
+ readonly primitives?: SurfacePayload;
15
+ readonly kit?: SurfacePayload;
16
+ }
17
+ export declare function scopeOf(raw: string): SurfaceScope;
18
+ export declare function wantsPrimitives(scope: SurfaceScope): boolean;
19
+ export declare function wantsKit(scope: SurfaceScope): boolean;
20
+ export declare function toolchainBinOf(root: string): string | null;
21
+ export declare function toolchainBinAmong(root: string, dirs: readonly string[]): string | null;
22
+ export declare function queryCommandOf(bin: string, only: 'kit' | 'primitives'): string;
23
+ export declare function runSurfaceQuery(shell: DshShell, bin: string, only: 'kit' | 'primitives', root: string, fallbackBin?: string): Promise<SurfacePayload>;
24
+ export declare function filesOf(payload: SurfacePayload | undefined): Record<string, string>;
25
+ export declare function rootsOf(payload: SurfacePayload | undefined): Record<string, string>;
26
+ export declare function countsOf(payload: SurfacePayload | undefined): Record<string, number>;
27
+ export declare function installedVersionOf(payload: SurfacePayload | undefined): string | null;
28
+ export declare function nearNamesOf(name: string, names: readonly string[], limit?: number): readonly string[];
29
+ export declare function findFileOf(name: string, query: SurfaceQuery): {
30
+ readonly file: string;
31
+ readonly from: 'kit' | 'primitives';
32
+ } | null;
33
+ export declare function excerptOf(text: string, maxLines?: number): string;
34
+ export declare function excerptAt(file: string, maxLines?: number): string;
35
+ /** 指引目录:从宿主产物往上找 `skills/workbench-module-diy`(找不到回 `null`)。 */
36
+ export declare function skillDirOf(from: string): string | null;
37
+ export declare function byLocationOf(payload: SurfacePayload): readonly {
38
+ readonly where: string;
39
+ readonly names: readonly string[];
40
+ }[];
41
+ export interface SurfaceBucket {
42
+ readonly label: string;
43
+ readonly key: string;
44
+ readonly names: readonly string[];
45
+ }
46
+ export declare function kitBucketsOf(payload: SurfacePayload): readonly SurfaceBucket[];
47
+ export declare function matchesBucket(where: string, bucket: string): boolean;
48
+ export declare function bucketNamesOf(query: SurfaceQuery): readonly {
49
+ readonly face: 'kit' | 'primitives';
50
+ readonly keys: readonly string[];
51
+ }[];
52
+ export declare const TWO_FACE_ALL = "\u26A0\uFE0F \u4E24\u4E2A\u9762\u4E00\u8D77\u4E0D\u7ED9\u5168\u8868 \u2014\u2014 \u8981\u5168\u8868\u5C31\u6307\u540D\u4E00\u9762\uFF1Ascope=kit \u6216 scope=primitives\u3002";
53
+ export declare function refusesEvery(scope: SurfaceScope, all: boolean, focused: boolean): boolean;
54
+ export declare function renderSurfaceText(query: SurfaceQuery, options: {
55
+ scope: SurfaceScope;
56
+ all: boolean;
57
+ bucket?: string;
58
+ }): string;
59
+ export declare function listedNamesOf(query: SurfaceQuery): readonly string[];
60
+ export type FaceState = 'not-queried' | 'ok' | 'unreadable';
61
+ export declare function faceStateOf(query: SurfaceQuery, face: 'kit' | 'primitives'): FaceState;
62
+ export declare function renderNameText(name: string, found: {
63
+ readonly file: string;
64
+ readonly from: 'kit' | 'primitives';
65
+ } | null, query: SurfaceQuery): string;
@@ -1,9 +1,26 @@
1
1
  import type { DebugIntent, DebugState, DebugStore, PostResource } from '@dsh-workbench/shared/host';
2
2
  export declare const DEBUG_NOTICE_KIND = "workbench-diy";
3
+ export interface NoticeTextBlock {
4
+ readonly type: 'text';
5
+ readonly text: string;
6
+ }
7
+ export interface NoticeSource {
8
+ readonly kind: string;
9
+ readonly form: 'notice';
10
+ readonly summary: string;
11
+ }
12
+ export interface NoticeMessage {
13
+ readonly role: 'user';
14
+ readonly id: string;
15
+ readonly content: readonly NoticeTextBlock[];
16
+ readonly source: NoticeSource;
17
+ }
18
+ export declare function noticeMessage(text: string, summary: string, kind?: string): NoticeMessage;
19
+ export declare function isNoticeMessage(value: unknown): value is NoticeMessage;
3
20
  export interface NoticeAgent {
4
21
  readonly status: string;
5
- inject(message: unknown): void;
6
- followup(message: unknown): void;
22
+ inject(message: NoticeMessage): void;
23
+ followup(message: NoticeMessage): void;
7
24
  }
8
25
  export interface AgentsLookup {
9
26
  get(id: string): NoticeAgent | undefined;
@@ -11,20 +28,20 @@ export interface AgentsLookup {
11
28
  export declare function debugNoticeText(intent: DebugIntent, state: DebugState): string;
12
29
  export declare function debugNoticeSummary(intent: DebugIntent, state: DebugState): string;
13
30
  export declare function debugNotice(intent: DebugIntent, state: DebugState): {
14
- message: unknown;
31
+ message: NoticeMessage;
15
32
  summary: string;
16
33
  };
17
34
  export type NoticeMode = 'wake' | 'hold' | 'drop';
18
35
  export type NoticeDelivery = 'followup' | 'inject' | 'held' | 'none' | 'skipped-idle';
19
- export declare function holdNotice(sessionId: string, message: unknown): void;
20
- export declare function takeHeldNotices(sessionId: string): unknown[];
21
- export declare function deliverDebugNotice(agents: AgentsLookup | undefined, sessionId: string, message: unknown, mode?: NoticeMode): NoticeDelivery;
36
+ export declare function holdNotice(sessionId: string, message: NoticeMessage): void;
37
+ export declare function takeHeldNotices(sessionId: string): NoticeMessage[];
38
+ export declare function deliverDebugNotice(agents: AgentsLookup | undefined, sessionId: string, message: NoticeMessage, mode?: NoticeMode): NoticeDelivery;
22
39
  export interface DebugActDeps {
23
40
  readonly store: () => DebugStore | undefined;
24
41
  readonly agents: () => AgentsLookup | undefined;
25
42
  readonly now?: (() => number) | undefined;
26
43
  readonly notice?: ((intent: DebugIntent, state: DebugState) => {
27
- message: unknown;
44
+ message: NoticeMessage;
28
45
  summary: string;
29
46
  }) | undefined;
30
47
  }
@@ -0,0 +1,19 @@
1
+ import type { PostResource, RecordIntent, RecordState, RecordStore } from '@dsh-workbench/shared/host';
2
+ import { type AgentsLookup, type NoticeMessage } from './diy-debug-act';
3
+ export declare const RECORD_NOTICE_KIND = "workbench-diy-record";
4
+ export declare function recordNoticeText(intent: RecordIntent, state: RecordState): string;
5
+ export declare function recordNoticeSummary(intent: RecordIntent, state: RecordState): string;
6
+ export declare function recordNotice(intent: RecordIntent, state: RecordState): {
7
+ message: NoticeMessage;
8
+ summary: string;
9
+ };
10
+ export interface RecordActDeps {
11
+ readonly store: () => RecordStore | undefined;
12
+ readonly agents: () => AgentsLookup | undefined;
13
+ readonly now?: (() => number) | undefined;
14
+ readonly notice?: ((intent: RecordIntent, state: RecordState) => {
15
+ message: NoticeMessage;
16
+ summary: string;
17
+ }) | undefined;
18
+ }
19
+ export declare function recordActResource(deps: RecordActDeps): PostResource;
@@ -1,4 +1,3 @@
1
- import type { DshHostContext } from '@dsh-workbench/shared';
2
1
  export interface WorkshopModule {
3
2
  readonly unit: string;
4
3
  readonly name: string;
@@ -6,10 +5,9 @@ export interface WorkshopModule {
6
5
  readonly dir: string;
7
6
  readonly installed: boolean;
8
7
  }
9
- export declare function workshopPackagesDir(ctx: DshHostContext): string | null;
10
8
  export declare function insideWorkshop(root: string, target: string): boolean;
11
9
  export declare function workshopModules(packagesDir: string, installed?: readonly string[]): readonly WorkshopModule[];
12
- export declare function inWorkshopSession(ctx: DshHostContext, workspace: string | null): boolean;
10
+ export declare function readDesignOfModule(dir: string): unknown;
13
11
  export interface WorkshopSync {
14
12
  readonly state: 'ok' | 'syncing' | 'failed';
15
13
  readonly version: string;
@@ -4,6 +4,9 @@ import { type RouteTable } from '@dsh-workbench/shared/host';
4
4
  import type { ContextRenderer, UnitMountDeps, UnitMountResult, UnitCall } from '@dsh-workbench/shared/host';
5
5
  import type { HostUnit } from './unit-registry';
6
6
  import { type UnitReadiness } from './unit-readiness';
7
+ export declare function declaredNotesOf(plans: Iterable<{
8
+ readonly declaredNotes: ReadonlySet<string>;
9
+ }>): ReadonlySet<string>;
7
10
  export interface UnitFailure {
8
11
  readonly id: string;
9
12
  readonly reason: string;
@@ -35,6 +38,7 @@ export interface UnitsPlan {
35
38
  }>;
36
39
  readonly failed: readonly UnitFailure[];
37
40
  readonly warmReads: () => readonly (readonly string[])[];
41
+ readonly declaredNotes: ReadonlySet<string>;
38
42
  readonly disposeLongTasks: () => void;
39
43
  }
40
44
  interface NamedEntry {
@@ -0,0 +1,16 @@
1
+ import type { DshHostContext } from '@dsh-workbench/shared';
2
+ import { type ToolScopeContext } from '@dsh-workbench/shared/host';
3
+ import { type ToolScope } from './tool-scope';
4
+ export interface SessionProjections {
5
+ stateOf(session: unknown, key: string): unknown;
6
+ onChanged(listener: (session: unknown, key: string, value: unknown, seq: unknown) => void): () => void;
7
+ }
8
+ export interface PresetScopeOptions {
9
+ readonly ctx: DshHostContext;
10
+ readonly deniedTools: (context: ToolScopeContext) => readonly string[];
11
+ readonly logger?: {
12
+ info?(message: string): void;
13
+ warn?(message: string): void;
14
+ } | undefined;
15
+ }
16
+ export declare function createPresetScope(options: PresetScopeOptions): ToolScope;