dsh-working-activity 0.2.2 → 0.2.4
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/lib/types/index.d.ts +1 -18
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +11 -0
- package/lib/types/registration.d.ts +7 -0
- package/lib/types/registration.d.ts.map +1 -0
- package/lib/types/registration.js +47 -0
- package/package.json +107 -106
- package/src/index.ts +12 -1
- package/src/registration.ts +54 -0
- package/lib/client.js +0 -80
- package/lib/client.js.map +0 -1
package/lib/types/index.d.ts
CHANGED
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
* @module @deepseek-ai/dsh-working-activity
|
|
16
16
|
*/
|
|
17
17
|
import type { Context } from '@deepseek-ai/cordis';
|
|
18
|
-
import z from '@deepseek-ai/schemastery';
|
|
19
18
|
export type * from './events.js';
|
|
20
19
|
export declare const name = "working-activity";
|
|
21
20
|
/** Configurable knobs; every key has a sane default. */
|
|
@@ -41,23 +40,7 @@ export type Config = {
|
|
|
41
40
|
/** Inject the `⏵` self-narration contract into the system prompt and surface it. */
|
|
42
41
|
narrate?: boolean;
|
|
43
42
|
};
|
|
44
|
-
export declare const Config:
|
|
45
|
-
phrases: z<boolean, boolean>;
|
|
46
|
-
publish: z<boolean, boolean>;
|
|
47
|
-
tickMs: z<number, number>;
|
|
48
|
-
publishIntervalMs: z<number, number>;
|
|
49
|
-
detailLimit: z<number, number>;
|
|
50
|
-
customActions: z<import("@deepseek-ai/cosmokit").Dict<string[], string>, import("@deepseek-ai/cosmokit").Dict<string[], string>>;
|
|
51
|
-
narrate: z<boolean, boolean>;
|
|
52
|
-
}>, Schemastery.ObjectT<{
|
|
53
|
-
phrases: z<boolean, boolean>;
|
|
54
|
-
publish: z<boolean, boolean>;
|
|
55
|
-
tickMs: z<number, number>;
|
|
56
|
-
publishIntervalMs: z<number, number>;
|
|
57
|
-
detailLimit: z<number, number>;
|
|
58
|
-
customActions: z<import("@deepseek-ai/cosmokit").Dict<string[], string>, import("@deepseek-ai/cosmokit").Dict<string[], string>>;
|
|
59
|
-
narrate: z<boolean, boolean>;
|
|
60
|
-
}>>;
|
|
43
|
+
export declare const Config: Schemastery<Config>;
|
|
61
44
|
/**
|
|
62
45
|
* Wire the working-activity plugin.
|
|
63
46
|
* @param ctx - Cordis context (agent loop + session services composed).
|
package/lib/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAalD,mBAAmB,aAAa,CAAA;AAEhC,eAAO,MAAM,IAAI,qBAAqB,CAAA;AAEtC,wDAAwD;AACxD,MAAM,MAAM,MAAM,GAAG;IACnB,gEAAgE;IAChE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;;;mCAM+B;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,gFAAgF;IAChF,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oEAAoE;IACpE,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IACxC,oFAAoF;IACpF,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAMD,eAAO,MAAM,MAAM,EAAE,WAAW,CAAC,MAAM,CAQrC,CAAA;AAyBF;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,GAAE,MAAW,GAAG,IAAI,CA+H7D"}
|
package/lib/types/index.js
CHANGED
|
@@ -16,7 +16,12 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import z from '@deepseek-ai/schemastery';
|
|
18
18
|
import { ActivityTracker } from './status.js';
|
|
19
|
+
import { registerActivityEventType } from './registration.js';
|
|
19
20
|
export const name = 'working-activity';
|
|
21
|
+
// Explicit annotation: the inferred z.dict output references cosmokit's
|
|
22
|
+
// Dict through a pnpm-virtual path, which is not portable in declaration
|
|
23
|
+
// emit (TS2883) when the dependency graph shifts. The global `Schemastery`
|
|
24
|
+
// interface comes from schemastery's own d.ts (declare global).
|
|
20
25
|
export const Config = z.object({
|
|
21
26
|
phrases: z.boolean().default(true),
|
|
22
27
|
publish: z.boolean().default(false),
|
|
@@ -34,6 +39,12 @@ const NARRATE_INSTRUCTION = '[状态栏] 你有一个状态栏展示给用户。
|
|
|
34
39
|
* @param config - Validated plugin config (schema defaults applied).
|
|
35
40
|
*/
|
|
36
41
|
export function apply(ctx, config = {}) {
|
|
42
|
+
// Register the event type BEFORE anything can publish or validate: the
|
|
43
|
+
// strict read paths (resume seed validation, persistence load) refuse
|
|
44
|
+
// logs with unknown non-ignorable types. Registration is unconditional —
|
|
45
|
+
// it also protects READING logs written by an earlier publish:true era
|
|
46
|
+
// in processes where publishing itself is off. See registration.ts.
|
|
47
|
+
registerActivityEventType();
|
|
37
48
|
const resolved = {
|
|
38
49
|
phrases: config.phrases ?? true,
|
|
39
50
|
publish: config.publish ?? false,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Register `activity/status` as a known session-event type in every
|
|
3
|
+
* reachable dsh-session copy. Idempotent; silently skips anchors whose
|
|
4
|
+
* resolution fails.
|
|
5
|
+
*/
|
|
6
|
+
export declare function registerActivityEventType(): void;
|
|
7
|
+
//# sourceMappingURL=registration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registration.d.ts","sourceRoot":"","sources":["../../src/registration.ts"],"names":[],"mappings":"AAmCA;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAahD"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime registration of the `activity/status` session-event type.
|
|
3
|
+
*
|
|
4
|
+
* dsh-session's read paths (resume seed validation, persistence load)
|
|
5
|
+
* refuse any log containing a type outside KNOWN_SESSION_EVENT_TYPES unless
|
|
6
|
+
* every such event carries the envelope's `ignorable` marker — and
|
|
7
|
+
* `session.append()` exposes no ignorable flag, so this plugin's published
|
|
8
|
+
* snapshots used to make the whole session unresumable (and broke tolerant
|
|
9
|
+
* title reads). Upstream's catalog header defers a registration surface
|
|
10
|
+
* "until such a consumer exists" — this plugin is that consumer, so it
|
|
11
|
+
* registers its own type at load.
|
|
12
|
+
*
|
|
13
|
+
* Why "every reachable copy": a runtime can load dsh-session more than
|
|
14
|
+
* once. The dsh CLI tree and a plugin profile tree resolve different
|
|
15
|
+
* physical copies (e.g. rc.5 vs rc.6 during upgrade windows), and the
|
|
16
|
+
* strict validators consult only THEIR copy's Set. Registering through the
|
|
17
|
+
* plugin's own import alone would leave the validator's copy untouched.
|
|
18
|
+
* Anchors: this module (plugin/profile tree) and the process entry point
|
|
19
|
+
* (the CLI tree the persistence backend resolves from). A copy that cannot
|
|
20
|
+
* be resolved from an anchor simply is not there; registration never throws.
|
|
21
|
+
*
|
|
22
|
+
* Self-adjusting per the compat house rules: when upstream's generated
|
|
23
|
+
* catalog adopts `activity/status` (or a real registration API ships), the
|
|
24
|
+
* add() calls are no-ops and this module can be deleted.
|
|
25
|
+
* @module dsh-working-activity/registration
|
|
26
|
+
*/
|
|
27
|
+
import { createRequire } from 'node:module';
|
|
28
|
+
/** The session-event type this plugin publishes. */
|
|
29
|
+
const ACTIVITY_EVENT_TYPE = 'activity/status';
|
|
30
|
+
/**
|
|
31
|
+
* Register `activity/status` as a known session-event type in every
|
|
32
|
+
* reachable dsh-session copy. Idempotent; silently skips anchors whose
|
|
33
|
+
* resolution fails.
|
|
34
|
+
*/
|
|
35
|
+
export function registerActivityEventType() {
|
|
36
|
+
const anchors = [import.meta.url, process.argv[1]].filter((anchor) => typeof anchor === 'string' && anchor.length > 0);
|
|
37
|
+
for (const anchor of anchors) {
|
|
38
|
+
try {
|
|
39
|
+
const req = createRequire(anchor);
|
|
40
|
+
const mod = req('@deepseek-ai/dsh-session');
|
|
41
|
+
mod.KNOWN_SESSION_EVENT_TYPES?.add(ACTIVITY_EVENT_TYPE);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// No resolvable dsh-session copy from this anchor — nothing to register into.
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
package/package.json
CHANGED
|
@@ -1,106 +1,107 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dsh-working-activity",
|
|
3
|
-
"description": "Live model working-status line: playful copy, running tool, turn elapsed — for TUI prompt and Web UI",
|
|
4
|
-
"version": "0.2.
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "lib/types/index.js",
|
|
7
|
-
"types": "lib/types/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./lib/types/index.d.ts",
|
|
11
|
-
"default": "./lib/types/index.js"
|
|
12
|
-
},
|
|
13
|
-
"./client": {
|
|
14
|
-
"types": "./lib/types/client/index.d.ts",
|
|
15
|
-
"default": "./lib/client.js"
|
|
16
|
-
},
|
|
17
|
-
"./events": {
|
|
18
|
-
"types": "./lib/types/events.d.ts",
|
|
19
|
-
"default": "./lib/types/events.js"
|
|
20
|
-
},
|
|
21
|
-
"./invariant": {
|
|
22
|
-
"types": "./lib/types/invariant.d.ts",
|
|
23
|
-
"default": "./lib/types/invariant.js"
|
|
24
|
-
},
|
|
25
|
-
"./status": {
|
|
26
|
-
"types": "./lib/types/status.d.ts",
|
|
27
|
-
"default": "./lib/types/status.js"
|
|
28
|
-
},
|
|
29
|
-
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
30
|
-
"./src/*": "./src/*",
|
|
31
|
-
"./package.json": "./package.json"
|
|
32
|
-
},
|
|
33
|
-
"files": [
|
|
34
|
-
"lib",
|
|
35
|
-
"src",
|
|
36
|
-
"cordis.patch.yml"
|
|
37
|
-
],
|
|
38
|
-
"engines": {
|
|
39
|
-
"node": "^22.19 || >=24"
|
|
40
|
-
},
|
|
41
|
-
"scripts": {
|
|
42
|
-
"build": "tsc -p tsconfig.json && tsc -p tsconfig.client.json",
|
|
43
|
-
"build:client": "tsdown -c tsdown.config.ts"
|
|
44
|
-
},
|
|
45
|
-
"license": "BSD-3-Clause",
|
|
46
|
-
"dsh": {
|
|
47
|
-
"bundle": {
|
|
48
|
-
"patch": "./cordis.patch.yml"
|
|
49
|
-
},
|
|
50
|
-
"client": {
|
|
51
|
-
"platform": "web",
|
|
52
|
-
"inject": [
|
|
53
|
-
"@deepseek-ai/dsh-client-runtime",
|
|
54
|
-
"@deepseek-ai/dsh-client-ui-conversation",
|
|
55
|
-
"@deepseek-ai/dsh-client-ui-slots"
|
|
56
|
-
]
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
"dependencies": {
|
|
60
|
-
"@deepseek-ai/schemastery": "^3.18.1"
|
|
61
|
-
},
|
|
62
|
-
"peerDependencies": {
|
|
63
|
-
"@deepseek-ai/cordis": "^4.0.1",
|
|
64
|
-
"@deepseek-ai/dsh-agent": "^0.1.0-rc.6",
|
|
65
|
-
"@deepseek-ai/dsh-
|
|
66
|
-
"@deepseek-ai/dsh-
|
|
67
|
-
"@deepseek-ai/dsh-
|
|
68
|
-
"@deepseek-ai/dsh-
|
|
69
|
-
"@deepseek-ai/dsh-
|
|
70
|
-
"@deepseek-ai/dsh-
|
|
71
|
-
"react": "^18.2.0"
|
|
72
|
-
},
|
|
73
|
-
"devDependencies": {
|
|
74
|
-
"@deepseek-ai/cordis": "^4.0.1",
|
|
75
|
-
"@deepseek-ai/dsh-agent": "^0.1.0-rc.6",
|
|
76
|
-
"@deepseek-ai/dsh-agent-loop": "^0.1.0-rc.6",
|
|
77
|
-
"@deepseek-ai/dsh-agent-loop-testkit": "^0.1.0-rc.6",
|
|
78
|
-
"@deepseek-ai/dsh-
|
|
79
|
-
"@deepseek-ai/dsh-
|
|
80
|
-
"@deepseek-ai/dsh-
|
|
81
|
-
"@deepseek-ai/dsh-
|
|
82
|
-
"@deepseek-ai/dsh-
|
|
83
|
-
"@deepseek-ai/dsh-
|
|
84
|
-
"@deepseek-ai/dsh-
|
|
85
|
-
"@
|
|
86
|
-
"@types/
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-working-activity",
|
|
3
|
+
"description": "Live model working-status line: playful copy, running tool, turn elapsed — for TUI prompt and Web UI",
|
|
4
|
+
"version": "0.2.4",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/types/index.js",
|
|
7
|
+
"types": "lib/types/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./lib/types/index.d.ts",
|
|
11
|
+
"default": "./lib/types/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./client": {
|
|
14
|
+
"types": "./lib/types/client/index.d.ts",
|
|
15
|
+
"default": "./lib/client.js"
|
|
16
|
+
},
|
|
17
|
+
"./events": {
|
|
18
|
+
"types": "./lib/types/events.d.ts",
|
|
19
|
+
"default": "./lib/types/events.js"
|
|
20
|
+
},
|
|
21
|
+
"./invariant": {
|
|
22
|
+
"types": "./lib/types/invariant.d.ts",
|
|
23
|
+
"default": "./lib/types/invariant.js"
|
|
24
|
+
},
|
|
25
|
+
"./status": {
|
|
26
|
+
"types": "./lib/types/status.d.ts",
|
|
27
|
+
"default": "./lib/types/status.js"
|
|
28
|
+
},
|
|
29
|
+
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
30
|
+
"./src/*": "./src/*",
|
|
31
|
+
"./package.json": "./package.json"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"lib",
|
|
35
|
+
"src",
|
|
36
|
+
"cordis.patch.yml"
|
|
37
|
+
],
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": "^22.19 || >=24"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsc -p tsconfig.json && tsc -p tsconfig.client.json",
|
|
43
|
+
"build:client": "tsdown -c tsdown.config.ts"
|
|
44
|
+
},
|
|
45
|
+
"license": "BSD-3-Clause",
|
|
46
|
+
"dsh": {
|
|
47
|
+
"bundle": {
|
|
48
|
+
"patch": "./cordis.patch.yml"
|
|
49
|
+
},
|
|
50
|
+
"client": {
|
|
51
|
+
"platform": "web",
|
|
52
|
+
"inject": [
|
|
53
|
+
"@deepseek-ai/dsh-client-runtime",
|
|
54
|
+
"@deepseek-ai/dsh-client-ui-conversation",
|
|
55
|
+
"@deepseek-ai/dsh-client-ui-slots"
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"@deepseek-ai/schemastery": "^3.18.1"
|
|
61
|
+
},
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
64
|
+
"@deepseek-ai/dsh-agent": "^0.1.0-rc.6",
|
|
65
|
+
"@deepseek-ai/dsh-client-runtime": "^0.1.0-rc.6",
|
|
66
|
+
"@deepseek-ai/dsh-client-ui-conversation": "^0.1.0-rc.6",
|
|
67
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.6",
|
|
68
|
+
"@deepseek-ai/dsh-invariants": "^0.1.0-rc.6",
|
|
69
|
+
"@deepseek-ai/dsh-session": "^0.1.0-rc.6",
|
|
70
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.0-rc.6",
|
|
71
|
+
"react": "^18.2.0"
|
|
72
|
+
},
|
|
73
|
+
"devDependencies": {
|
|
74
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
75
|
+
"@deepseek-ai/dsh-agent": "^0.1.0-rc.6",
|
|
76
|
+
"@deepseek-ai/dsh-agent-loop": "^0.1.0-rc.6",
|
|
77
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "^0.1.0-rc.6",
|
|
78
|
+
"@deepseek-ai/dsh-client-runtime": "^0.1.0-rc.6",
|
|
79
|
+
"@deepseek-ai/dsh-client-ui-conversation": "^0.1.0-rc.6",
|
|
80
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.6",
|
|
81
|
+
"@deepseek-ai/dsh-invariants": "^0.1.0-rc.6",
|
|
82
|
+
"@deepseek-ai/dsh-llm": "^0.1.0-rc.6",
|
|
83
|
+
"@deepseek-ai/dsh-session": "^0.1.0-rc.6",
|
|
84
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.0-rc.6",
|
|
85
|
+
"@deepseek-ai/dsh-tools": "^0.1.0-rc.6",
|
|
86
|
+
"@types/node": "^22.0.0",
|
|
87
|
+
"@types/react": "~18.3.1",
|
|
88
|
+
"lightningcss": "^1.32.0",
|
|
89
|
+
"react": "^18.2.0",
|
|
90
|
+
"tsdown": "^0.22.2",
|
|
91
|
+
"typescript": "^6.0.3"
|
|
92
|
+
},
|
|
93
|
+
"peerDependenciesMeta": {
|
|
94
|
+
"@deepseek-ai/dsh-client-runtime": {
|
|
95
|
+
"optional": true
|
|
96
|
+
},
|
|
97
|
+
"@deepseek-ai/dsh-client-ui-conversation": {
|
|
98
|
+
"optional": true
|
|
99
|
+
},
|
|
100
|
+
"@deepseek-ai/dsh-client-ui-slots": {
|
|
101
|
+
"optional": true
|
|
102
|
+
},
|
|
103
|
+
"react": {
|
|
104
|
+
"optional": true
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -23,6 +23,7 @@ import type {} from '@deepseek-ai/dsh-agent'
|
|
|
23
23
|
// Type-only: resolves ctx.systemPrompt for the narration section injection.
|
|
24
24
|
import type {} from '@deepseek-ai/dsh-system-prompt'
|
|
25
25
|
import { ActivityTracker } from './status.js'
|
|
26
|
+
import { registerActivityEventType } from './registration.js'
|
|
26
27
|
import type { ActivityState } from './status.js'
|
|
27
28
|
import type { ActivityStatusEvent } from './events.js'
|
|
28
29
|
// Re-export the event type + SessionEventMap merge: the package root must carry
|
|
@@ -55,7 +56,11 @@ export type Config = {
|
|
|
55
56
|
narrate?: boolean
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
|
|
59
|
+
// Explicit annotation: the inferred z.dict output references cosmokit's
|
|
60
|
+
// Dict through a pnpm-virtual path, which is not portable in declaration
|
|
61
|
+
// emit (TS2883) when the dependency graph shifts. The global `Schemastery`
|
|
62
|
+
// interface comes from schemastery's own d.ts (declare global).
|
|
63
|
+
export const Config: Schemastery<Config> = z.object({
|
|
59
64
|
phrases: z.boolean().default(true),
|
|
60
65
|
publish: z.boolean().default(false),
|
|
61
66
|
tickMs: z.number().step(50).min(100).max(5000).default(500),
|
|
@@ -94,6 +99,12 @@ const NARRATE_INSTRUCTION =
|
|
|
94
99
|
* @param config - Validated plugin config (schema defaults applied).
|
|
95
100
|
*/
|
|
96
101
|
export function apply(ctx: Context, config: Config = {}): void {
|
|
102
|
+
// Register the event type BEFORE anything can publish or validate: the
|
|
103
|
+
// strict read paths (resume seed validation, persistence load) refuse
|
|
104
|
+
// logs with unknown non-ignorable types. Registration is unconditional —
|
|
105
|
+
// it also protects READING logs written by an earlier publish:true era
|
|
106
|
+
// in processes where publishing itself is off. See registration.ts.
|
|
107
|
+
registerActivityEventType()
|
|
97
108
|
const resolved: ResolvedConfig = {
|
|
98
109
|
phrases: config.phrases ?? true,
|
|
99
110
|
publish: config.publish ?? false,
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime registration of the `activity/status` session-event type.
|
|
3
|
+
*
|
|
4
|
+
* dsh-session's read paths (resume seed validation, persistence load)
|
|
5
|
+
* refuse any log containing a type outside KNOWN_SESSION_EVENT_TYPES unless
|
|
6
|
+
* every such event carries the envelope's `ignorable` marker — and
|
|
7
|
+
* `session.append()` exposes no ignorable flag, so this plugin's published
|
|
8
|
+
* snapshots used to make the whole session unresumable (and broke tolerant
|
|
9
|
+
* title reads). Upstream's catalog header defers a registration surface
|
|
10
|
+
* "until such a consumer exists" — this plugin is that consumer, so it
|
|
11
|
+
* registers its own type at load.
|
|
12
|
+
*
|
|
13
|
+
* Why "every reachable copy": a runtime can load dsh-session more than
|
|
14
|
+
* once. The dsh CLI tree and a plugin profile tree resolve different
|
|
15
|
+
* physical copies (e.g. rc.5 vs rc.6 during upgrade windows), and the
|
|
16
|
+
* strict validators consult only THEIR copy's Set. Registering through the
|
|
17
|
+
* plugin's own import alone would leave the validator's copy untouched.
|
|
18
|
+
* Anchors: this module (plugin/profile tree) and the process entry point
|
|
19
|
+
* (the CLI tree the persistence backend resolves from). A copy that cannot
|
|
20
|
+
* be resolved from an anchor simply is not there; registration never throws.
|
|
21
|
+
*
|
|
22
|
+
* Self-adjusting per the compat house rules: when upstream's generated
|
|
23
|
+
* catalog adopts `activity/status` (or a real registration API ships), the
|
|
24
|
+
* add() calls are no-ops and this module can be deleted.
|
|
25
|
+
* @module dsh-working-activity/registration
|
|
26
|
+
*/
|
|
27
|
+
import { createRequire } from 'node:module'
|
|
28
|
+
|
|
29
|
+
/** The session-event type this plugin publishes. */
|
|
30
|
+
const ACTIVITY_EVENT_TYPE = 'activity/status'
|
|
31
|
+
|
|
32
|
+
interface KnownTypesModule {
|
|
33
|
+
KNOWN_SESSION_EVENT_TYPES?: Set<string>
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Register `activity/status` as a known session-event type in every
|
|
38
|
+
* reachable dsh-session copy. Idempotent; silently skips anchors whose
|
|
39
|
+
* resolution fails.
|
|
40
|
+
*/
|
|
41
|
+
export function registerActivityEventType(): void {
|
|
42
|
+
const anchors = [import.meta.url, process.argv[1]].filter(
|
|
43
|
+
(anchor): anchor is string => typeof anchor === 'string' && anchor.length > 0,
|
|
44
|
+
)
|
|
45
|
+
for (const anchor of anchors) {
|
|
46
|
+
try {
|
|
47
|
+
const req = createRequire(anchor)
|
|
48
|
+
const mod = req('@deepseek-ai/dsh-session') as KnownTypesModule
|
|
49
|
+
mod.KNOWN_SESSION_EVENT_TYPES?.add(ACTIVITY_EVENT_TYPE)
|
|
50
|
+
} catch {
|
|
51
|
+
// No resolvable dsh-session copy from this anchor — nothing to register into.
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
package/lib/client.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
window.__ModuleLoader__.load({
|
|
2
|
-
id: "dsh-working-activity",
|
|
3
|
-
factory: (require) => {
|
|
4
|
-
var module = { exports: {} };
|
|
5
|
-
var exports = module.exports;
|
|
6
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
7
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
-
//#region \0dsh-css:D:\code\projects\dsh-working-activity\packages\activity\working-activity\src\client\WorkingLine.module.css.mjs
|
|
9
|
-
const css = ".lRI9Pa_line{box-sizing:border-box;width:100%;max-width:var(--dsh-composer-card-max-width);font-family:var(--dsw-font-family);color:var(--dsw-alias-label-secondary);align-items:center;gap:8px;margin:0 auto;padding:4px 16px 0;font-size:13px;line-height:18px;display:flex}.lRI9Pa_marker{background:var(--dsw-alias-label-tertiary);border-radius:50%;flex:none;width:7px;height:7px;animation:1.6s ease-in-out infinite lRI9Pa_working-pulse}.lRI9Pa_line[data-activity-phase=done] .lRI9Pa_marker{background:var(--dsw-alias-state-business-primary);animation:none}.lRI9Pa_line[data-activity-phase=tool] .lRI9Pa_marker{background:var(--dsw-alias-state-business-primary)}.lRI9Pa_line[data-activity-phase=waiting] .lRI9Pa_marker{background:var(--dsw-alias-label-tertiary);opacity:.6}.lRI9Pa_text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.lRI9Pa_tools{background:var(--dsw-alias-surface-tertiary);min-width:18px;color:var(--dsw-alias-label-secondary);text-align:center;border-radius:9px;flex:none;padding:0 5px;font-size:11px;line-height:18px}@keyframes lRI9Pa_working-pulse{0%,to{opacity:1}50%{opacity:.35}}";
|
|
10
|
-
const tagId = "dsh-working-activity/WorkingLine.module.css";
|
|
11
|
-
if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
|
|
12
|
-
const tag = document.createElement("style");
|
|
13
|
-
tag.dataset.plugin = "dsh-working-activity";
|
|
14
|
-
tag.dataset.pluginCss = tagId;
|
|
15
|
-
tag.textContent = css;
|
|
16
|
-
document.head.appendChild(tag);
|
|
17
|
-
}
|
|
18
|
-
var WorkingLine_module_css_default = {
|
|
19
|
-
"working-pulse": "lRI9Pa_working-pulse",
|
|
20
|
-
"line": "lRI9Pa_line",
|
|
21
|
-
"marker": "lRI9Pa_marker",
|
|
22
|
-
"text": "lRI9Pa_text",
|
|
23
|
-
"tools": "lRI9Pa_tools"
|
|
24
|
-
};
|
|
25
|
-
//#endregion
|
|
26
|
-
//#region src/client/WorkingLine.tsx
|
|
27
|
-
/** Tool-count badge copy (no locale seat: the line text itself is host-composed). */
|
|
28
|
-
const TOOLS_LABEL = "tools this turn";
|
|
29
|
-
/**
|
|
30
|
-
* Working-line dock entry: reads the latest activity snapshot off the
|
|
31
|
-
* conversation snapshot and renders the row, or nothing when idle/absent.
|
|
32
|
-
*/
|
|
33
|
-
function WorkingLine({ useSession }) {
|
|
34
|
-
const activity = useSession((s) => s.activity);
|
|
35
|
-
if (activity === null || activity.phase === "idle" || activity.line === "") return null;
|
|
36
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
37
|
-
className: WorkingLine_module_css_default.line,
|
|
38
|
-
"data-activity-phase": activity.phase,
|
|
39
|
-
children: [
|
|
40
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
41
|
-
className: WorkingLine_module_css_default.marker,
|
|
42
|
-
"aria-hidden": "true"
|
|
43
|
-
}),
|
|
44
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
45
|
-
className: WorkingLine_module_css_default.text,
|
|
46
|
-
children: activity.line
|
|
47
|
-
}),
|
|
48
|
-
activity.toolCount > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
49
|
-
className: WorkingLine_module_css_default.tools,
|
|
50
|
-
title: `${activity.toolCount} ${TOOLS_LABEL}`,
|
|
51
|
-
children: activity.toolCount
|
|
52
|
-
})
|
|
53
|
-
]
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
//#endregion
|
|
57
|
-
//#region src/client/index.ts
|
|
58
|
-
/** Required services for the dock registration. */
|
|
59
|
-
const inject = ["slots"];
|
|
60
|
-
/**
|
|
61
|
-
* Client plugin body: the working-line dock entry.
|
|
62
|
-
* @param ctx - client root context.
|
|
63
|
-
*/
|
|
64
|
-
function apply(ctx) {
|
|
65
|
-
ctx.slots.inject("conversation.input.dock", () => ctx.slots.register({
|
|
66
|
-
name: "conversation.input.dock",
|
|
67
|
-
id: "activity",
|
|
68
|
-
order: 15,
|
|
69
|
-
registrant: "dsh-working-activity"
|
|
70
|
-
}, WorkingLine));
|
|
71
|
-
}
|
|
72
|
-
//#endregion
|
|
73
|
-
exports.WorkingLine = WorkingLine;
|
|
74
|
-
exports.apply = apply;
|
|
75
|
-
exports.inject = inject;
|
|
76
|
-
return module.exports;
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
//# sourceMappingURL=client.js.map
|
package/lib/client.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["css"],"sources":["../src/client/WorkingLine.tsx","../src/client/index.ts"],"sourcesContent":["// Working-line dock entry: one dim full-width row above the composer card\r\n// showing the live working-activity snapshot — phase-colored breathing\r\n// marker, the host-composed status line, and the turn's tool count badge.\r\n// Renders for every live phase (waiting/thinking/tool) and the done summary;\r\n// hides while idle or before the first publish.\r\n//\r\n// The 'conversation.input.dock' SlotMap declaration lives in\r\n// @deepseek-ai/dsh-client-ui-conversation/client (contract/slots.ts); this\r\n// entry contributes into it without owning it.\r\nimport type { PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\r\nimport css from './WorkingLine.module.css'\r\n\r\n/** Full props of the dock entry: the input-zone runtime share (session standard kit). */\r\nexport type WorkingLineProps = PropsRuntime<'conversation.input.dock'>\r\n\r\n/** Tool-count badge copy (no locale seat: the line text itself is host-composed). */\r\nconst TOOLS_LABEL = 'tools this turn'\r\n\r\n/**\r\n * Working-line dock entry: reads the latest activity snapshot off the\r\n * conversation snapshot and renders the row, or nothing when idle/absent.\r\n */\r\nexport function WorkingLine({ useSession }: WorkingLineProps) {\r\n const activity = useSession(s => s.activity)\r\n if (activity === null || activity.phase === 'idle' || activity.line === '') return null\r\n return (\r\n <div className={css.line} data-activity-phase={activity.phase}>\r\n <span className={css.marker} aria-hidden=\"true\" />\r\n <span className={css.text}>{activity.line}</span>\r\n {activity.toolCount > 0 && (\r\n <span className={css.tools} title={`${activity.toolCount} ${TOOLS_LABEL}`}>\r\n {activity.toolCount}\r\n </span>\r\n )}\r\n </div>\r\n )\r\n}\r\n","/**\r\n * Working-activity surface plugin, browser half: the working-line entry in\r\n * the conversation.input.dock strip. This package's node half emits\r\n * `activity/status` session events; the web runtime patch narrows them into\r\n * the conversation snapshot's `activity` member, so this dock entry reads\r\n * the live frame through the standard session kit and owns no store, no\r\n * refresh chain, and no event listener.\r\n *\r\n * Mount contract (see the root README's \"Web UI 集成\" section): the web\r\n * client's client-modules host scans loader entries for `dsh.client`\r\n * declarations and serves this package's `./client` bundle at\r\n * /plugins/dsh-working-activity/client.js. The entry contributes into the\r\n * input dock — no official-source patch is involved.\r\n */\r\nimport type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'\r\n// Type-only: pulls the ui-conversation SlotMap merge (the input.dock entry)\r\n// through the Client assembly boundary.\r\nimport type {} from '@deepseek-ai/dsh-client-ui-conversation/client'\r\nimport { WorkingLine } from './WorkingLine.tsx'\r\nimport type { ActivityPhase, ActivitySnapshot } from './activity.ts'\r\n\r\nexport { WorkingLine, type WorkingLineProps } from './WorkingLine.tsx'\r\nexport type { ActivityPhase, ActivitySnapshot } from './activity.ts'\r\n\r\n/** Required services for the dock registration. */\r\nexport const inject = ['slots']\r\n\r\n/**\r\n * Client plugin body: the working-line dock entry.\r\n * @param ctx - client root context.\r\n */\r\nexport function apply(ctx: ClientContext): void {\r\n ctx.slots.inject('conversation.input.dock', () => ctx.slots.register({\r\n name: 'conversation.input.dock',\r\n // The pre-slots patch used the same id in ui-conversation; entries with\r\n // equal order render in registration order, and goal (10) / queue (20)\r\n // keep their seats — this row sits between them.\r\n id: 'activity',\r\n order: 15,\r\n registrant: 'dsh-working-activity',\r\n }, WorkingLine))\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBA,MAAM,cAAc;;;;;EAMpB,SAAgB,YAAY,EAAE,cAAgC;GAC5D,MAAM,WAAW,YAAW,MAAK,EAAE,QAAQ;GAC3C,IAAI,aAAa,QAAQ,SAAS,UAAU,UAAU,SAAS,SAAS,IAAI,OAAO;GACnF,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;IAAK,WAAWA,+BAAI;IAAM,uBAAqB,SAAS;IAAxD,UAAA;KACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;MAAM,WAAWA,+BAAI;MAAQ,eAAY;KAAQ,CAAA;KACjD,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;MAAM,WAAWA,+BAAI;MAAO,UAAA,SAAS;KAAW,CAAA;KAC/C,SAAS,YAAY,KACpB,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;MAAM,WAAWA,+BAAI;MAAO,OAAO,GAAG,SAAS,UAAU,GAAG;MACzD,UAAA,SAAS;KACN,CAAA;IAEL;;EAET;;;;ECXA,MAAa,SAAS,CAAC,OAAO;;;;;EAM9B,SAAgB,MAAM,KAA0B;GAC9C,IAAI,MAAM,OAAO,iCAAiC,IAAI,MAAM,SAAS;IACnE,MAAM;IAIN,IAAI;IACJ,OAAO;IACP,YAAY;GACd,GAAG,WAAW,CAAC;EACjB"}
|