@thready-web/dsh-bot-plugin 0.1.0-beta.10 → 0.1.0-beta.12
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/README.md +19 -2
- package/dist/approvals.js +19 -1
- package/dist/canvas-compose.js +73 -0
- package/dist/canvas-http.js +379 -0
- package/dist/canvas-skills.js +56 -0
- package/dist/canvas-store.js +1015 -0
- package/dist/canvas-tools.js +380 -0
- package/dist/card-log.js +216 -0
- package/dist/context.js +6 -3
- package/dist/deleting.js +54 -0
- package/dist/desk-ledger.js +18 -0
- package/dist/desk.js +30 -5
- package/dist/http-plugin.js +2 -1
- package/dist/http.js +218 -3
- package/dist/inbox.js +24 -2
- package/dist/index.js +75 -12
- package/dist/questions.js +10 -0
- package/dist/runtime-registry.js +20 -0
- package/dist/session-delete-job.js +77 -0
- package/dist/session-files.js +33 -1
- package/dist/session-wipe.js +204 -0
- package/dist/store.js +46 -3
- package/dist/triggers.js +8 -0
- package/dist/work-admit.js +9 -20
- package/dist/work-child.js +27 -10
- package/dist/work-http.js +19 -0
- package/dist/work-ledger.js +5 -1
- package/dist/work-mock.js +10 -0
- package/dist/work-tickets.js +5 -3
- package/dist/work-tools.js +11 -9
- package/dist/work-worker.js +245 -6
- package/dist/worker-handles.js +33 -0
- package/dist/workspace-files.js +98 -17
- package/package.json +2 -1
- package/public/assets/{SourceEditor-BEQaScgR.js → SourceEditor-BjtoMvcX.js} +3 -3
- package/public/assets/{cssMode-gpcjCFFS.js → cssMode--96PQtWh.js} +1 -1
- package/public/assets/{freemarker2-C1qemGIt.js → freemarker2-Bz-HlISL.js} +1 -1
- package/public/assets/{handlebars-sZqIfAlP.js → handlebars-D9ScJ8AM.js} +1 -1
- package/public/assets/{html-Bn1WXB8L.js → html-Czc0jojJ.js} +1 -1
- package/public/assets/{htmlMode-CvQyXnaW.js → htmlMode-CCww5Z1w.js} +1 -1
- package/public/assets/index-DRCgKxWk.css +1 -0
- package/public/assets/index-ztUdW074.js +72 -0
- package/public/assets/{javascript-Ox4Jg12j.js → javascript-B-yRZSiz.js} +1 -1
- package/public/assets/{jsonMode-DMR7R2dQ.js → jsonMode-ASWsY833.js} +1 -1
- package/public/assets/{liquid-B6HxtpBd.js → liquid-BGoox2vJ.js} +1 -1
- package/public/assets/{mdx--jDhmrXq.js → mdx-DHgvnl_U.js} +1 -1
- package/public/assets/{python-YjG50skX.js → python-BJvVD30_.js} +1 -1
- package/public/assets/{razor-CEcFE3UK.js → razor-0PwR35mu.js} +1 -1
- package/public/assets/{tsMode-g4kTQl09.js → tsMode-3ETp8Gdh.js} +1 -1
- package/public/assets/{typescript-CnHeFmPW.js → typescript-BT0iTK6K.js} +1 -1
- package/public/assets/{xml-BFXMY9nb.js → xml-BTaNc_uT.js} +1 -1
- package/public/assets/{yaml-DNm87nSf.js → yaml-Dr7LW3tK.js} +1 -1
- package/public/index.html +2 -2
- package/skills/ui/baseline-ui/SKILL.md +85 -0
- package/skills/ui/bencium-innovative-ux-designer/SKILL.md +227 -0
- package/skills/ui/better-ui/SKILL.md +133 -0
- package/skills/ui/design-lab/SKILL.md +920 -0
- package/skills/ui/frontend-design/SKILL.md +71 -0
- package/skills/ui/impeccable/SKILL.md +93 -0
- package/skills/ui/interface-design/SKILL.md +320 -0
- package/skills/ui/sources.json +66 -0
- package/skills/ui/ui-design/SKILL.md +41 -0
- package/skills/ui/ui-skills-root/SKILL.md +59 -0
- package/skills/ui/visual-design-foundations/SKILL.md +318 -0
- package/skills/ui/web-design-guidelines/SKILL.md +39 -0
- package/public/assets/index-DRNkUrer.css +0 -1
- package/public/assets/index-DhL5Kdlz.js +0 -63
package/dist/work-admit.js
CHANGED
|
@@ -19,9 +19,9 @@ export const DEFAULT_WORK_BUDGET = Object.freeze({
|
|
|
19
19
|
holdMs: 15_000,
|
|
20
20
|
workerMaxSteps: 8,
|
|
21
21
|
/** One budget slice. A grant adds another slice; there is no cumulative ceiling. */
|
|
22
|
-
workerWallMs:
|
|
22
|
+
workerWallMs: 60 * 60 * 1000,
|
|
23
23
|
/** One budget slice. A grant adds another slice; there is no cumulative ceiling. */
|
|
24
|
-
workerMaxTokens:
|
|
24
|
+
workerMaxTokens: 2_000_000,
|
|
25
25
|
perBot: 2,
|
|
26
26
|
global: 4,
|
|
27
27
|
perBotQueue: 8,
|
|
@@ -233,28 +233,17 @@ export function budgetTrip(input) {
|
|
|
233
233
|
return null;
|
|
234
234
|
}
|
|
235
235
|
/**
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*/
|
|
240
|
-
function clampAtLeast(value, min) {
|
|
241
|
-
const number = Number(value);
|
|
242
|
-
if (!Number.isFinite(number))
|
|
243
|
-
return null;
|
|
244
|
-
return Math.max(min, Math.floor(number));
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Ticket budget chosen when the main bot dispatches.
|
|
248
|
-
* An omitted field is one standard slice. An explicit estimate is kept, with a
|
|
249
|
-
* floor of 1000. Later grants add on top and are not capped by this slice.
|
|
236
|
+
* Opening ticket budget. Dispatch does not choose it: a budget passed with the
|
|
237
|
+
* ticket is ignored, and every ticket starts on one host slice. Later grants
|
|
238
|
+
* add another slice and are not capped by this one.
|
|
250
239
|
* @param {string} _briefing
|
|
251
|
-
* @param {{ wallMs?: number, maxTokens?: number } | null | undefined}
|
|
240
|
+
* @param {{ wallMs?: number, maxTokens?: number } | null | undefined} _suggestion
|
|
252
241
|
* @param {typeof DEFAULT_WORK_BUDGET} defaults
|
|
253
242
|
*/
|
|
254
|
-
export function estimateWorkerBudget(_briefing,
|
|
243
|
+
export function estimateWorkerBudget(_briefing, _suggestion, defaults = DEFAULT_WORK_BUDGET) {
|
|
255
244
|
return {
|
|
256
|
-
wallMs:
|
|
257
|
-
maxTokens:
|
|
245
|
+
wallMs: defaults.workerWallMs,
|
|
246
|
+
maxTokens: defaults.workerMaxTokens,
|
|
258
247
|
perBot: defaults.perBot,
|
|
259
248
|
global: defaults.global,
|
|
260
249
|
perBotQueue: defaults.perBotQueue,
|
package/dist/work-child.js
CHANGED
|
@@ -9,6 +9,12 @@
|
|
|
9
9
|
* composed host bash-sandbox and approval policy.
|
|
10
10
|
*/
|
|
11
11
|
export const WORKER_FILE_PRESET = 'foundations-files';
|
|
12
|
+
/**
|
|
13
|
+
* Canvas workers read workspace reference files and write the preview through
|
|
14
|
+
* canvas tools. They do not get write, edit, bash, or jobs. A workspace `write`
|
|
15
|
+
* is not a canvas revision, and models treat that tool as the deliverable.
|
|
16
|
+
*/
|
|
17
|
+
export const CANVAS_WORKER_PRESET = 'foundations-canvas';
|
|
12
18
|
/**
|
|
13
19
|
* @param {import('@deepseek-ai/cordis').Context} ctx
|
|
14
20
|
*/
|
|
@@ -36,24 +42,35 @@ export function ensureWorkerFilePreset(ctx) {
|
|
|
36
42
|
const presets = presetsOf(ctx);
|
|
37
43
|
if (!presets?.register || !presets?.mount)
|
|
38
44
|
return Promise.resolve(null);
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
const fileTools = {
|
|
46
|
+
id: 'tool-fs',
|
|
47
|
+
name: '@deepseek-ai/dsh-tool-fs',
|
|
48
|
+
config: { applyPatch: false, readImage: false },
|
|
49
|
+
};
|
|
50
|
+
const canvasFileTools = {
|
|
51
|
+
id: 'tool-fs',
|
|
52
|
+
name: '@deepseek-ai/dsh-tool-fs',
|
|
53
|
+
config: { applyPatch: false, readImage: false, write: false, edit: false },
|
|
54
|
+
};
|
|
55
|
+
return registerPreset(presets, {
|
|
41
56
|
id: WORKER_FILE_PRESET,
|
|
42
57
|
plugins: [
|
|
43
|
-
|
|
44
|
-
id: 'tool-fs',
|
|
45
|
-
name: '@deepseek-ai/dsh-tool-fs',
|
|
46
|
-
config: { applyPatch: false, readImage: false },
|
|
47
|
-
},
|
|
58
|
+
fileTools,
|
|
48
59
|
{ id: 'tool-bash', name: '@deepseek-ai/dsh-tool-bash' },
|
|
49
60
|
{ id: 'tool-jobs', name: '@deepseek-ai/dsh-tool-jobs' },
|
|
50
61
|
],
|
|
51
62
|
})
|
|
52
|
-
.then(() =>
|
|
53
|
-
|
|
63
|
+
.then(() => registerPreset(presets, {
|
|
64
|
+
id: CANVAS_WORKER_PRESET,
|
|
65
|
+
plugins: [canvasFileTools],
|
|
66
|
+
}))
|
|
67
|
+
.then(() => WORKER_FILE_PRESET);
|
|
68
|
+
}
|
|
69
|
+
function registerPreset(presets, spec) {
|
|
70
|
+
return presets.register(spec).catch((error) => {
|
|
54
71
|
const message = error instanceof Error ? error.message : String(error);
|
|
55
72
|
if (message.includes('Duplicate'))
|
|
56
|
-
return
|
|
73
|
+
return spec;
|
|
57
74
|
throw error;
|
|
58
75
|
});
|
|
59
76
|
}
|
package/dist/work-http.js
CHANGED
|
@@ -144,6 +144,23 @@ export function openPageLive(req, res, source) {
|
|
|
144
144
|
let interactionTimer = null;
|
|
145
145
|
let lastInteractions = '';
|
|
146
146
|
let interactionFailed = false;
|
|
147
|
+
let lastCanvas = '';
|
|
148
|
+
const pumpCanvas = () => {
|
|
149
|
+
if (stopped || !source.canvas)
|
|
150
|
+
return;
|
|
151
|
+
try {
|
|
152
|
+
const text = JSON.stringify(source.canvas());
|
|
153
|
+
if (text === lastCanvas)
|
|
154
|
+
return;
|
|
155
|
+
lastCanvas = text;
|
|
156
|
+
if (text === '{"ok":true,"events":[]}')
|
|
157
|
+
return;
|
|
158
|
+
res.write(`event: canvas\ndata: ${text}\n\n`);
|
|
159
|
+
}
|
|
160
|
+
catch {
|
|
161
|
+
// A canvas notice failure leaves the desk and ticket streams open.
|
|
162
|
+
}
|
|
163
|
+
};
|
|
147
164
|
const pumpInteractions = () => {
|
|
148
165
|
if (stopped || !source.interactions)
|
|
149
166
|
return;
|
|
@@ -225,6 +242,7 @@ export function openPageLive(req, res, source) {
|
|
|
225
242
|
busy = false;
|
|
226
243
|
}
|
|
227
244
|
};
|
|
245
|
+
pumpCanvas();
|
|
228
246
|
pumpInteractions();
|
|
229
247
|
if (source.interactions) {
|
|
230
248
|
interactionTimer = setInterval(pumpInteractions, intervalMs);
|
|
@@ -232,6 +250,7 @@ export function openPageLive(req, res, source) {
|
|
|
232
250
|
}
|
|
233
251
|
void pump();
|
|
234
252
|
timer = setInterval(() => {
|
|
253
|
+
pumpCanvas();
|
|
235
254
|
void pump();
|
|
236
255
|
}, intervalMs);
|
|
237
256
|
timer.unref?.();
|
package/dist/work-ledger.js
CHANGED
|
@@ -23,6 +23,9 @@ export function renderBriefing(input) {
|
|
|
23
23
|
'You may read the main session. The host already queried it and attached the excerpt below. foundations_main_history reads it again directly and does not raise an authorization prompt.',
|
|
24
24
|
'Report only with foundations_report. kind must be progress, question, artifact, result, or failure.',
|
|
25
25
|
'This is not cross-bot mail and cannot raise permissions.',
|
|
26
|
+
...(input.kind === 'steer'
|
|
27
|
+
? ['This is steering. The previous turn was stopped. Do not continue that approach. Follow only the text below.']
|
|
28
|
+
: []),
|
|
26
29
|
'---',
|
|
27
30
|
input.text,
|
|
28
31
|
];
|
|
@@ -383,12 +386,13 @@ export async function pushInput(book, input, deps) {
|
|
|
383
386
|
}
|
|
384
387
|
}
|
|
385
388
|
const body = renderBriefing({ text, revision: input.briefing_revision, budget, kind: input.kind, history });
|
|
389
|
+
const deliver = input.kind === 'steer' && deps.steer ? deps.steer : deps.push;
|
|
386
390
|
deps.inflight.add(input.native_message_id);
|
|
387
391
|
try {
|
|
388
392
|
return await durableFollowup({
|
|
389
393
|
attempts: input.flush_attempts,
|
|
390
394
|
markFlushing: () => book.markInputFlush(input.id, 'flushing', deps.pid, '', null, true),
|
|
391
|
-
push: () =>
|
|
395
|
+
push: () => deliver(attempt.child_session_id, input.native_message_id, body),
|
|
392
396
|
markAccepted: seq => book.noteInputAccepted(input, seq),
|
|
393
397
|
markAmbiguous: error => book.markInputFlush(input.id, 'ambiguous', deps.pid, error, null, false),
|
|
394
398
|
markDead: error => book.markInputFlush(input.id, 'dead', deps.pid, error, null, false),
|
package/dist/work-mock.js
CHANGED
|
@@ -9,6 +9,8 @@ export function createMockWorld() {
|
|
|
9
9
|
const calls = [];
|
|
10
10
|
const cancels = [];
|
|
11
11
|
const pushes = [];
|
|
12
|
+
const steers = [];
|
|
13
|
+
const order = [];
|
|
12
14
|
const state = {
|
|
13
15
|
failCreate: false,
|
|
14
16
|
flushMode: 'accepted',
|
|
@@ -17,6 +19,8 @@ export function createMockWorld() {
|
|
|
17
19
|
calls,
|
|
18
20
|
cancels,
|
|
19
21
|
pushes,
|
|
22
|
+
steers,
|
|
23
|
+
order,
|
|
20
24
|
state,
|
|
21
25
|
session,
|
|
22
26
|
pendingIds(sessionId) {
|
|
@@ -100,12 +104,18 @@ export function createMockWorld() {
|
|
|
100
104
|
return true;
|
|
101
105
|
},
|
|
102
106
|
async cancel(sessionId, options) {
|
|
107
|
+
order.push('cancel');
|
|
103
108
|
cancels.push({
|
|
104
109
|
sessionId,
|
|
105
110
|
keepInbox: options?.keepInbox === true,
|
|
106
111
|
...(typeof options?.reason === 'string' ? { reason: options.reason } : {}),
|
|
107
112
|
});
|
|
108
113
|
},
|
|
114
|
+
async steer(sessionId, messageId, text) {
|
|
115
|
+
order.push('steer');
|
|
116
|
+
steers.push({ sessionId, messageId, text });
|
|
117
|
+
return this.push(sessionId, messageId, text);
|
|
118
|
+
},
|
|
109
119
|
async snapshot(sessionId) {
|
|
110
120
|
return session(sessionId).events.map(event => ({ ...event, data: event.data }));
|
|
111
121
|
},
|
package/dist/work-tickets.js
CHANGED
|
@@ -337,7 +337,7 @@ export function createTicketBook(db, root, now = () => new Date()) {
|
|
|
337
337
|
* ticketId: string,
|
|
338
338
|
* attemptId: string,
|
|
339
339
|
* revision: number,
|
|
340
|
-
* kind: 'briefing' | 'supply' | 'redirect' | 'cancel_note',
|
|
340
|
+
* kind: 'briefing' | 'supply' | 'redirect' | 'steer' | 'cancel_note',
|
|
341
341
|
* text: string,
|
|
342
342
|
* }} input
|
|
343
343
|
*/
|
|
@@ -406,7 +406,7 @@ export function createTicketBook(db, root, now = () => new Date()) {
|
|
|
406
406
|
* Ticket status stays until flush confirms. Returns null on CAS conflict.
|
|
407
407
|
* @param {string} ticketId
|
|
408
408
|
* @param {number | null} expectedRevision
|
|
409
|
-
* @param {'supply' | 'redirect'} kind
|
|
409
|
+
* @param {'supply' | 'redirect' | 'steer'} kind
|
|
410
410
|
* @param {string} text
|
|
411
411
|
*/
|
|
412
412
|
function advanceGeneration(ticketId, expectedRevision, kind, text) {
|
|
@@ -423,7 +423,7 @@ export function createTicketBook(db, root, now = () => new Date()) {
|
|
|
423
423
|
if (!allowed)
|
|
424
424
|
return {
|
|
425
425
|
error: 'VALIDATION',
|
|
426
|
-
message: `Ticket status ${ticket.status} cannot ${kind
|
|
426
|
+
message: `Ticket status ${ticket.status} cannot ${kind}.`,
|
|
427
427
|
};
|
|
428
428
|
if (!ticket.child_session_id)
|
|
429
429
|
return {
|
|
@@ -1359,6 +1359,8 @@ function hostFailureText(reason) {
|
|
|
1359
1359
|
return 'The main session refused more budget and this round has stopped.';
|
|
1360
1360
|
if (reason === 'lease')
|
|
1361
1361
|
return 'The worker lease expired and this round has stopped.';
|
|
1362
|
+
if (reason === 'no-report')
|
|
1363
|
+
return 'The worker ended its turn without a report. The session was still running; this was not a lease or heartbeat timeout.';
|
|
1362
1364
|
if (reason === 'enqueue-wall')
|
|
1363
1365
|
return 'The task entered the queue and did not start before the time limit.';
|
|
1364
1366
|
if (reason === 'reserve-wall')
|
package/dist/work-tools.js
CHANGED
|
@@ -19,19 +19,11 @@ const OUTPUT = {
|
|
|
19
19
|
*/
|
|
20
20
|
export function workToolDefinitions(work, engine) {
|
|
21
21
|
return [
|
|
22
|
-
tool('foundations_dispatch',
|
|
22
|
+
tool('foundations_dispatch', `Hand a non-trivial job to a worker session. Prefer this over doing the work with bash, write, edit, or an official subagent in the main session. Available only on a bot. The host assigns the opening budget of one standard slice (${SLICE}). Do not pass a budget. status=accepted means received, and may wait for an execution slot. status=enqueued means it entered the execution queue, not that it has started. queued=true means it is waiting for a slot and will start automatically when one is free. The return value is never started. A BUDGET error means both the slot cap and the queue cap are full; do not start the job in the main session. ownerSessionId is ignored.`, {
|
|
23
23
|
type: 'object',
|
|
24
24
|
properties: {
|
|
25
25
|
briefing: { type: 'string' },
|
|
26
26
|
idempotencyKey: { type: 'string' },
|
|
27
|
-
budget: {
|
|
28
|
-
type: 'object',
|
|
29
|
-
description: `Time and token budget for this ticket. When omitted, the host uses one standard slice (${SLICE}). Pass that slice. Do not estimate a smaller budget. Later grants add more slices with no cumulative ceiling.`,
|
|
30
|
-
properties: {
|
|
31
|
-
wallMs: { type: 'integer', description: 'Expected maximum runtime in milliseconds.' },
|
|
32
|
-
maxTokens: { type: 'integer', description: 'Expected maximum tokens.' },
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
27
|
correlationId: { type: 'string' },
|
|
36
28
|
ownerSessionId: { type: 'string', description: 'Ignored. The host uses the current session.' },
|
|
37
29
|
parentTicketId: { type: 'string', description: 'The MVP rejects a non-empty value.' },
|
|
@@ -58,6 +50,16 @@ export function workToolDefinitions(work, engine) {
|
|
|
58
50
|
},
|
|
59
51
|
required: ['text'],
|
|
60
52
|
}, (args, hostId) => work.redirect(hostId, args), 'bot'),
|
|
53
|
+
tool('foundations_steer', 'Interrupt a running worker. The current turn stops and text is what the worker does next. Use this when the worker is on the wrong path. foundations_redirect does not stop the current turn. Old reports from the previous generation become stale.', {
|
|
54
|
+
type: 'object',
|
|
55
|
+
properties: {
|
|
56
|
+
text: { type: 'string', description: 'The correction. Say what to stop and what to do instead.' },
|
|
57
|
+
ticketId: { type: 'string' },
|
|
58
|
+
expectedRevision: { type: 'integer' },
|
|
59
|
+
ownerSessionId: { type: 'string', description: 'Ignored.' },
|
|
60
|
+
},
|
|
61
|
+
required: ['text'],
|
|
62
|
+
}, (args, hostId) => work.steer(hostId, args), 'bot'),
|
|
61
63
|
tool('foundations_cancel', 'Cancel the ticket. Ticket notices that have not been claimed are removed from the inbox. It does not start again on its own.', {
|
|
62
64
|
type: 'object',
|
|
63
65
|
properties: {
|