meshy-dsh 0.3.7 → 0.4.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.
- package/README.md +203 -42
- package/README.zh.md +118 -8
- package/assets/viewer-env.hdr +6 -0
- package/lib/catalog.js +124 -0
- package/lib/client.js +4410 -655
- package/lib/client.viewer.js +42 -30
- package/lib/compose.js +100 -0
- package/lib/events.js +28 -0
- package/lib/index.js +528 -115
- package/lib/service.js +89 -0
- package/lib/tasks.js +687 -0
- package/lib/tools.js +756 -0
- package/lib/uploads.js +79 -0
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +5 -4
- package/skills/meshy-3d-generation/SKILL.md +6 -3
- package/skills/meshy-3d-generation/references/delivery.md +11 -6
- package/skills/meshy-3d-generation/references/pipelines.md +6 -5
- package/skills/meshy-3d-generation/references/setup.md +6 -6
- package/skills/meshy-3d-generation/references/troubleshooting.md +2 -2
- package/skills/meshy-3d-generation/references/visual-hosts.md +34 -0
- package/skills/meshy-3d-printing/SKILL.md +8 -4
- package/skills/meshy-3d-printing/references/delivery.md +11 -6
- package/skills/meshy-3d-printing/references/printing.md +11 -10
- package/skills/meshy-3d-printing/references/setup.md +6 -6
- package/skills/meshy-3d-printing/references/troubleshooting.md +2 -2
- package/skills/meshy-3d-printing/references/visual-hosts.md +34 -0
package/lib/service.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// Public Cordis host service (`ctx.provide('meshy', service)`): other dsh plugins and Creator Mode
|
|
2
|
+
// compositions read Meshy status, tasks and models, run Meshy CLI commands through the same
|
|
3
|
+
// approval as the agent's `meshy` tool, drive the right-sidebar Studio, and subscribe
|
|
4
|
+
// to live events.
|
|
5
|
+
import { listModels, recordAsset, resolveWorkspaceFile } from './tasks.js'
|
|
6
|
+
|
|
7
|
+
export function createMeshyService({ getStatus, sessionTasks, library, taskStates, events, meshyTool }) {
|
|
8
|
+
return {
|
|
9
|
+
version: 1,
|
|
10
|
+
|
|
11
|
+
async status() {
|
|
12
|
+
return getStatus()
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
tasks: {
|
|
16
|
+
session(sessionId, opts) {
|
|
17
|
+
return sessionTasks(sessionId, opts)
|
|
18
|
+
},
|
|
19
|
+
library(opts) {
|
|
20
|
+
return library.list(opts)
|
|
21
|
+
},
|
|
22
|
+
get(resource, taskId) {
|
|
23
|
+
return taskStates.get(resource, taskId)
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
models: {
|
|
28
|
+
list(workspace) {
|
|
29
|
+
return listModels(workspace)
|
|
30
|
+
},
|
|
31
|
+
async announce(workspace, file, meta = {}) {
|
|
32
|
+
const resolved = await resolveWorkspaceFile(workspace, file, { allowedExts: new Set(['.glb', '.3mf']) })
|
|
33
|
+
if (typeof meta?.taskId === 'string') {
|
|
34
|
+
await recordAsset(workspace, meta.taskId, {
|
|
35
|
+
resource: typeof meta.resource === 'string' ? meta.resource : null,
|
|
36
|
+
kind: 'model',
|
|
37
|
+
file: resolved.rel,
|
|
38
|
+
files: [resolved.rel],
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
events.emit({
|
|
42
|
+
type: 'model',
|
|
43
|
+
sessionId: typeof meta?.sessionId === 'string' ? meta.sessionId : null,
|
|
44
|
+
workspace,
|
|
45
|
+
file: resolved.rel,
|
|
46
|
+
resource: typeof meta?.resource === 'string' ? meta.resource : null,
|
|
47
|
+
taskId: typeof meta?.taskId === 'string' ? meta.taskId : null,
|
|
48
|
+
})
|
|
49
|
+
return { file: resolved.rel }
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
ui: {
|
|
54
|
+
openModel(sessionId, target) {
|
|
55
|
+
events.emit({
|
|
56
|
+
type: 'open',
|
|
57
|
+
sessionId: typeof sessionId === 'string' ? sessionId : null,
|
|
58
|
+
workspace: null,
|
|
59
|
+
target: target ?? null,
|
|
60
|
+
})
|
|
61
|
+
},
|
|
62
|
+
openTasks(sessionId) {
|
|
63
|
+
events.emit({
|
|
64
|
+
type: 'open',
|
|
65
|
+
sessionId: typeof sessionId === 'string' ? sessionId : null,
|
|
66
|
+
workspace: null,
|
|
67
|
+
target: null,
|
|
68
|
+
})
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Run one Meshy CLI command in a chat (`agent` carries its session), as the agent's `meshy`
|
|
74
|
+
* tool does: `args` are the CLI arguments after `meshy`; a command that spends credits asks
|
|
75
|
+
* the user first, showing `estimatedCredits` (from `make --dry-run` or the published price
|
|
76
|
+
* list) when given. Resolves when the command ends, with the CLI's envelope and saved files.
|
|
77
|
+
*/
|
|
78
|
+
async run({ agent, callId, signal, requester, args, estimatedCredits, estimateSource, title } = {}) {
|
|
79
|
+
return meshyTool.execute(
|
|
80
|
+
{ args, estimated_credits: estimatedCredits, estimate_source: estimateSource, title },
|
|
81
|
+
{ agent, callId, signal, requester, meshyWait: true },
|
|
82
|
+
)
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
subscribe(listener) {
|
|
86
|
+
return events.subscribe(listener)
|
|
87
|
+
},
|
|
88
|
+
}
|
|
89
|
+
}
|