@jiyr0119/dsh-service-console 0.1.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.
@@ -0,0 +1,51 @@
1
+ export interface CommandResult {
2
+ stdout: string;
3
+ stderr: string;
4
+ code: number | null;
5
+ }
6
+ export type CommandRunner = (command: string, timeoutMs?: number) => CommandResult | Promise<CommandResult>;
7
+ export declare function runCommand(command: string, timeoutMs?: number): CommandResult;
8
+ export declare function parseLstart(str: string): number | null;
9
+ export interface ListenRow {
10
+ command: string;
11
+ pid: number;
12
+ user: string;
13
+ fd: string;
14
+ type: string;
15
+ address: string;
16
+ }
17
+ export declare function parseListenRows(stdout: string): ListenRow[];
18
+ export interface PsRow {
19
+ pid: number;
20
+ ppid: number;
21
+ lstart: string;
22
+ startedAt: number | null;
23
+ command: string;
24
+ }
25
+ export declare function parsePsRows(stdout: string): PsRow[];
26
+ export declare function parseAddress(addr: string): {
27
+ host: string | null;
28
+ port: number | null;
29
+ };
30
+ export declare function shellQuote(s: string): string;
31
+ export interface RawProcess {
32
+ pid: number;
33
+ ppid: number | null;
34
+ startedAt: number | null;
35
+ command: string | null;
36
+ name: string | null;
37
+ pgid: number | null;
38
+ cwd: string | null;
39
+ }
40
+ export interface RawListener {
41
+ pid: number;
42
+ host: string;
43
+ port: number;
44
+ protocol: string;
45
+ }
46
+ export interface RawScan {
47
+ listeners: RawListener[];
48
+ procs: Map<number, RawProcess>;
49
+ partialWarnings: string[];
50
+ }
51
+ export declare function scanRaw(commandRunner?: CommandRunner): Promise<RawScan>;
@@ -0,0 +1 @@
1
+ export declare function redact(command: unknown): string | null;
@@ -0,0 +1,3 @@
1
+ import type { LedgerEntry, Snapshot, WorkspaceLike } from './types';
2
+ import { type CommandRunner } from './process-inspector';
3
+ export declare function buildSnapshot(ledgers: LedgerEntry[], workspaces: WorkspaceLike[], commandRunner?: CommandRunner): Promise<Snapshot>;
@@ -0,0 +1,87 @@
1
+ export type ServiceScope = 'conversation' | 'workspace' | 'machine';
2
+ export type Ownership = 'conversation-confirmed' | 'workspace-inferred' | 'other-local' | 'unknown' | 'protected';
3
+ export type ServiceStatus = 'running' | 'starting' | 'stopping' | 'exited' | 'unreachable' | 'permission-denied' | 'unknown';
4
+ export interface Listener {
5
+ host: string;
6
+ port: number;
7
+ protocol: string;
8
+ url?: string | null;
9
+ }
10
+ export interface Service {
11
+ id: string;
12
+ status: ServiceStatus;
13
+ ownership: Ownership;
14
+ confidence: 'confirmed' | 'inferred' | 'unknown';
15
+ name: string;
16
+ pid: number;
17
+ processGroupId?: number | null;
18
+ parentPid?: number | null;
19
+ commandSummary?: string | null;
20
+ cwd?: string | null;
21
+ startedAt?: number | null;
22
+ listeners: Listener[];
23
+ restartable: boolean;
24
+ protected: boolean;
25
+ ownershipEvidence: string[];
26
+ fingerprint: string;
27
+ }
28
+ export interface Snapshot {
29
+ scannedAt: number;
30
+ count: number;
31
+ services: Service[];
32
+ partialWarnings: string[];
33
+ ledgerCount: number;
34
+ }
35
+ export interface ApiResult<T = unknown> {
36
+ ok: boolean;
37
+ data?: T;
38
+ error?: {
39
+ code: string;
40
+ message: string;
41
+ };
42
+ }
43
+ export interface LedgerEntry {
44
+ at: number;
45
+ command: string;
46
+ cwd: string | null;
47
+ sessionKey: string | null;
48
+ redacted: string;
49
+ }
50
+ export interface Config {
51
+ refreshInterval: number;
52
+ defaultScope: ServiceScope;
53
+ gracefulTimeout: number;
54
+ showUnknown: boolean;
55
+ forceKill: boolean;
56
+ autoCleanup: boolean;
57
+ }
58
+ export interface ActionRecord {
59
+ at: number;
60
+ serviceId: string | null;
61
+ action: string;
62
+ result: string;
63
+ code: string | null;
64
+ }
65
+ export interface ShellLike {
66
+ resolve(request: {
67
+ command: string;
68
+ timeout?: number;
69
+ }): unknown;
70
+ run(spec: unknown): Promise<{
71
+ stdout?: unknown;
72
+ stderr?: unknown;
73
+ output?: unknown;
74
+ text?: unknown;
75
+ code?: unknown;
76
+ exitCode?: unknown;
77
+ }>;
78
+ }
79
+ export interface WorkspaceLike {
80
+ id?: string;
81
+ path?: string;
82
+ title?: string;
83
+ }
84
+ export interface TimerLike {
85
+ timeout(callback: () => void, delay: number): () => void;
86
+ timeout(delay: number): Promise<void>;
87
+ }
@@ -0,0 +1,17 @@
1
+ import type { Context } from 'cordis';
2
+ import type { WebServer } from '@deepseek-ai/dsh-host-webserver';
3
+ declare module 'cordis' {
4
+ interface Context {
5
+ timer: {
6
+ timeout(callback: () => void, delay: number): () => void;
7
+ timeout(delay: number): Promise<void>;
8
+ interval(callback: () => void, delay: number): () => void;
9
+ };
10
+ webServer: WebServer;
11
+ }
12
+ }
13
+ declare const _default: {
14
+ inject: string[];
15
+ apply(ctx: Context): void;
16
+ };
17
+ export default _default;
package/manifest.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "id": "dsh-service-console",
3
+ "name": "服务控制台 (Service Console)",
4
+ "version": "0.1.0",
5
+ "description": "本地开发服务控制台:发现监听端口,识别归属,安全停止/重启",
6
+ "kind": "dynamic-cordis-plugin",
7
+ "platforms": {
8
+ "host": "src/index.ts",
9
+ "client": "src/client/index.tsx"
10
+ },
11
+ "host": {
12
+ "handlers": ["scan", "detail", "stop", "restart", "config", "actions"],
13
+ "services": ["shell", "workspaceRegistry"]
14
+ },
15
+ "client": {
16
+ "slots": [
17
+ "conversation.session.header.utilities",
18
+ "shell.overlay",
19
+ "settings.section"
20
+ ],
21
+ "services": ["slots", "timer"]
22
+ },
23
+ "license": "MIT"
24
+ }
package/package.json ADDED
@@ -0,0 +1,100 @@
1
+ {
2
+ "name": "@jiyr0119/dsh-service-console",
3
+ "version": "0.1.0",
4
+ "description": "DeepSeek Harness 本地开发服务控制台(原生插件):发现监听端口,识别服务归属,安全查看/停止/重启。Local development service console for DSH.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "lib/index.js",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./lib/types/index.d.ts",
11
+ "default": "./lib/index.js"
12
+ },
13
+ "./client": {
14
+ "types": "./lib/types/client/index.d.ts",
15
+ "default": "./lib/client.js"
16
+ },
17
+ "./src/*": "./src/*",
18
+ "./package.json": "./package.json"
19
+ },
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/Jiyr0119/dsh-service-console.git"
26
+ },
27
+ "homepage": "https://github.com/Jiyr0119/dsh-service-console",
28
+ "keywords": [
29
+ "deepseek-harness",
30
+ "cordis",
31
+ "dsh-plugin",
32
+ "local-dev-server",
33
+ "port-manager"
34
+ ],
35
+ "files": [
36
+ "lib",
37
+ "dsh.plugin.json",
38
+ "cordis.patch.yml",
39
+ "dynamic",
40
+ "docs",
41
+ "assets",
42
+ "README.md",
43
+ "README.zh.md",
44
+ "LICENSE",
45
+ "manifest.json"
46
+ ],
47
+ "dsh": {
48
+ "bundle": {
49
+ "patch": "./cordis.patch.yml"
50
+ },
51
+ "client": {
52
+ "inject": [
53
+ "@deepseek-ai/dsh-client-runtime",
54
+ "@deepseek-ai/dsh-client-locale",
55
+ "@deepseek-ai/dsh-client-ui-slots",
56
+ "@deepseek-ai/dsh-client-ui-conversation"
57
+ ],
58
+ "platform": "web"
59
+ },
60
+ "plugin": {
61
+ "id": "dsh-service-console",
62
+ "kind": "dynamic-cordis-plugin",
63
+ "host": "dynamic/host.js",
64
+ "client": "dynamic/client.js",
65
+ "hostHandler": "scan",
66
+ "clientSlots": [
67
+ "conversation.session.header.utilities",
68
+ "shell.overlay",
69
+ "settings.section"
70
+ ]
71
+ }
72
+ },
73
+ "scripts": {
74
+ "build": "tsdown && tsc -p tsconfig.build.json",
75
+ "prepublishOnly": "npm run build",
76
+ "typecheck": "tsc --noEmit",
77
+ "test": "npm run build && node --test test/*.test.mjs"
78
+ },
79
+ "devDependencies": {
80
+ "@deepseek-ai/cordis": "^4.0.1",
81
+ "@deepseek-ai/dsh-client-locale": "^0.1.0-rc.6",
82
+ "@deepseek-ai/dsh-client-runtime": "^0.1.0-rc.6",
83
+ "@deepseek-ai/dsh-client-ui-conversation": "^0.1.0-rc.6",
84
+ "@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.6",
85
+ "@deepseek-ai/dsh-host-webserver": "^0.1.0-rc.6",
86
+ "@deepseek-ai/dsh-invariants": "^0.1.0-rc.6",
87
+ "@types/node": "^22.0.0",
88
+ "@types/react": "^18.3.1",
89
+ "cordis": "^4.0.0-rc.7",
90
+ "lightningcss": "^1.33.0",
91
+ "react": "^18.2.0",
92
+ "react-dom": "^18.2.0",
93
+ "tsdown": "^0.22.14",
94
+ "typescript": "^5.6.0"
95
+ },
96
+ "peerDependencies": {
97
+ "@deepseek-ai/cordis": "^4.0.1",
98
+ "react": "^18.2.0"
99
+ }
100
+ }