@eddyskywalker/dsh-chatgpt-subscription 0.30.0 → 0.32.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.
Files changed (110) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +64 -1
  3. package/lib/client.js +34034 -2768
  4. package/lib/client.js.map +1 -1
  5. package/lib/index.js +33214 -24259
  6. package/lib/types/client/cline-pass/ClinePassComposerQuota.d.ts +20 -0
  7. package/lib/types/client/cline-pass/ClinePassComposerQuota.d.ts.map +1 -0
  8. package/lib/types/client/cline-pass/ClinePassSection.d.ts +17 -0
  9. package/lib/types/client/cline-pass/ClinePassSection.d.ts.map +1 -0
  10. package/lib/types/client/cline-pass/api.d.ts +84 -0
  11. package/lib/types/client/cline-pass/api.d.ts.map +1 -0
  12. package/lib/types/client/cline-pass/locales.d.ts +1025 -0
  13. package/lib/types/client/cline-pass/locales.d.ts.map +1 -0
  14. package/lib/types/client/cline-pass/styles.d.ts +7 -0
  15. package/lib/types/client/cline-pass/styles.d.ts.map +1 -0
  16. package/lib/types/client/hub/brand-icons.d.ts +2 -2
  17. package/lib/types/client/hub/brand-icons.d.ts.map +1 -1
  18. package/lib/types/client/hub/providers.d.ts.map +1 -1
  19. package/lib/types/client/index.d.ts +2 -0
  20. package/lib/types/client/index.d.ts.map +1 -1
  21. package/lib/types/client/mermaid/renderer.d.ts +23 -0
  22. package/lib/types/client/mermaid/renderer.d.ts.map +1 -1
  23. package/lib/types/client/minimax-code/MinimaxCodeSection.d.ts.map +1 -1
  24. package/lib/types/client/minimax-code/MinimaxVideoDocumentBody.d.ts +86 -0
  25. package/lib/types/client/minimax-code/MinimaxVideoDocumentBody.d.ts.map +1 -0
  26. package/lib/types/client/minimax-code/MinimaxVideoToolView.d.ts +83 -0
  27. package/lib/types/client/minimax-code/MinimaxVideoToolView.d.ts.map +1 -0
  28. package/lib/types/client/minimax-code/VideoFormDialog.d.ts +90 -0
  29. package/lib/types/client/minimax-code/VideoFormDialog.d.ts.map +1 -0
  30. package/lib/types/client/minimax-code/VideoSettingsSections.d.ts +73 -0
  31. package/lib/types/client/minimax-code/VideoSettingsSections.d.ts.map +1 -0
  32. package/lib/types/client/minimax-code/commands-contract.d.ts +35 -0
  33. package/lib/types/client/minimax-code/commands-contract.d.ts.map +1 -0
  34. package/lib/types/client/minimax-code/document-preview.d.ts +45 -0
  35. package/lib/types/client/minimax-code/document-preview.d.ts.map +1 -0
  36. package/lib/types/client/minimax-code/locales.d.ts +206 -2
  37. package/lib/types/client/minimax-code/locales.d.ts.map +1 -1
  38. package/lib/types/client/minimax-code/styles.d.ts.map +1 -1
  39. package/lib/types/client/minimax-code/video-command-host.d.ts +61 -0
  40. package/lib/types/client/minimax-code/video-command-host.d.ts.map +1 -0
  41. package/lib/types/client/minimax-code/video-command.d.ts +126 -0
  42. package/lib/types/client/minimax-code/video-command.d.ts.map +1 -0
  43. package/lib/types/client/minimax-code/video-contract.d.ts +208 -0
  44. package/lib/types/client/minimax-code/video-contract.d.ts.map +1 -0
  45. package/lib/types/client/minimax-code/video-defaults-store.d.ts +61 -0
  46. package/lib/types/client/minimax-code/video-defaults-store.d.ts.map +1 -0
  47. package/lib/types/client/minimax-code/video-form-rules.d.ts +288 -0
  48. package/lib/types/client/minimax-code/video-form-rules.d.ts.map +1 -0
  49. package/lib/types/client/minimax-code/video-media.d.ts +61 -0
  50. package/lib/types/client/minimax-code/video-media.d.ts.map +1 -0
  51. package/lib/types/client/minimax-code/video-slots.d.ts +140 -0
  52. package/lib/types/client/minimax-code/video-slots.d.ts.map +1 -0
  53. package/lib/types/client/progress-updates/markdown-lite.d.ts +19 -6
  54. package/lib/types/client/progress-updates/markdown-lite.d.ts.map +1 -1
  55. package/lib/types/host/antigravity/adapter.d.ts.map +1 -1
  56. package/lib/types/host/cline-pass/account-pool.d.ts +63 -0
  57. package/lib/types/host/cline-pass/account-pool.d.ts.map +1 -0
  58. package/lib/types/host/cline-pass/adapter.d.ts +49 -0
  59. package/lib/types/host/cline-pass/adapter.d.ts.map +1 -0
  60. package/lib/types/host/cline-pass/catalog.d.ts +49 -0
  61. package/lib/types/host/cline-pass/catalog.d.ts.map +1 -0
  62. package/lib/types/host/cline-pass/client.d.ts +118 -0
  63. package/lib/types/host/cline-pass/client.d.ts.map +1 -0
  64. package/lib/types/host/cline-pass/engine.d.ts +223 -0
  65. package/lib/types/host/cline-pass/engine.d.ts.map +1 -0
  66. package/lib/types/host/cline-pass/line.d.ts +55 -0
  67. package/lib/types/host/cline-pass/line.d.ts.map +1 -0
  68. package/lib/types/host/cline-pass/mapper.d.ts +112 -0
  69. package/lib/types/host/cline-pass/mapper.d.ts.map +1 -0
  70. package/lib/types/host/cline-pass/oauth.d.ts +134 -0
  71. package/lib/types/host/cline-pass/oauth.d.ts.map +1 -0
  72. package/lib/types/host/cline-pass/protocol.d.ts +186 -0
  73. package/lib/types/host/cline-pass/protocol.d.ts.map +1 -0
  74. package/lib/types/host/cline-pass/routes.d.ts +71 -0
  75. package/lib/types/host/cline-pass/routes.d.ts.map +1 -0
  76. package/lib/types/host/cline-pass/store.d.ts +97 -0
  77. package/lib/types/host/cline-pass/store.d.ts.map +1 -0
  78. package/lib/types/host/cline-pass/token-store.d.ts +168 -0
  79. package/lib/types/host/cline-pass/token-store.d.ts.map +1 -0
  80. package/lib/types/host/cline-pass/tools.d.ts +21 -0
  81. package/lib/types/host/cline-pass/tools.d.ts.map +1 -0
  82. package/lib/types/host/cline-pass/types.d.ts +168 -0
  83. package/lib/types/host/cline-pass/types.d.ts.map +1 -0
  84. package/lib/types/host/common/model-request-control.d.ts +1 -1
  85. package/lib/types/host/common/model-request-control.d.ts.map +1 -1
  86. package/lib/types/host/common/request-diagnostics.d.ts +1 -1
  87. package/lib/types/host/common/request-diagnostics.d.ts.map +1 -1
  88. package/lib/types/host/minimax-code/client.d.ts.map +1 -1
  89. package/lib/types/host/minimax-code/iso-bmff-duration.d.ts +84 -0
  90. package/lib/types/host/minimax-code/iso-bmff-duration.d.ts.map +1 -0
  91. package/lib/types/host/minimax-code/matrix-client.d.ts +168 -0
  92. package/lib/types/host/minimax-code/matrix-client.d.ts.map +1 -0
  93. package/lib/types/host/minimax-code/media-store.d.ts +153 -0
  94. package/lib/types/host/minimax-code/media-store.d.ts.map +1 -0
  95. package/lib/types/host/minimax-code/routes.d.ts.map +1 -1
  96. package/lib/types/host/minimax-code/video-history.d.ts +240 -0
  97. package/lib/types/host/minimax-code/video-history.d.ts.map +1 -0
  98. package/lib/types/host/minimax-code/video-submit-rules.d.ts +40 -0
  99. package/lib/types/host/minimax-code/video-submit-rules.d.ts.map +1 -0
  100. package/lib/types/host/minimax-code/video-tool.d.ts +757 -0
  101. package/lib/types/host/minimax-code/video-tool.d.ts.map +1 -0
  102. package/lib/types/host/progress-updates/index.d.ts +6 -0
  103. package/lib/types/host/progress-updates/index.d.ts.map +1 -1
  104. package/lib/types/host/progress-updates/projection.d.ts +214 -0
  105. package/lib/types/host/progress-updates/projection.d.ts.map +1 -0
  106. package/lib/types/index.d.ts +12 -0
  107. package/lib/types/index.d.ts.map +1 -1
  108. package/lib/types/shared/cline-pass-contracts.d.ts +267 -0
  109. package/lib/types/shared/cline-pass-contracts.d.ts.map +1 -0
  110. package/package.json +14 -4
@@ -0,0 +1,140 @@
1
+ /**
2
+ * 本线路用到的槽位声明与浏览器侧服务面。
3
+ *
4
+ * `tool.call.toolview` 不在这里重复声明:它由本插件已安装的 ui-tool 合并进
5
+ * `SlotMap`,同一格写两次形状不同就是编译错误。
6
+ *
7
+ * `sidebar.right.tab.document` 由 `@deepseek-ai/dsh-client-ui-sidebar-documentpreview`
8
+ * 提供,而那个包**不是本插件的依赖**(`package.json` 的 `dsh.client.inject` 只声明
9
+ * 运行期顺序,不是编译期依赖)。为了两行注册去依赖整个文档预览包,等于把一个可选
10
+ * 能力变成硬依赖,所以这里按平台同形把它**声明**出来——运行语义完全由平台的槽位
11
+ * 注册表决定,这里只是让 `register` / `inject` 的实参过类型检查。
12
+ * 这与 `../progress-updates/contracts.ts` 对 `sidebar.right.pane.tab` 的处理一致。
13
+ *
14
+ * 刻意**不**合并 cordis 的 `Context`:只要 `src/client/**` 里出现一条那样的
15
+ * augmentation,cordis 自己的 `interface Context extends Pick<Fiber, 'effect'>`
16
+ * 就会整片失效(`../progress-updates/contracts.ts` 末尾记了这个坑)。
17
+ * 所以 `documentPreviews` / `remote` 一律经 `ctx.get(name)` 取回再窄化。
18
+ *
19
+ * @module @eddyskywalker/dsh-chatgpt-subscription/client/minimax-code/video-slots
20
+ */
21
+ /** 一份 `DocumentPreviewDefinition` 在运行期的形状(宿主 `document/registry.ts` 同形)。 */
22
+ export interface DocumentPreviewRegistration {
23
+ /** 唯一实现名,同时是文档槽的键。 */
24
+ readonly id: string;
25
+ /** 认领的文件后缀(不带点)。 */
26
+ readonly extensions: readonly string[];
27
+ /** 其中字节不可当文本读的后缀,必须是 `extensions` 的子集。 */
28
+ readonly binaryExtensions?: readonly string[];
29
+ /** 外部实现优先于内置实现。 */
30
+ readonly priority?: 'builtin' | 'extension';
31
+ /** 页签上的实现名,渲染时求值。 @returns 可见名称。 */
32
+ readonly title: () => string;
33
+ /** 内容下发方式。 */
34
+ readonly loading: 'text-pages' | 'bytes-complete' | 'renderer';
35
+ /** 是否消费文档的换行偏好。 */
36
+ readonly wrap?: boolean;
37
+ }
38
+ /** `ctx.documentPreviews` 的注册面。 */
39
+ export interface DocumentPreviewRegistryService {
40
+ /**
41
+ * 注册一个实现。
42
+ * @param definition - 静态声明;`binaryExtensions` 越界或 id 重复都会抛。
43
+ * @returns 幂等卸载函数。
44
+ */
45
+ register(definition: DocumentPreviewRegistration): () => void;
46
+ }
47
+ /**
48
+ * 一次远端调用声明的失败。
49
+ *
50
+ * 形状与宿主的 `RemoteError` 一致:稳定的 `code`、一句 `message`,以及该码
51
+ * 专属的结构化 `details`。判定只看 `code`,不看 `message` 里的英文。
52
+ */
53
+ export interface RemoteFailure {
54
+ /** 稳定的失败码,如 `workspace-file/too-large`。 */
55
+ readonly code: string;
56
+ /** 人读的诊断信息。 */
57
+ readonly message?: string;
58
+ /** 该码专属的结构化载荷(如 too-large 的 `limit`)。 */
59
+ readonly details?: unknown;
60
+ }
61
+ /**
62
+ * 一次远端调用的结果:**成功给值,失败给原因**。
63
+ *
64
+ * 远端调用不抛异常——宿主把它声明的失败装进结果里(见
65
+ * `@deepseek-ai/dsh-typert-protocol` 的 `RemoteResult`)。所以读字节的人
66
+ * 必须先看 `ok`,再去 `value`;直接读 `(await call()).data` 拿到的是
67
+ * `undefined`,而界面会把「没拿到字节」显示成「一直在读」。
68
+ */
69
+ export type RemoteResult<T> = {
70
+ readonly ok: true;
71
+ readonly value: T;
72
+ } | {
73
+ readonly ok: false;
74
+ readonly error: RemoteFailure;
75
+ };
76
+ /**
77
+ * 宿主交回来的字节载荷。
78
+ *
79
+ * **两代形状**:≤0.1.6 的宿主把字节编成 base64 字符串(宿主
80
+ * `readAll`/`readBytes` 返回 `data: string`),≥0.1.7 的宿主直接给
81
+ * `Uint8Array`(`packages/api/workspace-files/src/types.ts` 的
82
+ * `WorkspaceFileBytes.data`)。本插件支持两代,所以两种都认。
83
+ */
84
+ export type RemoteBytes = Uint8Array | string;
85
+ /**
86
+ * 本插件用到的 `remote.workspaceFiles` 面。
87
+ *
88
+ * 与宿主 `ui-sidebar-documentpreview/src/client/rpc.ts` 的
89
+ * `WorkspaceFilesReadRemote` 同形:不传 `range` 就是整文件读取(上限由宿主
90
+ * `maxFileBytes` 决定),`baseFile` 用于把相对路径解析到基准文件目录。
91
+ *
92
+ * `readAll` 是 **≤0.1.6 那一代**的整文件读取法(宿主在 0.1.7 把它并进了
93
+ * `readBytes` 的 `options` 形态)。留着它是为了旧世代仍能整文件取字节:
94
+ * 那一代的 `readBytes` 收的是**字节窗口**而不是 `options`,拿它读整文件
95
+ * 只会读到 `maxBytes` 那么多。
96
+ */
97
+ export interface WorkspaceFilesRemote {
98
+ readonly workspaceFiles: {
99
+ /**
100
+ * 读整段文件字节(≥0.1.7 那一代的形态)。
101
+ * @param sessionId - 决定工作区根的会话 id。
102
+ * @param path - 绝对路径,或相对该会话工作区根的路径。
103
+ * @param options - 可选的字节窗口与基准文件;本实现不传。
104
+ * @param signal - 取消信号。
105
+ * @returns 结果:成功时 `value.data` 是字节,失败时 `error` 带原因码。
106
+ */
107
+ readBytes(sessionId: string, path: string, options: {
108
+ readonly baseFile?: string;
109
+ readonly range?: {
110
+ readonly offset?: number;
111
+ readonly length?: number;
112
+ };
113
+ }, signal?: AbortSignal): Promise<RemoteResult<{
114
+ readonly data: RemoteBytes;
115
+ }>>;
116
+ /**
117
+ * 读整段文件字节(≤0.1.6 那一代的形态;≥0.1.7 已无此方法)。
118
+ * @param sessionId - 决定工作区根的会话 id。
119
+ * @param path - 绝对路径,或相对该会话工作区根的路径。
120
+ * @param signal - 取消信号。
121
+ * @returns 结果:成功时 `value.data` 是 base64 字符串,失败时带原因码。
122
+ */
123
+ readAll?(sessionId: string, path: string, signal?: AbortSignal): Promise<RemoteResult<{
124
+ readonly data: RemoteBytes;
125
+ }>>;
126
+ };
127
+ }
128
+ declare module '@deepseek-ai/dsh-client-ui-slots' {
129
+ interface SlotMap {
130
+ /**
131
+ * 文档正文,按注册的实现 id 分发。本渲染器只消费地址与注入的取字节通道,
132
+ * 所以只声明驱动 `register` / `inject` 过类型检查的这两轴。
133
+ */
134
+ 'sidebar.right.tab.document': {
135
+ kind: 'keyed';
136
+ scope: 'session';
137
+ };
138
+ }
139
+ }
140
+ //# sourceMappingURL=video-slots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video-slots.d.ts","sourceRoot":"","sources":["../../../../src/client/minimax-code/video-slots.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,4EAA4E;AAC5E,MAAM,WAAW,2BAA2B;IAC1C,sBAAsB;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,oBAAoB;IACpB,QAAQ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E,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;YAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;gBAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;gBAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;aAAE,CAAA;SAAE,EAChH,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,YAAY,CAAC;YAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;SAAE,CAAC,CAAC,CAAA;QACxD;;;;;;WAMG;QACH,OAAO,CAAC,CACN,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,YAAY,CAAC;YAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;SAAE,CAAC,CAAC,CAAA;KACzD,CAAA;CACF;AAED,OAAO,QAAQ,kCAAkC,CAAC;IAChD,UAAU,OAAO;QACf;;;WAGG;QACH,4BAA4B,EAAE;YAAE,IAAI,EAAE,OAAO,CAAC;YAAC,KAAK,EAAE,SAAS,CAAA;SAAE,CAAA;KAClE;CACF"}
@@ -19,14 +19,20 @@
19
19
  * - 行内 `code`
20
20
  * - `**粗体**`
21
21
  * - `###` 标题(最多三级)
22
+ * - 围栏代码块(三连及以上的反引号或波浪号:**不做语法高亮**,语言标签只当标题)
23
+ * - 数学公式:行内 `$…$` / `\(…\)`,块级 `$$…$$` / `\[…\]`,交给 KaTeX
22
24
  *
23
- * 表格是**后补**的:早先版本把它当「超出契约」排除了,结果模型写出来的管道符表格
24
- * 整块落进段落分支、原样上屏(用户直接看到一堆竖线)。渲染一个表格的代价只是
25
- * 一次前瞻扫描,远小于它被读错造成的损失。
25
+ * 表格与围栏代码块都是**后补**的:早先版本把它们当「超出契约」排除了,结果模型写出来的
26
+ * 管道符表格整块落进段落分支、原样上屏(用户直接看到一堆竖线),围栏代码块同样把三反
27
+ * 引号露在正文里。渲染它们的代价只是一次前瞻扫描,远小于它被读错造成的损失。
26
28
  *
27
- * 仍然刻意**不做**图片、链接、原始 HTML、脚注与围栏代码块:这些要么需要安全过滤,
28
- * 要么属于「进展汇报」这个场景不需要的重型排版。渲染结果全是 React 元素,不经过
29
- * `dangerouslySetInnerHTML`,因此没有注入面。
29
+ * 数学走 KaTeX 而不是自己画:公式排版(分式、上下标、矩阵)不是几十行手写能覆盖的面。
30
+ * KaTeX 只输出 HTML 串(`.katex` 那棵 span/MathML 树),本文件把它经 `DOMParser` 转成
31
+ * React 元素,**不经过 `dangerouslySetInnerHTML`** —— 整份渲染结果因此仍然是「全是
32
+ * React 元素」,没有注入面。KaTeX 的 CSS 与字体由平台 `ui-primitives` 随页面引入
33
+ * (`katex.min.css`),本插件不打包样式,只负责出结构。
34
+ *
35
+ * 仍然刻意**不做**图片、链接、原始 HTML、脚注与语法高亮。
30
36
  *
31
37
  * @module @eddyskywalker/dsh-chatgpt-subscription/client/progress-updates/markdown-lite
32
38
  */
@@ -52,6 +58,13 @@ type Block = {
52
58
  header: string[];
53
59
  aligns: ColumnAlign[];
54
60
  rows: string[][];
61
+ } | {
62
+ kind: 'code';
63
+ lang: string;
64
+ code: string;
65
+ } | {
66
+ kind: 'math';
67
+ tex: string;
55
68
  };
56
69
  /**
57
70
  * 一行表格 → 单元格数组。
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-lite.d.ts","sourceRoot":"","sources":["../../../../src/client/progress-updates/markdown-lite.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAgCtC,wDAAwD;AACxD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;AAErD,oBAAoB;AACpB,KAAK,KAAK,GACN;IAAE,IAAI,EAAE,GAAG,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S;IAIhC,mBAAmB,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS;IAInE,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB;;;;;;;;;;IAIzE,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,YAAY,EAAE,CAAC;IAsB/D,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAyCpG,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAO/F,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,aAAa,CAAC,WAAW,CAAC;YA0BpD,aAAa;CAiR7B"}
@@ -0,0 +1,63 @@
1
+ import { AccountPoolCore, type PoolAccountShape, type PoolData } from '../common/account-pool.ts';
2
+ import type { CredentialStore } from '../token-store.ts';
3
+ import { FileCredentialStore, type ClinePassCredentials } from './token-store.ts';
4
+ import type { AccountPoolStatusDto, AccountRotationStrategy } from '../../shared/account-pool-contracts.ts';
5
+ import type { ClinePassAccountSummaryDto } from '../../shared/cline-pass-contracts.ts';
6
+ /** One pooled Cline Pass key: the bearer key plus the display facts the card renders. */
7
+ export interface ClinePassPoolAccount extends PoolAccountShape<ClinePassCredentials> {
8
+ /** Model id this account last served, for the card's detail line. */
9
+ lastModelId?: string;
10
+ }
11
+ export type ClinePassPoolStatusDto = AccountPoolStatusDto;
12
+ /** Encrypted pool file this line owns. */
13
+ export declare function clinePassPoolPath(): string;
14
+ /** The credential name the standalone plugin reads when no key was pasted. */
15
+ export declare const CLINE_PASS_API_KEY_ENV = "CLINE_PASS_API_KEY";
16
+ /**
17
+ * Stable identity of one key.
18
+ *
19
+ * Cline hands the user a bare key and nothing else — no account id, no email —
20
+ * so the key's own digest is the only identity available. It is never written
21
+ * anywhere: it exists to tell two pasted keys apart inside the pool document,
22
+ * and it is not a credential and cannot be used as one.
23
+ */
24
+ export declare function clinePassAccountKey(credentials: ClinePassCredentials): string;
25
+ /** Validate and normalize one whole pool document. */
26
+ export declare function parseClinePassPoolData(value: unknown): PoolData<ClinePassPoolAccount>;
27
+ export interface ClinePassAccountPoolOptions {
28
+ /** Pre-pool credential file the pool mirrors its primary account into. */
29
+ store?: FileCredentialStore;
30
+ /** Test seam; production builds the platform backend from the pool path. */
31
+ backend?: CredentialStore<PoolData<ClinePassPoolAccount>>;
32
+ maxAccounts?: number;
33
+ /** The line's current chat base URL, used when an account names none. */
34
+ baseURL?: () => string;
35
+ }
36
+ /**
37
+ * Cline Pass's account pool.
38
+ *
39
+ * Two credential kinds share one pool: an OAuth session (WorkOS device sign-in,
40
+ * rotating refresh token, expiry) and a legacy static API key. The kernel's
41
+ * refresh hooks are wired for the first and are no-ops for the second.
42
+ */
43
+ export declare class ClinePassAccountPool extends AccountPoolCore<ClinePassCredentials, ClinePassPoolAccount, ClinePassAccountSummaryDto> {
44
+ private readonly store;
45
+ constructor(options?: ClinePassAccountPoolOptions);
46
+ /**
47
+ * Pick the key for the next request, skipping accounts already tried.
48
+ *
49
+ * The credential carries its own base-URL override, so the account and the key
50
+ * are returned together.
51
+ */
52
+ getEffectiveCredential(excludeIds?: ReadonlySet<string>, fetchFn?: typeof fetch): Promise<{
53
+ account: ClinePassPoolAccount;
54
+ credentials: ClinePassCredentials;
55
+ }>;
56
+ /** The pre-pool credential file this pool mirrors its primary account into. */
57
+ mirrorStore(): FileCredentialStore;
58
+ /** The rotation strategy as the settings card renders it. */
59
+ strategy(): Promise<AccountRotationStrategy>;
60
+ /** Remember which model an account last served, best-effort. */
61
+ recordModel(accountId: string, model: string): Promise<void>;
62
+ }
63
+ //# sourceMappingURL=account-pool.d.ts.map
@@ -0,0 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oBAAqB,SAAQ,eAAe,CACvD,oBAAoB,EACpB,oBAAoB,EACpB,0BAA0B,CAC3B;IACC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqB;gBAE/B,OAAO,GAAE,2BAAgC;IAoGrD;;;;;OAKG;IACG,sBAAsB,CAC1B,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,EAChC,OAAO,GAAE,OAAO,KAAa,GAC5B,OAAO,CAAC;QAAE,OAAO,EAAE,oBAAoB,CAAC;QAAC,WAAW,EAAE,oBAAoB,CAAA;KAAE,CAAC;IAIhF,+EAA+E;IAC/E,WAAW,IAAI,mBAAmB;IAIlC,6DAA6D;IACvD,QAAQ,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAIlD,gEAAgE;IAC1D,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAOnE"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * The Cline Pass LLM adapter: an OpenAI-compatible `chat/completions` stream
3
+ * with upstream pinning, per-account rotation, and pre-first-token failover.
4
+ *
5
+ * Transport and mapping live in `client.ts` / `mapper.ts`; account selection and
6
+ * probing live in `engine.ts`. This module owns the request loop: which account,
7
+ * which channel, and when an attempt is abandoned.
8
+ *
9
+ * @module dsh-chatgpt-subscription/cline-pass-adapter
10
+ */
11
+ import { LlmAdapter, type GenerateOptions as HarnessGenerateOptions, type LlmModelInfo, type LlmProviderInfo, type LlmResolvedModelInfo, type PreparedAdapterCall, type ResolvedRetryPolicy, type StreamChunk } from '@deepseek-ai/dsh-llm';
12
+ import type { ClinePassEngine } from './engine.ts';
13
+ import type { ClinePassStore } from './store.ts';
14
+ import type { ClinePassModelSettingsStore } from './token-store.ts';
15
+ import type { ClinePassAccountPool } from './account-pool.ts';
16
+ import { type AttachmentImageReader } from '../common/request-images.ts';
17
+ export interface ClinePassAdapterOptions {
18
+ /** Durable attachment service, for request images. */
19
+ attachments?: AttachmentImageReader;
20
+ }
21
+ export declare class ClinePassAdapter extends LlmAdapter {
22
+ private readonly engine;
23
+ private readonly store;
24
+ private readonly modelSettings;
25
+ private readonly accountPool;
26
+ private readonly options;
27
+ private readonly gate;
28
+ constructor(engine: ClinePassEngine, store: ClinePassStore, modelSettings: ClinePassModelSettingsStore, accountPool: ClinePassAccountPool, options?: ClinePassAdapterOptions);
29
+ providerInfo(provider: string): LlmProviderInfo;
30
+ providerRetryPolicy(): ResolvedRetryPolicy;
31
+ imageRequestPricing(): undefined;
32
+ private settings;
33
+ /**
34
+ * The ids the route advertises: the shipped table, models a live scan adopted,
35
+ * and (when asked) the gateway's own catalog — narrowed by the user's selection
36
+ * and hidden list.
37
+ */
38
+ private availableModelIds;
39
+ /** One model's resolved descriptor, from the shipped catalog plus live data. */
40
+ private modelInfo;
41
+ listModels(provider?: string): Promise<readonly LlmModelInfo[]>;
42
+ resolveModel(provider: string, modelId: string, signal?: AbortSignal): Promise<LlmResolvedModelInfo>;
43
+ prepareCall(provider: string, model: string, signal?: AbortSignal): Promise<PreparedAdapterCall>;
44
+ stream(options: HarnessGenerateOptions): AsyncIterable<StreamChunk>;
45
+ private requestStream;
46
+ /** Park an account that refused a request, for the reason it refused. */
47
+ private standDown;
48
+ }
49
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../src/host/cline-pass/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,UAAU,EAIV,KAAK,eAAe,IAAI,sBAAsB,EAC9C,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAEjB,MAAM,sBAAsB,CAAA;AAoB7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,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O,EAAE,sBAAsB,GAAG,aAAa,CAAC,WAAW,CAAC;YAW3D,aAAa;IA6P5B,yEAAyE;YAC3D,SAAS;CAOxB"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Merge the shipped catalog, the live scan and the user's per-model override into
3
+ * the descriptor the harness validates.
4
+ *
5
+ * Context window and output cap are provider facts, not preferences: the harness
6
+ * sizes its prompt budget against `context.contextWindow`, so an understated
7
+ * window silently truncates history.
8
+ *
9
+ * @module dsh-chatgpt-subscription/cline-pass-catalog
10
+ */
11
+ import { type ClinePassDiscoveredModel, type ClinePassModelInfo } from './types.ts';
12
+ import type { ClinePassCatalogModel } from './token-store.ts';
13
+ /**
14
+ * The output budget to advertise for one model.
15
+ *
16
+ * `defaultMaxTokens` is what a request asks for, not what the model can emit, and
17
+ * the harness spends it twice: it fills a request's `max_tokens` from it and
18
+ * reserves the same number as completion room before deciding to compact. So the
19
+ * published output ceiling clamps the configured budget rather than becoming it,
20
+ * and a budget is never taken past half the window.
21
+ */
22
+ export declare function resolveOutputBudget(budget: number | undefined, ceiling: number | undefined, contextWindow: number): number | undefined;
23
+ /**
24
+ * Resolve the metadata one model is advertised with.
25
+ *
26
+ * Precedence per field: the user's override, then the shipped table, then what
27
+ * the last official scan published, then the entry the last gateway catalog sync
28
+ * stored, then the route-wide fallback.
29
+ *
30
+ * The live scan sits below the shipped table because the shipped entry is
31
+ * curated: a community catalog reports extra modalities and underscore-free
32
+ * spellings the seam or the provider's label does not want. It exists to cover
33
+ * what the table cannot know — a model published after this release.
34
+ */
35
+ export declare function resolveModelInfo(model: string, options: {
36
+ /** Display name for the bare id. */
37
+ displayName: string;
38
+ /** Entries persisted by the last catalog sync. */
39
+ synced: readonly ClinePassCatalogModel[];
40
+ /** What the last official scan published for this id. */
41
+ discovered?: ClinePassDiscoveredModel;
42
+ /** Stored context-window override. */
43
+ contextWindowOverride?: number;
44
+ /** Route-wide fallback window. */
45
+ defaultContextWindow?: number;
46
+ /** Route-wide output budget. */
47
+ defaultMaxTokens?: number;
48
+ }): ClinePassModelInfo;
49
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../../src/host/cline-pass/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAKL,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACxB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAsB7D;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAOtI;AAOD;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;IACP,oCAAoC;IACpC,WAAW,EAAE,MAAM,CAAA;IACnB,kDAAkD;IAClD,MAAM,EAAE,SAAS,qBAAqB,EAAE,CAAA;IACxC,yDAAyD;IACzD,UAAU,CAAC,EAAE,wBAAwB,CAAA;IACrC,sCAAsC;IACtC,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,kCAAkC;IAClC,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,gCAAgC;IAChC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B,GACA,kBAAkB,CAsCpB"}
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Transport for the Cline gateway and its public catalogs. Transport only: no
3
+ * pinning, retry, or failover policy lives here (see `adapter.ts`).
4
+ *
5
+ * - `POST {baseURL}/chat/completions` — the gateway
6
+ * - `GET {baseURL}/models` — the gateway's own catalog
7
+ * - `GET {baseURL}/users/me/plan/usage-limits` — the account's quota windows
8
+ * - `GET api.cline.bot/…/recommended-models` — official subscription list
9
+ * - `GET models.dev/api.json` — community registry, a metadata backstop
10
+ * - `GET ai-gateway.vercel.sh/v1/models` — the upstream's own catalog
11
+ * - `GET openrouter.ai/api/v1/…` — endpoint detail for direct-pipeline models
12
+ *
13
+ * @module dsh-chatgpt-subscription/cline-pass-client
14
+ */
15
+ import { type ClinePassCatalogScan } from './types.ts';
16
+ export interface ClinePassHttpResult {
17
+ status: number;
18
+ ok: boolean;
19
+ json: unknown;
20
+ text: string;
21
+ }
22
+ /** Combine a caller signal with a timeout signal. */
23
+ export declare function withTimeout(signal: AbortSignal | undefined, timeoutMs: number | undefined): AbortSignal | undefined;
24
+ /** Strip a trailing slash so paths can be appended literally. */
25
+ export declare function trimBase(baseURL: string): string;
26
+ /** The gateway's own chat-completions endpoint for one base URL. */
27
+ export declare function chatURL(baseURL: string): string;
28
+ /** Send one JSON request and decode whatever comes back; never throws for HTTP errors. */
29
+ export declare function sendJSON(fetchFn: typeof fetch, url: string, { method, apiKey, body, signal, timeoutMs, headers, }?: {
30
+ method?: string;
31
+ apiKey?: string;
32
+ body?: unknown;
33
+ signal?: AbortSignal;
34
+ timeoutMs?: number;
35
+ headers?: Record<string, string>;
36
+ }): Promise<ClinePassHttpResult>;
37
+ /** Send one chat completion, non-streaming. */
38
+ export declare function chatCompletion({ fetchFn, baseURL, apiKey, body, signal, timeoutMs, }: {
39
+ fetchFn: typeof fetch;
40
+ baseURL: string;
41
+ apiKey: string;
42
+ body: unknown;
43
+ signal?: AbortSignal;
44
+ timeoutMs?: number;
45
+ }): Promise<ClinePassHttpResult>;
46
+ /** Open a streaming chat completion and hand back the live response. */
47
+ export declare function openChatStream({ fetchFn, baseURL, apiKey, body, signal, headers, }: {
48
+ fetchFn: typeof fetch;
49
+ baseURL: string;
50
+ apiKey: string;
51
+ body: unknown;
52
+ signal?: AbortSignal;
53
+ headers?: Record<string, string>;
54
+ }): Promise<Response>;
55
+ /** List the gateway's own catalog ids; an empty array when the call fails. */
56
+ export declare function fetchGatewayCatalog({ fetchFn, baseURL, apiKey, signal, timeoutMs, }: {
57
+ fetchFn: typeof fetch;
58
+ baseURL: string;
59
+ apiKey: string;
60
+ signal?: AbortSignal;
61
+ timeoutMs?: number;
62
+ }): Promise<string[]>;
63
+ /** One quota window as the gateway reports it. */
64
+ export interface ClinePassRawUsageLimit {
65
+ type: string;
66
+ percentUsed: number;
67
+ resetsAt: string;
68
+ }
69
+ /**
70
+ * Read the account's official quota consumption.
71
+ *
72
+ * The gateway answers with `{ success, data: { limits: [{ type, percentUsed,
73
+ * resetsAt }] } }`, where `type` is `five_hour`, `weekly` or `monthly`. A refusal
74
+ * is reported as data, never thrown: the card shows quota beside controls that
75
+ * keep working without it.
76
+ */
77
+ export declare function fetchUsageLimits({ fetchFn, baseURL, apiKey, signal, timeoutMs, }: {
78
+ fetchFn: typeof fetch;
79
+ baseURL: string;
80
+ apiKey: string;
81
+ signal?: AbortSignal;
82
+ timeoutMs?: number;
83
+ }): Promise<{
84
+ ok: boolean;
85
+ limits: ClinePassRawUsageLimit[];
86
+ error: string;
87
+ }>;
88
+ /**
89
+ * Collect `cline-pass/*` ids and metadata from the official endpoints and the
90
+ * community registry. Additive by design: a source that fails is skipped.
91
+ */
92
+ export declare function fetchOfficialModels({ fetchFn, signal, timeoutMs, }: {
93
+ fetchFn: typeof fetch;
94
+ signal?: AbortSignal;
95
+ timeoutMs?: number;
96
+ }): Promise<ClinePassCatalogScan>;
97
+ /** Resolve a canonical slug against OpenRouter's public catalog. */
98
+ export declare function resolveOpenRouterSlug(fetchFn: typeof fetch, slug: string, { signal, timeoutMs }?: {
99
+ signal?: AbortSignal;
100
+ timeoutMs?: number;
101
+ }): Promise<string | null>;
102
+ /** One upstream endpoint detail, as OpenRouter reports it. */
103
+ export interface ClinePassEndpointDetail {
104
+ slug: string;
105
+ name: string;
106
+ endpoints: number;
107
+ context: number;
108
+ uptime: number;
109
+ }
110
+ /** Per-upstream endpoint detail (context length, recent uptime) for one model. */
111
+ export declare function openRouterEndpoints(fetchFn: typeof fetch, slug: string, { signal, timeoutMs }?: {
112
+ signal?: AbortSignal;
113
+ timeoutMs?: number;
114
+ }): Promise<{
115
+ slug: string;
116
+ endpoints: ClinePassEndpointDetail[];
117
+ }>;
118
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/host/cline-pass/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAOL,KAAK,oBAAoB,EAE1B,MAAM,YAAY,CAAA;AAEnB,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAA;IACd,EAAE,EAAE,OAAO,CAAA;IACX,IAAI,EAAE,OAAO,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;CACb;AAED,qDAAqD;AACrD,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAMnH;AAED,iEAAiE;AACjE,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,oEAAoE;AACpE,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,0FAA0F;AAC1F,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,OAAO,KAAK,EACrB,GAAG,EAAE,MAAM,EACX,EACE,MAAc,EACd,MAAW,EACX,IAAI,EACJ,MAAM,EACN,SAAkB,EAClB,OAAY,GACb,GAAE;IACD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC5B,GACL,OAAO,CAAC,mBAAmB,CAAC,CAuB9B;AAED,+CAA+C;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