dsh-model-everything 0.5.1 → 0.6.0
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/annotation.js +323 -0
- package/lib/client.js +2138 -184
- package/lib/diagram-render-tool.js +13 -1
- package/lib/diagram-review-tool.js +1 -1
- package/lib/diagram.js +33 -0
- package/lib/gate.js +8 -6
- package/lib/render/paint.js +671 -207
- package/lib/render/svg.js +11 -2
- package/lib/render/trunk.js +213 -0
- package/lib/routing.js +12 -0
- package/lib/transcript.js +327 -0
- package/lib/types/annotation.d.ts +128 -0
- package/lib/types/client.d.ts +89 -6
- package/lib/types/diagram.d.ts +7 -0
- package/lib/types/gate.d.ts +8 -6
- package/lib/types/render/paint.d.ts +122 -6
- package/lib/types/render/place.d.ts +8 -3
- package/lib/types/render/trunk.d.ts +104 -0
- package/lib/types/transcript.d.ts +82 -0
- package/package.json +149 -148
- package/skills/model-everything/SKILL.md +2 -1
- package/skills/model-everything-diagram/SKILL.md +22 -1
- package/src/annotation.ts +333 -0
- package/src/client.ts +1841 -307
- package/src/diagram-render-tool.ts +13 -1
- package/src/diagram-review-tool.ts +1 -1
- package/src/diagram.ts +31 -0
- package/src/gate.ts +8 -6
- package/src/render/paint.ts +774 -205
- package/src/render/place.ts +8 -3
- package/src/render/svg.ts +12 -2
- package/src/render/trunk.ts +275 -0
- package/src/routing.ts +12 -0
- package/src/transcript.ts +349 -0
|
@@ -11,7 +11,7 @@ import { writeSvg } from './render/write.js';
|
|
|
11
11
|
export const DIAGRAM_TOOL_NAME = 'diagram_render';
|
|
12
12
|
export const diagramRenderTool = defineTool({
|
|
13
13
|
name: DIAGRAM_TOOL_NAME,
|
|
14
|
-
description: 'Draw a diagram from its source text and get back SVG.
|
|
14
|
+
description: 'Draw a diagram from its source text and get back SVG. Structure is read from a picture, so reach for this whenever the answer is a layout, a flow, a set of boundaries or a change between two of them - not only when the request says draw. Pass `out` to write the SVG and show it to the reader beside the explanation it carries, and read the model-everything-diagram skill for what this notation subset covers and what it refuses. It accepts Mermaid (flowchart, stateDiagram) and PlantUML (component, package, state), lays out boxes and arrows itself, and reports every line it refused with its line number instead of drawing half a diagram. This tool draws; it does not parse a diagram back into a model, and it does not review one - uml_parse and uml_review do that.',
|
|
15
15
|
parameters: {
|
|
16
16
|
source: {
|
|
17
17
|
type: 'string',
|
|
@@ -58,6 +58,18 @@ export const diagramRenderTool = defineTool({
|
|
|
58
58
|
}
|
|
59
59
|
return [{ type: 'text', text: lines.join('\n') }];
|
|
60
60
|
},
|
|
61
|
+
// The card a UI shows. The host keeps this on the settled call as `block.meta`, which is the one place a
|
|
62
|
+
// view can find the drawing's own source: by then the arguments are gone. Measured against how
|
|
63
|
+
// dsh-deepread's card reads its payload - the same field.
|
|
64
|
+
presentationMeta(args, value) {
|
|
65
|
+
const result = value;
|
|
66
|
+
const asked = args;
|
|
67
|
+
return {
|
|
68
|
+
source: typeof asked.source === 'string' ? asked.source : '',
|
|
69
|
+
scheme: typeof asked.scheme === 'string' ? asked.scheme : 'default',
|
|
70
|
+
caption: typeof result.caption === 'string' ? result.caption : '',
|
|
71
|
+
};
|
|
72
|
+
},
|
|
61
73
|
},
|
|
62
74
|
timeoutMs: 10_000,
|
|
63
75
|
isConcurrencySafe: () => true,
|
|
@@ -19,7 +19,7 @@ function limitsOf(args) {
|
|
|
19
19
|
}
|
|
20
20
|
export const diagramReviewTool = defineTool({
|
|
21
21
|
name: DIAGRAM_REVIEW_TOOL_NAME,
|
|
22
|
-
description: 'Review the structure of a diagram from its source text: how wide each boundary is, how deep they nest, and how many nodes the drawing holds, against budgets you can set. Accepts the same Mermaid and PlantUML subset as diagram_render and reports what it measured, so an empty report cannot be mistaken for a clean one. Read `verdict`, never `ok`. This reviews structure; it does not draw (diagram_render does) and it does not check behaviour (model_verify does).',
|
|
22
|
+
description: 'Review the structure of a diagram from its source text: how wide each boundary is, how deep they nest, and how many nodes the drawing holds, against budgets you can set. Run it before a drawing goes in front of a reader: a picture that needs scrolling is no longer a summary. Accepts the same Mermaid and PlantUML subset as diagram_render and reports what it measured, so an empty report cannot be mistaken for a clean one. Read `verdict`, never `ok`. This reviews structure; it does not draw (diagram_render does) and it does not check behaviour (model_verify does).',
|
|
23
23
|
parameters: {
|
|
24
24
|
source: {
|
|
25
25
|
type: 'string',
|
package/lib/diagram.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* boot, from the Plugins page, or by disabling this row, and none of those touches the tools or the skills.
|
|
11
11
|
*/
|
|
12
12
|
import z from '@deepseek-ai/schemastery';
|
|
13
|
+
import { createUserMessage } from '@deepseek-ai/dsh-llm';
|
|
13
14
|
import { diagramDiffTool } from './diagram-diff-tool.js';
|
|
14
15
|
import { diagramRenderTool } from './diagram-render-tool.js';
|
|
15
16
|
import { diagramReviewTool } from './diagram-review-tool.js';
|
|
@@ -39,5 +40,37 @@ export function apply(ctx, config) {
|
|
|
39
40
|
ctx.tools.register(diagramRenderTool);
|
|
40
41
|
ctx.tools.register(diagramReviewTool);
|
|
41
42
|
ctx.tools.register(diagramDiffTool);
|
|
43
|
+
registerAnnotateCommand(ctx);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Offer an annotation as a session command, so a page can send one without a composer.
|
|
47
|
+
*
|
|
48
|
+
* Optional on purpose, and failure-tolerant on purpose: a host without the commands service keeps the
|
|
49
|
+
* composer path, and a registration that throws must not take the drawing tools down with it.
|
|
50
|
+
*/
|
|
51
|
+
export function registerAnnotateCommand(ctx) {
|
|
52
|
+
const commands = ctx.get?.('commands');
|
|
53
|
+
if (commands === undefined || typeof commands.register !== 'function')
|
|
54
|
+
return;
|
|
55
|
+
try {
|
|
56
|
+
commands.register({
|
|
57
|
+
name: 'annotate',
|
|
58
|
+
description: 'Send a diagram annotation to this session',
|
|
59
|
+
handler: (invocation) => {
|
|
60
|
+
const raw = typeof invocation.rawInput === 'string' ? invocation.rawInput.trim().replace(/^\/?annotate\s*/i, '') : '';
|
|
61
|
+
const agent = invocation.agent;
|
|
62
|
+
const followup = agent?.followup;
|
|
63
|
+
if (raw === '' || typeof followup !== 'function')
|
|
64
|
+
return { kind: 'error', text: 'this host cannot take a follow-up note' };
|
|
65
|
+
// A follow-up takes a UserMessage, not a bag of fields: the runtime stamps the id and the time, and a
|
|
66
|
+
// hand-built object reaches the inbox without them. `createUserMessage` is the host's own constructor.
|
|
67
|
+
followup.call(agent, createUserMessage({ content: [{ type: 'text', text: raw }], source: { kind: 'user' } }));
|
|
68
|
+
return { kind: 'success', text: 'annotation sent' };
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
// A host whose command API differs keeps the composer path; the tools above are already registered.
|
|
74
|
+
}
|
|
42
75
|
}
|
|
43
76
|
export const inject = ['tools'];
|
package/lib/gate.js
CHANGED
|
@@ -10,13 +10,15 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Why it is a separate row. The plugin's doctrine is that a capability is discoverable
|
|
12
12
|
* through its own tool description or skill text. Injection departs from that, so it is
|
|
13
|
-
*
|
|
14
|
-
* without touching the tools or the skills. `enabled` is a live switch, so the Web
|
|
15
|
-
* page flips it inside a running host.
|
|
13
|
+
* mounted as its own component: the bundle's patch enables it, and the row can be turned off
|
|
14
|
+
* or removed without touching the tools or the skills. `enabled` is a live switch, so the Web
|
|
15
|
+
* Plugins page flips it inside a running host.
|
|
16
16
|
*
|
|
17
|
-
* Why
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* Why the bundle turns it on. Measured: a session that never decides to load a skill is never
|
|
18
|
+
* routed, and the catalog line is cut at 500 characters, so a domain the request names can be
|
|
19
|
+
* invisible at the moment of choosing. The cost is a fixed message in every session, which is
|
|
20
|
+
* why the switch is live and documented: turn it off where the bundle's default is wrong. The
|
|
21
|
+
* component's own `enabled` script default is off, so a bare `app.add(gate)` injects nothing.
|
|
20
22
|
*
|
|
21
23
|
* What it does not do. It routes; it checks nothing. It cannot make a skill load, and it
|
|
22
24
|
* does not restate the doctrine - the skill bodies carry that, and duplicating them here
|