dsh-artcraft-plugin-gridcraft 0.2.8 → 0.2.9
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/package.json +1 -1
- package/src/kit/suite.js +80 -0
- package/src/kit/tools.js +9 -1
package/package.json
CHANGED
package/src/kit/suite.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ArtCraft suite graph: which applications work together.
|
|
3
|
+
*
|
|
4
|
+
* A user who installs one craft has a working tool, not the best version of the
|
|
5
|
+
* workflow they are about to attempt: a report wants a spreadsheet and a word
|
|
6
|
+
* processor, a video wants slides and a mixer. This is the one place that
|
|
7
|
+
* knowledge lives, so the installer, the doctor and the plugins agree.
|
|
8
|
+
* @module @dsh-artcraft/craft-kit/suite
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** A workflow that spans several crafts. */
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
/** A package that is not a craft but completes the experience. */
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/** Workflows that need more than one craft. */
|
|
26
|
+
export const SUITE_WORKFLOWS = [
|
|
27
|
+
{ id: 'report', delivers: 'a data-backed report as DOCX and PDF', crafts: ['gridcraft', 'wordcraft', 'pdfcraft'] },
|
|
28
|
+
{ id: 'deck', delivers: 'a presentation with native charts', crafts: ['gridcraft', 'deckcraft', 'pdfcraft'] },
|
|
29
|
+
{ id: 'explainer-video', delivers: 'a narrated video from slides', crafts: ['deckcraft', 'filmcraft', 'soundcraft'] },
|
|
30
|
+
{ id: 'motion', delivers: 'a motion-graphics piece cut with the video', crafts: ['effectcraft', 'filmcraft'] },
|
|
31
|
+
{ id: 'brand-kit', delivers: 'a design system turned into a brand book', crafts: ['figcraft', 'vectorcraft', 'designcraft'] },
|
|
32
|
+
{ id: 'photo-pipeline', delivers: 'raw files developed and retouched for web and print', crafts: ['lightcraft', 'photocraft'] },
|
|
33
|
+
{ id: 'print-layout', delivers: 'a print-ready layout with images and graphics', crafts: ['photocraft', 'vectorcraft', 'designcraft'] },
|
|
34
|
+
{ id: 'cad-set', delivers: 'a drawing set delivered as one PDF', crafts: ['cadcraft', 'pdfcraft'] },
|
|
35
|
+
{ id: 'texture-kit', delivers: 'PBR maps baked and packed for a 3D asset', crafts: ['texturecraft', 'photocraft'] },
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
/** Packages that improve every craft. */
|
|
39
|
+
export const SUITE_COMPANIONS = [
|
|
40
|
+
{
|
|
41
|
+
id: 'preview-panel',
|
|
42
|
+
package: 'dsh-artcraft-preview-panel',
|
|
43
|
+
why: 'shows each step of the document inside the DSH Web GUI, and starts the local preview server',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: 'skills',
|
|
47
|
+
package: 'dsh-artcraft-skills',
|
|
48
|
+
why: 'the workflows themselves (report, brand kit, explainer video, drawing set, conversion) as agent skills',
|
|
49
|
+
},
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Missing crafts of the workflows a user has already started.
|
|
54
|
+
* @param installed - craft ids currently installed.
|
|
55
|
+
* @returns one entry per missing craft, best-completing workflow first.
|
|
56
|
+
*/
|
|
57
|
+
export function suggestCrafts(installed ) {
|
|
58
|
+
const have = new Set(installed)
|
|
59
|
+
const missing = new Map ()
|
|
60
|
+
for (const workflow of SUITE_WORKFLOWS) {
|
|
61
|
+
const present = workflow.crafts.filter(craft => have.has(craft))
|
|
62
|
+
if (present.length === 0 || present.length === workflow.crafts.length) continue
|
|
63
|
+
for (const craft of workflow.crafts) {
|
|
64
|
+
if (have.has(craft)) continue
|
|
65
|
+
const existing = missing.get(craft)
|
|
66
|
+
const candidate = { craft, forWorkflow: workflow.id, delivers: workflow.delivers, has: present.length, needs: workflow.crafts.length }
|
|
67
|
+
if (existing === undefined || candidate.has / candidate.needs > existing.has / existing.needs) missing.set(craft, candidate)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return [...missing.values()].sort((a, b) => b.has / b.needs - a.has / a.needs || a.craft.localeCompare(b.craft))
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The workflows one craft takes part in.
|
|
75
|
+
* @param craft - craft id.
|
|
76
|
+
* @returns the workflows containing it.
|
|
77
|
+
*/
|
|
78
|
+
export function workflowsOf(craft ) {
|
|
79
|
+
return SUITE_WORKFLOWS.filter(workflow => workflow.crafts.includes(craft))
|
|
80
|
+
}
|
package/src/kit/tools.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
import { craftCallView, craftResultView } from './present.js'
|
|
12
12
|
import { canPreview, nextStepNumber, previewRoot, recordPreview, renderPreview, stepName } from './preview.js'
|
|
13
|
+
import { workflowsOf } from './suite.js'
|
|
13
14
|
import { appendJournal } from './journal.js'
|
|
14
15
|
import { CraftMcpClient, renderSchema } from './mcp.js'
|
|
15
16
|
|
|
@@ -1157,7 +1158,14 @@ export function applyCraftPlugin(
|
|
|
1157
1158
|
+ (profile.mcpAttach === undefined
|
|
1158
1159
|
? ''
|
|
1159
1160
|
: `When the user has ${profile.product} open, pass \`attach: <control port>\` to an mcp call to work in their window instead of a headless copy. `)
|
|
1160
|
-
+ `Images returned by a render or screenshot are saved and named by path; look at them with \`read_image
|
|
1161
|
+
+ `Images returned by a render or screenshot are saved and named by path; look at them with \`read_image\`.`
|
|
1162
|
+
+ (() => {
|
|
1163
|
+
const partners = [...new Set(workflowsOf(profile.id).flatMap(workflow => workflow.crafts).filter(craft => craft !== profile.id))]
|
|
1164
|
+
if (partners.length === 0) return ''
|
|
1165
|
+
// A half-installed workflow is the common gap: name the partners so the
|
|
1166
|
+
// agent can offer the missing plugin instead of failing at the join.
|
|
1167
|
+
return ` Workflows that start in ${profile.product} usually also need ${partners.join(', ')}: if one of those tools is unavailable, say which plugin provides it and offer to install it.`
|
|
1168
|
+
})(),
|
|
1161
1169
|
order: CRAFT_SECTION_ORDER,
|
|
1162
1170
|
})
|
|
1163
1171
|
return () => {
|