dsh-account-authorization 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,231 @@
1
+ import { z } from 'zod';
2
+ export declare const TYPERT_REMOTE: {
3
+ package: string;
4
+ descriptors: ({
5
+ id: string;
6
+ service: string;
7
+ namespace: string;
8
+ method: string;
9
+ invocation: {
10
+ kind: string;
11
+ };
12
+ parameters: {
13
+ name: string;
14
+ wire: string;
15
+ source: string;
16
+ codec: {
17
+ mode: string;
18
+ typeSymbol: string;
19
+ schema: z.ZodObject<{
20
+ requestId: z.ZodReadonly<z.ZodString>;
21
+ attemptId: z.ZodReadonly<z.ZodString>;
22
+ }, z.core.$strip>;
23
+ };
24
+ }[];
25
+ result: {
26
+ mode: string;
27
+ typeSymbol: string;
28
+ schema: z.ZodObject<{
29
+ id: z.ZodReadonly<z.ZodString>;
30
+ connectionId: z.ZodReadonly<z.ZodString>;
31
+ revision: z.ZodReadonly<z.ZodNumber>;
32
+ notice: z.ZodOptional<z.ZodReadonly<z.ZodUnion<readonly [z.ZodUndefined, z.ZodObject<{
33
+ kind: z.ZodReadonly<z.ZodUnion<readonly [z.ZodLiteral<"browser">, z.ZodLiteral<"device">, z.ZodLiteral<"waiting">]>>;
34
+ url: z.ZodOptional<z.ZodReadonly<z.ZodUnion<readonly [z.ZodUndefined, z.ZodString]>>>;
35
+ code: z.ZodOptional<z.ZodReadonly<z.ZodUnion<readonly [z.ZodUndefined, z.ZodString]>>>;
36
+ }, z.core.$strip>]>>>;
37
+ prompt: z.ZodOptional<z.ZodReadonly<z.ZodUnion<readonly [z.ZodUndefined, z.ZodObject<{
38
+ id: z.ZodReadonly<z.ZodString>;
39
+ choices: z.ZodReadonly<z.ZodArray<z.ZodObject<{
40
+ id: z.ZodReadonly<z.ZodString>;
41
+ label: z.ZodReadonly<z.ZodString>;
42
+ kind: z.ZodReadonly<z.ZodUnion<readonly [z.ZodLiteral<"browser">, z.ZodLiteral<"device">, z.ZodLiteral<"other">]>>;
43
+ }, z.core.$strip>>>;
44
+ }, z.core.$strip>]>>>;
45
+ terminal: z.ZodOptional<z.ZodReadonly<z.ZodUnion<readonly [z.ZodUndefined, z.ZodObject<{
46
+ status: z.ZodReadonly<z.ZodUnion<readonly [z.ZodLiteral<"authorized">, z.ZodLiteral<"cancelled">]>>;
47
+ }, z.core.$strip>, z.ZodObject<{
48
+ status: z.ZodReadonly<z.ZodLiteral<"failed">>;
49
+ code: z.ZodReadonly<z.ZodUnion<readonly [z.ZodLiteral<"unavailable">, z.ZodLiteral<"unknown-method">, z.ZodLiteral<"in-flight">, z.ZodLiteral<"input-required">, z.ZodLiteral<"not-committed">, z.ZodLiteral<"flow-failed">]>>;
50
+ }, z.core.$strip>]>>>;
51
+ }, z.core.$strip>;
52
+ };
53
+ sourceLocation: {
54
+ file: string;
55
+ line: number;
56
+ column: number;
57
+ };
58
+ } | {
59
+ id: string;
60
+ service: string;
61
+ namespace: string;
62
+ method: string;
63
+ invocation: {
64
+ kind: string;
65
+ };
66
+ parameters: never[];
67
+ result: {
68
+ mode: string;
69
+ typeSymbol: string;
70
+ schema: z.ZodObject<{
71
+ connections: z.ZodReadonly<z.ZodArray<z.ZodObject<{
72
+ id: z.ZodReadonly<z.ZodString>;
73
+ label: z.ZodReadonly<z.ZodString>;
74
+ configured: z.ZodReadonly<z.ZodBoolean>;
75
+ inFlight: z.ZodReadonly<z.ZodBoolean>;
76
+ methods: z.ZodReadonly<z.ZodArray<z.ZodObject<{
77
+ id: z.ZodReadonly<z.ZodString>;
78
+ label: z.ZodReadonly<z.ZodString>;
79
+ kind: z.ZodReadonly<z.ZodUnion<readonly [z.ZodLiteral<"browser">, z.ZodLiteral<"device">, z.ZodLiteral<"other">]>>;
80
+ }, z.core.$strip>>>;
81
+ }, z.core.$strip>>>;
82
+ }, z.core.$strip>;
83
+ };
84
+ sourceLocation: {
85
+ file: string;
86
+ line: number;
87
+ column: number;
88
+ };
89
+ } | {
90
+ id: string;
91
+ service: string;
92
+ namespace: string;
93
+ method: string;
94
+ invocation: {
95
+ kind: string;
96
+ };
97
+ parameters: {
98
+ name: string;
99
+ wire: string;
100
+ source: string;
101
+ codec: {
102
+ mode: string;
103
+ typeSymbol: string;
104
+ schema: z.ZodObject<{
105
+ requestId: z.ZodReadonly<z.ZodString>;
106
+ connectionId: z.ZodReadonly<z.ZodString>;
107
+ }, z.core.$strip>;
108
+ };
109
+ }[];
110
+ result: {
111
+ mode: string;
112
+ typeSymbol: string;
113
+ schema: z.ZodObject<{
114
+ disconnected: z.ZodLiteral<true>;
115
+ }, z.core.$strip>;
116
+ };
117
+ sourceLocation: {
118
+ file: string;
119
+ line: number;
120
+ column: number;
121
+ };
122
+ } | {
123
+ id: string;
124
+ service: string;
125
+ namespace: string;
126
+ method: string;
127
+ invocation: {
128
+ kind: string;
129
+ };
130
+ parameters: {
131
+ name: string;
132
+ wire: string;
133
+ source: string;
134
+ codec: {
135
+ mode: string;
136
+ typeSymbol: string;
137
+ schema: z.ZodString;
138
+ };
139
+ }[];
140
+ result: {
141
+ mode: string;
142
+ typeSymbol: string;
143
+ schema: z.ZodObject<{
144
+ id: z.ZodReadonly<z.ZodString>;
145
+ connectionId: z.ZodReadonly<z.ZodString>;
146
+ revision: z.ZodReadonly<z.ZodNumber>;
147
+ notice: z.ZodOptional<z.ZodReadonly<z.ZodUnion<readonly [z.ZodUndefined, z.ZodObject<{
148
+ kind: z.ZodReadonly<z.ZodUnion<readonly [z.ZodLiteral<"browser">, z.ZodLiteral<"device">, z.ZodLiteral<"waiting">]>>;
149
+ url: z.ZodOptional<z.ZodReadonly<z.ZodUnion<readonly [z.ZodUndefined, z.ZodString]>>>;
150
+ code: z.ZodOptional<z.ZodReadonly<z.ZodUnion<readonly [z.ZodUndefined, z.ZodString]>>>;
151
+ }, z.core.$strip>]>>>;
152
+ prompt: z.ZodOptional<z.ZodReadonly<z.ZodUnion<readonly [z.ZodUndefined, z.ZodObject<{
153
+ id: z.ZodReadonly<z.ZodString>;
154
+ choices: z.ZodReadonly<z.ZodArray<z.ZodObject<{
155
+ id: z.ZodReadonly<z.ZodString>;
156
+ label: z.ZodReadonly<z.ZodString>;
157
+ kind: z.ZodReadonly<z.ZodUnion<readonly [z.ZodLiteral<"browser">, z.ZodLiteral<"device">, z.ZodLiteral<"other">]>>;
158
+ }, z.core.$strip>>>;
159
+ }, z.core.$strip>]>>>;
160
+ terminal: z.ZodOptional<z.ZodReadonly<z.ZodUnion<readonly [z.ZodUndefined, z.ZodObject<{
161
+ status: z.ZodReadonly<z.ZodUnion<readonly [z.ZodLiteral<"authorized">, z.ZodLiteral<"cancelled">]>>;
162
+ }, z.core.$strip>, z.ZodObject<{
163
+ status: z.ZodReadonly<z.ZodLiteral<"failed">>;
164
+ code: z.ZodReadonly<z.ZodUnion<readonly [z.ZodLiteral<"unavailable">, z.ZodLiteral<"unknown-method">, z.ZodLiteral<"in-flight">, z.ZodLiteral<"input-required">, z.ZodLiteral<"not-committed">, z.ZodLiteral<"flow-failed">]>>;
165
+ }, z.core.$strip>]>>>;
166
+ }, z.core.$strip>;
167
+ };
168
+ sourceLocation: {
169
+ file: string;
170
+ line: number;
171
+ column: number;
172
+ };
173
+ } | {
174
+ id: string;
175
+ service: string;
176
+ namespace: string;
177
+ method: string;
178
+ invocation: {
179
+ kind: string;
180
+ };
181
+ parameters: {
182
+ name: string;
183
+ wire: string;
184
+ source: string;
185
+ codec: {
186
+ mode: string;
187
+ typeSymbol: string;
188
+ schema: z.ZodObject<{
189
+ requestId: z.ZodReadonly<z.ZodString>;
190
+ connectionId: z.ZodReadonly<z.ZodString>;
191
+ method: z.ZodReadonly<z.ZodString>;
192
+ }, z.core.$strip>;
193
+ };
194
+ }[];
195
+ result: {
196
+ mode: string;
197
+ typeSymbol: string;
198
+ schema: z.ZodObject<{
199
+ id: z.ZodReadonly<z.ZodString>;
200
+ connectionId: z.ZodReadonly<z.ZodString>;
201
+ revision: z.ZodReadonly<z.ZodNumber>;
202
+ notice: z.ZodOptional<z.ZodReadonly<z.ZodUnion<readonly [z.ZodUndefined, z.ZodObject<{
203
+ kind: z.ZodReadonly<z.ZodUnion<readonly [z.ZodLiteral<"browser">, z.ZodLiteral<"device">, z.ZodLiteral<"waiting">]>>;
204
+ url: z.ZodOptional<z.ZodReadonly<z.ZodUnion<readonly [z.ZodUndefined, z.ZodString]>>>;
205
+ code: z.ZodOptional<z.ZodReadonly<z.ZodUnion<readonly [z.ZodUndefined, z.ZodString]>>>;
206
+ }, z.core.$strip>]>>>;
207
+ prompt: z.ZodOptional<z.ZodReadonly<z.ZodUnion<readonly [z.ZodUndefined, z.ZodObject<{
208
+ id: z.ZodReadonly<z.ZodString>;
209
+ choices: z.ZodReadonly<z.ZodArray<z.ZodObject<{
210
+ id: z.ZodReadonly<z.ZodString>;
211
+ label: z.ZodReadonly<z.ZodString>;
212
+ kind: z.ZodReadonly<z.ZodUnion<readonly [z.ZodLiteral<"browser">, z.ZodLiteral<"device">, z.ZodLiteral<"other">]>>;
213
+ }, z.core.$strip>>>;
214
+ }, z.core.$strip>]>>>;
215
+ terminal: z.ZodOptional<z.ZodReadonly<z.ZodUnion<readonly [z.ZodUndefined, z.ZodObject<{
216
+ status: z.ZodReadonly<z.ZodUnion<readonly [z.ZodLiteral<"authorized">, z.ZodLiteral<"cancelled">]>>;
217
+ }, z.core.$strip>, z.ZodObject<{
218
+ status: z.ZodReadonly<z.ZodLiteral<"failed">>;
219
+ code: z.ZodReadonly<z.ZodUnion<readonly [z.ZodLiteral<"unavailable">, z.ZodLiteral<"unknown-method">, z.ZodLiteral<"in-flight">, z.ZodLiteral<"input-required">, z.ZodLiteral<"not-committed">, z.ZodLiteral<"flow-failed">]>>;
220
+ }, z.core.$strip>]>>>;
221
+ }, z.core.$strip>;
222
+ };
223
+ sourceLocation: {
224
+ file: string;
225
+ line: number;
226
+ column: number;
227
+ };
228
+ })[];
229
+ };
230
+ export default TYPERT_REMOTE;
231
+ //# sourceMappingURL=remote.d.ts.map
@@ -0,0 +1,29 @@
1
+ /** Provider-neutral projection of Harness-owned authorization flows. */
2
+ import { Context } from '@deepseek-ai/cordis';
3
+ import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
4
+ import type { AccountConnectionsView, AuthorizationAttemptView, CancelAuthorizationRequest, ChooseAuthorizationRequest, DisconnectAccountRequest, StartAuthorizationRequest } from '../types.ts';
5
+ /** Host service. Harness remains the only owner of flows, attempts, credentials, Providers, and models. */
6
+ export declare class AccountAuthorizationService extends TypertRemoteService {
7
+ static inject: string[];
8
+ private readonly attempts;
9
+ private readonly startRequests;
10
+ private readonly disconnectRequests;
11
+ private readonly disconnectingConnections;
12
+ constructor(ctx: Context);
13
+ private flowByConnection;
14
+ private snapshot;
15
+ private changed;
16
+ private rememberCommand;
17
+ private trimAttempts;
18
+ private trimRequests;
19
+ connections(): Promise<AccountConnectionsView>;
20
+ start(request: StartAuthorizationRequest): AuthorizationAttemptView;
21
+ observe(attemptId: string): AuthorizationAttemptView;
22
+ choose(request: ChooseAuthorizationRequest): AuthorizationAttemptView;
23
+ cancel(request: CancelAuthorizationRequest): AuthorizationAttemptView;
24
+ disconnect(request: DisconnectAccountRequest): Promise<{
25
+ disconnected: true;
26
+ }>;
27
+ }
28
+ export default AccountAuthorizationService;
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { Context } from '@deepseek-ai/cordis';
2
+ import TargetPreservingAuthorizationService from './authorization-compat.ts';
3
+ import AccountAuthorizationService from './host/index.ts';
4
+ /** Mount one authorization owner, then the model-account Host projection. */
5
+ export declare function apply(ctx: Context): Promise<void>;
6
+ export default apply;
7
+ export { AccountAuthorizationService, TargetPreservingAuthorizationService };
8
+ export type * from './types.ts';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,65 @@
1
+ /** Browser-safe account authorization vocabulary. Credential keys and values never cross this boundary. */
2
+ export type AuthorizationMethodKind = 'browser' | 'device' | 'other';
3
+ export interface AuthorizationMethodView {
4
+ readonly id: string;
5
+ readonly label: string;
6
+ readonly kind: AuthorizationMethodKind;
7
+ }
8
+ export interface AccountConnectionView {
9
+ readonly id: string;
10
+ readonly label: string;
11
+ readonly configured: boolean;
12
+ readonly inFlight: boolean;
13
+ readonly methods: readonly AuthorizationMethodView[];
14
+ }
15
+ export interface AccountConnectionsView {
16
+ readonly connections: readonly AccountConnectionView[];
17
+ }
18
+ export interface AuthorizationNoticeView {
19
+ readonly kind: 'browser' | 'device' | 'waiting';
20
+ readonly url?: string;
21
+ readonly code?: string;
22
+ }
23
+ export interface AuthorizationChoiceView {
24
+ readonly id: string;
25
+ readonly label: string;
26
+ readonly kind: AuthorizationMethodKind;
27
+ }
28
+ export interface AuthorizationPromptView {
29
+ readonly id: string;
30
+ readonly choices: readonly AuthorizationChoiceView[];
31
+ }
32
+ export type AuthorizationTerminalView = {
33
+ readonly status: 'authorized' | 'cancelled';
34
+ } | {
35
+ readonly status: 'failed';
36
+ readonly code: 'unavailable' | 'unknown-method' | 'in-flight' | 'input-required' | 'not-committed' | 'flow-failed';
37
+ };
38
+ export interface AuthorizationAttemptView {
39
+ readonly id: string;
40
+ readonly connectionId: string;
41
+ readonly revision: number;
42
+ readonly notice?: AuthorizationNoticeView;
43
+ readonly prompt?: AuthorizationPromptView;
44
+ readonly terminal?: AuthorizationTerminalView;
45
+ }
46
+ export interface StartAuthorizationRequest {
47
+ readonly requestId: string;
48
+ readonly connectionId: string;
49
+ readonly method: string;
50
+ }
51
+ export interface ChooseAuthorizationRequest {
52
+ readonly requestId: string;
53
+ readonly attemptId: string;
54
+ readonly promptId: string;
55
+ readonly choice: string;
56
+ }
57
+ export interface CancelAuthorizationRequest {
58
+ readonly requestId: string;
59
+ readonly attemptId: string;
60
+ }
61
+ export interface DisconnectAccountRequest {
62
+ readonly requestId: string;
63
+ readonly connectionId: string;
64
+ }
65
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ export {}
package/package.json ADDED
@@ -0,0 +1,146 @@
1
+ {
2
+ "name": "dsh-account-authorization",
3
+ "version": "0.1.0",
4
+ "description": "Provider-neutral account authorization UI for DeepSeek Harness",
5
+ "type": "module",
6
+ "main": "lib/index.js",
7
+ "types": "lib/types/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./lib/types/index.d.ts",
11
+ "default": "./lib/index.js"
12
+ },
13
+ "./authorization-compat": {
14
+ "types": "./lib/types/authorization-compat.d.ts",
15
+ "default": "./lib/authorization-compat.js"
16
+ },
17
+ "./remote": {
18
+ "types": "./lib/types/generated/remote.d.ts",
19
+ "default": "./lib/typert.remote-client.js"
20
+ },
21
+ "./types": {
22
+ "types": "./lib/types/types.d.ts",
23
+ "default": "./lib/types/types.js"
24
+ },
25
+ "./typert": {
26
+ "types": "./lib/types/generated/host.d.ts",
27
+ "default": "./lib/typert.host.js"
28
+ },
29
+ "./client": "./lib/client.js",
30
+ "./cordis.patch.yml": "./cordis.patch.yml",
31
+ "./package.json": "./package.json"
32
+ },
33
+ "files": [
34
+ "lib/index.js",
35
+ "lib/host.js",
36
+ "lib/authorization-compat.js",
37
+ "lib/client.js",
38
+ "lib/client.js.map",
39
+ "lib/typert.host.js",
40
+ "lib/typert.remote-client.js",
41
+ "lib/types/types.js",
42
+ "lib/types/**/*.d.ts",
43
+ "cordis.patch.yml",
44
+ "README.md",
45
+ "README.zh-CN.md",
46
+ "LICENSE",
47
+ "SECURITY.md",
48
+ "THIRD_PARTY_NOTICES.md"
49
+ ],
50
+ "dsh": {
51
+ "bundle": {
52
+ "patch": "./cordis.patch.yml"
53
+ },
54
+ "client": {
55
+ "platform": "web",
56
+ "inject": [
57
+ "@deepseek-ai/dsh-client-runtime",
58
+ "@deepseek-ai/dsh-client-ui-settings",
59
+ "@deepseek-ai/dsh-client-ui-primitives",
60
+ "@deepseek-ai/dsh-client-ui-slots",
61
+ "@deepseek-ai/dsh-client-locale"
62
+ ]
63
+ }
64
+ },
65
+ "scripts": {
66
+ "build": "pnpm generate:typert && tsc -p tsconfig.host.json && tsc -p tsconfig.client.json && tsdown --config build/tsdown.config.mjs && node build/normalize-artifacts.mjs",
67
+ "generate:typert": "node build/generate-typert.mjs",
68
+ "typecheck": "tsc -p tsconfig.host.json --noEmit && tsc -p tsconfig.client.json --noEmit",
69
+ "test": "vitest run",
70
+ "test:reproducible": "node build/check-reproducible.mjs",
71
+ "prepack": "pnpm build",
72
+ "pack:check": "pnpm pack --dry-run"
73
+ },
74
+ "keywords": [
75
+ "deepseek-harness",
76
+ "dsh-plugin",
77
+ "provider-authorization",
78
+ "oauth"
79
+ ],
80
+ "license": "MIT",
81
+ "repository": {
82
+ "type": "git",
83
+ "url": "git+https://github.com/lxy271713/dsh-account-authorization.git"
84
+ },
85
+ "homepage": "https://github.com/lxy271713/dsh-account-authorization#readme",
86
+ "bugs": {
87
+ "url": "https://github.com/lxy271713/dsh-account-authorization/issues"
88
+ },
89
+ "publishConfig": {
90
+ "access": "public"
91
+ },
92
+ "dependencies": {
93
+ "zod": "^4.4.3"
94
+ },
95
+ "peerDependencies": {
96
+ "@deepseek-ai/cordis": "4.0.1",
97
+ "@deepseek-ai/dsh-authorization": "0.1.1-rc.2",
98
+ "@deepseek-ai/dsh-credentials": "0.1.1-rc.2",
99
+ "@deepseek-ai/dsh-typert-protocol": "0.1.1-rc.2",
100
+ "@deepseek-ai/dsh-client-runtime": "0.1.1-rc.2",
101
+ "@deepseek-ai/dsh-client-ui-settings": "0.1.1-rc.2",
102
+ "@deepseek-ai/dsh-client-ui-primitives": "0.1.1-rc.2",
103
+ "@deepseek-ai/dsh-client-ui-slots": "0.1.1-rc.2",
104
+ "@deepseek-ai/dsh-client-locale": "0.1.1-rc.2",
105
+ "react": "^18.2.0"
106
+ },
107
+ "peerDependenciesMeta": {
108
+ "@deepseek-ai/cordis": { "optional": true },
109
+ "@deepseek-ai/dsh-authorization": { "optional": true },
110
+ "@deepseek-ai/dsh-credentials": { "optional": true },
111
+ "@deepseek-ai/dsh-typert-protocol": { "optional": true },
112
+ "@deepseek-ai/dsh-client-runtime": { "optional": true },
113
+ "@deepseek-ai/dsh-client-ui-settings": { "optional": true },
114
+ "@deepseek-ai/dsh-client-ui-primitives": { "optional": true },
115
+ "@deepseek-ai/dsh-client-ui-slots": { "optional": true },
116
+ "@deepseek-ai/dsh-client-locale": { "optional": true },
117
+ "react": { "optional": true }
118
+ },
119
+ "devDependencies": {
120
+ "@deepseek-ai/cordis": "4.0.1",
121
+ "@deepseek-ai/dsh-authorization": "0.1.1-rc.2",
122
+ "@deepseek-ai/dsh-credentials": "0.1.1-rc.2",
123
+ "@deepseek-ai/dsh-typert-generator": "0.1.1-rc.2",
124
+ "@deepseek-ai/dsh-typert-protocol": "0.1.1-rc.2",
125
+ "@deepseek-ai/dsh-client-runtime": "0.1.1-rc.2",
126
+ "@deepseek-ai/dsh-client-ui-settings": "0.1.1-rc.2",
127
+ "@deepseek-ai/dsh-client-ui-primitives": "0.1.1-rc.2",
128
+ "@deepseek-ai/dsh-client-ui-slots": "0.1.1-rc.2",
129
+ "@deepseek-ai/dsh-client-locale": "0.1.1-rc.2",
130
+ "@testing-library/react": "^16.1.0",
131
+ "@types/node": "^24.0.0",
132
+ "@types/react": "~18.3.1",
133
+ "@types/react-dom": "~18.3.1",
134
+ "happy-dom": "20.11.2",
135
+ "lightningcss": "^1.30.2",
136
+ "react": "^18.2.0",
137
+ "react-dom": "^18.2.0",
138
+ "tsdown": "^0.21.0",
139
+ "typescript": "^6.0.3",
140
+ "vitest": "^3.2.4"
141
+ },
142
+ "engines": {
143
+ "node": "^22.19.0 || >=24"
144
+ },
145
+ "packageManager": "pnpm@11.19.0"
146
+ }