@stackstackstack/dsh-commands 0.1.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.
- package/LICENSE +21 -0
- package/README.i18n.yaml +6 -0
- package/README.md +40 -0
- package/README.zh.md +40 -0
- package/lib/index.js +360 -0
- package/lib/invariant.js +43 -0
- package/lib/typert.host.d.ts +3 -0
- package/lib/typert.host.js +502 -0
- package/lib/typert.remote-client.d.ts +29 -0
- package/lib/typert.remote-client.js +103 -0
- package/lib/types/brand.d.ts +25 -0
- package/lib/types/brand.js +20 -0
- package/lib/types/index.d.ts +126 -0
- package/lib/types/index.js +343 -0
- package/lib/types/invariant.d.ts +17 -0
- package/lib/types/invariant.js +60 -0
- package/lib/types/types.d.ts +102 -0
- package/lib/types/types.js +10 -0
- package/package.json +76 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Durable command event vocabulary and the registry's Cordis event
|
|
3
|
+
* declaration, shared with type-only consumers. Client-safe: nothing here
|
|
4
|
+
* reaches a Host-only symbol, so a Client compilation face reads the same
|
|
5
|
+
* `commands/change` signature the Host emits.
|
|
6
|
+
*
|
|
7
|
+
* @module @stackstackstack/dsh-commands/types
|
|
8
|
+
*/
|
|
9
|
+
import type { CommandId } from './brand.ts';
|
|
10
|
+
/** Immutable metadata for a command's optional unstructured input. */
|
|
11
|
+
export interface CommandInputDescriptor {
|
|
12
|
+
/** Placeholder shown before the user supplies free-form input. */
|
|
13
|
+
readonly hint: string;
|
|
14
|
+
}
|
|
15
|
+
/** Expected command outcome rendered directly by the dispatching UI. */
|
|
16
|
+
export type CommandResult = {
|
|
17
|
+
readonly kind: 'success';
|
|
18
|
+
readonly text?: string;
|
|
19
|
+
/** Earlier authoritative domain event that owns a richer presentation. */
|
|
20
|
+
readonly sourceEventSeq?: number;
|
|
21
|
+
} | {
|
|
22
|
+
readonly kind: 'error';
|
|
23
|
+
readonly text: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* One settled command execution: the handler's normalized result plus the
|
|
27
|
+
* lifecycle pairing id minted for its `command/run`/`command/done` records,
|
|
28
|
+
* so a dispatching surface can correlate the Remote acknowledgment with the
|
|
29
|
+
* flow node those events produce.
|
|
30
|
+
*/
|
|
31
|
+
export interface CommandExecution {
|
|
32
|
+
/** Pairing id carried by this execution's lifecycle events. */
|
|
33
|
+
readonly commandId: CommandId;
|
|
34
|
+
/** The handler's normalized outcome. */
|
|
35
|
+
readonly result: CommandResult;
|
|
36
|
+
}
|
|
37
|
+
/** Handler-free immutable command view returned to UI adapters. */
|
|
38
|
+
export interface CommandDescriptor {
|
|
39
|
+
/** Lowercase command name without the leading slash. */
|
|
40
|
+
readonly name: string;
|
|
41
|
+
/** Human-readable summary used in discovery UI. */
|
|
42
|
+
readonly description: string;
|
|
43
|
+
/** Optional free-form input hint advertised to capable clients. */
|
|
44
|
+
readonly input?: CommandInputDescriptor;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Producer record for one command invocation (the `command/run` event's
|
|
48
|
+
* source slot). Merge-extensible sum type mirroring `MessageSourceMap`'s
|
|
49
|
+
* shape; minimal today because every executor caller is a human-facing UI
|
|
50
|
+
* surface dispatching a human-typed line, so the sole variant is `user`.
|
|
51
|
+
*/
|
|
52
|
+
export interface CommandSourceMap {
|
|
53
|
+
user: {
|
|
54
|
+
kind: 'user';
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/** The union over {@link CommandSourceMap} — who issued a command line. */
|
|
58
|
+
export type CommandSource = CommandSourceMap[keyof CommandSourceMap];
|
|
59
|
+
declare module '@deepseek-ai/cordis' {
|
|
60
|
+
interface Events {
|
|
61
|
+
/**
|
|
62
|
+
* A command was registered or unregistered. This is an unfiltered registry
|
|
63
|
+
* notification because a global or scoped change may affect any UI view.
|
|
64
|
+
* Observer failures are contained and cannot veto the registry mutation.
|
|
65
|
+
* @mode emit
|
|
66
|
+
*/
|
|
67
|
+
'commands/change'(): void;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
declare module '@stackstackstack/dsh-session/types' {
|
|
71
|
+
interface SessionEventMap {
|
|
72
|
+
/**
|
|
73
|
+
* A resolved slash command entered its handler. Log-only (never model
|
|
74
|
+
* surface); paired with `command/done` by `commandId`, mirroring the
|
|
75
|
+
* `tool/call`↔`tool/result` pairing. The payload is structured — `name`
|
|
76
|
+
* and `args` are `parseCommand`'s own split (name and verbatim rawInput,
|
|
77
|
+
* separator whitespace included), so a consumer (a projection unit
|
|
78
|
+
* folding its own command records, a rich command card) never re-parses
|
|
79
|
+
* a line. `args` is absent when the definition sets `recordInput: false`
|
|
80
|
+
* because an authoritative domain event owns the input payload.
|
|
81
|
+
*/
|
|
82
|
+
'command/run': {
|
|
83
|
+
commandId: CommandId;
|
|
84
|
+
name: string;
|
|
85
|
+
args?: string;
|
|
86
|
+
source: CommandSource;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* The paired command settled. `kind`/`text` carry the handler's verbatim
|
|
90
|
+
* outcome (a thrown/aborted handler settles as `kind: 'error'` with the
|
|
91
|
+
* rendered failure). A successful command may identify the earlier
|
|
92
|
+
* authoritative domain event for a richer client-computed presentation.
|
|
93
|
+
*/
|
|
94
|
+
'command/done': {
|
|
95
|
+
commandId: CommandId;
|
|
96
|
+
kind: 'success' | 'error';
|
|
97
|
+
text?: string;
|
|
98
|
+
sourceEventSeq?: number;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Durable command event vocabulary and the registry's Cordis event
|
|
3
|
+
* declaration, shared with type-only consumers. Client-safe: nothing here
|
|
4
|
+
* reaches a Host-only symbol, so a Client compilation face reads the same
|
|
5
|
+
* `commands/change` signature the Host emits.
|
|
6
|
+
*
|
|
7
|
+
* @module @stackstackstack/dsh-commands/types
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=types.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stackstackstack/dsh-commands",
|
|
3
|
+
"description": "Plugin-owned human command registry for DeepSeek Harness UIs",
|
|
4
|
+
"version": "0.1.5",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
|
|
11
|
+
"directory": "packages/interaction/commands"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "lib/index.js",
|
|
15
|
+
"types": "lib/types/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"default": "./lib/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./invariant": {
|
|
22
|
+
"types": "./lib/types/invariant.d.ts",
|
|
23
|
+
"default": "./lib/invariant.js"
|
|
24
|
+
},
|
|
25
|
+
"./types": {
|
|
26
|
+
"types": "./lib/types/types.d.ts",
|
|
27
|
+
"default": "./lib/types/types.js"
|
|
28
|
+
},
|
|
29
|
+
"./brand": {
|
|
30
|
+
"types": "./lib/types/brand.d.ts",
|
|
31
|
+
"default": "./lib/types/brand.js"
|
|
32
|
+
},
|
|
33
|
+
"./typert": {
|
|
34
|
+
"types": "./lib/typert.host.d.ts",
|
|
35
|
+
"default": "./lib/typert.host.js"
|
|
36
|
+
},
|
|
37
|
+
"./remote": {
|
|
38
|
+
"types": "./lib/typert.remote-client.d.ts",
|
|
39
|
+
"default": "./lib/typert.remote-client.js"
|
|
40
|
+
},
|
|
41
|
+
"./src/*": "./src/*",
|
|
42
|
+
"./package.json": "./package.json"
|
|
43
|
+
},
|
|
44
|
+
"files": [
|
|
45
|
+
"lib/index.js",
|
|
46
|
+
"lib/invariant.js",
|
|
47
|
+
"lib/types/**/*.js",
|
|
48
|
+
"lib/types/**/*.d.ts",
|
|
49
|
+
"lib/typert.host.js",
|
|
50
|
+
"lib/typert.host.d.ts",
|
|
51
|
+
"lib/typert.remote-client.js",
|
|
52
|
+
"lib/typert.remote-client.d.ts"
|
|
53
|
+
],
|
|
54
|
+
"license": "MIT",
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"@stackstackstack/dsh-agent": "^0.1.5",
|
|
57
|
+
"@stackstackstack/dsh-invariants": "^0.1.5",
|
|
58
|
+
"@stackstackstack/dsh-scope": "^0.1.5",
|
|
59
|
+
"@stackstackstack/dsh-session": "^0.1.5",
|
|
60
|
+
"@stackstackstack/dsh-typert-protocol": "^0.1.5",
|
|
61
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
62
|
+
"@stackstackstack/dsh-brand": "^0.1.5"
|
|
63
|
+
},
|
|
64
|
+
"dependencies": {
|
|
65
|
+
"zod": "^4.4.3"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@stackstackstack/dsh-agent": "^0.1.5",
|
|
69
|
+
"@stackstackstack/dsh-invariants": "^0.1.5",
|
|
70
|
+
"@stackstackstack/dsh-brand": "^0.1.5",
|
|
71
|
+
"@stackstackstack/dsh-session": "^0.1.5",
|
|
72
|
+
"@stackstackstack/dsh-scope": "^0.1.5",
|
|
73
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
74
|
+
"@stackstackstack/dsh-typert-protocol": "^0.1.5"
|
|
75
|
+
}
|
|
76
|
+
}
|