dsh-coding-subscription-oauth 0.6.2 → 0.6.3

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 (121) hide show
  1. package/CHANGELOG.md +222 -206
  2. package/CONTRIBUTING.md +129 -120
  3. package/INSTALL.md +218 -218
  4. package/LICENSE +19 -19
  5. package/NOTICE +11 -11
  6. package/README.de.md +289 -289
  7. package/README.es.md +290 -290
  8. package/README.fr.md +290 -290
  9. package/README.ja.md +290 -290
  10. package/README.ko.md +290 -290
  11. package/README.md +304 -304
  12. package/README.pt-BR.md +290 -290
  13. package/README.ru.md +290 -290
  14. package/README.zh-CN.md +302 -302
  15. package/compatibility/dsh-bom.json +0 -0
  16. package/cordis.patch.yml +13 -13
  17. package/docs/00-project-rules.md +212 -195
  18. package/docs/02-architecture.md +130 -130
  19. package/docs/02-architecture.zh-CN.md +130 -130
  20. package/lib/bin.js.map +1 -1
  21. package/lib/capability-settings.d.ts +8 -2
  22. package/lib/capability-settings.d.ts.map +1 -1
  23. package/lib/capability-tools.d.ts +7 -2
  24. package/lib/capability-tools.d.ts.map +1 -1
  25. package/lib/client.js +3 -3
  26. package/lib/client.js.map +2 -2
  27. package/lib/codex-images.d.ts +8 -0
  28. package/lib/codex-images.d.ts.map +1 -1
  29. package/lib/index.js +32 -7
  30. package/lib/index.js.map +2 -2
  31. package/lib/invariant.js.map +1 -1
  32. package/media/en/settings_accounts.png +0 -0
  33. package/media/en/settings_capabilities.png +0 -0
  34. package/media/en/settings_gateway.png +0 -0
  35. package/media/settings_accounts.png +0 -0
  36. package/media/settings_capabilities.png +0 -0
  37. package/media/settings_gateway.png +0 -0
  38. package/media/settings_overview.png +0 -0
  39. package/media/zh-CN/settings_accounts.png +0 -0
  40. package/media/zh-CN/settings_capabilities.png +0 -0
  41. package/media/zh-CN/settings_gateway.png +0 -0
  42. package/package.json +148 -148
  43. package/patches/dsh-agy@0.1.2.patch +25 -25
  44. package/scripts/release.mjs +186 -186
  45. package/scripts/smoke-deployed-routes.mjs +146 -146
  46. package/scripts/verify-deployed-catalog.mjs +87 -87
  47. package/src/adapter.ts +273 -273
  48. package/src/alias-adapter.ts +130 -130
  49. package/src/auth-routes.ts +921 -921
  50. package/src/auth.ts +67 -67
  51. package/src/bin.ts +350 -350
  52. package/src/capability-routes.ts +279 -279
  53. package/src/capability-runtime.ts +314 -313
  54. package/src/capability-settings.ts +671 -658
  55. package/src/capability-tools.ts +685 -666
  56. package/src/catalog.ts +271 -271
  57. package/src/client/GrokBuildSettings.tsx +771 -770
  58. package/src/client/api.ts +88 -88
  59. package/src/client/components/AboutTab.tsx +30 -30
  60. package/src/client/components/AccountsTab.tsx +241 -241
  61. package/src/client/components/Badge.tsx +33 -33
  62. package/src/client/components/CapabilitiesTab.tsx +265 -265
  63. package/src/client/components/CliPullPreview.tsx +116 -116
  64. package/src/client/components/CopyButton.tsx +57 -57
  65. package/src/client/components/GatewayTab.tsx +469 -469
  66. package/src/client/components/NoticeBanner.tsx +46 -46
  67. package/src/client/components/ProgressBar.tsx +53 -53
  68. package/src/client/components/ProviderCard.tsx +606 -606
  69. package/src/client/components/SettingsTabs.tsx +75 -75
  70. package/src/client/components/ToggleSwitch.tsx +71 -71
  71. package/src/client/constants.ts +230 -224
  72. package/src/client/display.ts +61 -61
  73. package/src/client/dshClientAdapter.ts +127 -127
  74. package/src/client/gatewaySnippets.ts +37 -37
  75. package/src/client/index.tsx +156 -156
  76. package/src/client/locales.ts +540 -535
  77. package/src/client/microStyles.ts +52 -52
  78. package/src/client/parsers.ts +398 -396
  79. package/src/client/styles.ts +325 -325
  80. package/src/client/types.ts +199 -197
  81. package/src/codex-http.ts +447 -447
  82. package/src/codex-images.ts +503 -485
  83. package/src/codex-model-capabilities.ts +320 -320
  84. package/src/codex-search.ts +245 -245
  85. package/src/codex-usage.ts +263 -263
  86. package/src/compatibility.ts +41 -41
  87. package/src/dsh-host-adapter.ts +173 -173
  88. package/src/gateway-anthropic-messages.ts +84 -84
  89. package/src/gateway-auth.ts +102 -102
  90. package/src/gateway-backend.ts +274 -274
  91. package/src/gateway-body.ts +49 -49
  92. package/src/gateway-config.ts +76 -76
  93. package/src/gateway-http.ts +104 -104
  94. package/src/gateway-openai-chat.ts +124 -124
  95. package/src/gateway-openai-responses.ts +53 -53
  96. package/src/gateway-parse.ts +224 -224
  97. package/src/gateway-protocol.ts +52 -52
  98. package/src/gateway-routes.ts +158 -158
  99. package/src/gateway.ts +258 -258
  100. package/src/grok-errors.ts +24 -24
  101. package/src/grok-imagine.ts +1627 -1627
  102. package/src/grok-import.ts +151 -151
  103. package/src/http-json.ts +82 -82
  104. package/src/ids.ts +59 -59
  105. package/src/imagine-routes.ts +463 -463
  106. package/src/index.ts +709 -709
  107. package/src/invariant.ts +17 -17
  108. package/src/kimi-errors.ts +26 -26
  109. package/src/media-store.ts +927 -927
  110. package/src/oauth-import-routes.ts +324 -324
  111. package/src/oauth-providers.ts +152 -152
  112. package/src/oauth-session.ts +183 -183
  113. package/src/oauth-sources.ts +1104 -1104
  114. package/src/oauth.ts +620 -620
  115. package/src/provider.ts +128 -128
  116. package/src/proxy.ts +11 -11
  117. package/src/redact.ts +72 -72
  118. package/src/session.ts +218 -218
  119. package/src/store.ts +217 -217
  120. package/src/web-origin.ts +296 -296
  121. package/src/web-routes.ts +38 -38
@@ -1,116 +1,116 @@
1
- /** CLI credential pull preview panel. */
2
-
3
- import { SOURCE_CONFLICT_KEY, SOURCE_KIND_KEY, SOURCE_PREVIEW_ACTION_KEY } from "../constants.ts";
4
- import { formatEpoch } from "../parsers.ts";
5
- import {
6
- bodyStyle,
7
- buttonStyle,
8
- cardStyle,
9
- checkRowStyle,
10
- hintStyle,
11
- listStyle,
12
- monoStyle,
13
- primaryButtonStyle,
14
- } from "../styles.ts";
15
- import type { GrokBuildSettingsInjected, SourcePreview } from "../types.ts";
16
-
17
- export interface CliPullPreviewProps {
18
- t: GrokBuildSettingsInjected["t"];
19
- preview: SourcePreview;
20
- confirmOverwrite: boolean;
21
- sourcesBusy: boolean;
22
- onConfirmOverwriteChange: (checked: boolean) => void;
23
- onCommit: () => void;
24
- onCancel: () => void;
25
- }
26
-
27
- export function CliPullPreview({
28
- t,
29
- preview,
30
- confirmOverwrite,
31
- sourcesBusy,
32
- onConfirmOverwriteChange,
33
- onCommit,
34
- onCancel,
35
- }: CliPullPreviewProps) {
36
- const expiresAt = formatEpoch(preview.expiresAt);
37
- const ticketExpiresAt = formatEpoch(preview.ticketExpiresAt);
38
-
39
- return (
40
- <section
41
- id={`coding-oauth-source-preview-${preview.kind}`}
42
- style={cardStyle}
43
- aria-labelledby={`coding-oauth-source-preview-title-${preview.kind}`}
44
- aria-live="polite"
45
- tabIndex={-1}
46
- >
47
- <p id={`coding-oauth-source-preview-title-${preview.kind}`} style={bodyStyle}>
48
- {t("sourcesPreviewTitle")} · {t(SOURCE_KIND_KEY[preview.kind])}
49
- </p>
50
- <p style={hintStyle}>
51
- <span style={monoStyle}>{preview.displayPath}</span>
52
- </p>
53
- <p style={bodyStyle}>
54
- {t("sourcesConflict", {
55
- detail: t(
56
- preview.conflict === undefined ? "sourceConflictUnrecognized" : SOURCE_CONFLICT_KEY[preview.conflict],
57
- ),
58
- })}
59
- </p>
60
- <p style={bodyStyle}>
61
- {t("sourcesAction", {
62
- detail: t(
63
- preview.action === undefined ? "sourceActionUnrecognized" : SOURCE_PREVIEW_ACTION_KEY[preview.action],
64
- ),
65
- })}
66
- </p>
67
- {expiresAt === undefined ? null : <p style={hintStyle}>{t("sourcesPreviewExpires", { time: expiresAt })}</p>}
68
- {ticketExpiresAt === undefined ? null : (
69
- <p style={hintStyle}>{t("sourcesTicketExpires", { time: ticketExpiresAt })}</p>
70
- )}
71
- {preview.warnings.length === 0 ? null : (
72
- <ul style={{ ...listStyle, gap: 4 }} aria-label={t("sourcesWarnings")}>
73
- {preview.warnings.map((warning) => (
74
- <li key={warning} style={hintStyle}>
75
- {warning}
76
- </li>
77
- ))}
78
- </ul>
79
- )}
80
- {preview.confirmOverwriteRequired ? (
81
- <label style={checkRowStyle}>
82
- <input
83
- aria-describedby={`coding-oauth-source-overwrite-hint-${preview.kind}`}
84
- type="checkbox"
85
- checked={confirmOverwrite}
86
- disabled={sourcesBusy || preview.action === "blocked"}
87
- onChange={(event) => {
88
- onConfirmOverwriteChange(event.target.checked);
89
- }}
90
- />
91
- <span>
92
- {t("sourcesConfirmOverwrite")}
93
- <span id={`coding-oauth-source-overwrite-hint-${preview.kind}`} style={{ display: "block", ...hintStyle }}>
94
- {t("sourcesConfirmOverwriteHint")}
95
- </span>
96
- </span>
97
- </label>
98
- ) : null}
99
- <div style={{ display: "flex", flexWrap: "wrap", gap: 8 }}>
100
- <button
101
- type="button"
102
- style={primaryButtonStyle}
103
- disabled={
104
- sourcesBusy || preview.action === "blocked" || (preview.confirmOverwriteRequired && !confirmOverwrite)
105
- }
106
- onClick={onCommit}
107
- >
108
- {t("sourcesCommit")}
109
- </button>
110
- <button type="button" style={buttonStyle} disabled={sourcesBusy} onClick={onCancel}>
111
- {t("sourcesCancelPreview")}
112
- </button>
113
- </div>
114
- </section>
115
- );
116
- }
1
+ /** CLI credential pull preview panel. */
2
+
3
+ import { SOURCE_CONFLICT_KEY, SOURCE_KIND_KEY, SOURCE_PREVIEW_ACTION_KEY } from "../constants.ts";
4
+ import { formatEpoch } from "../parsers.ts";
5
+ import {
6
+ bodyStyle,
7
+ buttonStyle,
8
+ cardStyle,
9
+ checkRowStyle,
10
+ hintStyle,
11
+ listStyle,
12
+ monoStyle,
13
+ primaryButtonStyle,
14
+ } from "../styles.ts";
15
+ import type { GrokBuildSettingsInjected, SourcePreview } from "../types.ts";
16
+
17
+ export interface CliPullPreviewProps {
18
+ t: GrokBuildSettingsInjected["t"];
19
+ preview: SourcePreview;
20
+ confirmOverwrite: boolean;
21
+ sourcesBusy: boolean;
22
+ onConfirmOverwriteChange: (checked: boolean) => void;
23
+ onCommit: () => void;
24
+ onCancel: () => void;
25
+ }
26
+
27
+ export function CliPullPreview({
28
+ t,
29
+ preview,
30
+ confirmOverwrite,
31
+ sourcesBusy,
32
+ onConfirmOverwriteChange,
33
+ onCommit,
34
+ onCancel,
35
+ }: CliPullPreviewProps) {
36
+ const expiresAt = formatEpoch(preview.expiresAt);
37
+ const ticketExpiresAt = formatEpoch(preview.ticketExpiresAt);
38
+
39
+ return (
40
+ <section
41
+ id={`coding-oauth-source-preview-${preview.kind}`}
42
+ style={cardStyle}
43
+ aria-labelledby={`coding-oauth-source-preview-title-${preview.kind}`}
44
+ aria-live="polite"
45
+ tabIndex={-1}
46
+ >
47
+ <p id={`coding-oauth-source-preview-title-${preview.kind}`} style={bodyStyle}>
48
+ {t("sourcesPreviewTitle")} · {t(SOURCE_KIND_KEY[preview.kind])}
49
+ </p>
50
+ <p style={hintStyle}>
51
+ <span style={monoStyle}>{preview.displayPath}</span>
52
+ </p>
53
+ <p style={bodyStyle}>
54
+ {t("sourcesConflict", {
55
+ detail: t(
56
+ preview.conflict === undefined ? "sourceConflictUnrecognized" : SOURCE_CONFLICT_KEY[preview.conflict],
57
+ ),
58
+ })}
59
+ </p>
60
+ <p style={bodyStyle}>
61
+ {t("sourcesAction", {
62
+ detail: t(
63
+ preview.action === undefined ? "sourceActionUnrecognized" : SOURCE_PREVIEW_ACTION_KEY[preview.action],
64
+ ),
65
+ })}
66
+ </p>
67
+ {expiresAt === undefined ? null : <p style={hintStyle}>{t("sourcesPreviewExpires", { time: expiresAt })}</p>}
68
+ {ticketExpiresAt === undefined ? null : (
69
+ <p style={hintStyle}>{t("sourcesTicketExpires", { time: ticketExpiresAt })}</p>
70
+ )}
71
+ {preview.warnings.length === 0 ? null : (
72
+ <ul style={{ ...listStyle, gap: 4 }} aria-label={t("sourcesWarnings")}>
73
+ {preview.warnings.map((warning) => (
74
+ <li key={warning} style={hintStyle}>
75
+ {warning}
76
+ </li>
77
+ ))}
78
+ </ul>
79
+ )}
80
+ {preview.confirmOverwriteRequired ? (
81
+ <label style={checkRowStyle}>
82
+ <input
83
+ aria-describedby={`coding-oauth-source-overwrite-hint-${preview.kind}`}
84
+ type="checkbox"
85
+ checked={confirmOverwrite}
86
+ disabled={sourcesBusy || preview.action === "blocked"}
87
+ onChange={(event) => {
88
+ onConfirmOverwriteChange(event.target.checked);
89
+ }}
90
+ />
91
+ <span>
92
+ {t("sourcesConfirmOverwrite")}
93
+ <span id={`coding-oauth-source-overwrite-hint-${preview.kind}`} style={{ display: "block", ...hintStyle }}>
94
+ {t("sourcesConfirmOverwriteHint")}
95
+ </span>
96
+ </span>
97
+ </label>
98
+ ) : null}
99
+ <div style={{ display: "flex", flexWrap: "wrap", gap: 8 }}>
100
+ <button
101
+ type="button"
102
+ style={primaryButtonStyle}
103
+ disabled={
104
+ sourcesBusy || preview.action === "blocked" || (preview.confirmOverwriteRequired && !confirmOverwrite)
105
+ }
106
+ onClick={onCommit}
107
+ >
108
+ {t("sourcesCommit")}
109
+ </button>
110
+ <button type="button" style={buttonStyle} disabled={sourcesBusy} onClick={onCancel}>
111
+ {t("sourcesCancelPreview")}
112
+ </button>
113
+ </div>
114
+ </section>
115
+ );
116
+ }
@@ -1,57 +1,57 @@
1
- /** Compact copy button with copied / failed feedback. */
2
-
3
- import { useCallback, useEffect, useRef, useState } from "react";
4
- import { copyText } from "../api.ts";
5
- import { compactButtonStyle, primaryButtonStyle } from "../styles.ts";
6
-
7
- export interface CopyButtonProps {
8
- text: string;
9
- idleLabel: string;
10
- copiedLabel: string;
11
- failedLabel: string;
12
- primary?: boolean;
13
- disabled?: boolean;
14
- }
15
-
16
- export function CopyButton({
17
- text,
18
- idleLabel,
19
- copiedLabel,
20
- failedLabel,
21
- primary = false,
22
- disabled = false,
23
- }: CopyButtonProps) {
24
- const [state, setState] = useState<"idle" | "copied" | "failed">("idle");
25
- const timerRef = useRef<number | undefined>(undefined);
26
-
27
- useEffect(() => {
28
- return () => {
29
- if (timerRef.current !== undefined) window.clearTimeout(timerRef.current);
30
- };
31
- }, []);
32
-
33
- const handleClick = useCallback(async () => {
34
- const ok = await copyText(text);
35
- setState(ok ? "copied" : "failed");
36
- if (timerRef.current !== undefined) window.clearTimeout(timerRef.current);
37
- timerRef.current = window.setTimeout(() => {
38
- setState("idle");
39
- timerRef.current = undefined;
40
- }, 2000);
41
- }, [text]);
42
-
43
- const label = state === "copied" ? copiedLabel : state === "failed" ? failedLabel : idleLabel;
44
-
45
- return (
46
- <button
47
- type="button"
48
- style={primary ? primaryButtonStyle : compactButtonStyle}
49
- disabled={disabled || text.length === 0}
50
- onClick={() => {
51
- void handleClick();
52
- }}
53
- >
54
- {label}
55
- </button>
56
- );
57
- }
1
+ /** Compact copy button with copied / failed feedback. */
2
+
3
+ import { useCallback, useEffect, useRef, useState } from "react";
4
+ import { copyText } from "../api.ts";
5
+ import { compactButtonStyle, primaryButtonStyle } from "../styles.ts";
6
+
7
+ export interface CopyButtonProps {
8
+ text: string;
9
+ idleLabel: string;
10
+ copiedLabel: string;
11
+ failedLabel: string;
12
+ primary?: boolean;
13
+ disabled?: boolean;
14
+ }
15
+
16
+ export function CopyButton({
17
+ text,
18
+ idleLabel,
19
+ copiedLabel,
20
+ failedLabel,
21
+ primary = false,
22
+ disabled = false,
23
+ }: CopyButtonProps) {
24
+ const [state, setState] = useState<"idle" | "copied" | "failed">("idle");
25
+ const timerRef = useRef<number | undefined>(undefined);
26
+
27
+ useEffect(() => {
28
+ return () => {
29
+ if (timerRef.current !== undefined) window.clearTimeout(timerRef.current);
30
+ };
31
+ }, []);
32
+
33
+ const handleClick = useCallback(async () => {
34
+ const ok = await copyText(text);
35
+ setState(ok ? "copied" : "failed");
36
+ if (timerRef.current !== undefined) window.clearTimeout(timerRef.current);
37
+ timerRef.current = window.setTimeout(() => {
38
+ setState("idle");
39
+ timerRef.current = undefined;
40
+ }, 2000);
41
+ }, [text]);
42
+
43
+ const label = state === "copied" ? copiedLabel : state === "failed" ? failedLabel : idleLabel;
44
+
45
+ return (
46
+ <button
47
+ type="button"
48
+ style={primary ? primaryButtonStyle : compactButtonStyle}
49
+ disabled={disabled || text.length === 0}
50
+ onClick={() => {
51
+ void handleClick();
52
+ }}
53
+ >
54
+ {label}
55
+ </button>
56
+ );
57
+ }