aitoearn-dsh-plugin-test 0.0.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.
Files changed (62) hide show
  1. package/AGENT.md +39 -0
  2. package/README.md +46 -0
  3. package/cordis.patch.yml +3 -0
  4. package/lib/client.js +453 -0
  5. package/lib/client.js.map +7 -0
  6. package/package.json +138 -0
  7. package/presets/aitoearn/agent.cordis.yml +22 -0
  8. package/presets/aitoearn/lib/mcp.js +150 -0
  9. package/presets/aitoearn/lib/mcp.js.map +7 -0
  10. package/presets/aitoearn/lib/persona.js +21 -0
  11. package/presets/aitoearn/lib/persona.js.map +7 -0
  12. package/presets/aitoearn/package.json +22 -0
  13. package/presets/aitoearn/preset.yml +3 -0
  14. package/skills/browser-operations/SKILL.md +85 -0
  15. package/skills/channel-publish/SKILL.md +99 -0
  16. package/skills/image-creation/SKILL.md +136 -0
  17. package/skills/image-creation/references/prompting.md +103 -0
  18. package/skills/image-creation/references/sample-prompts.md +310 -0
  19. package/skills/image-edit/SKILL.md +95 -0
  20. package/skills/video-generation/SKILL.md +61 -0
  21. package/skills/video-generation/references/model-comparison.md +76 -0
  22. package/skills/video-generation/references/seedance-2-0-guide.md +1050 -0
  23. package/skills/video-generation/references/seedance-2-5-guide.md +997 -0
  24. package/src/dsh/auth.d.ts +25 -0
  25. package/src/dsh/auth.js +60 -0
  26. package/src/dsh/auth.js.map +1 -0
  27. package/src/dsh/client/AitoearnCard.d.ts +15 -0
  28. package/src/dsh/client/AitoearnCard.js +50 -0
  29. package/src/dsh/client/AitoearnCard.js.map +1 -0
  30. package/src/dsh/client/card-store.d.ts +34 -0
  31. package/src/dsh/client/card-store.js +130 -0
  32. package/src/dsh/client/card-store.js.map +1 -0
  33. package/src/dsh/client/card.css.d.ts +31 -0
  34. package/src/dsh/client/card.css.js +80 -0
  35. package/src/dsh/client/card.css.js.map +1 -0
  36. package/src/dsh/client/i18n.d.ts +55 -0
  37. package/src/dsh/client/i18n.js +49 -0
  38. package/src/dsh/client/i18n.js.map +1 -0
  39. package/src/dsh/client/index.d.ts +4 -0
  40. package/src/dsh/client/index.js +21 -0
  41. package/src/dsh/client/index.js.map +1 -0
  42. package/src/dsh/index.d.ts +8 -0
  43. package/src/dsh/index.js +20 -0
  44. package/src/dsh/index.js.map +1 -0
  45. package/src/dsh/mcp.d.ts +5 -0
  46. package/src/dsh/mcp.js +54 -0
  47. package/src/dsh/mcp.js.map +1 -0
  48. package/src/dsh/paths.d.ts +6 -0
  49. package/src/dsh/paths.js +22 -0
  50. package/src/dsh/paths.js.map +1 -0
  51. package/src/dsh/persona.d.ts +4 -0
  52. package/src/dsh/persona.js +19 -0
  53. package/src/dsh/persona.js.map +1 -0
  54. package/src/dsh/preset-sync.d.ts +1 -0
  55. package/src/dsh/preset-sync.js +55 -0
  56. package/src/dsh/preset-sync.js.map +1 -0
  57. package/src/dsh/settings-schema.d.ts +13 -0
  58. package/src/dsh/settings-schema.js +15 -0
  59. package/src/dsh/settings-schema.js.map +1 -0
  60. package/src/dsh/tool-name.d.ts +9 -0
  61. package/src/dsh/tool-name.js +32 -0
  62. package/src/dsh/tool-name.js.map +1 -0
@@ -0,0 +1,25 @@
1
+ export declare const MCP_PATH = "/api/ai/agent/mcp";
2
+ export declare const API_KEY_ENV = "AITOEARN_API_KEY";
3
+ export declare const DEFAULT_ENVIRONMENT = "global";
4
+ export declare const SETTINGS_NAMESPACE = "aitoearn";
5
+ export declare const ENVIRONMENT_ORIGINS: {
6
+ readonly global: "https://aitoearn.ai";
7
+ readonly cn: "https://aitoearn.cn";
8
+ };
9
+ export declare const DEFAULT_MCP_URL: string;
10
+ export type AitoearnEnvironment = 'global' | 'cn' | 'custom';
11
+ export interface AitoearnAuth {
12
+ mcpUrl: string;
13
+ apiKey: string;
14
+ }
15
+ export interface AitoearnPluginConfig {
16
+ environment?: string;
17
+ baseUrl?: string;
18
+ apiKey?: string;
19
+ }
20
+ export declare function pluginConfigFromSettings(section: unknown, fallback?: AitoearnPluginConfig): AitoearnPluginConfig;
21
+ export declare function resolveEnvironment(value: string | undefined): AitoearnEnvironment;
22
+ export declare function resolveOrigin(environment: AitoearnEnvironment, baseUrl?: string): string;
23
+ export declare function resolveMcpUrl(config: AitoearnPluginConfig): string;
24
+ export declare function resolveAuth(config: AitoearnPluginConfig, env?: NodeJS.ProcessEnv): AitoearnAuth;
25
+ export declare function authorizationHeader(apiKey: string): Record<string, string>;
@@ -0,0 +1,60 @@
1
+ export const MCP_PATH = '/api/ai/agent/mcp';
2
+ export const API_KEY_ENV = 'AITOEARN_API_KEY';
3
+ export const DEFAULT_ENVIRONMENT = 'global';
4
+ export const SETTINGS_NAMESPACE = 'aitoearn';
5
+ export const ENVIRONMENT_ORIGINS = {
6
+ global: 'https://aitoearn.ai',
7
+ cn: 'https://aitoearn.cn',
8
+ };
9
+ export const DEFAULT_MCP_URL = `${ENVIRONMENT_ORIGINS.global}${MCP_PATH}`;
10
+ export function pluginConfigFromSettings(section, fallback = {}) {
11
+ if (section === null || typeof section !== 'object' || Array.isArray(section))
12
+ return fallback;
13
+ const record = section;
14
+ return {
15
+ ...fallback,
16
+ ...(typeof record['environment'] === 'string' ? { environment: record['environment'] } : {}),
17
+ ...(typeof record['baseUrl'] === 'string' ? { baseUrl: record['baseUrl'] } : {}),
18
+ ...(typeof record['apiKey'] === 'string' ? { apiKey: record['apiKey'] } : {}),
19
+ };
20
+ }
21
+ export function resolveEnvironment(value) {
22
+ if (value === 'cn' || value === 'custom' || value === 'global')
23
+ return value;
24
+ return DEFAULT_ENVIRONMENT;
25
+ }
26
+ export function resolveOrigin(environment, baseUrl) {
27
+ if (environment !== 'custom')
28
+ return ENVIRONMENT_ORIGINS[environment];
29
+ const trimmed = baseUrl?.trim() ?? '';
30
+ if (trimmed.length === 0)
31
+ return '';
32
+ try {
33
+ const url = new URL(trimmed);
34
+ if (url.protocol !== 'http:' && url.protocol !== 'https:')
35
+ return '';
36
+ return url.origin;
37
+ }
38
+ catch {
39
+ return '';
40
+ }
41
+ }
42
+ export function resolveMcpUrl(config) {
43
+ const environment = resolveEnvironment(config.environment);
44
+ const origin = resolveOrigin(environment, config.baseUrl);
45
+ if (origin.length === 0)
46
+ return '';
47
+ return `${origin}${MCP_PATH}`;
48
+ }
49
+ export function resolveAuth(config, env = process.env) {
50
+ return {
51
+ mcpUrl: resolveMcpUrl(config),
52
+ apiKey: config.apiKey?.trim() || env[API_KEY_ENV]?.trim() || '',
53
+ };
54
+ }
55
+ export function authorizationHeader(apiKey) {
56
+ if (apiKey.length === 0)
57
+ return {};
58
+ return { Authorization: `Bearer ${apiKey}` };
59
+ }
60
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../tools/agent-plugin/src/dsh/auth.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,mBAAmB,CAAA;AAC3C,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,CAAA;AAC7C,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CAAA;AAC3C,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAA;AAE5C,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,MAAM,EAAE,qBAAqB;IAC7B,EAAE,EAAE,qBAAqB;CACjB,CAAA;AAEV,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,mBAAmB,CAAC,MAAM,GAAG,QAAQ,EAAE,CAAA;AAezE,MAAM,UAAU,wBAAwB,CACtC,OAAgB,EAChB,WAAiC,EAAE;IAEnC,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QAC3E,OAAO,QAAQ,CAAA;IACjB,MAAM,MAAM,GAAG,OAAkC,CAAA;IACjD,OAAO;QACL,GAAG,QAAQ;QACX,GAAG,CAAC,OAAO,MAAM,CAAC,aAAa,CAAC,K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M,WAAW,GAAG,kBAAkB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;IAC1D,MAAM,MAAM,GAAG,aAAa,CAAC,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA;IACzD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QACrB,OAAO,EAAE,CAAA;IACX,OAAO,GAAG,MAAM,GAAG,QAAQ,EAAE,CAAA;AAC/B,CAAC;AAED,MAAM,UAAU,WAAW,CACzB,MAA4B,EAC5B,MAAyB,OAAO,CAAC,GAAG;IAEpC,OAAO;QACL,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC;QAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE;KAChE,CAAA;AACH,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAc;IAChD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QACrB,OAAO,EAAE,CAAA;IACX,OAAO,EAAE,aAAa,EAAE,UAAU,MAAM,EAAE,EAAE,CAAA;AAC9C,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { SnapshotSelectorHook, TranslateNS } from '@deepseek-ai/dsh-client-ui-slots';
2
+ import { AitoearnCardState } from './card-store.js';
3
+ export interface AitoearnCardProps {
4
+ t: TranslateNS<'aitoearn-card'>;
5
+ useAitoearnCard: SnapshotSelectorHook<AitoearnCardState>;
6
+ edit: (field: 'environment' | 'baseUrl' | 'apiKey', value: string) => void;
7
+ save: () => void;
8
+ discard: () => void;
9
+ }
10
+ /**
11
+ * The Aitoearn plugin settings card, laid out after the official plugin cards:
12
+ * a header naming the plugin, its fields in place, and the footer that writes
13
+ * the staged edits.
14
+ */
15
+ export declare function AitoearnCard(props: AitoearnCardProps): import("react").JSX.Element | null;
@@ -0,0 +1,50 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { IconChevronDownOutline14, Tag } from '@deepseek-ai/dsh-client-ui-primitives';
3
+ import { useEffect, useRef, useState } from 'react';
4
+ import * as css from './card.css.js';
5
+ const cx = (names) => names.filter(Boolean).join(' ');
6
+ const ENVIRONMENT_OPTIONS = [
7
+ { value: 'global', labelKey: 'envGlobal' },
8
+ { value: 'cn', labelKey: 'envCn' },
9
+ { value: 'custom', labelKey: 'envCustom' },
10
+ ];
11
+ /**
12
+ * The Aitoearn plugin settings card, laid out after the official plugin cards:
13
+ * a header naming the plugin, its fields in place, and the footer that writes
14
+ * the staged edits.
15
+ */
16
+ export function AitoearnCard(props) {
17
+ const { t } = props;
18
+ const state = props.useAitoearnCard(snapshot => snapshot);
19
+ const [open, setOpen] = useState(false);
20
+ const saveStarted = useRef(false);
21
+ useEffect(() => {
22
+ if (state.saving) {
23
+ saveStarted.current = true;
24
+ return;
25
+ }
26
+ if (!saveStarted.current)
27
+ return;
28
+ saveStarted.current = false;
29
+ if (!state.dirty && !state.failed)
30
+ setOpen(false);
31
+ }, [state.dirty, state.failed, state.saving]);
32
+ if (!state.available)
33
+ return null;
34
+ const disabled = !state.writable;
35
+ const blocked = !state.dirty || state.saving;
36
+ return (_jsxs("li", { className: cx([css.card, open && css.cardOpen]), children: [_jsxs("button", { type: "button", className: css.header, "aria-expanded": open, "aria-label": `${t(open ? 'collapse' : 'expand')}: ${t('title')}`, onClick: () => {
37
+ setOpen(!open);
38
+ }, children: [_jsxs("span", { className: css.headText, children: [_jsx("span", { className: css.name, children: t('title') }), _jsx("span", { className: css.description, children: t('description') })] }), state.dirty ? _jsx(Tag, { tone: "neutral", className: css.pending, children: t('unsaved') }) : null, _jsx(IconChevronDownOutline14, { className: cx([css.chevron, open && css.chevronOpen]) })] }), open
39
+ ? (_jsxs("div", { className: css.body, children: [!state.writable ? _jsx("p", { className: css.readOnly, role: "status", children: t('readOnly') }) : null, _jsxs("div", { className: css.field, children: [_jsx("div", { className: css.head, children: _jsx("span", { className: css.label, id: "aitoearn-environment-label", children: t('environment') }) }), _jsx("div", { className: css.envGroup, role: "radiogroup", "aria-labelledby": "aitoearn-environment-label", children: ENVIRONMENT_OPTIONS.map(option => (_jsx("button", { type: "button", role: "radio", "aria-checked": state.environment === option.value, className: cx([css.envPill, state.environment === option.value && css.envPillActive]), disabled: disabled, onClick: () => {
40
+ props.edit('environment', option.value);
41
+ }, children: t(option.labelKey) }, option.value))) })] }), state.environment === 'custom'
42
+ ? (_jsxs("div", { className: css.field, children: [_jsx("div", { className: css.head, children: _jsx("label", { className: css.label, htmlFor: "aitoearn-base-url", children: t('baseUrl') }) }), _jsx("input", { id: "aitoearn-base-url", className: css.input, type: "text", value: state.baseUrl, placeholder: "https://example.com", disabled: disabled, onChange: (event) => {
43
+ props.edit('baseUrl', event.currentTarget.value);
44
+ } }), _jsx("p", { className: css.hint, children: t('baseUrlHint') })] }))
45
+ : null, _jsxs("div", { className: css.field, children: [_jsxs("div", { className: css.head, children: [_jsx("label", { className: css.label, htmlFor: "aitoearn-api-key", children: t('apiKey') }), _jsx("span", { className: css.badges, children: _jsx(Tag, { tone: state.apiKeyConfigured ? 'neutral' : 'quiet', children: state.apiKeyConfigured ? t('apiKeySet') : t('apiKeyUnset') }) })] }), _jsx("input", { id: "aitoearn-api-key", className: css.input, type: "password", autoComplete: "off", value: state.apiKey, disabled: disabled, onChange: (event) => {
46
+ props.edit('apiKey', event.currentTarget.value);
47
+ } }), _jsx("p", { className: css.hint, children: t('apiKeyHint') })] }), _jsxs("div", { className: css.footer, children: [state.failed ? _jsx("p", { className: css.failed, role: "status", children: t('saveFailed') }) : null, _jsx("button", { type: "button", className: css.discard, disabled: !state.dirty || state.saving, onClick: props.discard, children: t('discard') }), _jsx("button", { type: "button", className: css.save, disabled: blocked, onClick: props.save, children: t(state.saving ? 'saving' : 'save') })] })] }))
48
+ : null] }));
49
+ }
50
+ //# sourceMappingURL=AitoearnCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AitoearnCard.js","sourceRoot":"","sources":["../../../../../../../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,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;oCACjD,CAAC,GACD,EACF,YAAG,SAAS,EAAE,GAAG,CAAC,IAAI,YAAG,CAAC,CAAC,YAAY,CAAC,GAAK,IACzC,EACN,eAAK,SAAS,EAAE,GAAG,CAAC,MAAM,aACvB,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,YAAG,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,EAAC,QAAQ,YAAE,CAAC,CAAC,YAAY,CAAC,GAAK,CAAC,CAAC,CAAC,IAAI,EACpF,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,GAAG,CAAC,OAAO,EACtB,QAAQ,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,EACtC,OAAO,EAAE,KAAK,CAAC,OAAO,YAErB,CAAC,CAAC,SAAS,CAAC,GACN,EACT,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,GAAG,CAAC,IAAI,EACnB,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,KAAK,CAAC,IAAI,YAElB,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,GAC7B,IACL,IACF,CACP;gBACH,CAAC,CAAC,IAAI,IACL,CACN,CAAA;AACH,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { SnapshotStore } from '@deepseek-ai/dsh-client-store';
2
+ import { SettingsDescribeFace, SettingsScope } from '@deepseek-ai/dsh-client-ui-settings/client';
3
+ import { AitoearnEnvironment, AitoearnPluginConfig } from '../auth.js';
4
+ export type AitoearnCardField = 'environment' | 'baseUrl' | 'apiKey';
5
+ export interface AitoearnCardState {
6
+ available: boolean;
7
+ writable: boolean;
8
+ dirty: boolean;
9
+ saving: boolean;
10
+ failed: boolean;
11
+ environment: AitoearnEnvironment;
12
+ baseUrl: string;
13
+ apiKey: string;
14
+ apiKeyConfigured: boolean;
15
+ }
16
+ export interface AitoearnCardFace {
17
+ hooks: {
18
+ aitoearnCard: SnapshotStore<AitoearnCardState>;
19
+ };
20
+ edit: (field: AitoearnCardField, value: string) => void;
21
+ save: () => void;
22
+ discard: () => void;
23
+ }
24
+ /**
25
+ * Bridges the `aitoearn` settings scope onto the card's staged form. Edits stay
26
+ * local drafts until `save` writes them in one gesture; a save that did not land
27
+ * keeps its drafts so the user can correct them instead of retyping.
28
+ *
29
+ * The API key is a schema-declared secret: the Host redacts it from every view
30
+ * it serves, so the key can never be read back and the input starts blank. A
31
+ * blank draft keeps the stored key, and whether one is configured comes from
32
+ * the namespace view's secret record.
33
+ */
34
+ export declare function createAitoearnCardFace(scope: SettingsScope<AitoearnPluginConfig>, describe: SettingsDescribeFace): AitoearnCardFace;
@@ -0,0 +1,130 @@
1
+ import { createSnapshotStore } from '@deepseek-ai/dsh-client-store';
2
+ import { resolveEnvironment, SETTINGS_NAMESPACE } from '../auth.js';
3
+ /**
4
+ * Bridges the `aitoearn` settings scope onto the card's staged form. Edits stay
5
+ * local drafts until `save` writes them in one gesture; a save that did not land
6
+ * keeps its drafts so the user can correct them instead of retyping.
7
+ *
8
+ * The API key is a schema-declared secret: the Host redacts it from every view
9
+ * it serves, so the key can never be read back and the input starts blank. A
10
+ * blank draft keeps the stored key, and whether one is configured comes from
11
+ * the namespace view's secret record.
12
+ */
13
+ export function createAitoearnCardFace(scope, describe) {
14
+ let draft = {};
15
+ let saving = false;
16
+ let failed = false;
17
+ const store = createSnapshotStore(project());
18
+ function stored() {
19
+ return scope.getSnapshot().value ?? {};
20
+ }
21
+ function apiKeyConfigured() {
22
+ const view = describe.getSnapshot().view;
23
+ const section = view?.namespaces.find(candidate => candidate.ns === SETTINGS_NAMESPACE);
24
+ return section?.secrets.some((secret) => secret.path.length === 1 && secret.path[0] === 'apiKey' && secret.set) ?? false;
25
+ }
26
+ function pendingWrites() {
27
+ const value = stored();
28
+ const writes = [];
29
+ const environment = draft.environment ?? resolveEnvironment(value.environment);
30
+ if (draft.environment !== undefined && environment !== resolveEnvironment(value.environment))
31
+ writes.push('environment');
32
+ if (draft.apiKey !== undefined && draft.apiKey.trim() !== '')
33
+ writes.push('apiKey');
34
+ if (draft.baseUrl !== undefined && environment === 'custom' && draft.baseUrl !== (value.baseUrl ?? ''))
35
+ writes.push('baseUrl');
36
+ if (environment !== 'custom' && value.baseUrl !== undefined)
37
+ writes.push('baseUrl');
38
+ return writes;
39
+ }
40
+ function project() {
41
+ const snapshot = scope.getSnapshot();
42
+ const value = stored();
43
+ return {
44
+ available: snapshot.status === 'ready',
45
+ writable: snapshot.writable,
46
+ dirty: pendingWrites().length > 0,
47
+ saving,
48
+ failed,
49
+ environment: draft.environment ?? resolveEnvironment(value.environment),
50
+ baseUrl: draft.baseUrl ?? value.baseUrl ?? '',
51
+ apiKey: draft.apiKey ?? '',
52
+ apiKeyConfigured: apiKeyConfigured(),
53
+ };
54
+ }
55
+ const publish = () => {
56
+ store.set(project());
57
+ };
58
+ async function commit() {
59
+ const snapshot = scope.getSnapshot();
60
+ const writes = pendingWrites();
61
+ if (saving || snapshot.status !== 'ready' || !snapshot.writable || writes.length === 0)
62
+ return;
63
+ const value = stored();
64
+ const environment = draft.environment ?? resolveEnvironment(value.environment);
65
+ const baseUrl = draft.baseUrl ?? value.baseUrl ?? '';
66
+ const apiKey = draft.apiKey?.trim() ?? '';
67
+ saving = true;
68
+ failed = false;
69
+ publish();
70
+ try {
71
+ if (writes.includes('environment'))
72
+ await scope.set('environment', environment);
73
+ if (writes.includes('apiKey'))
74
+ await scope.set('apiKey', apiKey);
75
+ if (writes.includes('baseUrl')) {
76
+ if (environment === 'custom')
77
+ await scope.set('baseUrl', baseUrl);
78
+ else
79
+ await scope.unset('baseUrl');
80
+ }
81
+ }
82
+ catch {
83
+ // A rejected write keeps the drafts on screen (with the failure flag) so
84
+ // the user can correct them instead of retyping.
85
+ saving = false;
86
+ failed = true;
87
+ publish();
88
+ return;
89
+ }
90
+ const landed = (writes.includes('environment') ? resolveEnvironment(stored().environment) === environment : true)
91
+ && (writes.includes('apiKey') ? apiKeyConfigured() : true)
92
+ && (writes.includes('baseUrl')
93
+ ? (environment === 'custom' ? (stored().baseUrl ?? '') === baseUrl : stored().baseUrl === undefined)
94
+ : true);
95
+ saving = false;
96
+ if (landed)
97
+ draft = {};
98
+ else
99
+ failed = true;
100
+ publish();
101
+ }
102
+ scope.subscribe(publish);
103
+ describe.subscribe(publish);
104
+ void describe.ensure();
105
+ return {
106
+ hooks: { aitoearnCard: store },
107
+ edit: (field, value) => {
108
+ if (saving)
109
+ return;
110
+ failed = false;
111
+ if (field === 'environment') {
112
+ const environment = resolveEnvironment(value);
113
+ draft = environment === 'custom'
114
+ ? { ...draft, environment }
115
+ : { ...draft, environment, baseUrl: undefined };
116
+ }
117
+ else {
118
+ draft = { ...draft, [field]: value };
119
+ }
120
+ publish();
121
+ },
122
+ save: () => commit(),
123
+ discard: () => {
124
+ draft = {};
125
+ failed = false;
126
+ publish();
127
+ },
128
+ };
129
+ }
130
+ //# sourceMappingURL=card-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card-store.js","sourceRoot":"","sources":["../../../../../../../tools/agent-plugin/src/dsh/client/card-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAiB,MAAM,+BAA+B,CAAA;AAElF,OAAO,EAA6C,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAsC9G;;;;;;;;;GASG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAA0C,EAAE,QAA8B;IAC/G,IAAI,KAAK,GAAc,EAAE,CAAA;IACzB,IAAI,MAAM,GAAG,KAAK,CAAA;IAClB,IAAI,MAAM,GAAG,KAAK,CAAA;IAClB,MAAM,KAAK,GAAG,mBAAmB,CAAoB,OAAO,EAAE,CAAC,CAAA;IAE/D,SAAS,MAAM;QACb,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC,KAAK,I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the Aitoearn plugin settings card. Values mirror the
3
+ * official `PluginCard` / field styling in `@deepseek-ai/dsh-client-ui-settings-plugins`
4
+ * so the card reads like the Bash / Agent loop / Web search cards. Everything is
5
+ * token-styled through `--dsw-alias-*`; the sheet self-injects once, the same
6
+ * `style[data-plugin-css]` way the official client packages do.
7
+ */
8
+ export declare const card = "Ata_card";
9
+ export declare const cardOpen = "Ata_cardOpen";
10
+ export declare const header = "Ata_header";
11
+ export declare const headText = "Ata_headText";
12
+ export declare const name = "Ata_name";
13
+ export declare const description = "Ata_description";
14
+ export declare const pending = "Ata_pending";
15
+ export declare const chevron = "Ata_chevron";
16
+ export declare const chevronOpen = "Ata_chevronOpen";
17
+ export declare const body = "Ata_body";
18
+ export declare const readOnly = "Ata_readOnly";
19
+ export declare const footer = "Ata_footer";
20
+ export declare const failed = "Ata_failed";
21
+ export declare const discard = "Ata_discard";
22
+ export declare const save = "Ata_save";
23
+ export declare const field = "Ata_field";
24
+ export declare const head = "Ata_head";
25
+ export declare const label = "Ata_label";
26
+ export declare const badges = "Ata_badges";
27
+ export declare const input = "Ata_input";
28
+ export declare const hint = "Ata_hint";
29
+ export declare const envGroup = "Ata_envGroup";
30
+ export declare const envPill = "Ata_envPill";
31
+ export declare const envPillActive = "Ata_envPillActive";
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Card styles for the Aitoearn plugin settings card. Values mirror the
3
+ * official `PluginCard` / field styling in `@deepseek-ai/dsh-client-ui-settings-plugins`
4
+ * so the card reads like the Bash / Agent loop / Web search cards. Everything is
5
+ * token-styled through `--dsw-alias-*`; the sheet self-injects once, the same
6
+ * `style[data-plugin-css]` way the official client packages do.
7
+ */
8
+ const CARD_CSS = `
9
+ .Ata_card{border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-3);border-radius:16px;list-style:none;transition:border-color .16s,background .16s}
10
+ .Ata_card:hover{border-color:var(--dsw-alias-label-dimmed)}
11
+ .Ata_cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed)}
12
+ .Ata_header{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}
13
+ .Ata_header:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}
14
+ .Ata_headText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}
15
+ .Ata_name{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}
16
+ .Ata_description{color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:1.5}
17
+ .Ata_pending{flex:none}
18
+ .Ata_chevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .16s}
19
+ .Ata_chevronOpen{transform:rotate(180deg)}
20
+ .Ata_body{border-top:.5px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}
21
+ .Ata_readOnly{color:var(--dsw-alias-label-tertiary);margin:12px 0 0;font-size:12px;line-height:1.5}
22
+ .Ata_footer{border-top:.5px solid var(--dsw-alias-border-l2);justify-content:flex-end;align-items:center;gap:8px;padding:12px 0 4px;display:flex}
23
+ .Ata_failed{min-width:0;color:var(--dsw-alias-label-error);flex:1;margin:0;font-size:12px;line-height:1.5}
24
+ .Ata_discard,.Ata_save{appearance:none;font:inherit;cursor:pointer;border:1px solid #0000;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5;transition:background .16s,border-color .16s,color .16s}
25
+ .Ata_discard{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:0 0}
26
+ .Ata_discard:hover:not(:disabled){color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-dimmed)}
27
+ .Ata_discard:active:not(:disabled){background:var(--dsw-alias-interactive-bg-active)}
28
+ .Ata_save{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3)}
29
+ .Ata_discard:disabled,.Ata_save:disabled{opacity:.4;cursor:default}
30
+ .Ata_discard:focus-visible,.Ata_save:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}
31
+ .Ata_field{flex-direction:column;gap:6px;padding:12px 0;display:flex}
32
+ .Ata_field+.Ata_field{border-top:.5px solid var(--dsw-alias-border-l2)}
33
+ .Ata_head{align-items:center;gap:8px;display:flex}
34
+ .Ata_label{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}
35
+ .Ata_badges{align-items:center;gap:8px;display:inline-flex}
36
+ .Ata_input{border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-3);height:34px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 12px;font-size:13px;line-height:1.5}
37
+ .Ata_input:focus-visible{border-color:var(--dsw-alias-brand-primary);outline:none}
38
+ .Ata_input:disabled{color:var(--dsw-alias-label-tertiary);cursor:default}
39
+ .Ata_hint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:1.5}
40
+ .Ata_envGroup{flex-wrap:wrap;gap:8px;display:flex}
41
+ .Ata_envPill{appearance:none;font:inherit;cursor:pointer;border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-secondary);border-radius:999px;padding:5px 14px;font-size:13px;line-height:1.5;transition:background .16s,border-color .16s,color .16s}
42
+ .Ata_envPill:hover:not(:disabled):not(.Ata_envPillActive){color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-dimmed)}
43
+ .Ata_envPill:active:not(:disabled){background:var(--dsw-alias-bg-layer-4)}
44
+ .Ata_envPill:disabled{opacity:.4;cursor:not-allowed}
45
+ .Ata_envPill:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}
46
+ .Ata_envPillActive{border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-brand-primary)}
47
+ `;
48
+ const STYLE_TAG_ID = '@aitoearn/dsh-plugin/card.css';
49
+ if (typeof document !== 'undefined' && document.querySelector(`style[data-plugin-css="${STYLE_TAG_ID}"]`) === null) {
50
+ const tag = document.createElement('style');
51
+ tag.dataset['plugin'] = '@aitoearn/dsh-plugin';
52
+ tag.dataset['pluginCss'] = STYLE_TAG_ID;
53
+ tag.textContent = CARD_CSS;
54
+ document.head.appendChild(tag);
55
+ }
56
+ export const card = 'Ata_card';
57
+ export const cardOpen = 'Ata_cardOpen';
58
+ export const header = 'Ata_header';
59
+ export const headText = 'Ata_headText';
60
+ export const name = 'Ata_name';
61
+ export const description = 'Ata_description';
62
+ export const pending = 'Ata_pending';
63
+ export const chevron = 'Ata_chevron';
64
+ export const chevronOpen = 'Ata_chevronOpen';
65
+ export const body = 'Ata_body';
66
+ export const readOnly = 'Ata_readOnly';
67
+ export const footer = 'Ata_footer';
68
+ export const failed = 'Ata_failed';
69
+ export const discard = 'Ata_discard';
70
+ export const save = 'Ata_save';
71
+ export const field = 'Ata_field';
72
+ export const head = 'Ata_head';
73
+ export const label = 'Ata_label';
74
+ export const badges = 'Ata_badges';
75
+ export const input = 'Ata_input';
76
+ export const hint = 'Ata_hint';
77
+ export const envGroup = 'Ata_envGroup';
78
+ export const envPill = 'Ata_envPill';
79
+ export const envPillActive = 'Ata_envPillActive';
80
+ //# sourceMappingURL=card.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card.css.js","sourceRoot":"","sources":["../../../../../../../tools/agent-plugin/src/dsh/client/card.css.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuChB,CAAA;AAED,MAAM,YAAY,GAAG,+BAA+B,CAAA;AAEpD,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,QAAQ,CAAC,aAAa,CAAC,0BAA0B,YAAY,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;IACnH,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;IAC3C,GAAG,CAAC,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,GAAG,UAAU,CAAA;AAC9B,MAAM,CAAC,MAAM,QAAQ,GAAG,cAAc,CAAA;AACtC,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAA;AACpC,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAA"}
@@ -0,0 +1,55 @@
1
+ /** Locale dictionary for the Aitoearn plugin settings card. */
2
+ export declare const aitoearnCardNS = "aitoearn-card";
3
+ declare module '@deepseek-ai/dsh-client-ui-slots' {
4
+ interface LocaleNamespaceMap {
5
+ /** The Aitoearn plugin card's copy. */
6
+ 'aitoearn-card': keyof typeof aitoearnCardLocales.zh;
7
+ }
8
+ }
9
+ export type AitoearnCardLocaleKey = keyof typeof aitoearnCardLocales.zh;
10
+ export declare const aitoearnCardLocales: {
11
+ zh: {
12
+ title: string;
13
+ description: string;
14
+ environment: string;
15
+ envGlobal: string;
16
+ envCn: string;
17
+ envCustom: string;
18
+ baseUrl: string;
19
+ baseUrlHint: string;
20
+ apiKey: string;
21
+ apiKeySet: string;
22
+ apiKeyUnset: string;
23
+ apiKeyHint: string;
24
+ expand: string;
25
+ collapse: string;
26
+ save: string;
27
+ saving: string;
28
+ discard: string;
29
+ unsaved: string;
30
+ saveFailed: string;
31
+ readOnly: string;
32
+ };
33
+ en: {
34
+ title: string;
35
+ description: string;
36
+ environment: string;
37
+ envGlobal: string;
38
+ envCn: string;
39
+ envCustom: string;
40
+ baseUrl: string;
41
+ baseUrlHint: string;
42
+ apiKey: string;
43
+ apiKeySet: string;
44
+ apiKeyUnset: string;
45
+ apiKeyHint: string;
46
+ expand: string;
47
+ collapse: string;
48
+ save: string;
49
+ saving: string;
50
+ discard: string;
51
+ unsaved: string;
52
+ saveFailed: string;
53
+ readOnly: string;
54
+ };
55
+ };
@@ -0,0 +1,49 @@
1
+ /** Locale dictionary for the Aitoearn plugin settings card. */
2
+ export const aitoearnCardNS = 'aitoearn-card';
3
+ export const aitoearnCardLocales = {
4
+ zh: {
5
+ title: 'Aitoearn',
6
+ description: 'Aitoearn 工具的运行环境与 API Key。',
7
+ environment: '运行环境',
8
+ envGlobal: '国际站 aitoearn.ai',
9
+ envCn: '中国站 aitoearn.cn',
10
+ envCustom: '自定义',
11
+ baseUrl: '接口地址',
12
+ baseUrlHint: '留空则使用所选环境默认地址。',
13
+ apiKey: 'API Key',
14
+ apiKeySet: '已配置密钥。',
15
+ apiKeyUnset: '未配置密钥;配置之前 Aitoearn 工具不可用。',
16
+ apiKeyHint: '出于安全考虑密钥不会回显;留空表示保持当前密钥,输入新值将覆盖。',
17
+ expand: '展开设置',
18
+ collapse: '收起设置',
19
+ save: '保存',
20
+ saving: '保存中…',
21
+ discard: '放弃修改',
22
+ unsaved: '未保存',
23
+ saveFailed: '本部署没有接受这些值,已保留供你修改。',
24
+ readOnly: '本部署的设置为只读。',
25
+ },
26
+ en: {
27
+ title: 'Aitoearn',
28
+ description: 'Environment and API key for Aitoearn tools.',
29
+ environment: 'Environment',
30
+ envGlobal: 'Global (aitoearn.ai)',
31
+ envCn: 'China (aitoearn.cn)',
32
+ envCustom: 'Custom',
33
+ baseUrl: 'Base URL',
34
+ baseUrlHint: 'Leave blank to use the selected environment default.',
35
+ apiKey: 'API key',
36
+ apiKeySet: 'A key is configured.',
37
+ apiKeyUnset: 'No key is configured; Aitoearn tools are unavailable until one is.',
38
+ apiKeyHint: 'The key is never displayed back; leave blank to keep the current key, or type a new one to overwrite it.',
39
+ expand: 'Show settings',
40
+ collapse: 'Hide settings',
41
+ save: 'Save',
42
+ saving: 'Saving…',
43
+ discard: 'Discard',
44
+ unsaved: 'Unsaved',
45
+ saveFailed: 'The deployment did not accept these values; they were left for you to correct.',
46
+ readOnly: 'This deployment stores settings read-only.',
47
+ },
48
+ };
49
+ //# sourceMappingURL=i18n.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../../../../../../tools/agent-plugin/src/dsh/client/i18n.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAE/D,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAA;AAW7C,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,EAAE,EAAE;QACF,KAAK,EAAE,UAAU;QACjB,WAAW,EAAE,4BAA4B;QACzC,WAAW,EAAE,MAAM;QACnB,SAAS,EAAE,iBAAiB;QAC5B,KAAK,EAAE,iBAAiB;QACxB,SAAS,EAAE,KAAK;QAChB,OAAO,EAAE,MAAM;QACf,WAAW,EAAE,gBAAgB;QAC7B,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,QAAQ;QACnB,WAAW,EAAE,4BAA4B;QACzC,UAAU,EAAE,kCAAkC;QAC9C,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,MAAM;QAChB,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,MAAM;QACf,OAAO,EAAE,KAAK;QACd,UAAU,EAAE,qBAAqB;QACjC,QAAQ,EAAE,YAAY;KACvB;IACD,EAAE,EAAE;QACF,KAAK,EAAE,UAAU;QACjB,WAAW,EAAE,6CAA6C;QAC1D,WAAW,EAAE,aAAa;QAC1B,SAAS,EAAE,sBAAsB;QACjC,KAAK,EAAE,qBAAqB;QAC5B,SAAS,EAAE,QAAQ;QACnB,OAAO,EAAE,UAAU;QACnB,WAAW,EAAE,sDAAsD;QACnE,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,sBAAsB;QACjC,WAAW,EAAE,oEAAoE;QACjF,UAAU,EAAE,0GAA0G;QACtH,MAAM,EAAE,eAAe;QACvB,QAAQ,EAAE,eAAe;QACzB,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,SAAS;QAClB,UAAU,EAAE,gFAAgF;QAC5F,QAAQ,EAAE,4CAA4C;KACvD;CACF,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { Context } from '@deepseek-ai/cordis';
2
+ export declare const name = "aitoearn-settings-card";
3
+ export declare const inject: string[];
4
+ export declare function apply(ctx: Context): void;
@@ -0,0 +1,21 @@
1
+ import { pluginConfigFromSettings } from '../auth.js';
2
+ import { AitoearnCard } from './AitoearnCard.js';
3
+ import { createAitoearnCardFace } from './card-store.js';
4
+ import { aitoearnCardLocales, aitoearnCardNS } from './i18n.js';
5
+ export const name = 'aitoearn-settings-card';
6
+ export const inject = ['slots', 'locale', 'settingsScope'];
7
+ export function apply(ctx) {
8
+ ctx.effect(() => ctx.locale.register(aitoearnCardNS, aitoearnCardLocales), 'aitoearn-settings-card: dictionaries');
9
+ const scope = ctx.settingsScope.bind({
10
+ namespace: 'aitoearn',
11
+ decode: section => pluginConfigFromSettings(section),
12
+ });
13
+ const face = createAitoearnCardFace(scope, ctx.settingsScope.describe());
14
+ ctx.slots.inject('settings.plugin.item', () => ctx.slots.register({
15
+ name: 'settings.plugin.item',
16
+ key: 'aitoearn',
17
+ locale: aitoearnCardNS,
18
+ inject: () => face,
19
+ }, AitoearnCard));
20
+ }
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../tools/agent-plugin/src/dsh/client/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAE/D,MAAM,CAAC,MAAM,IAAI,GAAG,wBAAwB,CAAA;AAC5C,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAA;AAE1D,MAAM,UAAU,KAAK,CAAC,GAAY;IAChC,GAAG,CAAC,MAAM,CACR,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,mBAAmB,CAAC,EAC9D,sCAAsC,CACvC,CAAA;IACD,MAAM,KAAK,GAAG,GAAG,CAAC,aAAa,CAAC,IAAI,CAAuB;QACzD,SAAS,EAAE,UAAU;QACrB,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,wBAAwB,CAAC,OAAO,CAAC;KACrD,CAAC,CAAA;IACF,MAAM,IAAI,GAAG,sBAAsB,CAAC,KAAK,EAAE,GAAG,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAA;IACxE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,sBAAsB,EAAE,GAAG,EAAE,CAC5C,GAAG,CAAC,KAAK,CAAC,QAAQ,CAChB;QACE,IAAI,EAAE,sBAAsB;QAC5B,GAAG,EAAE,UAAU;QACf,MAAM,EAAE,cAAc;QACtB,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI;KACnB,EACD,YAAY,CACb,CAAC,CAAA;AACN,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Context } from '@deepseek-ai/cordis';
2
+ import { AitoearnPluginConfig, SETTINGS_NAMESPACE } from './auth.js';
3
+ export declare const name = "aitoearn";
4
+ export { SETTINGS_NAMESPACE };
5
+ export declare function apply(ctx: Context, config?: AitoearnPluginConfig, paths?: {
6
+ sourceDir?: string;
7
+ targetDir?: string;
8
+ }): void;