refactor(daemon): load sense/workflow bundles from dist/ directory
Workspace build output moved from senses/<name>/index.js and workflows/<name>/dist/index.js to dist/senses/<name>/index.js and dist/workflows/<name>/index.js. Refs #274 小橘 <xiaoju@shazhou.work>
This commit is contained in:
@@ -83,7 +83,7 @@ async function initSense(
|
||||
): Promise<SenseRuntime> {
|
||||
const dbPath = join(nerveRoot, "data", "senses", `${senseName}.db`);
|
||||
const migrationsDir = join(nerveRoot, "senses", senseName, "migrations");
|
||||
const senseIndexPath = resolve(join(nerveRoot, "senses", senseName, "index.js"));
|
||||
const senseIndexPath = resolve(join(nerveRoot, "dist", "senses", senseName, "index.js"));
|
||||
|
||||
const dbResult = openSenseDb(dbPath, migrationsDir, retention);
|
||||
if (!dbResult.ok) {
|
||||
|
||||
@@ -60,7 +60,7 @@ export type WorkflowManager = {
|
||||
updateConfig: (newConfig: NerveConfig) => void;
|
||||
/**
|
||||
* Drain active threads for a workflow, then respawn its worker process.
|
||||
* Used for hot reload when bundled workflow output under workflows/<name>/dist/ changes.
|
||||
* Used for hot reload when bundled workflow output under dist/workflows/<name>/ changes.
|
||||
* Waits up to `drainTimeoutMs` for threads to complete before force-killing.
|
||||
*/
|
||||
drainAndRespawn: (workflowName: string, drainTimeoutMs?: number) => Promise<void>;
|
||||
|
||||
@@ -303,7 +303,7 @@ async function loadWorkflowDefinition(
|
||||
nerveRoot: string,
|
||||
workflowName: string,
|
||||
): Promise<WorkflowDefinition<RoleMeta>> {
|
||||
const indexPath = resolve(join(nerveRoot, "workflows", workflowName, "dist", "index.js"));
|
||||
const indexPath = resolve(join(nerveRoot, "dist", "workflows", workflowName, "index.js"));
|
||||
if (!existsSync(indexPath)) {
|
||||
throw new Error(
|
||||
`Workflow definition not found for "${workflowName}". Expected:\n ${indexPath}`,
|
||||
|
||||
Reference in New Issue
Block a user