@portel/photon 1.17.6 → 1.19.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/dist/auto-ui/beam/photon-management.d.ts.map +1 -1
- package/dist/auto-ui/beam/photon-management.js +28 -1
- package/dist/auto-ui/beam/photon-management.js.map +1 -1
- package/dist/auto-ui/beam/routes/api-marketplace.d.ts.map +1 -1
- package/dist/auto-ui/beam/routes/api-marketplace.js +10 -5
- package/dist/auto-ui/beam/routes/api-marketplace.js.map +1 -1
- package/dist/auto-ui/beam.d.ts.map +1 -1
- package/dist/auto-ui/beam.js +14 -4
- package/dist/auto-ui/beam.js.map +1 -1
- package/dist/auto-ui/streamable-http-transport.d.ts.map +1 -1
- package/dist/auto-ui/streamable-http-transport.js +259 -88
- package/dist/auto-ui/streamable-http-transport.js.map +1 -1
- package/dist/auto-ui/types.d.ts +2 -0
- package/dist/auto-ui/types.d.ts.map +1 -1
- package/dist/auto-ui/types.js +5 -0
- package/dist/auto-ui/types.js.map +1 -1
- package/dist/beam-form.bundle.js +5 -3
- package/dist/beam-form.bundle.js.map +2 -2
- package/dist/beam.bundle.js +912 -59
- package/dist/beam.bundle.js.map +3 -3
- package/dist/claude-code-plugin.js +1 -1
- package/dist/cli/commands/beam.d.ts.map +1 -1
- package/dist/cli/commands/beam.js +8 -2
- package/dist/cli/commands/beam.js.map +1 -1
- package/dist/cli/commands/changelog.d.ts +9 -0
- package/dist/cli/commands/changelog.d.ts.map +1 -0
- package/dist/cli/commands/changelog.js +133 -0
- package/dist/cli/commands/changelog.js.map +1 -0
- package/dist/cli/commands/maker.d.ts.map +1 -1
- package/dist/cli/commands/maker.js +23 -2
- package/dist/cli/commands/maker.js.map +1 -1
- package/dist/cli/commands/mcp.d.ts.map +1 -1
- package/dist/cli/commands/mcp.js +53 -0
- package/dist/cli/commands/mcp.js.map +1 -1
- package/dist/cli/commands/package.d.ts.map +1 -1
- package/dist/cli/commands/package.js +18 -2
- package/dist/cli/commands/package.js.map +1 -1
- package/dist/cli/commands/run.d.ts.map +1 -1
- package/dist/cli/commands/run.js +1 -0
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/update.d.ts +3 -2
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +50 -43
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +16 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/cli-alias.js +1 -1
- package/dist/cli-alias.js.map +1 -1
- package/dist/context-store.d.ts +23 -33
- package/dist/context-store.d.ts.map +1 -1
- package/dist/context-store.js +147 -97
- package/dist/context-store.js.map +1 -1
- package/dist/context.d.ts +15 -10
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +37 -13
- package/dist/context.js.map +1 -1
- package/dist/daemon/server.js +4 -2
- package/dist/daemon/server.js.map +1 -1
- package/dist/data-migration.d.ts +27 -0
- package/dist/data-migration.d.ts.map +1 -0
- package/dist/data-migration.js +307 -0
- package/dist/data-migration.js.map +1 -0
- package/dist/editor-support/docblock-tag-catalog.d.ts.map +1 -1
- package/dist/editor-support/docblock-tag-catalog.js +6 -0
- package/dist/editor-support/docblock-tag-catalog.js.map +1 -1
- package/dist/loader.d.ts +10 -0
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +106 -20
- package/dist/loader.js.map +1 -1
- package/dist/marketplace-manager.d.ts.map +1 -1
- package/dist/marketplace-manager.js +25 -5
- package/dist/marketplace-manager.js.map +1 -1
- package/dist/photon-cli-runner.d.ts.map +1 -1
- package/dist/photon-cli-runner.js +56 -19
- package/dist/photon-cli-runner.js.map +1 -1
- package/dist/photon-doc-extractor.d.ts +1 -0
- package/dist/photon-doc-extractor.d.ts.map +1 -1
- package/dist/photon-doc-extractor.js +6 -0
- package/dist/photon-doc-extractor.js.map +1 -1
- package/dist/readme-syncer.d.ts.map +1 -1
- package/dist/readme-syncer.js +6 -1
- package/dist/readme-syncer.js.map +1 -1
- package/dist/server.d.ts +40 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +298 -29
- package/dist/server.js.map +1 -1
- package/dist/shared/audit.js +4 -4
- package/dist/shared/audit.js.map +1 -1
- package/dist/tasks/executor.d.ts +47 -0
- package/dist/tasks/executor.d.ts.map +1 -0
- package/dist/tasks/executor.js +180 -0
- package/dist/tasks/executor.js.map +1 -0
- package/dist/tasks/store.d.ts +13 -6
- package/dist/tasks/store.d.ts.map +1 -1
- package/dist/tasks/store.js +56 -11
- package/dist/tasks/store.js.map +1 -1
- package/dist/tasks/types.d.ts +23 -2
- package/dist/tasks/types.d.ts.map +1 -1
- package/dist/tasks/types.js +23 -3
- package/dist/tasks/types.js.map +1 -1
- package/dist/version-notify.d.ts +27 -0
- package/dist/version-notify.d.ts.map +1 -0
- package/dist/version-notify.js +142 -0
- package/dist/version-notify.js.map +1 -0
- package/package.json +5 -4
- package/dist/auto-ui/bridge/openai-shim.d.ts +0 -20
- package/dist/auto-ui/bridge/openai-shim.d.ts.map +0 -1
- package/dist/auto-ui/bridge/openai-shim.js +0 -231
- package/dist/auto-ui/bridge/openai-shim.js.map +0 -1
- package/dist/auto-ui/bridge/photon-app.d.ts +0 -162
- package/dist/auto-ui/bridge/photon-app.d.ts.map +0 -1
- package/dist/auto-ui/bridge/photon-app.js +0 -460
- package/dist/auto-ui/bridge/photon-app.js.map +0 -1
- package/dist/auto-ui/daemon-tools.d.ts +0 -45
- package/dist/auto-ui/daemon-tools.d.ts.map +0 -1
- package/dist/auto-ui/daemon-tools.js +0 -581
- package/dist/auto-ui/daemon-tools.js.map +0 -1
- package/dist/auto-ui/design-system/index.d.ts +0 -21
- package/dist/auto-ui/design-system/index.d.ts.map +0 -1
- package/dist/auto-ui/design-system/index.js +0 -27
- package/dist/auto-ui/design-system/index.js.map +0 -1
- package/dist/auto-ui/design-system/transaction-ui.d.ts +0 -70
- package/dist/auto-ui/design-system/transaction-ui.d.ts.map +0 -1
- package/dist/auto-ui/design-system/transaction-ui.js +0 -982
- package/dist/auto-ui/design-system/transaction-ui.js.map +0 -1
- package/dist/auto-ui/playground-server.d.ts +0 -7
- package/dist/auto-ui/playground-server.d.ts.map +0 -1
- package/dist/auto-ui/playground-server.js +0 -840
- package/dist/auto-ui/playground-server.js.map +0 -1
- package/dist/auto-ui/rendering/components.d.ts +0 -29
- package/dist/auto-ui/rendering/components.d.ts.map +0 -1
- package/dist/auto-ui/rendering/components.js +0 -1341
- package/dist/auto-ui/rendering/components.js.map +0 -1
- package/dist/auto-ui/rendering/field-analyzer.d.ts +0 -104
- package/dist/auto-ui/rendering/field-analyzer.d.ts.map +0 -1
- package/dist/auto-ui/rendering/field-analyzer.js +0 -447
- package/dist/auto-ui/rendering/field-analyzer.js.map +0 -1
- package/dist/auto-ui/rendering/field-renderers.d.ts +0 -64
- package/dist/auto-ui/rendering/field-renderers.d.ts.map +0 -1
- package/dist/auto-ui/rendering/field-renderers.js +0 -317
- package/dist/auto-ui/rendering/field-renderers.js.map +0 -1
- package/dist/auto-ui/rendering/index.d.ts +0 -28
- package/dist/auto-ui/rendering/index.d.ts.map +0 -1
- package/dist/auto-ui/rendering/index.js +0 -60
- package/dist/auto-ui/rendering/index.js.map +0 -1
- package/dist/auto-ui/rendering/layout-selector.d.ts +0 -60
- package/dist/auto-ui/rendering/layout-selector.d.ts.map +0 -1
- package/dist/auto-ui/rendering/layout-selector.js +0 -476
- package/dist/auto-ui/rendering/layout-selector.js.map +0 -1
- package/dist/markdown-utils.d.ts +0 -8
- package/dist/markdown-utils.d.ts.map +0 -1
- package/dist/markdown-utils.js +0 -64
- package/dist/markdown-utils.js.map +0 -1
- package/dist/mcp-client.d.ts +0 -9
- package/dist/mcp-client.d.ts.map +0 -1
- package/dist/mcp-client.js +0 -11
- package/dist/mcp-client.js.map +0 -1
- package/dist/mcp-elicitation.d.ts +0 -32
- package/dist/mcp-elicitation.d.ts.map +0 -1
- package/dist/mcp-elicitation.js +0 -26
- package/dist/mcp-elicitation.js.map +0 -1
- package/dist/photons/builder-compass.photon.d.ts +0 -167
- package/dist/photons/builder-compass.photon.d.ts.map +0 -1
- package/dist/photons/builder-compass.photon.js +0 -816
- package/dist/photons/builder-compass.photon.js.map +0 -1
- package/dist/photons/builder-compass.photon.ts +0 -1129
- package/dist/photons/docs/ui/docs.html +0 -441
- package/dist/photons/docs.photon.d.ts +0 -237
- package/dist/photons/docs.photon.d.ts.map +0 -1
- package/dist/photons/docs.photon.js +0 -483
- package/dist/photons/docs.photon.js.map +0 -1
- package/dist/photons/docs.photon.ts +0 -536
- package/dist/photons/slides.photon.d.ts +0 -212
- package/dist/photons/slides.photon.d.ts.map +0 -1
- package/dist/photons/slides.photon.js +0 -355
- package/dist/photons/slides.photon.js.map +0 -1
- package/dist/photons/slides.photon.ts +0 -370
- package/dist/photons/spreadsheet/ui/spreadsheet.html +0 -779
- package/dist/photons/spreadsheet.photon.d.ts +0 -554
- package/dist/photons/spreadsheet.photon.d.ts.map +0 -1
- package/dist/photons/spreadsheet.photon.js +0 -1050
- package/dist/photons/spreadsheet.photon.js.map +0 -1
- package/dist/photons/spreadsheet.photon.ts +0 -1239
- package/dist/photons/ui/builder-compass.html +0 -1199
- package/dist/photons/ui/builder-compass.photon.html +0 -380
- package/dist/security-scanner.d.ts +0 -52
- package/dist/security-scanner.d.ts.map +0 -1
- package/dist/security-scanner.js +0 -181
- package/dist/security-scanner.js.map +0 -1
- package/dist/shared/performance.d.ts +0 -65
- package/dist/shared/performance.d.ts.map +0 -1
- package/dist/shared/performance.js +0 -136
- package/dist/shared/performance.js.map +0 -1
package/dist/loader.js
CHANGED
|
@@ -36,7 +36,7 @@ executionContext,
|
|
|
36
36
|
// Lock helper
|
|
37
37
|
withLock as withLockHelper,
|
|
38
38
|
// Middleware system
|
|
39
|
-
builtinRegistry, MiddlewareRegistry, buildMiddlewareChain, } from '@portel/photon-core';
|
|
39
|
+
builtinRegistry, MiddlewareRegistry, buildMiddlewareChain, detectNamespace, getCacheDir, } from '@portel/photon-core';
|
|
40
40
|
import { getDefaultContext } from './context.js';
|
|
41
41
|
import * as os from 'os';
|
|
42
42
|
import { MarketplaceManager } from './marketplace-manager.js';
|
|
@@ -332,7 +332,7 @@ export class PhotonLoader {
|
|
|
332
332
|
* Directory where MCP-specific dependencies are cached
|
|
333
333
|
*/
|
|
334
334
|
getDependencyCacheDir(cacheKey) {
|
|
335
|
-
return path.join(
|
|
335
|
+
return path.join(getCacheDir(), 'dependencies', cacheKey);
|
|
336
336
|
}
|
|
337
337
|
getBuildCacheDir(cacheKey) {
|
|
338
338
|
return path.join(this.getDependencyCacheDir(cacheKey), '.build');
|
|
@@ -402,22 +402,27 @@ export class PhotonLoader {
|
|
|
402
402
|
? this.dependenciesEqual(metadata.dependencies, dependencies)
|
|
403
403
|
: false;
|
|
404
404
|
const resolvedCoreVersion = getResolvedPhotonCoreVersion();
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
405
|
+
// Compare versions tolerantly: "2.17.6" matches "^2.17.6" and vice versa
|
|
406
|
+
// This prevents unnecessary cache clears when createRequire fallback returns a range
|
|
407
|
+
const storedVersion = metadata?.photonCoreVersion || '';
|
|
408
|
+
const coreVersionChanged = storedVersion !== resolvedCoreVersion &&
|
|
409
|
+
storedVersion.replace(/^[\^~]/, '') !== resolvedCoreVersion.replace(/^[\^~]/, '');
|
|
410
|
+
// Only clear dependency cache when deps or core version actually changed.
|
|
411
|
+
// Source-only changes just need a build cache clear (recompile is fast).
|
|
412
|
+
const needsDepClear = Boolean(metadata && (!depsMatch || coreVersionChanged));
|
|
413
|
+
const needsBuildClear = Boolean(metadata && !hashMatches);
|
|
414
|
+
if (needsDepClear) {
|
|
410
415
|
if (coreVersionChanged) {
|
|
411
416
|
this.log(`🔄 photon-core version changed (${metadata?.photonCoreVersion} → ${resolvedCoreVersion}), clearing cache for ${mcpName}`);
|
|
412
417
|
}
|
|
413
418
|
else {
|
|
414
|
-
this.log(`🔄 Dependencies changed for ${mcpName}
|
|
415
|
-
dependencyCache: depDir,
|
|
416
|
-
buildCache: buildDir,
|
|
417
|
-
});
|
|
419
|
+
this.log(`🔄 Dependencies changed for ${mcpName}, reinstalling`);
|
|
418
420
|
}
|
|
419
421
|
await this.clearAllCaches(cacheKey);
|
|
420
422
|
}
|
|
423
|
+
else if (needsBuildClear) {
|
|
424
|
+
await this.clearBuildCache(cacheKey);
|
|
425
|
+
}
|
|
421
426
|
let nodeModules = null;
|
|
422
427
|
if (dependencies.length > 0) {
|
|
423
428
|
nodeModules = await this.dependencyManager.ensureDependencies(cacheKey, dependencies);
|
|
@@ -456,24 +461,39 @@ export class PhotonLoader {
|
|
|
456
461
|
const message = error instanceof Error ? error.message : String(error);
|
|
457
462
|
return (message.includes('Cannot find package') ||
|
|
458
463
|
message.includes('ERR_MODULE_NOT_FOUND') ||
|
|
459
|
-
message.includes('Cannot find module')
|
|
464
|
+
message.includes('Cannot find module') ||
|
|
465
|
+
message.includes('require is not defined'));
|
|
460
466
|
}
|
|
461
467
|
static parseDependenciesFromSource(source) {
|
|
462
468
|
const deps = [];
|
|
469
|
+
// Only match @dependencies inside JSDoc blocks (/** ... */)
|
|
470
|
+
const jsdocBlocks = source.match(/\/\*\*[\s\S]*?\*\//g) || [];
|
|
471
|
+
const jsdocText = jsdocBlocks.join('\n');
|
|
463
472
|
const regex = /@dependencies\s+([^\r\n]+)/g;
|
|
464
473
|
let match;
|
|
465
|
-
while ((match = regex.exec(
|
|
474
|
+
while ((match = regex.exec(jsdocText)) !== null) {
|
|
466
475
|
const entries = match[1]
|
|
476
|
+
.replace(/\*\/$/, '') // strip trailing */ if on same line
|
|
467
477
|
.split(',')
|
|
468
478
|
.map((entry) => entry.trim())
|
|
469
479
|
.filter(Boolean);
|
|
470
480
|
for (const entry of entries) {
|
|
471
481
|
const atIndex = entry.lastIndexOf('@');
|
|
482
|
+
let name;
|
|
483
|
+
let version;
|
|
472
484
|
if (atIndex <= 0) {
|
|
485
|
+
// No version specified (e.g., "sharp") — default to latest
|
|
486
|
+
name = entry.trim();
|
|
487
|
+
version = '*';
|
|
488
|
+
}
|
|
489
|
+
else {
|
|
490
|
+
name = entry.slice(0, atIndex).trim();
|
|
491
|
+
version = entry.slice(atIndex + 1).trim();
|
|
492
|
+
}
|
|
493
|
+
// Validate: npm package names are lowercase, may have @scope/, no spaces
|
|
494
|
+
if (name.includes(' ') || !/^(@[a-z0-9-]+\/)?[a-z0-9._-]+$/.test(name)) {
|
|
473
495
|
continue;
|
|
474
496
|
}
|
|
475
|
-
const name = entry.slice(0, atIndex).trim();
|
|
476
|
-
let version = entry.slice(atIndex + 1).trim();
|
|
477
497
|
// Trailing ? marks the dependency as optional (e.g. sharp@^0.33.0?)
|
|
478
498
|
const optional = version.endsWith('?');
|
|
479
499
|
if (optional) {
|
|
@@ -608,8 +628,9 @@ export class PhotonLoader {
|
|
|
608
628
|
this.logger.warn(`⚠️ ${name} loaded with configuration warnings:`);
|
|
609
629
|
this.logger.warn(String(configError));
|
|
610
630
|
}
|
|
611
|
-
// Set photon name for event source identification
|
|
631
|
+
// Set photon name and namespace for event source identification and data paths
|
|
612
632
|
instance._photonName = name;
|
|
633
|
+
instance._photonNamespace = this.resolveNamespace(absolutePath);
|
|
613
634
|
// Inject instance name for named instances (runtime concept, not code)
|
|
614
635
|
instance.instanceName = options?.instanceName ?? '';
|
|
615
636
|
// Inject file path for storage()/assets() resolution
|
|
@@ -701,11 +722,12 @@ export class PhotonLoader {
|
|
|
701
722
|
};
|
|
702
723
|
}
|
|
703
724
|
if (caps.has('memory')) {
|
|
704
|
-
// Inject lazy memory provider
|
|
725
|
+
// Inject lazy memory provider — capture baseDir from loader context
|
|
726
|
+
const memoryBaseDir = this.baseDir;
|
|
705
727
|
Object.defineProperty(instance, 'memory', {
|
|
706
728
|
get() {
|
|
707
729
|
if (!this._memory) {
|
|
708
|
-
this._memory = new MemoryProvider(name, this._sessionId);
|
|
730
|
+
this._memory = new MemoryProvider(name, this._sessionId, this._photonNamespace, memoryBaseDir);
|
|
709
731
|
}
|
|
710
732
|
return this._memory;
|
|
711
733
|
},
|
|
@@ -903,6 +925,42 @@ export class PhotonLoader {
|
|
|
903
925
|
}
|
|
904
926
|
this.log(`🔌 Injected channel event infrastructure into ${name}`);
|
|
905
927
|
}
|
|
928
|
+
// Inject this.channel() for channel notifications — works for both Photon
|
|
929
|
+
// subclasses and plain classes. Emits on '{photonName}:channel-push' daemon
|
|
930
|
+
// channel which the MCP server intercepts and translates to the client's
|
|
931
|
+
// notification method (e.g. notifications/claude/channel).
|
|
932
|
+
//
|
|
933
|
+
// this.channel(content, meta) — send a message to the client
|
|
934
|
+
// this.channel.respond(id, behavior) — respond to permission requests
|
|
935
|
+
// this.channel.onPermission(handler) — register permission request handler
|
|
936
|
+
if (typeof instance.emit === 'function') {
|
|
937
|
+
const emitFn = instance.emit.bind(instance);
|
|
938
|
+
// Permission handler stored locally — wired by server after load
|
|
939
|
+
let permissionHandler;
|
|
940
|
+
const channelFn = Object.assign((content, meta) => {
|
|
941
|
+
emitFn({
|
|
942
|
+
channel: `${name}:channel-push`,
|
|
943
|
+
event: 'channel',
|
|
944
|
+
data: { content, meta },
|
|
945
|
+
});
|
|
946
|
+
}, {
|
|
947
|
+
respond: (requestId, behavior) => {
|
|
948
|
+
emitFn({
|
|
949
|
+
channel: `${name}:channel-permission-response`,
|
|
950
|
+
event: 'permission-response',
|
|
951
|
+
data: { request_id: requestId, behavior },
|
|
952
|
+
});
|
|
953
|
+
},
|
|
954
|
+
onPermission: (handler) => {
|
|
955
|
+
permissionHandler = handler;
|
|
956
|
+
},
|
|
957
|
+
// Internal: called by the server when a permission request arrives
|
|
958
|
+
_dispatchPermission: (request) => {
|
|
959
|
+
permissionHandler?.(request);
|
|
960
|
+
},
|
|
961
|
+
});
|
|
962
|
+
instance.channel = channelFn;
|
|
963
|
+
}
|
|
906
964
|
// Check @cli dependencies (required system CLI tools)
|
|
907
965
|
if (tsContent) {
|
|
908
966
|
await this.checkCLIDependencies(tsContent, name);
|
|
@@ -1036,6 +1094,7 @@ export class PhotonLoader {
|
|
|
1036
1094
|
instance._photonConfigError = configError;
|
|
1037
1095
|
}
|
|
1038
1096
|
instance._photonName = name;
|
|
1097
|
+
instance._photonNamespace = this.resolveNamespace(absolutePath);
|
|
1039
1098
|
instance.instanceName = options?.instanceName ?? '';
|
|
1040
1099
|
// Inject file path for storage()/assets() resolution.
|
|
1041
1100
|
// For preloaded modules (compiled binaries), remap to ~/.photon/ so storage()
|
|
@@ -1115,10 +1174,11 @@ export class PhotonLoader {
|
|
|
1115
1174
|
};
|
|
1116
1175
|
}
|
|
1117
1176
|
if (caps.has('memory')) {
|
|
1177
|
+
const memoryBaseDir = this.baseDir;
|
|
1118
1178
|
Object.defineProperty(instance, 'memory', {
|
|
1119
1179
|
get() {
|
|
1120
1180
|
if (!this._memory) {
|
|
1121
|
-
this._memory = new MemoryProvider(name, this._sessionId);
|
|
1181
|
+
this._memory = new MemoryProvider(name, this._sessionId, this._photonNamespace, memoryBaseDir);
|
|
1122
1182
|
}
|
|
1123
1183
|
return this._memory;
|
|
1124
1184
|
},
|
|
@@ -1944,7 +2004,7 @@ export class PhotonLoader {
|
|
|
1944
2004
|
}
|
|
1945
2005
|
// If configured but failed, provide more specific error
|
|
1946
2006
|
throw new Error(`MCP "${dep.name}" is configured but failed to connect: ${errorMsg}\n` +
|
|
1947
|
-
`Check your
|
|
2007
|
+
`Check your config.json configuration and ensure:\n` +
|
|
1948
2008
|
` • The command/URL is correct\n` +
|
|
1949
2009
|
` • Required environment variables are set\n` +
|
|
1950
2010
|
` • The MCP server is accessible`);
|
|
@@ -2989,12 +3049,19 @@ Run: photon mcp ${mcpName} --config
|
|
|
2989
3049
|
return; // No emit function, can't wrap methods
|
|
2990
3050
|
}
|
|
2991
3051
|
// Get all public method names from the instance
|
|
3052
|
+
// Skip runtime-injected methods (emit, render, push, ask) — these are
|
|
3053
|
+
// capability methods injected by the loader, not user-defined tools
|
|
3054
|
+
const RUNTIME_METHODS = new Set(['emit', 'render', 'channel', 'ask', 'call']);
|
|
2992
3055
|
const proto = Object.getPrototypeOf(instance);
|
|
2993
3056
|
const methodNames = Object.getOwnPropertyNames(proto).filter((name) => {
|
|
2994
3057
|
// Skip constructor and private/protected methods
|
|
2995
3058
|
if (name === 'constructor' || name.startsWith('_')) {
|
|
2996
3059
|
return false;
|
|
2997
3060
|
}
|
|
3061
|
+
// Skip runtime-injected capability methods
|
|
3062
|
+
if (RUNTIME_METHODS.has(name)) {
|
|
3063
|
+
return false;
|
|
3064
|
+
}
|
|
2998
3065
|
const descriptor = Object.getOwnPropertyDescriptor(proto, name);
|
|
2999
3066
|
return descriptor && typeof descriptor.value === 'function';
|
|
3000
3067
|
});
|
|
@@ -3210,6 +3277,25 @@ Run: photon mcp ${mcpName} --config
|
|
|
3210
3277
|
check.on('error', () => resolve(false));
|
|
3211
3278
|
});
|
|
3212
3279
|
}
|
|
3280
|
+
/**
|
|
3281
|
+
* Resolve the namespace for a photon based on its file path.
|
|
3282
|
+
* Extracts the directory name between baseDir and the photon file.
|
|
3283
|
+
*
|
|
3284
|
+
* Examples:
|
|
3285
|
+
* ~/.photon/portel-dev/todo.photon.ts → 'portel-dev'
|
|
3286
|
+
* ~/.photon/local/todo.photon.ts → 'local'
|
|
3287
|
+
* ~/.photon/todo.photon.ts → detected from git or 'local'
|
|
3288
|
+
*/
|
|
3289
|
+
resolveNamespace(absolutePath) {
|
|
3290
|
+
const rel = path.relative(this.baseDir, absolutePath);
|
|
3291
|
+
const parts = rel.split(path.sep);
|
|
3292
|
+
// If file is in a subdirectory (namespace/photon.ts), use that as namespace
|
|
3293
|
+
if (parts.length >= 2) {
|
|
3294
|
+
return parts[0];
|
|
3295
|
+
}
|
|
3296
|
+
// Flat file at root — detect from git remote or default to 'local'
|
|
3297
|
+
return detectNamespace(this.baseDir);
|
|
3298
|
+
}
|
|
3213
3299
|
/**
|
|
3214
3300
|
* Discover and extract assets from a Photon file
|
|
3215
3301
|
* Uses shared discoverAssets from photon-core for core logic,
|