aitoearn-dsh-plugin-test 0.0.2 → 0.0.4
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/lib/client.js +34 -36
- package/lib/client.js.map +2 -2
- package/package.json +57 -40
- package/presets/aitoearn/lib/mcp.js +85 -21
- package/presets/aitoearn/lib/mcp.js.map +2 -2
- package/presets/aitoearn/package.json +14 -13
- package/skills/cloudedit/SKILL.md +113 -0
- package/skills/cloudedit/references/amk-scenarios/edit-asr.md +160 -0
- package/skills/cloudedit/references/edit-position.md +64 -0
- package/skills/cloudedit/references/edit-project.md +192 -0
- package/skills/cloudedit/references/edit-quality-gate.md +136 -0
- package/skills/cloudedit/references/edit-shader.md +114 -0
- package/skills/cloudedit/references/edit-text.md +227 -0
- package/skills/cloudedit/references/edit-timeline.md +29 -0
- package/skills/cloudedit-planner/SKILL.md +102 -0
- package/skills/cloudedit-planner/evals/evals.json +80 -0
- package/skills/cloudedit-planner/references/editing-plan.md +63 -0
- package/skills/cloudedit-planner/references/executable-handoff.md +25 -0
- package/skills/cloudedit-planner/references/media-evidence-models.md +32 -0
- package/skills/cloudedit-planner/references/media-understanding.md +25 -0
- package/skills/cloudedit-planner/references/processing-and-lineage.md +22 -0
- package/skills/cloudedit-planner/references/subtitle-timing.md +50 -0
- package/src/dsh/client/AitoearnCard.js +2 -2
- package/src/dsh/client/AitoearnCard.js.map +1 -1
- package/src/dsh/client/card-store.d.ts +2 -2
- package/src/dsh/client/card-store.js +18 -9
- package/src/dsh/client/card-store.js.map +1 -1
- package/src/dsh/client/index.js +15 -13
- package/src/dsh/client/index.js.map +1 -1
- package/src/dsh/index.d.ts +2 -1
- package/src/dsh/index.js +4 -6
- package/src/dsh/index.js.map +1 -1
- package/src/dsh/mcp.js +90 -21
- package/src/dsh/mcp.js.map +1 -1
- package/src/dsh/settings-schema.d.ts +16 -12
- package/src/dsh/settings-schema.js +8 -10
- package/src/dsh/settings-schema.js.map +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Processing and Source Lineage
|
|
2
|
+
|
|
3
|
+
For each operation, identify the observed problem, the decision or deliverable it blocks, the smallest sufficient operation, and its verification.
|
|
4
|
+
|
|
5
|
+
Trims, placement, speed, gain, and crop belong on the timeline. This agent has no audio-separation, transcode, repair, or frame-sampling analysis tool, and it has no shell. If the timeline cannot produce the required result, say so and continue the work that does not depend on it. Do not search for a cleanup command, and do not call `extract_video_frame` to understand a video.
|
|
6
|
+
|
|
7
|
+
| Need | What to do | Verification |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| Duration, size, or alpha is missing before import | `get_media_metadata` for an HTTP(S) URL; a CloudEdit probe only for `vod://`, `tos://`, average hue, or BlurHash | The number required by `sync_materials` or the canvas |
|
|
10
|
+
| A crop risks losing a subject or text | Timeline fit or crop from what you already saw | The subject or text stays inside the frame |
|
|
11
|
+
| Speech is hard to hear | Select a clearer span, or lower other tracks on the timeline | The chosen words stay audible in the plan |
|
|
12
|
+
| A file cannot be imported as-is | Stop that file and say which property blocks import | Do not invent a converted derivative |
|
|
13
|
+
|
|
14
|
+
Do not process because a tool exists. Avoid replacement generation, retouching, watermark removal, or blanket enhancement without relevant user intent. If a capability or essential input is unavailable, retain the dependency and continue independent work.
|
|
15
|
+
|
|
16
|
+
When the user already supplied a derivative, keep it separate from the original. Keep source, operation, and task handle until a task is terminal. A submission, timeout, or filename does not establish success. Do not resubmit a pending task.
|
|
17
|
+
|
|
18
|
+
Record necessary lineage: original/derived references, operation/status, covered source range, changes to duration/speed/offset/sound/geometry, verified temporal mapping, evidence still valid, output checks, and synchronization still needed.
|
|
19
|
+
|
|
20
|
+
For an extracted source interval 12–20 s at 1x, derived 0–8 s maps back by adding 12 s only if extraction preserves timing without extra offset. If timing changes, use a verified mapping or obtain new timing evidence on the derivative. Original ASR words may remain usable while timestamps do not. A crop invalidates geometry-based safe regions; sound replacement changes which transcript is audible. Reinspect affected content, not necessarily every source.
|
|
21
|
+
|
|
22
|
+
Before project use, give cloudedit the actual derivative and metadata. Follow its explicit material synchronization rules and use the returned real material ID. Never treat a tool URL as already imported or silently substitute an original for a failed required derivative.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Subtitle Timing and Display Units
|
|
2
|
+
|
|
3
|
+
Use this reference only when subtitles are requested. It defines text reuse, time mapping, and overlapping speech. Visual style follows cloudedit's text editing guide. Do not create a track when subtitles are excluded, and do not call `asr_subtitles` only to understand dialogue.
|
|
4
|
+
|
|
5
|
+
## Reuse Text Before Requesting ASR
|
|
6
|
+
|
|
7
|
+
Keep verified source utterances with their speaker, exact text, original start/end, and verification provenance. Reuse corrected captions or transcripts when they cover the selected audible ranges. A tool summary, OCR, or an unverified ASR guess is not verified dialogue.
|
|
8
|
+
|
|
9
|
+
Map each retained occurrence to the planned timeline. With constant speed `r`, source trim start `s0`, and timeline start `t0`, a source instant `s` maps to `t0 + (s - s0) / r`. Split mapping across different speed intervals. Replays require distinct timeline occurrences; source time alone cannot identify which one is being captioned. Clip, overlap, and audibility boundaries may affect the retained utterance range. Do not silently drop spoken words when a trim intersects them.
|
|
10
|
+
|
|
11
|
+
Obtain ASR or focused alignment only for missing text, unreliable boundaries, changed audible content, or a transformation that cannot be mapped reliably. Planning can use source evidence without writing an assembled project first. After execution, check the actual audible intervals and update affected mappings. New full-film ASR is not a prerequisite for verifying reliable reused captions.
|
|
12
|
+
|
|
13
|
+
## Separate Utterances from Display Units
|
|
14
|
+
|
|
15
|
+
An **utterance** is a verified spoken sentence or clause with its own speaker, text, and audible interval. Keep consecutive sentences distinct even when they belong to one speaker or one ASR result.
|
|
16
|
+
|
|
17
|
+
A **display unit** is one subtitle element showing the active utterance or utterances during one interval. Ordinary nonoverlapping speech uses one unit per retained utterance. Automatic line wrapping does not create a new timing unit. For overlapping speech, one utterance can map to several display units and one unit can contain several utterances.
|
|
18
|
+
|
|
19
|
+
Build overlapping units from the sorted unique start/end times of the retained utterances. For each interval, show only the utterances audible in that interval, one readable line per speaker where needed. Preserve their verified text; splitting display time does not authorize splitting words at invented word-level timings. Keep a stable speaker order. Omit intervals with no active speech and do not merge different consecutive sentences into one long caption.
|
|
20
|
+
|
|
21
|
+
Example, already on the final timeline:
|
|
22
|
+
|
|
23
|
+
| Source utterance | Audible interval | Text |
|
|
24
|
+
| --- | --- | --- |
|
|
25
|
+
| A | 0–3 s | Wait here. |
|
|
26
|
+
| B | 2–4 s | I will return. |
|
|
27
|
+
| C | 4–5 s | All right. |
|
|
28
|
+
|
|
29
|
+
| Display unit | Interval | Active text | Utterance links |
|
|
30
|
+
| --- | --- | --- | --- |
|
|
31
|
+
| U1 | 0–2 s | Wait here. | A |
|
|
32
|
+
| U2 | 2–3 s | Wait here. / I will return. (separate lines) | A, B |
|
|
33
|
+
| U3 | 3–4 s | I will return. | B |
|
|
34
|
+
| U4 | 4–5 s | All right. | C |
|
|
35
|
+
|
|
36
|
+
The units do not overlap; A and B each remain visible over exactly their own full audible interval. Repeated text across adjacent units maintains an ongoing utterance, rather than duplicating dialogue or merging sequential sentences. If two utterances have exactly the same interval, one multiline unit is sufficient. If simultaneous text cannot remain readable, report the layout/content conflict or use an authorized alternative; do not silently omit a speaker or extend text outside its audible interval.
|
|
37
|
+
|
|
38
|
+
## Handoff and Readback
|
|
39
|
+
|
|
40
|
+
Maintain an utterance list and a display-unit list. Each unit records its utterance IDs, text lines, timeline interval, and eventual element ID. This mapping may be many-to-many for overlaps and repeated source occurrences; do not require one element ID per source clause in those cases.
|
|
41
|
+
|
|
42
|
+
Validate that:
|
|
43
|
+
|
|
44
|
+
- Every retained audible utterance is covered by the union of its linked units, with no missing or extra interval.
|
|
45
|
+
- Every displayed line has verified text and an active utterance during that unit; omitted speech has an explicit supported reason.
|
|
46
|
+
- Consecutive utterances remain distinct; simultaneous lines and continuing text across units use the overlap exception above.
|
|
47
|
+
- Units are ordered and nonoverlapping within the subtitle track. Reuse an existing track in the affected range; no empty track is created for absent speech.
|
|
48
|
+
- Actual element IDs, text, timing, and requested style match the unit list. Correct only mismatched units and their dependencies, then read back and check the affected audible range.
|
|
49
|
+
|
|
50
|
+
Subtitle text/timing verification does not imply final visual legibility or actual project writes. State which checks remain planned or unavailable.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { IconChevronDownOutlineRegular, Tag } from '@deepseek-ai/dsh-client-ui-primitives';
|
|
3
3
|
import { useEffect, useRef, useState } from 'react';
|
|
4
4
|
import * as css from './card.css.js';
|
|
5
5
|
const cx = (names) => names.filter(Boolean).join(' ');
|
|
@@ -35,7 +35,7 @@ export function AitoearnCard(props) {
|
|
|
35
35
|
const blocked = !state.dirty || state.saving;
|
|
36
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
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(
|
|
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(IconChevronDownOutlineRegular, { className: cx([css.chevron, open && css.chevronOpen]) })] }), open
|
|
39
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
40
|
props.edit('environment', option.value);
|
|
41
41
|
}, children: t(option.labelKey) }, option.value))) })] }), state.environment === 'custom'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AitoearnCard.js","sourceRoot":"","sources":["../../../../../../../tools/agent-plugin/src/dsh/client/AitoearnCard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"AitoearnCard.js","sourceRoot":"","sources":["../../../../../../../tools/agent-plugin/src/dsh/client/AitoearnCard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,6BAA6B,EAAE,GAAG,EAAE,MAAM,uCAAuC,CAAA;AAE1F,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAGnD,OAAO,KAAK,GAAG,MAAM,eAAe,CAAA;AAWpC,MAAM,EAAE,GAAG,CAAC,KAAwC,EAAU,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAEhG,MAAM,mBAAmB,GAA2E;IAClG,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE;IAC1C,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE;IAClC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE;CAC3C,CAAA;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAwB;IACnD,MAAM,EAAE,CAAC,EAAE,GAAG,KAAK,CAAA;IACnB,MAAM,KAAK,GAAG,KAAK,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAA;IACzD,MAAM,CAAC,IAAI,E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IACF,CACP;gBACH,CAAC,CAAC,IAAI,IACL,CACN,CAAA;AACH,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SnapshotStore } from '@deepseek-ai/dsh-client-store';
|
|
2
|
-
import {
|
|
2
|
+
import { ConfigForm, SettingsDescribeFace } from '@deepseek-ai/dsh-client-ui-settings/client';
|
|
3
3
|
import { AitoearnEnvironment, AitoearnPluginConfig } from '../auth.js';
|
|
4
4
|
export type AitoearnCardField = 'environment' | 'baseUrl' | 'apiKey';
|
|
5
5
|
export interface AitoearnCardState {
|
|
@@ -31,4 +31,4 @@ export interface AitoearnCardFace {
|
|
|
31
31
|
* blank draft keeps the stored key, and whether one is configured comes from
|
|
32
32
|
* the namespace view's secret record.
|
|
33
33
|
*/
|
|
34
|
-
export declare function createAitoearnCardFace(
|
|
34
|
+
export declare function createAitoearnCardFace(form: ConfigForm<AitoearnPluginConfig>, describe: SettingsDescribeFace): AitoearnCardFace;
|
|
@@ -10,13 +10,13 @@ import { resolveEnvironment, SETTINGS_NAMESPACE } from '../auth.js';
|
|
|
10
10
|
* blank draft keeps the stored key, and whether one is configured comes from
|
|
11
11
|
* the namespace view's secret record.
|
|
12
12
|
*/
|
|
13
|
-
export function createAitoearnCardFace(
|
|
13
|
+
export function createAitoearnCardFace(form, describe) {
|
|
14
14
|
let draft = {};
|
|
15
15
|
let saving = false;
|
|
16
16
|
let failed = false;
|
|
17
17
|
const store = createSnapshotStore(project());
|
|
18
18
|
function stored() {
|
|
19
|
-
return
|
|
19
|
+
return form.getSnapshot().value ?? {};
|
|
20
20
|
}
|
|
21
21
|
function apiKeyConfigured() {
|
|
22
22
|
const view = describe.getSnapshot().view;
|
|
@@ -38,7 +38,7 @@ export function createAitoearnCardFace(scope, describe) {
|
|
|
38
38
|
return writes;
|
|
39
39
|
}
|
|
40
40
|
function project() {
|
|
41
|
-
const snapshot =
|
|
41
|
+
const snapshot = form.getSnapshot();
|
|
42
42
|
const value = stored();
|
|
43
43
|
return {
|
|
44
44
|
available: snapshot.status === 'ready',
|
|
@@ -56,7 +56,7 @@ export function createAitoearnCardFace(scope, describe) {
|
|
|
56
56
|
store.set(project());
|
|
57
57
|
};
|
|
58
58
|
async function commit() {
|
|
59
|
-
const snapshot =
|
|
59
|
+
const snapshot = form.getSnapshot();
|
|
60
60
|
const writes = pendingWrites();
|
|
61
61
|
if (saving || snapshot.status !== 'ready' || !snapshot.writable || writes.length === 0)
|
|
62
62
|
return;
|
|
@@ -67,16 +67,19 @@ export function createAitoearnCardFace(scope, describe) {
|
|
|
67
67
|
saving = true;
|
|
68
68
|
failed = false;
|
|
69
69
|
publish();
|
|
70
|
+
// A `false` answer means the Host refused or skipped the write (transport
|
|
71
|
+
// failures reject instead): keep the drafts so the user can correct them.
|
|
72
|
+
let accepted = true;
|
|
70
73
|
try {
|
|
71
74
|
if (writes.includes('environment'))
|
|
72
|
-
await
|
|
75
|
+
accepted = await form.set('environment', environment) && accepted;
|
|
73
76
|
if (writes.includes('apiKey'))
|
|
74
|
-
await
|
|
77
|
+
accepted = await form.set('apiKey', apiKey) && accepted;
|
|
75
78
|
if (writes.includes('baseUrl')) {
|
|
76
79
|
if (environment === 'custom')
|
|
77
|
-
await
|
|
80
|
+
accepted = await form.set('baseUrl', baseUrl) && accepted;
|
|
78
81
|
else
|
|
79
|
-
await
|
|
82
|
+
accepted = await form.unset('baseUrl') && accepted;
|
|
80
83
|
}
|
|
81
84
|
}
|
|
82
85
|
catch {
|
|
@@ -87,6 +90,12 @@ export function createAitoearnCardFace(scope, describe) {
|
|
|
87
90
|
publish();
|
|
88
91
|
return;
|
|
89
92
|
}
|
|
93
|
+
if (!accepted) {
|
|
94
|
+
saving = false;
|
|
95
|
+
failed = true;
|
|
96
|
+
publish();
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
90
99
|
const landed = (writes.includes('environment') ? resolveEnvironment(stored().environment) === environment : true)
|
|
91
100
|
&& (writes.includes('apiKey') ? apiKeyConfigured() : true)
|
|
92
101
|
&& (writes.includes('baseUrl')
|
|
@@ -99,7 +108,7 @@ export function createAitoearnCardFace(scope, describe) {
|
|
|
99
108
|
failed = true;
|
|
100
109
|
publish();
|
|
101
110
|
}
|
|
102
|
-
|
|
111
|
+
form.subscribe(publish);
|
|
103
112
|
describe.subscribe(publish);
|
|
104
113
|
void describe.ensure();
|
|
105
114
|
return {
|
|
@@ -1 +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,
|
|
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,IAAsC,EAAE,QAA8B;IAC3G,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,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,IAAI,EAAE,CAAA;IACvC,CAAC;IAED,SAAS,gBAAgB;QACvB,MAAM,IAAI,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,CAAA;QACxC,MAAM,OAAO,GAAG,IAAI,EAAE,UAAU,CAAC,IAAI,CA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,EAAE,CAAA;YACV,MAAM,GAAG,KAAK,CAAA;YACd,OAAO,EAAE,CAAA;QACX,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/src/dsh/client/index.js
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SETTINGS_NAMESPACE } from '../auth.js';
|
|
2
2
|
import { AitoearnCard } from './AitoearnCard.js';
|
|
3
3
|
import { createAitoearnCardFace } from './card-store.js';
|
|
4
4
|
import { aitoearnCardLocales, aitoearnCardNS } from './i18n.js';
|
|
5
5
|
export const name = 'aitoearn-settings-card';
|
|
6
|
-
export const inject = ['slots', 'locale', '
|
|
6
|
+
export const inject = ['slots', 'locale', 'configForms'];
|
|
7
7
|
export function apply(ctx) {
|
|
8
8
|
ctx.effect(() => ctx.locale.register(aitoearnCardNS, aitoearnCardLocales), 'aitoearn-settings-card: dictionaries');
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
const t = ctx.locale.bind(aitoearnCardNS);
|
|
10
|
+
ctx.effect(() => ctx.configForms.whileServed([SETTINGS_NAMESPACE], () => {
|
|
11
|
+
const form = ctx.configForms.get(SETTINGS_NAMESPACE);
|
|
12
|
+
const face = createAitoearnCardFace(form, ctx.configForms.describe());
|
|
13
|
+
return ctx.slots.inject('settings.plugins.tab', () => ctx.slots.register({
|
|
14
|
+
name: 'settings.plugins.tab',
|
|
15
|
+
id: 'aitoearn',
|
|
16
|
+
order: 10,
|
|
17
|
+
label: () => t('title'),
|
|
18
|
+
locale: aitoearnCardNS,
|
|
19
|
+
inject: () => face,
|
|
20
|
+
}, AitoearnCard));
|
|
21
|
+
}), 'aitoearn-settings-card: tab');
|
|
20
22
|
}
|
|
21
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../tools/agent-plugin/src/dsh/client/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../tools/agent-plugin/src/dsh/client/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,kBAAkB,EAAE,MAAM,YAAY,CAAA;AACrE,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,aAAa,CAAC,CAAA;AAExD,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,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;IACzC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,kBAAkB,CAAC,EAAE,GAAG,EAAE;QACtE,MAAM,IAAI,GAAG,GAAG,CAAC,WAAW,CAAC,GAAG,CAAuB,kBAAkB,CAAC,CAAA;QAC1E,MAAM,IAAI,GAAG,sBAAsB,CAAC,IAAI,EAAE,GAAG,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAA;QACrE,OAAO,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,sBAAsB,EAAE,GAAG,EAAE,CACnD,GAAG,CAAC,KAAK,CAAC,QAAQ,CAChB;YACE,IAAI,EAAE,sBAAsB;YAC5B,EAAE,EAAE,UAAU;YACd,KAAK,EAAE,EAAE;YACT,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;YACvB,MAAM,EAAE,cAAc;YACtB,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI;SACnB,EACD,YAAY,CACb,CAAC,CAAA;IACN,CAAC,CAAC,EAAE,6BAA6B,CAAC,CAAA;AACpC,CAAC"}
|
package/src/dsh/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Context } from '@deepseek-ai/cordis';
|
|
2
2
|
import { AitoearnPluginConfig, SETTINGS_NAMESPACE } from './auth.js';
|
|
3
|
+
import { Config } from './settings-schema.js';
|
|
3
4
|
export declare const name = "aitoearn";
|
|
4
|
-
export { SETTINGS_NAMESPACE };
|
|
5
|
+
export { Config, SETTINGS_NAMESPACE };
|
|
5
6
|
export declare function apply(ctx: Context, config?: AitoearnPluginConfig, paths?: {
|
|
6
7
|
sourceDir?: string;
|
|
7
8
|
targetDir?: string;
|
package/src/dsh/index.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { SETTINGS_NAMESPACE } from './auth.js';
|
|
2
2
|
import { syncAitoearnPreset } from './preset-sync.js';
|
|
3
|
-
import {
|
|
3
|
+
import { Config } from './settings-schema.js';
|
|
4
4
|
export const name = 'aitoearn';
|
|
5
|
-
export { SETTINGS_NAMESPACE };
|
|
5
|
+
export { Config, SETTINGS_NAMESPACE };
|
|
6
6
|
export function apply(ctx, config = {}, paths) {
|
|
7
|
+
void config;
|
|
7
8
|
ctx.inject(['settings'], (scoped) => {
|
|
8
|
-
scoped.settings.
|
|
9
|
-
setSource() { },
|
|
10
|
-
onChange() { },
|
|
11
|
-
});
|
|
9
|
+
scoped.effect(() => scoped.settings.configure({ auto: false }, ctx.fiber), 'aitoearn:settings-page-policy');
|
|
12
10
|
});
|
|
13
11
|
try {
|
|
14
12
|
syncAitoearnPreset(paths?.sourceDir, paths?.targetDir);
|
package/src/dsh/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../tools/agent-plugin/src/dsh/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,kBAAkB,EAAE,MAAM,WAAW,CAAA;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../tools/agent-plugin/src/dsh/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,kBAAkB,EAAE,MAAM,WAAW,CAAA;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAE7C,MAAM,CAAC,MAAM,IAAI,GAAG,UAAU,CAAA;AAC9B,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAA;AAErC,MAAM,UAAU,KAAK,CACnB,GAAY,EACZ,SAA+B,EAAE,EACjC,KAAkD;IAElD,KAAK,MAAM,CAAA;IACX,GAAG,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE;QAClC,MAAM,CAAC,MAAM,CACX,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,GAAG,CAAC,KAAK,CAAC,EAC3D,+BAA+B,CAChC,CAAA;IACH,CAAC,CAAC,CAAA;IACF,IAAI,CAAC;QACH,kBAAkB,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,CAAA;IACxD,CAAC;IACD,OAAO,KAAK,EAAE,CAAC;QACb,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,6BAA6B,CAAC,CAAA;IACxD,CAAC;AACH,CAAC"}
|
package/src/dsh/mcp.js
CHANGED
|
@@ -8,47 +8,116 @@ export async function apply(ctx, config = {}) {
|
|
|
8
8
|
let current = () => config;
|
|
9
9
|
let restoreNames;
|
|
10
10
|
let fiber;
|
|
11
|
-
|
|
11
|
+
let generation = 0;
|
|
12
|
+
let mountChain = Promise.resolve();
|
|
13
|
+
let remountTimer;
|
|
14
|
+
let mountedFingerprint;
|
|
15
|
+
const unmountAsync = async () => {
|
|
12
16
|
restoreNames?.();
|
|
13
17
|
restoreNames = undefined;
|
|
14
|
-
|
|
18
|
+
const previous = fiber;
|
|
15
19
|
fiber = undefined;
|
|
20
|
+
if (previous) {
|
|
21
|
+
try {
|
|
22
|
+
await previous.dispose();
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
ctx.logger.warn(error, 'aitoearn-mcp: failed to dispose previous MCP client');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
16
28
|
};
|
|
17
|
-
const
|
|
18
|
-
unmount();
|
|
29
|
+
const doMount = async (gen) => {
|
|
19
30
|
const auth = resolveAuth(current());
|
|
20
31
|
if (auth.apiKey.length === 0 || auth.mcpUrl.length === 0) {
|
|
32
|
+
await unmountAsync();
|
|
33
|
+
mountedFingerprint = undefined;
|
|
21
34
|
ctx.logger.warn('aitoearn-mcp: skip mounting; API key or MCP URL is not configured yet');
|
|
22
35
|
return;
|
|
23
36
|
}
|
|
37
|
+
const fingerprint = `${auth.mcpUrl}\n${auth.apiKey}`;
|
|
38
|
+
if (fingerprint === mountedFingerprint && fiber) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
await unmountAsync();
|
|
42
|
+
if (gen !== generation) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
24
45
|
restoreNames = patchRawToolNames(ctx.tools, MCP_SERVER_NAME, (publicName) => {
|
|
25
46
|
ctx.logger.info(`kept qualified MCP tool name ${publicName}`);
|
|
26
47
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
48
|
+
try {
|
|
49
|
+
const mcpClient = runtimeRequire('@deepseek-ai/dsh-mcp-client');
|
|
50
|
+
const mcpConfig = {
|
|
51
|
+
serverName: MCP_SERVER_NAME,
|
|
52
|
+
transport: 'streamable-http',
|
|
53
|
+
url: auth.mcpUrl,
|
|
54
|
+
headers: authorizationHeader(auth.apiKey),
|
|
55
|
+
failOnStartupError: false,
|
|
56
|
+
toolCallTimeoutMs: 120000,
|
|
57
|
+
};
|
|
58
|
+
const next = ctx.plugin(mcpClient, mcpConfig);
|
|
59
|
+
fiber = next;
|
|
60
|
+
await next;
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
restoreNames?.();
|
|
64
|
+
restoreNames = undefined;
|
|
65
|
+
fiber = undefined;
|
|
66
|
+
ctx.logger.warn(error, 'aitoearn-mcp: mount failed; will retry on next settings change');
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (gen !== generation) {
|
|
70
|
+
await unmountAsync();
|
|
71
|
+
mountedFingerprint = undefined;
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
mountedFingerprint = fingerprint;
|
|
38
75
|
ctx.logger.info(`aitoearn-mcp: mounted MCP tools from ${auth.mcpUrl}`);
|
|
39
76
|
};
|
|
77
|
+
const scheduleMount = () => {
|
|
78
|
+
generation += 1;
|
|
79
|
+
const gen = generation;
|
|
80
|
+
mountChain = mountChain
|
|
81
|
+
.then(() => doMount(gen))
|
|
82
|
+
.catch((error) => {
|
|
83
|
+
ctx.logger.warn(error, 'aitoearn-mcp: mount failed');
|
|
84
|
+
});
|
|
85
|
+
return mountChain;
|
|
86
|
+
};
|
|
87
|
+
const scheduleRemountSoon = () => {
|
|
88
|
+
if (remountTimer) {
|
|
89
|
+
clearTimeout(remountTimer);
|
|
90
|
+
}
|
|
91
|
+
remountTimer = setTimeout(() => {
|
|
92
|
+
remountTimer = undefined;
|
|
93
|
+
void scheduleMount();
|
|
94
|
+
}, 50);
|
|
95
|
+
};
|
|
40
96
|
ctx.inject(['settings'], (scoped) => {
|
|
41
|
-
|
|
97
|
+
// Host `describe()` serves the live value unredacted by default, so the
|
|
98
|
+
// preset can read the stored key; remote callers get the redacted view.
|
|
99
|
+
const readSection = () => {
|
|
100
|
+
const descriptor = scoped.settings.describe().find(candidate => String(candidate.ns) === SETTINGS_NAMESPACE);
|
|
101
|
+
return pluginConfigFromSettings(descriptor?.value, config);
|
|
102
|
+
};
|
|
103
|
+
current = readSection;
|
|
42
104
|
ctx.on('settings/document-updated', (namespace) => {
|
|
43
|
-
if (String(namespace) === SETTINGS_NAMESPACE)
|
|
44
|
-
|
|
105
|
+
if (String(namespace) === SETTINGS_NAMESPACE) {
|
|
106
|
+
scheduleRemountSoon();
|
|
107
|
+
}
|
|
45
108
|
});
|
|
46
109
|
// The initial apply-time mount may run before the settings section is
|
|
47
110
|
// readable; mount again once it is, so a stored key takes effect without
|
|
48
111
|
// requiring a manual settings save.
|
|
49
|
-
void
|
|
112
|
+
void scheduleMount();
|
|
50
113
|
});
|
|
51
|
-
ctx.effect(() =>
|
|
52
|
-
|
|
114
|
+
ctx.effect(() => () => {
|
|
115
|
+
if (remountTimer) {
|
|
116
|
+
clearTimeout(remountTimer);
|
|
117
|
+
remountTimer = undefined;
|
|
118
|
+
}
|
|
119
|
+
void unmountAsync();
|
|
120
|
+
}, 'aitoearn-mcp.client');
|
|
121
|
+
await scheduleMount();
|
|
53
122
|
}
|
|
54
123
|
//# sourceMappingURL=mcp.js.map
|
package/src/dsh/mcp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../../../../../tools/agent-plugin/src/dsh/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAM3C,OAAO,EAAwB,mBAAmB,EAAE,wBAAwB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AAE,CAAC;YACjB,YAAY,CAAC,YAAY,CAAC,CAAA;YAC1B,YAAY,GAAG,SAAS,CAAA;QAC1B,CAAC;QACD,KAAK,YAAY,EAAE,CAAA;IACrB,CAAC,EAAE,qBAAqB,CAAC,CAAA;IACzB,MAAM,aAAa,EAAE,CAAA;AACvB,CAAC"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import z from '@deepseek-ai/schemastery';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Loader-discovered plugin configuration. The settings host only serves
|
|
4
|
+
* entries with volatile fields, and only volatile fields are form-editable,
|
|
5
|
+
* so the section is marked volatile as a whole; the Loader resolves it into
|
|
6
|
+
* a live reference that cordis unwraps before it reaches `apply`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const Config: z<NoInfer<Schemastery.ObjectS<NoInfer<{
|
|
9
|
+
environment: z<"global" | "cn" | "custom", "global" | "cn" | "custom", "defined">;
|
|
10
|
+
baseUrl: z<string, string, "defined">;
|
|
11
|
+
apiKey: z<string, string, "defined">;
|
|
12
|
+
}>>>, NoInfer<Schemastery.ObjectT<NoInfer<{
|
|
13
|
+
environment: z<"global" | "cn" | "custom", "global" | "cn" | "custom", "defined">;
|
|
14
|
+
baseUrl: z<string, string, "defined">;
|
|
15
|
+
apiKey: z<string, string, "defined">;
|
|
16
|
+
}>>>, "volatile">;
|
|
17
|
+
export type AitoearnSettings = ReturnType<typeof Config>;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import z from '@deepseek-ai/schemastery';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Loader-discovered plugin configuration. The settings host only serves
|
|
4
|
+
* entries with volatile fields, and only volatile fields are form-editable,
|
|
5
|
+
* so the section is marked volatile as a whole; the Loader resolves it into
|
|
6
|
+
* a live reference that cordis unwraps before it reaches `apply`.
|
|
7
|
+
*/
|
|
8
|
+
export const Config = z.object({
|
|
4
9
|
environment: z.union(['global', 'cn', 'custom']).default('global'),
|
|
5
10
|
baseUrl: z.string().default(''),
|
|
6
11
|
apiKey: z.string().role('secret').default(''),
|
|
7
|
-
});
|
|
8
|
-
export function settingsEntry(config) {
|
|
9
|
-
return aitoearnSettingsSchema({
|
|
10
|
-
environment: resolveEnvironment(config.environment),
|
|
11
|
-
baseUrl: config.baseUrl ?? '',
|
|
12
|
-
apiKey: config.apiKey ?? '',
|
|
13
|
-
});
|
|
14
|
-
}
|
|
12
|
+
}).volatile();
|
|
15
13
|
//# sourceMappingURL=settings-schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings-schema.js","sourceRoot":"","sources":["../../../../../../tools/agent-plugin/src/dsh/settings-schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"settings-schema.js","sourceRoot":"","sources":["../../../../../../tools/agent-plugin/src/dsh/settings-schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAExC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;IAClE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAC/B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CAC9C,CAAC,CAAC,QAAQ,EAAE,CAAA"}
|