mikser-io 7.8.0 → 7.8.2
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/engine.js +2 -3
- package/src/mcp.js +8 -2
- package/src/plugins/api.js +8 -3
- package/src/plugins/assets.js +2 -2
- package/src/plugins/data.js +1 -1
- package/src/plugins/files.js +1 -1
- package/src/plugins/front-matter.js +1 -1
- package/src/plugins/layouts.js +2 -2
- package/src/plugins/observer.js +4 -4
- package/src/plugins/preview.js +8 -3
- package/src/plugins/resources.js +1 -1
- package/src/plugins/shares.js +1 -1
- package/src/plugins.js +1 -1
- package/src/source.js +3 -3
package/package.json
CHANGED
package/src/engine.js
CHANGED
|
@@ -184,7 +184,7 @@ export async function setup(options) {
|
|
|
184
184
|
if (req.method === 'OPTIONS') return res.sendStatus(204)
|
|
185
185
|
next()
|
|
186
186
|
})
|
|
187
|
-
logger.
|
|
187
|
+
logger.debug('CORS enabled: %s', origin)
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
|
|
@@ -250,11 +250,10 @@ export async function setup(options) {
|
|
|
250
250
|
// plugin's router falls through to the static handler and
|
|
251
251
|
// gets served from <outputFolder>.
|
|
252
252
|
runtime.options.app.use(express.static(runtime.options.outputFolder))
|
|
253
|
-
logger.info('Serving %s as /', runtime.options.outputFolder.replace(runtime.options.workingFolder + '/', ''))
|
|
254
253
|
|
|
255
254
|
await new Promise(resolve => {
|
|
256
255
|
runtime.options.app.listen(runtime.options.port, () => {
|
|
257
|
-
logger.info('Server listening
|
|
256
|
+
logger.info('Server listening: http://localhost:%d', runtime.options.port)
|
|
258
257
|
resolve()
|
|
259
258
|
})
|
|
260
259
|
})
|
package/src/mcp.js
CHANGED
|
@@ -473,10 +473,16 @@ function mountEndpoint(app, substrate, path, ep, endpointName) {
|
|
|
473
473
|
const authLabel = ep.token
|
|
474
474
|
? 'token'
|
|
475
475
|
: (ep.allowRemote ? 'public, REMOTE OPEN' : 'public, loopback-only')
|
|
476
|
+
// Print as a full URL when we know the port so the operator can
|
|
477
|
+
// copy/click straight from the log. Falls back to bare path for
|
|
478
|
+
// external-app setups where the engine doesn't own the listener.
|
|
479
|
+
const location = runtime.options.port
|
|
480
|
+
? `http://localhost:${runtime.options.port}${path}`
|
|
481
|
+
: path
|
|
476
482
|
if (endpointName) {
|
|
477
|
-
logger.info('MCP endpoint mounted: %s (tools=[%s] [%s])',
|
|
483
|
+
logger.info('MCP endpoint mounted: %s (tools=[%s] [%s])', location, toolsLabel, authLabel)
|
|
478
484
|
} else {
|
|
479
|
-
logger.info('MCP mounted: %s [%s]',
|
|
485
|
+
logger.info('MCP mounted: %s [%s]', location, authLabel)
|
|
480
486
|
}
|
|
481
487
|
}
|
|
482
488
|
}
|
package/src/plugins/api.js
CHANGED
|
@@ -637,8 +637,13 @@ export default ({
|
|
|
637
637
|
const authLabel = ep.token
|
|
638
638
|
? 'token'
|
|
639
639
|
: (ep.allowRemote ? 'public, REMOTE OPEN' : 'public, loopback-only')
|
|
640
|
-
|
|
641
|
-
|
|
640
|
+
// Full URL when the engine owns the listener (port is known).
|
|
641
|
+
// Falls back to the path alone for external-app setups.
|
|
642
|
+
const location = runtime.options.port
|
|
643
|
+
? `http://localhost:${runtime.options.port}${base}/${name}`
|
|
644
|
+
: `${base}/${name}`
|
|
645
|
+
logger.info('Api endpoint mounted: %s (ops=[%s] [%s])',
|
|
646
|
+
location, [...allowedOps].join(','), authLabel)
|
|
642
647
|
}
|
|
643
648
|
|
|
644
649
|
// MCP tool registrations. MCP is in-process: whoever can reach
|
|
@@ -833,7 +838,7 @@ export default ({
|
|
|
833
838
|
},
|
|
834
839
|
)
|
|
835
840
|
|
|
836
|
-
logger.
|
|
841
|
+
logger.debug('MCP tools registered: mikser_api_{list_entities,read_entity,update_entity,delete_entity,render} (api plugin)')
|
|
837
842
|
}
|
|
838
843
|
})
|
|
839
844
|
|
package/src/plugins/assets.js
CHANGED
|
@@ -119,12 +119,12 @@ export default ({
|
|
|
119
119
|
|
|
120
120
|
runtime.options.presets = runtime.config.presets?.presetsFolder || collection
|
|
121
121
|
runtime.options.presetsFolder = path.join(runtime.options.workingFolder, runtime.options.presets)
|
|
122
|
-
logger.
|
|
122
|
+
logger.debug('Presets folder: %s', runtime.options.presetsFolder)
|
|
123
123
|
await mkdir(runtime.options.presetsFolder, { recursive: true })
|
|
124
124
|
|
|
125
125
|
runtime.options.assets = runtime.config.assets?.assetsFolder || 'assets'
|
|
126
126
|
runtime.options.assetsFolder = path.join(runtime.options.workingFolder, runtime.options.assets)
|
|
127
|
-
logger.
|
|
127
|
+
logger.debug('Assets folder: %s', runtime.options.assetsFolder)
|
|
128
128
|
await mkdir(runtime.options.assetsFolder, { recursive: true })
|
|
129
129
|
|
|
130
130
|
let link = path.join(runtime.options.outputFolder, runtime.options.assets)
|
package/src/plugins/data.js
CHANGED
|
@@ -20,7 +20,7 @@ export default ({
|
|
|
20
20
|
runtime.options.data = runtime.config.data?.dataFolder || 'data'
|
|
21
21
|
runtime.options.dataFolder = path.join(runtime.options.outputFolder, runtime.options.data)
|
|
22
22
|
|
|
23
|
-
logger.
|
|
23
|
+
logger.debug('Data folder: %s', runtime.options.dataFolder)
|
|
24
24
|
await mkdir(runtime.options.dataFolder, { recursive: true })
|
|
25
25
|
})
|
|
26
26
|
|
package/src/plugins/files.js
CHANGED
|
@@ -113,7 +113,7 @@ export default ({
|
|
|
113
113
|
runtime.options.files = runtime.config.files?.filesFolder || collection
|
|
114
114
|
runtime.options.filesFolder = path.join(runtime.options.workingFolder, runtime.options.files)
|
|
115
115
|
|
|
116
|
-
logger.
|
|
116
|
+
logger.debug('Files folder: %s', runtime.options.filesFolder)
|
|
117
117
|
await mkdir(runtime.options.filesFolder, { recursive: true })
|
|
118
118
|
|
|
119
119
|
watch(collection, runtime.options.filesFolder)
|
|
@@ -9,7 +9,7 @@ export default ({
|
|
|
9
9
|
}) => {
|
|
10
10
|
onProcess(async () => {
|
|
11
11
|
const logger = useLogger()
|
|
12
|
-
for await (let { id, entity } of useJournal('
|
|
12
|
+
for await (let { id, entity } of useJournal('Front matter', [OPERATION.CREATE, OPERATION.UPDATE])) {
|
|
13
13
|
if (entity.content && fm.test(entity.content)) {
|
|
14
14
|
const info = fm(entity.content)
|
|
15
15
|
if (info.attributes) {
|
package/src/plugins/layouts.js
CHANGED
|
@@ -233,7 +233,7 @@ export default ({
|
|
|
233
233
|
runtime.options.layoutsFolder = path.join(runtime.options.workingFolder, runtime.options.layouts)
|
|
234
234
|
runtime.options.layoutsStateFolder = path.join(runtime.options.outputFolder, 'state')
|
|
235
235
|
|
|
236
|
-
logger.
|
|
236
|
+
logger.debug('Layouts folder: %s', runtime.options.layoutsFolder)
|
|
237
237
|
await mkdir(runtime.options.layoutsFolder, { recursive: true })
|
|
238
238
|
|
|
239
239
|
watch(collection, runtime.options.layoutsFolder)
|
|
@@ -591,7 +591,7 @@ export default ({
|
|
|
591
591
|
},
|
|
592
592
|
)
|
|
593
593
|
const logger = useLogger()
|
|
594
|
-
logger.
|
|
594
|
+
logger.debug('MCP tool registered: mikser_layouts_inspect (layouts plugin)')
|
|
595
595
|
})
|
|
596
596
|
|
|
597
597
|
return {
|
package/src/plugins/observer.js
CHANGED
|
@@ -119,16 +119,16 @@ export default ({
|
|
|
119
119
|
entity.checksum = await hash(JSON.stringify(entity.meta), { algorithm: 'md5' })
|
|
120
120
|
if (current) {
|
|
121
121
|
if (entity.checksum != current.checksum) {
|
|
122
|
-
logger.
|
|
122
|
+
logger.debug('Observer update: %s', id)
|
|
123
123
|
await updateEntity(entity)
|
|
124
124
|
}
|
|
125
125
|
} else {
|
|
126
|
-
logger.
|
|
126
|
+
logger.debug('Observer create: %s', id)
|
|
127
127
|
await createEntity(entity)
|
|
128
128
|
}
|
|
129
129
|
} else {
|
|
130
130
|
if (current) {
|
|
131
|
-
logger.
|
|
131
|
+
logger.debug('Observer delete: %s', id)
|
|
132
132
|
await deleteEntity(entity)
|
|
133
133
|
}
|
|
134
134
|
}
|
|
@@ -157,7 +157,7 @@ export default ({
|
|
|
157
157
|
const { origin } = new URL(runtime.config.observer[observerName].uri)
|
|
158
158
|
onSync(origin, async ({ context }) => {
|
|
159
159
|
if (context.uri) {
|
|
160
|
-
logger.
|
|
160
|
+
logger.debug('Syncing observer: [%s] %s', observerName, context.uri)
|
|
161
161
|
return syncEntities(observerName)
|
|
162
162
|
}
|
|
163
163
|
})
|
package/src/plugins/preview.js
CHANGED
|
@@ -124,7 +124,12 @@ export default ({
|
|
|
124
124
|
}
|
|
125
125
|
res.type(entry.mime).send(entry.bytes)
|
|
126
126
|
})
|
|
127
|
-
|
|
127
|
+
// Full URL when port is known; bare path otherwise. The /:filename
|
|
128
|
+
// segment is left off — it's filled at request time per preview.
|
|
129
|
+
const location = runtime.options.port
|
|
130
|
+
? `http://localhost:${runtime.options.port}${cfg.path}`
|
|
131
|
+
: cfg.path
|
|
132
|
+
logger.info('Preview route mounted: %s (cache cap: %d MB)', location, Math.round(cfg.maxBytes / 1024 / 1024))
|
|
128
133
|
})
|
|
129
134
|
|
|
130
135
|
// Gating on runtime.options.mcp inside onLoaded matches the route-
|
|
@@ -182,7 +187,7 @@ export default ({
|
|
|
182
187
|
const url = `http://localhost:${runtime.options.port}${cfg.path}/${filename}`
|
|
183
188
|
const bytes = Buffer.isBuffer(result) ? result.length : Buffer.byteLength(result)
|
|
184
189
|
|
|
185
|
-
logger.
|
|
190
|
+
logger.debug('MCP mikser_preview_render cached %s (%d bytes, ttl %ds): %s', filename, bytes, ttlSec, url)
|
|
186
191
|
|
|
187
192
|
return ok({
|
|
188
193
|
previewUrl: url,
|
|
@@ -199,7 +204,7 @@ export default ({
|
|
|
199
204
|
)
|
|
200
205
|
|
|
201
206
|
const logger = useLogger()
|
|
202
|
-
logger.
|
|
207
|
+
logger.debug('MCP tool registered: mikser_preview_render (preview plugin)')
|
|
203
208
|
})
|
|
204
209
|
|
|
205
210
|
return { name: 'preview' }
|
package/src/plugins/resources.js
CHANGED
|
@@ -48,7 +48,7 @@ export default ({
|
|
|
48
48
|
|
|
49
49
|
runtime.options.resources = runtime.config.resources?.resourcesFolder || collection
|
|
50
50
|
runtime.options.resourcesFolder = path.join(runtime.options.workingFolder, runtime.options.resources)
|
|
51
|
-
logger.
|
|
51
|
+
logger.debug('Resources folder: %s', runtime.options.resourcesFolder)
|
|
52
52
|
|
|
53
53
|
for (let library in (runtime.config.resources?.libraries || [])) {
|
|
54
54
|
let resource = runtime.config.resources.libraries[library]
|
package/src/plugins/shares.js
CHANGED
|
@@ -25,7 +25,7 @@ export default ({
|
|
|
25
25
|
const sourceStat = await stat(sourceLocation)
|
|
26
26
|
|
|
27
27
|
await mkdir(destinationFolder, { recursive: true })
|
|
28
|
-
logger.
|
|
28
|
+
logger.debug('Sharing: %s → %s', sourceLocation, destinationLocation)
|
|
29
29
|
if (sourceStat.isDirectory()) {
|
|
30
30
|
await symlink(path.resolve(sourceLocation), destinationLocation, 'dir')
|
|
31
31
|
} else {
|
package/src/plugins.js
CHANGED
|
@@ -63,7 +63,7 @@ onLoad(async () => {
|
|
|
63
63
|
if (!userPlugins.length) {
|
|
64
64
|
logger.info('No plugins loaded')
|
|
65
65
|
} else {
|
|
66
|
-
logger.info('Loading plugins: %s', userPlugins)
|
|
66
|
+
logger.info('Loading plugins: %s', userPlugins.join(', '))
|
|
67
67
|
|
|
68
68
|
for (let plugin of userPlugins) {
|
|
69
69
|
await loadPlugin(plugin)
|
package/src/source.js
CHANGED
|
@@ -126,7 +126,7 @@ export function useSource(core, options) {
|
|
|
126
126
|
: `${prefix}/${context.relativePath.replace(/\\/g, '/')}`
|
|
127
127
|
try {
|
|
128
128
|
await deleteEntity({ id, type, collection })
|
|
129
|
-
logger.
|
|
129
|
+
logger.debug('%s removed: %s', collection, name)
|
|
130
130
|
} catch (err) {
|
|
131
131
|
logger.warn('%s remove failed for %s: %s', collection, name, err.message)
|
|
132
132
|
}
|
|
@@ -154,7 +154,7 @@ export function useSource(core, options) {
|
|
|
154
154
|
? folder
|
|
155
155
|
: path.join(runtime.options.workingFolder, folder)
|
|
156
156
|
runtime.options[`${collection}Folder`] = absFolder
|
|
157
|
-
logger.
|
|
157
|
+
logger.debug('%s folder: %s', cap, absFolder)
|
|
158
158
|
|
|
159
159
|
await mkdir(absFolder, { recursive: true })
|
|
160
160
|
watch(collection, absFolder)
|
|
@@ -222,7 +222,7 @@ export function useSource(core, options) {
|
|
|
222
222
|
const write = action === ACTION.UPDATE ? updateEntity : createEntity
|
|
223
223
|
await write(entity)
|
|
224
224
|
if (phase !== 'import' || reload) {
|
|
225
|
-
logger.
|
|
225
|
+
logger.debug('%s %s: %s', cap, reload ? 'reloaded' : 'loaded', name)
|
|
226
226
|
}
|
|
227
227
|
} catch (err) {
|
|
228
228
|
logger.error('%s load failed for %s: %s', collection, name, err.message)
|