@sixzjd/dsh-workbuddy-connect 0.0.0-stage → 0.3.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,91 @@
1
+ /**
2
+ * The two WorkBuddy products this one plugin serves.
3
+ *
4
+ * Both are the same client framework in different regions, and they differ by
5
+ * upstream realm, catalog endpoint, and display identity. Everything that
6
+ * varies between them is collected here as one descriptor, so no module has to
7
+ * carry its own `if (international)` branch and a third variant would be a data
8
+ * change rather than a refactor.
9
+ *
10
+ * Each variant signs in independently, through its own realm's device
11
+ * authorization flow. The two therefore never share a credential, and a realm
12
+ * that is unreachable from the user's network (the international one, from some
13
+ * mainland networks) cannot block the other's login.
14
+ *
15
+ * @module dsh-workbuddy-connect/variants
16
+ */
17
+
18
+ /** One WorkBuddy product variant. */
19
+ export const WORKBUDDY_VARIANTS = [
20
+ {
21
+ /** Provider id registered with DSH. */
22
+ id: 'workbuddy',
23
+ /** Model-group heading and card title stem. */
24
+ displayName: 'WorkBuddy',
25
+ /** Product name as users know it, for diagnostics and error copy. */
26
+ appName: 'WorkBuddy',
27
+ /** Which upstream realm this variant's credentials must belong to. */
28
+ region: 'cn',
29
+ /** The id every model of this route advertises. */
30
+ modelIdentity: 'workbuddy',
31
+ /** Basename of the plugin-owned credential file under the data dir. */
32
+ authFilename: '.workbuddy-auth.json',
33
+ /** Basename of the plugin-owned saved-catalog file under the state dir. */
34
+ catalogFilename: '.workbuddy-catalog.json',
35
+ /** Basename of the plugin-owned settings file under the data dir. */
36
+ settingsFilename: '.workbuddy-settings.json',
37
+ /** Site the human signs in at. */
38
+ signInUrl: 'https://www.codebuddy.cn',
39
+ },
40
+ {
41
+ id: 'workbuddy-global',
42
+ modelIdentity: 'workbuddy',
43
+ displayName: 'WorkBuddy AI',
44
+ appName: 'WorkBuddy AI',
45
+ region: 'global',
46
+ authFilename: '.workbuddy-ai-auth.json',
47
+ catalogFilename: '.workbuddy-ai-catalog.json',
48
+ settingsFilename: '.workbuddy-ai-settings.json',
49
+ signInUrl: 'https://www.workbuddy.ai',
50
+ },
51
+ ]
52
+
53
+ /**
54
+ * The model identity every WorkBuddy model advertises.
55
+ *
56
+ * Deliberately NOT the same string as a route id: a message is only
57
+ * "same-model" when provider, api AND model id all match, so the identity has
58
+ * to be shared for a transcript to keep its thinking blocks when the user
59
+ * switches region — and it must not be reachable as a route a user could pick,
60
+ * because it names one model, not one gateway.
61
+ *
62
+ * The international route is therefore `workbuddy-global` and the identity
63
+ * `workbuddy`; the CN route is `workbuddy` and happens to share the name.
64
+ */
65
+ export const WORKBUDDY_MODEL_IDENTITY = 'workbuddy'
66
+
67
+ /**
68
+ * Registry keys an adapter serving `providerId` must publish so that every
69
+ * stamp its models carry resolves inside its own region.
70
+ *
71
+ * The route id first, then the model identity, de-duplicated — route-first so
72
+ * `profiles()` opens with the route the adapter actually serves. CN yields one
73
+ * key (`workbuddy` is both its route and the shared identity) and the
74
+ * international region yields two (`workbuddy-global`, `workbuddy`); each
75
+ * region must publish the shared one, or every request in that region dies
76
+ * with `Unknown provider: workbuddy` before a byte is sent.
77
+ */
78
+ export function modelIdentityKeysOf(providerId, identity = WORKBUDDY_MODEL_IDENTITY) {
79
+ return [...new Set([providerId, identity].filter(key => key !== undefined))]
80
+ }
81
+
82
+ /** The international variant — the one this plugin leads with. */
83
+ export const GLOBAL_VARIANT = WORKBUDDY_VARIANTS[1]
84
+
85
+ /** The CN variant. */
86
+ export const CN_VARIANT = WORKBUDDY_VARIANTS[0]
87
+
88
+ /** Look up a variant by provider id. */
89
+ export function variantFor(id) {
90
+ return WORKBUDDY_VARIANTS.find(variant => variant.id === id)
91
+ }
package/locale/en.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "WorkBuddy",
4
+ "description": "Connect WorkBuddy models: device-authorization sign-in, model catalog and toggles, quota view."
5
+ }
6
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "WorkBuddy",
4
+ "description": "接入 WorkBuddy 模型:设备授权登录、模型目录与开关、额度查看。"
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,6 +1,61 @@
1
1
  {
2
2
  "name": "@sixzjd/dsh-workbuddy-connect",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "displayName": "WorkBuddy",
4
+ "description": "将 WorkBuddy(国际版 / 国内版)的模型接入 DeepSeek Harness — bring WorkBuddy (Global & CN) models into DeepSeek Harness.",
5
+ "icon": "./assets/icon.svg",
6
+ "version": "0.3.0",
7
+ "author": "sunzhengnan",
8
+ "keywords": [
9
+ "dsh-plugin",
10
+ "deepseek-harness",
11
+ "workbuddy",
12
+ "workbuddy-ai",
13
+ "codebuddy",
14
+ "model-provider"
15
+ ],
16
+ "type": "module",
17
+ "main": "lib/index.js",
18
+ "exports": {
19
+ ".": {
20
+ "default": "./lib/index.js"
21
+ },
22
+ "./client": {
23
+ "default": "./client.js"
24
+ },
25
+ "./cordis.patch.yml": "./cordis.patch.yml",
26
+ "./package.json": "./package.json",
27
+ "./locale/*.json": "./locale/*.json"
28
+ },
29
+ "files": [
30
+ "lib",
31
+ "client.js",
32
+ "cordis.patch.yml",
33
+ "locale",
34
+ "assets",
35
+ "README.md",
36
+ "README.en.md",
37
+ "LICENSE"
38
+ ],
39
+ "engines": {
40
+ "dsh": ">=0.2.0-rc.2",
41
+ "node": "^22.19.0 || >=24.0.0"
42
+ },
43
+ "license": "MIT",
44
+ "dsh": {
45
+ "bundle": {
46
+ "patch": "./cordis.patch.yml"
47
+ },
48
+ "client": {
49
+ "platform": "web",
50
+ "inject": [
51
+ "@deepseek-ai/dsh-client-ui-slots",
52
+ "@deepseek-ai/dsh-client-ui-primitives"
53
+ ]
54
+ }
55
+ },
56
+ "peerDependencies": {
57
+ "@deepseek-ai/dsh-llm": ">=0.2.0-rc.2",
58
+ "@deepseek-ai/dsh-llm-pi-ai": ">=0.2.0-rc.2",
59
+ "@earendil-works/pi-ai": ">=0.85.1"
60
+ }
61
+ }