openmeld 0.3.222 → 0.3.224
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{add-me-membership-Wc69O6rA.js → add-me-membership-CGISMRPF.js} +2 -2
- package/dist/{add-me-membership-Wc69O6rA.js.map → add-me-membership-CGISMRPF.js.map} +1 -1
- package/dist/{agents-B8zhQnGw.js → agents-CR7BebgO.js} +12 -12
- package/dist/{agents-B8zhQnGw.js.map → agents-CR7BebgO.js.map} +1 -1
- package/dist/{api-client-foundation-DTiFoGpI.js → api-client-foundation-CqbIn_de.js} +1 -1
- package/dist/{api-client-foundation-DnJ_JYli.js → api-client-foundation-DpVwrgh-.js} +3 -3
- package/dist/{api-client-foundation-DnJ_JYli.js.map → api-client-foundation-DpVwrgh-.js.map} +1 -1
- package/dist/auth-session-BJfKu74u.js +4 -0
- package/dist/{auth-session-nhS8jyux.js → auth-session-uEk_Tx6T.js} +8 -8
- package/dist/auth-session-uEk_Tx6T.js.map +1 -0
- package/dist/{base-url-CMBApK1J.js → base-url-DXrUiSMI.js} +1 -1
- package/dist/{base-url-D7uE_xTo.js → base-url-DvjOkKPs.js} +2 -2
- package/dist/{base-url-D7uE_xTo.js.map → base-url-DvjOkKPs.js.map} +1 -1
- package/dist/{channel-ggx0o_aG.js → channel-B2fD2_be.js} +4 -4
- package/dist/{channel-ggx0o_aG.js.map → channel-B2fD2_be.js.map} +1 -1
- package/dist/{cli-binary-manifest-DiUulkp0.js → cli-binary-manifest-CT5X05lk.js} +30 -4
- package/dist/cli-binary-manifest-CT5X05lk.js.map +1 -0
- package/dist/{command-Bz9x7V2T.js → command-CQ9XRwqf.js} +22 -165
- package/dist/command-CQ9XRwqf.js.map +1 -0
- package/dist/{computer-connection-M3N6plkj.js → computer-connection-Dm7iTnRK.js} +2 -2
- package/dist/{computer-connection-M3N6plkj.js.map → computer-connection-Dm7iTnRK.js.map} +1 -1
- package/dist/{computer-connection-review-DY5BK_27.js → computer-connection-review-RHAoddSS.js} +6 -6
- package/dist/{computer-connection-review-DY5BK_27.js.map → computer-connection-review-RHAoddSS.js.map} +1 -1
- package/dist/{computer-disconnect-DR1WDSPK.js → computer-disconnect-BWRsge_2.js} +10 -10
- package/dist/{computer-disconnect-DR1WDSPK.js.map → computer-disconnect-BWRsge_2.js.map} +1 -1
- package/dist/{computer-setup-continuation-2gs8z-nB.js → computer-setup-continuation-BOCRH0qq.js} +4 -4
- package/dist/{computer-setup-continuation-2gs8z-nB.js.map → computer-setup-continuation-BOCRH0qq.js.map} +1 -1
- package/dist/context-Bdh3nAzw.js +162 -0
- package/dist/context-Bdh3nAzw.js.map +1 -0
- package/dist/{control-plane-e3W6PD2M.js → control-plane-rTE2rHZ5.js} +2 -2
- package/dist/{control-plane-e3W6PD2M.js.map → control-plane-rTE2rHZ5.js.map} +1 -1
- package/dist/{daemon-device-id-DWO9_QW6.js → daemon-device-id-B1Af2Zmn.js} +344 -36
- package/dist/daemon-device-id-B1Af2Zmn.js.map +1 -0
- package/dist/{daemon-frame-transport-D2-tazuK.js → daemon-frame-transport-WiB73yhT.js} +519 -12
- package/dist/daemon-frame-transport-WiB73yhT.js.map +1 -0
- package/dist/{daemon-lifecycle-journal-DyKx1xzm.js → daemon-lifecycle-journal-CDZLWgMj.js} +11 -11
- package/dist/daemon-lifecycle-journal-CDZLWgMj.js.map +1 -0
- package/dist/{daemon-runtime-lease-BUr4qsLo.js → daemon-runtime-lease-1LMeZ6IS.js} +2 -2
- package/dist/{daemon-runtime-lease-BUr4qsLo.js.map → daemon-runtime-lease-1LMeZ6IS.js.map} +1 -1
- package/dist/{daemon-runtime-lease-C9X8xV_F.js → daemon-runtime-lease-Bz0ucJj3.js} +1 -1
- package/dist/{daemon-service-contract-BpOBMGX0.js → daemon-service-contract-GLmAxsq-.js} +4 -4
- package/dist/{daemon-service-contract-BpOBMGX0.js.map → daemon-service-contract-GLmAxsq-.js.map} +1 -1
- package/dist/{daemon-service-manager-HL4VKbIU.js → daemon-service-manager-C8RUCMDo.js} +9 -7
- package/dist/daemon-service-manager-C8RUCMDo.js.map +1 -0
- package/dist/{daemon-service-manager-B-QrDe5p.js → daemon-service-manager-CU-79a4z.js} +1 -1
- package/dist/{daemon-service-runtime-bKt0YjC7.js → daemon-service-runtime-CBJtgM4P.js} +397 -51
- package/dist/daemon-service-runtime-CBJtgM4P.js.map +1 -0
- package/dist/{daemon-service-update-coordinator-D8O1uTtu.js → daemon-service-update-coordinator-0LB_XGVZ.js} +48 -33
- package/dist/daemon-service-update-coordinator-0LB_XGVZ.js.map +1 -0
- package/dist/{daemon-state-B44aq2nm.js → daemon-state-Ca0WK5x0.js} +3 -3
- package/dist/{daemon-state-B44aq2nm.js.map → daemon-state-Ca0WK5x0.js.map} +1 -1
- package/dist/{dist-B07ziN_u.js → dist-BeJcIdCZ.js} +25 -17
- package/dist/dist-BeJcIdCZ.js.map +1 -0
- package/dist/dist-C32frPV2.js +4 -0
- package/dist/{dist-B2EauBG6.js → dist-YbTZ-Y-2.js} +16 -12
- package/dist/dist-YbTZ-Y-2.js.map +1 -0
- package/dist/{elapsed-time-Ooo4IC25.js → elapsed-time-q8lSPcfm.js} +6 -6
- package/dist/{elapsed-time-Ooo4IC25.js.map → elapsed-time-q8lSPcfm.js.map} +1 -1
- package/dist/{entry-DeIRMCiW.js → entry-CpS6tnIk.js} +12 -12
- package/dist/{entry-DeIRMCiW.js.map → entry-CpS6tnIk.js.map} +1 -1
- package/dist/{installation-inventory-DThnBEhV.js → installation-inventory-C5FsAvrf.js} +5 -5
- package/dist/{installation-inventory-DThnBEhV.js.map → installation-inventory-C5FsAvrf.js.map} +1 -1
- package/dist/{installer-D2bWZT88.js → installer-054NLJg6.js} +2 -2
- package/dist/{installer-D2bWZT88.js.map → installer-054NLJg6.js.map} +1 -1
- package/dist/io-DT66typ4.js +16 -0
- package/dist/io-DT66typ4.js.map +1 -0
- package/dist/{local-components-B6SCXZf9.js → local-components-DleLEzSU.js} +2 -1
- package/dist/local-components-DleLEzSU.js.map +1 -0
- package/dist/{lock-Bsl_ElWy.js → lock-iue1J2xy.js} +8 -5
- package/dist/lock-iue1J2xy.js.map +1 -0
- package/dist/{cli-space-api-CQtKu9Zt.js → meta-api-B1k3mwHN.js} +203 -19
- package/dist/meta-api-B1k3mwHN.js.map +1 -0
- package/dist/{openmeld-BQy0nMox.js → openmeld-BFO3sfC_.js} +93 -1027
- package/dist/openmeld-BFO3sfC_.js.map +1 -0
- package/dist/openmeld-dev.js +1 -1
- package/dist/{openmeld-environment-target-B6HqY0_a.js → openmeld-environment-target-BBn5Ko6p.js} +3 -3
- package/dist/{openmeld-environment-target-B6HqY0_a.js.map → openmeld-environment-target-BBn5Ko6p.js.map} +1 -1
- package/dist/{openmeld-maintenance-worker-BSODPHbn.js → openmeld-maintenance-worker-Ce4ehQ-c.js} +15 -14
- package/dist/openmeld-maintenance-worker-Ce4ehQ-c.js.map +1 -0
- package/dist/{openmeld-tools-update-join-BfY0GnDs.js → openmeld-tools-update-join-D24llJ9L.js} +4 -4
- package/dist/{openmeld-tools-update-join-BfY0GnDs.js.map → openmeld-tools-update-join-D24llJ9L.js.map} +1 -1
- package/dist/{openmeld-tools-update-process-frame-B-XB4dmO.js → openmeld-tools-update-process-frame-BtFKp70p.js} +2 -2
- package/dist/{openmeld-tools-update-process-frame-B-XB4dmO.js.map → openmeld-tools-update-process-frame-BtFKp70p.js.map} +1 -1
- package/dist/{openmeld-tools-update-process-frame-j-RXwFsK.js → openmeld-tools-update-process-frame-DbEZ3fEh.js} +1 -1
- package/dist/openmeld.js +9 -5
- package/dist/openmeld.js.map +1 -1
- package/dist/{prepare-provider-runtime-CWZcuMF6.js → prepare-provider-runtime-MB-BxOgt.js} +3342 -1327
- package/dist/prepare-provider-runtime-MB-BxOgt.js.map +1 -0
- package/dist/{prepare-session-executor-CkDxstsf.js → prepare-session-executor-zvSZ6jqy.js} +29 -28
- package/dist/prepare-session-executor-zvSZ6jqy.js.map +1 -0
- package/dist/{presenter-BcxiQyJg.js → presenter-MJ5YgsOT.js} +3 -13
- package/dist/presenter-MJ5YgsOT.js.map +1 -0
- package/dist/{process-channel-BQwtOlRc.js → process-channel-CgbduFCz.js} +2 -2
- package/dist/{process-channel-BQwtOlRc.js.map → process-channel-CgbduFCz.js.map} +1 -1
- package/dist/process-environment-BWSFeUu6.js +49 -0
- package/dist/process-environment-BWSFeUu6.js.map +1 -0
- package/dist/process-identity-BQLdaZdB.js +190 -0
- package/dist/process-identity-BQLdaZdB.js.map +1 -0
- package/dist/process-launch-B0pHlkV_.js +173 -0
- package/dist/process-launch-B0pHlkV_.js.map +1 -0
- package/dist/{published-production-safety-dp-fOmmB.js → published-production-safety-C40hKrBA.js} +2 -2
- package/dist/{published-production-safety-dp-fOmmB.js.map → published-production-safety-C40hKrBA.js.map} +1 -1
- package/dist/{runtime-BYaFkkLK.js → runtime-D6jItuQ-.js} +155 -702
- package/dist/runtime-D6jItuQ-.js.map +1 -0
- package/dist/{runtime-agent-controller-reporting-submission-BUUub9_1.js → runtime-agent-controller-reporting-submission-D9ysbi7R.js} +9 -9
- package/dist/{runtime-agent-controller-reporting-submission-BUUub9_1.js.map → runtime-agent-controller-reporting-submission-D9ysbi7R.js.map} +1 -1
- package/dist/{runtime-reporting-health-state-BgwfrH7f.js → runtime-reporting-health-state-DA-_vW-n.js} +2210 -60
- package/dist/runtime-reporting-health-state-DA-_vW-n.js.map +1 -0
- package/dist/{runtime-transport-Cc_RN-PL.js → runtime-transport-YIYHSJPn.js} +99 -14
- package/dist/runtime-transport-YIYHSJPn.js.map +1 -0
- package/dist/{service-CfO38_a-.js → service-Dz2MsvGr.js} +126 -550
- package/dist/service-Dz2MsvGr.js.map +1 -0
- package/dist/{service-account-admission-Dy2W3n3_.js → service-account-admission-BfdJ-kKR.js} +18 -10
- package/dist/service-account-admission-BfdJ-kKR.js.map +1 -0
- package/dist/{service-account-authorization-DKpIpxXo.js → service-account-authorization-DZbUOD29.js} +6 -6
- package/dist/{service-account-authorization-DKpIpxXo.js.map → service-account-authorization-DZbUOD29.js.map} +1 -1
- package/dist/{service-account-control-CCPQAZzn.js → service-account-control-DCMOKXDT.js} +16 -16
- package/dist/service-account-control-DCMOKXDT.js.map +1 -0
- package/dist/{service-control-capabilities-C9UHSMPz.js → service-control-capabilities-3_bdeHXu.js} +1 -1
- package/dist/{service-control-capabilities-xGylBNoH.js → service-control-capabilities-Bb738e_d.js} +19 -15
- package/dist/service-control-capabilities-Bb738e_d.js.map +1 -0
- package/dist/{service-control-carrier-capability-DDNyE5cB.js → service-control-carrier-capability-gMk5gMKU.js} +11 -4
- package/dist/service-control-carrier-capability-gMk5gMKU.js.map +1 -0
- package/dist/{state-CQG3k9eh.js → state-GxF_KAM1.js} +4 -4
- package/dist/{state-CQG3k9eh.js.map → state-GxF_KAM1.js.map} +1 -1
- package/dist/{upgrade-D5FxGbh1.js → upgrade-DfJwCD5H.js} +52 -32
- package/dist/upgrade-DfJwCD5H.js.map +1 -0
- package/dist/upgrade-DgmYWeNu.js +4 -0
- package/dist/windows/openmeld-windows-process.exe +0 -0
- package/dist/windows-artifact-DJ9DKjfc.js +16 -0
- package/dist/windows-artifact-DJ9DKjfc.js.map +1 -0
- package/dist/windows-task-command-COu_6Ke3.js +74 -0
- package/dist/windows-task-command-COu_6Ke3.js.map +1 -0
- package/dist/windows-task-entry-CtRpUbiK.js +50 -0
- package/dist/windows-task-entry-CtRpUbiK.js.map +1 -0
- package/dist/{windows-user-task-Bx2yYnOM.js → windows-user-task-B8NcRg_u.js} +1 -1
- package/dist/{windows-user-task-CRGbKggi.js → windows-user-task-Io5QuEVR.js} +108 -51
- package/dist/windows-user-task-Io5QuEVR.js.map +1 -0
- package/package.json +12 -12
- package/skills/openmeld-cli/playbooks/space-ops.md +9 -3
- package/skills/openmeld-cli/references/commands.md +0 -1
- package/dist/auth-session-D8dbMpaK.js +0 -4
- package/dist/auth-session-nhS8jyux.js.map +0 -1
- package/dist/cli-binary-manifest-DiUulkp0.js.map +0 -1
- package/dist/cli-space-api-CQtKu9Zt.js.map +0 -1
- package/dist/command-Bz9x7V2T.js.map +0 -1
- package/dist/context-l_31Mn4X.js +0 -473
- package/dist/context-l_31Mn4X.js.map +0 -1
- package/dist/daemon-device-id-DWO9_QW6.js.map +0 -1
- package/dist/daemon-frame-transport-D2-tazuK.js.map +0 -1
- package/dist/daemon-lifecycle-journal-DyKx1xzm.js.map +0 -1
- package/dist/daemon-service-manager-HL4VKbIU.js.map +0 -1
- package/dist/daemon-service-runtime-bKt0YjC7.js.map +0 -1
- package/dist/daemon-service-update-coordinator-D8O1uTtu.js.map +0 -1
- package/dist/dist-B07ziN_u.js.map +0 -1
- package/dist/dist-B2EauBG6.js.map +0 -1
- package/dist/dist-DhWI1iyi.js +0 -4
- package/dist/local-components-B6SCXZf9.js.map +0 -1
- package/dist/lock-Bsl_ElWy.js.map +0 -1
- package/dist/openmeld-BQy0nMox.js.map +0 -1
- package/dist/openmeld-maintenance-worker-BSODPHbn.js.map +0 -1
- package/dist/prepare-provider-runtime-CWZcuMF6.js.map +0 -1
- package/dist/prepare-session-executor-CkDxstsf.js.map +0 -1
- package/dist/presenter-BcxiQyJg.js.map +0 -1
- package/dist/process-identity-CNus0e6E.js +0 -146
- package/dist/process-identity-CNus0e6E.js.map +0 -1
- package/dist/runtime-BYaFkkLK.js.map +0 -1
- package/dist/runtime-reporting-health-state-BgwfrH7f.js.map +0 -1
- package/dist/runtime-transport-Cc_RN-PL.js.map +0 -1
- package/dist/service-CfO38_a-.js.map +0 -1
- package/dist/service-account-admission-Dy2W3n3_.js.map +0 -1
- package/dist/service-account-control-CCPQAZzn.js.map +0 -1
- package/dist/service-control-capabilities-xGylBNoH.js.map +0 -1
- package/dist/service-control-carrier-capability-DDNyE5cB.js.map +0 -1
- package/dist/upgrade-D5FxGbh1.js.map +0 -1
- package/dist/upgrade-DhFEu0k6.js +0 -4
- package/dist/windows-user-task-CRGbKggi.js.map +0 -1
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { a as formatOpenMeldCliTextBlock } from "./cli-entry-command-CR_9QU1i.js";
|
|
4
|
+
import { n as outJsonLine, r as outLine, t as errLine } from "./io-DT66typ4.js";
|
|
4
5
|
import { stripVTControlCharacters } from "node:util";
|
|
5
6
|
import pc from "picocolors";
|
|
6
|
-
//#region src/ui/io.ts
|
|
7
|
-
function outLine(line) {
|
|
8
|
-
process.stdout.write(`${line}\n`);
|
|
9
|
-
}
|
|
10
|
-
function outJsonLine(value) {
|
|
11
|
-
process.stdout.write(`${JSON.stringify(value)}\n`);
|
|
12
|
-
}
|
|
13
|
-
function errLine(line) {
|
|
14
|
-
process.stderr.write(`${line}\n`);
|
|
15
|
-
}
|
|
16
|
-
//#endregion
|
|
17
7
|
//#region src/runtime/messages.ts
|
|
18
8
|
const SENTENCE_END_PATTERN = /[.!?]$/u;
|
|
19
9
|
const HUMAN_MESSAGES = {
|
|
@@ -357,6 +347,6 @@ function createPresenter(context) {
|
|
|
357
347
|
return context.resolvedView === "agent" ? createAgentPresenter({ context }) : createHumanPresenter({ context });
|
|
358
348
|
}
|
|
359
349
|
//#endregion
|
|
360
|
-
export {
|
|
350
|
+
export { sanitizeTerminalDisplayText as n, formatMessage as r, createPresenter as t };
|
|
361
351
|
|
|
362
|
-
//# sourceMappingURL=presenter-
|
|
352
|
+
//# sourceMappingURL=presenter-MJ5YgsOT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presenter-MJ5YgsOT.js","names":[],"sources":["../src/runtime/messages.ts","../src/runtime/presenter/agent.ts","../src/ui/terminal-safe-text.ts","../src/runtime/presenter/human.ts","../src/runtime/presenter/index.ts"],"sourcesContent":["import { formatOpenMeldCliTextBlock } from \"./cli-entry-command\";\nimport type { ResolvedCliView } from \"./types\";\n\ntype MessageResolver = (params?: Record<string, unknown>) => string;\n\ntype Catalog = Record<string, MessageResolver>;\n\nconst SENTENCE_END_PATTERN = /[.!?]$/u;\n\n// Keep literal keys for strict MessageKey derivation used by override validation.\nconst HUMAN_MESSAGES = {\n \"whoami.loaded\": (params) =>\n `Profile loaded (profile: ${String(params?.profile ?? \"unknown\")}).`,\n \"space.menu.interactive_required\": () =>\n \"This menu only works in an interactive terminal. Run `openmeld space --help`.\",\n \"space.target.missing\": (params) =>\n `Add a Space ID after \\`openmeld space ${String(params?.command ?? \"join\")}\\`, then try again.`,\n \"space.target.invalid\": (_params) =>\n \"That Space ID isn't valid. Copy the full Space ID, then try again.\",\n \"signal.id.invalid\": (params) =>\n `That ${String(params?.flag ?? \"signal\")} ID is incomplete. Copy the full signal ID from \\`openmeld space history --view agent\\`, then try again.`,\n \"space.create.created\": (params) =>\n `Space created: ${String(params?.spaceId ?? \"unknown\")}`,\n \"space.join.stdin_fallback_watch\": (params) =>\n formatJoinNoStdioMessage(\"human\", params),\n \"space.join.bootstrap_context\": (params) =>\n formatJoinBootstrapContextMessage(\"human\", params),\n \"space.guide.current\": (params) =>\n `Space guide for ${String(params?.spaceId ?? \"unknown\")}:`,\n \"space.guide.empty\": () => \"(empty)\",\n \"space.guide.updated\": (params) =>\n `Space guide updated for ${String(params?.spaceId ?? \"unknown\")}.`,\n \"space.password.updated\": (params) =>\n `Space password updated for ${String(params?.spaceId ?? \"unknown\")}.`,\n \"space.password.cleared\": (params) =>\n `Space password cleared for ${String(params?.spaceId ?? \"unknown\")}.`,\n \"space.password.warning\": () =>\n \"Important: Save this password securely. If lost, it cannot be recovered. Reset is the only option.\",\n \"profile.menu.interactive_required\": () =>\n \"This menu only works in an interactive terminal. Run `openmeld profiles --help`.\",\n \"profile.no_profiles\": () =>\n \"No OpenMeld profiles found. Sign in with `openmeld login` or create one with `openmeld profiles create`.\",\n \"profile.target.missing\": (params) =>\n `Add a profile ID after \\`openmeld profiles ${String(params?.action ?? \"set\")}\\`, then try again.`,\n \"profile.delete.force_required\": () =>\n \"Add `--force` to delete a profile from a non-interactive terminal.\",\n \"profile.current_set\": (params) =>\n `Current profile: ${String(params?.profile ?? \"unknown\")}. New OpenMeld commands will use this profile by default unless you pass \\`--profile\\`.`,\n \"profile.selection.non_persistent\": () =>\n \"Warning: this temporary OpenMeld CLI context only uses the selected profile for this command.\",\n \"profile.deleted\": (params) =>\n `Deleted profile: ${String(params?.profile ?? \"unknown\")}.`,\n \"profile.current_switched\": (params) =>\n `Current profile switched to: ${String(params?.profile ?? \"unknown\")}.`,\n \"profile.no_active\": () => \"No OpenMeld profile is currently selected.\",\n \"profile.update.missing_changes\": () =>\n \"Choose at least one profile setting to update. Run `openmeld profile update --help` to see the options.\",\n \"profile.update.candidates_required\": () =>\n \"Choose a profile first. Available profiles are listed above.\",\n \"routines.error\": (params) =>\n String(params?.message ?? \"Routine action couldn't finish.\"),\n \"doctor.summary.failed\": () => \"OpenMeld diagnostics found issues.\",\n \"send.sent\": () => \"Sent.\",\n \"tail.empty\": () => \"(no signals yet)\",\n \"space.updates.empty\": () => \"(no updates found after this signal)\",\n \"init.profile_initialized\": (params) =>\n `Profile initialized: ${String(params?.profile ?? \"unknown\")}.`,\n \"connect.connecting\": (params) =>\n `Connecting to ${String(params?.wsUrl ?? \"\")}`,\n \"connect.warn.persist_last_seen\": (_params) =>\n \"OpenMeld couldn't save where you left off. Live updates will continue.\",\n \"connect.warn.persist_recent_mentions\": (_params) =>\n \"OpenMeld couldn't save your recent @ mentions. Live updates will continue.\",\n \"connect.warn.cursor_fetch_failed\": (_params) =>\n \"OpenMeld couldn't load where you left off. Live updates will continue.\",\n \"connect.warn.cursor_patch_failed\": (_params) =>\n \"OpenMeld couldn't save your new place. Live updates will continue.\",\n \"connect.warn.catchup_failed\": (_params) =>\n \"OpenMeld couldn't load every recent message. Live updates will continue.\",\n \"connect.warn.catchup_live_buffer_overflow\": (_params) =>\n \"OpenMeld couldn't load every recent message. Live updates will continue, but your place won't be saved in this session.\",\n \"connect.warn.cursor_sync_paused\": () =>\n \"Live updates will continue, but OpenMeld won't save your place in this session.\",\n \"connect.warn.meta_fetch_failed\": (_params) =>\n \"OpenMeld couldn't load this Space's details.\",\n \"connect.warn.members_fetch_failed\": (_params) =>\n \"OpenMeld couldn't load this Space's members.\",\n \"connect.warn.profile_space_history_sync_failed\": (_params) =>\n \"OpenMeld couldn't save this Space to your recent history.\",\n \"connect.closed\": () => \"Connection closed.\",\n \"connect.closed_with_code_reason\": (params) =>\n `The connection closed.${formatHumanHintSentence(params?.hint)}`,\n \"connect.error\": (params) => formatHumanConnectError(params),\n \"connect.error.space_not_found\": (_params) =>\n `OpenMeld couldn't find that Space. Check the Space ID, then try again.`,\n \"connect.closing\": (params) =>\n `Closing the connection (${String(params?.why ?? \"\")})...`,\n \"connect.watch_ready\": () => \"Watching the stream. Press Ctrl+C to quit.\",\n \"connect.connected_no_stdio\": (params) =>\n formatConnectedNoStdioMessage(\"human\", params),\n \"connect.chat_mention_hint\": () =>\n \"Press @ to insert an Agent Wake, Agent Reference, or Human Mention.\",\n \"connect.chat_ready\": () => \"Type your message and press Enter to send.\",\n \"connect.chat_exit_hint\": () => \"Exit with '/quit', ':q', Ctrl+D, or Ctrl+C.\",\n \"connect.chat_prompt_question\": () =>\n \"What would you like to say in this space?\",\n \"connect.connected_stdio\": () =>\n 'Connected in `--stdio` mode. Type a line and press Enter. Use Ctrl+D, Ctrl+C, \"/quit\", or \":q\" to exit.',\n \"connect.reject\": (params) =>\n `Rejected: ${String(params?.reason ?? \"unknown\")}`,\n \"connect.space_guide\": (params) =>\n `Space guide (${String(params?.spaceId ?? \"unknown\")}):`,\n} as const satisfies Catalog;\n\nconst AGENT_MESSAGES = {\n \"whoami.loaded\": (params) =>\n `whoami loaded for profile ${String(params?.profile ?? \"unknown\")}`,\n \"space.menu.interactive_required\": () =>\n \"interactive menu is disabled in agent view; use explicit command arguments\",\n \"space.target.missing\": (params) =>\n `missing required 'space' argument for \\`openmeld space ${String(params?.command ?? \"join\")}\\``,\n \"space.target.invalid\": (params) =>\n `invalid space target: ${String(params?.space ?? \"unknown\")} (must be a 64-character hex ID)`,\n \"signal.id.invalid\": (params) =>\n `invalid ${String(params?.flag ?? \"signal\")} value: ${String(params?.value ?? \"unknown\")} (must be a full 36-character UUID signal ID, not a short prefix; read signalId from \\`openmeld space history --view agent\\`)`,\n \"space.create.created\": (params) =>\n `Space created: ${String(params?.spaceId ?? \"unknown\")}`,\n \"space.join.stdin_fallback_watch\": (params) =>\n formatJoinNoStdioMessage(\"agent\", params),\n \"space.join.bootstrap_context\": (params) =>\n formatJoinBootstrapContextMessage(\"agent\", params),\n \"space.guide.current\": (params) =>\n `space guide for ${String(params?.spaceId ?? \"unknown\")}:`,\n \"space.guide.empty\": () => \"space guide is empty\",\n \"space.guide.updated\": (params) =>\n `space guide updated for ${String(params?.spaceId ?? \"unknown\")}`,\n \"space.password.updated\": (params) =>\n `space password set for ${String(params?.spaceId ?? \"unknown\")}`,\n \"space.password.cleared\": (params) =>\n `space password cleared for ${String(params?.spaceId ?? \"unknown\")}`,\n \"space.password.warning\": () =>\n \"Important: Save this password securely. If lost, it cannot be recovered. Reset is the only option.\",\n \"profile.menu.interactive_required\": () =>\n \"interactive profile menu is disabled in agent view; use `openmeld profiles list`, `set`, `update`, or `delete` with explicit arguments\",\n \"profile.no_profiles\": () =>\n \"no OpenMeld profiles found for this account; run `openmeld login` or `openmeld profiles create`\",\n \"profile.target.missing\": (params) =>\n `missing required 'profile' argument for \\`openmeld profiles ${String(params?.action ?? \"set\")}\\``,\n \"profile.delete.force_required\": () =>\n \"profile delete requires `--force` in non-interactive mode\",\n \"profile.current_set\": (params) =>\n `profile selected: ${String(params?.profile ?? \"unknown\")} (subsequent OpenMeld commands use it by default unless --profile is provided)`,\n \"profile.selection.non_persistent\": () =>\n \"non-persistent OpenMeld CLI context; the selected OpenMeld profile applies only to this process\",\n \"profile.deleted\": (params) =>\n `profile deleted: ${String(params?.profile ?? \"unknown\")}`,\n \"profile.current_switched\": (params) =>\n `selected profile switched to ${String(params?.profile ?? \"unknown\")}`,\n \"profile.no_active\": () => \"no active OpenMeld profile selected\",\n \"profile.update.missing_changes\": () =>\n \"`openmeld profile update` requires at least one update option\",\n \"profile.update.candidates_required\": () =>\n \"profile update requires explicit profile argument; candidates listed above\",\n \"routines.error\": (params) =>\n String(params?.message ?? \"Routine command failed.\"),\n \"doctor.summary.failed\": () => \"diagnostics found issues\",\n \"send.sent\": () => \"signal sent\",\n \"tail.empty\": () => \"no signals found\",\n \"space.updates.empty\": () => \"no updates found after this signal\",\n \"init.profile_initialized\": (params) =>\n `profile initialized: ${String(params?.profile ?? \"unknown\")}`,\n \"connect.connecting\": (params) =>\n `connecting to ${String(params?.wsUrl ?? \"\")}`,\n \"connect.warn.persist_last_seen\": (params) =>\n `warning: couldn't save where you left off in this space: ${String(params?.error ?? \"unknown\")}`,\n \"connect.warn.persist_recent_mentions\": (params) =>\n `warning: couldn't save recent @ targets for this space: ${String(params?.error ?? \"unknown\")}`,\n \"connect.warn.cursor_fetch_failed\": (params) =>\n `warning: couldn't load current place in this space: ${String(params?.error ?? \"unknown\")}`,\n \"connect.warn.cursor_patch_failed\": (params) =>\n `warning: couldn't update current place in this space: ${String(params?.error ?? \"unknown\")}`,\n \"connect.warn.catchup_failed\": (params) =>\n `warning: couldn't catch up to recent messages: ${String(params?.error ?? \"unknown\")}`,\n \"connect.warn.catchup_live_buffer_overflow\": (_params) =>\n \"warning: catch-up could not finish; continuing live updates without saving your place for this session\",\n \"connect.warn.cursor_sync_paused\": () =>\n \"warning: continuing live updates without saving your place for this session\",\n \"connect.warn.meta_fetch_failed\": (params) =>\n `warning: couldn't load space details: ${String(params?.error ?? \"unknown\")}`,\n \"connect.warn.members_fetch_failed\": (params) =>\n `warning: couldn't load space members: ${String(params?.error ?? \"unknown\")}`,\n \"connect.warn.profile_space_history_sync_failed\": (params) =>\n `warning: couldn't update recent space history: ${String(params?.error ?? \"unknown\")}`,\n \"connect.closed\": () => \"connection closed\",\n \"connect.closed_with_code_reason\": (params) =>\n `connection closed code=${String(params?.code ?? \"\")}${formatCodeLabelSuffix(params?.codeLabel)} reason=${String(params?.reason ?? \"\")}${formatHintSuffix(params?.hint)}`,\n \"connect.error\": (params) =>\n `connection error: ${String(params?.error ?? \"unknown\")}${formatHintSuffix(params?.hint)}`,\n \"connect.error.space_not_found\": (params) =>\n `space not found: ${String(params?.space ?? \"unknown\")} (join supports existing spaces only; create first via \\`openmeld space create --name <name> --visibility private\\`)`,\n \"connect.closing\": (params) =>\n `closing connection (${String(params?.why ?? \"\")})`,\n \"connect.watch_ready\": () => \"watch mode active; Ctrl+C to quit\",\n \"connect.connected_no_stdio\": (params) =>\n formatConnectedNoStdioMessage(\"agent\", params),\n \"connect.chat_mention_hint\": () =>\n \"choose a member with @ in the interactive picker, or use space send --wake, --reference, or --mention with a full Profile ID; typed text is literal\",\n \"connect.chat_ready\": () => \"chat mode active; type a line to send\",\n \"connect.chat_exit_hint\": () =>\n \"enter sends; line ending with \\\\ continues draft; exit with /quit, :q, Ctrl+D, or Ctrl+C\",\n \"connect.chat_prompt_question\": () => \"what would you like to say?\",\n \"connect.connected_stdio\": () => \"connected in stdio mode\",\n \"connect.reject\": (params) =>\n `input rejected: ${String(params?.reason ?? \"unknown\")}`,\n \"connect.space_guide\": (params) =>\n `space guide (${String(params?.spaceId ?? \"unknown\")}):`,\n} as const satisfies Record<MessageKey, MessageResolver>;\n\nexport type MessageKey = keyof typeof HUMAN_MESSAGES;\n\nexport function formatMessage(\n view: ResolvedCliView,\n key: MessageKey,\n params?: Record<string, unknown>,\n overrides?: Record<string, string>\n): string {\n const override = overrides?.[key];\n if (typeof override === \"string\" && override.length > 0) {\n return formatOpenMeldCliTextBlock(applyTemplate(override, params));\n }\n\n const catalog = view === \"agent\" ? AGENT_MESSAGES : HUMAN_MESSAGES;\n const resolver = catalog[key];\n if (!resolver) {\n return key;\n }\n return formatOpenMeldCliTextBlock(resolver(params));\n}\n\nfunction applyTemplate(\n template: string,\n params?: Record<string, unknown>\n): string {\n if (!params) {\n return template;\n }\n\n return template.replace(/\\{\\{\\s*([\\w.-]+)\\s*\\}\\}/g, (_all, name) => {\n const value = params[name];\n return value === undefined || value === null ? \"\" : String(value);\n });\n}\n\nfunction formatCodeLabelSuffix(codeLabel: unknown): string {\n if (typeof codeLabel !== \"string\") {\n return \"\";\n }\n const normalized = codeLabel.trim();\n if (normalized.length === 0) {\n return \"\";\n }\n return ` (${normalized})`;\n}\n\nfunction formatJoinNoStdioMessage(\n view: ResolvedCliView,\n params?: Record<string, unknown>\n): string {\n const sendCommandHint = formatSendCommandHint(params);\n if (view === \"agent\") {\n return `stdin unavailable; continuing as a stream-only join (no inline stdin input)${sendCommandHint}`;\n }\n return `stdin is not interactive; continuing as a stream-only join (no inline stdin input)${sendCommandHint}`;\n}\n\nfunction formatConnectedNoStdioMessage(\n view: ResolvedCliView,\n params?: Record<string, unknown>\n): string {\n if (resolveConnectionMode(params) !== \"join\") {\n return view === \"agent\"\n ? \"watch mode active; Ctrl+C to quit\"\n : \"watching stream. Press Ctrl+C to quit.\";\n }\n\n const sendCommand = resolveSendCommand(params);\n if (view === \"agent\") {\n return `joined in stream-only mode; use ${sendCommand} to send messages`;\n }\n return `joined in stream-only mode (no inline stdin input). Use ${sendCommand} to send messages. Press Ctrl+C to quit.`;\n}\n\nfunction formatSendCommandHint(params?: Record<string, unknown>): string {\n if (resolveConnectionMode(params) !== \"join\") {\n return \"\";\n }\n return `; send messages with ${resolveSendCommand(params)}`;\n}\n\nfunction resolveConnectionMode(\n params?: Record<string, unknown>\n): \"join\" | \"watch\" {\n const normalized = String(params?.connectionMode ?? \"\")\n .trim()\n .toLowerCase();\n return normalized === \"join\" ? \"join\" : \"watch\";\n}\n\nfunction resolveSendCommand(params?: Record<string, unknown>): string {\n const explicitCommand = String(params?.sendCommand ?? \"\").trim();\n if (explicitCommand.length > 0) {\n return `\\`${explicitCommand}\\``;\n }\n return \"`openmeld space send --profile <profile-id> <space-id> <text...>`\";\n}\n\nfunction formatJoinBootstrapContextMessage(\n view: ResolvedCliView,\n params?: Record<string, unknown>\n): string {\n const parts: string[] = [];\n const role = normalizeMessageValue(params?.role);\n const mentionAlias = normalizeMessageValue(params?.mentionAlias);\n const roleSource = resolveJoinBootstrapSourceLabel(\n params?.roleSource,\n view === \"human\"\n );\n const mentionAliasSource = resolveJoinBootstrapSourceLabel(\n params?.mentionAliasSource,\n view === \"human\"\n );\n\n if (role) {\n parts.push(`role \"${role}\" (${roleSource})`);\n }\n if (mentionAlias) {\n parts.push(`mention alias @${mentionAlias} (${mentionAliasSource})`);\n }\n\n if (parts.length === 0) {\n return view === \"agent\"\n ? \"join bootstrap context resolved\"\n : \"Join bootstrap context resolved.\";\n }\n\n const prefix =\n view === \"agent\" ? \"join bootstrap context:\" : \"Join context loaded:\";\n return `${prefix} ${parts.join(\"; \")}`;\n}\n\nfunction resolveJoinBootstrapSourceLabel(\n value: unknown,\n humanFriendly: boolean\n): string {\n const normalized = String(value ?? \"\")\n .trim()\n .toLowerCase();\n if (normalized === \"explicit\") {\n return \"explicit\";\n }\n if (normalized === \"cloud\" || normalized === \"local\") {\n return humanFriendly ? \"saved\" : normalized;\n }\n return humanFriendly ? \"unset\" : \"none\";\n}\n\nfunction normalizeMessageValue(value: unknown): string | null {\n if (typeof value !== \"string\") {\n return null;\n }\n const normalized = value.trim();\n return normalized.length > 0 ? normalized : null;\n}\n\nfunction formatHintSuffix(hint: unknown): string {\n if (typeof hint !== \"string\") {\n return \"\";\n }\n const normalized = hint.trim();\n if (normalized.length === 0) {\n return \"\";\n }\n return ` (hint: ${normalized})`;\n}\n\nfunction formatHumanConnectError(\n params: Record<string, unknown> | undefined\n): string {\n const error = String(params?.error ?? \"\").toLowerCase();\n let summary = \"OpenMeld lost the connection.\";\n if (error.includes(\"last message may not have been confirmed\")) {\n summary = \"OpenMeld lost the connection before confirming your message.\";\n } else if (error.includes(\"couldn't send the message\")) {\n summary = \"OpenMeld couldn't send your message.\";\n }\n return `${summary}${formatHumanHintSentence(params?.hint)}`;\n}\n\nfunction formatHumanHintSentence(hint: unknown): string {\n if (typeof hint !== \"string\") {\n return \"\";\n }\n const normalized = hint.trim();\n if (!normalized) {\n return \"\";\n }\n const sentence = `${normalized.slice(0, 1).toUpperCase()}${normalized.slice(1)}`;\n return ` ${SENTENCE_END_PATTERN.test(sentence) ? sentence : `${sentence}.`}`;\n}\n","import { outJsonLine } from \"../../ui/io\";\nimport { formatMessage, type MessageKey } from \"../messages\";\nimport type {\n Presenter,\n PresenterEventKind,\n PresenterEventOptions,\n PresenterFactoryInput,\n} from \"./types\";\n\nexport function createAgentPresenter(input: PresenterFactoryInput): Presenter {\n const messageOverrides = input.context.viewCustomization?.messages?.agent;\n const envelopeMode =\n input.context.viewCustomization?.render?.agent?.envelopeMode ?? \"verbose\";\n\n return {\n view: \"agent\",\n event: (\n kind: PresenterEventKind,\n key: MessageKey,\n params?: Record<string, unknown>,\n options?: PresenterEventOptions\n ) => {\n const message = formatMessage(\"agent\", key, params, messageOverrides);\n emitEnvelope(envelopeMode, {\n type: kind,\n code: options?.code ?? key,\n message,\n ...(params ? { data: params } : {}),\n });\n },\n line: (inputLine: {\n code: string;\n text: string;\n data?: Record<string, unknown>;\n }) => {\n emitEnvelope(envelopeMode, {\n type: \"line\",\n code: inputLine.code,\n text: inputLine.text,\n ...(inputLine.data ? { data: inputLine.data } : {}),\n });\n },\n data: (inputData: { code: string; payload: unknown }) => {\n emitEnvelope(envelopeMode, {\n type: \"result\",\n code: inputData.code,\n payload: inputData.payload,\n });\n },\n };\n}\n\nfunction emitEnvelope(\n mode: \"verbose\" | \"compact\",\n value: {\n type: string;\n code: string;\n message?: string;\n text?: string;\n data?: Record<string, unknown>;\n payload?: unknown;\n }\n): void {\n if (mode === \"compact\") {\n outJsonLine({\n t: value.type,\n c: value.code,\n ...(value.message ? { m: value.message } : {}),\n ...(value.text ? { x: value.text } : {}),\n ...(value.data ? { d: value.data } : {}),\n ...(value.payload === undefined ? {} : { p: value.payload }),\n });\n return;\n }\n\n outJsonLine(value);\n}\n","import { stripVTControlCharacters } from \"node:util\";\n\nexport type TerminalDisplaySanitizeMode = \"single-line\" | \"multi-line\";\n\n// Terminal display boundary only:\n// - strip executable VT/ANSI control sequences\n// - normalize CR/CRLF to LF before line-mode handling\n// - remove remaining non-printing C0/C1 controls while preserving tab/newline\nconst TAB_CHARACTER_CODE = 0x09;\nconst LINE_FEED_CHARACTER_CODE = 0x0a;\nconst C0_CONTROL_MAX_CODE = 0x1f;\nconst DELETE_CHARACTER_CODE = 0x7f;\nconst C1_CONTROL_MAX_CODE = 0x9f;\n\nexport function sanitizeTerminalDisplayText(\n value: string | number | null | undefined,\n mode: TerminalDisplaySanitizeMode = \"single-line\"\n): string {\n const normalizedValue = String(value ?? \"\");\n if (normalizedValue.length === 0) {\n return \"\";\n }\n\n const withNormalizedNewlines = normalizedValue.replace(/\\r\\n?/g, \"\\n\");\n const withoutTerminalSequences = stripVTControlCharacters(\n withNormalizedNewlines\n );\n const modeAdjusted =\n mode === \"single-line\"\n ? withoutTerminalSequences.replaceAll(\"\\n\", \" \")\n : withoutTerminalSequences;\n\n return removeRemainingTerminalControlCharacters(modeAdjusted);\n}\n\nfunction removeRemainingTerminalControlCharacters(value: string): string {\n let sanitized = \"\";\n for (const char of value) {\n if (isRemainingTerminalControlCharacter(char)) {\n continue;\n }\n sanitized += char;\n }\n return sanitized;\n}\n\nfunction isRemainingTerminalControlCharacter(char: string): boolean {\n const codePoint = char.codePointAt(0);\n if (codePoint === undefined) {\n return false;\n }\n if (\n codePoint === TAB_CHARACTER_CODE ||\n codePoint === LINE_FEED_CHARACTER_CODE\n ) {\n return false;\n }\n if (codePoint <= C0_CONTROL_MAX_CODE) {\n return true;\n }\n return codePoint >= DELETE_CHARACTER_CODE && codePoint <= C1_CONTROL_MAX_CODE;\n}\n","import pc from \"picocolors\";\nimport { errLine, outJsonLine, outLine } from \"../../ui/io\";\nimport { sanitizeTerminalDisplayText } from \"../../ui/terminal-safe-text\";\nimport { formatMessage, type MessageKey } from \"../messages\";\nimport type {\n Presenter,\n PresenterEventKind,\n PresenterFactoryInput,\n} from \"./types\";\n\nexport function createHumanPresenter(input: PresenterFactoryInput): Presenter {\n const messageOverrides = input.context.viewCustomization?.messages?.human;\n const dataMode = input.context.viewCustomization?.render?.human?.dataMode;\n\n return {\n view: \"human\",\n event: (\n kind: PresenterEventKind,\n key: MessageKey,\n params?: Record<string, unknown>\n ) => {\n const message = sanitizeTerminalDisplayText(\n formatMessage(\"human\", key, params, messageOverrides),\n \"single-line\"\n );\n errLine(formatHumanEventForTerminal({ kind, key, message }));\n },\n line: ({ text }: { code: string; text: string }) => {\n outLine(text);\n },\n data: (inputData: { code: string; payload: unknown }) => {\n if (dataMode === \"envelope\") {\n outJsonLine({\n type: \"result\",\n code: inputData.code,\n payload: inputData.payload,\n });\n return;\n }\n outJsonLine(inputData.payload);\n },\n };\n}\n\ntype TerminalEventTone = \"neutral\" | \"warning\" | \"error\";\n\nfunction formatHumanEventForTerminal(input: {\n kind: PresenterEventKind;\n key: MessageKey;\n message: string;\n}): string {\n if (process.stderr.isTTY !== true) {\n return input.message;\n }\n const tone = resolveTerminalEventTone(input);\n if (tone === \"neutral\") {\n return input.message;\n }\n const highlightedMessage = colorizeEventMessage({\n message: input.message,\n tone,\n });\n if (shouldInsertTopSpacing({ key: input.key, tone })) {\n return `\\n${highlightedMessage}`;\n }\n return highlightedMessage;\n}\n\nfunction resolveTerminalEventTone(input: {\n kind: PresenterEventKind;\n key: MessageKey;\n message: string;\n}): TerminalEventTone {\n if (input.kind === \"error\") {\n return \"error\";\n }\n if (input.key.startsWith(\"connect.warn.\")) {\n return \"warning\";\n }\n if (input.key === \"connect.closed_with_code_reason\") {\n return \"warning\";\n }\n const normalized = input.message.trim().toLowerCase();\n if (normalized.startsWith(\"warn:\")) {\n return \"warning\";\n }\n return \"neutral\";\n}\n\nfunction colorizeEventMessage(input: {\n tone: TerminalEventTone;\n message: string;\n}): string {\n if (input.tone === \"error\") {\n return pc.bold(pc.red(input.message));\n }\n return pc.bold(pc.yellow(input.message));\n}\n\nfunction shouldInsertTopSpacing(input: {\n key: MessageKey;\n tone: TerminalEventTone;\n}): boolean {\n if (input.tone === \"error\") {\n return true;\n }\n return input.key === \"connect.closed_with_code_reason\";\n}\n","import type { RuntimeContext } from \"../types\";\nimport { createAgentPresenter } from \"./agent\";\nimport { createHumanPresenter } from \"./human\";\nimport type { Presenter } from \"./types\";\n\nexport function createPresenter(context: RuntimeContext): Presenter {\n return context.resolvedView === \"agent\"\n ? createAgentPresenter({ context })\n : createHumanPresenter({ context });\n}\n\nexport type { Presenter } from \"./types\";\n"],"mappings":";;;;;;;AAOA,MAAM,uBAAuB;AAG7B,MAAM,iBAAiB;CACrB,kBAAkB,WAChB,4BAA4B,OAAO,QAAQ,WAAW,SAAS,EAAE;CACnE,yCACE;CACF,yBAAyB,WACvB,yCAAyC,OAAO,QAAQ,WAAW,MAAM,EAAE;CAC7E,yBAAyB,YACvB;CACF,sBAAsB,WACpB,QAAQ,OAAO,QAAQ,QAAQ,QAAQ,EAAE;CAC3C,yBAAyB,WACvB,kBAAkB,OAAO,QAAQ,WAAW,SAAS;CACvD,oCAAoC,WAClC,yBAAyB,SAAS,MAAM;CAC1C,iCAAiC,WAC/B,kCAAkC,SAAS,MAAM;CACnD,wBAAwB,WACtB,mBAAmB,OAAO,QAAQ,WAAW,SAAS,EAAE;CAC1D,2BAA2B;CAC3B,wBAAwB,WACtB,2BAA2B,OAAO,QAAQ,WAAW,SAAS,EAAE;CAClE,2BAA2B,WACzB,8BAA8B,OAAO,QAAQ,WAAW,SAAS,EAAE;CACrE,2BAA2B,WACzB,8BAA8B,OAAO,QAAQ,WAAW,SAAS,EAAE;CACrE,gCACE;CACF,2CACE;CACF,6BACE;CACF,2BAA2B,WACzB,8CAA8C,OAAO,QAAQ,UAAU,KAAK,EAAE;CAChF,uCACE;CACF,wBAAwB,WACtB,oBAAoB,OAAO,QAAQ,WAAW,SAAS,EAAE;CAC3D,0CACE;CACF,oBAAoB,WAClB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,qBAAqB;EAC9C,SAAS,MAAM;EACf;CACF,CAAC;CACD,IAAI,uBAAuB;EAAE,KAAK,MAAM;EAAK;CAAK,CAAC,GACjD,OAAO,KAAK;CAEd,OAAO;AACT;AAEA,SAAS,yBAAyB,OAIZ;CACpB,IAAI,MAAM,SAAS,SACjB,OAAO;CAET,IAAI,MAAM,IAAI,WAAW,eAAe,GACtC,OAAO;CAET,IAAI,MAAM,QAAQ,mCAChB,OAAO;CAGT,IADmB,MAAM,QAAQ,KAAK,CAAC,CAAC,YAC3B,CAAC,CAAC,WAAW,OAAO,GAC/B,OAAO;CAET,OAAO;AACT;AAEA,SAAS,qBAAqB,OAGnB;CACT,IAAI,MAAM,SAAS,SACjB,OAAO,GAAG,KAAK,GAAG,IAAI,MAAM,OAAO,CAAC;CAEtC,OAAO,GAAG,KAAK,GAAG,OAAO,MAAM,OAAO,CAAC;AACzC;AAEA,SAAS,uBAAuB,OAGpB;CACV,IAAI,MAAM,SAAS,SACjB,OAAO;CAET,OAAO,MAAM,QAAQ;AACvB;;;ACtGA,SAAgB,gBAAgB,SAAoC;CAClE,OAAO,QAAQ,iBAAiB,UAC5B,qBAAqB,EAAE,QAAQ,CAAC,IAChC,qBAAqB,EAAE,QAAQ,CAAC;AACtC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { t as ExecutionHostError } from "./channel-
|
|
3
|
+
import { t as ExecutionHostError } from "./channel-B2fD2_be.js";
|
|
4
4
|
//#region src/local-service/execution-host/process-channel.ts
|
|
5
5
|
function childExecutionHostChannel(child) {
|
|
6
6
|
return {
|
|
@@ -61,4 +61,4 @@ function parentExecutionHostChannel() {
|
|
|
61
61
|
//#endregion
|
|
62
62
|
export { parentExecutionHostChannel as n, childExecutionHostChannel as t };
|
|
63
63
|
|
|
64
|
-
//# sourceMappingURL=process-channel-
|
|
64
|
+
//# sourceMappingURL=process-channel-CgbduFCz.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-channel-
|
|
1
|
+
{"version":3,"file":"process-channel-CgbduFCz.js","names":[],"sources":["../src/local-service/execution-host/process-channel.ts"],"sourcesContent":["import type { ChildProcess } from \"node:child_process\";\nimport type { ExecutionHostChannel } from \"./channel\";\nimport { ExecutionHostError } from \"./channel\";\n\n// Use inherited Node-compatible IPC with JSON serialization. Provider stdout is\n// not a protocol channel; ordinary logs cannot become control messages.\nexport function childExecutionHostChannel(\n child: ChildProcess\n): ExecutionHostChannel {\n return {\n connected: () => child.connected,\n send: (message, completed) => {\n child.send(message, (error) => completed(error ?? null));\n },\n onMessage: (listener) => {\n child.on(\"message\", listener);\n return () => {\n child.off(\"message\", listener);\n };\n },\n onDisconnect: (listener) => {\n let observed = false;\n const finish = (error?: Error) => {\n if (!observed) {\n observed = true;\n listener(error);\n }\n };\n const exited = (code: number | null, signal: NodeJS.Signals | null) => {\n finish(\n new Error(`Host process exited (${signal ?? code ?? \"unknown\"})`)\n );\n };\n child.on(\"disconnect\", finish);\n child.on(\"exit\", exited);\n // Spawn/send failures must not become unhandled EventEmitter errors.\n child.on(\"error\", finish);\n return () => {\n child.off(\"disconnect\", finish);\n child.off(\"exit\", exited);\n child.off(\"error\", finish);\n };\n },\n };\n}\n\nexport function parentExecutionHostChannel(): ExecutionHostChannel {\n const send = process.send?.bind(process);\n if (!(send && process.connected)) {\n throw new ExecutionHostError(\n \"host.inherited_channel_required\",\n \"The execution host requires its supervisor's inherited IPC channel.\"\n );\n }\n return {\n connected: () => process.connected === true,\n send: (message, completed) => {\n send(message, undefined, undefined, (error) => completed(error ?? null));\n },\n onMessage: (listener) => {\n process.on(\"message\", listener);\n return () => {\n process.off(\"message\", listener);\n };\n },\n onDisconnect: (listener) => {\n process.on(\"disconnect\", listener);\n return () => {\n process.off(\"disconnect\", listener);\n };\n },\n };\n}\n"],"mappings":";;;;AAMA,SAAgB,0BACd,OACsB;CACtB,OAAO;EACL,iBAAiB,MAAM;EACvB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|
4
|
+
const WINDOWS_KEY_SPELLINGS = {
|
|
5
|
+
PATH: "PATH",
|
|
6
|
+
PATHEXT: "PATHEXT",
|
|
7
|
+
SYSTEMROOT: "SystemRoot",
|
|
8
|
+
COMSPEC: "ComSpec",
|
|
9
|
+
WINDIR: "WINDIR",
|
|
10
|
+
USERPROFILE: "USERPROFILE",
|
|
11
|
+
HOMEDRIVE: "HOMEDRIVE",
|
|
12
|
+
HOMEPATH: "HOMEPATH",
|
|
13
|
+
APPDATA: "APPDATA",
|
|
14
|
+
LOCALAPPDATA: "LOCALAPPDATA",
|
|
15
|
+
TEMP: "TEMP",
|
|
16
|
+
TMP: "TMP"
|
|
17
|
+
};
|
|
18
|
+
/** Match Node's Windows duplicate-key precedence, then use stable OS key names. */
|
|
19
|
+
function normalizeCommandEnvironment(source, platform = process.platform) {
|
|
20
|
+
if (platform !== "win32") return { ...source };
|
|
21
|
+
const result = {};
|
|
22
|
+
const seen = /* @__PURE__ */ new Set();
|
|
23
|
+
for (const key of Object.keys(source).sort()) {
|
|
24
|
+
const value = source[key];
|
|
25
|
+
const identity = key.toUpperCase();
|
|
26
|
+
if (value === void 0 || seen.has(identity)) continue;
|
|
27
|
+
seen.add(identity);
|
|
28
|
+
result[WINDOWS_KEY_SPELLINGS[identity] ?? key] = value;
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
/** Non-secret Windows runtime context needed by an independently started process. */
|
|
33
|
+
const WINDOWS_RUNTIME_ENV_KEYS = [
|
|
34
|
+
"SystemRoot",
|
|
35
|
+
"ComSpec",
|
|
36
|
+
"WINDIR",
|
|
37
|
+
"PATHEXT",
|
|
38
|
+
"USERPROFILE",
|
|
39
|
+
"HOMEDRIVE",
|
|
40
|
+
"HOMEPATH",
|
|
41
|
+
"APPDATA",
|
|
42
|
+
"LOCALAPPDATA",
|
|
43
|
+
"TEMP",
|
|
44
|
+
"TMP"
|
|
45
|
+
];
|
|
46
|
+
//#endregion
|
|
47
|
+
export { normalizeCommandEnvironment as n, WINDOWS_RUNTIME_ENV_KEYS as t };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=process-environment-BWSFeUu6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-environment-BWSFeUu6.js","names":[],"sources":["../../../runtime/adapters/core/dist/process-environment.js"],"sourcesContent":["const WINDOWS_KEY_SPELLINGS = {\n PATH: \"PATH\",\n PATHEXT: \"PATHEXT\",\n SYSTEMROOT: \"SystemRoot\",\n COMSPEC: \"ComSpec\",\n WINDIR: \"WINDIR\",\n USERPROFILE: \"USERPROFILE\",\n HOMEDRIVE: \"HOMEDRIVE\",\n HOMEPATH: \"HOMEPATH\",\n APPDATA: \"APPDATA\",\n LOCALAPPDATA: \"LOCALAPPDATA\",\n TEMP: \"TEMP\",\n TMP: \"TMP\",\n};\n/** Match Node's Windows duplicate-key precedence, then use stable OS key names. */\nexport function normalizeCommandEnvironment(source, platform = process.platform) {\n if (platform !== \"win32\") {\n return { ...source };\n }\n const result = {};\n const seen = new Set();\n for (const key of Object.keys(source).sort()) {\n const value = source[key];\n const identity = key.toUpperCase();\n if (value === undefined || seen.has(identity)) {\n continue;\n }\n seen.add(identity);\n result[WINDOWS_KEY_SPELLINGS[identity] ?? key] = value;\n }\n return result;\n}\n/** Non-secret Windows runtime context needed by an independently started process. */\nexport const WINDOWS_RUNTIME_ENV_KEYS = [\n \"SystemRoot\",\n \"ComSpec\",\n \"WINDIR\",\n \"PATHEXT\",\n \"USERPROFILE\",\n \"HOMEDRIVE\",\n \"HOMEPATH\",\n \"APPDATA\",\n \"LOCALAPPDATA\",\n \"TEMP\",\n \"TMP\",\n];\n"],"mappings":";;;AAAA,MAAM,wBAAwB;CAC1B,MAAM;CACN,SAAS;CACT,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,aAAa;CACb,WAAW;CACX,UAAU;CACV,SAAS;CACT,cAAc;CACd,MAAM;CACN,KAAK;AACT;;AAEA,SAAgB,4BAA4B,QAAQ,WAAW,QAAQ,UAAU;CAC7E,IAAI,aAAa,SACb,OAAO,EAAE,GAAG,OAAO;CAEvB,MAAM,SAAS,CAAC;CAChB,MAAM,uBAAO,IAAI,IAAI;CACrB,KAAK,MAAM,OAAO,OAAO,KAAK,MAAM,CAAC,CAAC,KAAK,GAAG;EAC1C,MAAM,QAAQ,OAAO;EACrB,MAAM,WAAW,IAAI,YAAY;EACjC,IAAI,UAAU,KAAA,KAAa,KAAK,IAAI,QAAQ,GACxC;EAEJ,KAAK,IAAI,QAAQ;EACjB,OAAO,sBAAsB,aAAa,OAAO;CACrD;CACA,OAAO;AACX;;AAEA,MAAa,2BAA2B;CACpC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { n as WINDOWS_PROCESS_HELPER_FILENAME } from "./windows-artifact-DJ9DKjfc.js";
|
|
4
|
+
import { n as normalizeCommandEnvironment } from "./process-environment-BWSFeUu6.js";
|
|
5
|
+
import { win32 } from "node:path";
|
|
6
|
+
import * as z$1 from "zod/v4";
|
|
7
|
+
import { execFile, execFileSync } from "node:child_process";
|
|
8
|
+
import { promisify } from "node:util";
|
|
9
|
+
import { fileURLToPath } from "node:url";
|
|
10
|
+
//#region ../../packages/schemas/dist/schemas/daemon/windows-native-process.js
|
|
11
|
+
const jobName = z$1.string().regex(/^Local\\OpenMeld-Process-[a-f0-9-]{36}$/u);
|
|
12
|
+
const text = z$1.string().min(1).refine((value) => !value.includes("\0"));
|
|
13
|
+
const windowsNativeProcessRequestSchema = z$1.discriminatedUnion("operation", [
|
|
14
|
+
z$1.strictObject({
|
|
15
|
+
operation: z$1.literal("activate-managed-command"),
|
|
16
|
+
binDirectory: text
|
|
17
|
+
}),
|
|
18
|
+
z$1.strictObject({
|
|
19
|
+
operation: z$1.literal("prune-binary-bundle"),
|
|
20
|
+
directory: text
|
|
21
|
+
}),
|
|
22
|
+
z$1.strictObject({
|
|
23
|
+
operation: z$1.literal("identity"),
|
|
24
|
+
pid: z$1.number().int().positive()
|
|
25
|
+
}),
|
|
26
|
+
z$1.strictObject({
|
|
27
|
+
operation: z$1.literal("launch"),
|
|
28
|
+
jobName,
|
|
29
|
+
executable: text,
|
|
30
|
+
commandLine: text.max(32766),
|
|
31
|
+
workingDirectory: text,
|
|
32
|
+
ownerPid: z$1.number().int().positive(),
|
|
33
|
+
ownerStartedAt: z$1.string().regex(/^\d{10,20}$/u)
|
|
34
|
+
}),
|
|
35
|
+
z$1.strictObject({
|
|
36
|
+
operation: z$1.literal("drain"),
|
|
37
|
+
jobName
|
|
38
|
+
})
|
|
39
|
+
]);
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region ../../runtime/adapters/core/dist/windows-native-process.js
|
|
42
|
+
const WINDOWS_NATIVE_PROCESS_REQUEST_ENV = "OPENMELD_NATIVE_JOB_REQUEST";
|
|
43
|
+
function resolveWindowsNativeProcessHelper() {
|
|
44
|
+
return fileURLToPath(new URL(`../dist/windows/${WINDOWS_PROCESS_HELPER_FILENAME}`, import.meta.url));
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region ../../runtime/adapters/core/dist/windows-system.js
|
|
48
|
+
function resolveWindowsPowerShellPath(env = process.env) {
|
|
49
|
+
const source = normalizeCommandEnvironment(env, "win32");
|
|
50
|
+
const root = source.SystemRoot ?? source.WINDIR;
|
|
51
|
+
if (!(root && win32.isAbsolute(root))) throw new Error("Windows system directory is unavailable.");
|
|
52
|
+
return win32.join(root, "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
|
|
53
|
+
}
|
|
54
|
+
function powerShellEncodedArguments(script) {
|
|
55
|
+
return [
|
|
56
|
+
"-NoLogo",
|
|
57
|
+
"-NoProfile",
|
|
58
|
+
"-NonInteractive",
|
|
59
|
+
"-EncodedCommand",
|
|
60
|
+
Buffer.from(script, "utf16le").toString("base64")
|
|
61
|
+
];
|
|
62
|
+
}
|
|
63
|
+
const FILE_TIME_PATTERN = /^\d{10,20}$/u;
|
|
64
|
+
const PROCESS_IDENTITY_TIMEOUT_MS = 15e3;
|
|
65
|
+
let currentProcessFileTime;
|
|
66
|
+
async function activateWindowsManagedCommand(binDirectory) {
|
|
67
|
+
const request = windowsNativeProcessRequestSchema.parse({
|
|
68
|
+
operation: "activate-managed-command",
|
|
69
|
+
binDirectory
|
|
70
|
+
});
|
|
71
|
+
const { stdout } = await promisify(execFile)(resolveWindowsNativeProcessHelper(), [], {
|
|
72
|
+
env: {
|
|
73
|
+
...process.env,
|
|
74
|
+
[WINDOWS_NATIVE_PROCESS_REQUEST_ENV]: Buffer.from(JSON.stringify(request), "utf8").toString("base64")
|
|
75
|
+
},
|
|
76
|
+
encoding: "utf8",
|
|
77
|
+
windowsHide: true,
|
|
78
|
+
timeout: 15e3,
|
|
79
|
+
maxBuffer: 4096
|
|
80
|
+
});
|
|
81
|
+
const result = stdout.trim();
|
|
82
|
+
if (result !== "activated" && result !== "already_active") throw new Error("Windows returned an invalid command activation receipt.");
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
/** Kernel sharing rules keep a live CLI and its helper together during pruning. */
|
|
86
|
+
async function pruneWindowsBinaryBundle(directory) {
|
|
87
|
+
const request = windowsNativeProcessRequestSchema.parse({
|
|
88
|
+
operation: "prune-binary-bundle",
|
|
89
|
+
directory
|
|
90
|
+
});
|
|
91
|
+
const { stdout } = await promisify(execFile)(resolveWindowsNativeProcessHelper(), [], {
|
|
92
|
+
env: {
|
|
93
|
+
...process.env,
|
|
94
|
+
[WINDOWS_NATIVE_PROCESS_REQUEST_ENV]: Buffer.from(JSON.stringify(request), "utf8").toString("base64")
|
|
95
|
+
},
|
|
96
|
+
encoding: "utf8",
|
|
97
|
+
windowsHide: true,
|
|
98
|
+
timeout: 15e3,
|
|
99
|
+
maxBuffer: 4096
|
|
100
|
+
});
|
|
101
|
+
const result = stdout.trim();
|
|
102
|
+
if (result !== "removed" && result !== "absent" && result !== "in_use" && result !== "unrecognized") throw new Error("Windows returned an invalid managed-version cleanup receipt.");
|
|
103
|
+
return result;
|
|
104
|
+
}
|
|
105
|
+
/** An opened process handle binds the observation to the actual instance, not a reused PID. */
|
|
106
|
+
function readWindowsProcessStartFileTime(pid) {
|
|
107
|
+
if (!(Number.isSafeInteger(pid) && pid > 0)) return null;
|
|
108
|
+
if (pid === process.pid && currentProcessFileTime) return currentProcessFileTime;
|
|
109
|
+
const request = windowsNativeProcessRequestSchema.parse({
|
|
110
|
+
operation: "identity",
|
|
111
|
+
pid
|
|
112
|
+
});
|
|
113
|
+
try {
|
|
114
|
+
const output = execFileSync(resolveWindowsNativeProcessHelper(), [], {
|
|
115
|
+
env: {
|
|
116
|
+
...process.env,
|
|
117
|
+
[WINDOWS_NATIVE_PROCESS_REQUEST_ENV]: Buffer.from(JSON.stringify(request), "utf8").toString("base64")
|
|
118
|
+
},
|
|
119
|
+
encoding: "utf8",
|
|
120
|
+
windowsHide: true,
|
|
121
|
+
timeout: PROCESS_IDENTITY_TIMEOUT_MS,
|
|
122
|
+
maxBuffer: 1024,
|
|
123
|
+
stdio: [
|
|
124
|
+
"ignore",
|
|
125
|
+
"pipe",
|
|
126
|
+
"ignore"
|
|
127
|
+
]
|
|
128
|
+
}).trim();
|
|
129
|
+
if (!FILE_TIME_PATTERN.test(output)) return null;
|
|
130
|
+
if (pid === process.pid) currentProcessFileTime = output;
|
|
131
|
+
return output;
|
|
132
|
+
} catch {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/system/process-identity.ts
|
|
138
|
+
const WINDOWS_PROCESS_IDENTITY_PATTERN = /^win32:\d{10,20}$/u;
|
|
139
|
+
function isPreciseProcessStartIdentity(value) {
|
|
140
|
+
return typeof value === "string" && (value.startsWith("ps:") && value.length > 3 || WINDOWS_PROCESS_IDENTITY_PATTERN.test(value));
|
|
141
|
+
}
|
|
142
|
+
const CURRENT_PROCESS_START_IDENTITY = readProcessStartIdentity(process.pid) ?? `fallback:${process.pid}:${Math.floor(Date.now() - process.uptime() * 1e3)}`;
|
|
143
|
+
function isProcessIdentityAlive(input, platform = process.platform) {
|
|
144
|
+
if (!isProcessAlive(input.ownerPid)) return false;
|
|
145
|
+
const observedIdentity = readProcessStartIdentity(input.ownerPid, platform);
|
|
146
|
+
if (isPreciseProcessStartIdentity(observedIdentity) && isPreciseProcessStartIdentity(input.ownerProcessStartedAt) && observedIdentity.split(":", 1)[0] === input.ownerProcessStartedAt.split(":", 1)[0]) return observedIdentity === input.ownerProcessStartedAt;
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
function readProcessStartIdentity(pid, platform = process.platform) {
|
|
150
|
+
if (!(Number.isSafeInteger(pid) && pid > 0)) return null;
|
|
151
|
+
if (platform === "win32") {
|
|
152
|
+
const created = readWindowsProcessStartFileTime(pid);
|
|
153
|
+
return created === null ? null : `win32:${created}`;
|
|
154
|
+
}
|
|
155
|
+
try {
|
|
156
|
+
const output = execFileSync("ps", [
|
|
157
|
+
"-o",
|
|
158
|
+
"lstart=",
|
|
159
|
+
"-p",
|
|
160
|
+
String(pid)
|
|
161
|
+
], {
|
|
162
|
+
encoding: "utf8",
|
|
163
|
+
stdio: [
|
|
164
|
+
"ignore",
|
|
165
|
+
"pipe",
|
|
166
|
+
"ignore"
|
|
167
|
+
],
|
|
168
|
+
timeout: 1e3,
|
|
169
|
+
windowsHide: true
|
|
170
|
+
}).trim();
|
|
171
|
+
return output.length > 0 ? `ps:${output}` : null;
|
|
172
|
+
} catch {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
function isProcessAlive(pid) {
|
|
177
|
+
try {
|
|
178
|
+
process.kill(pid, 0);
|
|
179
|
+
return true;
|
|
180
|
+
} catch (error) {
|
|
181
|
+
return !isNodeError(error, "ESRCH");
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function isNodeError(error, code) {
|
|
185
|
+
return error instanceof Error && "code" in error && String(error.code) === code;
|
|
186
|
+
}
|
|
187
|
+
//#endregion
|
|
188
|
+
export { activateWindowsManagedCommand as a, readWindowsProcessStartFileTime as c, resolveWindowsNativeProcessHelper as d, windowsNativeProcessRequestSchema as f, readProcessStartIdentity as i, resolveWindowsPowerShellPath as l, isPreciseProcessStartIdentity as n, powerShellEncodedArguments as o, isProcessIdentityAlive as r, pruneWindowsBinaryBundle as s, CURRENT_PROCESS_START_IDENTITY as t, WINDOWS_NATIVE_PROCESS_REQUEST_ENV as u };
|
|
189
|
+
|
|
190
|
+
//# sourceMappingURL=process-identity-BQLdaZdB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-identity-BQLdaZdB.js","names":[],"sources":["../../../packages/schemas/dist/schemas/daemon/windows-native-process.js","../../../runtime/adapters/core/dist/windows-native-process.js","../../../runtime/adapters/core/dist/windows-system.js","../src/system/process-identity.ts"],"sourcesContent":["import * as z$1 from \"zod/v4\";\n//#region src/schemas/daemon/windows-native-process.ts\nconst jobName = z$1.string().regex(/^Local\\\\OpenMeld-Process-[a-f0-9-]{36}$/u);\nconst text = z$1.string().min(1).refine((value) => !value.includes(\"\\0\"));\nconst windowsNativeProcessRequestSchema = z$1.discriminatedUnion(\"operation\", [\n\tz$1.strictObject({\n\t\toperation: z$1.literal(\"activate-managed-command\"),\n\t\tbinDirectory: text\n\t}),\n\tz$1.strictObject({\n\t\toperation: z$1.literal(\"prune-binary-bundle\"),\n\t\tdirectory: text\n\t}),\n\tz$1.strictObject({\n\t\toperation: z$1.literal(\"identity\"),\n\t\tpid: z$1.number().int().positive()\n\t}),\n\tz$1.strictObject({\n\t\toperation: z$1.literal(\"launch\"),\n\t\tjobName,\n\t\texecutable: text,\n\t\tcommandLine: text.max(32766),\n\t\tworkingDirectory: text,\n\t\townerPid: z$1.number().int().positive(),\n\t\townerStartedAt: z$1.string().regex(/^\\d{10,20}$/u)\n\t}),\n\tz$1.strictObject({\n\t\toperation: z$1.literal(\"drain\"),\n\t\tjobName\n\t})\n]);\n//#endregion\nexport { windowsNativeProcessRequestSchema };\n\n//# sourceMappingURL=windows-native-process.js.map","import { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { WINDOWS_PROCESS_HELPER_FILENAME } from \"@openmeld/schemas\";\nexport const WINDOWS_NATIVE_PROCESS_REQUEST_ENV = \"OPENMELD_NATIVE_JOB_REQUEST\";\nexport function resolveWindowsNativeProcessHelper() {\n const binary = typeof __OPENMELD_DISTRIBUTION__ !== \"undefined\" &&\n __OPENMELD_DISTRIBUTION__ === \"binary\";\n return binary\n ? join(dirname(process.execPath), WINDOWS_PROCESS_HELPER_FILENAME)\n : fileURLToPath(\n // Both src/ (workspace tests) and dist/ (installed code) share this\n // package-owned build output. Never search another installation.\n new URL(`../dist/windows/${WINDOWS_PROCESS_HELPER_FILENAME}`, import.meta.url));\n}\n","import { execFile, execFileSync } from \"node:child_process\";\nimport { win32 } from \"node:path\";\nimport { promisify } from \"node:util\";\nimport { windowsNativeProcessRequestSchema } from \"@openmeld/schemas\";\nimport { normalizeCommandEnvironment } from \"./process-environment.js\";\nimport { resolveWindowsNativeProcessHelper, WINDOWS_NATIVE_PROCESS_REQUEST_ENV, } from \"./windows-native-process.js\";\nexport function resolveWindowsPowerShellPath(env = process.env) {\n const source = normalizeCommandEnvironment(env, \"win32\");\n const root = source.SystemRoot ?? source.WINDIR;\n if (!(root && win32.isAbsolute(root))) {\n throw new Error(\"Windows system directory is unavailable.\");\n }\n return win32.join(root, \"System32\", \"WindowsPowerShell\", \"v1.0\", \"powershell.exe\");\n}\nexport function powerShellEncodedArguments(script) {\n return [\n \"-NoLogo\",\n \"-NoProfile\",\n \"-NonInteractive\",\n \"-EncodedCommand\",\n Buffer.from(script, \"utf16le\").toString(\"base64\"),\n ];\n}\nconst FILE_TIME_PATTERN = /^\\d{10,20}$/u;\n// Keep native identity reads bounded; an unavailable identity fails admission.\nconst PROCESS_IDENTITY_TIMEOUT_MS = 15_000;\nlet currentProcessFileTime;\nexport async function activateWindowsManagedCommand(binDirectory) {\n const request = windowsNativeProcessRequestSchema.parse({\n operation: \"activate-managed-command\",\n binDirectory,\n });\n const { stdout } = await promisify(execFile)(resolveWindowsNativeProcessHelper(), [], {\n env: {\n ...process.env,\n [WINDOWS_NATIVE_PROCESS_REQUEST_ENV]: Buffer.from(JSON.stringify(request), \"utf8\").toString(\"base64\"),\n },\n encoding: \"utf8\",\n windowsHide: true,\n timeout: 15_000,\n maxBuffer: 4096,\n });\n const result = stdout.trim();\n if (result !== \"activated\" && result !== \"already_active\") {\n throw new Error(\"Windows returned an invalid command activation receipt.\");\n }\n return result;\n}\n/** Kernel sharing rules keep a live CLI and its helper together during pruning. */\nexport async function pruneWindowsBinaryBundle(directory) {\n const request = windowsNativeProcessRequestSchema.parse({\n operation: \"prune-binary-bundle\",\n directory,\n });\n const { stdout } = await promisify(execFile)(resolveWindowsNativeProcessHelper(), [], {\n env: {\n ...process.env,\n [WINDOWS_NATIVE_PROCESS_REQUEST_ENV]: Buffer.from(JSON.stringify(request), \"utf8\").toString(\"base64\"),\n },\n encoding: \"utf8\",\n windowsHide: true,\n timeout: 15_000,\n maxBuffer: 4096,\n });\n const result = stdout.trim();\n if (result !== \"removed\" &&\n result !== \"absent\" &&\n result !== \"in_use\" &&\n result !== \"unrecognized\") {\n throw new Error(\"Windows returned an invalid managed-version cleanup receipt.\");\n }\n return result;\n}\n/** An opened process handle binds the observation to the actual instance, not a reused PID. */\nexport function readWindowsProcessStartFileTime(pid) {\n if (!(Number.isSafeInteger(pid) && pid > 0)) {\n return null;\n }\n if (pid === process.pid && currentProcessFileTime) {\n return currentProcessFileTime;\n }\n const request = windowsNativeProcessRequestSchema.parse({\n operation: \"identity\",\n pid,\n });\n try {\n const output = execFileSync(resolveWindowsNativeProcessHelper(), [], {\n env: {\n ...process.env,\n [WINDOWS_NATIVE_PROCESS_REQUEST_ENV]: Buffer.from(JSON.stringify(request), \"utf8\").toString(\"base64\"),\n },\n encoding: \"utf8\",\n windowsHide: true,\n timeout: PROCESS_IDENTITY_TIMEOUT_MS,\n maxBuffer: 1024,\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n }).trim();\n if (!FILE_TIME_PATTERN.test(output)) {\n return null;\n }\n if (pid === process.pid) {\n currentProcessFileTime = output;\n }\n return output;\n }\n catch {\n return null;\n }\n}\n","import { execFileSync } from \"node:child_process\";\nimport { readWindowsProcessStartFileTime } from \"@openmeld/adapter-core/windows-system\";\n\nconst WINDOWS_PROCESS_IDENTITY_PATTERN = /^win32:\\d{10,20}$/u;\n\nexport function isPreciseProcessStartIdentity(value: unknown): value is string {\n return (\n typeof value === \"string\" &&\n ((value.startsWith(\"ps:\") && value.length > 3) ||\n WINDOWS_PROCESS_IDENTITY_PATTERN.test(value))\n );\n}\n\nexport const CURRENT_PROCESS_START_IDENTITY =\n readProcessStartIdentity(process.pid) ??\n `fallback:${process.pid}:${Math.floor(Date.now() - process.uptime() * 1000)}`;\n\nexport function isProcessIdentityAlive(\n input: { ownerPid: number; ownerProcessStartedAt: string },\n platform: NodeJS.Platform = process.platform\n): boolean {\n if (!isProcessAlive(input.ownerPid)) {\n return false;\n }\n const observedIdentity = readProcessStartIdentity(input.ownerPid, platform);\n if (\n isPreciseProcessStartIdentity(observedIdentity) &&\n isPreciseProcessStartIdentity(input.ownerProcessStartedAt) &&\n observedIdentity.split(\":\", 1)[0] ===\n input.ownerProcessStartedAt.split(\":\", 1)[0]\n ) {\n return observedIdentity === input.ownerProcessStartedAt;\n }\n // Fail closed when a live process cannot be identified precisely. A caller\n // may recover only after it can prove that the transition owner has exited.\n return true;\n}\n\nexport function readProcessStartIdentity(\n pid: number,\n platform: NodeJS.Platform = process.platform\n): string | null {\n if (!(Number.isSafeInteger(pid) && pid > 0)) {\n return null;\n }\n if (platform === \"win32\") {\n const created = readWindowsProcessStartFileTime(pid);\n return created === null ? null : `win32:${created}`;\n }\n try {\n const output = execFileSync(\"ps\", [\"-o\", \"lstart=\", \"-p\", String(pid)], {\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n timeout: 1000,\n windowsHide: true,\n }).trim();\n return output.length > 0 ? `ps:${output}` : null;\n } catch {\n return null;\n }\n}\n\nfunction isProcessAlive(pid: number): boolean {\n try {\n process.kill(pid, 0);\n return true;\n } catch (error) {\n return !isNodeError(error, \"ESRCH\");\n }\n}\n\nfunction isNodeError(error: unknown, code: string): boolean {\n return (\n error instanceof Error && \"code\" in error && String(error.code) === code\n );\n}\n"],"mappings":";;;;;;;;;;AAEA,MAAM,UAAU,IAAI,OAAO,CAAC,CAAC,MAAM,0CAA0C;AAC7E,MAAM,OAAO,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,UAAU,CAAC,MAAM,SAAS,IAAI,CAAC;AACxE,MAAM,oCAAoC,IAAI,mBAAmB,aAAa;CAC7E,IAAI,aAAa;EAChB,WAAW,IAAI,QAAQ,0BAA0B;EACjD,cAAc;CACf,CAAC;CACD,IAAI,aAAa;EAChB,WAAW,IAAI,QAAQ,qBAAqB;EAC5C,WAAW;CACZ,CAAC;CACD,IAAI,aAAa;EAChB,WAAW,IAAI,QAAQ,UAAU;EACjC,KAAK,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS;CAClC,CAAC;CACD,IAAI,aAAa;EAChB,WAAW,IAAI,QAAQ,QAAQ;EAC/B;EACA,YAAY;EACZ,aAAa,KAAK,IAAI,KAAK;EAC3B,kBAAkB;EAClB,UAAU,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS;EACtC,gBAAgB,IAAI,OAAO,CAAC,CAAC,MAAM,cAAc;CAClD,CAAC;CACD,IAAI,aAAa;EAChB,WAAW,IAAI,QAAQ,OAAO;EAC9B;CACD,CAAC;AACF,CAAC;;;AC3BD,MAAa,qCAAqC;AAClD,SAAg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mBAAmB,yBAAyB,MAAM,UAAU,QAAQ;CAC1E,IACE,8BAA8B,gBAAgB,KAC9C,8BAA8B,MAAM,qBAAqB,KACzD,iBAAiB,MAAM,KAAK,CAAC,CAAC,CAAC,OAC7B,MAAM,sBAAsB,MAAM,KAAK,CAAC,CAAC,CAAC,IAE5C,OAAO,qBAAqB,MAAM;CAIpC,OAAO;AACT;AAEA,SAAgB,yBACd,KACA,WAA4B,QAAQ,UACrB;CACf,IAAI,EAAE,OAAO,cAAc,GAAG,KAAK,MAAM,IACvC,OAAO;CAET,IAAI,aAAa,SAAS;EACxB,MAAM,UAAU,gCAAgC,GAAG;EACnD,OAAO,YAAY,OAAO,OAAO,SAAS;CAC5C;CACA,IAAI;EACF,MAAM,SAAS,aAAa,MAAM;GAAC;GAAM;GAAW;GAAM,OAAO,GAAG;EAAC,GAAG;GACtE,UAAU;GACV,OAAO;IAAC;IAAU;IAAQ;GAAQ;GAClC,SAAS;GACT,aAAa;EACf,CAAC,CAAC,CAAC,KAAK;EACR,OAAO,OAAO,SAAS,IAAI,MAAM,WAAW;CAC9C,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,eAAe,KAAsB;CAC5C,IAAI;EACF,QAAQ,KAAK,KAAK,CAAC;EACnB,OAAO;CACT,SAAS,OAAO;EACd,OAAO,CAAC,YAAY,OAAO,OAAO;CACpC;AACF;AAEA,SAAS,YAAY,OAAgB,MAAuB;CAC1D,OACE,iBAAiB,SAAS,UAAU,SAAS,OAAO,MAAM,IAAI,MAAM;AAExE"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { n as normalizeCommandEnvironment } from "./process-environment-BWSFeUu6.js";
|
|
4
|
+
import { basename, dirname, extname, join, resolve, sep, win32 } from "node:path";
|
|
5
|
+
import { closeSync, openSync, readSync, statSync } from "node:fs";
|
|
6
|
+
import { execFile } from "node:child_process";
|
|
7
|
+
import { promisify } from "node:util";
|
|
8
|
+
//#region ../../runtime/adapters/core/dist/process-launch.js
|
|
9
|
+
const CMD_META_CHARACTERS = /* @__PURE__ */ new Set("()[]%!^\"`<>&|;, *?");
|
|
10
|
+
const BATCH_PATH_PATTERN = /\.(?:cmd|bat)$/iu;
|
|
11
|
+
const NODE_SCRIPT_PATTERN = /\.(?:cjs|mjs|js)$/iu;
|
|
12
|
+
const INVALID_BATCH_TEXT = /[\r\n\0]/u;
|
|
13
|
+
const SCRIPT_LINES = /\r?\n/u;
|
|
14
|
+
const NPM_NODE_SHIM_PREFIX = [
|
|
15
|
+
"@echo off",
|
|
16
|
+
"goto start",
|
|
17
|
+
":find_dp0",
|
|
18
|
+
"set dp0=%~dp0",
|
|
19
|
+
"exit /b",
|
|
20
|
+
":start",
|
|
21
|
+
"setlocal",
|
|
22
|
+
"call :find_dp0",
|
|
23
|
+
"if exist \"%dp0%\\node.exe\" (",
|
|
24
|
+
"set \"_prog=%dp0%\\node.exe\"",
|
|
25
|
+
") else (",
|
|
26
|
+
"set \"_prog=node\"",
|
|
27
|
+
"set pathext=%pathext:;.js;=;%",
|
|
28
|
+
")"
|
|
29
|
+
];
|
|
30
|
+
const NPM_NODE_SHIM_LAUNCH = /^endlocal & goto #_undefined_# 2>nul \|\| title %comspec% & "%_prog%"\s+"%dp0%[\\/]([^"\r\n]+)" %\*$/iu;
|
|
31
|
+
/** Native argv at the process boundary; callers never interpolate args into a shell. */
|
|
32
|
+
function resolvePlatformCommand(file, args, source = process.env, platform = process.platform) {
|
|
33
|
+
if (platform !== "win32") return {
|
|
34
|
+
bin: file,
|
|
35
|
+
args: [...args]
|
|
36
|
+
};
|
|
37
|
+
const env = normalizeCommandEnvironment(source, platform);
|
|
38
|
+
const command = resolveWindowsCommandPath(file, env);
|
|
39
|
+
const nodeScript = NODE_SCRIPT_PATTERN.test(command) ? command : readNpmNodeShimTarget(command);
|
|
40
|
+
if (nodeScript) return {
|
|
41
|
+
bin: resolveWindowsNodeExecutable(dirname(command), env),
|
|
42
|
+
args: [nodeScript, ...args]
|
|
43
|
+
};
|
|
44
|
+
if (!BATCH_PATH_PATTERN.test(command)) return {
|
|
45
|
+
bin: command,
|
|
46
|
+
args: [...args]
|
|
47
|
+
};
|
|
48
|
+
if ([command, ...args].some((value) => INVALID_BATCH_TEXT.test(value))) throw Object.assign(/* @__PURE__ */ new Error("This Windows batch wrapper cannot preserve multiline arguments. Select the native executable or Node script for this command."), { code: "WINDOWS_BATCH_ARGUMENT_UNSUPPORTED" });
|
|
49
|
+
const escapedArgs = args.map((value) => {
|
|
50
|
+
return escapeCmdText(escapeCmdText(quoteWindowsProcessArgument(value)));
|
|
51
|
+
});
|
|
52
|
+
const statement = [escapeCmdText(win32.normalize(command)), ...escapedArgs].join(" ");
|
|
53
|
+
if (statement.length > 8e3) throw Object.assign(/* @__PURE__ */ new Error("This Windows batch command is too long. Select its native executable or Node script instead."), { code: "WINDOWS_BATCH_ARGUMENT_UNSUPPORTED" });
|
|
54
|
+
const root = env.SystemRoot ?? env.WINDIR;
|
|
55
|
+
if (!(root && win32.isAbsolute(root))) throw new Error("Windows system directory is unavailable.");
|
|
56
|
+
return {
|
|
57
|
+
bin: win32.join(root, "System32", "cmd.exe"),
|
|
58
|
+
args: [
|
|
59
|
+
"/d",
|
|
60
|
+
"/v:off",
|
|
61
|
+
"/s",
|
|
62
|
+
"/c",
|
|
63
|
+
`"${statement}"`
|
|
64
|
+
],
|
|
65
|
+
windowsVerbatimArguments: true
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** Windows CRT argv quoting, also used when CreateProcessW receives native argv. */
|
|
69
|
+
function quoteWindowsProcessArgument(value) {
|
|
70
|
+
if (value.includes("\0")) throw new Error("Process arguments must not contain a null byte.");
|
|
71
|
+
let quoted = "\"";
|
|
72
|
+
let slashes = 0;
|
|
73
|
+
for (const char of value) {
|
|
74
|
+
if (char === "\\") {
|
|
75
|
+
slashes += 1;
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
quoted += "\\".repeat(char === "\"" ? slashes * 2 + 1 : slashes) + char;
|
|
79
|
+
slashes = 0;
|
|
80
|
+
}
|
|
81
|
+
return `${quoted}${"\\".repeat(slashes * 2)}"`;
|
|
82
|
+
}
|
|
83
|
+
function escapeCmdText(value) {
|
|
84
|
+
return [...value].map((char) => CMD_META_CHARACTERS.has(char) ? `^${char}` : char).join("");
|
|
85
|
+
}
|
|
86
|
+
function isFile(path) {
|
|
87
|
+
try {
|
|
88
|
+
return statSync(path).isFile();
|
|
89
|
+
} catch {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function resolveWindowsCommandPath(file, source = process.env) {
|
|
94
|
+
if (file.includes("/") || file.includes("\\") || win32.isAbsolute(file)) return file;
|
|
95
|
+
const env = normalizeCommandEnvironment(source, "win32");
|
|
96
|
+
const extensions = (env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean).map((item) => item.toLowerCase());
|
|
97
|
+
const names = extname(file) ? [file] : [...extensions.map((extension) => `${file}${extension}`), file];
|
|
98
|
+
for (const directory of (env.PATH ?? "").split(";").filter(Boolean)) for (const name of names) {
|
|
99
|
+
const candidate = join(directory, name);
|
|
100
|
+
if (isFile(candidate)) return candidate;
|
|
101
|
+
}
|
|
102
|
+
return file;
|
|
103
|
+
}
|
|
104
|
+
function resolveWindowsNodeExecutable(directory, env) {
|
|
105
|
+
const sibling = join(directory, "node.exe");
|
|
106
|
+
if (isFile(sibling)) return sibling;
|
|
107
|
+
const onPath = resolveWindowsCommandPath("node.exe", env);
|
|
108
|
+
if (onPath !== "node.exe" && isFile(onPath)) return onPath;
|
|
109
|
+
if (!process.versions.electron && basename(process.execPath).toLowerCase() === "node.exe") return process.execPath;
|
|
110
|
+
throw Object.assign(/* @__PURE__ */ new Error("Node.js is required to run this Windows CLI. Install the supported Node.js release, then try again."), { code: "NODE_RUNTIME_NOT_FOUND" });
|
|
111
|
+
}
|
|
112
|
+
function readNpmNodeShimTarget(file) {
|
|
113
|
+
if (!BATCH_PATH_PATTERN.test(file)) return null;
|
|
114
|
+
let descriptor;
|
|
115
|
+
try {
|
|
116
|
+
descriptor = openSync(file, "r");
|
|
117
|
+
const buffer = Buffer.alloc(65537);
|
|
118
|
+
const size = readSync(descriptor, buffer, 0, buffer.length, 0);
|
|
119
|
+
if (size > 65536) return null;
|
|
120
|
+
const lines = buffer.subarray(0, size).toString("utf8").split(SCRIPT_LINES).map((line) => line.trim()).filter(Boolean);
|
|
121
|
+
if (lines.length !== NPM_NODE_SHIM_PREFIX.length + 1 || !NPM_NODE_SHIM_PREFIX.every((line, index) => lines[index]?.toLowerCase() === line)) return null;
|
|
122
|
+
const target = lines.at(-1)?.match(NPM_NODE_SHIM_LAUNCH)?.[1];
|
|
123
|
+
if (!(target && NODE_SCRIPT_PATTERN.test(target)) || target.includes("%")) return null;
|
|
124
|
+
return resolve(dirname(file), target.replaceAll("\\", sep));
|
|
125
|
+
} catch {
|
|
126
|
+
return null;
|
|
127
|
+
} finally {
|
|
128
|
+
if (descriptor !== void 0) closeSync(descriptor);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function executePlatformFile(file, args, options, callback) {
|
|
132
|
+
try {
|
|
133
|
+
const env = normalizeCommandEnvironment(options.env ?? process.env);
|
|
134
|
+
const invocation = resolvePlatformCommand(file, args, env);
|
|
135
|
+
return execFile(invocation.bin, invocation.args, {
|
|
136
|
+
...options,
|
|
137
|
+
encoding: "utf8",
|
|
138
|
+
env,
|
|
139
|
+
...process.platform === "win32" ? {
|
|
140
|
+
shell: false,
|
|
141
|
+
windowsHide: true,
|
|
142
|
+
windowsVerbatimArguments: invocation.windowsVerbatimArguments ?? false
|
|
143
|
+
} : {}
|
|
144
|
+
}, callback);
|
|
145
|
+
} catch (error) {
|
|
146
|
+
const failure = error instanceof Error ? error : /* @__PURE__ */ new Error("The native command could not be prepared.");
|
|
147
|
+
queueMicrotask(() => callback(failure, "", ""));
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function executePlatformFileAsync(file, args, options = {}) {
|
|
152
|
+
if (process.platform !== "win32") return promisify(execFile)(file, [...args], {
|
|
153
|
+
...options,
|
|
154
|
+
encoding: "utf8"
|
|
155
|
+
});
|
|
156
|
+
return new Promise((resolveResult, reject) => {
|
|
157
|
+
executePlatformFile(file, args, options, (error, stdout, stderr) => {
|
|
158
|
+
if (error) reject(Object.assign(error, {
|
|
159
|
+
stdout,
|
|
160
|
+
stderr
|
|
161
|
+
}));
|
|
162
|
+
else resolveResult({
|
|
163
|
+
stdout,
|
|
164
|
+
stderr
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
const execPlatformFile = Object.assign(executePlatformFile, { [promisify.custom]: executePlatformFileAsync });
|
|
170
|
+
//#endregion
|
|
171
|
+
export { resolveWindowsCommandPath as i, quoteWindowsProcessArgument as n, resolvePlatformCommand as r, execPlatformFile as t };
|
|
172
|
+
|
|
173
|
+
//# sourceMappingURL=process-launch-B0pHlkV_.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-launch-B0pHlkV_.js","names":[],"sources":["../../../runtime/adapters/core/dist/process-launch.js"],"sourcesContent":["import { execFile, } from \"node:child_process\";\nimport { closeSync, openSync, readSync, statSync } from \"node:fs\";\nimport { basename, dirname, extname, join, resolve, sep, win32, } from \"node:path\";\nimport { promisify } from \"node:util\";\nimport { normalizeCommandEnvironment } from \"./process-environment.js\";\nconst CMD_META_CHARACTERS = new Set('()[]%!^\"`<>&|;, *?');\nconst BATCH_PATH_PATTERN = /\\.(?:cmd|bat)$/iu;\nconst NODE_SCRIPT_PATTERN = /\\.(?:cjs|mjs|js)$/iu;\nconst INVALID_BATCH_TEXT = /[\\r\\n\\0]/u;\nconst SCRIPT_LINES = /\\r?\\n/u;\n// npm/cmd-shim's Node wrapper. Only this complete control prefix is unwrapped;\n// custom scripts keep their semantics through the escaped batch adapter below.\nconst NPM_NODE_SHIM_PREFIX = [\n \"@echo off\",\n \"goto start\",\n \":find_dp0\",\n \"set dp0=%~dp0\",\n \"exit /b\",\n \":start\",\n \"setlocal\",\n \"call :find_dp0\",\n 'if exist \"%dp0%\\\\node.exe\" (',\n 'set \"_prog=%dp0%\\\\node.exe\"',\n \") else (\",\n 'set \"_prog=node\"',\n \"set pathext=%pathext:;.js;=;%\",\n \")\",\n];\nconst NPM_NODE_SHIM_LAUNCH = /^endlocal & goto #_undefined_# 2>nul \\|\\| title %comspec% & \"%_prog%\"\\s+\"%dp0%[\\\\/]([^\"\\r\\n]+)\" %\\*$/iu;\n/** Native argv at the process boundary; callers never interpolate args into a shell. */\nexport function resolvePlatformCommand(file, args, source = process.env, platform = process.platform) {\n if (platform !== \"win32\") {\n return { bin: file, args: [...args] };\n }\n const env = normalizeCommandEnvironment(source, platform);\n const command = resolveWindowsCommandPath(file, env);\n const nodeScript = NODE_SCRIPT_PATTERN.test(command)\n ? command\n : readNpmNodeShimTarget(command);\n if (nodeScript) {\n return {\n bin: resolveWindowsNodeExecutable(dirname(command), env),\n args: [nodeScript, ...args],\n };\n }\n if (!BATCH_PATH_PATTERN.test(command)) {\n return { bin: command, args: [...args] };\n }\n if ([command, ...args].some((value) => INVALID_BATCH_TEXT.test(value))) {\n throw Object.assign(new Error(\"This Windows batch wrapper cannot preserve multiline arguments. Select the native executable or Node script for this command.\"), { code: \"WINDOWS_BATCH_ARGUMENT_UNSUPPORTED\" });\n }\n // A batch entry reparses forwarded arguments (for example through %*) even\n // outside node_modules/.bin. Protect both cmd parsing layers, not just npm's\n // conventional shim directory. Native executables and recognized Node shims\n // above do not pass through either layer.\n const escapedArgs = args.map((value) => {\n const escaped = escapeCmdText(quoteWindowsProcessArgument(value));\n return escapeCmdText(escaped);\n });\n const statement = [\n escapeCmdText(win32.normalize(command)),\n ...escapedArgs,\n ].join(\" \");\n if (statement.length > 8000) {\n throw Object.assign(new Error(\"This Windows batch command is too long. Select its native executable or Node script instead.\"), { code: \"WINDOWS_BATCH_ARGUMENT_UNSUPPORTED\" });\n }\n const root = env.SystemRoot ?? env.WINDIR;\n if (!(root && win32.isAbsolute(root))) {\n throw new Error(\"Windows system directory is unavailable.\");\n }\n return {\n bin: win32.join(root, \"System32\", \"cmd.exe\"),\n args: [\"/d\", \"/v:off\", \"/s\", \"/c\", `\"${statement}\"`],\n windowsVerbatimArguments: true,\n };\n}\n/** Windows CRT argv quoting, also used when CreateProcessW receives native argv. */\nexport function quoteWindowsProcessArgument(value) {\n if (value.includes(\"\\0\")) {\n throw new Error(\"Process arguments must not contain a null byte.\");\n }\n let quoted = '\"';\n let slashes = 0;\n for (const char of value) {\n if (char === \"\\\\\") {\n slashes += 1;\n continue;\n }\n quoted += \"\\\\\".repeat(char === '\"' ? slashes * 2 + 1 : slashes) + char;\n slashes = 0;\n }\n return `${quoted}${\"\\\\\".repeat(slashes * 2)}\"`;\n}\nfunction escapeCmdText(value) {\n return [...value]\n .map((char) => (CMD_META_CHARACTERS.has(char) ? `^${char}` : char))\n .join(\"\");\n}\nfunction isFile(path) {\n try {\n return statSync(path).isFile();\n }\n catch {\n return false;\n }\n}\nexport function resolveWindowsCommandPath(file, source = process.env) {\n if (file.includes(\"/\") || file.includes(\"\\\\\") || win32.isAbsolute(file)) {\n return file;\n }\n const env = normalizeCommandEnvironment(source, \"win32\");\n const extensions = (env.PATHEXT ?? \".COM;.EXE;.BAT;.CMD\")\n .split(\";\")\n .filter(Boolean)\n .map((item) => item.toLowerCase());\n const names = extname(file)\n ? [file]\n : [...extensions.map((extension) => `${file}${extension}`), file];\n for (const directory of (env.PATH ?? \"\").split(\";\").filter(Boolean)) {\n for (const name of names) {\n const candidate = join(directory, name);\n if (isFile(candidate)) {\n return candidate;\n }\n }\n }\n return file; // Preserve native ENOENT behavior when the selected command is missing.\n}\nfunction resolveWindowsNodeExecutable(directory, env) {\n const sibling = join(directory, \"node.exe\");\n if (isFile(sibling)) {\n return sibling;\n }\n const onPath = resolveWindowsCommandPath(\"node.exe\", env);\n if (onPath !== \"node.exe\" && isFile(onPath)) {\n return onPath;\n }\n // Electron's executable is not the independent Node runtime needed by Service.\n if (!process.versions.electron &&\n basename(process.execPath).toLowerCase() === \"node.exe\") {\n return process.execPath;\n }\n throw Object.assign(new Error(\"Node.js is required to run this Windows CLI. Install the supported Node.js release, then try again.\"), { code: \"NODE_RUNTIME_NOT_FOUND\" });\n}\nfunction readNpmNodeShimTarget(file) {\n if (!BATCH_PATH_PATTERN.test(file)) {\n return null;\n }\n let descriptor;\n try {\n descriptor = openSync(file, \"r\");\n const buffer = Buffer.alloc(65_537);\n const size = readSync(descriptor, buffer, 0, buffer.length, 0);\n if (size > 65_536) {\n return null;\n }\n const lines = buffer\n .subarray(0, size)\n .toString(\"utf8\")\n .split(SCRIPT_LINES)\n .map((line) => line.trim())\n .filter(Boolean);\n if (lines.length !== NPM_NODE_SHIM_PREFIX.length + 1 ||\n !NPM_NODE_SHIM_PREFIX.every((line, index) => lines[index]?.toLowerCase() === line)) {\n return null;\n }\n const target = lines.at(-1)?.match(NPM_NODE_SHIM_LAUNCH)?.[1];\n if (!(target && NODE_SCRIPT_PATTERN.test(target)) || target.includes(\"%\")) {\n return null;\n }\n return resolve(dirname(file), target.replaceAll(\"\\\\\", sep));\n }\n catch {\n return null;\n }\n finally {\n if (descriptor !== undefined) {\n closeSync(descriptor);\n }\n }\n}\nfunction executePlatformFile(file, args, options, callback) {\n try {\n const env = normalizeCommandEnvironment(options.env ?? process.env);\n const invocation = resolvePlatformCommand(file, args, env);\n return execFile(invocation.bin, invocation.args, {\n ...options,\n encoding: \"utf8\",\n env,\n ...(process.platform === \"win32\"\n ? {\n shell: false,\n windowsHide: true,\n windowsVerbatimArguments: invocation.windowsVerbatimArguments ?? false,\n }\n : {}),\n }, callback);\n }\n catch (error) {\n const failure = error instanceof Error\n ? error\n : new Error(\"The native command could not be prepared.\");\n queueMicrotask(() => callback(failure, \"\", \"\"));\n return undefined;\n }\n}\nfunction executePlatformFileAsync(file, args, options = {}) {\n if (process.platform !== \"win32\") {\n // Preserve Node's native promisify contract on platforms with no adapter.\n return promisify(execFile)(file, [...args], {\n ...options,\n encoding: \"utf8\",\n });\n }\n return new Promise((resolveResult, reject) => {\n executePlatformFile(file, args, options, (error, stdout, stderr) => {\n if (error) {\n reject(Object.assign(error, { stdout, stderr }));\n }\n else {\n resolveResult({ stdout, stderr });\n }\n });\n });\n}\nexport const execPlatformFile = Object.assign(executePlatformFile, {\n [promisify.custom]: executePlatformFileAsync,\n});\n"],"mappings":";;;;;;;;AAKA,MAAM,sCAAsB,IAAI,IAAI,qBAAoB;AACxD,MAAM,qBAAqB;AAC3B,MAAM,sBAAsB;AAC5B,MAAM,qBAAqB;AAC3B,MAAM,eAAe;AAGrB,MAAM,uBAAuB;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AACA,MAAM,uBAAuB;;AAE7B,SAAgB,uBAAuB,MAAM,MAAM,SAAS,QAAQ,KAAK,WAAW,QAAQ,UAAU;CAClG,IAAI,aAAa,SACb,OAAO;EAAE,KAAK;EAAM,MAAM,CAAC,GAAG,IAAI;CAAE;CAExC,MAAM,MAAM,4BAA4B,QAAQ,QAAQ;CACxD,MAAM,UAAU,0BAA0B,MAAM,GAAG;CACnD,MAAM,aAAa,oBAAoB,KAAK,OAAO,IAC7C,UACA,sBAAsB,OAAO;CACnC,IAAI,YACA,OAAO;EACH,KAAK,6BAA6B,QAAQ,OAAO,GAAG,GAAG;EACvD,MAAM,CAAC,YAAY,GAAG,IAAI;CAC9B;CAEJ,IAAI,CAAC,mBAAmB,KAAK,OAAO,GAChC,OAAO;EAAE,KAAK;EAAS,MAAM,CAAC,GAAG,IAAI;CAAE;CAE3C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,MAAM,UAAU,mBAAmB,KAAK,KAAK,CAAC,GACjE,MAAM,OAAO,uBAAO,IAAI,MAAM,+HA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