@powerhousedao/ph-cli 6.4.0-next.1 → 6.4.0-next.3
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 +6 -5
- package/dist/{build-C490lBnu.mjs → build-B-rPwjM8.mjs} +7 -7
- package/dist/{build-C490lBnu.mjs.map → build-B-rPwjM8.mjs.map} +1 -1
- package/dist/build-DuwAPWMY.mjs +4 -0
- package/dist/{check-DIK1LTss.mjs → check-B7C3Vi_b.mjs} +4 -4
- package/dist/{check-DIK1LTss.mjs.map → check-B7C3Vi_b.mjs.map} +1 -1
- package/dist/{check-D84ta1Dh.mjs → check-DM7UdFTK.mjs} +4 -4
- package/dist/{check-D84ta1Dh.mjs.map → check-DM7UdFTK.mjs.map} +1 -1
- package/dist/{check-F3nwJiG-.mjs → check-DeUTd514.mjs} +3 -3
- package/dist/{cli-connect-override-BMU4Qldg.mjs → cli-connect-override-Bx_g3-ZE.mjs} +4 -4
- package/dist/{cli-connect-override-BMU4Qldg.mjs.map → cli-connect-override-Bx_g3-ZE.mjs.map} +1 -1
- package/dist/cli.mjs +8 -8
- package/dist/cli.mjs.map +1 -1
- package/dist/{compound-BWLJ0KBw-8hKyrfjG.mjs → compound-Q9sZSEZF-DQvtoigb.mjs} +6 -6
- package/dist/compound-Q9sZSEZF-DQvtoigb.mjs.map +1 -0
- package/dist/{connect-build-DW1fFVbU.mjs → connect-build-CaTxdYcc.mjs} +5 -5
- package/dist/{connect-build-DW1fFVbU.mjs.map → connect-build-CaTxdYcc.mjs.map} +1 -1
- package/dist/{connect-config-DVubBBLb.mjs → connect-config-A-U83U8U.mjs} +4 -4
- package/dist/{connect-config-DVubBBLb.mjs.map → connect-config-A-U83U8U.mjs.map} +1 -1
- package/dist/{connect-studio-CQC-LDSg.mjs → connect-studio-B2gugCJU.mjs} +4 -4
- package/dist/{connect-studio-CQC-LDSg.mjs.map → connect-studio-B2gugCJU.mjs.map} +1 -1
- package/dist/definitions-worker.mjs +1 -1
- package/dist/dev-host-RhWeATKB.mjs +19 -0
- package/dist/dev-host-RhWeATKB.mjs.map +1 -0
- package/dist/{dist-BFMRL5C0.mjs → dist-D_UjZsgt.mjs} +4 -4
- package/dist/dist-D_UjZsgt.mjs.map +1 -0
- package/dist/{explain-YPD3n6t8.mjs → explain-DbbHpa61.mjs} +5 -5
- package/dist/{explain-YPD3n6t8.mjs.map → explain-DbbHpa61.mjs.map} +1 -1
- package/dist/{export-DjQL6zkr.mjs → export-FduYVQEM.mjs} +4 -4
- package/dist/{export-DjQL6zkr.mjs.map → export-FduYVQEM.mjs.map} +1 -1
- package/dist/{files-D6_euBBn.mjs → files-DEHg350R.mjs} +4 -4
- package/dist/{files-D6_euBBn.mjs.map → files-DEHg350R.mjs.map} +1 -1
- package/dist/{generate-all-BLot_H9Z.mjs → generate-all-BE8UmbJv.mjs} +6 -21
- package/dist/generate-all-BE8UmbJv.mjs.map +1 -0
- package/dist/{generate-app-hm6CJ_4O.mjs → generate-app-C7n0j8Ak.mjs} +5 -18
- package/dist/generate-app-C7n0j8Ak.mjs.map +1 -0
- package/dist/{generate-document-model-BiD6ovXc.mjs → generate-document-model-DSYPTMZg.mjs} +9 -31
- package/dist/generate-document-model-DSYPTMZg.mjs.map +1 -0
- package/dist/{generate-editor-DBj_Pxwa.mjs → generate-editor-DKuRUeIt.mjs} +5 -18
- package/dist/generate-editor-DKuRUeIt.mjs.map +1 -0
- package/dist/{generate-processor-BVjOsfjJ.mjs → generate-processor-CwJvJDpd.mjs} +5 -18
- package/dist/generate-processor-CwJvJDpd.mjs.map +1 -0
- package/dist/{generate-subgraph-DJZCr0Tk.mjs → generate-subgraph-EQ2ZjMp9.mjs} +6 -25
- package/dist/generate-subgraph-EQ2ZjMp9.mjs.map +1 -0
- package/dist/{get-version-CcYVboCW.mjs → get-version-7oKMD8Gt.mjs} +4 -4
- package/dist/{get-version-CcYVboCW.mjs.map → get-version-7oKMD8Gt.mjs.map} +1 -1
- package/dist/{index-D3H9pQ8u.d.mts → index-Bs1PfL3W.d.mts} +17 -4
- package/dist/index-Bs1PfL3W.d.mts.map +1 -0
- package/dist/{mcp-B3l1mtBq.mjs → mcp-CcZT9zT9.mjs} +8 -8
- package/dist/mcp-CcZT9zT9.mjs.map +1 -0
- package/dist/{migrate-CzcBEypc.mjs → migrate-Ddr7YAtM.mjs} +4 -4
- package/dist/{migrate-CzcBEypc.mjs.map → migrate-Ddr7YAtM.mjs.map} +1 -1
- package/dist/{migrate-document-models-D0HSo4WN.mjs → migrate-document-models-X_mVTljj.mjs} +4 -4
- package/dist/{migrate-document-models-D0HSo4WN.mjs.map → migrate-document-models-X_mVTljj.mjs.map} +1 -1
- package/dist/migrate-subgraphs-DEqWkLoh.mjs +4 -0
- package/dist/{migrate-subgraphs-CfSMlcJD.mjs → migrate-subgraphs-Ffwwm7Oy.mjs} +5 -5
- package/dist/{migrate-subgraphs-CfSMlcJD.mjs.map → migrate-subgraphs-Ffwwm7Oy.mjs.map} +1 -1
- package/dist/{ph-cli-commands-CQXdWQ74.mjs → ph-cli-commands-D4Z6YSwd.mjs} +39 -104
- package/dist/ph-cli-commands-D4Z6YSwd.mjs.map +1 -0
- package/dist/ph-cli-commands-p9cO6MsE.mjs +4 -0
- package/dist/{run-sugar-hGKprsKz.mjs → run-sugar-CkuGJuPg.mjs} +16 -8
- package/dist/run-sugar-CkuGJuPg.mjs.map +1 -0
- package/dist/{run-sugar-BfnRBv7h.mjs → run-sugar-Dd_Mu058.mjs} +3 -3
- package/dist/runners/connect.d.mts +1 -1
- package/dist/runners/connect.mjs +2 -2
- package/dist/runners/switchboard.d.mts +1 -1
- package/dist/runners/switchboard.mjs +3 -3
- package/dist/{sugar-checks-CTCsK5DJ.mjs → sugar-checks-CAtgUIem.mjs} +16 -15
- package/dist/sugar-checks-CAtgUIem.mjs.map +1 -0
- package/dist/{verify-NK6a_7j8.mjs → verify-DXrs0JUp.mjs} +5 -5
- package/dist/{verify-NK6a_7j8.mjs.map → verify-DXrs0JUp.mjs.map} +1 -1
- package/dist/{vetra-gateway-BxcduYAI.mjs → vetra-gateway-BHuz7pvS.mjs} +5 -5
- package/dist/{vetra-gateway-BxcduYAI.mjs.map → vetra-gateway-BHuz7pvS.mjs.map} +1 -1
- package/dist/vetra-gateway-ag33E_Ta.mjs +4 -0
- package/dist/{vetra-host-BrLdIMRP.mjs → vetra-host-CYdbd3J3.mjs} +28 -11
- package/dist/vetra-host-CYdbd3J3.mjs.map +1 -0
- package/dist/{vetra-launcher-Dokr1aDK.mjs → vetra-launcher-B5L3yXPo.mjs} +16 -13
- package/dist/vetra-launcher-B5L3yXPo.mjs.map +1 -0
- package/dist/vetra-launcher-BUO9e74r.mjs +4 -0
- package/dist/{vetra-instance-CPNIsaxh.mjs → vetra-runtime-Bk6CW-BE.mjs} +7 -25
- package/dist/vetra-runtime-Bk6CW-BE.mjs.map +1 -0
- package/dist/warn-subgraph-type-conflicts-BZ4NwLx5.mjs +131 -0
- package/dist/warn-subgraph-type-conflicts-BZ4NwLx5.mjs.map +1 -0
- package/package.json +15 -16
- package/dist/build-DblrRe4z.mjs +0 -4
- package/dist/compound-BWLJ0KBw-8hKyrfjG.mjs.map +0 -1
- package/dist/dist-BFMRL5C0.mjs.map +0 -1
- package/dist/generate-all-BLot_H9Z.mjs.map +0 -1
- package/dist/generate-app-hm6CJ_4O.mjs.map +0 -1
- package/dist/generate-document-model-BiD6ovXc.mjs.map +0 -1
- package/dist/generate-editor-DBj_Pxwa.mjs.map +0 -1
- package/dist/generate-processor-BVjOsfjJ.mjs.map +0 -1
- package/dist/generate-subgraph-DJZCr0Tk.mjs.map +0 -1
- package/dist/index-D3H9pQ8u.d.mts.map +0 -1
- package/dist/mcp-B3l1mtBq.mjs.map +0 -1
- package/dist/migrate-subgraphs-Hc5w9Mpk.mjs +0 -4
- package/dist/ph-cli-commands-CQXdWQ74.mjs.map +0 -1
- package/dist/ph-cli-commands-YE0ciOSX.mjs +0 -4
- package/dist/run-sugar-hGKprsKz.mjs.map +0 -1
- package/dist/sugar-checks-CTCsK5DJ.mjs.map +0 -1
- package/dist/vetra-gateway-Bpe50oGk.mjs +0 -4
- package/dist/vetra-host-BrLdIMRP.mjs.map +0 -1
- package/dist/vetra-instance-CPNIsaxh.mjs.map +0 -1
- package/dist/vetra-launcher-BtDWQBuh.mjs +0 -4
- package/dist/vetra-launcher-Dokr1aDK.mjs.map +0 -1
- package/dist/warn-subgraph-type-conflicts-BOHBmThq.mjs +0 -19
- package/dist/warn-subgraph-type-conflicts-BOHBmThq.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dist-BFMRL5C0.mjs","sources":["../../../packages/host-core/dist/index.mjs"],"sourcesContent":["import { $ as computeOutputsHash, $n as runProvideHook, $t as resolveHostPlugins, A as STOP_RUN_TIMEOUT_MS, An as placementKeyIssues, At as resolveHostOutputs, B as probeRun, Bn as runnerKindSchema, Bt as checkTokenSites, C as applyChildWrapper, Cn as emitHostJsonSchema, Ct as packageBuildRefusal, D as COMPOUND_MEMBER_ENV, Dn as makeHostSchemas, Dt as TokenResolutionError, E as spawnHost, En as hostNameSchema, Et as validateHost, F as stopChannelPath, Fn as reactorProtocolSchema, Ft as BUILTIN_ENV_NAMES, G as writeRunRecord, Gn as normalizePluginEntries, Gt as schemaAtPath, H as readRunRecord, Hn as entryActiveForVerb, Ht as outputRefsOf, I as stopRun, In as reactorSchema, It as isBuiltinEnvName, J as checkRunnerArgv, Jn as pluginEntrySchema, Jt as formatPath, K as runRecordMemberSchema, Kn as normalizePluginEntry, Kt as collectTokenSites, L as clearRunRecord, Ln as refineConnectReactor, Lt as substituteBuiltinEnv, M as installStopChannel, Mn as reactorBackendKindSchema, Mt as PlanError, N as listenForStop, Nn as reactorBackendSchema, Nt as memberForRef, O as takeCompoundMember, On as memberProcessSchema, Ot as describeMapElements, P as requestStop, Pn as reactorHostSchema, Pt as planCompound, Q as OUTPUTS_FILE, Qn as runObserveHookSequential, Qt as findDeadConnectConfig, R as isPidAlive, Rn as refineStartOrder, Rt as findRemovedForms, S as resolveUserDataPlaceholders, Sn as defineHostSchemas, Sr as tokenable, St as listVerbs, T as SpawnHostError, Tn as genericCompoundHostSchema, Tt as validateDeclaredHost, U as recordKeyOf, Un as hostTypeSatisfies, Ut as outputSitesOf, V as readProjectName, Vn as PluginError, Vt as envSitesOf, W as runRecordKey, Wn as mergeContributions, Wt as refKey, X as splitCompoundArgv, Xn as resolveOrder, Xt as renderTokens, Y as isRunnerArgsSchema, Yn as registerHostType, Yt as isPlainObject, Z as splitRunArgv, Zn as runObserveHook, Zt as unwrapEscapes, _ as processResolveEnv, _n as compoundHostSchema, _r as mapTokenSchema, _t as getVerb, a as memberProcessOf, an as locateHost, ar as drivesSchema, at as loadHost, b as runnerOutputsSchema, bn as declaredGenericCompoundHostSchema, br as tokenKeyOf, bt as kindShapeIssues, c as prepareMember, cn as CONNECT_PRIMARY_MESSAGE, cr as TOKEN_KEYS, ct as probeHostsFolder, d as takesCspRegistrySync, dn as HOST_NAME_PATTERN, dr as envTokenable, dt as stripComments, en as resolvePluginContributions, er as runTransformHook, et as describeHostOutputs, f as runnerHandleSchema, fn as HOST_REF_MESSAGE, fr as findToken, ft as withoutHostsMessage, g as loadProducers, gn as childrenSchema, gr as keyTokenSchema, gt as STORE_VERBS, h as OUTPUT_DATA_DIRS_ENV, hn as childWrapperSchema, hr as itemTokenSchema, ht as RunnerError, i as memberCycle, in as hostFileLabel, ir as driveDeclarationSchema, it as lintOutputsFile, j as askToStop, jn as profileSchema, jt as unsetEnvMessage, k as STOP_ON_STDIN_ENV, kn as originOrUrlSchema, kt as emptyMaps, l as runCompound, ln as HOST_NAME_MAX_LENGTH, lr as concatTokenSchema, lt as readOutputsFileHash, m as compoundOutputSource, mn as PACKAGE_NAME_PATTERN, mr as isToken, mt as ONE_SHOT_VERBS, n as compoundStartVerb, nn as findHostPackage, nr as defaultConnectComposition, nt as lintHostImportGraph, o as memberVerbOf, on as parseHostRef, or as projectDriveIdWith, ot as loadHostFresh, p as toStartedHandle, pn as HOST_REF_PATTERN, pr as forbidRef, pt as CONNECT_RUNNER, q as runRecordSchema, qn as pluginEntryObjectSchema, qt as describeToken, r as holdStopRequests, rn as formatHostRef, rr as buildDriveDeclarationSchema, rt as lintHostImports, s as planForeground, sn as resolvePackageRoot, sr as TOKEN_ESCAPE_KEY, st as moduleRootOf, t as STOP_STREAM_LIMIT_MS, tn as HostLoadError, tr as CONNECT_PLUGIN_OWNED_SLICES, tt as findNonStaticValue, u as stopStreamOf, un as HOST_NAME_MESSAGE, ur as envTokenSchema, ut as scanHostImports, v as producerOutputsSchemas, vn as compoundWiringSchema, vr as outputTokenSchema, vt as hostSchemaIssues, w as SPAWN_STOPPING_NOTE, wn as emittedHostSchemas, wt as resolveRunnerModule, x as defaultUserDataDir, xn as declaredHostSchemas, xr as tokenSchema, xt as knownVerbIssues, y as runRecordOutputSource, yn as connectReactorIssues, yr as ref, yt as isSchemaLike, z as listRunRecords, zn as runnerBaseSchema, zt as checkOutputPaths } from \"./compound-BWLJ0KBw.mjs\";\nimport { killTree } from \"./kill-tree.mjs\";\nimport crypto from \"node:crypto\";\nimport path from \"node:path\";\nimport { z } from \"zod\";\nimport { driveAddressMessage, switchboardOfDrive, switchboardOfDrive as switchboardOfDrive$1 } from \"@powerhousedao/shared/host-tokens\";\nimport { ORIGIN_PLACEHOLDER, SWITCHBOARD_PROXY_PATHS, isHtmlNavigation, isOriginPlaceholderUrl, isSwitchboardProxyPath, resolveOriginPlaceholders, toOriginPlaceholder, withOriginPlaceholders } from \"@powerhousedao/shared/connect/origin-placeholder\";\nimport { DEFAULT_CONNECT_STUDIO_PORT, DEFAULT_SWITCHBOARD_PORT } from \"@powerhousedao/shared/clis/constants\";\nimport { DRIVE_ICON_MAX_BYTES, resolveImageRef } from \"@powerhousedao/shared/connect/image-ref\";\n//#region src/check-host.ts\n/** The `ph run` pipeline up to the verb, collecting every issue; starts\n* nothing. `name` is a ref: a project host, or `<package>/<host>`. */\nasync function checkHost(name, options) {\n\tconst result = {\n\t\tissues: [],\n\t\twarnings: [],\n\t\tdeferred: []\n\t};\n\tlet file = `hosts/${name}/host.js`;\n\tconst verb = options.verb ?? \"run\";\n\tlet host;\n\tlet runner;\n\tlet hostPackage;\n\ttry {\n\t\tconst loaded = await loadHost(options.projectRoot, name);\n\t\thost = loaded.host;\n\t\thostPackage = loaded.package;\n\t\tfile = hostFileLabel(loaded.name, hostPackage);\n\t\trunner = await resolveRunnerModule(moduleRootOf(options.projectRoot, loaded), host.runner.module);\n\t} catch (error) {\n\t\tissuer(result, file)(\"load\", \"\", error);\n\t\treturn result;\n\t}\n\tconst specifier = host.runner.module;\n\tif (hostPackage && ONE_SHOT_VERBS.has(verb)) {\n\t\tissuer(result, file)(\"declared\", packageBuildRefusal(name, hostPackage, verb));\n\t\treturn result;\n\t}\n\tif (runner.kind === \"compound\") {\n\t\tawait checkCompound(result, options, {\n\t\t\tfile,\n\t\t\thost,\n\t\t\trunner,\n\t\t\tspecifier,\n\t\t\tverb,\n\t\t\thostPackage\n\t\t});\n\t\treturn result;\n\t}\n\tconst refs = outputRefsOf(host);\n\tconst producers = await loadProducers(options.projectRoot, refs, hostPackage);\n\tawait checkSubject(result, options, {\n\t\tfile,\n\t\thost,\n\t\trunner,\n\t\tspecifier,\n\t\tverb,\n\t\thostPackage,\n\t\toutputsSchemaOf: producerOutputsSchemas(producers),\n\t\tself: \"outputs\"\n\t});\n\treturn result;\n}\n/** Declared validation; returns whether its tokens and its shape passed. */\nfunction checkDeclared(result, subject, outputsSchemaOf) {\n\tconst issue = issuer(result, subject.file);\n\tconst { host, runner, specifier } = subject;\n\ttry {\n\t\tgetVerb(runner, specifier, subject.verb);\n\t} catch (error) {\n\t\tissue(\"declared\", \"\", error);\n\t}\n\tconst tokenIssues = [\n\t\t...findRemovedForms(host),\n\t\t...checkTokenSites(host),\n\t\t...outputsSchemaOf ? checkOutputPaths(host, outputsSchemaOf) : []\n\t];\n\tfor (const i of tokenIssues) issue(\"declared\", i);\n\tconst shapeIssues = runner.declaredHostSchema ? schemaIssuesOf(runner, runner.declaredHostSchema, specifier, host, true) : kindShapeIssues(runner.kind, specifier, host);\n\tfor (const i of shapeIssues) issue(\"declared\", i);\n\treturn {\n\t\ttokens: tokenIssues.length === 0,\n\t\tshape: shapeIssues.length === 0\n\t};\n}\nfunction schemaIssuesOf(runner, schema, specifier, host, allowTokens) {\n\tconst checked = hostSchemaIssues(runner, schema, specifier, host, { tokens: allowTokens ? \"allow\" : \"forbid\" });\n\treturn [...checked.issues, ...checked.schemaIssues ?? []];\n}\nasync function checkSubject(result, options, subject) {\n\tconst issue = issuer(result, subject.file);\n\tconst { runner, specifier, file } = subject;\n\tconst declared = checkDeclared(result, subject, subject.outputsSchemaOf);\n\tconst resolveEnv = processResolveEnv(options.projectRoot, options.env, subject.hostPackage);\n\tconst patch = subject.patch ?? ((host) => host);\n\tif (ONE_SHOT_VERBS.has(subject.verb)) {\n\t\tif (!declared.tokens || !declared.shape) return;\n\t\tconst host = patch(substituteBuiltinEnv(subject.host, resolveEnv.builtins ?? {}));\n\t\tconst schema = runner.declaredHostSchema ?? runner.hostSchema;\n\t\tfor (const i of schemaIssuesOf(runner, schema, specifier, host, true)) issue(\"resolved\", i);\n\t\treturn;\n\t}\n\tconst unset = envSitesOf(subject.host).filter((site) => !site.optional && !isBuiltinEnvName(site.name) && options.env[site.name] === void 0);\n\tfor (const site of unset) issue(\"resolve\", {\n\t\tpath: site.path,\n\t\tmessage: unsetEnvMessage(site.name)\n\t});\n\tif (!declared.tokens || unset.length > 0) return;\n\tlet resolved;\n\tlet deferred = [];\n\ttry {\n\t\tif (options.outputs) resolved = resolveHostOutputs(subject.host, {\n\t\t\toutputs: options.outputs,\n\t\t\t...resolveEnv\n\t\t});\n\t\telse {\n\t\t\tconst partial = resolveHostOutputs(subject.host, resolveEnv, { deferSelf: subject.self });\n\t\t\tresolved = partial.host;\n\t\t\tdeferred = partial.deferred;\n\t\t}\n\t} catch (error) {\n\t\tif (error instanceof TokenResolutionError && error.detail) issue(\"resolve\", {\n\t\t\tpath: error.detail.path,\n\t\t\tmessage: error.detail.reason\n\t\t});\n\t\telse issue(\"resolve\", \"\", error);\n\t\treturn;\n\t}\n\tresult.deferred.push(...deferred.map((d) => ({\n\t\t...d,\n\t\tfile\n\t})));\n\tif (!declared.shape) return;\n\tconst allow = deferred.length > 0;\n\tconst schema = allow ? runner.declaredHostSchema ?? runner.hostSchema : runner.hostSchema;\n\tconst checked = hostSchemaIssues(runner, schema, specifier, patch(resolved), { tokens: allow ? \"allow\" : \"forbid\" });\n\tconst resolvedIssues = [...checked.issues, ...checked.schemaIssues ?? []];\n\tfor (const i of resolvedIssues) issue(\"resolved\", i);\n\tif (resolvedIssues.length > 0 || !runner.checkBoot) return;\n\ttry {\n\t\tconst boot = await runner.checkBoot(checked.data, {\n\t\t\tprojectRoot: options.projectRoot,\n\t\t\tverb: subject.verb,\n\t\t\tenv: options.env,\n\t\t\tfile\n\t\t});\n\t\tfor (const i of boot) issue(\"boot\", {\n\t\t\t...i,\n\t\t\tpath: i.path ?? \"\"\n\t\t});\n\t} catch (error) {\n\t\tissue(\"boot\", \"\", error);\n\t}\n}\nasync function checkCompound(result, options, subject) {\n\tconst issue = issuer(result, subject.file);\n\tconst { host, runner, specifier } = subject;\n\tconst declared = checkDeclared(result, subject);\n\tif (!declared.tokens || !declared.shape) return;\n\tif (!runner.declaredHostSchema) {\n\t\tconst own = schemaIssuesOf(runner, runner.hostSchema, specifier, host, true);\n\t\tfor (const i of own) issue(\"resolved\", i);\n\t\tif (own.length > 0) return;\n\t}\n\tconst children = isPlainObject(host.children) ? host.children : {};\n\tconst wiring = isPlainObject(host.config) ? host.config : {};\n\tconst verb = compoundStartVerb(subject.verb, host.runner);\n\tconst prepared = [];\n\tfor (const [key, member] of Object.entries(children)) try {\n\t\tprepared.push(await prepareMember(options.projectRoot, key, member, subject.hostPackage));\n\t} catch (error) {\n\t\tissuer(result, `hosts/${member.host}/host.js`)(\"load\", \"\", error);\n\t}\n\ttry {\n\t\tconst cycle = await memberCycle(options.projectRoot, prepared);\n\t\tif (cycle) issue(\"declared\", {\n\t\t\tpath: \"children\",\n\t\t\tmessage: `compound member cycle: ${cycle.join(\" -> \")}.`,\n\t\t\thint: \"A compound cannot run itself, directly or through another compound.\"\n\t\t});\n\t} catch (error) {\n\t\tissue(\"load\", \"children\", error);\n\t}\n\tconst members = Object.entries(children).map(([key, m]) => ({\n\t\tkey,\n\t\thost: m.host\n\t}));\n\tlet foreground;\n\tif (prepared.length === members.length) try {\n\t\tconst plan = planCompound(prepared.map((m) => ({\n\t\t\tkey: m.key,\n\t\t\thost: m.member.host,\n\t\t\trefs: outputSitesOf(m.draft).map(({ ref, path }) => ({\n\t\t\t\tref,\n\t\t\t\tpath\n\t\t\t}))\n\t\t})), wiring.startOrder);\n\t\tconst planned = planForeground(prepared, plan, wiring);\n\t\tfor (const i of planned.issues) issue(\"declared\", i);\n\t\tforeground = planned.foreground;\n\t} catch (error) {\n\t\tissue(\"declared\", \"\", error);\n\t}\n\tresult.warnings.push(...sharedPortWarnings(subject.file, prepared));\n\tconst byKey = new Map(prepared.map((m) => [m.key, m]));\n\tconst outputsSchemaOf = (ref) => {\n\t\tconst target = memberForRef(ref, members);\n\t\tif (\"error\" in target) return { error: target.error };\n\t\tconst producer = byKey.get(target.key);\n\t\treturn producer ? runnerOutputsSchema(producer.runner, producer.specifier, `member \"${target.key}\"`) : { error: `names member \"${target.key}\", which was not prepared.` };\n\t};\n\tfor (const m of prepared) {\n\t\tconst isForeground = m.key === foreground;\n\t\tif (isForeground && ONE_SHOT_VERBS.has(verb)) continue;\n\t\tif (m.hostPackage && ONE_SHOT_VERBS.has(verb)) {\n\t\t\tissue(\"declared\", {\n\t\t\t\t...packageBuildRefusal(m.ref, m.hostPackage, verb),\n\t\t\t\tpath: `children.${m.key}`\n\t\t\t});\n\t\t\tcontinue;\n\t\t}\n\t\tconst csp = wiring.cspRegistrySync === true && takesCspRegistrySync(m);\n\t\tawait checkSubject(result, options, {\n\t\t\tfile: m.file,\n\t\t\thost: m.draft,\n\t\t\trunner: m.runner,\n\t\t\tspecifier: m.specifier,\n\t\t\t...m.hostPackage ? { hostPackage: m.hostPackage } : {},\n\t\t\tverb: isForeground ? m.draft.runner.defaultVerb ?? \"run\" : memberVerbOf(verb, m.draft.runner),\n\t\t\toutputsSchemaOf,\n\t\t\tself: { members },\n\t\t\t...csp ? { patch: (resolved) => ({\n\t\t\t\t...resolved,\n\t\t\t\trunner: {\n\t\t\t\t\t...resolved.runner,\n\t\t\t\t\tcspRegistrySync: true\n\t\t\t\t}\n\t\t\t}) } : {}\n\t\t});\n\t}\n}\nconst SWITCHBOARD_RUNNER = \"@powerhousedao/ph-cli/runners/switchboard\";\n/** The port a member binds: its own literal, else its ph-cli runner's default. */\nfunction boundPortOf(m) {\n\tconst port = m.draft.runner.port;\n\tif (port === void 0) {\n\t\tif (m.specifier === \"@powerhousedao/ph-cli/runners/connect\") return DEFAULT_CONNECT_STUDIO_PORT;\n\t\tif (m.specifier === SWITCHBOARD_RUNNER) return DEFAULT_SWITCHBOARD_PORT;\n\t\treturn;\n\t}\n\treturn typeof port === \"number\" && Number.isInteger(port) && port > 0 ? port : void 0;\n}\n/** Members binding one port: under `ph run` the later one moves or fails. */\nfunction sharedPortWarnings(file, prepared) {\n\tconst owners = /* @__PURE__ */ new Map();\n\tconst warnings = [];\n\tfor (const m of prepared) {\n\t\tconst port = boundPortOf(m);\n\t\tif (port === void 0) continue;\n\t\tconst other = owners.get(port);\n\t\tif (!other) {\n\t\t\towners.set(port, m);\n\t\t\tcontinue;\n\t\t}\n\t\tconst connects = m.specifier === \"@powerhousedao/ph-cli/runners/connect\" && other.specifier === \"@powerhousedao/ph-cli/runners/connect\";\n\t\twarnings.push({\n\t\t\tstage: \"declared\",\n\t\t\tfile,\n\t\t\tpath: `children.${m.key}.runner.port`,\n\t\t\tmessage: connects ? `${other.key} and ${m.key} both use port ${port}. One will move to the next free port and lose its browser data.` : `${other.key} and ${m.key} both use port ${port}. One will move to the next free port or fail to start.`\n\t\t});\n\t}\n\treturn warnings;\n}\nfunction issuer(result, file) {\n\treturn (stage, found, error) => {\n\t\tif (typeof found !== \"string\") {\n\t\t\tconst { path, message, hint } = found;\n\t\t\tresult.issues.push({\n\t\t\t\tstage,\n\t\t\t\tfile,\n\t\t\t\tpath,\n\t\t\t\tmessage,\n\t\t\t\t...hint ? { hint } : {}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst [message, hint] = (error instanceof Error ? error.message : String(error)).split(\"\\n Hint: \");\n\t\tresult.issues.push({\n\t\t\tstage,\n\t\t\tfile,\n\t\t\tpath: found,\n\t\t\tmessage,\n\t\t\t...hint ? { hint } : {}\n\t\t});\n\t};\n}\n//#endregion\n//#region src/host-export-schema.ts\nfunction isRecord$1(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction childFolders$1(host) {\n\tif (!isRecord$1(host) || !isRecord$1(host.children)) return [];\n\treturn Object.entries(host.children).flatMap(([key, child]) => isRecord$1(child) && typeof child.host === \"string\" ? [[key, child.host]] : []);\n}\nconst declaredHostSchema = z.custom().superRefine((host, ctx) => {\n\tconst result = (isRecord$1(host) && \"children\" in host ? declaredHostSchemas.compoundHostSchema : declaredHostSchemas.reactorHostSchema).safeParse(host);\n\tif (result.success) return;\n\tfor (const issue of result.error.issues) ctx.addIssue({\n\t\tcode: \"custom\",\n\t\tmessage: issue.message,\n\t\tpath: issue.path\n\t});\n});\n/** `ph host export`: a declared host plus its members, keyed by folder. */\nconst hostExportSchema = z.strictObject({\n\tformat: z.literal(\"ph-host-export\"),\n\tversion: z.literal(1),\n\tproject: z.strictObject({\n\t\tname: z.string().min(1),\n\t\troot: z.string().min(1)\n\t}),\n\tname: z.string().min(1),\n\thost: declaredHostSchema,\n\tmembers: z.record(z.string(), declaredHostSchema)\n}).superRefine((value, ctx) => {\n\tconst reached = /* @__PURE__ */ new Set();\n\tconst pending = [[[\"host\"], value.host]];\n\tfor (let next = pending.shift(); next; next = pending.shift()) {\n\t\tconst [at, host] = next;\n\t\tfor (const [key, folder] of childFolders$1(host)) {\n\t\t\tif (!(folder in value.members)) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tpath: [\n\t\t\t\t\t\t...at,\n\t\t\t\t\t\t\"children\",\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\"host\"\n\t\t\t\t\t],\n\t\t\t\t\tmessage: `Member folder \"${folder}\" is missing from members.`\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (reached.has(folder)) continue;\n\t\t\treached.add(folder);\n\t\t\tpending.push([[\"members\", folder], value.members[folder]]);\n\t\t}\n\t}\n\tfor (const folder of Object.keys(value.members)) {\n\t\tif (reached.has(folder)) continue;\n\t\tctx.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tpath: [\"members\", folder],\n\t\t\tmessage: `Member \"${folder}\" is not reached from the host's children.`\n\t\t});\n\t}\n});\n//#endregion\n//#region src/host-export.ts\nfunction checkHint(name) {\n\treturn `Run \\`ph host check ${name}\\`.`;\n}\nfunction childFolders(host, name) {\n\tif (!(\"children\" in host)) return [];\n\tconst parsed = declaredHostSchemas.childrenSchema.safeParse(host.children);\n\tif (!parsed.success) throw new HostLoadError(`hosts/${name}/host.js: invalid \\`children\\`:\\n${z.prettifyError(parsed.error)}`, checkHint(name));\n\treturn Object.values(parsed.data).map((child) => child.host);\n}\n/** A host as declared and every member it reaches, raw `loadHost` bodies. */\nasync function exportHost(projectRoot, name) {\n\tconst root = path.resolve(projectRoot);\n\tconst { host } = await loadHost(root, name);\n\tconst members = {};\n\tconst visit = async (folders) => {\n\t\tfor (const folder of folders) {\n\t\t\tif (folder in members) continue;\n\t\t\tconst member = (await loadHost(root, folder)).host;\n\t\t\tmembers[folder] = member;\n\t\t\tawait visit(childFolders(member, folder));\n\t\t}\n\t};\n\tawait visit(childFolders(host, name));\n\tconst envelope = {\n\t\tformat: \"ph-host-export\",\n\t\tversion: 1,\n\t\tproject: {\n\t\t\tname: readProjectName(root),\n\t\t\troot\n\t\t},\n\t\tname,\n\t\thost,\n\t\tmembers\n\t};\n\tconst parsed = hostExportSchema.safeParse(JSON.parse(JSON.stringify(envelope)));\n\tif (!parsed.success) throw new HostLoadError(`hosts/${name}/host.js: the export is not a valid host export:\\n${z.prettifyError(parsed.error)}`, checkHint(name));\n\treturn envelope;\n}\n//#endregion\n//#region src/drives.ts\nconst sha256Hex = (input) => crypto.createHash(\"sha256\").update(input).digest(\"hex\");\nfunction projectDriveId(projectRoot, slug) {\n\treturn projectDriveIdWith(sha256Hex, projectRoot, slug);\n}\nfunction resolveDriveDeclaration(projectRoot, decl) {\n\tconst id = decl.projectHash ? projectDriveId(projectRoot, decl.slug) : decl.id;\n\tconst slug = decl.projectHash === true ? id : decl.slug;\n\tif (decl.remote) return {\n\t\tkind: \"remote\",\n\t\tid,\n\t\tslug,\n\t\tname: decl.name ?? decl.slug,\n\t\tremoteUrl: decl.remote.url,\n\t\tsharingType: decl.sharingType ?? \"public\",\n\t\tavailableOffline: decl.availableOffline ?? true\n\t};\n\treturn {\n\t\tkind: \"local\",\n\t\tid,\n\t\tslug,\n\t\tdocumentType: decl.documentType,\n\t\tname: decl.name ?? decl.slug,\n\t\ticon: resolveImageRef(projectRoot, decl.icon, {\n\t\t\tmaxBytes: DRIVE_ICON_MAX_BYTES,\n\t\t\twarn: (m) => console.warn(m)\n\t\t}),\n\t\tpreferredEditor: decl.preferredEditor,\n\t\tsharingType: decl.sharingType ?? \"public\",\n\t\tavailableOffline: decl.availableOffline ?? true\n\t};\n}\n/** Idempotent, slug-keyed: an existing slug is left untouched (never\n* recreated, never mutated — preserveStrategy refinements live here later). */\nasync function seedDrives(client, drives) {\n\tconst result = {\n\t\tcreated: [],\n\t\texisting: [],\n\t\tattached: []\n\t};\n\tfor (const drive of drives) {\n\t\tif (drive.kind === \"remote\") {\n\t\t\tawait client.attachRemoteDrive(drive.remoteUrl);\n\t\t\tresult.attached.push(drive.slug);\n\t\t\tcontinue;\n\t\t}\n\t\tif (await client.findDriveBySlug(drive.slug) !== void 0) {\n\t\t\tresult.existing.push(drive.slug);\n\t\t\tcontinue;\n\t\t}\n\t\tawait client.createDrive(drive);\n\t\tresult.created.push(drive.slug);\n\t}\n\treturn result;\n}\n/** Merge host-declared drives with plugin contributions, slug-keyed — the\n* host file wins on conflicts (it is the most explicit source). */\nfunction mergeDrivePlan(projectRoot, hostDeclared, contributed) {\n\tconst plan = /* @__PURE__ */ new Map();\n\tfor (const { declaration, source } of contributed) {\n\t\tconst drive = resolveDriveDeclaration(projectRoot, declaration);\n\t\tplan.set(drive.slug, {\n\t\t\tdrive,\n\t\t\tsource\n\t\t});\n\t}\n\tfor (const declaration of hostDeclared) {\n\t\tconst drive = resolveDriveDeclaration(projectRoot, declaration);\n\t\tplan.set(drive.slug, {\n\t\t\tdrive,\n\t\t\tsource: \"host\"\n\t\t});\n\t}\n\treturn [...plan.values()];\n}\nfunction explainDrivePlan(plan) {\n\tif (plan.length === 0) return \"(no drives declared)\";\n\treturn [\"drives:\", ...plan.map(({ drive, source }) => {\n\t\tconst kind = drive.kind === \"remote\" ? `remote ${drive.remoteUrl}` : \"local\";\n\t\tconst editor = drive.preferredEditor ? ` editor=${drive.preferredEditor}` : \"\";\n\t\tconst id = drive.id ?? \"generated\";\n\t\treturn ` ${drive.slug} (${kind}, id=${id}${editor}) [${source}]`;\n\t})].join(\"\\n\");\n}\n//#endregion\n//#region src/backend-projection.ts\nfunction projectStorage(name, storage) {\n\tswitch (storage.kind) {\n\t\tcase \"idb\": return { kind: \"idb\" };\n\t\tcase \"memory\": return { kind: \"memory\" };\n\t\tcase \"path\":\n\t\t\tif (!storage.dataDir) throw new Error(`Backend \"${name}\": storage kind \"path\" requires dataDir.`);\n\t\t\treturn {\n\t\t\t\tkind: \"path\",\n\t\t\t\tdataDir: storage.dataDir\n\t\t\t};\n\t\tcase \"postgres\": throw new Error(`Backend \"${name}\": storage kind \"postgres\" is server-side only — a provisioned (in-process/worker) reactor cannot use it. Point a \"remote\" backend at the switchboard that owns that database instead.`);\n\t}\n}\n/** One backend → one descriptor. The protocol's featureFlags ride every\n* descriptor (they are fleet consensus, not per-backend). A remote backend\n* must carry remote.url — provision() requires it. */\nfunction backendToDescriptor(name, backend, protocol) {\n\tconst descriptor = {\n\t\tkind: backend.kind,\n\t\tname\n\t};\n\tif (descriptor.kind === \"remote\") {\n\t\tconst url = backend.remote?.url;\n\t\tif (!url) throw new Error(`Backend \"${name}\" is kind \"remote\" but has no remote.url — a remote descriptor attaches to an already-running reactor by URL.`);\n\t\tdescriptor.remote = { url };\n\t\treturn descriptor;\n\t}\n\tif (backend.storage) descriptor.storage = projectStorage(name, backend.storage);\n\tif (backend.packages) descriptor.packages = backend.packages;\n\tif (protocol?.featureFlags) descriptor.featureFlags = protocol.featureFlags;\n\treturn descriptor;\n}\n/** All named backends, in placement-primary-first order (the order a\n* createReactorClients step would provision them). */\nfunction backendsToDescriptors(reactor) {\n\tconst backends = reactor?.backends;\n\tif (!backends) return [];\n\tconst names = Object.keys(backends);\n\tconst primary = reactor.placement?.primary;\n\treturn (primary && names.includes(primary) ? [primary, ...names.filter((n) => n !== primary)] : names).map((name) => backendToDescriptor(name, backends[name], reactor.protocol));\n}\nconst LOCAL_KINDS = /* @__PURE__ */ new Set([\"in-process\", \"worker\"]);\n/**\n* Structural multi-reactor (phase 4): true when the block names BOTH a local\n* backend (in-process/worker — the tab's own reactor) and a remote one. This\n* is the shape Connect's routing client serves; a lone remote backend is an\n* attach-only host (assistant/agent shape), not a routed tab.\n*/\nfunction isStructuralMultiReactor(reactor) {\n\tconst backends = reactor?.backends;\n\tif (!backends) return false;\n\tconst kinds = Object.values(backends).map((b) => b.kind);\n\treturn kinds.some((k) => LOCAL_KINDS.has(k)) && kinds.some((k) => k === \"remote\");\n}\n/** The remote backends' drive addresses, placement order. */\nfunction remoteBackendUrls(reactor) {\n\treturn backendsToDescriptors(reactor).filter((d) => d.kind === \"remote\").map((d) => d.remote?.url).filter((u) => typeof u === \"string\");\n}\n/**\n* The remote backends by host key, placement order, each with the\n* connection settings it sets. A url that is not a string yet (an output\n* token, unresolved when a host builds) is skipped, as in remoteBackendUrls.\n*/\nfunction remoteBackends(reactor) {\n\treturn backendsToDescriptors(reactor).flatMap((d) => {\n\t\tconst remote = reactor?.backends?.[d.name]?.remote;\n\t\tif (d.kind !== \"remote\" || typeof d.remote?.url !== \"string\" || !remote) return [];\n\t\tconst { requestTimeoutMs, breaker, realtime } = remote;\n\t\treturn [{\n\t\t\tname: d.name,\n\t\t\turl: d.remote.url,\n\t\t\t...requestTimeoutMs !== void 0 ? { requestTimeoutMs } : {},\n\t\t\t...breaker !== void 0 ? { breaker } : {},\n\t\t\t...realtime !== void 0 ? { realtime } : {}\n\t\t}];\n\t});\n}\n//#endregion\n//#region src/reactor-config.ts\n/**\n* The shared `reactor` host-config block and its projections onto the\n* Switchboard config / Connect runtime config. Phase 2 of uniform-runners: makes\n* the reactor block live through the bridge runners, BEFORE track R replaces\n* the projection with reactor-monitor's provision(). The headline is\n* single-sourced `reactor.protocol` — both projections read the same block, so\n* client and server cannot diverge, and a contradicting pre-set env fails boot.\n*/\n/** A switchboard host's own store. Prefers placement.primary, else\n* \"main\"/\"local\", else the first. Connect refuses placement.primary: its\n* reactor is {@link browserBackend}. */\nfunction primaryBackend(reactor) {\n\tconst backends = reactor?.backends;\n\tif (!backends) return void 0;\n\tconst names = Object.keys(backends);\n\tif (names.length === 0) return void 0;\n\treturn backends[reactor.placement?.primary ?? (names.includes(\"main\") ? \"main\" : names.includes(\"local\") ? \"local\" : names[0])];\n}\nconst FLAG_ENV = {\n\tdocumentDecisions: \"REACTOR_DOCUMENT_DECISIONS\",\n\tauthEnforcement: \"REACTOR_AUTH_ENFORCEMENT\",\n\tauthGroups: \"REACTOR_AUTH_GROUPS\",\n\tauthConditions: \"REACTOR_AUTH_CONDITIONS\",\n\tundoV3: \"REACTOR_UNDO_V3\"\n};\n/** The env vars a protocol block maps onto, with their string values. Only\n* keys the block actually sets appear. */\nfunction protocolEnv(protocol) {\n\tconst env = {};\n\tif (!protocol) return env;\n\tfor (const [key, varName] of Object.entries(FLAG_ENV)) {\n\t\tconst value = protocol.featureFlags?.[key];\n\t\tif (value !== void 0) env[varName] = value ? \"true\" : \"false\";\n\t}\n\tif (protocol.createSignaturePolicy !== void 0) env.CREATE_SIGNATURE_POLICY = protocol.createSignaturePolicy;\n\tif (protocol.unsupportedStoredDocuments !== void 0) env.REACTOR_UNSUPPORTED_STORED_DOCUMENTS = protocol.unsupportedStoredDocuments;\n\treturn env;\n}\n/** The reactor block as a switchboard config layer. The reactor store and the\n* read model are separate fields: `readModel.url` never moves the reactor. */\nfunction reactorBlockToSwitchboardConfig(reactor) {\n\tconst layer = {};\n\tconst backend = primaryBackend(reactor);\n\tconst storage = backend?.storage;\n\tconst reactorUrl = storage?.kind === \"postgres\" ? storage.url : storage?.dataDir;\n\tconst readModelUrl = backend?.readModel?.url;\n\tif (reactorUrl || readModelUrl) layer.storage = {\n\t\t...reactorUrl ? { reactor: { url: reactorUrl } } : {},\n\t\t...readModelUrl ? { readModel: { url: readModelUrl } } : {}\n\t};\n\tif (reactor?.protocol) layer.protocol = reactor.protocol;\n\tif (backend?.packages?.dynamic) layer.packages = { dynamic: true };\n\treturn layer;\n}\nconst LOCAL_BACKEND_KINDS = /* @__PURE__ */ new Set([\"in-process\", \"worker\"]);\n/** Connect's browser reactor: its first in-process or worker backend. */\nfunction browserBackend(reactor) {\n\tconst entry = Object.entries(reactor?.backends ?? {}).find(([, backend]) => LOCAL_BACKEND_KINDS.has(backend.kind));\n\treturn entry ? {\n\t\t...entry[1],\n\t\tname: entry[0]\n\t} : void 0;\n}\n/**\n* Which reactor client the backend topology asks for:\n* - local (in-process/worker) AND remote backends -> `router`\n* - remote backend(s) only -> `remote`\n* - a worker backend -> `worker`\n* - anything else local -> `in-process`\n* `undefined` when no backends are declared: Connect then runs `in-process`.\n*/\nfunction reactorClientMode(reactor) {\n\tconst backends = reactor?.backends;\n\tif (!backends) return void 0;\n\tconst kinds = Object.values(backends).map((b) => b.kind);\n\tif (kinds.length === 0) return void 0;\n\tconst hasLocal = kinds.some((k) => LOCAL_BACKEND_KINDS.has(k));\n\tconst hasRemote = kinds.some((k) => k === \"remote\");\n\tif (hasLocal && hasRemote) return \"router\";\n\tif (hasRemote) return \"remote\";\n\treturn browserBackend(reactor)?.kind === \"worker\" ? \"worker\" : \"in-process\";\n}\n/** Served only when `newDrives` names a served remote backend: a local one\n* is the default, and Connect refuses one it has no address for. */\nfunction connectRouterSettings(reactor, served) {\n\tconst newDrives = reactor?.placement?.newDrives;\n\tconst { probeTimeoutMs, provisionalRouteMs } = reactor?.router ?? {};\n\tconst router = {\n\t\t...newDrives !== void 0 && served.some((remote) => remote.name === newDrives) ? { newDrives } : {},\n\t\t...probeTimeoutMs !== void 0 ? { probeTimeoutMs } : {},\n\t\t...provisionalRouteMs !== void 0 ? { provisionalRouteMs } : {}\n\t};\n\treturn Object.keys(router).length > 0 ? router : void 0;\n}\nfunction connectStorage(backend) {\n\tconst kind = backend?.storage?.kind;\n\treturn kind === \"idb\" || kind === \"memory\" ? kind : void 0;\n}\n/** Why the browser reactor's declared store can't be served: Connect keeps\n* IndexedDB instead of a folder or Postgres. */\nfunction unservedConnectStorage(reactor) {\n\tconst browser = browserBackend(reactor);\n\tconst kind = browser?.storage?.kind;\n\tif (!browser || !kind || connectStorage(browser)) return void 0;\n\treturn `reactor.backends.${browser.name}.storage \"${kind}\": Connect's browser reactor can't use it and keeps IndexedDB instead.`;\n}\n/** Project the reactor block onto the Connect runtime config: protocol →\n* connect.reactor (same shape), backend topology → instance.reactorWorker\n* (the browser reactor's kind), instance.reactorClient, instance.storage\n* (the browser reactor's store), and with a\n* switchboard instance.remoteBackends and instance.router. */\nfunction projectReactorToConnect(reactor) {\n\tconst connect = {};\n\tif (reactor?.protocol) connect.reactor = reactor.protocol;\n\tconst mode = reactorClientMode(reactor);\n\tif (mode !== void 0) {\n\t\tconst routed = mode === \"router\" || mode === \"remote\";\n\t\tconst served = routed ? remoteBackends(reactor) : [];\n\t\tconst router = routed ? connectRouterSettings(reactor, served) : void 0;\n\t\tconst browser = browserBackend(reactor);\n\t\tconst storage = connectStorage(browser);\n\t\tconnect.instance = {\n\t\t\treactorWorker: browser?.kind === \"worker\",\n\t\t\treactorClient: mode,\n\t\t\t...storage ? { storage } : {},\n\t\t\t...routed ? { remoteBackends: served } : {},\n\t\t\t...router ? { router } : {}\n\t\t};\n\t}\n\treturn { connect };\n}\n/** Whether an env value means what the host's value does. The switchboard\n* reads REACTOR_UNDO_V3 as on unless it is exactly \"false\". */\nfunction protocolEnvAgrees(varName, envValue, hostValue) {\n\tif (varName === FLAG_ENV.undoV3) return envValue !== \"false\" === (hostValue === \"true\");\n\treturn envValue === hostValue;\n}\n/** Each pre-set env var that CONTRADICTS the host's protocol block, as a\n* message naming the var, the host value and the env value. An env var that\n* merely matches, or is unset, is fine. */\nfunction protocolConflicts(protocol, env, hostFile = \"the host file\") {\n\tif (!protocol) return [];\n\treturn Object.entries(protocolEnv(protocol)).flatMap(([varName, hostValue]) => {\n\t\tconst envValue = env[varName];\n\t\tif (envValue === void 0 || protocolEnvAgrees(varName, envValue, hostValue)) return [];\n\t\treturn [`reactor.protocol conflict: ${varName} is \"${envValue}\" in the environment but \"${hostValue}\" in ${hostFile}. These are fleet-consensus settings — a mismatch would diverge replay. Remove the env override or align the host.`];\n\t});\n}\n/**\n* The enforcement teeth of single-sourcing: if a pre-set env var CONTRADICTS\n* the host's protocol block, fail loudly naming the var, the host value, and\n* the env value (phase-2 transition keeps an operator's explicit env as an\n* escape hatch unless it disagrees with the protocol — see the WBS\n* precedence note).\n*/\nfunction assertProtocolConsistency(protocol, env, hostFile = \"the host file\") {\n\tconst conflict = protocolConflicts(protocol, env, hostFile).at(0);\n\tif (conflict) throw new Error(conflict);\n}\n//#endregion\n//#region src/connect-projection.ts\n/**\n* Instance-fact projection for compound hosts: the drives a compound's\n* reactor member created, projected into the Connect member's runtime-config\n* override. Pure functions, moved from ph-cli's vetra service so the generic\n* compound and the classic path share one implementation.\n*/\nfunction isLocalDrive(drive) {\n\treturn \"local\" in drive;\n}\nconst driveKey = (drive) => isLocalDrive(drive) ? `local:${drive.id}` : drive.url;\n/**\n* Concatenate groups of `connect.drives.defaultDrives` in the order given,\n* de-duplicating by drive identity (URL for remote entries, id for local\n* ones). The first occurrence of a drive wins, so earlier groups keep their\n* position and metadata — e.g. the Vetra drive `ph dev` starts stays first\n* even when the project's `powerhouse.config.json` lists the same drive.\n*/\nfunction mergeDefaultDrives(...groups) {\n\tconst seen = /* @__PURE__ */ new Set();\n\tconst out = [];\n\tfor (const group of groups) for (const drive of group) {\n\t\tconst key = driveKey(drive);\n\t\tif (seen.has(key)) continue;\n\t\tseen.add(key);\n\t\tout.push(drive);\n\t}\n\treturn out;\n}\n/**\n* Rebase a local drive URL onto a public base: keeps the /d/<slug> path,\n* swaps the loopback origin for the public base. Browser clients behind a\n* reverse proxy can't reach http://localhost:<port>. Non-loopback URLs\n* (e.g. a remote drive) are already public and pass through unchanged, as do\n* unparseable ones.\n*/\nfunction rebaseDriveUrl(driveUrl, publicBase) {\n\tlet url;\n\ttry {\n\t\turl = new URL(driveUrl);\n\t} catch {\n\t\treturn driveUrl;\n\t}\n\tif (![\n\t\t\"localhost\",\n\t\t\"127.0.0.1\",\n\t\t\"[::1]\"\n\t].includes(url.hostname)) return driveUrl;\n\treturn `${publicBase.replace(/\\/+$/, \"\")}${url.pathname}`;\n}\n/**\n* The compound's drives projection: created drives first (rebased onto the\n* public base when given), then the project's configured drives, de-duplicated\n* — and `preserve-all`, because compound-injected drive lists change per\n* launch context and must never detach drives the user added by hand.\n*/\nfunction projectDrivesIntoConnect(input) {\n\treturn { drives: {\n\t\tdefaultDrives: mergeDefaultDrives(input.createdDriveUrls.filter((url) => typeof url === \"string\" && url.length > 0).map((url) => ({\n\t\t\turl: input.publicBase ? rebaseDriveUrl(url, input.publicBase) : url,\n\t\t\tname: null,\n\t\t\ticon: null\n\t\t})), input.configuredDefaultDrives ?? []),\n\t\tpreserveStrategy: \"preserve-all\"\n\t} };\n}\n/** A served slug names a declared one as is, or hashed (`<slug>-<8 hex>`). */\nfunction servesSlug(declared, served) {\n\treturn served === declared || served.startsWith(`${declared}-`) && /^[0-9a-f]{8}$/.test(served.slice(declared.length + 1));\n}\n/** Annotates remote default drives with their backend (`sync: false` when placed on it); other remote placements become collections. */\nfunction placeConnectDrives(reactor, defaultDrives) {\n\tconst remotes = remoteBackends(reactor).flatMap(({ name, url }) => {\n\t\tconst at = switchboardOfDrive$1(url);\n\t\treturn at ? [{\n\t\t\tname,\n\t\t\tbase: at.base\n\t\t}] : [];\n\t});\n\tif (remotes.length === 0) return { defaultDrives: [...defaultDrives] };\n\tconst placement = Object.entries(reactor?.placement?.drives ?? {});\n\tconst matched = /* @__PURE__ */ new Set();\n\tconst placed = defaultDrives.map((drive) => {\n\t\tif (!(\"url\" in drive)) return drive;\n\t\tconst at = switchboardOfDrive$1(drive.url);\n\t\tconst backend = remotes.find((remote) => remote.base === at?.base)?.name;\n\t\tif (!at || !backend) return drive;\n\t\tconst entry = placement.find(([slug]) => servesSlug(slug, at.slug));\n\t\tif (entry) matched.add(entry[0]);\n\t\treturn entry?.[1] === backend ? {\n\t\t\t...drive,\n\t\t\tbackend,\n\t\t\tsync: false\n\t\t} : {\n\t\t\t...drive,\n\t\t\tbackend\n\t\t};\n\t});\n\tconst names = new Set(remotes.map((remote) => remote.name));\n\tconst collections = Object.fromEntries(placement.filter(([slug, backend]) => !matched.has(slug) && names.has(backend)).map(([slug, backend]) => [slug, {\n\t\tbackend,\n\t\tsync: false\n\t}]));\n\treturn Object.keys(collections).length > 0 ? {\n\t\tdefaultDrives: placed,\n\t\tcollections\n\t} : { defaultDrives: placed };\n}\n//#endregion\n//#region src/expect-host.ts\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction runnerOf(host) {\n\treturn isRecord(host.runner) ? host.runner : {};\n}\nfunction defaultVerbOf(host) {\n\tconst verb = runnerOf(host).defaultVerb;\n\treturn typeof verb === \"string\" ? verb : void 0;\n}\n/** At compound verb \"run\" each member runs its own defaultVerb; any other\n* compound verb is forwarded uniformly (compound.ts `memberVerbOf`). */\nfunction memberVerb(compoundVerb, member) {\n\treturn compoundVerb === \"run\" ? defaultVerbOf(member) ?? \"run\" : compoundVerb;\n}\n/** Backend names, placement-primary first (`backendsToDescriptors` order). */\nfunction orderedBackends(reactor) {\n\tconst backends = Object.entries(reactor.backends ?? {});\n\tconst primary = reactor.placement?.primary;\n\treturn [...backends.filter(([name]) => name === primary), ...backends.filter(([name]) => name !== primary)];\n}\nfunction expectBackend(name, backend, reactor) {\n\tconst out = {\n\t\tname,\n\t\tkind: backend.kind\n\t};\n\tif (backend.storage) out.storage = backend.storage.kind;\n\tif (typeof backend.storage?.dataDir === \"string\") out.dataDir = backend.storage.dataDir;\n\ttry {\n\t\tbackendToDescriptor(name, backend, reactor.protocol);\n\t} catch (error) {\n\t\tout.provisionError = error instanceof Error ? error.message : String(error);\n\t}\n\treturn out;\n}\nfunction expectDrive(declaration, source) {\n\tif (typeof declaration.slug !== \"string\") return void 0;\n\tconst remote = isRecord(declaration.remote) ? declaration.remote : void 0;\n\tconst drive = {\n\t\tslug: declaration.slug,\n\t\tkind: remote ? \"remote\" : \"local\",\n\t\tsource\n\t};\n\tif (remote && typeof remote.url === \"string\") drive.url = remote.url;\n\tif (typeof declaration.id === \"string\") drive.id = declaration.id;\n\tconst projectHash = declaration.projectHash;\n\tif (typeof projectHash === \"boolean\" || projectHash === \"id\") drive.projectHash = projectHash;\n\treturn drive;\n}\n/** The key `mergeDrivePlan` merges on: the SERVED slug, which for\n* `projectHash: true` is the hashed id (never equal to a plain slug). */\nfunction servedSlugKey(drive) {\n\treturn drive.projectHash === true ? `${drive.slug}\\0hashed` : drive.slug;\n}\n/** Contributions first, then host declarations; keyed by served slug, the\n* host wins (and keeps the contribution's position), like `mergeDrivePlan`. */\nfunction drivePlan(reactor, contributed) {\n\tconst plan = /* @__PURE__ */ new Map();\n\tfor (const { declaration, source } of contributed) {\n\t\tconst drive = expectDrive(declaration, source);\n\t\tif (drive) plan.set(servedSlugKey(drive), drive);\n\t}\n\tfor (const declaration of reactor?.drives ?? []) {\n\t\tconst drive = expectDrive(declaration, \"host\");\n\t\tif (drive) plan.set(servedSlugKey(drive), drive);\n\t}\n\treturn [...plan.values()];\n}\n/** Token facts of the host's OWN fields (a compound's `children` are its\n* members' own). */\nfunction tokenFacts(declared, kind) {\n\tconst own = kind === \"compound\" ? Object.fromEntries(Object.entries(declared).filter(([key]) => key !== \"children\")) : declared;\n\tconst sites = outputSitesOf(own);\n\tconst consumes = sites.map(({ path, ref, outputPath }) => ({\n\t\tat: path,\n\t\thost: ref.host,\n\t\t...ref.member !== void 0 ? { member: ref.member } : {},\n\t\tpath: outputPath\n\t}));\n\treturn {\n\t\tdependsOn: [...new Set(sites.map(({ ref }) => refKey(ref)))].sort(),\n\t\tconsumes,\n\t\tenv: [...new Set(envSitesOf(own).map(({ name }) => name))].sort()\n\t};\n}\nfunction expectOwn(input, verb) {\n\tconst resolved = input.resolved ?? input.declared;\n\tconst expectation = {\n\t\tname: typeof resolved.name === \"string\" ? resolved.name : \"\",\n\t\tkind: input.kind,\n\t\tverb,\n\t\t...tokenFacts(input.declared, input.kind)\n\t};\n\tif (input.kind !== \"reactor\") return expectation;\n\tconst reactor = isRecord(resolved.reactor) ? resolved.reactor : void 0;\n\tconst mode = reactorClientMode(reactor);\n\tif (mode !== void 0) expectation.clientMode = mode;\n\texpectation.multiReactor = isStructuralMultiReactor(reactor);\n\tconst backends = reactor ? orderedBackends(reactor) : [];\n\tif (reactor && backends.length > 0) {\n\t\texpectation.backends = backends.map(([name, backend]) => expectBackend(name, backend, reactor));\n\t\texpectation.remotes = backends.flatMap(([, backend]) => backend.kind === \"remote\" && typeof backend.remote?.url === \"string\" ? [backend.remote.url] : []);\n\t}\n\texpectation.drives = drivePlan(reactor, input.contributed ?? []);\n\treturn expectation;\n}\n/**\n* The expectation for one host. A reactor host's comes from its resolved\n* reactor block and contributed drives; a compound's lists its members in\n* plan order, each with the verb it runs at under the compound's own verb\n* and the members it starts after.\n*/\nfunction expectHost(input) {\n\tconst verb = defaultVerbOf(input.declared) ?? \"run\";\n\tconst expectation = expectOwn(input, verb);\n\tif (input.kind !== \"compound\" || !input.members) return expectation;\n\tconst order = input.plan?.order ?? input.members.map((m) => m.key);\n\tconst edges = input.plan?.edges ?? [];\n\tconst byKey = new Map(input.members.map((m) => [m.key, m]));\n\tconst members = {};\n\tfor (const key of order) {\n\t\tconst member = byKey.get(key);\n\t\tif (!member) continue;\n\t\tmembers[key] = {\n\t\t\thost: member.host,\n\t\t\t...expectOwn(member, memberVerb(verb, member.declared)),\n\t\t\tafter: [...new Set(edges.filter((e) => e.consumer === key).map((e) => e.producer))].sort()\n\t\t};\n\t}\n\texpectation.startOrder = order.filter((key) => byKey.has(key));\n\texpectation.members = members;\n\treturn expectation;\n}\n//#endregion\nexport { BUILTIN_ENV_NAMES, COMPOUND_MEMBER_ENV, CONNECT_PLUGIN_OWNED_SLICES, CONNECT_PRIMARY_MESSAGE, CONNECT_RUNNER, HOST_NAME_MAX_LENGTH, HOST_NAME_MESSAGE, HOST_NAME_PATTERN, HOST_REF_MESSAGE, HOST_REF_PATTERN, HostLoadError, ONE_SHOT_VERBS, ORIGIN_PLACEHOLDER, OUTPUTS_FILE, OUTPUT_DATA_DIRS_ENV, PACKAGE_NAME_PATTERN, PlanError, PluginError, RunnerError, SPAWN_STOPPING_NOTE, STOP_ON_STDIN_ENV, STOP_RUN_TIMEOUT_MS, STOP_STREAM_LIMIT_MS, STORE_VERBS, SWITCHBOARD_PROXY_PATHS, SpawnHostError, TOKEN_ESCAPE_KEY, TOKEN_KEYS, TokenResolutionError, applyChildWrapper, askToStop, assertProtocolConsistency, backendToDescriptor, backendsToDescriptors, browserBackend, buildDriveDeclarationSchema, checkHost, checkOutputPaths, checkRunnerArgv, checkTokenSites, childWrapperSchema, childrenSchema, clearRunRecord, collectTokenSites, compoundHostSchema, compoundOutputSource, compoundWiringSchema, computeOutputsHash, concatTokenSchema, connectReactorIssues, declaredGenericCompoundHostSchema, declaredHostSchemas, defaultConnectComposition, defaultUserDataDir, defineHostSchemas, describeHostOutputs, describeMapElements, describeToken, driveAddressMessage, driveDeclarationSchema, drivesSchema, emitHostJsonSchema, emittedHostSchemas, emptyMaps, entryActiveForVerb, envSitesOf, envTokenSchema, envTokenable, expectHost, explainDrivePlan, exportHost, findDeadConnectConfig, findHostPackage, findNonStaticValue, findRemovedForms, findToken, forbidRef, formatHostRef, formatPath, genericCompoundHostSchema, getVerb, holdStopRequests, hostExportSchema, hostFileLabel, hostNameSchema, hostSchemaIssues, hostTypeSatisfies, installStopChannel, isBuiltinEnvName, isHtmlNavigation, isOriginPlaceholderUrl, isPidAlive, isRunnerArgsSchema, isSchemaLike, isStructuralMultiReactor, isSwitchboardProxyPath, isToken, itemTokenSchema, keyTokenSchema, killTree, kindShapeIssues, knownVerbIssues, lintHostImportGraph, lintHostImports, lintOutputsFile, listRunRecords, listVerbs, listenForStop, loadHost, loadHostFresh, loadProducers, locateHost, makeHostSchemas, mapTokenSchema, memberCycle, memberForRef, memberProcessOf, memberProcessSchema, mergeContributions, mergeDefaultDrives, mergeDrivePlan, moduleRootOf, normalizePluginEntries, normalizePluginEntry, originOrUrlSchema, outputRefsOf, outputSitesOf, outputTokenSchema, packageBuildRefusal, parseHostRef, placeConnectDrives, placementKeyIssues, planCompound, planForeground, pluginEntryObjectSchema, pluginEntrySchema, primaryBackend, probeHostsFolder, probeRun, processResolveEnv, producerOutputsSchemas, profileSchema, projectDriveId, projectDriveIdWith, projectDrivesIntoConnect, projectReactorToConnect, protocolConflicts, protocolEnv, protocolEnvAgrees, reactorBackendKindSchema, reactorBackendSchema, reactorBlockToSwitchboardConfig, reactorClientMode, reactorHostSchema, reactorProtocolSchema, reactorSchema, readOutputsFileHash, readProjectName, readRunRecord, rebaseDriveUrl, recordKeyOf, ref, refKey, refineConnectReactor, refineStartOrder, registerHostType, remoteBackendUrls, remoteBackends, renderTokens, requestStop, resolveDriveDeclaration, resolveHostOutputs, resolveHostPlugins, resolveOrder, resolveOriginPlaceholders, resolvePackageRoot, resolvePluginContributions, resolveRunnerModule, resolveUserDataPlaceholders, runCompound, runObserveHook, runObserveHookSequential, runProvideHook, runRecordKey, runRecordMemberSchema, runRecordOutputSource, runRecordSchema, runTransformHook, runnerBaseSchema, runnerHandleSchema, runnerKindSchema, runnerOutputsSchema, scanHostImports, schemaAtPath, seedDrives, spawnHost, splitCompoundArgv, splitRunArgv, stopChannelPath, stopRun, stopStreamOf, stripComments, substituteBuiltinEnv, switchboardOfDrive, takeCompoundMember, toOriginPlaceholder, toStartedHandle, tokenKeyOf, tokenSchema, tokenable, unservedConnectStorage, unwrapEscapes, validateDeclaredHost, validateHost, withOriginPlaceholders, withoutHostsMessage, writeRunRecord };\n\n//# sourceMappingURL=index.mjs.map"],"names":["z.custom","z.strictObject","z.literal","z.string","z.record","z.prettifyError"],"mappings":";;;;;;;;;;;;;AAYA,eAAe,UAAU,MAAM,SAAS;CACvC,MAAM,SAAS;EACd,QAAQ,CAAC;EACT,UAAU,CAAC;EACX,UAAU,CAAC;CACZ;CACA,IAAI,OAAO,SAAS,KAAK;CACzB,MAAM,OAAO,QAAQ,QAAQ;CAC7B,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;EACH,MAAM,SAAS,MAAM,SAAS,QAAQ,aAAa,IAAI;EACvD,OAAO,OAAO;EACd,cAAc,OAAO;EACrB,OAAO,cAAc,OAAO,MAAM,WAAW;EAC7C,SAAS,MAAM,oBAAoB,aAAa,QAAQ,aAAa,MAAM,GAAG,KAAK,OAAO,MAA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,IAAI,GAAG,GAAG;EACnB,KAAK,IAAI,GAAG;EACZ,IAAI,KAAK,KAAK;CACf;CACA,OAAO;AACR","debug_id":"d7a0be1b-2030-5dcc-a1b0-cdac076dacbe"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-all-BLot_H9Z.mjs","sources":["../src/services/generate-all.ts"],"sourcesContent":["import { modelGeneration } from \"@powerhousedao/codegen\";\nimport { buildTsMorphProject } from \"@powerhousedao/codegen/utils\";\nimport { extractAllDocuments, saveSpec } from \"@powerhousedao/vetra/codegen\";\nimport { probeHostsFolder } from \"@powerhousedao/host-core\";\nimport { warnSubgraphTypeConflicts } from \"../utils/warn-subgraph-type-conflicts.js\";\nimport { startGenerateHosts } from \"./generate-hosts.js\";\n\nexport async function startGenerateAll(\n args: { extract?: boolean },\n projectDir: string,\n) {\n const project = buildTsMorphProject(projectDir);\n if (args.extract) {\n const all = extractAllDocuments(project);\n for (const doc of [\n ...all.documentModels,\n ...all.editors,\n ...all.processors,\n ...all.subgraphs,\n ...all.apps,\n ]) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n await modelGeneration.generateAll(project);\n await project.save();\n await warnSubgraphTypeConflicts(projectDir);\n if (\n probeHostsFolder(projectDir).kind === \"present\" &&\n !(await startGenerateHosts(projectDir))\n ) {\n process.exitCode = 1;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;AAOA,eAAsB,iBACpB,MACA,YACA;CACA,MAAM,UAAU,oBAAoB,UAAU;CAC9C,IAAI,KAAK,SAAS;EAChB,MAAM,MAAM,oBAAoB,OAAO;EACvC,KAAK,MAAM,OAAO;GAChB,GAAG,IAAI;GACP,GAAG,IAAI;GACP,GAAG,IAAI;GACP,GAAG,IAAI;GACP,GAAG,IAAI;EACT,GAAG;GACD,MAAM,OAAO,MAAM,SAAS,KAAK,UAAU;GAC3C,QAAQ,IAAI,SAAS,MAAM;EAC7B;EACA;CACF;CACA,MAAM,gBAAgB,YAAY,OAAO;CACzC,MAAM,QAAQ,KAAK;CACnB,MAAM,0BAA0B,UAAU;CAC1C,IACE,iBAAiB,UAAU,CAAC,CAAC,SAAS,aACtC,CAAE,MAAM,mBAAmB,UAAU,GAErC,QAAQ,WAAW;AAEvB","debug_id":"20a45ddd-12a3-5808-a248-63bca77b34d1"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-app-hm6CJ_4O.mjs","sources":["../src/services/generate-app.ts"],"sourcesContent":["import { generateAllApps, generateApp } from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n getAppMetadata,\n getEditorMetadata,\n} from \"@powerhousedao/codegen/utils\";\nimport {\n extractAppDocuments,\n generateAppFromDocument,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport type { AppModuleDocument } from \"@powerhousedao/vetra/document-models/app-module\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { GenerateAppArgs } from \"../types.js\";\nimport { resolveModuleDirName } from \"../utils/module-dir.js\";\n\nconst MODULE_FILE_EXPECTATION =\n \"an EditorModule with string literals for config.id, config.name and documentTypes\";\n\nexport async function startGenerateApp(\n args: GenerateAppArgs,\n projectDir: string,\n) {\n const {\n name,\n allowedDocumentTypes = [],\n disableDragAndDrop,\n document,\n dir,\n all,\n extract,\n debug,\n } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (extract) {\n const docs = extractAppDocuments(project);\n if (docs.length === 0) {\n console.log(\"No drive apps found in editors/.\");\n }\n for (const doc of docs) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n if (all) {\n const { apps, unreadableDirs } = await generateAllApps(project);\n await project.save();\n if (apps.length === 0 && unreadableDirs.length === 0) {\n console.log(\"No drive apps found in editors/.\");\n }\n for (const app of apps) {\n console.log(`Regenerated app \"${app.name}\" in editors/${app.dirName}`);\n }\n for (const dirName of unreadableDirs) {\n console.warn(\n `Skipped editors/${dirName}: expected its module.ts to export ${MODULE_FILE_EXPECTATION}. Kept the manifest's apps.`,\n );\n }\n return;\n } else if (document) {\n const doc = (await getDocument(document)) as AppModuleDocument;\n await generateAppFromDocument(doc, project);\n } else if (name) {\n await generateApp(\n {\n appName: name,\n allowedDocumentTypes,\n isDragAndDropEnabled: !disableDragAndDrop,\n },\n project,\n );\n } else if (dir) {\n const appMetadata = getAppMetadata(\n project,\n resolveAppDirName(project, projectDir, dir),\n );\n if (!appMetadata) {\n throw new Error(`Failed to get data for app in dir \"${dir}\"`);\n }\n const {\n name: appName,\n id: appId,\n dirName: appDirName,\n allowedDocumentTypes,\n isDragAndDropEnabled,\n } = appMetadata;\n\n await generateApp(\n {\n appName,\n appId,\n appDirName,\n allowedDocumentTypes,\n isDragAndDropEnabled,\n },\n project,\n );\n await project.save();\n console.log(`Regenerated app \"${appName}\" in editors/${appDirName}`);\n return;\n } else {\n console.log(\n \"Please specify one of `name`, `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n}\n\n/** The app directory that `--dir` names, checked to hold a drive app's module.ts */\nfunction resolveAppDirName(\n project: ReturnType<typeof buildTsMorphProject>,\n projectDir: string,\n dir: string,\n) {\n const dirName = resolveModuleDirName(projectDir, \"editors\", dir, \"my-app\");\n if (!existsSync(join(projectDir, \"editors\", dirName, \"module.ts\"))) {\n throw new Error(`editors/${dirName} has no module.ts.`);\n }\n const editorMetadata = getEditorMetadata(project, dirName);\n if (!editorMetadata) {\n throw new Error(\n `Could not read editors/${dirName}/module.ts: expected ${MODULE_FILE_EXPECTATION}.`,\n );\n }\n if (!editorMetadata.documentTypes.includes(\"powerhouse/document-drive\")) {\n throw new Error(\n `editors/${dirName} is a document editor, not a drive app: its documentTypes don't include \"powerhouse/document-drive\". Use \\`ph-cli generate editor --dir ${dirName}\\` instead.`,\n );\n }\n return dirName;\n}\n"],"names":[],"mappings":";;;;;;;;;AAkBA,MAAM,0BACJ;AAE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AoB,QAAQ,eAAe,YAAY;EACnE;CACF,OAAO;EACL,QAAQ,IACN,uEACF;EACA;CACF;CACA,MAAM,QAAQ,KAAK;AACrB;;AAGA,SAAS,kBACP,SACA,YACA,KACA;CACA,MAAM,UAAU,qBAAqB,YAAY,WAAW,KAAK,QAAQ;CACzE,IAAI,CAAC,WAAW,KAAK,YAAY,WAAW,SAAS,WAAW,CAAC,GAC/D,MAAM,IAAI,MAAM,WAAW,QAAQ,mBAAmB;CAExD,MAAM,iBAAiB,kBAAkB,SAAS,OAAO;CACzD,IAAI,CAAC,gBACH,MAAM,IAAI,MACR,0BAA0B,QAAQ,uBAAuB,wBAAwB,EACnF;CAEF,IAAI,CAAC,eAAe,cAAc,SAAS,2BAA2B,GACpE,MAAM,IAAI,MACR,WAAW,QAAQ,0IAA0I,QAAQ,YACvK;CAEF,OAAO;AACT","debug_id":"598034cf-aa42-5189-8607-4625d64996ff"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-document-model-BiD6ovXc.mjs","sources":["../src/services/definitions/code-first-scaffold.ts","../src/services/generate-document-model.ts"],"sourcesContent":["import type { ModelGeneration } from \"@powerhousedao/codegen\";\nimport { capitalCase, kebabCase } from \"change-case\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { readPackage } from \"read-pkg\";\nimport type { Project } from \"ts-morph\";\n\nexport async function scaffoldCodeFirstDocumentModel(\n generation: ModelGeneration,\n name: string,\n projectDir: string,\n project: Project,\n) {\n const modelName = name.trim();\n if (modelName === \"\") {\n throw new Error(\"--name needs a document model name.\");\n }\n const namespace = await documentTypeNamespace(projectDir);\n const documentType = `${namespace}/${kebabCase(modelName)}`;\n const editorName = `${capitalCase(modelName)} Editor`;\n const editorDirName = kebabCase(editorName);\n if (existsSync(join(projectDir, \"editors\", editorDirName))) {\n throw new Error(\n `editors/${editorDirName} already exists. Choose another --name, or move that editor first.`,\n );\n }\n\n const result = await generation.scaffoldDocumentModel(\n {\n name: modelName,\n documentType,\n author: { name: namespace, website: null },\n },\n project,\n );\n for (const path of result.written) {\n console.log(`Wrote ${path}`);\n }\n\n await generation.generateEditor(\n {\n editorName,\n documentTypes: [documentType],\n editorId: editorDirName,\n editorDirName,\n },\n project,\n );\n await project.save();\n console.log(`Generated editor \"${editorName}\" in editors/${editorDirName}`);\n}\n\nasync function documentTypeNamespace(projectDir: string) {\n const { name } = await readPackage({ cwd: projectDir, normalize: false });\n if (!name) {\n throw new Error(\n \"--name puts the document type under the package name. Add a name to package.json.\",\n );\n }\n return name.replace(/^@/, \"\").replaceAll(\"/\", \"-\");\n}\n","import { loadDocumentModel, modelGeneration } from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n documentModelsDirOf,\n} from \"@powerhousedao/codegen/utils\";\nimport {\n extractDocumentModelDocuments,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport { handleMutuallyExclusiveOptions } from \"@powerhousedao/shared/clis\";\nimport type { DocumentModelDocument } from \"@powerhousedao/shared/document-model\";\nimport { existsSync } from \"node:fs\";\nimport { join, relative } from \"node:path\";\nimport type { GenerateDocumentModelArgs } from \"../types.js\";\nimport { resolveModuleDirName } from \"../utils/module-dir.js\";\nimport { warnSubgraphTypeConflicts } from \"../utils/warn-subgraph-type-conflicts.js\";\nimport { scaffoldCodeFirstDocumentModel } from \"./definitions/code-first-scaffold.js\";\n\n/** The configured documentModelsDir, package-relative, for messages and paths. */\nfunction modelsDirOf(projectDir: string) {\n return relative(projectDir, documentModelsDirOf(projectDir).path).replaceAll(\n \"\\\\\",\n \"/\",\n );\n}\n\nexport async function startGenerateDocumentModel(\n args: GenerateDocumentModelArgs,\n projectDir: string,\n) {\n const { document, dir, all, extract, name, codeFirst, debug } = args;\n if (debug) {\n console.log({ args });\n }\n if (name !== undefined && !codeFirst) {\n throw new Error(\n \"--name creates a code-first document model. Pass --code-first.\",\n );\n }\n if (codeFirst && name === undefined) {\n throw new Error(\n \"--code-first only chooses how --name creates a model. Existing models of both styles are discovered without it; drop --code-first. To convert a schema-first model, run ph migrate --document-model <dir>.\",\n );\n }\n const project = buildTsMorphProject(projectDir);\n if (name !== undefined) {\n handleMutuallyExclusiveOptions(\n {\n \"--name\": name,\n \"--document\": document,\n \"--dir\": dir,\n \"--all\": all || undefined,\n \"--extract\": extract || undefined,\n },\n \"generation mode\",\n );\n await scaffoldCodeFirstDocumentModel(\n modelGeneration,\n name,\n projectDir,\n project,\n );\n return;\n }\n if (extract) {\n const docs = extractDocumentModelDocuments(project);\n for (const doc of docs) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n if (all) {\n const { documentModels, unreadableDirs, codeFirstDocumentModels } =\n await modelGeneration.generateAllDocumentModels(project);\n await project.save();\n if (\n documentModels.length === 0 &&\n unreadableDirs.length === 0 &&\n codeFirstDocumentModels.length === 0\n ) {\n console.log(`No document models found in ${modelsDirOf(projectDir)}/.`);\n }\n for (const { name } of documentModels) {\n console.log(`Regenerated document model \"${name}\"`);\n }\n for (const { name } of codeFirstDocumentModels) {\n console.log(`Updated the exports of code-first document model \"${name}\"`);\n }\n for (const dirName of unreadableDirs) {\n console.warn(\n `Skipped ${modelsDirOf(projectDir)}/${dirName}: it has no readable ${dirName}.json, and no index.ts in it exports a code-first model. Kept the manifest's document models.`,\n );\n }\n await warnSubgraphTypeConflicts(projectDir);\n return;\n } else if (document) {\n if (document.endsWith(\".phd\")) {\n const doc = (await getDocument(document)) as DocumentModelDocument;\n await modelGeneration.generateDocumentModel(doc.state.global, project);\n } else {\n const state = await loadDocumentModel(document);\n await modelGeneration.generateDocumentModel(state, project);\n }\n } else if (dir) {\n const modelsDir = modelsDirOf(projectDir);\n const dirName = resolveModuleDirName(\n projectDir,\n modelsDir,\n dir,\n \"my-document-model\",\n );\n const specPath = join(projectDir, modelsDir, dirName, `${dirName}.json`);\n if (!existsSync(specPath)) {\n throw new Error(`${modelsDir}/${dirName} has no ${dirName}.json.`);\n }\n const state = await loadDocumentModel(specPath);\n await modelGeneration.generateDocumentModel(state, project);\n await project.save();\n console.log(\n `Regenerated document model \"${state.name}\" in ${modelsDir}/${dirName}`,\n );\n await warnSubgraphTypeConflicts(projectDir);\n return;\n } else {\n console.log(\n \"Please specify one of `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n await warnSubgraphTypeConflicts(projectDir);\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAOA,eAAsB,+BACpB,YACA,MACA,YACA,SACA;CACA,MAAM,YAAY,KAAK,KAAK;CAC5B,IAAI,cAAc,IAChB,MAAM,IAAI,MAAM,qCAAqC;CAEvD,MAAM,YAAY,MAAM,sBAAsB,UAAU;CACxD,MAAM,eAAe,GAAG,UAAU,GAAG,UAAU,SAAS;CACxD,MAAM,aAAa,GAAG,YAAY,SAAS,EAAE;CAC7C,MAAM,gBAAgB,UAAU,UAAU;CAC1C,IAAI,WAAW,KAAK,YAAY,WAAW,aAAa,CAAC,GACvD,MAAM,IAAI,MACR,WAAW,cAAc,mEAC3B;CAGF,MAAM,SAAS,MAAM,WAAW,sBAC9B;EACE,MAAM;EACN;EACA,QAAQ;GAAE,MAAM;GAAW,SAAS;EAAK;CAC3C,GACA,OACF;CACA,KAAK,MAAM,QAAQ,OAAO,SACxB,QAAQ,IAAI,SAAS,MAAM;CAG7B,MAAM,WAAW,eACf;EACE;EACA,eAAe,CAAC,YAAY;EAC5B,UAAU;EACV;CACF,GACA,OACF;CACA,MAAM,QAAQ,KAAK;CACnB,QAAQ,IAAI,qBAAqB,WAAW,eAAe,eAAe;AAC5E;AAEA,eAAe,sBAAsB,YAAoB;CACvD,MAAM,EAAE,SAAS,MAAM,YAAY;EAAE,KAAK;EAAY,WAAW;CAAM,CAAC;CACxE,IAAI,CAAC,MACH,MAAM,IAAI,MACR,mFACF;CAEF,OAAO,KAAK,QAAQ,MAAM,EAAE,CAAC,CAAC,WAAW,KAAK,GAAG;AACnD;;;;ACxCA,SAAS,YAA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EF,MAAM,0BAA0B,UAAU;EAC1C;CACF,OAAO,IAAI,UAAU;EACnB,IAAI,SAAS,SAAS,MAAM,GAAG;GAC7B,MAAM,MAAO,MAAM,YAAY,QAAQ;GACvC,MAAM,gBAAgB,sBAAsB,IAAI,MAAM,QAAQ,OAAO;EACvE,OAAO;GACL,MAAM,QAAQ,MAAM,kBAAkB,QAAQ;GAC9C,MAAM,gBAAgB,sBAAsB,OAAO,OAAO;EAC5D;CACF,OAAO,IAAI,KAAK;EACd,MAAM,YAAY,YAAY,UAAU;EACxC,MAAM,UAAU,qBACd,YACA,WACA,KACA,mBACF;EACA,MAAM,WAAW,KAAK,YAAY,WAAW,SAAS,GAAG,QAAQ,MAAM;EACvE,IAAI,CAAC,WAAW,QAAQ,GACtB,MAAM,IAAI,MAAM,GAAG,UAAU,GAAG,QAAQ,UAAU,QAAQ,OAAO;EAEnE,MAAM,QAAQ,MAAM,kBAAkB,QAAQ;EAC9C,MAAM,gBAAgB,sBAAsB,OAAO,OAAO;EAC1D,MAAM,QAAQ,KAAK;EACnB,QAAQ,IACN,+BAA+B,MAAM,KAAK,OAAO,UAAU,GAAG,SAChE;EACA,MAAM,0BAA0B,UAAU;EAC1C;CACF,OAAO;EACL,QAAQ,IACN,+DACF;EACA;CACF;CACA,MAAM,QAAQ,KAAK;CACnB,MAAM,0BAA0B,UAAU;AAC5C","debug_id":"d143ac9a-759c-5a5d-98d0-f6df3d4b1bfe"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-editor-DBj_Pxwa.mjs","sources":["../src/services/generate-editor.ts"],"sourcesContent":["import { modelGeneration } from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n getEditorMetadata,\n} from \"@powerhousedao/codegen/utils\";\nimport {\n extractEditorDocuments,\n generateEditorFromDocument,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport type { DocumentEditorDocument } from \"@powerhousedao/vetra/document-models/document-editor\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { GenerateEditorArgs } from \"../types.js\";\nimport { resolveModuleDirName } from \"../utils/module-dir.js\";\n\nconst MODULE_FILE_EXPECTATION =\n \"an EditorModule with string literals for config.id, config.name and documentTypes\";\n\nexport async function startGenerateEditor(\n args: GenerateEditorArgs,\n projectDir: string,\n) {\n const { name, documentType, document, dir, all, extract, debug } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (extract) {\n const docs = extractEditorDocuments(project);\n if (docs.length === 0) {\n console.log(\"No document editors found in editors/.\");\n }\n for (const doc of docs) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n const report: string[] = [];\n if (all) {\n const { editors, unreadableDirs } =\n await modelGeneration.generateAllEditors(project);\n if (editors.length === 0 && unreadableDirs.length === 0) {\n report.push(\"No document editors found in editors/.\");\n }\n for (const editor of editors) {\n report.push(\n `Regenerated editor \"${editor.name}\" in editors/${editor.dirName}`,\n );\n }\n for (const dirName of unreadableDirs) {\n console.warn(\n `Skipped editors/${dirName}: expected its module.ts to export ${MODULE_FILE_EXPECTATION}. Kept the manifest's editors.`,\n );\n }\n } else if (document) {\n const doc = (await getDocument(document)) as DocumentEditorDocument;\n await generateEditorFromDocument(doc, project);\n } else if (name) {\n if (!documentType) {\n throw new Error(\n \"Please specify a document type for the new editor to generate.\",\n );\n }\n await modelGeneration.generateEditor(\n { editorName: name, documentTypes: [documentType] },\n project,\n );\n } else if (dir) {\n const dirName = resolveModuleDirName(\n projectDir,\n \"editors\",\n dir,\n \"my-editor\",\n );\n if (!existsSync(join(projectDir, \"editors\", dirName, \"module.ts\"))) {\n throw new Error(`editors/${dirName} has no module.ts.`);\n }\n const editorArgs = getEditorMetadata(project, dirName);\n if (!editorArgs) {\n throw new Error(\n `Could not read editors/${dirName}/module.ts: expected ${MODULE_FILE_EXPECTATION}.`,\n );\n }\n if (editorArgs.documentTypes.includes(\"powerhouse/document-drive\")) {\n throw new Error(\n `editors/${dirName} is a drive app, not a document editor. Use \\`ph-cli generate app --dir ${dirName}\\` instead.`,\n );\n }\n const {\n name: editorName,\n id: editorId,\n dirName: editorDirName,\n documentTypes,\n } = editorArgs;\n await modelGeneration.generateEditor(\n {\n editorName,\n editorId,\n editorDirName,\n documentTypes,\n },\n project,\n );\n report.push(\n `Regenerated editor \"${editorName}\" in editors/${editorDirName}`,\n );\n } else {\n console.log(\n \"Please specify one of `name`, `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n for (const line of report) {\n console.log(line);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;AAiBA,MAAM,0BACJ;AAEF,eAAsB,oBACpB,MACA,YACA;CACA,MAAM,EAAE,MAAM,cAAc,UAAU,KAAK,KAAK,SAAS,UAAU;CACnE,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,UAAU,oBAAoB,UAAU;CAC9C,IAAI,SAAS;EACX,MAAM,OAAO,uBAAuB,OAAO;EAC3C,IAAI,KAAK,WAAW,GAClB,QAAQ,IAAI,wCAAwC;EAEtD,KAAK,MAAM,OAAO,MAAM;GACtB,MAAM,OAAO,MAAM,SAAS,KAAK,UAAU;GAC3C,QAAQ,IAAI,SAAS,MAAM;EAC7B;EACA;CACF;CACA,MAAM,SAAmB,CAAC;CAC1B,IAAI,KAAK;EACP,MAAM,EAAE,SAAS,mBACf,MAAM,gBAAgB,mBAAmB,OAAO;EAClD,IAAI,QAAQ,WAAW,KAAK,eAAe,WAAW,GACpD,OAAO,KAAK,wCAAwC;EAEtD,KAAK,MAAM,UAAU,SACnB,OAAO,KACL,uBAAuB,OAAO,KAAK,eAAe,OAAO,SAC3D;EAEF,KAAK,MAAM,WAAW,gBACpB,QAAQ,KACN,mBAAmB,QAAQ,qCAAqC,wBAAwB,+BAC1F;CAEJ,OAAO,IAAI,UAAU;EACnB,MAAM,MAAO,MAAM,YAAY,QAAQ;EACvC,MAAM,2BAA2B,KAAK,OAAO;CAC/C,OAAO,IAAI,MAAM;EACf,IAAI,CAAC,cACH,MAAM,IAAI,MACR,gEACF;EAEF,MAAM,gBAAgB,eACpB;GAAE,YAAY;GAAM,eAAe,CAAC,YAAY;EAAE,GAClD,OACF;CACF,OAAO,IAAI,KAAK;EACd,MAAM,UAAU,qBACd,YACA,WACA,KACA,WACF;EACA,IAAI,CAAC,WAAW,KAAK,YAAY,WAAW,SAAS,WAAW,CAAC,GAC/D,MAAM,IAAI,MAAM,WAAW,QAAQ,mBAAmB;EAExD,MAAM,aAAa,kBAAkB,SAAS,OAAO;EACrD,IAAI,CAAC,YACH,MAAM,IAAI,MACR,0BAA0B,QAAQ,uBAAuB,wBAAwB,EACnF;EAEF,IAAI,WAAW,cAAc,SAAS,2BAA2B,GAC/D,MAAM,IAAI,MACR,WAAW,QAAQ,0EAA0E,QAAQ,YACvG;EAEF,MAAM,EACJ,MAAM,YACN,IAAI,UACJ,SAAS,eACT,kBACE;EACJ,MAAM,gBAAgB,eACpB;GACE;GACA;GACA;GACA;EACF,GACA,OACF;EACA,OAAO,KACL,uBAAuB,WAAW,eAAe,eACnD;CACF,OAAO;EACL,QAAQ,IACN,uEACF;EACA;CACF;CACA,MAAM,QAAQ,KAAK;CACnB,KAAK,MAAM,QAAQ,QACjB,QAAQ,IAAI,IAAI;AAEpB","debug_id":"0204e193-cfc3-57bd-8acf-bc46414176a5"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-processor-BVjOsfjJ.mjs","sources":["../src/services/generate-processor.ts"],"sourcesContent":["import {\n detectFeatures,\n generateAllProcessors,\n generateProcessor,\n syncFeatureDependencies,\n} from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n getProcessorMetadata,\n} from \"@powerhousedao/codegen/utils\";\nimport {\n extractProcessorDocuments,\n generateProcessorFromDocument,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport type { ProcessorModuleDocument } from \"@powerhousedao/vetra/document-models/processor-module\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { GenerateProcessorArgs } from \"../types.js\";\nimport { installAddedDependencies } from \"../utils/install-added-dependencies.js\";\nimport { resolveModuleDirName } from \"../utils/module-dir.js\";\n\nexport async function startGenerateProcessor(\n args: GenerateProcessorArgs,\n projectDir: string,\n) {\n const {\n name: processorName,\n type: processorType,\n apps: processorApps,\n documentTypes,\n document,\n dir,\n all,\n extract,\n debug,\n } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (extract) {\n const docs = extractProcessorDocuments(project);\n if (docs.length === 0) {\n console.log(\"No processors found in processors/.\");\n }\n for (const doc of docs) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n const report: string[] = [];\n if (all) {\n const processors = await generateAllProcessors(project);\n if (processors.length === 0) {\n report.push(\"No processors found in processors/.\");\n }\n for (const { processorName } of processors) {\n report.push(`Regenerated processor in processors/${processorName}`);\n }\n } else if (document) {\n const doc = (await getDocument(document)) as ProcessorModuleDocument;\n await generateProcessorFromDocument(doc, project);\n } else if (processorName) {\n await generateProcessor(\n {\n processorName,\n processorApps,\n processorType,\n documentTypes,\n },\n project,\n );\n } else if (dir) {\n const processorDirName = resolveModuleDirName(\n projectDir,\n \"processors\",\n dir,\n \"my-processor\",\n );\n const processorDir = join(projectDir, \"processors\", processorDirName);\n if (\n ![\"processor.ts\", \"index.ts\"].some((file) =>\n existsSync(join(processorDir, file)),\n )\n ) {\n throw new Error(\n `processors/${processorDirName} has no processor.ts or index.ts.`,\n );\n }\n const processorArgs = getProcessorMetadata(project, processorDirName);\n await generateProcessor(processorArgs, project);\n report.push(`Regenerated processor in processors/${processorDirName}`);\n } else {\n console.log(\n \"Please specify one of `name`, `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n for (const line of report) {\n console.log(line);\n }\n const added = await syncFeatureDependencies(\n detectFeatures(projectDir),\n projectDir,\n );\n await installAddedDependencies(added, projectDir, args.skipInstall);\n}\n"],"names":["installAddedDependencies"],"mappings":";;;;;;;;;;AAuBA,eAAsB,uBACpB,MACA,YACA;CACA,MAAM,EACJ,MAAM,eACN,MAAM,eACN,MAAM,eACN,eACA,UACA,KACA,KACA,SACA,UACE;CACJ,IAAI,OACF,QAAQ,IAAI,EAAE,KAAK,CAAC;CAEtB,MAAM,UAAU,oBAAoB,UAAU;CAC9C,IAAI,SAAS;EACX,MAAM,OAAO,0BAA0B,OAAO;EAC9C,IAAI,KAAK,WAAW,GAClB,QAAQ,IAAI,qCAAqC;EAEnD,KAAK,MAAM,OAAO,MAAM;GACtB,MAAM,OAAO,MAAM,SAAS,KAAK,UAAU;GAC3C,QAAQ,IAAI,SAAS,MAAM;EAC7B;EACA;CACF;CACA,MAAM,SAAmB,CAAC;CAC1B,IAAI,KAAK;EACP,MAAM,aAAa,MAAM,sBAAsB,OAAO;EACtD,IAAI,WAAW,WAAW,GACxB,OAAO,KAAK,qCAAqC;EAEnD,KAAK,MAAM,EAAE,mBAAmB,YAC9B,OAAO,KAAK,uCAAuC,eAAe;CAEtE,OAAO,IAAI,UAAU;EACnB,MAAM,MAAO,MAAM,YAAY,QAAQ;EACvC,MAAM,8BAA8B,KAAK,OAAO;CAClD,OAAO,IAAI,eACT,MAAM,kBACJ;EACE;EACA;EACA;EACA;CACF,GACA,OACF;MACK,IAAI,KAAK;EACd,MAAM,mBAAmB,qBACvB,YACA,cACA,KACA,cACF;EACA,MAAM,eAAe,KAAK,YAAY,cAAc,gBAAgB;EACpE,IACE,CAAC,CAAC,gBAAgB,UAAU,CAAC,CAAC,MAAM,SAClC,WAAW,KAAK,cAAc,IAAI,CAAC,CACrC,GAEA,MAAM,IAAI,MACR,cAAc,iBAAiB,kCACjC;EAEF,MAAM,gBAAgB,qBAAqB,SAAS,gBAAgB;EACpE,MAAM,kBAAkB,eAAe,OAAO;EAC9C,OAAO,KAAK,uCAAuC,kBAAkB;CACvE,OAAO;EACL,QAAQ,IACN,uEACF;EACA;CACF;CACA,MAAM,QAAQ,KAAK;CACnB,KAAK,MAAM,QAAQ,QACjB,QAAQ,IAAI,IAAI;CAElB,MAAM,QAAQ,MAAM,wBAClB,eAAe,UAAU,GACzB,UACF;CACA,MAAMA,2BAAyB,OAAO,YAAY,KAAK,WAAW;AACpE","debug_id":"72eea5cc-adda-5917-886a-b16a3f13873c"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-subgraph-DJZCr0Tk.mjs","sources":["../src/services/generate-subgraph.ts"],"sourcesContent":["import {\n detectFeatures,\n generateAllSubgraphs,\n generateSubgraph,\n generateSubgraphDir,\n syncFeatureDependencies,\n} from \"@powerhousedao/codegen\";\nimport {\n buildTsMorphProject,\n subgraphDirStyle,\n type SubgraphStyle,\n} from \"@powerhousedao/codegen/utils\";\nimport {\n extractSubgraphDocuments,\n findSubgraphNameConflict,\n generateSubgraphFromDocument,\n getDocument,\n saveSpec,\n} from \"@powerhousedao/vetra/codegen\";\nimport type { SubgraphModuleDocument } from \"@powerhousedao/vetra/document-models/subgraph-module\";\nimport { kebabCase } from \"change-case\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { GenerateSubgraphArgs } from \"../types.js\";\nimport { installAddedDependencies } from \"../utils/install-added-dependencies.js\";\nimport { resolveModuleDirName } from \"../utils/module-dir.js\";\nimport { warnSubgraphTypeConflicts } from \"../utils/warn-subgraph-type-conflicts.js\";\n\nconst INDEX_FILE_EXPECTATION = {\n \"schema-first\": \"a class extending BaseSubgraph with a string literal `name`\",\n \"code-first\":\n \"a class extending Subgraph with a string literal `static subgraphName`\",\n} satisfies Record<SubgraphStyle, string>;\n\nasync function assertSubgraphNameFree(projectDir: string, name: string) {\n const conflict = await findSubgraphNameConflict(projectDir, name);\n if (conflict) throw new Error(conflict);\n}\n\n/** The notice for `--code-first` on an existing schema-first subgraph, which\n * is then left unchanged. */\nfunction codeFirstOnSchemaFirst(\n args: GenerateSubgraphArgs,\n projectDir: string,\n name: string,\n): string | undefined {\n if (!args.codeFirst) return undefined;\n const subgraphsDir = join(projectDir, \"subgraphs\");\n const dirName = kebabCase(name);\n if (\n !existsSync(join(subgraphsDir, dirName, \"index.ts\")) ||\n subgraphDirStyle(subgraphsDir, dirName) !== \"schema-first\"\n )\n return undefined;\n return `subgraphs/${dirName} is schema-first; --code-first only applies to new subgraphs. To convert it, run ph migrate --subgraph ${dirName}.`;\n}\n\nexport async function startGenerateSubgraph(\n args: GenerateSubgraphArgs,\n projectDir: string,\n) {\n const { name, document, dir, all, extract, debug } = args;\n if (debug) {\n console.log({ args });\n }\n const project = buildTsMorphProject(projectDir);\n if (extract) {\n const docs = extractSubgraphDocuments(project);\n if (docs.length === 0) {\n console.log(\"No subgraphs found in subgraphs/.\");\n }\n for (const doc of docs) {\n const path = await saveSpec(doc, projectDir);\n console.log(`Wrote ${path}`);\n }\n return;\n }\n const report: string[] = [];\n if (all) {\n const { subgraphNames, unreadableDirs } =\n await generateAllSubgraphs(project);\n if (subgraphNames.length === 0 && unreadableDirs.length === 0) {\n report.push(\"No subgraphs found in subgraphs/.\");\n }\n for (const subgraphName of subgraphNames) {\n report.push(`Regenerated subgraph \"${subgraphName}\"`);\n }\n for (const dirName of unreadableDirs) {\n console.warn(\n `Skipped subgraphs/${dirName}: expected its index.ts to export ${INDEX_FILE_EXPECTATION[subgraphDirStyle(join(projectDir, \"subgraphs\"), dirName)]}. Kept the manifest's subgraphs.`,\n );\n }\n } else if (document) {\n const doc = (await getDocument(document)) as SubgraphModuleDocument;\n const notice = codeFirstOnSchemaFirst(\n args,\n projectDir,\n doc.state.global.name,\n );\n if (notice) {\n console.log(notice);\n return;\n }\n await assertSubgraphNameFree(projectDir, doc.state.global.name);\n await generateSubgraphFromDocument(doc, project, {\n codeFirst: args.codeFirst,\n });\n } else if (name) {\n const notice = codeFirstOnSchemaFirst(args, projectDir, name);\n if (notice) {\n console.log(notice);\n return;\n }\n await assertSubgraphNameFree(projectDir, name);\n await generateSubgraph(name, project, { codeFirst: args.codeFirst });\n } else if (dir) {\n const dirName = resolveModuleDirName(\n projectDir,\n \"subgraphs\",\n dir,\n \"my-subgraph\",\n );\n if (!existsSync(join(projectDir, \"subgraphs\", dirName, \"index.ts\"))) {\n throw new Error(`subgraphs/${dirName} has no index.ts.`);\n }\n const { subgraphName, style } = await generateSubgraphDir(dirName, project);\n if (!subgraphName) {\n throw new Error(\n `Could not read subgraphs/${dirName}/index.ts: expected ${INDEX_FILE_EXPECTATION[style]}.`,\n );\n }\n report.push(`Regenerated subgraph \"${subgraphName}\"`);\n } else {\n console.log(\n \"Please specify one of `name`, `document`, `dir`, `all`, or `extract`.\",\n );\n return;\n }\n await project.save();\n for (const line of report) {\n console.log(line);\n }\n await warnSubgraphTypeConflicts(projectDir);\n const added = await syncFeatureDependencies(\n detectFeatures(projectDir),\n projectDir,\n );\n await installAddedDependencies(added, projectDir, args.skipInstall);\n}\n"],"names":["installAddedDependencies"],"mappings":";;;;;;;;;;;;AA4BA,MAAM,yBAAyB;CAC7B,gBAAgB;CAChB,cACE;AACJ;AAEA,eAAe,uBAAuB,YAAoB,MAAc;CACtE,MAAM,WAAW,MAAM,yBAAyB,YAAY,IAAI;CAChE,IAAI,UAAU,MAAM,IAAI,MAAM,QAAQ;AACxC;;;AAIA,SAAS,uBACP,MACA,YACA,MACoB;CACpB,IAAI,CAAC,KAAK,WAAW,OAAO,KAAA;CAC5B,MAAM,eAAe,KAAK,YAAY,WAAW;CACjD,MAAM,UAAU,UAAU,IAAI;CAC9B,IACE,CAAC,WAAW,KAAK,cAAc,SAAS,UAAU,CAAC,KACnD,iBAAiB,cAAc,OAAO,MAAM,gBAE5C,OAAO,KAAA;CACT,OAAO,aAAa,QAAQ,yGAAyG,QAAQ;AAC/I;AAEA,eAAsB,sBACpB,MACA,YACA;CACA,MAAM,EAAE,MAAM,UAAU,KAAK,KAAK,SAAS,UAAU;CACrD,IAAI,OACF,QA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AC,WAAW,KAAK,YAAY,aAAa,SAAS,UAAU,CAAC,GAChE,MAAM,IAAI,MAAM,aAAa,QAAQ,kBAAkB;EAEzD,MAAM,EAAE,cAAc,UAAU,MAAM,oBAAoB,SAAS,OAAO;EAC1E,IAAI,CAAC,cACH,MAAM,IAAI,MACR,4BAA4B,QAAQ,sBAAsB,uBAAuB,OAAO,EAC1F;EAEF,OAAO,KAAK,yBAAyB,aAAa,EAAE;CACtD,OAAO;EACL,QAAQ,IACN,uEACF;EACA;CACF;CACA,MAAM,QAAQ,KAAK;CACnB,KAAK,MAAM,QAAQ,QACjB,QAAQ,IAAI,IAAI;CAElB,MAAM,0BAA0B,UAAU;CAC1C,MAAM,QAAQ,MAAM,wBAClB,eAAe,UAAU,GACzB,UACF;CACA,MAAMA,2BAAyB,OAAO,YAAY,KAAK,WAAW;AACpE","debug_id":"57f37708-e436-5415-9747-38ee27ce7f15"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-D3H9pQ8u.d.mts","names":[],"sources":["../../../packages/host-core/dist/compound-D2dh2VUh.d.mts","../../../packages/host-core/dist/index.d.mts"],"mappings":";;;;;;;;UAiBU;EACR;EACA;;cAykEY,mCAAmC;EAC/C,MAAM;EACN,QAAQ;IACN,QAAQ;IACR,aAAa,YAAc;IAC3B,MAAM,YAAc;IACpB,MAAM,YAAc;IACpB,SAAS,YAAc,SAAW,mBAAqB,WAAa;MAClE,QAAQ;MACR,SAAS,YAAc;MACvB,OAAO,YAAc,mBAAqB,iBAAmB,SAAW;MACxE,QAAQ,YAAc,UAAY,WAAa;OAC9C;KACF;EACH,UAAU,UAAY,WAAa;IACjC,MAAM;IACN,QAAQ,YAAc;MACpB,QAAQ,YAAc;MACtB,aAAa,YAAc,YAAc;MACzC,MAAM,YAAc,YAAc;MAClC,SAAS,YAAc,YAAc,SAAW,mBAAqB,WAAa;QAChF,QAAQ;QACR,SAAS,YAAc;QACvB,OAAO,YAAc,mBAAqB,iBAAmB,SA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;QAC/B,aAAa,YAAc;UACzB;UACA;UACA;;QAEF,kBAAkB,YAAc;QAChC,QAAQ,YAAc;UACpB,KAAK,gBAAgB;WACpB;SACF;OACF;IACH,SAAS,YAAc;MACrB;MACA;;KAED;EACH,SAAS,YAAc;IACrB,OAAO,YAAc;IACrB,MAAM,YAAc;IACpB,aAAa,YAAc;IAC3B,MAAM,YAAc;KACnB;EACH,QAAQ,YAAc;IACpB,YAAY,YAAc,SAAW;IACrC,eAAe,YAAc;IAC7B,iBAAiB,YAAc;KAC9B;GACF;UA2GO;;;EAGR;;;;EAIA,cAAc;;;EAGd;EACA,KAAK;;;EAGL;IACE;IACA;;;;;EAKF;;;;;;EAMA,mBAAmB;;;;EAInB,aAAa;;;UAGL;;EAER,oBAAoB;;;;EAIpB;;;;;;;UAOQ;;EAER;;EAEA;EACA;EACA;;EAEA;;EAEA,WAAW;;EAEX;EACA;;;;;;;;;;UA8MQ,aAAa,IAAI;EACzB,SAAS;;EAET,OAAO;;EAEP,YAAY;;;;;;QC77DN;;;YAGI;;YAEA;;QA0CJ;YACI;IACR;MACE,MAAM,aAAe;MACrB,SAAS"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-B3l1mtBq.mjs","sources":["../src/services/mcp.ts"],"sourcesContent":["import { Client } from \"@modelcontextprotocol/sdk/client/index.js\";\nimport {\n StreamableHTTPClientTransport,\n StreamableHTTPError,\n} from \"@modelcontextprotocol/sdk/client/streamableHttp.js\";\nimport { InMemoryTransport } from \"@modelcontextprotocol/sdk/inMemory.js\";\nimport { Server } from \"@modelcontextprotocol/sdk/server/index.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport {\n CallToolRequestSchema,\n CallToolResultSchema,\n ListResourcesRequestSchema,\n ListResourceTemplatesRequestSchema,\n ListToolsRequestSchema,\n McpError,\n ReadResourceRequestSchema,\n type CallToolRequest,\n type CallToolResult,\n type Tool,\n} from \"@modelcontextprotocol/sdk/types.js\";\nimport type { IReactorClient } from \"@powerhousedao/reactor\";\nimport { createServer } from \"@powerhousedao/reactor-mcp\";\nimport { resolveSwitchboardPortDefault } from \"@powerhousedao/shared/clis/args\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { getVersion } from \"../get-version.js\";\nimport {\n ensureVetra,\n restartVetra,\n currentPhCliRunVetraCommand,\n VetraStartError,\n type EnsureVetraOptions,\n type VetraCommand,\n} from \"../utils/vetra-launcher.js\";\nimport {\n readVetraRuntime,\n type VetraRuntimeRecord,\n} from \"../utils/vetra-runtime.js\";\n\nconst CALL_TIMEOUT_MS = 10 * 60_000;\nconst CONFIG_FILE = \"powerhouse.config.json\";\n\nexport type McpLauncherOptions = {\n projectDir?: string;\n startTimeoutSeconds: number;\n /** Test seam: what starts Vetra; defaults to {@link currentPhCliRunVetraCommand}. */\n vetraCommand?: VetraCommand;\n};\n\n/** The nearest directory at or above `start` holding powerhouse.config.json. */\nexport function findProjectDir(start: string): string | undefined {\n let dir = path.resolve(start);\n for (;;) {\n if (fs.existsSync(path.join(dir, CONFIG_FILE))) return dir;\n const parent = path.dirname(dir);\n if (parent === dir) return undefined;\n dir = parent;\n }\n}\n\n// The tool list never touches the reactor, so a client that throws on use is enough.\nconst reactorlessClient = new Proxy({} as IReactorClient, {\n get(_target, property) {\n if (property === \"then\") return undefined;\n return () => {\n throw new Error(\"reactor-mcp's local tool list has no reactor\");\n };\n },\n});\n\n/** reactor-mcp's own server, in-process, for the tool list and resources. */\nasync function connectLocalReactorMcp(): Promise<Client> {\n const server = await createServer({ client: reactorlessClient });\n const [clientSide, serverSide] = InMemoryTransport.createLinkedPair();\n await server.connect(serverSide);\n const client = new Client({ name: \"ph-mcp\", version: getVersion() });\n await client.connect(clientSide);\n return client;\n}\n\nfunction toolError(message: string): CallToolResult {\n return { isError: true, content: [{ type: \"text\", text: message }] };\n}\n\n/** The call never reached a live session: Vetra is down, or restarted since. */\nfunction isStaleConnection(error: unknown): boolean {\n if (error instanceof StreamableHTTPError) {\n return error.code === 404 || error.code === 400;\n }\n for (let e = error; e instanceof Error; e = e.cause) {\n if ((e as NodeJS.ErrnoException).code === \"ECONNREFUSED\") return true;\n }\n return false;\n}\n\nexport const RESTART_VETRA_TOOL = \"restartVetra\";\n\nconst restartVetraTool: Tool = {\n name: RESTART_VETRA_TOOL,\n description:\n \"Restart this project's Vetra (its Switchboard and Studio) and wait until it is ready. \" +\n \"Use it after a change Vetra reads only at startup, such as the reactor or packages settings \" +\n \"in powerhouse.config.json; Studio restarts by itself for connect.* changes. \" +\n \"Returns the new Connect, Switchboard and MCP URLs.\",\n inputSchema: { type: \"object\", properties: {} },\n outputSchema: {\n type: \"object\",\n properties: {\n pid: { type: \"number\" },\n connectUrl: { type: \"string\" },\n switchboardUrl: { type: \"string\" },\n mcpUrl: { type: \"string\" },\n },\n required: [\"pid\", \"mcpUrl\"],\n },\n};\n\nfunction vetraUrls(record: VetraRuntimeRecord) {\n return {\n pid: record.pid,\n ...(record.connectUrl ? { connectUrl: record.connectUrl } : {}),\n switchboardUrl:\n record.switchboardUrl ??\n `http://localhost:${record.switchboardPort}/graphql`,\n mcpUrl: record.mcpUrl || `http://localhost:${record.switchboardPort}/mcp`,\n };\n}\n\nfunction projectName(projectDir: string): string | undefined {\n try {\n const pkg = JSON.parse(\n fs.readFileSync(path.join(projectDir, \"package.json\"), \"utf8\"),\n ) as { name?: string };\n return pkg.name;\n } catch {\n return undefined;\n }\n}\n\n/** Connects to the project's Vetra `/mcp`, starting Vetra when it is down. */\ntype Progress = (message: string) => void;\n\nclass Upstream {\n #client: Promise<Client> | undefined;\n /** The Vetra the client talks to; another pid in the record means it restarted. */\n #pid: number | undefined;\n /** The calls waiting on the connection, told how Vetra's start goes. */\n #waiting = new Set<Progress>();\n\n constructor(\n private readonly projectDir: string | undefined,\n private readonly options: McpLauncherOptions,\n ) {}\n\n get(onProgress?: Progress): Promise<Client> {\n if (this.#client && this.#pid !== undefined && this.projectDir) {\n const pid = readVetraRuntime(this.projectDir)?.pid;\n if (pid !== this.#pid) this.reset();\n }\n this.#client ??= this.#connect(ensureVetra).catch((error: unknown) => {\n this.#client = undefined;\n throw error;\n });\n return this.#waitWith(this.#client, onProgress);\n }\n\n async #waitWith<T>(task: Promise<T>, onProgress?: Progress): Promise<T> {\n if (onProgress) this.#waiting.add(onProgress);\n try {\n return await task;\n } finally {\n if (onProgress) this.#waiting.delete(onProgress);\n }\n }\n\n #report = (message: string) => {\n for (const progress of this.#waiting) progress(message);\n };\n\n reset(): void {\n const stale = this.#client;\n this.#client = undefined;\n this.#pid = undefined;\n void stale?.then((client) => client.close()).catch(() => {});\n }\n\n /** Restarts Vetra and connects to the new one; resolves to its record. */\n async restart(onProgress?: Progress): Promise<VetraRuntimeRecord> {\n this.reset();\n let record: VetraRuntimeRecord | undefined;\n const connected = this.#connect(async (options) => {\n record = await restartVetra(options);\n return record;\n });\n this.#client = connected.catch((error: unknown) => {\n this.#client = undefined;\n throw error;\n });\n await this.#waitWith(this.#client, onProgress);\n return record!;\n }\n\n async #connect(\n start: (options: EnsureVetraOptions) => Promise<VetraRuntimeRecord>,\n ): Promise<Client> {\n const { projectDir } = this;\n if (!projectDir) {\n throw new VetraStartError(\n `No Powerhouse project (${CONFIG_FILE}) at or above ${process.cwd()}. Run \\`ph mcp\\` inside the project, or pass --project-dir.`,\n );\n }\n const name = projectName(projectDir);\n if (!name) {\n throw new VetraStartError(`${projectDir} has no package.json name.`);\n }\n console.error(`[ph mcp] connecting to Vetra for ${name}...`);\n const record = await start({\n projectDir,\n projectName: name,\n switchboardPort: resolveSwitchboardPortDefault(),\n command: this.options.vetraCommand ?? currentPhCliRunVetraCommand(),\n timeoutMs: this.options.startTimeoutSeconds * 1000,\n onProgress: this.#report,\n });\n const { mcpUrl } = vetraUrls(record);\n const client = new Client({ name: \"ph-mcp\", version: getVersion() });\n await client.connect(new StreamableHTTPClientTransport(new URL(mcpUrl)));\n this.#pid = record.pid;\n console.error(`[ph mcp] forwarding tool calls to ${mcpUrl}`);\n return client;\n }\n}\n\nasync function forwardToolCall(\n upstream: Upstream,\n params: CallToolRequest[\"params\"],\n signal: AbortSignal,\n onProgress: Progress,\n): Promise<CallToolResult> {\n for (let attempt = 0; ; attempt++) {\n const client = await upstream.get(onProgress);\n try {\n return await client.request(\n { method: \"tools/call\", params },\n CallToolResultSchema,\n { signal, timeout: CALL_TIMEOUT_MS },\n );\n } catch (error) {\n // It never arrived: Vetra went away or restarted, so find or start it again.\n if (attempt > 0 || !isStaleConnection(error)) throw error;\n upstream.reset();\n }\n }\n}\n\n/** `ph mcp`: tools listed by in-process reactor-mcp, calls forwarded to Vetra (started on first call). */\nexport async function startMcpLauncher(options: McpLauncherOptions) {\n // stdout carries JSON-RPC only.\n console.log = console.error;\n console.info = console.error;\n\n const projectDir = findProjectDir(\n options.projectDir ?? process.env.PH_CALLER_CWD ?? process.cwd(),\n );\n // Port resolution and `ph run vetra` both read the project from the cwd.\n if (projectDir) process.chdir(projectDir);\n\n const local = await connectLocalReactorMcp();\n const upstream = new Upstream(projectDir, options);\n const server = new Server(\n local.getServerVersion() ?? { name: \"reactor-mcp-server\", version: \"\" },\n {\n capabilities: { tools: {}, resources: {} },\n instructions: local.getInstructions(),\n },\n );\n\n server.setRequestHandler(ListToolsRequestSchema, async (request) => {\n const listed = await local.listTools(request.params);\n return { ...listed, tools: [...listed.tools, restartVetraTool] };\n });\n server.setRequestHandler(ListResourcesRequestSchema, (request) =>\n local.listResources(request.params),\n );\n server.setRequestHandler(ListResourceTemplatesRequestSchema, (request) =>\n local.listResourceTemplates(request.params),\n );\n server.setRequestHandler(ReadResourceRequestSchema, (request) =>\n local.readResource(request.params),\n );\n server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {\n // How Vetra's start goes: progress notifications when the client asked, else stderr.\n const token = request.params._meta?.progressToken;\n let progress = 0;\n const onProgress: Progress = (message) => {\n if (token === undefined) {\n console.error(`[ph mcp] ${message}`);\n return;\n }\n void extra\n .sendNotification({\n method: \"notifications/progress\",\n params: { progressToken: token, progress: ++progress, message },\n })\n .catch(() => {});\n };\n try {\n if (request.params.name === RESTART_VETRA_TOOL) {\n const urls = vetraUrls(await upstream.restart(onProgress));\n return {\n content: [{ type: \"text\", text: JSON.stringify(urls) }],\n structuredContent: urls,\n };\n }\n return await forwardToolCall(\n upstream,\n request.params,\n extra.signal,\n onProgress,\n );\n } catch (error) {\n // Protocol errors from reactor-mcp reach the agent as they would over HTTP.\n if (error instanceof McpError) throw error;\n const message = error instanceof Error ? error.message : String(error);\n return toolError(\n error instanceof VetraStartError\n ? message\n : `reactor-mcp request failed: ${message}`,\n );\n }\n });\n\n const transport = new StdioServerTransport();\n transport.onclose = () => process.exit(0);\n process.stdin.once(\"end\", () => process.exit(0));\n await server.connect(transport);\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAuCA,MAAM,kBAAkB;AACxB,MAAM,cAAc;;AAUpB,SAAgB,eAAe,OAAmC;CAChE,IAAI,MAAM,KAAK,QAAQ,KAAK;CAC5B,SAAS;EACP,IAAI,GAAG,WAAW,KAAK,KAAK,KAAK,WAAW,CAAC,GAAG,OAAO;EACvD,MAAM,SAAS,KAAK,QAAQ,GAAG;EAC/B,IAAI,WAAW,KAAK,OAAO,KAAA;EAC3B,MAAM;CACR;AACF;AAGA,MAAM,oBAAoB,IAAI,MAAM,CAAC,GAAqB,EACxD,IAAI,SAAS,UAAU;CACrB,IAAI,aAAa,QAAQ,OAAO,KAAA;CAChC,aAAa;EACX,MAAM,IAAI,MAAM,8CAA8C;CAChE;AACF,EACF,CAAC;;AAGD,eAAe,yBAA0C;CACvD,MAAM,SAAS,MAAM,aAAa,EAAE,QAAQ,kBAAkB,CAAC;CAC/D,MAAM,CAAC,YAAY,cAAc,kBAAkB,iBAAiB;CACpE,MAAM,OAAO,QAAQ,UAAU;CAC/B,MAAM,SAAS,IAAI,OAAO;EAAE,MAAM;EAAU,SAAS,WAAW;CAAE,CAAC;CACnE,MAAM,OAAO,QAA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K,aAAa,QAAQ,KAAK,CAAC,CAAC;CAC/C,MAAM,OAAO,QAAQ,SAAS;AAChC","debug_id":"23813e6f-3dfd-5ada-a527-3c6cb5b74760"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { t as migrateSubgraphs } from "./migrate-subgraphs-CfSMlcJD.mjs";
|
|
2
|
-
export { migrateSubgraphs };
|
|
3
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1f84811a-aa28-59cb-81db-77abbbcccdfc")}catch(e){}}();
|
|
4
|
-
//# debugId=1f84811a-aa28-59cb-81db-77abbbcccdfc
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ph-cli-commands-CQXdWQ74.mjs","sources":["../src/commands/access-token.ts","../src/commands/build.ts","../src/commands/connect.ts","../src/commands/generate-all.ts","../src/utils/fs-args.ts","../src/utils/comma-separated.ts","../src/commands/generate-app.ts","../src/commands/generate-connect-routes.ts","../src/commands/generate-desktop-shell.ts","../src/commands/generate-document-model.ts","../src/commands/generate-editor.ts","../src/commands/generate-hosts.ts","../src/commands/generate-migration-file.ts","../src/commands/generate-piece-action.ts","../src/commands/generate-piece-trigger.ts","../src/commands/generate-piece.ts","../src/commands/generate-processor.ts","../src/commands/generate-subgraph.ts","../src/commands/generate.ts","../src/commands/host.ts","../src/commands/init.ts","../src/commands/inspect.ts","../src/commands/install.ts","../src/commands/keyframes.ts","../src/commands/list.ts","../src/commands/login.ts","../src/commands/logout.ts","../src/commands/mcp.ts","../src/commands/migrate.ts","../src/commands/model.ts","../src/commands/publish.ts","../src/commands/registry-login.ts","../src/commands/run.ts","../src/commands/uninstall.ts","../src/commands/unpublish.ts","../src/commands/vetra.ts","../src/commands/ph-cli-commands.ts"],"sourcesContent":["import { accessTokenArgs } from \"@powerhousedao/shared/clis/args\";\nimport { DEFAULT_EXPIRY_SECONDS } from \"@powerhousedao/shared/clis/constants\";\nimport { command } from \"cmd-ts\";\n\nexport const accessToken = command({\n name: \"access-token\",\n description: `\nThe access-token command generates a bearer token for API authentication. This token\ncan be used to authenticate requests to Powerhouse APIs like reactor-api (Switchboard).\n\nThis command:\n1. Uses your CLI's cryptographic identity (DID) to sign a verifiable credential\n2. Creates a JWT bearer token with configurable expiration\n3. Outputs the token to stdout (info to stderr) for easy piping\n\nPrerequisites:\n You must have a cryptographic identity. Run 'ph login' first to:\n - Generate a keypair (stored in .ph/.keypair.json)\n - Optionally link your Ethereum address (stored in .ph/.renown.json)\n\nToken Details:\n The generated token is a JWT (JSON Web Token) containing:\n - Issuer (iss): Your CLI's DID (did:key:...)\n - Subject (sub): Your CLI's DID\n - Credential Subject: Chain ID, network ID, and address (if authenticated)\n - Expiration (exp): Based on --expiry option\n - Audience (aud): If --audience is specified\n\nOutput:\n- Token information (DID, address, expiry) is printed to stderr\n- The token itself is printed to stdout for easy piping/copying\n\nThis allows you to use the command in scripts:\n TOKEN=$(ph access-token)\n curl -H \"Authorization: Bearer $TOKEN\" http://localhost:4001/graphql\n\nUsage with APIs:\n Generate token and use with curl\n TOKEN=$(ph access-token --expiry 1d)\n curl -X POST http://localhost:4001/graphql \\\\\n -H \"Content-Type: application/json\" \\\\\n -H \"Authorization: Bearer $TOKEN\" \\\\\n -d '{\"query\": \"{ drives { id name } }\"}'\n\n Export as environment variable\n export PH_ACCESS_TOKEN=$(ph access-token)\n\nNotes:\n - Tokens are self-signed using your CLI's private key\n - No network request is made; tokens are generated locally\n - The recipient API must trust your CLI's DID to accept the token\n - For reactor-api, ensure AUTH_ENABLED=true to require authentication\n`,\n args: accessTokenArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { generateAccessToken, parseExpiry, formatExpiry } =\n await import(\"@renown/sdk/node\");\n const { getRenown } = await import(\"../services/auth.js\");\n const renown = await getRenown();\n\n let expiresIn = DEFAULT_EXPIRY_SECONDS;\n if (args.expiry) expiresIn = parseExpiry(args.expiry);\n\n const result = await generateAccessToken(renown, {\n expiresIn,\n aud: args.audience,\n });\n\n // Output token info to stderr, token itself to stdout for piping\n console.error(`CLI DID: ${result.did}`);\n console.error(`ETH Address: ${result.address}`);\n console.error(`Token expires in: ${formatExpiry(expiresIn)}`);\n console.error(\"\");\n\n console.log(result.token);\n process.exit(0);\n },\n});\n","import { buildArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const build = command({\n name: \"build\",\n description: `\nBuild a Powerhouse package for publishing: a browser bundle and a node bundle of its\ndocument models, scalars, editors, subgraphs and processors, type declarations, and its\nstylesheet.\n\nPieces under pieces/ are built too, each into its own self-contained module under\ndist/node/pieces/<name>, with a descriptor.json and package.json written beside it and\nthe piece listed in dist/powerhouse.manifest.json. A piece takes the package's version: an\nentry in pieces/index.ts that declares version fails the build. A package that ships only\npieces is an ordinary package: it carries the same boilerplate, and every step above runs\nfor it too.\n\ntsc runs first. If it reports type errors the build asks whether to go ahead, and stops\nwhere it can't ask. --ignore-type-errors builds without asking; a package built that way\ncan load and still fail at runtime, so don't publish it.`,\n args: buildArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n try {\n const { runBuild } = await import(\"../services/build.js\");\n await runBuild(args, { checkDefinitions: true, ownsProcess: true });\n } catch (error) {\n // The message includes its cause; --debug adds the stack and the cause again.\n console.error(\n args.debug || !(error instanceof Error) ? error : error.message,\n );\n process.exit(1);\n }\n },\n});\n","import { connectConfigArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, subcommands } from \"cmd-ts\";\n\nexport const config = command({\n name: \"config\",\n description: `Read or update Connect's runtime configuration (powerhouse.config.json).\n\nModes (mutually exclusive — positional, --get, --json, and field flags cannot be combined):\n ph connect config List the effective connect.* block (defaults < source).\n ph connect config <key> Get the value at the dotted path (e.g. ph connect config connect.renown.url).\n ph connect config --get <dotted.path> Same as positional <key> (kept for backward compat).\n ph connect config <key> <value> Set a single field and dual-write to source + dist (positional).\n ph connect config --<field> <value> Set a single field via per-field flag (e.g. --renown-url https://renown.id).\n ph connect config --json '{\"renown\":{\"url\":\"…\"}}'\n Bulk-set multiple fields and dual-write. The payload is the connect.*\n block without the \"connect\" wrapper; unknown keys are rejected.\n\nWrites go to:\n - <project>/powerhouse.config.json (source — picked up by the next build)\n - <dist-dir>/powerhouse.config.json (if it exists — the currently-served SPA picks it up on refresh)\n`,\n args: connectConfigArgs,\n handler: async (args) => {\n const { runConnectConfig } = await import(\"../services/connect-config.js\");\n await runConnectConfig(args);\n },\n});\n\n// `ph connect`, `ph connect studio`, `ph connect build` and\n// `ph connect preview` never reach this command: they are sugar for\n// `ph run connect dev|build|serve` (utils/run-sugar.ts).\nexport const connect = subcommands({\n name: \"connect\",\n description: `Powerhouse Connect. \\`ph connect\\` runs the project's connect host: it is \\`ph run connect dev\\`, as is \\`ph connect studio\\`; \\`ph connect build\\` is \\`ph run connect build\\` and \\`ph connect preview\\` is \\`ph run connect serve\\`. \\`ph connect config\\` reads and writes Connect's runtime configuration.`,\n cmds: {\n config,\n },\n});\n","import { command, flag } from \"cmd-ts\";\n\nexport const generateAllCmd = command({\n name: \"all\",\n description: \"Re-generate all modules in the current project\",\n args: {\n extract: flag({\n long: \"extract\",\n short: \"x\",\n description:\n \"Instead of generating code, write a spec for every module into specs/ (one-shot migration to documents-as-source-of-truth)\",\n }),\n },\n handler: async (args) => {\n const { startGenerateAll } = await import(\"../services/generate-all.js\");\n await startGenerateAll(args, process.cwd());\n process.exit(0);\n },\n});\n","import { extendType, string, type Type } from \"cmd-ts\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\n// cmd-ts's `batteries/fs`, rebuilt on the root entry so bun never loads its CJS build.\n\nconst ExistingPath: Type<string, string> = extendType(string, {\n displayName: \"path\",\n description: \"An existing path\",\n from(str) {\n const resolved = path.resolve(str);\n if (!fs.existsSync(resolved)) {\n return Promise.reject(new Error(\"Path doesn't exist\"));\n }\n return Promise.resolve(resolved);\n },\n});\n\n/** A directory, or the directory of a given file. */\nexport const Directory: Type<string, string> = extendType(ExistingPath, {\n displayName: \"dir\",\n description: \"A path to a directory or a file within a directory\",\n from(resolved) {\n return Promise.resolve(\n fs.statSync(resolved).isDirectory() ? resolved : path.dirname(resolved),\n );\n },\n});\n\n/** An existing file. */\nexport const File: Type<string, string> = extendType(ExistingPath, {\n displayName: \"file\",\n description: \"A file in the file system\",\n from(resolved) {\n if (!fs.statSync(resolved).isFile()) {\n return Promise.reject(new Error(\"Provided path is not a file\"));\n }\n return Promise.resolve(resolved);\n },\n});\n\n/** A module's directory name or path, resolved by the command against the project. */\nexport const ModuleDir: Type<string, string> = extendType(string, {\n displayName: \"dir\",\n description: \"A module's directory name or path\",\n from: (dir) => Promise.resolve(dir),\n});\n","import type { Type } from \"cmd-ts\";\n\n/** Splits comma-separated values so `-t \"a,b\"` means the same as `-t a -t b`\n * instead of yielding the single value `\"a,b\"`, which matches nothing. */\nexport function splitCommaSeparated(values: string[]): string[] {\n return values\n .flatMap((value) => value.split(\",\"))\n .map((value) => value.trim())\n .filter((value) => value.length > 0);\n}\n\n/** `multioption` type accepting repeated and/or comma-separated values. */\nexport const CommaSeparatedStrings: Type<string[], string[]> = {\n from: (values) => Promise.resolve(splitCommaSeparated(values)),\n};\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport {\n boolean,\n command,\n flag,\n multioption,\n option,\n optional,\n string,\n} from \"cmd-ts\";\nimport { File, ModuleDir } from \"../utils/fs-args.js\";\nimport { CommaSeparatedStrings } from \"../utils/comma-separated.js\";\n\nexport const generateAppCmd = command({\n name: \"app\",\n description: \"Generate a drive app\",\n args: {\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the drive app to generate\",\n }),\n allowedDocumentTypes: multioption({\n type: optional(CommaSeparatedStrings),\n long: \"document-types\",\n short: \"t\",\n description:\n \"The document types allowed by the new app (repeatable or comma-separated)\",\n }),\n document: option({\n type: optional(File),\n long: \"document\",\n short: \"d\",\n description:\n \"Path to a powerhouse/app spec file (.phd or .json) to drive codegen\",\n }),\n dir: option({\n type: optional(ModuleDir),\n long: \"dir\",\n description:\n \"Name of the directory of an existing app to re-generate (my-app or editors/my-app)\",\n }),\n disableDragAndDrop: flag({\n type: boolean,\n long: \"disable-drag-and-drop\",\n description: \"Do not allow drag and drop in this drive app.\",\n defaultValue: () => false as const,\n defaultValueIsSerializable: true,\n }),\n all: flag({\n long: \"all\",\n short: \"a\",\n description: \"Re-generate all existing apps in the current project\",\n }),\n extract: flag({\n long: \"extract\",\n short: \"x\",\n description:\n \"Write a powerhouse/app spec for each existing drive app into specs/apps/\",\n }),\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGenerateApp } = await import(\"../services/generate-app.js\");\n await startGenerateApp(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const generateConnectRoutesCmd = command({\n name: \"connect-routes\",\n description:\n \"Generate .ph/connect-routes.gen.ts, the route tree hosts/connect/routes/ type-checks against, and fail if a route the package offers imports @powerhousedao/connect\",\n args: { ...debugArgs },\n handler: async () => {\n const { syncProjectConnectRoutes } =\n await import(\"../utils/sync-connect-routes.js\");\n const { checkOfferedRoutesImports } =\n await import(\"../utils/offered-routes-imports.js\");\n await syncProjectConnectRoutes(process.cwd());\n // npm run tsc and lint run this first: they fail where `ph build` would.\n await checkOfferedRoutesImports(process.cwd());\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, flag, option, optional, string } from \"cmd-ts\";\n\nexport const generateDesktopShellCmd = command({\n name: \"desktop-shell\",\n description:\n \"Scaffold a builder-owned desktop identity (hosts/desktop/app.json + icon). \" +\n \"`ph run desktop dev|build` then projects it into a native Tauri shell — no Rust.\",\n args: {\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description:\n \"Product name (window title + macOS app name). Default: the project's package name.\",\n }),\n identifier: option({\n type: optional(string),\n long: \"identifier\",\n short: \"i\",\n description:\n \"Reverse-DNS app identifier, e.g. com.acme.app. Default: inc.powerhouse.desktop.<project>.\",\n }),\n force: flag({\n long: \"force\",\n short: \"f\",\n description:\n \"Overwrite an existing app.json (protects edits by default).\",\n }),\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGenerateDesktopShell } =\n await import(\"../services/generate-desktop-shell.js\");\n startGenerateDesktopShell(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, flag, option, optional, string } from \"cmd-ts\";\nimport { File, ModuleDir } from \"../utils/fs-args.js\";\nexport const generateDocumentModelCmd = command({\n name: \"document-model\",\n aliases: [\"doc\"],\n description: \"Generate a document model\",\n args: {\n document: option({\n type: optional(File),\n long: \"document\",\n short: \"d\",\n description:\n \"Path to a document model spec (.phd or .json) to generate from\",\n }),\n dir: option({\n type: optional(ModuleDir),\n long: \"dir\",\n description:\n \"Name of the directory of an existing document model to re-generate (my-document-model or document-models/my-document-model)\",\n }),\n all: flag({\n long: \"all\",\n short: \"a\",\n description:\n \"Re-generate all existing document models in the current project\",\n }),\n extract: flag({\n long: \"extract\",\n short: \"x\",\n description:\n \"Write a powerhouse/document-model spec for each existing document model into specs/document-models/\",\n }),\n /** @experimental Code-first scaffolding is being tested in production. */\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description:\n \"Experimental. Create a code-first document model with this name, with its editor\",\n }),\n /** @experimental Chooses code-first authoring for the model --name creates. */\n codeFirst: flag({\n long: \"code-first\",\n description:\n \"Experimental. With --name, create the model code-first. Existing models of both styles are discovered without it; ph migrate --document-model converts a schema-first one\",\n }),\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGenerateDocumentModel } =\n await import(\"../services/generate-document-model.js\");\n await startGenerateDocumentModel(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, flag, option, optional, string } from \"cmd-ts\";\nimport { File, ModuleDir } from \"../utils/fs-args.js\";\n\nexport const generateEditorCmd = command({\n name: \"editor\",\n description: \"Generate a document editor\",\n args: {\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the document editor to generate\",\n }),\n documentType: option({\n type: optional(string),\n long: \"document-type\",\n short: \"t\",\n description: \"The document type for the new editor\",\n }),\n document: option({\n type: optional(File),\n long: \"document\",\n short: \"d\",\n description:\n \"Path to a powerhouse/document-editor spec file (.phd or .json) to drive codegen\",\n }),\n dir: option({\n type: optional(ModuleDir),\n long: \"dir\",\n description:\n \"Name of the directory of an existing editor to re-generate (my-editor or editors/my-editor)\",\n }),\n all: flag({\n long: \"all\",\n short: \"a\",\n description: \"Re-generate all existing editors in the current project\",\n }),\n extract: flag({\n long: \"extract\",\n short: \"x\",\n description:\n \"Write a powerhouse/document-editor spec for each existing editor into specs/editors/\",\n }),\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGenerateEditor } =\n await import(\"../services/generate-editor.js\");\n await startGenerateEditor(args, process.cwd());\n process.exit(0);\n },\n});\n","import { command } from \"cmd-ts\";\n\nexport const generateHostsCmd = command({\n name: \"hosts\",\n description:\n \"Generate hosts/<name>/outputs.js + outputs.d.ts (typed $output token trees) for every host whose runner declares outputs, and refresh hosts/types.d.ts. Rerun after changing a producer's runner or declared drives: a stale outputs.js fails the load.\",\n args: {},\n handler: async () => {\n const { startGenerateHosts } =\n await import(\"../services/generate-hosts.js\");\n const ok = await startGenerateHosts(process.cwd());\n process.exit(ok ? 0 : 1);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, option, optional, string } from \"cmd-ts\";\nimport { skipInstallArgs } from \"../utils/install-added-dependencies.js\";\n\nexport const generateMigrationFileCmd = command({\n name: \"migration-file\",\n description: \"Generate a migration file\",\n args: {\n migrationFile: option({\n type: string,\n long: \"path\",\n short: \"p\",\n description: \"Path to the migration file\",\n }),\n schemaFile: option({\n type: optional(string),\n long: \"schema-file\",\n description: \"Path to the output file. Defaults to './schema.ts'\",\n }),\n ...skipInstallArgs,\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGenerateMigrationFile } =\n await import(\"../services/generate-migration-file.js\");\n await startGenerateMigrationFile(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport {\n command,\n number,\n oneOf,\n option,\n optional,\n positional,\n string,\n} from \"cmd-ts\";\nimport { skipInstallArgs } from \"../utils/install-added-dependencies.js\";\n\nexport const generatePieceActionCmd = command({\n name: \"piece-action\",\n description: \"Generate an action inside an existing piece\",\n args: {\n namePositional: positional({\n type: optional(string),\n displayName: \"name\",\n description: \"The name of the action, e.g. get-record\",\n }),\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the action to generate\",\n }),\n piece: option({\n type: optional(string),\n long: \"piece\",\n short: \"p\",\n description:\n \"The piece directory under pieces/ to add the action to. Optional when the project ships exactly one piece.\",\n }),\n requireReactor: option({\n type: optional(oneOf([\"read\", \"write\"] as const)),\n long: \"require-reactor\",\n description:\n \"Declare reactor access for the action: read, or write (which includes read). The action then gets context.reactor\",\n }),\n defaultTimeoutSeconds: option({\n type: optional(number),\n long: \"default-timeout-seconds\",\n description:\n \"Write defaultTimeoutSeconds: the step timeout used when the workflow sets none\",\n }),\n defaultMaxAttempts: option({\n type: optional(number),\n long: \"default-max-attempts\",\n description:\n \"Write defaultRetry: { maxAttempts }: the attempts (1 is no retry) used when the workflow sets no retry\",\n }),\n ...skipInstallArgs,\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGeneratePieceAction } =\n await import(\"../services/generate-piece-action.js\");\n await startGeneratePieceAction(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, oneOf, option, optional, positional, string } from \"cmd-ts\";\nimport { skipInstallArgs } from \"../utils/install-added-dependencies.js\";\n\nexport const generatePieceTriggerCmd = command({\n name: \"piece-trigger\",\n description: \"Generate a trigger inside an existing piece\",\n args: {\n namePositional: positional({\n type: optional(string),\n displayName: \"name\",\n description: \"The name of the trigger, e.g. new-record\",\n }),\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the trigger to generate\",\n }),\n piece: option({\n type: optional(string),\n long: \"piece\",\n short: \"p\",\n description:\n \"The piece directory under pieces/ to add the trigger to. Optional when the project ships exactly one piece.\",\n }),\n strategy: option({\n type: oneOf([\"polling\", \"webhook\"] as const),\n long: \"strategy\",\n description:\n \"How the trigger fires: polled on a schedule, or delivered to a webhook\",\n defaultValue: () => \"polling\" as const,\n defaultValueIsSerializable: true,\n }),\n requireReactor: option({\n type: optional(oneOf([\"read\", \"write\"] as const)),\n long: \"require-reactor\",\n description:\n \"Declare reactor access for the trigger: read, or write (which includes read). Its hooks then get context.reactor\",\n }),\n ...skipInstallArgs,\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGeneratePieceTrigger } =\n await import(\"../services/generate-piece-trigger.js\");\n await startGeneratePieceTrigger(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport {\n command,\n flag,\n oneOf,\n option,\n optional,\n positional,\n string,\n} from \"cmd-ts\";\nimport { ModuleDir } from \"../utils/fs-args.js\";\nimport { skipInstallArgs } from \"../utils/install-added-dependencies.js\";\n\nexport const generatePieceCmd = command({\n name: \"piece\",\n description:\n \"Generate a piece: a connector whose actions and triggers a workflow can call\",\n args: {\n namePositional: positional({\n type: optional(string),\n displayName: \"name\",\n description:\n \"The name of the piece to generate. Its directory is the kebab-case of this.\",\n }),\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the piece to generate\",\n }),\n id: option({\n type: optional(string),\n long: \"id\",\n description:\n \"The piece id, the pieceName a workflow step holds, e.g. @acme/piece-crm. Defaults to one derived from the package name.\",\n }),\n auth: option({\n type: oneOf([\"none\", \"secret\", \"custom\"] as const),\n long: \"auth\",\n description: \"The kind of connection the piece asks for\",\n defaultValue: () => \"custom\" as const,\n defaultValueIsSerializable: true,\n }),\n description: option({\n type: optional(string),\n long: \"description\",\n description: \"One line describing what the piece connects to\",\n }),\n dir: option({\n type: optional(ModuleDir),\n long: \"dir\",\n description:\n \"Name of the directory of an existing piece to re-register (my-piece or pieces/my-piece)\",\n }),\n all: flag({\n long: \"all\",\n short: \"a\",\n description:\n \"Re-register every piece in pieces/: refresh the pieces list and the manifest, and prune what is gone\",\n }),\n ...skipInstallArgs,\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGeneratePiece } =\n await import(\"../services/generate-piece.js\");\n await startGeneratePiece(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { PROCESSOR_APPS } from \"@powerhousedao/shared/processors\";\nimport type { Type } from \"cmd-ts\";\nimport {\n command,\n flag,\n multioption,\n oneOf,\n option,\n optional,\n string,\n} from \"cmd-ts\";\nimport { File, ModuleDir } from \"../utils/fs-args.js\";\nimport {\n CommaSeparatedStrings,\n splitCommaSeparated,\n} from \"../utils/comma-separated.js\";\nimport { skipInstallArgs } from \"../utils/install-added-dependencies.js\";\n\nconst ProcessorAppType: Type<string[], (\"connect\" | \"switchboard\")[]> = {\n from(rawProcessorApps) {\n const processorApps = splitCommaSeparated(rawProcessorApps);\n if (processorApps.length === 0) {\n throw new Error(\n `No arguments provided for processor apps. Must be \"connect\" and/or \"switchboard\"`,\n );\n }\n if (processorApps.length > 2) {\n throw new Error(\n `Too many arguments provided for processor apps. Must be \"connect\" and/or \"switchboard\"`,\n );\n }\n const allowed = new Set(PROCESSOR_APPS);\n if (\n !processorApps.every((p) => allowed.has(p as \"connect\" | \"switchboard\"))\n ) {\n throw new Error(\n `Processor apps can only be \"connect\" and/or \"switchboard\".`,\n );\n }\n return Promise.resolve(processorApps as (\"connect\" | \"switchboard\")[]);\n },\n};\nexport const generateProcessorCmd = command({\n name: \"processor\",\n description: \"Generate a processor\",\n args: {\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the processor to generate\",\n }),\n type: option({\n type: oneOf([\"analytics\", \"relationalDb\"] as const),\n long: \"type\",\n description: \"The type of processor to generate\",\n defaultValue: () => \"analytics\" as const,\n defaultValueIsSerializable: true,\n }),\n documentTypes: multioption({\n type: CommaSeparatedStrings,\n long: \"document-types\",\n short: \"t\",\n description:\n \"The document types the processor will run on (repeatable or comma-separated)\",\n defaultValue: () => [],\n defaultValueIsSerializable: true,\n }),\n apps: multioption({\n long: \"apps\",\n type: ProcessorAppType,\n description:\n \"Whether the processor will run in switchboard (nodejs), connect (browser), or both\",\n defaultValue: () => [\"switchboard\" as const, \"connect\" as const],\n defaultValueIsSerializable: true,\n }),\n document: option({\n type: optional(File),\n long: \"document\",\n short: \"d\",\n description:\n \"Path to a powerhouse/processor spec file (.phd or .json) to drive codegen\",\n }),\n dir: option({\n type: optional(ModuleDir),\n long: \"dir\",\n description:\n \"Name of the directory of an existing processor to re-generate (my-processor or processors/my-processor)\",\n }),\n all: flag({\n long: \"all\",\n short: \"a\",\n description: \"Re-generate all existing processors in the current project\",\n }),\n extract: flag({\n long: \"extract\",\n short: \"x\",\n description:\n \"Write a powerhouse/processor spec for each existing processor into specs/processors/\",\n }),\n ...skipInstallArgs,\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGenerateProcessor } =\n await import(\"../services/generate-processor.js\");\n await startGenerateProcessor(args, process.cwd());\n process.exit(0);\n },\n});\n","import { debugArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, flag, option, optional, string } from \"cmd-ts\";\nimport { File, ModuleDir } from \"../utils/fs-args.js\";\nimport { skipInstallArgs } from \"../utils/install-added-dependencies.js\";\n\nexport const generateSubgraphCmd = command({\n name: \"subgraph\",\n description: \"Generate a subgraph\",\n args: {\n name: option({\n type: optional(string),\n long: \"name\",\n short: \"n\",\n description: \"The name of the subgraph to generate\",\n }),\n document: option({\n type: optional(File),\n long: \"document\",\n short: \"d\",\n description:\n \"Path to a powerhouse/subgraph spec file (.phd or .json) to drive codegen\",\n }),\n dir: option({\n type: optional(ModuleDir),\n long: \"dir\",\n description:\n \"Name of the directory of an existing subgraph to re-generate (my-subgraph or subgraphs/my-subgraph)\",\n }),\n all: flag({\n long: \"all\",\n short: \"a\",\n description: \"Re-generate all existing subgraphs in the current project\",\n }),\n extract: flag({\n long: \"extract\",\n short: \"x\",\n description:\n \"Write a powerhouse/subgraph spec for each existing subgraph into specs/subgraphs/\",\n }),\n /** @experimental */\n codeFirst: flag({\n long: \"code-first\",\n description:\n \"Experimental. With --name or --document, create a new subgraph code-first. Existing subgraphs keep their own style; ph migrate --subgraph converts one\",\n }),\n ...skipInstallArgs,\n ...debugArgs,\n },\n handler: async (args) => {\n const { startGenerateSubgraph } =\n await import(\"../services/generate-subgraph.js\");\n await startGenerateSubgraph(args, process.cwd());\n process.exit(0);\n },\n});\n","import { subcommands } from \"cmd-ts\";\nimport { generateAllCmd } from \"./generate-all.js\";\nimport { generateAppCmd } from \"./generate-app.js\";\nimport { generateConnectRoutesCmd } from \"./generate-connect-routes.js\";\nimport { generateDesktopShellCmd } from \"./generate-desktop-shell.js\";\nimport { generateDocumentModelCmd } from \"./generate-document-model.js\";\nimport { generateEditorCmd } from \"./generate-editor.js\";\nimport { generateHostsCmd } from \"./generate-hosts.js\";\nimport { generateMigrationFileCmd } from \"./generate-migration-file.js\";\nimport { generatePieceActionCmd } from \"./generate-piece-action.js\";\nimport { generatePieceTriggerCmd } from \"./generate-piece-trigger.js\";\nimport { generatePieceCmd } from \"./generate-piece.js\";\nimport { generateProcessorCmd } from \"./generate-processor.js\";\nimport { generateSubgraphCmd } from \"./generate-subgraph.js\";\n\n/** Exported for tests. */\nexport const generateCmds = {\n all: generateAllCmd,\n \"document-model\": generateDocumentModelCmd,\n editor: generateEditorCmd,\n app: generateAppCmd,\n processor: generateProcessorCmd,\n subgraph: generateSubgraphCmd,\n piece: generatePieceCmd,\n \"piece-action\": generatePieceActionCmd,\n \"piece-trigger\": generatePieceTriggerCmd,\n \"migration-file\": generateMigrationFileCmd,\n \"connect-routes\": generateConnectRoutesCmd,\n \"desktop-shell\": generateDesktopShellCmd,\n hosts: generateHostsCmd,\n} as const;\n\nexport const generate = subcommands({\n name: \"generate\",\n description: `The generate command creates code for Powerhouse modules. It helps you create new code from scratch, or to re-generate existing code in your project.`,\n cmds: generateCmds,\n});\n","import { hostCheckArgs, hostExportArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command, subcommands } from \"cmd-ts\";\n\nexport const check = command({\n name: \"check\",\n description:\n \"Check a host the way `ph run` would, without starting it: every load, \" +\n \"validation, resolution and boot issue, grouped by host file. Exits 1 \" +\n \"on any issue. `--env <file>` checks against that file alone.\",\n args: hostCheckArgs,\n handler: async (args) => {\n const { runHostCheck } = await import(\"../services/host/check.js\");\n const { output, exitCode } = await runHostCheck(args);\n console.log(output);\n // Not process.exit: on macOS a piped stdout is async and would be cut.\n process.exitCode = exitCode;\n },\n});\n\n// `export` is a reserved word.\nexport const exportCmd = command({\n name: \"export\",\n description:\n \"Print a host as declared, with every member a compound names, as JSON \" +\n \"(tokens unresolved). `--out` writes it to a file instead.\",\n args: hostExportArgs,\n handler: async (args) => {\n const { runHostExport } = await import(\"../services/host/export.js\");\n const { stdout, stderr, exitCode } = await runHostExport(args);\n if (stdout !== undefined) process.stdout.write(stdout);\n if (stderr !== undefined) process.stderr.write(stderr);\n process.exitCode = exitCode;\n },\n});\n\nexport const host = subcommands({\n name: \"host\",\n description: \"Inspect the project's hosts/: `check`, `export`.\",\n cmds: { check, export: exportCmd },\n});\n","import { initArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const init = command({\n name: \"init\",\n description: \"Initialize a new project\",\n args: initArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log({ args });\n }\n const { startInit } = await import(\"../services/init.js\");\n await startInit(args);\n process.exit(0);\n },\n});\n","import { inspectArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const inspect = command({\n name: \"inspect\",\n description: `\nThe inspect command examines and provides detailed information about a Powerhouse package.\nIt helps you understand the structure, dependencies, and configuration of packages in\nyour project.\n\nThis command:\n1. Analyzes the specified package\n2. Retrieves detailed information about its structure and configuration\n3. Displays package metadata, dependencies, and other relevant information\n4. Helps troubleshoot package-related issues`,\n aliases: [\"is\"],\n args: inspectArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n const { startInspect } = await import(\"../services/inspect.js\");\n startInspect(args);\n process.exit(0);\n },\n});\n","import { installArgs } from \"@powerhousedao/shared/clis/args\";\nimport { execSync } from \"child_process\";\nimport { command } from \"cmd-ts\";\n\nconst MANIFEST_TIMEOUT_MS = 10_000;\n\n// The external packages a registry package's manifest lists; none when unreadable.\nexport async function fetchExternalDependencies(\n registryUrl: string,\n dependency: { name: string; version?: string },\n): Promise<string[]> {\n const base = registryUrl.endsWith(\"/\") ? registryUrl : `${registryUrl}/`;\n const spec = dependency.version\n ? `${dependency.name}@${dependency.version}`\n : dependency.name;\n try {\n const response = await fetch(\n `${base}-/cdn/${spec}/powerhouse.manifest.json`,\n { signal: AbortSignal.timeout(MANIFEST_TIMEOUT_MS) },\n );\n if (!response.ok) return [];\n const manifest = (await response.json()) as {\n externalDependencies?: unknown;\n };\n const external = manifest.externalDependencies;\n return typeof external === \"object\" && external !== null\n ? Object.keys(external).sort()\n : [];\n } catch {\n return [];\n }\n}\n\nexport async function warnAboutExternalDependencies(\n registryUrl: string,\n dependencies: { name: string; version?: string }[],\n): Promise<void> {\n // Fetched together: each manifest may take the whole timeout.\n const found = await Promise.all(\n dependencies.map((dependency) =>\n fetchExternalDependencies(registryUrl, dependency),\n ),\n );\n for (const [i, dependency] of dependencies.entries()) {\n const external = found[i];\n if (external.length === 0) continue;\n console.warn(\n `⚠ ${dependency.name}: its subgraphs and processors need packages with native addons or WebAssembly modules (${external.join(\", \")}) ` +\n `and only run when the package is installed locally: ph install --local ${dependency.name}\\n` +\n ` Its pieces work either way.`,\n );\n }\n}\n\nexport const install = command({\n name: \"install\",\n aliases: [\"add\", \"i\"],\n description: `\nThe install command adds Powerhouse dependencies to your project.\n\nBy default it only registers the package in powerhouse.config.json with\nprovider \"registry\" — Connect will load it from the registry CDN at runtime.\n\nWith --local, the package is also installed into node_modules and marked\nas provider \"local\" — it will be bundled into ph connect build so the\npreview works without the registry being reachable.\n\nResolution order for the registry URL:\n --registry flag > PH_REGISTRY_URL env > powerhouse.config.json > default\n `,\n args: installArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { getPowerhouseProjectInfo, makeDependenciesWithVersions } =\n await import(\"@powerhousedao/shared/clis\");\n\n const {\n projectPath,\n localProjectPath,\n globalProjectPath,\n packageManager,\n isGlobal,\n } = await getPowerhouseProjectInfo(args);\n\n if (!projectPath) {\n throw new Error(`Could not find project path to install from.`);\n }\n\n const { resolveRegistryUrl } =\n await import(\"@powerhousedao/shared/registry\");\n const registryUrl = resolveRegistryUrl({\n registry: args.registry,\n projectPath,\n });\n\n if (args.debug) {\n console.log(\">>> registryUrl\", registryUrl);\n }\n\n const dependenciesWithVersions = await makeDependenciesWithVersions(\n args.dependencies,\n registryUrl,\n );\n\n if (args.debug) {\n console.log(\">>> parsedDependencies\", dependenciesWithVersions);\n console.log(\"\\n>>> projectInfo\", {\n localProjectPath,\n globalProjectPath,\n packageManager,\n isGlobal,\n });\n }\n\n if (args.local) {\n if (dependenciesWithVersions.length === 0) {\n throw new Error(\n \"--local requires at least one package name (e.g. ph install --local @scope/pkg)\",\n );\n }\n try {\n const specs = dependenciesWithVersions.map((d) =>\n d.version ? `${d.name}@${d.version}` : d.name,\n );\n\n // Route only the scopes of the packages being installed to the\n // resolved registry, leaving transitive deps from other scopes\n // (and unscoped packages) on the package manager's default. This\n // avoids requiring a project-level .npmrc when the user already\n // has packageRegistryUrl in powerhouse.config.json.\n const scopes = new Set<string>();\n for (const dep of dependenciesWithVersions) {\n if (dep.name.startsWith(\"@\")) {\n const scope = dep.name.split(\"/\")[0];\n scopes.add(scope);\n }\n }\n const scopeRegistryArgs = Array.from(scopes).map(\n (scope) => `--${scope}:registry=${registryUrl}`,\n );\n\n const minReleaseAgeArgs =\n packageManager === \"pnpm\" ? [\"--config.minimum-release-age=0\"] : [];\n\n const allowBuildArgs =\n packageManager === \"pnpm\" && args.allowBuild.length > 0\n ? [`--allow-build=${args.allowBuild.join(\",\")}`]\n : [];\n\n const { resolveCommand } = await import(\"package-manager-detector\");\n const resolved = resolveCommand(packageManager, \"add\", [\n ...specs,\n ...scopeRegistryArgs,\n ...minReleaseAgeArgs,\n ...allowBuildArgs,\n ]);\n if (!resolved) {\n throw new Error(\n `Failed to resolve install command for package manager \"${packageManager}\".`,\n );\n }\n const installCommand = `${resolved.command} ${resolved.args.join(\" \")}`;\n if (scopeRegistryArgs.length > 0) {\n console.log(\n `Installing dependencies 📦 (routing ${Array.from(scopes).join(\", \")} → ${registryUrl})...`,\n );\n } else {\n console.log(\"Installing dependencies 📦...\");\n }\n console.log(`> ${installCommand}`);\n execSync(installCommand, {\n stdio: \"inherit\",\n cwd: projectPath,\n });\n console.log(\"Dependency installed successfully 🎉\");\n } catch (error) {\n console.error(\"❌ Failed to install dependencies\");\n throw error;\n }\n }\n\n const { updateConfigFile } = await import(\"../utils.js\");\n\n try {\n console.log(\"⚙️ Updating powerhouse config file...\");\n updateConfigFile(\n dependenciesWithVersions,\n projectPath,\n \"install\",\n args.local ? \"local\" : \"registry\",\n registryUrl,\n args.registry !== undefined,\n );\n console.log(\"Config file updated successfully 🎉\");\n } catch (error) {\n console.error(\"❌ Failed to update config file\");\n throw error;\n }\n\n if (args.local) {\n // A local install puts the package in node_modules, skills included.\n const { syncPackageSkills } =\n await import(\"@powerhousedao/codegen/file-builders\");\n for (const { path, action } of await syncPackageSkills(projectPath)) {\n console.log(` ${path}: ${action}`);\n }\n }\n\n if (!args.local) {\n await warnAboutExternalDependencies(\n registryUrl,\n dependenciesWithVersions,\n );\n }\n\n process.exit(0);\n },\n});\n","import { keyframesArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const keyframes = command({\n name: \"keyframes\",\n description: `\nThe keyframes command reports on and cleans up the keyframes of a running switchboard,\nthrough its inspection-admin endpoint.\n\nPrerequisites:\n - The host serves inspection-admin (INSPECTION_ADMIN_ENABLED=true).\n - The caller is one of the host's auth admins.\n - The keep rules are in powerhouse.config.json under reactor.keyframes, or in PH_KEYFRAMES.\n\nRun preview first: it only reads. clean then removes the keyframes past each type's keep\ncount and all keyframes of deleted documents, in small paced statements beside live\ntraffic. Running it again is safe. A later read that misses a keyframe replays from the\noperation log, so a clean-up costs time on cold reads and never changes a document.\n\nThe disk only shrinks after reclaim, which rewrites the Keyframe table once the store is\nquiet. On PGlite the store answers nothing while it rewrites. On Postgres it says what to\nrun by hand.\n`,\n args: keyframesArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n const { runKeyframesCommand } = await import(\"../services/keyframes.js\");\n const exitCode = await runKeyframesCommand(args);\n process.exit(exitCode);\n },\n});\n","import { listArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const list = command({\n name: \"list\",\n description: `\nThe list command displays information about installed Powerhouse packages in your project.\nIt reads the powerhouse.config.json file and shows the packages that are currently installed.\n\nThis command:\n1. Examines your project configuration\n2. Lists all installed Powerhouse packages\n3. Provides a clear overview of your project's dependencies\n4. Helps you manage and track your Powerhouse components\n`,\n aliases: [\"l\"],\n args: listArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n try {\n const { getPowerhouseProjectInfo } =\n await import(\"@powerhousedao/shared/clis\");\n const projectInfo = await getPowerhouseProjectInfo();\n\n const { getConfig } = await import(\"@powerhousedao/config/node\");\n const phConfig = getConfig(\n projectInfo.projectPath + \"/powerhouse.config.json\",\n );\n\n if (!phConfig.packages || phConfig.packages.length === 0) {\n console.log(\"No packages found in the project\");\n return;\n }\n\n console.log(\"Installed Packages:\\n\");\n phConfig.packages.forEach((pkg) => {\n console.log(\n pkg.version ? `${pkg.packageName}@${pkg.version}` : pkg.packageName,\n );\n });\n } catch (_e) {\n console.log(\"No packages found in the project\");\n }\n process.exit(0);\n },\n});\n","import { loginArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const login = command({\n name: \"login\",\n description: `\nThe login command authenticates you with Renown using your Ethereum wallet. This enables\nthe CLI to act on behalf of your Ethereum identity for authenticated operations.\n\nThis command:\n1. Generates or loads a cryptographic identity (DID) for the CLI\n2. Opens your browser to the Renown authentication page\n3. You authorize the CLI's DID to act on behalf of your Ethereum address\n4. Stores the credentials locally in .ph/.renown.json\n `,\n args: loginArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { getRenown } = await import(\"../services/auth.js\");\n const renown = await getRenown(args.renownUrl);\n\n if (args.showDid) {\n console.log(renown.did);\n process.exit(0);\n }\n\n if (args.status) {\n const { getAuthStatus } = await import(\"@renown/sdk/node\");\n const status = getAuthStatus(renown);\n if (!status.authenticated || !status.address) {\n console.log(\"Not authenticated with an Ethereum address.\");\n console.log('Run \"ph login\" to authenticate.');\n } else {\n console.log(\"Authenticated\");\n console.log(` ETH Address: ${status.address}`);\n console.log(` User DID: ${status.userDid}`);\n console.log(` Chain ID: ${status.chainId}`);\n console.log(` CLI DID: ${status.cliDid}`);\n console.log(\n ` Authenticated at: ${status.authenticatedAt?.toLocaleString()}`,\n );\n console.log(` Renown URL: ${status.baseUrl}`);\n }\n process.exit(0);\n }\n\n if (args.logout) {\n await handleLogout();\n process.exit(0);\n }\n\n const { browserLogin } = await import(\"@renown/sdk/node\");\n\n console.debug(\"Initializing cryptographic identity...\");\n console.log(`CLI DID: ${renown.did}`);\n\n try {\n const timeoutMs = args.timeout ? args.timeout * 1000 : undefined;\n\n const result = await browserLogin(renown, {\n renownUrl: args.renownUrl,\n timeoutMs,\n onLoginUrl: (url, sessionId) => {\n console.log(\"Opening browser for authentication...\");\n console.log(`Session ID: ${sessionId.slice(0, 8)}...`);\n console.log(`Login URL: ${url}`);\n console.log();\n console.log(\"Waiting for authentication in browser\");\n console.log(`(timeout in ${(timeoutMs ?? 300_000) / 1000} seconds)`);\n console.log();\n console.log(\n \"Please connect your wallet and authorize this CLI to act on your behalf.\",\n );\n console.log();\n process.stdout.write(\"Waiting\");\n },\n onPollTick: () => process.stdout.write(\".\"),\n onBrowserOpenFailed: (url) => {\n console.error(\"Failed to open browser automatically.\");\n console.log(`Please open this URL manually: ${url}`);\n },\n });\n\n console.log(); // New line after dots\n console.log();\n console.log(\"Successfully authenticated!\");\n console.log(` ETH Address: ${result.user.address}`);\n console.log(` User DID: ${result.user.did}`);\n console.log(` CLI DID: ${result.cliDid}`);\n console.log();\n console.log(\"The CLI can now act on behalf of your Ethereum identity.\");\n } catch (error) {\n console.log(); // New line after dots\n throw error;\n }\n\n process.exit(0);\n },\n});\n\nexport async function handleLogout() {\n const { getRenown } = await import(\"../services/auth.js\");\n const renown = await getRenown();\n if (!renown.user) {\n console.log(\"Not currently authenticated.\");\n return;\n }\n\n try {\n await renown.logout();\n console.log(\"Successfully logged out.\");\n } catch (error) {\n console.error(\"Failed to clear credentials.\");\n console.debug(error);\n }\n}\n","import { command } from \"cmd-ts\";\nimport { handleLogout } from \"./login.js\";\n\nexport const logout = command({\n name: \"logout\",\n description: `\nThe logout command removes an existing session created with 'ph login'`,\n args: {},\n handler: async () => {\n await handleLogout();\n process.exit(0);\n },\n});\n","import { mcpArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const mcp = command({\n name: \"mcp\",\n args: mcpArgs,\n description: `\nServe the project's reactor-mcp tools to a coding agent over stdio.\n\nUse it as the MCP server command in .mcp.json, .cursor/mcp.json and\n.gemini/settings.json. Tools are listed at once, without waiting for Vetra.\nThe first tool call connects to the project's running Vetra (found through\n.ph/vetra-runtime.json), or starts one in the background and waits for it to\nbe ready: \\`ph run vetra --strictPort\\`, the project's hosts/vetra host. How\nthe start goes is reported as MCP progress notifications when the client sent a progressToken, else on\nstderr.\nStartup failures come back as tool errors carrying Vetra's output, which is\nalso written to .ph/vetra.log.\n\nBeside reactor-mcp's tools it serves restartVetra, which stops the project's\nVetra, starts it again and returns its URLs. When Vetra restarts some other\nway (stopped and started again), the next tool call connects to the new one.\n`,\n handler: async (args) => {\n if (args.debug) {\n console.error(args);\n }\n const { startMcpLauncher } = await import(\"../services/mcp.js\");\n await startMcpLauncher({\n projectDir: args.projectDir,\n startTimeoutSeconds: args.startTimeout,\n });\n },\n});\n","import { migrateArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const migrate = command({\n name: \"migrate\",\n args: migrateArgs,\n description: \"Run migrations\",\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n const models = args.documentModels || args.documentModel.length > 0;\n const subgraphs = args.subgraphs || args.subgraph.length > 0;\n if (args.strictResolvers && !subgraphs) {\n console.error(\n \"--strict-resolvers applies only with --subgraphs or --subgraph.\",\n );\n process.exit(1);\n }\n if (args.renameConflictingTypes && !models) {\n console.error(\n \"--rename-conflicting-types applies only with --document-models or --document-model.\",\n );\n process.exit(1);\n }\n if (models || subgraphs) {\n if (args.versionPositional ?? args.version ?? args.force) {\n console.error(\n \"--document-models, --document-model, --subgraphs and --subgraph convert to code-first only; they take no version and no --force.\",\n );\n process.exit(1);\n }\n let code = 0;\n if (models) {\n const { migrateDocumentModels } =\n await import(\"../services/migrate-document-models.js\");\n code |= await migrateDocumentModels({\n projectDir: process.cwd(),\n dirs: args.documentModel,\n dryRun: Boolean(args.dryRun),\n renameConflictingTypes: Boolean(args.renameConflictingTypes),\n });\n }\n if (subgraphs) {\n const { migrateSubgraphs } =\n await import(\"../services/migrate-subgraphs.js\");\n code |= await migrateSubgraphs({\n projectDir: process.cwd(),\n dirs: args.subgraph,\n dryRun: Boolean(args.dryRun),\n strictResolvers: Boolean(args.strictResolvers),\n });\n }\n process.exit(code);\n }\n const { startMigrate } = await import(\"../services/migrate.js\");\n await startMigrate(args);\n process.exit(0);\n },\n});\n","import {\n modelCheckArgs,\n modelInspectArgs,\n} from \"@powerhousedao/shared/clis/args\";\nimport { command, subcommands } from \"cmd-ts\";\n\nconst EXPERIMENTAL =\n \"Experimental: the command, its output and the JSON report can change in any release.\";\n\nconst EXIT_CODES = `Exit codes:\n 0 ok, or skipped. Skipped means the package has no document model, so\n nothing was checked. Read \"status\".\n 1 invalid. The models were read and at least one is wrong.\n 2 failed. The configuration or a module could not be read, the arguments\n are wrong, or the command could not run.`;\n\nconst OUTPUT = (name: string) => `Output:\n ph model ${name} a readable report on stdout\n ph model ${name} --json exactly one JSON report on stdout and nothing else\nLogs, including what the package's modules print while they load, go to\nstderr. When the command cannot run at all, it prints only a message on\nstderr and exits 2.`;\n\nexport const modelCheck = command({\n name: \"check\",\n description: `Check this package's document models through one set of checks:\nevery model directory in documentModelsDir, whether it stores a schema-first\n<name>.json or exports a code-first model from its index.ts. Writes nothing.\n\n\\`tsc\\` cannot run these checks: a code-first model compiles when its module is\nevaluated.\n\n--release (experimental) runs the checks \\`ph build --release\\` runs: these,\nthe release checks, and host validation, which validates every model and the\npackage's scalars entry as a host that installed the package would.\n\n--prepack (experimental) loads nothing. It reads the release approval\n\\`ph build --release\\` wrote in .ph/build/release-approval.json and exits 0\nwhen it matches this package, 1 when it does not (missing, unreadable, stale\nor refused), naming the reasons, and 2 when it cannot be checked. To stop a\nplain \\`npm publish\\` too, add it to package.json, then run\n\\`ph build --release\\` (package.json is published, so the approval covers it):\n \"scripts\": { \"prepack\": \"ph-cli model check --prepack\" }\nWith --json it prints {\"decision\": ..., \"reasons\": [...]}.\n\n${EXIT_CODES}\n\n${OUTPUT(\"check\")}\n\n${EXPERIMENTAL}`,\n args: modelCheckArgs,\n handler: async (args) => {\n if (args.debug) {\n console.error(args);\n }\n const [{ runModelCheck }, { exitWithModelCommand }] = await Promise.all([\n import(\"../services/model/check.js\"),\n import(\"../services/model/run.js\"),\n ]);\n await exitWithModelCommand(args.json, (streams) =>\n runModelCheck(args, { streams }),\n );\n },\n});\n\nexport const modelInspect = command({\n name: \"inspect\",\n description: `Describe this package's document models without checking them: for each\nmodel its digest and compatibility, and for each of its versions the source,\nscopes, scalars and operations. With <documentType>@<version>, describe that\nversion only and add its full definition to the JSON report. Writes nothing.\n\n${EXIT_CODES}\n\n${OUTPUT(\"inspect\")}\n\n${EXPERIMENTAL}`,\n args: modelInspectArgs,\n handler: async (args) => {\n if (args.debug) {\n console.error(args);\n }\n const [{ runModelInspect }, { exitWithModelCommand }] = await Promise.all([\n import(\"../services/model/inspect.js\"),\n import(\"../services/model/run.js\"),\n ]);\n await exitWithModelCommand(args.json, (streams) =>\n runModelInspect(args, { streams }),\n );\n },\n});\n\nexport const model = subcommands({\n name: \"model\",\n description:\n \"Check or inspect this package's document models (experimental): `check`, `inspect`.\",\n cmds: { check: modelCheck, inspect: modelInspect },\n});\n","import { publishArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nfunction hasTagFlag(args: string[]): boolean {\n return args.some((a) => a === \"--tag\" || a.startsWith(\"--tag=\"));\n}\n\nfunction isInteractive(): boolean {\n return Boolean(process.stdin.isTTY) && !process.env.CI;\n}\n\nasync function readPrereleaseTag(\n projectPath: string,\n packedVersion: string | undefined,\n): Promise<{\n version: string;\n tag: string;\n} | null> {\n try {\n const [{ readPackageSync }, { prerelease }] = await Promise.all([\n import(\"read-pkg\"),\n import(\"semver\"),\n ]);\n const version =\n packedVersion ?? readPackageSync({ cwd: projectPath }).version;\n if (!version) return null;\n const parts = prerelease(version);\n if (!parts || parts.length === 0) return null;\n const label = String(parts[0]);\n // semver may surface numeric-only prerelease ids (e.g. `1.0.0-0`);\n // npm requires an alphanumeric dist-tag, so skip those.\n if (!/^[a-z][a-z0-9-]*$/i.test(label)) return null;\n return { version, tag: label };\n } catch {\n return null;\n }\n}\n\nexport const publish = command({\n name: \"publish\",\n description: `\nPublish a package to the Powerhouse registry. This is a thin wrapper around npm publish\nthat automatically sets the registry URL.\n\nThis command:\n0. With a release approval from ph build --release (experimental), checks that it matches\n the package and warns when it does not. --require-approval exits 1 instead; it forwards\n only --tag, --access, --otp, --dry-run, --provenance, --json and --loglevel to npm,\n refuses npm configuration in the environment that selects another package\n (npm_config_workspace, npm_config_workspaces, npm_config_include_workspace_root),\n packs the package once, checks that tarball, and publishes that tarball with\n --ignore-scripts, so a file changed after the check is not published\n1. Resolves the registry URL (--registry flag > PH_REGISTRY_URL env > powerhouse.config.json > default)\n2. Checks authentication with the registry via npm whoami\n3. Forwards all additional arguments to npm publish\n `,\n args: publishArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { getPowerhouseProjectInfo } =\n await import(\"@powerhousedao/shared/clis\");\n const { projectPath } = await getPowerhouseProjectInfo();\n\n if (!projectPath) {\n throw new Error(\"Could not find project path.\");\n }\n\n const { checkApprovalBeforePublish } =\n await import(\"../services/release/verify.js\");\n if (args.requireApproval) {\n const {\n ALLOWED_NPM_ARGUMENTS,\n refusedNpmArguments,\n targetSelectingNpmEnvironment,\n } = await import(\"../services/release/npm-args.js\");\n const refused = refusedNpmArguments(args.forwardedArgs);\n if (refused.length > 0) {\n console.error(\n `✘ ph publish --require-approval publishes only the package it checked, so it forwards only these npm arguments: ${ALLOWED_NPM_ARGUMENTS}. Not allowed: ${refused.join(\" \")}`,\n );\n process.exit(1);\n }\n const selecting = targetSelectingNpmEnvironment(process.env);\n if (selecting.length > 0) {\n console.error(\n `✘ ph publish --require-approval publishes only the package it checked, but the environment sets npm configuration that selects another package: ${selecting.join(\", \")}. Unset it and publish again.`,\n );\n process.exit(1);\n }\n }\n const checked = checkApprovalBeforePublish(\n projectPath,\n args.requireApproval,\n );\n if (!checked.proceed) {\n process.exit(1);\n }\n const { packed } = checked;\n if (packed) process.once(\"exit\", packed.dispose);\n try {\n const { checkNpmAuth, npmPublish, resolveRegistryUrl } =\n await import(\"@powerhousedao/shared/registry\");\n const { mintRegistryAuthToken } =\n await import(\"../services/registry-auth.js\");\n\n const registryUrl = resolveRegistryUrl({\n registry: args.registry,\n projectPath,\n });\n\n if (args.debug) {\n console.log(\">>> registryUrl\", registryUrl);\n }\n\n // Try Renown auth first: if the user is logged in via `ph login`, mint a\n // short-lived registry-bound bearer token. Falling back to the legacy\n // `npm adduser` (htpasswd) path keeps existing flows working until the\n // grace period ends.\n let authToken: string | undefined;\n try {\n authToken = await mintRegistryAuthToken(registryUrl, 5 * 60);\n if (args.debug) {\n console.error(`>>> minted renown token for ${registryUrl} (5m TTL)`);\n }\n } catch (err) {\n if (args.debug) {\n console.error(\n `>>> renown token mint skipped: ${(err as Error).message}`,\n );\n }\n try {\n await checkNpmAuth(registryUrl);\n } catch {\n console.error(`Not authenticated with registry: ${registryUrl}`);\n console.error(\n `Run: ph login (recommended) or npm adduser --registry ${registryUrl}`,\n );\n process.exit(1);\n }\n }\n\n let forwardedArgs = args.forwardedArgs;\n\n if (!hasTagFlag(forwardedArgs)) {\n const prereleaseInfo = await readPrereleaseTag(\n projectPath,\n packed?.manifest.version,\n );\n if (prereleaseInfo) {\n const { version, tag } = prereleaseInfo;\n if (!isInteractive()) {\n console.error(\n `Detected prerelease version ${version}. npm requires an explicit dist-tag for prerelease publishes.`,\n );\n console.error(\n `Re-run with --tag <label> (e.g. --tag ${tag}) to proceed.`,\n );\n process.exit(1);\n }\n\n const enquirer = await import(\"enquirer\");\n\n let confirmed: boolean;\n try {\n const answer = await enquirer.default.prompt<{\n confirmed: boolean;\n }>({\n type: \"confirm\",\n name: \"confirmed\",\n message: `Detected prerelease version ${version}. Publish with --tag ${tag}?`,\n initial: true,\n });\n confirmed = answer.confirmed;\n } catch {\n // user aborted the prompt (Ctrl-C); treat as decline\n confirmed = false;\n }\n\n if (!confirmed) {\n console.error(\n `Aborted. To publish manually: npm publish --registry ${registryUrl} --tag <label>`,\n );\n process.exit(1);\n }\n\n forwardedArgs = [\"--tag\", tag, ...forwardedArgs];\n }\n }\n\n if (args.debug) {\n console.log(\n \">>> command\",\n `npm publish --registry ${registryUrl} ${forwardedArgs.join(\" \")}`,\n );\n }\n\n if (args.requireApproval) {\n // The approval checked this package's files as they are: a prepack,\n // prepare or prepublishOnly script would change them after that check,\n // and an .npmrc `workspace` would publish another package, which npm\n // refuses alongside --workspaces=false.\n forwardedArgs = [\n ...forwardedArgs,\n \"--ignore-scripts\",\n \"--workspaces=false\",\n ];\n console.log(\n \"Lifecycle scripts are skipped (--ignore-scripts) and workspaces are off (--workspaces=false), so npm publishes the tarball the approval matched.\",\n );\n }\n\n console.log(`Publishing to ${registryUrl}...`);\n const result = await npmPublish({\n registryUrl,\n cwd: projectPath,\n args: packed ? [packed.tarball, ...forwardedArgs] : forwardedArgs,\n authToken,\n });\n if (result.stdout) {\n console.log(result.stdout);\n }\n\n process.exit(0);\n } finally {\n packed?.dispose();\n }\n },\n});\n","import { registryLoginArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\n\nexport const registryLogin = command({\n name: \"registry-login\",\n description: `\nLog in to a Powerhouse registry using your Renown identity. Mints a longer-lived\nbearer token (default 30 days) bound to the registry's audience and writes the\ntoken into ~/.npmrc so raw 'npm publish' / 'npm install' work without further\nsetup.\n\nPrerequisites:\n Run 'ph login' first to establish a Renown identity.\n\nUsage:\n ph registry-login # uses powerhouse.config.json / PH_REGISTRY_URL\n ph registry-login --registry https://registry.vetra.io\n ph registry-login --expiry 7d\n `,\n args: registryLoginArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { getPowerhouseProjectInfo } =\n await import(\"@powerhousedao/shared/clis\");\n const projectInfo = await getPowerhouseProjectInfo().catch(() => null);\n const projectPath = projectInfo?.projectPath ?? process.cwd();\n\n const [\n { resolveRegistryUrl, writeRegistryAuthToken },\n { mintRegistryAuthToken },\n { parseExpiry, formatExpiry },\n ] = await Promise.all([\n import(\"@powerhousedao/shared/registry\"),\n import(\"../services/registry-auth.js\"),\n import(\"@renown/sdk/node\"),\n ]);\n\n const registryUrl = resolveRegistryUrl({\n registry: args.registry,\n projectPath,\n });\n\n const expiresIn = parseExpiry(args.expiry);\n\n const token = await mintRegistryAuthToken(registryUrl, expiresIn);\n const npmrcPath = await writeRegistryAuthToken(registryUrl, token);\n\n console.log(`Logged in to ${registryUrl}`);\n console.log(` Token expires in: ${formatExpiry(expiresIn)}`);\n console.log(` Wrote: ${npmrcPath}`);\n process.exit(0);\n },\n});\n","import {\n boolean,\n command,\n flag,\n option,\n optional,\n positional,\n restPositionals,\n string,\n} from \"cmd-ts\";\n\nexport const runHost = command({\n name: \"run\",\n description:\n \"Run a host from the project's hosts/ folder: `ph run <host> [verb]`. \" +\n \"The host's own host.js names the runner module; the verb defaults to `run`. \" +\n \"Arguments after the verb go to the runner, which names the ones it accepts. \" +\n \"`ph run <package>/<host>` runs a host that an installed package supplies.\",\n args: {\n host: positional({\n type: string,\n displayName: \"host\",\n description:\n \"Folder name under hosts/ (e.g. vetra, connect), or `<package>/<host>` \" +\n \"for one in an installed package's hosts/ (e.g. `@acme/tools/studio`).\",\n }),\n verb: positional({\n type: optional(string),\n displayName: \"verb\",\n description: \"Runner verb (default: run; e.g. dev, build, serve).\",\n }),\n debug: flag({\n type: optional(boolean),\n long: \"debug\",\n description: \"Print resolved host/runner/verb before dispatch.\",\n }),\n stop: flag({\n type: optional(boolean),\n long: \"stop\",\n description:\n \"Stop the project's running instance of this host instead of \" +\n \"starting one: it shuts down as on Ctrl-C, and the command returns \" +\n \"when it has.\",\n }),\n explain: option({\n type: optional(string),\n long: \"explain\",\n description:\n \"Explain a resolved aspect instead of running: `--explain drives` \" +\n \"prints the merged drive plan with provenance; `--explain outputs` \" +\n \"prints what each host produces, the output tokens it reads and \" +\n \"the start order they imply.\",\n }),\n // cli.ts moves the runner's arguments behind a `--` (forwardRunnerArgv).\n argv: restPositionals({\n type: string,\n displayName: \"runner arguments\",\n description:\n \"Arguments for the host's runner (e.g. --port 4001); they win over \" +\n \"the host file.\",\n }),\n },\n handler: async (args) => {\n if (args.explain !== undefined) {\n const { explainHost } = await import(\"../services/run/explain.js\");\n await explainHost({ host: args.host, topic: args.explain });\n return;\n }\n if (args.stop) {\n const { stopRunningHost } =\n await import(\"@powerhousedao/ph-run/start-run\");\n await stopRunningHost({ host: args.host });\n return;\n }\n const run = {\n host: args.host,\n verb: args.verb,\n debug: args.debug,\n argv: args.argv,\n };\n // hosts/vetra is what `ph dev` is sugar for (run-sugar.ts): its stack\n // keeps the runtime record `ph mcp` reads.\n if (args.host === \"vetra\") {\n const { runVetraHost } = await import(\"../services/run/vetra-host.js\");\n await runVetraHost(run);\n return;\n }\n const { startRun } = await import(\"@powerhousedao/ph-run/start-run\");\n await startRun(run);\n },\n});\n","import { AGENTS, uninstallArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\nimport { execSync } from \"node:child_process\";\n\nexport const uninstall = command({\n name: \"uninstall\",\n aliases: [\"remove\"],\n description: `\nThe uninstall command removes Powerhouse dependencies from your project. It handles the\nremoval of packages, updates configuration files, and ensures proper cleanup.\n\nThis command:\n1. Uninstalls specified Powerhouse dependencies using your package manager\n2. Updates powerhouse.config.json to remove the dependencies\n3. Supports various uninstallation options and configurations\n4. Works with ${AGENTS.join(\", \")} package managers\n`,\n args: uninstallArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const {\n getPowerhouseProjectInfo,\n getPowerhouseProjectUninstallCommand,\n makeDependenciesWithVersions,\n } = await import(\"@powerhousedao/shared/clis\");\n\n const {\n projectPath,\n localProjectPath,\n globalProjectPath,\n packageManager,\n isGlobal,\n } = await getPowerhouseProjectInfo(args);\n\n if (!projectPath) {\n throw new Error(`Could not find project path to uninstall from`);\n }\n\n const dependenciesWithVersions = await makeDependenciesWithVersions(\n args.dependencies,\n );\n\n if (args.debug) {\n console.log(\">>> parsedDependencies\", dependenciesWithVersions);\n }\n\n if (args.debug) {\n console.log(\"\\n>>> projectInfo\", {\n localProjectPath,\n globalProjectPath,\n packageManager,\n isGlobal,\n });\n }\n\n try {\n console.log(\"Uninstalling dependencies 📦 ...\");\n const uninstallCommand = await getPowerhouseProjectUninstallCommand(\n packageManager,\n args.dependencies,\n );\n execSync(uninstallCommand, {\n stdio: \"inherit\",\n cwd: projectPath,\n });\n console.log(\"Dependency uninstalled successfully 🎉\");\n } catch (error) {\n console.error(\"❌ Failed to uninstall dependencies\");\n throw error;\n }\n\n const { removeStylesImports, updateConfigFile } =\n await import(\"../utils.js\");\n\n try {\n console.log(\"⚙️ Updating powerhouse config file...\");\n updateConfigFile(dependenciesWithVersions, projectPath, \"uninstall\");\n console.log(\"Config file updated successfully 🎉\");\n } catch (error) {\n console.error(\"❌ Failed to update config file\");\n throw error;\n }\n\n // Skills of the removed packages leave with them.\n const { syncPackageSkills } =\n await import(\"@powerhousedao/codegen/file-builders\");\n for (const { path, action } of await syncPackageSkills(projectPath)) {\n console.log(` ${path}: ${action}`);\n }\n\n try {\n console.log(\"⚙️ Updating styles.css file...\");\n removeStylesImports(dependenciesWithVersions, projectPath);\n console.log(\"Styles file updated successfully 🎉\");\n } catch (error) {\n console.error(\"❌ Failed to update styles file\");\n throw error;\n }\n\n process.exit(0);\n },\n});\n","import { unpublishArgs } from \"@powerhousedao/shared/clis/args\";\nimport { command } from \"cmd-ts\";\nimport { createInterface } from \"node:readline/promises\";\n\nexport const unpublish = command({\n name: \"unpublish\",\n description: `\nUnpublish a package from the Powerhouse registry. This is a thin wrapper around\nnpm unpublish that automatically targets the Powerhouse registry and never\nreaches npmjs.org.\n\nForms:\n ph unpublish # unpublish <name>@<version> from cwd's package.json\n ph unpublish <name> # unpublish the whole package (all versions)\n ph unpublish <name>@<version> # unpublish a single version\n\nFlags:\n --registry <url> # override registry URL\n --yes, -y # skip the confirmation prompt\n `,\n args: unpublishArgs,\n handler: async (args) => {\n if (args.debug) {\n console.log(args);\n }\n\n const { getPowerhouseProjectInfo } =\n await import(\"@powerhousedao/shared/clis\");\n const { projectPath } = await getPowerhouseProjectInfo();\n\n if (!projectPath) {\n throw new Error(\"Could not find project path.\");\n }\n\n const { checkNpmAuth, npmUnpublish, resolveRegistryUrl } =\n await import(\"@powerhousedao/shared/registry\");\n\n const registryUrl = resolveRegistryUrl({\n registry: args.registry,\n projectPath,\n });\n\n const spec = await resolveSpec(args.spec, projectPath);\n if (!spec) {\n console.error(\n \"No package spec provided and could not read name/version from package.json.\",\n );\n process.exit(1);\n }\n\n if (args.debug) {\n console.log(\">>> registryUrl\", registryUrl);\n console.log(\">>> spec\", spec);\n }\n\n try {\n await checkNpmAuth(registryUrl);\n } catch {\n console.error(`Not authenticated with registry: ${registryUrl}`);\n console.error(`Run: npm adduser --registry ${registryUrl}`);\n process.exit(1);\n }\n\n if (!args.yes) {\n const confirmed = await confirm(\n `Unpublish ${spec} from ${registryUrl}? [y/N] `,\n );\n if (!confirmed) {\n console.log(\"Aborted.\");\n process.exit(0);\n }\n }\n\n if (args.debug) {\n console.log(\n \">>> command\",\n `npm unpublish ${spec} --registry ${registryUrl} --force ${args.forwardedArgs.join(\" \")}`,\n );\n }\n\n console.log(`Unpublishing ${spec} from ${registryUrl}...`);\n try {\n const result = await npmUnpublish({\n registryUrl,\n cwd: projectPath,\n spec,\n args: args.forwardedArgs,\n });\n if (result.stdout) {\n console.log(result.stdout);\n }\n process.exit(0);\n } catch (err) {\n console.error(err instanceof Error ? err.message : String(err));\n process.exit(1);\n }\n },\n});\n\nasync function resolveSpec(\n explicit: string | undefined,\n projectPath: string,\n): Promise<string | null> {\n if (explicit) return explicit;\n try {\n const { readPackageSync } = await import(\"read-pkg\");\n const pkg = readPackageSync({ cwd: projectPath });\n if (!pkg.name) return null;\n return pkg.version ? `${pkg.name}@${pkg.version}` : pkg.name;\n } catch {\n return null;\n }\n}\n\nasync function confirm(prompt: string): Promise<boolean> {\n const rl = createInterface({ input: process.stdin, output: process.stdout });\n try {\n const answer = await rl.question(prompt);\n return /^y(es)?$/i.test(answer.trim());\n } finally {\n rl.close();\n }\n}\n","import { command, optional, positional, restPositionals, string } from \"cmd-ts\";\nimport {\n VETRA_STUDIO_HOST,\n VETRA_STUDIO_PACKAGE,\n} from \"../services/vetra-gateway.js\";\n\n/**\n * `ph vetra`, the gateway to Vetra Studio. cli.ts hands every `ph vetra` but\n * its help to the gateway (services/vetra-gateway.ts), which makes it the\n * `ph run` of the studio host: this command gives the help and the docs.\n */\nexport const vetra = command({\n name: \"vetra\",\n description:\n `Open Vetra Studio: \\`ph vetra [verb]\\` is \\`ph run ${VETRA_STUDIO_HOST} [verb]\\`, ` +\n `the studio host of the ${VETRA_STUDIO_PACKAGE} package. ` +\n `A project without the package gets it first: \\`ph vetra\\` installs it as a devDependency, ` +\n \"at this ph-cli's version, with the project's package manager. \" +\n \"The runner arguments, --stop and --explain work as for `ph run`. \" +\n \"The dev mode that `ph vetra` started before 6.4 (the project's hosts/vetra) is `ph dev`.\",\n args: {\n verb: positional({\n type: optional(string),\n displayName: \"verb\",\n description: \"Verb of the studio host (default: the host's own).\",\n }),\n argv: restPositionals({\n type: string,\n displayName: \"runner arguments\",\n description:\n \"Arguments for the studio host's runner, as `ph run` takes them.\",\n }),\n },\n handler: () => {\n // Not reached: cli.ts runs `ph vetra` through the gateway.\n throw new Error(\n `\\`ph vetra\\` is \\`ph run ${VETRA_STUDIO_HOST}\\`, through the gateway in cli.ts.`,\n );\n },\n});\n","import { accessToken } from \"./access-token.js\";\nimport { build } from \"./build.js\";\nimport { connect } from \"./connect.js\";\nimport { generate } from \"./generate.js\";\nimport { host } from \"./host.js\";\nimport { init } from \"./init.js\";\nimport { inspect } from \"./inspect.js\";\nimport { install } from \"./install.js\";\nimport { keyframes } from \"./keyframes.js\";\nimport { list } from \"./list.js\";\nimport { login } from \"./login.js\";\nimport { logout } from \"./logout.js\";\nimport { mcp } from \"./mcp.js\";\nimport { migrate } from \"./migrate.js\";\nimport { model } from \"./model.js\";\nimport { publish } from \"./publish.js\";\nimport { registryLogin } from \"./registry-login.js\";\nimport { runHost } from \"./run.js\";\nimport { uninstall } from \"./uninstall.js\";\nimport { unpublish } from \"./unpublish.js\";\nimport { vetra } from \"./vetra.js\";\n\nexport const phCliCommands = {\n init,\n generate,\n connect,\n build,\n publish,\n unpublish,\n \"access-token\": accessToken,\n \"registry-login\": registryLogin,\n inspect,\n keyframes,\n list,\n mcp,\n migrate,\n model,\n login,\n logout,\n install,\n uninstall,\n run: runHost,\n host,\n vetra,\n} as const;\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAIA,MAAa,cAAc,QAAQ;CACjC,MAAM;CACN,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+Cb,MAAM;CACN,SAAS,OAAO,SAAS;EACvB,IAAI,KAAK,OACP,QAAQ,IAAI,IAAI;EAGlB,MAAM,EAAE,qBAAqB,aAAa,iBACxC,MAAM,OAAO;EACf,MAAM,EAAE,cAAc,MAAM,OAAO;EACnC,MAAM,SAAS,MAAM,UAAU;EAE/B,IAAI,YAAY;EAChB,IAAI,KAAK,QAAQ,YAAY,YAAY,KAAK,MAAM;EAEpD,MAAM,SAAS,MAAM,oBAAoB,QAAQ;GAC/C;GACA,KAAK,KAAK;EACZ,CAAC;EAGD,QAAQ,MAAM,YAAY,OAAO,KAAK;EACtC,QAAQ,MAAM,gBAAgB,OAAO,SAAS;EAC9C,QAAQ,MAAM,qBAAqB,aAAa,SAAS,GAAG;EAC5D,QAAQ,MAAM,EAAE;EAEhB,QAAQ,IAAI,OAAO,KAAK;EACxB,QAAQ,KAAK,CAAC;CAChB;AACF,CAAC;;;AC9ED,MAAa,QAAQ,QAAQ;CAC3B,MAAM;CACN,aAAa;;;;;;;;;;;;;;;CAeb,MAAM;CACN,SAAS,OAAO,SAAS;EACvB,IAAI,KAAK,OACP,QAAQ,IAAI,I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AS,MAAM;IACrB,aAAa;IACb,aAAa;GACf,CAAC;GACD,MAAM,gBAAgB;IACpB,MAAM;IACN,aAAa;IACb,aACE;GACJ,CAAC;EACH;EACA,eAAe;GAEb,MAAM,IAAI,MACR,4BAA4B,kBAAkB,mCAChD;EACF;CACF,CCIE;AACF","debug_id":"43e97a70-39bc-5891-94c3-fbdc50701c55"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { t as phCliCommands } from "./ph-cli-commands-CQXdWQ74.mjs";
|
|
2
|
-
export { phCliCommands };
|
|
3
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c86f9ba6-d2b7-5067-b400-93060c5aa35c")}catch(e){}}();
|
|
4
|
-
//# debugId=c86f9ba6-d2b7-5067-b400-93060c5aa35c
|