@chatcode/cco-market 1.45.1
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/LICENSE +21 -0
- package/README.md +146 -0
- package/README.zh.md +143 -0
- package/UPDATE-API-V1.md +132 -0
- package/client/client.js +11534 -0
- package/cordis.patch.yml +5 -0
- package/lib/accelerate.js +184 -0
- package/lib/agents.js +36 -0
- package/lib/backup.js +572 -0
- package/lib/catalog-local-match.js +126 -0
- package/lib/catalog-npm.js +111 -0
- package/lib/changelog.js +242 -0
- package/lib/channels.js +64 -0
- package/lib/check.js +1067 -0
- package/lib/compatibility.js +198 -0
- package/lib/diagnostics.js +49 -0
- package/lib/discovery-compatibility.js +260 -0
- package/lib/dsh-cli.js +949 -0
- package/lib/dsh-install.js +108 -0
- package/lib/gist.js +352 -0
- package/lib/groups.js +97 -0
- package/lib/home-paths.js +42 -0
- package/lib/hot.js +519 -0
- package/lib/http.js +39 -0
- package/lib/index.js +97 -0
- package/lib/install.js +387 -0
- package/lib/log.js +197 -0
- package/lib/ndjson.js +154 -0
- package/lib/net.js +98 -0
- package/lib/order.js +284 -0
- package/lib/patch.js +521 -0
- package/lib/pnpm-compat.js +490 -0
- package/lib/presets.js +278 -0
- package/lib/profile.js +911 -0
- package/lib/region-probe.js +93 -0
- package/lib/regions.js +253 -0
- package/lib/registry.js +204 -0
- package/lib/restart.js +373 -0
- package/lib/routes.js +4372 -0
- package/lib/settings.js +109 -0
- package/lib/skill-market/api.js +119 -0
- package/lib/skill-market/config.js +29 -0
- package/lib/skill-market/installer.js +352 -0
- package/lib/skill-market/runtime.js +13 -0
- package/lib/skill-market/tui.js +119 -0
- package/lib/skill-market/types.js +1 -0
- package/lib/skill-market/web-routes.js +123 -0
- package/lib/snapshot.js +500 -0
- package/lib/source-migration.js +54 -0
- package/lib/sources.js +596 -0
- package/lib/store.js +91 -0
- package/lib/themes.js +102 -0
- package/lib/trial.js +116 -0
- package/lib/types/accelerate.d.ts +85 -0
- package/lib/types/agents.d.ts +22 -0
- package/lib/types/backup.d.ts +131 -0
- package/lib/types/catalog-local-match.d.ts +50 -0
- package/lib/types/catalog-npm.d.ts +47 -0
- package/lib/types/changelog.d.ts +102 -0
- package/lib/types/channels.d.ts +56 -0
- package/lib/types/check.d.ts +266 -0
- package/lib/types/compatibility.d.ts +64 -0
- package/lib/types/diagnostics.d.ts +29 -0
- package/lib/types/discovery-compatibility.d.ts +80 -0
- package/lib/types/dsh-cli.d.ts +324 -0
- package/lib/types/dsh-install.d.ts +46 -0
- package/lib/types/gist.d.ts +53 -0
- package/lib/types/groups.d.ts +34 -0
- package/lib/types/home-paths.d.ts +16 -0
- package/lib/types/hot.d.ts +221 -0
- package/lib/types/http.d.ts +12 -0
- package/lib/types/index.d.ts +14 -0
- package/lib/types/install.d.ts +172 -0
- package/lib/types/log.d.ts +43 -0
- package/lib/types/ndjson.d.ts +52 -0
- package/lib/types/net.d.ts +58 -0
- package/lib/types/order.d.ts +100 -0
- package/lib/types/patch.d.ts +129 -0
- package/lib/types/pnpm-compat.d.ts +93 -0
- package/lib/types/presets.d.ts +90 -0
- package/lib/types/profile.d.ts +253 -0
- package/lib/types/region-probe.d.ts +50 -0
- package/lib/types/regions.d.ts +122 -0
- package/lib/types/registry.d.ts +86 -0
- package/lib/types/restart.d.ts +194 -0
- package/lib/types/routes.d.ts +67 -0
- package/lib/types/settings.d.ts +78 -0
- package/lib/types/skill-market/api.d.ts +10 -0
- package/lib/types/skill-market/config.d.ts +3 -0
- package/lib/types/skill-market/installer.d.ts +23 -0
- package/lib/types/skill-market/runtime.d.ts +10 -0
- package/lib/types/skill-market/tui.d.ts +4 -0
- package/lib/types/skill-market/types.d.ts +71 -0
- package/lib/types/skill-market/web-routes.d.ts +19 -0
- package/lib/types/snapshot.d.ts +93 -0
- package/lib/types/source-migration.d.ts +11 -0
- package/lib/types/sources.d.ts +216 -0
- package/lib/types/store.d.ts +30 -0
- package/lib/types/themes.d.ts +40 -0
- package/lib/types/trial.d.ts +61 -0
- package/lib/types/update-api-v1.d.ts +66 -0
- package/lib/types/updates.d.ts +123 -0
- package/lib/types/verify.d.ts +139 -0
- package/lib/update-api-v1.js +215 -0
- package/lib/updates.js +361 -0
- package/lib/verify.js +453 -0
- package/package.json +121 -0
- package/src/accelerate.ts +213 -0
- package/src/agents.ts +43 -0
- package/src/backup.ts +583 -0
- package/src/catalog-local-match.ts +144 -0
- package/src/catalog-npm.ts +120 -0
- package/src/changelog.ts +282 -0
- package/src/channels.ts +70 -0
- package/src/check.ts +1239 -0
- package/src/client/CommentsModal.tsx +119 -0
- package/src/client/Diagnostics.tsx +907 -0
- package/src/client/ErrorBoundary.tsx +111 -0
- package/src/client/InstallToast.tsx +31 -0
- package/src/client/Market.module.css +830 -0
- package/src/client/MarketSection.tsx +5301 -0
- package/src/client/OperationsPanel.tsx +365 -0
- package/src/client/SettingsCard.tsx +621 -0
- package/src/client/SkillMarket.module.css +21 -0
- package/src/client/SkillMarketSection.tsx +162 -0
- package/src/client/comments.ts +54 -0
- package/src/client/globals.d.ts +13 -0
- package/src/client/index.ts +180 -0
- package/src/client/locales.ts +1112 -0
- package/src/client/market-data.ts +1321 -0
- package/src/client/operations.ts +201 -0
- package/src/client/preset-panel.tsx +263 -0
- package/src/client/primitives.d.ts +140 -0
- package/src/client/self-check.ts +147 -0
- package/src/client/snapshot-panel.tsx +244 -0
- package/src/compatibility.ts +237 -0
- package/src/diagnostics.ts +84 -0
- package/src/discovery-compatibility.ts +315 -0
- package/src/dsh-cli.ts +1126 -0
- package/src/dsh-install.ts +118 -0
- package/src/gist.ts +362 -0
- package/src/groups.ts +111 -0
- package/src/home-paths.ts +53 -0
- package/src/hot.ts +628 -0
- package/src/http.ts +41 -0
- package/src/index.ts +128 -0
- package/src/install.ts +420 -0
- package/src/log.ts +206 -0
- package/src/ndjson.ts +185 -0
- package/src/net.ts +106 -0
- package/src/order.ts +303 -0
- package/src/patch.ts +522 -0
- package/src/pnpm-compat.ts +527 -0
- package/src/presets.ts +344 -0
- package/src/profile.ts +940 -0
- package/src/region-probe.ts +97 -0
- package/src/regions.ts +310 -0
- package/src/registry.ts +250 -0
- package/src/restart.ts +396 -0
- package/src/routes.ts +4506 -0
- package/src/settings.ts +141 -0
- package/src/skill-market/api.ts +130 -0
- package/src/skill-market/config.ts +32 -0
- package/src/skill-market/installer.ts +337 -0
- package/src/skill-market/runtime.ts +14 -0
- package/src/skill-market/tui.ts +157 -0
- package/src/skill-market/types.ts +80 -0
- package/src/skill-market/web-routes.ts +132 -0
- package/src/snapshot.ts +532 -0
- package/src/source-migration.ts +61 -0
- package/src/sources.ts +565 -0
- package/src/store.ts +89 -0
- package/src/themes.ts +125 -0
- package/src/trial.ts +156 -0
- package/src/update-api-v1.ts +277 -0
- package/src/updates.ts +400 -0
- package/src/verify.ts +492 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The market's last line of defence: a crash renders a way out, not a blank.
|
|
3
|
+
*
|
|
4
|
+
* Every part of the market UI is inside one React tree. When that tree
|
|
5
|
+
* throws during render or commit, React unmounts it — and what the user gets
|
|
6
|
+
* is an empty settings panel, with the "export log" button gone along with
|
|
7
|
+
* everything else. That is not hypothetical: it is #293, where browser page
|
|
8
|
+
* translation replaced text nodes under React and the resulting
|
|
9
|
+
* NotFoundError blanked the panel for months, and every request for a log
|
|
10
|
+
* came back empty because there was no longer a button to press.
|
|
11
|
+
*
|
|
12
|
+
* #513 fixed that particular trigger. This exists because the next one will
|
|
13
|
+
* be different, and the property worth having is not "translation is
|
|
14
|
+
* handled" but "a crash is survivable and reportable".
|
|
15
|
+
*
|
|
16
|
+
* Deliberately not a retry loop. If the same render throws again the
|
|
17
|
+
* boundary catches it again and the user is back here, which is honest —
|
|
18
|
+
* an automatic remount would flicker between a broken UI and this panel
|
|
19
|
+
* with no way to read either.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { Component, createElement as h } from 'react'
|
|
23
|
+
import type { ErrorInfo, ReactNode } from 'react'
|
|
24
|
+
|
|
25
|
+
interface Props {
|
|
26
|
+
/** Optional so `createElement(Boundary, props, child)` type-checks. */
|
|
27
|
+
children?: ReactNode
|
|
28
|
+
/** Rendered under the message; the export-log control belongs here. */
|
|
29
|
+
actions?: ReactNode
|
|
30
|
+
/** Bilingual strings, so this file holds no copy of its own. */
|
|
31
|
+
text: { title: string; hint: string; reload: string; details: string }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface State {
|
|
35
|
+
error: Error | null
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The last crash this boundary caught, for the exported log.
|
|
40
|
+
*
|
|
41
|
+
* Module-level rather than component state because the log export runs
|
|
42
|
+
* outside this tree — and a crash the user has already dismissed is still
|
|
43
|
+
* the most useful line in their report.
|
|
44
|
+
*/
|
|
45
|
+
let lastCrash: { message: string; stack: string | null; at: string } | null = null
|
|
46
|
+
|
|
47
|
+
/** The crash to report in the exported log, or null when there was none. */
|
|
48
|
+
export function lastMarketCrash(): { message: string; stack: string | null; at: string } | null {
|
|
49
|
+
return lastCrash
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Testing seam: forget the recorded crash. */
|
|
53
|
+
export function forgetMarketCrash(): void {
|
|
54
|
+
lastCrash = null
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export class MarketErrorBoundary extends Component<Props, State> {
|
|
58
|
+
state: State = { error: null }
|
|
59
|
+
|
|
60
|
+
static getDerivedStateFromError(error: Error): State {
|
|
61
|
+
return { error }
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
componentDidCatch(error: Error, info: ErrorInfo): void {
|
|
65
|
+
lastCrash = {
|
|
66
|
+
message: error.message,
|
|
67
|
+
// React's component stack says WHERE, which the JS stack does not once
|
|
68
|
+
// the bundle is minified — and a reporter cannot get either by hand.
|
|
69
|
+
stack: info.componentStack ?? error.stack ?? null,
|
|
70
|
+
at: new Date().toISOString(),
|
|
71
|
+
}
|
|
72
|
+
// Kept on the console too: a developer looking at a live page should not
|
|
73
|
+
// have to export a file to see what a boundary swallowed.
|
|
74
|
+
console.error('[ChatCode CLI Market] the market UI crashed and was replaced by its recovery panel', error, info.componentStack)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
render(): ReactNode {
|
|
78
|
+
const { error } = this.state
|
|
79
|
+
if (error === null) return this.props.children
|
|
80
|
+
const { text, actions } = this.props
|
|
81
|
+
return h('div', {
|
|
82
|
+
// Marked like the real root so the exported log's "market roots"
|
|
83
|
+
// count does not read as "never mounted" for a crashed market —
|
|
84
|
+
// those are different failures and the log has to keep telling them
|
|
85
|
+
// apart.
|
|
86
|
+
'data-dsh-market-root': '',
|
|
87
|
+
'data-dsh-market-crashed': '',
|
|
88
|
+
translate: 'no',
|
|
89
|
+
className: 'notranslate',
|
|
90
|
+
style: { padding: '24px', display: 'flex', flexDirection: 'column', gap: '12px', alignItems: 'flex-start' },
|
|
91
|
+
}, [
|
|
92
|
+
h('div', { key: 'title', style: { fontSize: '14px', fontWeight: 600 } }, text.title),
|
|
93
|
+
h('div', { key: 'hint', style: { fontSize: '12px', lineHeight: '19px', opacity: 0.8, whiteSpace: 'pre-wrap' } }, text.hint),
|
|
94
|
+
h('div', { key: 'actions', style: { display: 'flex', gap: '8px', flexWrap: 'wrap' } }, [
|
|
95
|
+
h('button', {
|
|
96
|
+
key: 'reload',
|
|
97
|
+
type: 'button',
|
|
98
|
+
onClick: () => { this.setState({ error: null }) },
|
|
99
|
+
}, text.reload),
|
|
100
|
+
actions,
|
|
101
|
+
]),
|
|
102
|
+
h('details', { key: 'details', style: { fontSize: '11px', opacity: 0.7 } }, [
|
|
103
|
+
h('summary', { key: 'summary', style: { cursor: 'pointer' } }, text.details),
|
|
104
|
+
h('pre', {
|
|
105
|
+
key: 'body',
|
|
106
|
+
style: { whiteSpace: 'pre-wrap', wordBreak: 'break-word', margin: '8px 0 0' },
|
|
107
|
+
}, error.message),
|
|
108
|
+
]),
|
|
109
|
+
])
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-reload confirmation via the official Toast primitive: shown once after
|
|
3
|
+
* the refresh that follows a hot install or theme switch, so the user lands
|
|
4
|
+
* back in their flow with visible proof.
|
|
5
|
+
*/
|
|
6
|
+
import { useState } from 'react'
|
|
7
|
+
import { IconSparkle16, Toast } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
8
|
+
import { readSession } from './market-data.ts'
|
|
9
|
+
import type { Translate } from './market-data.ts'
|
|
10
|
+
|
|
11
|
+
export function InstallToast(props: { t: Translate }) {
|
|
12
|
+
const t = props.t
|
|
13
|
+
const [mode] = useState(() => {
|
|
14
|
+
const value = sessionStorage.getItem('dshm-toast-mode')
|
|
15
|
+
sessionStorage.removeItem('dshm-toast-mode')
|
|
16
|
+
return value
|
|
17
|
+
})
|
|
18
|
+
const [names, setNames] = useState<string[]>(() => {
|
|
19
|
+
const value = readSession('dshm-toast')
|
|
20
|
+
sessionStorage.removeItem('dshm-toast')
|
|
21
|
+
return Array.isArray(value) ? value : []
|
|
22
|
+
})
|
|
23
|
+
if (names.length === 0) return null
|
|
24
|
+
return (
|
|
25
|
+
<Toast
|
|
26
|
+
text={names.join(', ') + ' ' + t(mode === 'theme' ? 'toastTheme' : 'toastReady')}
|
|
27
|
+
icon={<IconSparkle16 size={14} />}
|
|
28
|
+
onDone={() => setNames([])}
|
|
29
|
+
/>
|
|
30
|
+
)
|
|
31
|
+
}
|