openmeld 0.3.216 → 0.3.217
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-CxgkT6ht.js → add-me-membership-C2Ys6Gq2.js} +2 -2
- package/dist/{add-me-membership-CxgkT6ht.js.map → add-me-membership-C2Ys6Gq2.js.map} +1 -1
- package/dist/{agents-B_qjzGkQ.js → agents-ClqMS9aO.js} +10 -10
- package/dist/{agents-B_qjzGkQ.js.map → agents-ClqMS9aO.js.map} +1 -1
- package/dist/{api-client-foundation-DdtV7aF-.js → api-client-foundation-CMVD057A.js} +1 -1
- package/dist/{api-client-foundation-XILCNkrF.js → api-client-foundation-Cib1elkI.js} +3 -3
- package/dist/{api-client-foundation-XILCNkrF.js.map → api-client-foundation-Cib1elkI.js.map} +1 -1
- package/dist/auth-session-D7oAIuHk.js +4 -0
- package/dist/{auth-session-B9Whm1hq.js → auth-session-DOjVKRI_.js} +2 -2
- package/dist/{auth-session-B9Whm1hq.js.map → auth-session-DOjVKRI_.js.map} +1 -1
- package/dist/{base-url-CiSsUvmr.js → base-url-CMBApK1J.js} +1 -1
- package/dist/{base-url-jdL78gyl.js → base-url-D7uE_xTo.js} +2 -2
- package/dist/{base-url-jdL78gyl.js.map → base-url-D7uE_xTo.js.map} +1 -1
- package/dist/{channel-CKmbucdt.js → channel-BfTy6fDo.js} +4 -4
- package/dist/{channel-CKmbucdt.js.map → channel-BfTy6fDo.js.map} +1 -1
- package/dist/{cli-space-api-DlDztj9O.js → cli-space-api-BT_Pu9Yg.js} +6 -6
- package/dist/{cli-space-api-DlDztj9O.js.map → cli-space-api-BT_Pu9Yg.js.map} +1 -1
- package/dist/{command-Cbp4ZeZs.js → command-C1w0UpIu.js} +28 -23
- package/dist/command-C1w0UpIu.js.map +1 -0
- package/dist/{computer-connection-CVE1MAqF.js → computer-connection-DsjsjmPp.js} +2 -2
- package/dist/{computer-connection-CVE1MAqF.js.map → computer-connection-DsjsjmPp.js.map} +1 -1
- package/dist/{computer-connection-review-CfFmjZLP.js → computer-connection-review-RXJyryCh.js} +5 -5
- package/dist/{computer-connection-review-CfFmjZLP.js.map → computer-connection-review-RXJyryCh.js.map} +1 -1
- package/dist/{computer-disconnect-B5nMRe9T.js → computer-disconnect-B_LZM2QE.js} +7 -7
- package/dist/{computer-disconnect-B5nMRe9T.js.map → computer-disconnect-B_LZM2QE.js.map} +1 -1
- package/dist/{computer-setup-continuation-Bd3BIgdU.js → computer-setup-continuation-BVI7SD0M.js} +3 -3
- package/dist/{computer-setup-continuation-Bd3BIgdU.js.map → computer-setup-continuation-BVI7SD0M.js.map} +1 -1
- package/dist/{context-Cz5nJnDe.js → context-Di5R4iik.js} +5 -5
- package/dist/{context-Cz5nJnDe.js.map → context-Di5R4iik.js.map} +1 -1
- package/dist/{control-plane-DKPz7DMv.js → control-plane-BDS63N7Y.js} +2 -2
- package/dist/{control-plane-DKPz7DMv.js.map → control-plane-BDS63N7Y.js.map} +1 -1
- package/dist/{controller-contract-pe3_Re-c.js → controller-contract-DAOCaefz.js} +9 -1
- package/dist/controller-contract-DAOCaefz.js.map +1 -0
- package/dist/{daemon-device-id-KgO7zcEr.js → daemon-device-id-bfkbZj9G.js} +7 -7
- package/dist/{daemon-device-id-KgO7zcEr.js.map → daemon-device-id-bfkbZj9G.js.map} +1 -1
- package/dist/{daemon-frame-transport-DUDAgNbO.js → daemon-frame-transport-saNQVOyi.js} +8 -8
- package/dist/daemon-frame-transport-saNQVOyi.js.map +1 -0
- package/dist/{daemon-lifecycle-journal-Bj-fw052.js → daemon-lifecycle-journal-DP01txRB.js} +5 -4
- package/dist/{daemon-lifecycle-journal-Bj-fw052.js.map → daemon-lifecycle-journal-DP01txRB.js.map} +1 -1
- package/dist/{daemon-service-manager-Cq3ANgn8.js → daemon-service-manager-CRHq3YSj.js} +1 -1
- package/dist/{daemon-service-manager-CZY8Bin4.js → daemon-service-manager-CXbN836B.js} +2 -2
- package/dist/{daemon-service-manager-CZY8Bin4.js.map → daemon-service-manager-CXbN836B.js.map} +1 -1
- package/dist/{daemon-service-runtime-yD-w1dQw.js → daemon-service-runtime-DpiD8oap.js} +5 -5
- package/dist/{daemon-service-runtime-yD-w1dQw.js.map → daemon-service-runtime-DpiD8oap.js.map} +1 -1
- package/dist/{daemon-service-update-coordinator-BATuKmZA.js → daemon-service-update-coordinator-BuCEBJoe.js} +16 -16
- package/dist/{daemon-service-update-coordinator-BATuKmZA.js.map → daemon-service-update-coordinator-BuCEBJoe.js.map} +1 -1
- package/dist/{dist-o3UL1EGQ.js → dist-BLuEEVHh.js} +2 -2
- package/dist/dist-BLuEEVHh.js.map +1 -0
- package/dist/{dist-Ddy96dwl.js → dist-BdibASYs.js} +3 -3
- package/dist/{dist-Ddy96dwl.js.map → dist-BdibASYs.js.map} +1 -1
- package/dist/{dist-CkGG099H.js → dist-DkRliHib.js} +9292 -9207
- package/dist/dist-DkRliHib.js.map +1 -0
- package/dist/{dist-DZYJ8yLA.js → dist-RR7jryeV.js} +1 -1
- package/dist/{elapsed-time-DGQ63StD.js → elapsed-time-CR9OIZSD.js} +6 -6
- package/dist/{elapsed-time-DGQ63StD.js.map → elapsed-time-CR9OIZSD.js.map} +1 -1
- package/dist/{entry-Dhify7h7.js → entry-CSoHtCQ9.js} +8 -8
- package/dist/{entry-Dhify7h7.js.map → entry-CSoHtCQ9.js.map} +1 -1
- package/dist/{installation-inventory-BJe8fC9k.js → installation-inventory-CscX0nmD.js} +4 -4
- package/dist/{installation-inventory-BJe8fC9k.js.map → installation-inventory-CscX0nmD.js.map} +1 -1
- package/dist/{installer-CWgaNzfE.js → installer-CkF3gSdD.js} +2 -2
- package/dist/{installer-CWgaNzfE.js.map → installer-CkF3gSdD.js.map} +1 -1
- package/dist/{openmeld-koCpjXo7.js → openmeld-BcyBlby4.js} +44 -40
- package/dist/openmeld-BcyBlby4.js.map +1 -0
- package/dist/openmeld-dev.js +1 -1
- package/dist/{openmeld-environment-target-Dn2rJCa7.js → openmeld-environment-target-B6HqY0_a.js} +2 -2
- package/dist/{openmeld-environment-target-Dn2rJCa7.js.map → openmeld-environment-target-B6HqY0_a.js.map} +1 -1
- package/dist/{openmeld-maintenance-worker-DdsIYpG-.js → openmeld-maintenance-worker-Brsfy22C.js} +11 -11
- package/dist/{openmeld-maintenance-worker-DdsIYpG-.js.map → openmeld-maintenance-worker-Brsfy22C.js.map} +1 -1
- package/dist/{openmeld-tools-update-join-Clgm1ix5.js → openmeld-tools-update-join-CUh0JERe.js} +4 -4
- package/dist/{openmeld-tools-update-join-Clgm1ix5.js.map → openmeld-tools-update-join-CUh0JERe.js.map} +1 -1
- package/dist/{openmeld-tools-update-process-frame-0X-t0Kjv.js → openmeld-tools-update-process-frame-B-XB4dmO.js} +2 -2
- package/dist/{openmeld-tools-update-process-frame-0X-t0Kjv.js.map → openmeld-tools-update-process-frame-B-XB4dmO.js.map} +1 -1
- package/dist/{openmeld-tools-update-process-frame-DX1Dc8VI.js → openmeld-tools-update-process-frame-j-RXwFsK.js} +1 -1
- package/dist/openmeld.js +5 -5
- package/dist/{prepare-provider-runtime-CeGzeQbD.js → prepare-provider-runtime-DxaGSe3R.js} +1130 -122
- package/dist/prepare-provider-runtime-DxaGSe3R.js.map +1 -0
- package/dist/{prepare-session-executor-CsxnDFgS.js → prepare-session-executor-CyouBl49.js} +22 -22
- package/dist/{prepare-session-executor-CsxnDFgS.js.map → prepare-session-executor-CyouBl49.js.map} +1 -1
- package/dist/{process-channel-BTxB9zK-.js → process-channel-Cocpv3Br.js} +2 -2
- package/dist/{process-channel-BTxB9zK-.js.map → process-channel-Cocpv3Br.js.map} +1 -1
- package/dist/{runtime-CesmzZ2L.js → runtime-DGT66AR-.js} +19 -19
- package/dist/{runtime-CesmzZ2L.js.map → runtime-DGT66AR-.js.map} +1 -1
- package/dist/{runtime-agent-controller-reporting-submission-B6cDV_zW.js → runtime-agent-controller-reporting-submission-C1Vc_JWm.js} +59 -9
- package/dist/runtime-agent-controller-reporting-submission-C1Vc_JWm.js.map +1 -0
- package/dist/{runtime-reporting-health-state-Cjavvccq.js → runtime-reporting-health-state-CPWlQ5IX.js} +9 -9
- package/dist/{runtime-reporting-health-state-Cjavvccq.js.map → runtime-reporting-health-state-CPWlQ5IX.js.map} +1 -1
- package/dist/{runtime-transport-CVtBXzIp.js → runtime-transport-BLtOFrtv.js} +64 -11
- package/dist/runtime-transport-BLtOFrtv.js.map +1 -0
- package/dist/{service-Cgat7nEE.js → service-ClETdJbz.js} +49 -28
- package/dist/service-ClETdJbz.js.map +1 -0
- package/dist/{service-account-authorization-Ct0OZwbr.js → service-account-authorization-kciEaW5t.js} +3 -3
- package/dist/{service-account-authorization-Ct0OZwbr.js.map → service-account-authorization-kciEaW5t.js.map} +1 -1
- package/dist/{service-account-control-DefN0EOY.js → service-account-control-3n_YwNsF.js} +10 -10
- package/dist/{service-account-control-DefN0EOY.js.map → service-account-control-3n_YwNsF.js.map} +1 -1
- package/dist/{service-control-capabilities-BsCCHsUg.js → service-control-capabilities-C2tMMuFl.js} +4 -4
- package/dist/{service-control-capabilities-BsCCHsUg.js.map → service-control-capabilities-C2tMMuFl.js.map} +1 -1
- package/dist/{service-control-capabilities-m7mmxVOi.js → service-control-capabilities-DoW5MW7A.js} +1 -1
- package/dist/{state-C2ztY4iq.js → state-CMs4p0wo.js} +2 -2
- package/dist/{state-C2ztY4iq.js.map → state-CMs4p0wo.js.map} +1 -1
- package/dist/{upgrade-O_blyOta.js → upgrade-2epQATRq.js} +8 -8
- package/dist/{upgrade-O_blyOta.js.map → upgrade-2epQATRq.js.map} +1 -1
- package/dist/upgrade-BVIot_cP.js +4 -0
- package/package.json +3 -2
- package/skills/openmeld-cli/playbooks/agent-onboarding.md +15 -0
- package/dist/auth-session-DXKHtGTr.js +0 -4
- package/dist/command-Cbp4ZeZs.js.map +0 -1
- package/dist/controller-contract-pe3_Re-c.js.map +0 -1
- package/dist/daemon-frame-transport-DUDAgNbO.js.map +0 -1
- package/dist/dist-CkGG099H.js.map +0 -1
- package/dist/dist-o3UL1EGQ.js.map +0 -1
- package/dist/openmeld-koCpjXo7.js.map +0 -1
- package/dist/prepare-provider-runtime-CeGzeQbD.js.map +0 -1
- package/dist/runtime-agent-controller-reporting-submission-B6cDV_zW.js.map +0 -1
- package/dist/runtime-transport-CVtBXzIp.js.map +0 -1
- package/dist/service-Cgat7nEE.js.map +0 -1
- package/dist/upgrade-axb9z2uy.js +0 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { ft as computerConnectionProgressObservationSchema, it as prepareSessionSnapshotSchema, nt as createPrepareSessionRequestSchema, pt as computerConnectionProgressPhaseSchema } from "./auth-session-
|
|
3
|
+
import { ft as computerConnectionProgressObservationSchema, it as prepareSessionSnapshotSchema, nt as createPrepareSessionRequestSchema, pt as computerConnectionProgressPhaseSchema } from "./auth-session-DOjVKRI_.js";
|
|
4
4
|
import * as z$1 from "zod/v4";
|
|
5
5
|
//#region ../../packages/schemas/dist/computer-connection.js
|
|
6
6
|
const computerConnectionIntentSchema = z$1.strictObject({
|
|
@@ -117,4 +117,4 @@ z$1.union([desktopComputerConnectionOperationSchema, desktopComputerDisconnectOp
|
|
|
117
117
|
//#endregion
|
|
118
118
|
export { computerConnectionReviewSchema as n, computerConnectionIntentSchema as t };
|
|
119
119
|
|
|
120
|
-
//# sourceMappingURL=computer-connection-
|
|
120
|
+
//# sourceMappingURL=computer-connection-DsjsjmPp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computer-connection-
|
|
1
|
+
{"version":3,"file":"computer-connection-DsjsjmPp.js","names":[],"sources":["../../../packages/schemas/dist/computer-connection.js"],"sourcesContent":["import { computerConnectionProgressObservationSchema, computerConnectionProgressPhaseSchema } from \"./computer-connection-progress.js\";\nimport { createPrepareSessionRequestSchema, prepareSessionSnapshotSchema } from \"./schemas/prepare/session.js\";\nimport * as z$1 from \"zod/v4\";\n//#region src/computer-connection.ts\nconst computerConnectionIntentSchema = z$1.strictObject({\n\texpectedAccount: z$1.string().trim().min(1).max(256),\n\tpreviousSessionIdentity: z$1.string().min(1).max(128)\n});\nconst computerSetupVerboseOutputSchema = z$1.object({\n\ttype: z$1.string(),\n\tcode: z$1.string().min(1).max(256),\n\ttext: z$1.string().optional(),\n\tmessage: z$1.string().optional(),\n\tdata: z$1.object({\n\t\tstate: z$1.string().optional(),\n\t\tphase: computerConnectionProgressPhaseSchema.optional()\n\t}).optional()\n});\nconst computerSetupOutputSchema = z$1.union([computerSetupVerboseOutputSchema, z$1.object({\n\tt: z$1.string(),\n\tc: z$1.string().min(1).max(256),\n\tx: z$1.string().optional(),\n\tm: z$1.string().optional(),\n\td: computerSetupVerboseOutputSchema.shape.data\n}).transform((event) => ({\n\ttype: event.t,\n\tcode: event.c,\n\ttext: event.x,\n\tmessage: event.m,\n\tdata: event.d\n}))]);\nconst desktopComputerConnectionProgressSchema = computerConnectionProgressObservationSchema.extend({ expectedAccount: computerConnectionIntentSchema.shape.expectedAccount });\nconst computerConnectionReviewSchema = z$1.strictObject({\n\tprotocol: z$1.literal(\"computer-connection-v1\"),\n\tpreviousSessionIdentity: z$1.string().min(1).max(128),\n\taccount: z$1.strictObject({\n\t\tid: z$1.string().min(1).max(256),\n\t\temail: z$1.string().max(512).nullable()\n\t}).nullable(),\n\texistingConnection: z$1.strictObject({\n\t\tdeviceId: z$1.string().min(1),\n\t\truntimeLane: z$1.enum([\n\t\t\t\"prod\",\n\t\t\t\"dev-local\",\n\t\t\t\"canary\"\n\t\t])\n\t}).nullable()\n});\nconst desktopComputerDisconnectRequestSchema = z$1.strictObject({\n\texpectedAccount: computerConnectionIntentSchema.shape.expectedAccount,\n\texpectedConnection: computerConnectionReviewSchema.shape.existingConnection.unwrap().optional()\n});\nconst desktopComputerConnectionRequestSchema = createPrepareSessionRequestSchema.pick({\n\thumanProfileId: true,\n\ttargetSpaceId: true,\n\tsourceNavigationAction: true,\n\tconnectedComputerId: true\n}).extend({\n\texpectedAccount: computerConnectionIntentSchema.shape.expectedAccount,\n\tresetThisComputer: z$1.boolean().optional()\n});\nconst desktopComputerConnectionResultSchema = z$1.discriminatedUnion(\"status\", [\n\tz$1.strictObject({\n\t\tstatus: z$1.literal(\"failed\"),\n\t\tmessage: z$1.string().min(1),\n\t\tdiagnosticId: z$1.string().min(1),\n\t\tdiagnosticsPath: z$1.string().min(1).optional()\n\t}),\n\tz$1.strictObject({\n\t\tstatus: z$1.literal(\"reused\"),\n\t\tconnection: computerConnectionReviewSchema.shape.existingConnection.unwrap()\n\t}),\n\tz$1.strictObject({\n\t\tstatus: z$1.literal(\"completed\"),\n\t\tsnapshot: prepareSessionSnapshotSchema\n\t}),\n\tz$1.strictObject({ status: z$1.literal(\"cancelled\") })\n]);\nconst desktopComputerConnectionOperationSchema = z$1.strictObject({\n\toperationId: z$1.string().min(1).max(128),\n\trequest: desktopComputerConnectionRequestSchema,\n\tstatus: z$1.enum([\"pending\", \"settled\"]),\n\tprogress: desktopComputerConnectionProgressSchema.nullable(),\n\tresult: desktopComputerConnectionResultSchema.nullable(),\n\terrorMessage: z$1.string().min(1).max(4096).nullable()\n});\nconst desktopComputerDisconnectPhaseSchema = z$1.enum([\n\t\"checking\",\n\t\"waiting_for_confirmation\",\n\t\"disconnecting\"\n]);\nconst desktopComputerDisconnectResultSchema = z$1.union([\n\tz$1.strictObject({ status: z$1.literal(\"disconnected\") }),\n\tz$1.strictObject({ status: z$1.literal(\"cancelled\") }),\n\tz$1.strictObject({\n\t\tstatus: z$1.enum([\n\t\t\t\"connection_changed\",\n\t\t\t\"failed\",\n\t\t\t\"unconfirmed\"\n\t\t]),\n\t\tcode: z$1.string().min(1).max(256),\n\t\tmessage: z$1.string().min(1).max(4096),\n\t\tdiagnosticId: z$1.string().min(1).max(128).optional(),\n\t\tdiagnosticsPath: z$1.string().min(1).max(4096).optional()\n\t})\n]);\nconst desktopComputerDisconnectOperationSchema = z$1.strictObject({\n\tkind: z$1.literal(\"disconnect\"),\n\toperationId: desktopComputerConnectionOperationSchema.shape.operationId,\n\trequest: desktopComputerDisconnectRequestSchema,\n\tstatus: z$1.enum([\"pending\", \"settled\"]),\n\tphase: desktopComputerDisconnectPhaseSchema,\n\tresult: desktopComputerDisconnectResultSchema.nullable()\n});\nconst desktopComputerOperationSchema = z$1.union([desktopComputerConnectionOperationSchema, desktopComputerDisconnectOperationSchema]);\n//#endregion\nexport { computerConnectionIntentSchema, computerConnectionReviewSchema, computerSetupOutputSchema, desktopComputerConnectionOperationSchema, desktopComputerConnectionProgressSchema, desktopComputerConnectionRequestSchema, desktopComputerConnectionResultSchema, desktopComputerDisconnectOperationSchema, desktopComputerDisconnectPhaseSchema, desktopComputerDisconnectRequestSchema, desktopComputerDisconnectResultSchema, desktopComputerOperationSchema };\n\n//# sourceMappingURL=computer-connection.js.map"],"mappings":";;;;;AAIA,MAAM,iCAAiC,IAAI,aAAa;CACvD,iBAAiB,IAAI,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;CACnD,yBAAyB,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;AACrD,CAAC;AACD,MAAM,mCAAmC,IAAI,OAAO;CACnD,MAAM,IAAI,OAAO;CACjB,MAAM,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;CACjC,MAAM,IAAI,OAAO,CAAC,CAAC,SAAS;CAC5B,SAAS,IAAI,OAAO,CAAC,CAAC,SAAS;CAC/B,MAAM,IAAI,OAAO;EAChB,OAAO,IAAI,OAAO,CAAC,CAAC,SAAS;EAC7B,OAAO,sCAAsC,SAAS;CACvD,CAAC,CAAC,CAAC,SAAS;AACb,CAAC;AACiC,IAAI,MAAM,CAAC,kCAAkC,IAAI,OAAO;CACzF,GAAG,IAAI,OAAO;CACd,GAAG,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IA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I;EACrC,cAAc,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,SAAS;EACpD,iBAAiB,IAAI,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS;CACzD,CAAC;AACF,CAAC;AACD,MAAM,2CAA2C,IAAI,aAAa;CACjE,MAAM,IAAI,QAAQ,YAAY;CAC9B,aAAa,yCAAyC,MAAM;CAC5D,SAAS;CACT,QAAQ,IAAI,KAAK,CAAC,WAAW,SAAS,CAAC;CACvC,OAAO;CACP,QAAQ,sCAAsC,SAAS;AACxD,CAAC;AACsC,IAAI,MAAM,CAAC,0CAA0C,wCAAwC,CAAC"}
|
package/dist/{computer-connection-review-CfFmjZLP.js → computer-connection-review-RXJyryCh.js}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { d as getAuthSessionState, o as buildStoredAuthSessionIdentity, u as getAuthSessionMetadata } from "./auth-session-
|
|
4
|
-
import { n as computerConnectionReviewSchema } from "./computer-connection-
|
|
3
|
+
import { d as getAuthSessionState, o as buildStoredAuthSessionIdentity, u as getAuthSessionMetadata } from "./auth-session-DOjVKRI_.js";
|
|
4
|
+
import { n as computerConnectionReviewSchema } from "./computer-connection-DsjsjmPp.js";
|
|
5
5
|
import { i as readDaemonServiceContract } from "./daemon-service-contract-BpOBMGX0.js";
|
|
6
|
-
import { n as resolveServiceAccountIdentity } from "./service-account-authorization-
|
|
7
|
-
import { t as readServiceControlCapabilities } from "./service-control-capabilities-
|
|
6
|
+
import { n as resolveServiceAccountIdentity } from "./service-account-authorization-kciEaW5t.js";
|
|
7
|
+
import { t as readServiceControlCapabilities } from "./service-control-capabilities-C2tMMuFl.js";
|
|
8
8
|
//#region src/commands/computer-connection-review.ts
|
|
9
9
|
/** Display evidence only. Auth and Service owners validate an existing connection. */
|
|
10
10
|
async function readComputerConnectionReview() {
|
|
@@ -36,4 +36,4 @@ async function readComputerConnectionReview() {
|
|
|
36
36
|
//#endregion
|
|
37
37
|
export { readComputerConnectionReview };
|
|
38
38
|
|
|
39
|
-
//# sourceMappingURL=computer-connection-review-
|
|
39
|
+
//# sourceMappingURL=computer-connection-review-RXJyryCh.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computer-connection-review-
|
|
1
|
+
{"version":3,"file":"computer-connection-review-RXJyryCh.js","names":[],"sources":["../src/commands/computer-connection-review.ts"],"sourcesContent":["import { computerConnectionReviewSchema } from \"@openmeld/schemas\";\nimport {\n buildStoredAuthSessionIdentity,\n getAuthSessionMetadata,\n getAuthSessionState,\n} from \"../config/auth-session\";\nimport { readDaemonServiceContract } from \"../config/daemon-service-contract\";\nimport { resolveServiceAccountIdentity } from \"../local-service/lifecycle/service-account-authorization\";\nimport { readServiceControlCapabilities } from \"./service-control-capabilities\";\n\n/** Display evidence only. Auth and Service owners validate an existing connection. */\nexport async function readComputerConnectionReview() {\n const session = await getAuthSessionMetadata();\n if (session && !session.user?.id) {\n throw new Error(\n \"The computer account cannot be identified. Review its sign-in before connecting.\"\n );\n }\n let existingConnection: ReturnType<\n typeof computerConnectionReviewSchema.parse\n >[\"existingConnection\"] = null;\n const contract = await readDaemonServiceContract();\n if (session && contract && contract.ownerUserId === session.user?.id) {\n const auth = await getAuthSessionState({ validateRemote: true });\n if (auth.state === \"valid\" && auth.session) {\n const identity = await resolveServiceAccountIdentity(\n auth.session,\n contract\n );\n const capabilities = await readServiceControlCapabilities();\n if (capabilities.stop && capabilities.deviceId === identity.deviceId) {\n existingConnection = {\n deviceId: identity.deviceId,\n runtimeLane: identity.lane,\n };\n }\n }\n }\n return computerConnectionReviewSchema.parse({\n protocol: \"computer-connection-v1\",\n previousSessionIdentity: buildStoredAuthSessionIdentity(session),\n account: session\n ? { id: session.user?.id, email: session.user?.email ?? null }\n : null,\n existingConnection,\n });\n}\n"],"mappings":";;;;;;;;;AAWA,eAAsB,+BAA+B;CACnD,MAAM,UAAU,MAAM,uBAAuB;CAC7C,IAAI,WAAW,CAAC,QAAQ,MAAM,IAC5B,MAAM,IAAI,MACR,kFACF;CAEF,IAAI,qBAEsB;CAC1B,MAAM,WAAW,MAAM,0BAA0B;CACjD,IAAI,WAAW,YAAY,SAAS,gBAAgB,QAAQ,MAAM,IAAI;EACpE,MAAM,OAAO,MAAM,oBAAoB,EAAE,gBAAgB,KAAK,CAAC;EAC/D,IAAI,KAAK,UAAU,WAAW,KAAK,SAAS;GAC1C,MAAM,WAAW,MAAM,8BACrB,KAAK,SACL,QACF;GACA,MAAM,eAAe,MAAM,+BAA+B;GAC1D,IAAI,aAAa,QAAQ,aAAa,aAAa,SAAS,UAC1D,qBAAqB;IACnB,UAAU,SAAS;IACnB,aAAa,SAAS;GACxB;EAEJ;CACF;CACA,OAAO,+BAA+B,MAAM;EAC1C,UAAU;EACV,yBAAyB,+BAA+B,OAAO;EAC/D,SAAS,UACL;GAAE,IAAI,QAAQ,MAAM;GAAI,OAAO,QAAQ,MAAM,SAAS;EAAK,IAC3D;EACJ;CACF,CAAC;AACH"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { l as getAuthSession, o as buildStoredAuthSessionIdentity, s as clearAuthSession, u as getAuthSessionMetadata } from "./auth-session-
|
|
4
|
-
import { t as computerConnectionIntentSchema } from "./computer-connection-
|
|
5
|
-
import { r as readCurrentDaemonRuntimeContext } from "./daemon-service-runtime-
|
|
3
|
+
import { l as getAuthSession, o as buildStoredAuthSessionIdentity, s as clearAuthSession, u as getAuthSessionMetadata } from "./auth-session-DOjVKRI_.js";
|
|
4
|
+
import { t as computerConnectionIntentSchema } from "./computer-connection-DsjsjmPp.js";
|
|
5
|
+
import { r as readCurrentDaemonRuntimeContext } from "./daemon-service-runtime-DpiD8oap.js";
|
|
6
6
|
import { K as withDaemonServiceRunLock } from "./daemon-state-B44aq2nm.js";
|
|
7
7
|
import { i as readDaemonServiceContract } from "./daemon-service-contract-BpOBMGX0.js";
|
|
8
|
-
import { n as resolveServiceAccountIdentity } from "./service-account-authorization-
|
|
9
|
-
import { n as resolveRuntimeContext } from "./context-
|
|
8
|
+
import { n as resolveServiceAccountIdentity } from "./service-account-authorization-kciEaW5t.js";
|
|
9
|
+
import { n as resolveRuntimeContext } from "./context-Di5R4iik.js";
|
|
10
10
|
import { t as createPresenter } from "./presenter-BcxiQyJg.js";
|
|
11
|
-
import { t as runServiceAccountControl } from "./service-account-control-
|
|
11
|
+
import { t as runServiceAccountControl } from "./service-account-control-3n_YwNsF.js";
|
|
12
12
|
//#region src/commands/computer-disconnect.ts
|
|
13
13
|
async function runComputerDisconnect(request, view) {
|
|
14
14
|
const presenter = createPresenter(await resolveRuntimeContext({ view }));
|
|
@@ -45,4 +45,4 @@ async function disconnectComputer(request) {
|
|
|
45
45
|
//#endregion
|
|
46
46
|
export { runComputerDisconnect };
|
|
47
47
|
|
|
48
|
-
//# sourceMappingURL=computer-disconnect-
|
|
48
|
+
//# sourceMappingURL=computer-disconnect-B_LZM2QE.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computer-disconnect-
|
|
1
|
+
{"version":3,"file":"computer-disconnect-B_LZM2QE.js","names":[],"sources":["../src/commands/computer-disconnect.ts"],"sourcesContent":["import {\n type ComputerConnectionIntent,\n computerConnectionIntentSchema,\n} from \"@openmeld/schemas\";\nimport {\n buildStoredAuthSessionIdentity,\n clearAuthSession,\n getAuthSession,\n getAuthSessionMetadata,\n} from \"../config/auth-session\";\nimport { readDaemonServiceContract } from \"../config/daemon-service-contract\";\nimport { withDaemonServiceRunLock } from \"../config/daemon-state\";\nimport { readCurrentDaemonRuntimeContext } from \"../local-service/lifecycle/daemon-service-runtime\";\nimport { resolveServiceAccountIdentity } from \"../local-service/lifecycle/service-account-authorization\";\nimport { resolveRuntimeContext } from \"../runtime/context\";\nimport { createPresenter } from \"../runtime/presenter/index\";\nimport { runServiceAccountControl } from \"./service-account-control\";\n\nexport async function runComputerDisconnect(\n request: ComputerConnectionIntent,\n view?: string\n) {\n const presenter = createPresenter(await resolveRuntimeContext({ view }));\n presenter.line({\n code: \"computer.disconnect.started\",\n text: \"Stopping OpenMeld Service…\",\n data: { state: \"started\" },\n });\n await disconnectComputer(request);\n presenter.line({\n code: \"computer.disconnected\",\n text: \"This computer is disconnected. Its record is still in your account.\",\n });\n}\n\n// Disconnect ends this Mac's local account connection. Forget remains the\n// separate cloud operation that removes the account's Computer record.\nexport async function disconnectComputer(\n request: ComputerConnectionIntent\n): Promise<void> {\n const intent = computerConnectionIntentSchema.parse(request);\n const session = await getAuthSessionMetadata();\n if (\n !session ||\n session.user?.id !== intent.expectedAccount ||\n buildStoredAuthSessionIdentity(session) !== intent.previousSessionIdentity\n ) {\n throw new Error(\n \"The computer sign-in changed. Review its connection before disconnecting.\"\n );\n }\n // The existing admission owner rechecks account, process and generation,\n // drains active work, and disables automatic startup. Never use an unscoped Stop.\n await withDaemonServiceRunLock(async () => {\n const contract = await readDaemonServiceContract();\n const runtime = await readCurrentDaemonRuntimeContext();\n if (contract?.desiredState === \"stopped\") {\n const current = await getAuthSession();\n if (!current) {\n throw new Error(\"Review this computer's sign-in before disconnecting.\");\n }\n await resolveServiceAccountIdentity(current, contract);\n }\n // A retry may follow an acknowledged Stop and a failed credential cleanup.\n // Only the owner's explicit stopped intent can skip another Stop.\n if (\n !(\n contract?.ownerUserId === intent.expectedAccount &&\n contract.desiredState === \"stopped\" &&\n runtime.effectiveRuntimeStatus === \"not_running\"\n )\n ) {\n await runServiceAccountControl(\n {\n operation: \"stop\",\n expectedAccount: intent.expectedAccount,\n },\n intent.previousSessionIdentity\n );\n }\n // Hold the existing lifecycle lock through cleanup so Start cannot race it.\n // A concurrent sign-in after Stop must never be cleared by this operation.\n await clearAuthSession(session);\n });\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,eAAsB,sBACpB,SACA,MACA;CACA,MAAM,YAAY,gBAAgB,MAAM,sBAAsB,EAAE,KAAK,CAAC,CAAC;CACvE,UAAU,KAAK;EACb,MAAM;EACN,MAAM;EACN,MAAM,EAAE,OAAO,UAAU;CAC3B,CAAC;CACD,MAAM,mBAAmB,OAAO;CAChC,UAAU,KAAK;EACb,MAAM;EACN,MAAM;CACR,CAAC;AACH;AAIA,eAAsB,mBACpB,SACe;CACf,MAAM,SAAS,+BAA+B,MAAM,OAAO;CAC3D,MAAM,UAAU,MAAM,uBAAuB;CAC7C,IACE,CAAC,WACD,QAAQ,MAAM,OAAO,OAAO,mBAC5B,+BAA+B,OAAO,MAAM,OAAO,yBAEnD,MAAM,IAAI,MACR,2EACF;CAIF,MAAM,yBAAyB,YAAY;EACzC,MAAM,WAAW,MAAM,0BAA0B;EACjD,MAAM,UAAU,MAAM,gCAAgC;EACtD,IAAI,UAAU,iBAAiB,WAAW;GACxC,MAAM,UAAU,MAAM,eAAe;GACrC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,sDAAsD;GAExE,MAAM,8BAA8B,SAAS,QAAQ;EACvD;EAGA,IACE,EACE,UAAU,gBAAgB,OAAO,mBACjC,SAAS,iBAAiB,aAC1B,QAAQ,2BAA2B,gBAGrC,MAAM,yBACJ;GACE,WAAW;GACX,iBAAiB,OAAO;EAC1B,GACA,OAAO,uBACT;EAIF,MAAM,iBAAiB,OAAO;CAChC,CAAC;AACH"}
|
package/dist/{computer-setup-continuation-Bd3BIgdU.js → computer-setup-continuation-BVI7SD0M.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { m as hasPendingComputerSetupContinuation, x as resumeInterruptedComputerSetup } from "./auth-session-
|
|
3
|
+
import { m as hasPendingComputerSetupContinuation, x as resumeInterruptedComputerSetup } from "./auth-session-DOjVKRI_.js";
|
|
4
4
|
import { t as createPresenter } from "./presenter-BcxiQyJg.js";
|
|
5
|
-
import { A as mintPrepareSessionReconnectToken, D as recoverInterruptedComputerAuthHandoff, i as runPrepareSessionExecutor } from "./prepare-session-executor-
|
|
5
|
+
import { A as mintPrepareSessionReconnectToken, D as recoverInterruptedComputerAuthHandoff, i as runPrepareSessionExecutor } from "./prepare-session-executor-CyouBl49.js";
|
|
6
6
|
import { setTimeout } from "node:timers/promises";
|
|
7
7
|
//#region src/commands/computer-setup-continuation.ts
|
|
8
8
|
const runtime = {
|
|
@@ -39,4 +39,4 @@ async function recoverComputerSetupAfterBackgroundUpdate() {
|
|
|
39
39
|
//#endregion
|
|
40
40
|
export { finishComputerSetupAfterBackgroundUpdate, recoverComputerSetupAfterBackgroundUpdate };
|
|
41
41
|
|
|
42
|
-
//# sourceMappingURL=computer-setup-continuation-
|
|
42
|
+
//# sourceMappingURL=computer-setup-continuation-BVI7SD0M.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computer-setup-continuation-
|
|
1
|
+
{"version":3,"file":"computer-setup-continuation-BVI7SD0M.js","names":["sleep"],"sources":["../src/commands/computer-setup-continuation.ts"],"sourcesContent":["import { setTimeout as sleep } from \"node:timers/promises\";\nimport {\n hasPendingComputerSetupContinuation,\n resumeInterruptedComputerSetup,\n} from \"../config/auth-session\";\nimport { mintPrepareSessionReconnectToken } from \"../config/prepare-session-api\";\nimport { createPresenter } from \"../runtime/presenter/index\";\nimport type { RuntimeContext } from \"../runtime/types\";\nimport { recoverInterruptedComputerAuthHandoff } from \"./computer-auth-handoff-recovery\";\nimport { runPrepareSessionExecutor } from \"./prepare-session-executor\";\n\nconst runtime: RuntimeContext = {\n interactive: false,\n resolvedView: \"agent\",\n viewMode: \"agent\",\n};\n\n// Called only by the existing OS-owned maintenance worker after its update.\n// The live Terminal keeps ownership. If it exits, continue the same Core\n// Prepare session using the existing auth journal, not a second setup plan.\nexport async function finishComputerSetupAfterBackgroundUpdate(): Promise<void> {\n while (await hasPendingComputerSetupContinuation()) {\n const resumed = await resumeInterruptedComputerSetup(\n async (continuation) => {\n const { snapshot, opaqueToken } =\n await mintPrepareSessionReconnectToken({\n baseUrl: continuation.gatewayUrl,\n prepareSessionId: continuation.prepareSessionId,\n });\n if (\n snapshot.lifecycleStatus !== \"active\" &&\n snapshot.lifecycleStatus !== \"completed\"\n ) {\n return \"not_completed\";\n }\n const result = await runPrepareSessionExecutor({\n gatewayUrl: continuation.gatewayUrl,\n initialSnapshot: snapshot,\n interactive: false,\n localAgentSelection: continuation.localAgentSelection,\n presenter: createPresenter(runtime),\n runtime,\n startSession: opaqueToken,\n view: \"agent\",\n });\n return result.status;\n }\n );\n if (!resumed) {\n await sleep(500);\n }\n }\n}\n\n// Run after the completed update has released its pending job. Account rollback\n// uses the existing handoff recovery, which itself waits for active updates.\nexport async function recoverComputerSetupAfterBackgroundUpdate(): Promise<void> {\n await recoverInterruptedComputerAuthHandoff({\n presenter: createPresenter(runtime),\n runtime,\n view: \"agent\",\n });\n}\n"],"mappings":";;;;;;;AAWA,MAAM,UAA0B;CAC9B,aAAa;CACb,cAAc;CACd,UAAU;AACZ;AAKA,eAAsB,2CAA0D;CAC9E,OAAO,MAAM,oCAAoC,GA2B/C,IAAI,CAAC,MA1BiB,+BACpB,OAAO,iBAAiB;EACtB,MAAM,EAAE,UAAU,gBAChB,MAAM,iCAAiC;GACrC,SAAS,aAAa;GACtB,kBAAkB,aAAa;EACjC,CAAC;EACH,IACE,SAAS,oBAAoB,YAC7B,SAAS,oBAAoB,aAE7B,OAAO;EAYT,QAAO,MAVc,0BAA0B;GAC7C,YAAY,aAAa;GACzB,iBAAiB;GACjB,aAAa;GACb,qBAAqB,aAAa;GAClC,WAAW,gBAAgB,OAAO;GAClC;GACA,cAAc;GACd,MAAM;EACR,CAAC,EAAA,CACa;CAChB,CACF,GAEE,MAAMA,WAAM,GAAG;AAGrB;AAIA,eAAsB,4CAA2D;CAC/E,MAAM,sCAAsC;EAC1C,WAAW,gBAAgB,OAAO;EAClC;EACA,MAAM;CACR,CAAC;AACH"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { J as normalizeOpenMeldProfileId, N as accountProfileViewPath, _ as resolveCliContext, et as openMeldRootDir, ft as runtimeDir, g as readCliContextState, h as listCliContextStates, y as writeCliContextState } from "./lock-Bsl_ElWy.js";
|
|
4
|
-
import {
|
|
5
|
-
import { d as getAuthSessionState } from "./auth-session-
|
|
6
|
-
import { G as resolveOpenMeldProfile, K as resolveOpenMeldProfileByIdOrName, it as resolveAuthenticationGuidanceFromError, ot as resolveAuthenticationReasonFromState, st as resolveCurrentOpenMeldAccountContext, tt as createAuthenticationError } from "./daemon-device-id-
|
|
7
|
-
import { _ as getConfiguredViewCustomization } from "./base-url-
|
|
4
|
+
import { ci as openMeldProfileIdSchema } from "./runtime-transport-BLtOFrtv.js";
|
|
5
|
+
import { d as getAuthSessionState } from "./auth-session-DOjVKRI_.js";
|
|
6
|
+
import { G as resolveOpenMeldProfile, K as resolveOpenMeldProfileByIdOrName, it as resolveAuthenticationGuidanceFromError, ot as resolveAuthenticationReasonFromState, st as resolveCurrentOpenMeldAccountContext, tt as createAuthenticationError } from "./daemon-device-id-bfkbZj9G.js";
|
|
7
|
+
import { _ as getConfiguredViewCustomization } from "./base-url-D7uE_xTo.js";
|
|
8
8
|
import { t as formatInlineOpenMeldCliCommands } from "./cli-entry-command-CR_9QU1i.js";
|
|
9
9
|
import { createHash } from "node:crypto";
|
|
10
10
|
import { dirname, join } from "node:path";
|
|
@@ -470,4 +470,4 @@ function isInteractiveSession() {
|
|
|
470
470
|
//#endregion
|
|
471
471
|
export { requireOpenMeldProfile as a, clearAllSelectedOpenMeldProfileIds as c, setSelectedOpenMeldProfileId as d, getProfileDefaultView as f, isSelectedOpenMeldProfileRequiredError as i, clearSelectedOpenMeldProfileId as l, resolveRuntimeContext as n, resolveOpenMeldProfileOrNull as o, setProfileDefaultView as p, resolveViewProfileKey as r, alignSelectedOpenMeldProfileStorage as s, parseCliViewMode as t, getSelectedOpenMeldProfileId as u };
|
|
472
472
|
|
|
473
|
-
//# sourceMappingURL=context-
|
|
473
|
+
//# sourceMappingURL=context-Di5R4iik.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-Cz5nJnDe.js","names":["normalizeOptionalString","normalizeOptionalString"],"sources":["../src/config/profile-view.ts","../src/config/openmeld-profile-selection.ts","../src/config/resolve-openmeld-profile.ts","../src/config/view-profile-key.ts","../src/runtime/context.ts"],"sourcesContent":["import { mkdir, readFile, rename, rm, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\nimport { resolveCurrentOpenMeldAccountContext } from \"./account-context\";\nimport {\n accountProfileViewPath,\n normalizeOpenMeldProfileId,\n type OpenMeldProfileId,\n} from \"./paths\";\n\nexport type ProfileDefaultView = \"auto\" | \"human\" | \"agent\";\n\ntype ProfileViewV1 = {\n v: 1;\n openMeldProfileId: OpenMeldProfileId;\n defaultView: Exclude<ProfileDefaultView, \"auto\">;\n updatedAt: string;\n};\n\ntype StoredProfileViewInput = Partial<ProfileViewV1> & { profile?: string };\n\ntype NormalizedStoredProfileView = {\n needsRewrite: boolean;\n payload: ProfileViewV1;\n};\n\nexport async function getProfileDefaultView(\n openMeldProfileId: string\n): Promise<ProfileDefaultView> {\n const normalizedOpenMeldProfileId =\n normalizeOpenMeldProfileId(openMeldProfileId);\n const path = await resolveAccountProfileViewPath(normalizedOpenMeldProfileId);\n const raw = await readFile(path, \"utf8\").catch(() => null);\n if (!raw) {\n return \"auto\";\n }\n\n try {\n const parsed = JSON.parse(raw) as StoredProfileViewInput;\n if (parsed.v !== 1) {\n return \"auto\";\n }\n const normalizedStoredProfileView = normalizeStoredProfileView(parsed);\n if (!normalizedStoredProfileView) {\n return \"auto\";\n }\n if (\n normalizedStoredProfileView.payload.openMeldProfileId !==\n normalizedOpenMeldProfileId\n ) {\n await rm(path, { force: true });\n return \"auto\";\n }\n if (normalizedStoredProfileView.needsRewrite) {\n await writeProfileViewFile(path, normalizedStoredProfileView.payload);\n }\n return normalizedStoredProfileView.payload.defaultView;\n } catch {\n return \"auto\";\n }\n}\n\nexport async function setProfileDefaultView(input: {\n openMeldProfileId: string;\n view: ProfileDefaultView;\n}): Promise<void> {\n const openMeldProfileId = normalizeOpenMeldProfileId(input.openMeldProfileId);\n const path = await resolveAccountProfileViewPath(openMeldProfileId);\n\n if (input.view === \"auto\") {\n await rm(path, { force: true });\n return;\n }\n\n await writeProfileViewFile(path, {\n v: 1,\n openMeldProfileId,\n defaultView: input.view,\n updatedAt: new Date().toISOString(),\n });\n}\n\nasync function writeProfileViewFile(\n path: string,\n payload: ProfileViewV1\n): Promise<void> {\n await mkdir(dirname(path), { recursive: true });\n const tempPath = `${path}.tmp-${process.pid}-${Date.now()}`;\n await writeFile(tempPath, `${JSON.stringify(payload, null, 2)}\\n`, \"utf8\");\n try {\n await rename(tempPath, path);\n } catch (error) {\n await rm(tempPath, { force: true }).catch(() => undefined);\n throw error;\n }\n}\n\nasync function resolveAccountProfileViewPath(\n openMeldProfileId: OpenMeldProfileId\n): Promise<string> {\n const accountContext = await resolveCurrentOpenMeldAccountContext();\n return accountProfileViewPath(accountContext.key, openMeldProfileId);\n}\n\nfunction normalizeStoredProfileView(\n input: StoredProfileViewInput\n): NormalizedStoredProfileView | null {\n const openMeldProfileId = normalizeOptionalOpenMeldProfileId(\n input.openMeldProfileId\n );\n const legacyProfile = normalizeOptionalOpenMeldProfileId(input.profile);\n const resolvedOpenMeldProfileId = openMeldProfileId ?? legacyProfile;\n if (!resolvedOpenMeldProfileId) {\n return null;\n }\n const defaultView = normalizeStoredDefaultView(input.defaultView);\n if (!defaultView) {\n return null;\n }\n const updatedAt = normalizeStoredUpdatedAt(input.updatedAt);\n return {\n needsRewrite:\n openMeldProfileId !== resolvedOpenMeldProfileId ||\n input.profile !== undefined ||\n input.updatedAt !== updatedAt,\n payload: {\n v: 1,\n openMeldProfileId: resolvedOpenMeldProfileId,\n defaultView,\n updatedAt,\n },\n };\n}\n\nfunction normalizeStoredDefaultView(\n value: unknown\n): Exclude<ProfileDefaultView, \"auto\"> | null {\n if (value === \"human\" || value === \"agent\") {\n return value;\n }\n return null;\n}\n\nfunction normalizeStoredUpdatedAt(value: unknown): string {\n if (typeof value === \"string\") {\n const trimmedValue = value.trim();\n if (trimmedValue.length > 0 && !Number.isNaN(Date.parse(trimmedValue))) {\n return trimmedValue;\n }\n }\n return new Date().toISOString();\n}\n\nfunction normalizeOptionalOpenMeldProfileId(\n value: unknown\n): OpenMeldProfileId | null {\n if (typeof value !== \"string\") {\n return null;\n }\n try {\n return normalizeOpenMeldProfileId(value);\n } catch {\n return null;\n }\n}\n","import { createHash } from \"node:crypto\";\nimport {\n mkdir,\n readdir,\n readFile,\n rm,\n stat,\n writeFile,\n} from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { openMeldRootDir, runtimeDir } from \"./paths\";\nimport {\n listCliContextStates,\n readCliContextState,\n resolveCliContext,\n writeCliContextState,\n} from \"./session-profile\";\n\ntype SelectedOpenMeldProfileV1 = {\n v: 1;\n sessionId: string;\n sessionSource: string;\n openMeldProfileId: string;\n updatedAt: string;\n};\n\nexport type SetSelectedOpenMeldProfileResult = {\n persistent: boolean;\n cliContextSource?: string;\n};\n\nexport type ClearAllSelectedOpenMeldProfileIdsResult = {\n clearedSessionSelections: number;\n failedSessionIds: string[];\n removedFallbackSelection: boolean;\n removedLegacySelectionFile: boolean;\n removedLegacySessionSelectionDirectory: boolean;\n};\n\nconst SESSION_FILE_HASH_LENGTH = 8;\nconst SESSION_FILE_MAX_LENGTH = 128;\nconst FALLBACK_SELECTION_SESSION_ID = \"global-default\";\nconst FALLBACK_SELECTION_SOURCE = \"fallback:no_runtime_session\";\n\nexport async function setSelectedOpenMeldProfileId(\n openMeldProfileId: string\n): Promise<SetSelectedOpenMeldProfileResult> {\n const normalized = normalizeRequiredString(\n openMeldProfileId,\n \"openMeldProfileId\"\n );\n await rm(legacySelectionPath(), { force: true }).catch(() => undefined);\n\n const cliContext = resolveCliContext();\n if (!cliContext) {\n await writeFallbackSelectionPayload(normalized);\n return {\n persistent: true,\n cliContextSource: FALLBACK_SELECTION_SOURCE,\n };\n }\n\n await writeCliContextState({\n selectedOpenMeldProfileId: normalized,\n });\n await rm(selectionPath(cliContext.cliContextId), {\n force: true,\n }).catch(() => undefined);\n return {\n persistent: true,\n cliContextSource: cliContext.source,\n };\n}\n\nexport async function getSelectedOpenMeldProfileId(): Promise<string | null> {\n const cliContext = resolveCliContext();\n if (!cliContext) {\n return await readFallbackSelectionPayload();\n }\n\n const sessionState = await readCliContextState();\n if (sessionState?.selectedOpenMeldProfileId) {\n return sessionState.selectedOpenMeldProfileId;\n }\n\n const legacySelection = await readLegacySelectionPayload(\n cliContext.cliContextId\n );\n if (!legacySelection?.openMeldProfileId) {\n return null;\n }\n await writeCliContextState({\n sessionId: legacySelection.sessionId,\n sessionSource: legacySelection.sessionSource,\n openMeldProfileId: legacySelection.openMeldProfileId,\n });\n await rm(selectionPath(cliContext.cliContextId), {\n force: true,\n }).catch(() => undefined);\n return legacySelection.openMeldProfileId;\n}\n\nexport async function clearSelectedOpenMeldProfileId(): Promise<void> {\n const cliContext = resolveCliContext();\n if (!cliContext) {\n await rm(fallbackSelectionPath(), { force: true }).catch(() => undefined);\n await rm(legacySelectionPath(), { force: true }).catch(() => undefined);\n return;\n }\n\n await writeCliContextState({\n selectedOpenMeldProfileId: null,\n });\n await rm(selectionPath(cliContext.cliContextId), { force: true });\n await rm(legacySelectionPath(), { force: true }).catch(() => undefined);\n}\n\nexport async function clearAllSelectedOpenMeldProfileIds(): Promise<ClearAllSelectedOpenMeldProfileIdsResult> {\n const sessionStates = await listCliContextStates();\n let clearedSessionSelections = 0;\n const failedSessionIds: string[] = [];\n\n for (const sessionState of sessionStates) {\n if (!sessionState.selectedOpenMeldProfileId) {\n continue;\n }\n try {\n const written = await writeCliContextState({\n sessionId: sessionState.sessionId,\n sessionSource: sessionState.cliContextSource,\n selectedOpenMeldProfileId: null,\n });\n if (written) {\n clearedSessionSelections += 1;\n continue;\n }\n } catch {\n // Best-effort cleanup: skip unwritable session state and continue logout.\n }\n failedSessionIds.push(sessionState.sessionId);\n }\n\n const removedFallbackSelection = await removeFileIfPresent(\n fallbackSelectionPath()\n );\n const removedLegacySelectionFile = await removeFileIfPresent(\n legacySelectionPath()\n );\n const removedLegacySessionSelectionDirectory = await removeDirectoryIfPresent(\n sessionSelectionDir()\n );\n\n return {\n clearedSessionSelections,\n failedSessionIds,\n removedFallbackSelection,\n removedLegacySelectionFile,\n removedLegacySessionSelectionDirectory,\n };\n}\n\nexport async function alignSelectedOpenMeldProfileStorage(): Promise<{\n migratedSessionSelections: number;\n removedLegacyDirectory: boolean;\n removedLegacySelectionFile: boolean;\n}> {\n let migratedSessionSelections = 0;\n const entryNames = await readdir(sessionSelectionDir()).catch(() => []);\n for (const entryName of entryNames) {\n if (!entryName.endsWith(\".selected-profile.json\")) {\n continue;\n }\n const raw = await readFile(\n join(sessionSelectionDir(), entryName),\n \"utf8\"\n ).catch(() => null);\n if (!raw) {\n continue;\n }\n const parsed = parseLegacySelectionPayload(raw);\n if (!parsed) {\n continue;\n }\n const written = await writeCliContextState({\n sessionId: parsed.sessionId,\n sessionSource: parsed.sessionSource,\n selectedOpenMeldProfileId: parsed.openMeldProfileId,\n });\n if (written) {\n migratedSessionSelections += 1;\n }\n }\n\n const legacyDirectoryExists = entryNames.length > 0;\n if (legacyDirectoryExists) {\n await rm(sessionSelectionDir(), { recursive: true, force: true });\n }\n await migrateLegacyFallbackSelection();\n const removedLegacySelectionFile = await removeLegacySelectionFile();\n return {\n migratedSessionSelections,\n removedLegacyDirectory: legacyDirectoryExists,\n removedLegacySelectionFile,\n };\n}\n\nfunction selectionPath(sessionId: string): string {\n return join(\n sessionSelectionDir(),\n `${toSafeSessionFile(sessionId)}.selected-profile.json`\n );\n}\n\nfunction sessionSelectionDir(): string {\n return join(runtimeDir(), \"selected-openmeld-profiles\");\n}\n\nfunction legacySelectionPath(): string {\n return join(openMeldRootDir(), \"auth\", \"selected-profile.json\");\n}\n\nfunction fallbackSelectionPath(): string {\n return join(runtimeDir(), \"selected-profile-fallback.json\");\n}\n\nasync function readLegacySelectionPayload(\n sessionId: string\n): Promise<SelectedOpenMeldProfileV1 | null> {\n const raw = await readFile(selectionPath(sessionId), \"utf8\").catch(\n () => null\n );\n if (!raw) {\n return null;\n }\n return parseLegacySelectionPayload(raw);\n}\n\nasync function readFallbackSelectionPayload(): Promise<string | null> {\n const raw = await readFile(fallbackSelectionPath(), \"utf8\").catch(() => null);\n if (!raw) {\n const legacyFallback = await readLegacyFallbackSelection();\n if (!legacyFallback) {\n return null;\n }\n await writeFallbackSelectionPayload(legacyFallback.openMeldProfileId);\n await rm(legacySelectionPath(), { force: true }).catch(() => undefined);\n return legacyFallback.openMeldProfileId;\n }\n return parseLegacySelectionPayload(raw)?.openMeldProfileId ?? null;\n}\n\nasync function writeFallbackSelectionPayload(\n openMeldProfileId: string\n): Promise<void> {\n await mkdir(runtimeDir(), { recursive: true });\n const payload: SelectedOpenMeldProfileV1 = {\n v: 1,\n sessionId: FALLBACK_SELECTION_SESSION_ID,\n sessionSource: FALLBACK_SELECTION_SOURCE,\n openMeldProfileId,\n updatedAt: new Date().toISOString(),\n };\n await writeFile(\n fallbackSelectionPath(),\n `${JSON.stringify(payload, null, 2)}\\n`,\n \"utf8\"\n );\n}\n\nfunction parseLegacySelectionPayload(\n raw: string\n): SelectedOpenMeldProfileV1 | null {\n try {\n const payload = JSON.parse(raw) as Partial<SelectedOpenMeldProfileV1>;\n if (payload.v !== 1) {\n return null;\n }\n const sessionId = normalizeOptionalString(payload.sessionId);\n const openMeldProfileId = normalizeOptionalString(\n payload.openMeldProfileId\n );\n if (!(sessionId && openMeldProfileId)) {\n return null;\n }\n return {\n v: 1,\n sessionId,\n sessionSource: normalizeOptionalString(payload.sessionSource) ?? \"manual\",\n openMeldProfileId,\n updatedAt:\n normalizeOptionalString(payload.updatedAt) ?? new Date(0).toISOString(),\n };\n } catch {\n return null;\n }\n}\n\nasync function readLegacyFallbackSelection(): Promise<SelectedOpenMeldProfileV1 | null> {\n const raw = await readFile(legacySelectionPath(), \"utf8\").catch(() => null);\n if (!raw) {\n return null;\n }\n const parsed = parseLegacySelectionPayload(raw);\n if (parsed?.sessionSource !== FALLBACK_SELECTION_SOURCE) {\n return null;\n }\n return parsed;\n}\n\nasync function migrateLegacyFallbackSelection(): Promise<void> {\n const legacyFallback = await readLegacyFallbackSelection();\n if (!legacyFallback) {\n return;\n }\n const existingFallback = await readFile(\n fallbackSelectionPath(),\n \"utf8\"\n ).catch(() => null);\n if (!existingFallback) {\n await writeFallbackSelectionPayload(legacyFallback.openMeldProfileId);\n }\n}\n\nasync function removeLegacySelectionFile(): Promise<boolean> {\n const raw = await readFile(legacySelectionPath(), \"utf8\").catch(() => null);\n if (!raw) {\n return false;\n }\n await rm(legacySelectionPath(), { force: true }).catch(() => undefined);\n return true;\n}\n\nfunction toSafeSessionFile(value: string): string {\n const hash = createHash(\"sha1\")\n .update(value, \"utf8\")\n .digest(\"hex\")\n .slice(0, SESSION_FILE_HASH_LENGTH);\n const safeBaseRaw = value.replace(/[^a-zA-Z0-9._-]+/g, \"_\");\n const safeBase = safeBaseRaw.length > 0 ? safeBaseRaw : \"session\";\n const maxBaseLength = Math.max(\n 1,\n SESSION_FILE_MAX_LENGTH - SESSION_FILE_HASH_LENGTH - 1\n );\n const truncatedBase = safeBase.slice(0, maxBaseLength);\n return `${truncatedBase}-${hash}`;\n}\n\nfunction normalizeOptionalString(value: unknown): string | null {\n const normalized = String(value ?? \"\").trim();\n return normalized.length > 0 ? normalized : null;\n}\n\nfunction normalizeRequiredString(value: unknown, field: string): string {\n const normalized = normalizeOptionalString(value);\n if (!normalized) {\n throw new Error(`${field} is required`);\n }\n return normalized;\n}\n\nasync function removeFileIfPresent(path: string): Promise<boolean> {\n const raw = await readFile(path, \"utf8\").catch(() => null);\n if (raw === null) {\n return false;\n }\n await rm(path, { force: true }).catch(() => undefined);\n return true;\n}\n\nasync function removeDirectoryIfPresent(path: string): Promise<boolean> {\n const directory = await stat(path).catch(() => null);\n if (!directory?.isDirectory()) {\n return false;\n }\n await rm(path, { recursive: true, force: true }).catch(() => undefined);\n return true;\n}\n","import {\n createAuthenticationError,\n resolveAuthenticationGuidanceFromError,\n resolveAuthenticationReasonFromState,\n} from \"../auth/auth-guidance\";\nimport { formatInlineOpenMeldCliCommands } from \"../runtime/cli-entry-command\";\nimport { getAuthSessionState } from \"./auth-session\";\nimport {\n clearSelectedOpenMeldProfileId,\n getSelectedOpenMeldProfileId,\n setSelectedOpenMeldProfileId,\n} from \"./openmeld-profile-selection\";\nimport {\n type OpenMeldProfile,\n type OpenMeldProfileKind,\n resolveOpenMeldProfile,\n resolveOpenMeldProfileByIdOrName,\n} from \"./openmeld-profiles-api\";\n\nexport type ResolveOpenMeldProfileInput = {\n openMeldProfileId?: string;\n profileKind?: OpenMeldProfileKind;\n allowUnauthenticated?: boolean;\n persistSelection?: boolean;\n allowDefaultFallback?: boolean;\n authAction?: string;\n};\n\nconst PROFILE_REQUIRED_ERROR_ROOT =\n \"no OpenMeld profile is selected for this terminal session yet\";\nconst PROFILE_REQUIRED_ERROR_MESSAGE = `${PROFILE_REQUIRED_ERROR_ROOT}; run \\`openmeld start\\` to choose one, or pass \\`--profile <id>\\`.`;\nconst SERVICE_TRACE_PROFILE_REQUIRED_ERROR_MESSAGE = `${PROFILE_REQUIRED_ERROR_ROOT}; dispatch trace needs an acting profile. Run \\`openmeld profile set <profile-id>\\` once, or pass \\`--profile <profile-id>\\` with this trace command. \\`--target-profile\\` only identifies the agent being traced.`;\nconst PROFILE_REQUIRED_ERROR_PREFIX =\n \"no OpenMeld profile is selected for this terminal session yet; run `\";\nconst PROFILE_REQUIRED_ERROR_SUFFIX =\n \" start` to choose one, or pass `--profile <id>`.\";\n\nexport function isSelectedOpenMeldProfileRequiredError(\n error: unknown\n): boolean {\n if (!(error instanceof Error)) {\n return false;\n }\n\n if (error.message === PROFILE_REQUIRED_ERROR_MESSAGE) {\n return true;\n }\n\n if (\n error.message.includes(PROFILE_REQUIRED_ERROR_ROOT) &&\n error.message.includes(\"--profile <\")\n ) {\n return true;\n }\n\n return (\n error.message.startsWith(PROFILE_REQUIRED_ERROR_PREFIX) &&\n error.message.endsWith(PROFILE_REQUIRED_ERROR_SUFFIX)\n );\n}\n\nexport async function resolveOpenMeldProfileOrNull(\n input: ResolveOpenMeldProfileInput = {}\n): Promise<OpenMeldProfile | null> {\n const explicitOpenMeldProfileId = normalizeOptionalString(\n input.openMeldProfileId\n );\n if (explicitOpenMeldProfileId) {\n return await resolveExplicitOpenMeldProfile(explicitOpenMeldProfileId, {\n profileKind: input.profileKind,\n allowUnauthenticated: input.allowUnauthenticated === true,\n persistSelection: input.persistSelection !== false,\n });\n }\n\n const selectedOpenMeldProfileId = await getSelectedOpenMeldProfileId();\n if (selectedOpenMeldProfileId) {\n const selectedProfile = await resolveSelectedOpenMeldProfile(\n selectedOpenMeldProfileId,\n {\n profileKind: input.profileKind,\n allowUnauthenticated: input.allowUnauthenticated === true,\n }\n );\n if (selectedProfile) {\n return selectedProfile;\n }\n }\n\n if (input.allowUnauthenticated === true) {\n const authState = await getAuthSessionState({\n validateRemote: false,\n });\n if (authState.state !== \"valid\") {\n return null;\n }\n }\n\n if (input.allowDefaultFallback !== true) {\n return null;\n }\n\n let fallbackProfile: OpenMeldProfile;\n try {\n fallbackProfile = await resolveOpenMeldProfile({\n profileKind: input.profileKind,\n });\n } catch (error) {\n if (input.allowUnauthenticated === true && isAuthRequiredError(error)) {\n return null;\n }\n throw error;\n }\n if (input.persistSelection !== false) {\n await setSelectedOpenMeldProfileId(fallbackProfile.openMeldProfileId);\n }\n return fallbackProfile;\n}\n\nasync function resolveExplicitOpenMeldProfile(\n openMeldProfileId: string,\n input: {\n profileKind?: OpenMeldProfileKind;\n allowUnauthenticated: boolean;\n persistSelection: boolean;\n }\n): Promise<OpenMeldProfile | null> {\n try {\n const profile = await resolveOpenMeldProfileByIdOrName({\n profileIdentifier: openMeldProfileId,\n profileKind: input.profileKind,\n });\n if (input.persistSelection) {\n await setSelectedOpenMeldProfileId(profile.openMeldProfileId);\n }\n return profile;\n } catch (error) {\n if (isAuthRequiredError(error) && input.allowUnauthenticated) {\n return null;\n }\n throw error;\n }\n}\n\nexport async function requireOpenMeldProfile(\n input: ResolveOpenMeldProfileInput = {}\n): Promise<OpenMeldProfile> {\n const profile = await resolveOpenMeldProfileOrNull(input);\n if (profile) {\n return profile;\n }\n\n const authState = await getAuthSessionState({\n validateRemote: false,\n });\n if (authState.state === \"valid\") {\n throw new Error(\n formatInlineOpenMeldCliCommands(\n resolveProfileRequiredErrorMessage(input.authAction)\n )\n );\n }\n const reason = resolveAuthenticationReasonFromState(authState.state);\n throw createAuthenticationError({\n reason: reason ?? \"required\",\n action: input.authAction,\n });\n}\n\nfunction resolveProfileRequiredErrorMessage(authAction?: string): string {\n if (authAction === \"reading a dispatch trace\") {\n return SERVICE_TRACE_PROFILE_REQUIRED_ERROR_MESSAGE;\n }\n\n return PROFILE_REQUIRED_ERROR_MESSAGE;\n}\n\nasync function resolveSelectedOpenMeldProfile(\n selectedOpenMeldProfileId: string,\n input: {\n profileKind?: OpenMeldProfileKind;\n allowUnauthenticated: boolean;\n }\n): Promise<OpenMeldProfile | null> {\n try {\n return await resolveOpenMeldProfile({\n openMeldProfileId: selectedOpenMeldProfileId,\n profileKind: input.profileKind,\n });\n } catch (error) {\n if (isAuthRequiredError(error)) {\n if (input.allowUnauthenticated) {\n return null;\n }\n throw error;\n }\n\n if (isProfileMissingError(error)) {\n await clearSelectedOpenMeldProfileId();\n return null;\n }\n\n throw error;\n }\n}\n\nfunction normalizeOptionalString(value: unknown): string | null {\n const normalized = String(value ?? \"\").trim();\n return normalized.length > 0 ? normalized : null;\n}\n\nfunction isAuthRequiredError(error: unknown): boolean {\n return resolveAuthenticationGuidanceFromError(error) !== null;\n}\n\nfunction isProfileMissingError(error: unknown): boolean {\n const code =\n error && typeof error === \"object\" && \"code\" in error\n ? String((error as { code?: unknown }).code ?? \"\")\n : \"\";\n if (code === \"profile.not_found\") {\n return true;\n }\n\n const message = error instanceof Error ? error.message : String(error ?? \"\");\n return message.includes(\"profile not found\");\n}\n","import { openMeldProfileIdSchema } from \"@openmeld/schemas\";\nimport { getSelectedOpenMeldProfileId } from \"./openmeld-profile-selection\";\nimport { resolveOpenMeldProfileByIdOrName } from \"./openmeld-profiles-api\";\n\nexport async function resolveViewProfileKey(\n inputProfile?: string\n): Promise<string | null> {\n const explicit = normalizeOptionalString(inputProfile);\n if (explicit) {\n const profileId = openMeldProfileIdSchema.safeParse(explicit);\n if (profileId.success) {\n return profileId.data;\n }\n const profile = await resolveOpenMeldProfileByIdOrName({\n profileIdentifier: explicit,\n }).catch(() => null);\n return profile?.openMeldProfileId ?? explicit;\n }\n\n const selected = await getSelectedOpenMeldProfileId();\n if (selected) {\n return selected;\n }\n\n return null;\n}\n\nfunction normalizeOptionalString(value: unknown): string | null {\n const normalized = String(value ?? \"\").trim();\n return normalized.length > 0 ? normalized : null;\n}\n","import { getProfileDefaultView } from \"../config/profile-view\";\nimport { resolveOpenMeldProfileOrNull } from \"../config/resolve-openmeld-profile\";\nimport {\n getConfiguredViewCustomization,\n type RuntimeViewCustomization,\n} from \"../config/runtime-config\";\nimport { resolveViewProfileKey } from \"../config/view-profile-key\";\nimport type { CliViewMode, RuntimeContext } from \"./types\";\n\nexport type { CliViewMode, RuntimeContext } from \"./types\";\n\nexport async function resolveRuntimeContext(input?: {\n view?: string;\n profile?: string;\n interactive?: boolean;\n}): Promise<RuntimeContext> {\n const viewOpenMeldProfileId = await resolveViewProfileKey(input?.profile);\n const configuredViewMode = await readConfiguredDefaultView(\n viewOpenMeldProfileId\n );\n const viewMode = parseCliViewMode(input?.view ?? configuredViewMode);\n const interactive = input?.interactive ?? isInteractiveSession();\n const viewCustomization = await readViewCustomization();\n\n if (viewMode === \"human\" || viewMode === \"agent\") {\n return {\n viewMode,\n resolvedView: viewMode,\n interactive,\n ...(viewOpenMeldProfileId\n ? { openMeldProfileId: viewOpenMeldProfileId }\n : {}),\n ...(viewCustomization ? { viewCustomization } : {}),\n };\n }\n\n const openMeldProfile = await resolveOpenMeldProfileOrNull({\n openMeldProfileId: input?.profile,\n allowUnauthenticated: true,\n persistSelection: false,\n allowDefaultFallback: false,\n }).catch(() => null);\n const resolvedView =\n openMeldProfile?.profileKind === \"agent\" ? \"agent\" : \"human\";\n const resolvedOpenMeldProfileId = openMeldProfile\n ? openMeldProfile.openMeldProfileId\n : viewOpenMeldProfileId;\n\n return {\n viewMode,\n resolvedView,\n interactive,\n ...(resolvedOpenMeldProfileId\n ? { openMeldProfileId: resolvedOpenMeldProfileId }\n : {}),\n ...(openMeldProfile?.profileKind\n ? { profileKind: openMeldProfile.profileKind }\n : {}),\n ...(viewCustomization ? { viewCustomization } : {}),\n };\n}\n\nexport function parseCliViewMode(value?: string): CliViewMode {\n const normalized = String(value ?? \"auto\")\n .trim()\n .toLowerCase();\n if (\n normalized === \"auto\" ||\n normalized === \"human\" ||\n normalized === \"agent\"\n ) {\n return normalized;\n }\n\n throw new Error(`invalid --view value: ${normalized} (use auto|human|agent)`);\n}\n\nfunction readViewCustomization(): Promise<RuntimeViewCustomization | null> {\n return getConfiguredViewCustomization().catch(() => null);\n}\n\nfunction readConfiguredDefaultView(\n openMeldProfileId?: string | null\n): Promise<CliViewMode> {\n if (!openMeldProfileId) {\n return Promise.resolve(\"auto\");\n }\n return getProfileDefaultView(openMeldProfileId).catch(() => \"auto\");\n}\n\nfunction isInteractiveSession(): boolean {\n return Boolean(process.stdin.isTTY && process.stdout.isTTY);\n}\n"],"mappings":";;;;;;;;;;;;AAyBA,eAAsB,sBACpB,mBAC6B;CAC7B,MAAM,8BACJ,2BAA2B,iBAAiB;CAC9C,MAAM,OAAO,MAAM,8BAA8B,2BAA2B;CAC5E,MAAM,MAAM,MAAM,SAAS,MAAM,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,CAAC,CAAC,YAAY,MAAM;AACpE;AAEA,SAAS,uBAAgC;CACvC,OAAO,QAAQ,QAAQ,MAAM,SAAS,QAAQ,OAAO,KAAK;AAC5D"}
|
|
1
|
+
{"version":3,"file":"context-Di5R4iik.js","names":["normalizeOptionalString","normalizeOptionalString"],"sources":["../src/config/profile-view.ts","../src/config/openmeld-profile-selection.ts","../src/config/resolve-openmeld-profile.ts","../src/config/view-profile-key.ts","../src/runtime/context.ts"],"sourcesContent":["import { mkdir, readFile, rename, rm, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\nimport { resolveCurrentOpenMeldAccountContext } from \"./account-context\";\nimport {\n accountProfileViewPath,\n normalizeOpenMeldProfileId,\n type OpenMeldProfileId,\n} from \"./paths\";\n\nexport type ProfileDefaultView = \"auto\" | \"human\" | \"agent\";\n\ntype ProfileViewV1 = {\n v: 1;\n openMeldProfileId: OpenMeldProfileId;\n defaultView: Exclude<ProfileDefaultView, \"auto\">;\n updatedAt: string;\n};\n\ntype StoredProfileViewInput = Partial<ProfileViewV1> & { profile?: string };\n\ntype NormalizedStoredProfileView = {\n needsRewrite: boolean;\n payload: ProfileViewV1;\n};\n\nexport async function getProfileDefaultView(\n openMeldProfileId: string\n): Promise<ProfileDefaultView> {\n const normalizedOpenMeldProfileId =\n normalizeOpenMeldProfileId(openMeldProfileId);\n const path = await resolveAccountProfileViewPath(normalizedOpenMeldProfileId);\n const raw = await readFile(path, \"utf8\").catch(() => null);\n if (!raw) {\n return \"auto\";\n }\n\n try {\n const parsed = JSON.parse(raw) as StoredProfileViewInput;\n if (parsed.v !== 1) {\n return \"auto\";\n }\n const normalizedStoredProfileView = normalizeStoredProfileView(parsed);\n if (!normalizedStoredProfileView) {\n return \"auto\";\n }\n if (\n normalizedStoredProfileView.payload.openMeldProfileId !==\n normalizedOpenMeldProfileId\n ) {\n await rm(path, { force: true });\n return \"auto\";\n }\n if (normalizedStoredProfileView.needsRewrite) {\n await writeProfileViewFile(path, normalizedStoredProfileView.payload);\n }\n return normalizedStoredProfileView.payload.defaultView;\n } catch {\n return \"auto\";\n }\n}\n\nexport async function setProfileDefaultView(input: {\n openMeldProfileId: string;\n view: ProfileDefaultView;\n}): Promise<void> {\n const openMeldProfileId = normalizeOpenMeldProfileId(input.openMeldProfileId);\n const path = await resolveAccountProfileViewPath(openMeldProfileId);\n\n if (input.view === \"auto\") {\n await rm(path, { force: true });\n return;\n }\n\n await writeProfileViewFile(path, {\n v: 1,\n openMeldProfileId,\n defaultView: input.view,\n updatedAt: new Date().toISOString(),\n });\n}\n\nasync function writeProfileViewFile(\n path: string,\n payload: ProfileViewV1\n): Promise<void> {\n await mkdir(dirname(path), { recursive: true });\n const tempPath = `${path}.tmp-${process.pid}-${Date.now()}`;\n await writeFile(tempPath, `${JSON.stringify(payload, null, 2)}\\n`, \"utf8\");\n try {\n await rename(tempPath, path);\n } catch (error) {\n await rm(tempPath, { force: true }).catch(() => undefined);\n throw error;\n }\n}\n\nasync function resolveAccountProfileViewPath(\n openMeldProfileId: OpenMeldProfileId\n): Promise<string> {\n const accountContext = await resolveCurrentOpenMeldAccountContext();\n return accountProfileViewPath(accountContext.key, openMeldProfileId);\n}\n\nfunction normalizeStoredProfileView(\n input: StoredProfileViewInput\n): NormalizedStoredProfileView | null {\n const openMeldProfileId = normalizeOptionalOpenMeldProfileId(\n input.openMeldProfileId\n );\n const legacyProfile = normalizeOptionalOpenMeldProfileId(input.profile);\n const resolvedOpenMeldProfileId = openMeldProfileId ?? legacyProfile;\n if (!resolvedOpenMeldProfileId) {\n return null;\n }\n const defaultView = normalizeStoredDefaultView(input.defaultView);\n if (!defaultView) {\n return null;\n }\n const updatedAt = normalizeStoredUpdatedAt(input.updatedAt);\n return {\n needsRewrite:\n openMeldProfileId !== resolvedOpenMeldProfileId ||\n input.profile !== undefined ||\n input.updatedAt !== updatedAt,\n payload: {\n v: 1,\n openMeldProfileId: resolvedOpenMeldProfileId,\n defaultView,\n updatedAt,\n },\n };\n}\n\nfunction normalizeStoredDefaultView(\n value: unknown\n): Exclude<ProfileDefaultView, \"auto\"> | null {\n if (value === \"human\" || value === \"agent\") {\n return value;\n }\n return null;\n}\n\nfunction normalizeStoredUpdatedAt(value: unknown): string {\n if (typeof value === \"string\") {\n const trimmedValue = value.trim();\n if (trimmedValue.length > 0 && !Number.isNaN(Date.parse(trimmedValue))) {\n return trimmedValue;\n }\n }\n return new Date().toISOString();\n}\n\nfunction normalizeOptionalOpenMeldProfileId(\n value: unknown\n): OpenMeldProfileId | null {\n if (typeof value !== \"string\") {\n return null;\n }\n try {\n return normalizeOpenMeldProfileId(value);\n } catch {\n return null;\n }\n}\n","import { createHash } from \"node:crypto\";\nimport {\n mkdir,\n readdir,\n readFile,\n rm,\n stat,\n writeFile,\n} from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { openMeldRootDir, runtimeDir } from \"./paths\";\nimport {\n listCliContextStates,\n readCliContextState,\n resolveCliContext,\n writeCliContextState,\n} from \"./session-profile\";\n\ntype SelectedOpenMeldProfileV1 = {\n v: 1;\n sessionId: string;\n sessionSource: string;\n openMeldProfileId: string;\n updatedAt: string;\n};\n\nexport type SetSelectedOpenMeldProfileResult = {\n persistent: boolean;\n cliContextSource?: string;\n};\n\nexport type ClearAllSelectedOpenMeldProfileIdsResult = {\n clearedSessionSelections: number;\n failedSessionIds: string[];\n removedFallbackSelection: boolean;\n removedLegacySelectionFile: boolean;\n removedLegacySessionSelectionDirectory: boolean;\n};\n\nconst SESSION_FILE_HASH_LENGTH = 8;\nconst SESSION_FILE_MAX_LENGTH = 128;\nconst FALLBACK_SELECTION_SESSION_ID = \"global-default\";\nconst FALLBACK_SELECTION_SOURCE = \"fallback:no_runtime_session\";\n\nexport async function setSelectedOpenMeldProfileId(\n openMeldProfileId: string\n): Promise<SetSelectedOpenMeldProfileResult> {\n const normalized = normalizeRequiredString(\n openMeldProfileId,\n \"openMeldProfileId\"\n );\n await rm(legacySelectionPath(), { force: true }).catch(() => undefined);\n\n const cliContext = resolveCliContext();\n if (!cliContext) {\n await writeFallbackSelectionPayload(normalized);\n return {\n persistent: true,\n cliContextSource: FALLBACK_SELECTION_SOURCE,\n };\n }\n\n await writeCliContextState({\n selectedOpenMeldProfileId: normalized,\n });\n await rm(selectionPath(cliContext.cliContextId), {\n force: true,\n }).catch(() => undefined);\n return {\n persistent: true,\n cliContextSource: cliContext.source,\n };\n}\n\nexport async function getSelectedOpenMeldProfileId(): Promise<string | null> {\n const cliContext = resolveCliContext();\n if (!cliContext) {\n return await readFallbackSelectionPayload();\n }\n\n const sessionState = await readCliContextState();\n if (sessionState?.selectedOpenMeldProfileId) {\n return sessionState.selectedOpenMeldProfileId;\n }\n\n const legacySelection = await readLegacySelectionPayload(\n cliContext.cliContextId\n );\n if (!legacySelection?.openMeldProfileId) {\n return null;\n }\n await writeCliContextState({\n sessionId: legacySelection.sessionId,\n sessionSource: legacySelection.sessionSource,\n openMeldProfileId: legacySelection.openMeldProfileId,\n });\n await rm(selectionPath(cliContext.cliContextId), {\n force: true,\n }).catch(() => undefined);\n return legacySelection.openMeldProfileId;\n}\n\nexport async function clearSelectedOpenMeldProfileId(): Promise<void> {\n const cliContext = resolveCliContext();\n if (!cliContext) {\n await rm(fallbackSelectionPath(), { force: true }).catch(() => undefined);\n await rm(legacySelectionPath(), { force: true }).catch(() => undefined);\n return;\n }\n\n await writeCliContextState({\n selectedOpenMeldProfileId: null,\n });\n await rm(selectionPath(cliContext.cliContextId), { force: true });\n await rm(legacySelectionPath(), { force: true }).catch(() => undefined);\n}\n\nexport async function clearAllSelectedOpenMeldProfileIds(): Promise<ClearAllSelectedOpenMeldProfileIdsResult> {\n const sessionStates = await listCliContextStates();\n let clearedSessionSelections = 0;\n const failedSessionIds: string[] = [];\n\n for (const sessionState of sessionStates) {\n if (!sessionState.selectedOpenMeldProfileId) {\n continue;\n }\n try {\n const written = await writeCliContextState({\n sessionId: sessionState.sessionId,\n sessionSource: sessionState.cliContextSource,\n selectedOpenMeldProfileId: null,\n });\n if (written) {\n clearedSessionSelections += 1;\n continue;\n }\n } catch {\n // Best-effort cleanup: skip unwritable session state and continue logout.\n }\n failedSessionIds.push(sessionState.sessionId);\n }\n\n const removedFallbackSelection = await removeFileIfPresent(\n fallbackSelectionPath()\n );\n const removedLegacySelectionFile = await removeFileIfPresent(\n legacySelectionPath()\n );\n const removedLegacySessionSelectionDirectory = await removeDirectoryIfPresent(\n sessionSelectionDir()\n );\n\n return {\n clearedSessionSelections,\n failedSessionIds,\n removedFallbackSelection,\n removedLegacySelectionFile,\n removedLegacySessionSelectionDirectory,\n };\n}\n\nexport async function alignSelectedOpenMeldProfileStorage(): Promise<{\n migratedSessionSelections: number;\n removedLegacyDirectory: boolean;\n removedLegacySelectionFile: boolean;\n}> {\n let migratedSessionSelections = 0;\n const entryNames = await readdir(sessionSelectionDir()).catch(() => []);\n for (const entryName of entryNames) {\n if (!entryName.endsWith(\".selected-profile.json\")) {\n continue;\n }\n const raw = await readFile(\n join(sessionSelectionDir(), entryName),\n \"utf8\"\n ).catch(() => null);\n if (!raw) {\n continue;\n }\n const parsed = parseLegacySelectionPayload(raw);\n if (!parsed) {\n continue;\n }\n const written = await writeCliContextState({\n sessionId: parsed.sessionId,\n sessionSource: parsed.sessionSource,\n selectedOpenMeldProfileId: parsed.openMeldProfileId,\n });\n if (written) {\n migratedSessionSelections += 1;\n }\n }\n\n const legacyDirectoryExists = entryNames.length > 0;\n if (legacyDirectoryExists) {\n await rm(sessionSelectionDir(), { recursive: true, force: true });\n }\n await migrateLegacyFallbackSelection();\n const removedLegacySelectionFile = await removeLegacySelectionFile();\n return {\n migratedSessionSelections,\n removedLegacyDirectory: legacyDirectoryExists,\n removedLegacySelectionFile,\n };\n}\n\nfunction selectionPath(sessionId: string): string {\n return join(\n sessionSelectionDir(),\n `${toSafeSessionFile(sessionId)}.selected-profile.json`\n );\n}\n\nfunction sessionSelectionDir(): string {\n return join(runtimeDir(), \"selected-openmeld-profiles\");\n}\n\nfunction legacySelectionPath(): string {\n return join(openMeldRootDir(), \"auth\", \"selected-profile.json\");\n}\n\nfunction fallbackSelectionPath(): string {\n return join(runtimeDir(), \"selected-profile-fallback.json\");\n}\n\nasync function readLegacySelectionPayload(\n sessionId: string\n): Promise<SelectedOpenMeldProfileV1 | null> {\n const raw = await readFile(selectionPath(sessionId), \"utf8\").catch(\n () => null\n );\n if (!raw) {\n return null;\n }\n return parseLegacySelectionPayload(raw);\n}\n\nasync function readFallbackSelectionPayload(): Promise<string | null> {\n const raw = await readFile(fallbackSelectionPath(), \"utf8\").catch(() => null);\n if (!raw) {\n const legacyFallback = await readLegacyFallbackSelection();\n if (!legacyFallback) {\n return null;\n }\n await writeFallbackSelectionPayload(legacyFallback.openMeldProfileId);\n await rm(legacySelectionPath(), { force: true }).catch(() => undefined);\n return legacyFallback.openMeldProfileId;\n }\n return parseLegacySelectionPayload(raw)?.openMeldProfileId ?? null;\n}\n\nasync function writeFallbackSelectionPayload(\n openMeldProfileId: string\n): Promise<void> {\n await mkdir(runtimeDir(), { recursive: true });\n const payload: SelectedOpenMeldProfileV1 = {\n v: 1,\n sessionId: FALLBACK_SELECTION_SESSION_ID,\n sessionSource: FALLBACK_SELECTION_SOURCE,\n openMeldProfileId,\n updatedAt: new Date().toISOString(),\n };\n await writeFile(\n fallbackSelectionPath(),\n `${JSON.stringify(payload, null, 2)}\\n`,\n \"utf8\"\n );\n}\n\nfunction parseLegacySelectionPayload(\n raw: string\n): SelectedOpenMeldProfileV1 | null {\n try {\n const payload = JSON.parse(raw) as Partial<SelectedOpenMeldProfileV1>;\n if (payload.v !== 1) {\n return null;\n }\n const sessionId = normalizeOptionalString(payload.sessionId);\n const openMeldProfileId = normalizeOptionalString(\n payload.openMeldProfileId\n );\n if (!(sessionId && openMeldProfileId)) {\n return null;\n }\n return {\n v: 1,\n sessionId,\n sessionSource: normalizeOptionalString(payload.sessionSource) ?? \"manual\",\n openMeldProfileId,\n updatedAt:\n normalizeOptionalString(payload.updatedAt) ?? new Date(0).toISOString(),\n };\n } catch {\n return null;\n }\n}\n\nasync function readLegacyFallbackSelection(): Promise<SelectedOpenMeldProfileV1 | null> {\n const raw = await readFile(legacySelectionPath(), \"utf8\").catch(() => null);\n if (!raw) {\n return null;\n }\n const parsed = parseLegacySelectionPayload(raw);\n if (parsed?.sessionSource !== FALLBACK_SELECTION_SOURCE) {\n return null;\n }\n return parsed;\n}\n\nasync function migrateLegacyFallbackSelection(): Promise<void> {\n const legacyFallback = await readLegacyFallbackSelection();\n if (!legacyFallback) {\n return;\n }\n const existingFallback = await readFile(\n fallbackSelectionPath(),\n \"utf8\"\n ).catch(() => null);\n if (!existingFallback) {\n await writeFallbackSelectionPayload(legacyFallback.openMeldProfileId);\n }\n}\n\nasync function removeLegacySelectionFile(): Promise<boolean> {\n const raw = await readFile(legacySelectionPath(), \"utf8\").catch(() => null);\n if (!raw) {\n return false;\n }\n await rm(legacySelectionPath(), { force: true }).catch(() => undefined);\n return true;\n}\n\nfunction toSafeSessionFile(value: string): string {\n const hash = createHash(\"sha1\")\n .update(value, \"utf8\")\n .digest(\"hex\")\n .slice(0, SESSION_FILE_HASH_LENGTH);\n const safeBaseRaw = value.replace(/[^a-zA-Z0-9._-]+/g, \"_\");\n const safeBase = safeBaseRaw.length > 0 ? safeBaseRaw : \"session\";\n const maxBaseLength = Math.max(\n 1,\n SESSION_FILE_MAX_LENGTH - SESSION_FILE_HASH_LENGTH - 1\n );\n const truncatedBase = safeBase.slice(0, maxBaseLength);\n return `${truncatedBase}-${hash}`;\n}\n\nfunction normalizeOptionalString(value: unknown): string | null {\n const normalized = String(value ?? \"\").trim();\n return normalized.length > 0 ? normalized : null;\n}\n\nfunction normalizeRequiredString(value: unknown, field: string): string {\n const normalized = normalizeOptionalString(value);\n if (!normalized) {\n throw new Error(`${field} is required`);\n }\n return normalized;\n}\n\nasync function removeFileIfPresent(path: string): Promise<boolean> {\n const raw = await readFile(path, \"utf8\").catch(() => null);\n if (raw === null) {\n return false;\n }\n await rm(path, { force: true }).catch(() => undefined);\n return true;\n}\n\nasync function removeDirectoryIfPresent(path: string): Promise<boolean> {\n const directory = await stat(path).catch(() => null);\n if (!directory?.isDirectory()) {\n return false;\n }\n await rm(path, { recursive: true, force: true }).catch(() => undefined);\n return true;\n}\n","import {\n createAuthenticationError,\n resolveAuthenticationGuidanceFromError,\n resolveAuthenticationReasonFromState,\n} from \"../auth/auth-guidance\";\nimport { formatInlineOpenMeldCliCommands } from \"../runtime/cli-entry-command\";\nimport { getAuthSessionState } from \"./auth-session\";\nimport {\n clearSelectedOpenMeldProfileId,\n getSelectedOpenMeldProfileId,\n setSelectedOpenMeldProfileId,\n} from \"./openmeld-profile-selection\";\nimport {\n type OpenMeldProfile,\n type OpenMeldProfileKind,\n resolveOpenMeldProfile,\n resolveOpenMeldProfileByIdOrName,\n} from \"./openmeld-profiles-api\";\n\nexport type ResolveOpenMeldProfileInput = {\n openMeldProfileId?: string;\n profileKind?: OpenMeldProfileKind;\n allowUnauthenticated?: boolean;\n persistSelection?: boolean;\n allowDefaultFallback?: boolean;\n authAction?: string;\n};\n\nconst PROFILE_REQUIRED_ERROR_ROOT =\n \"no OpenMeld profile is selected for this terminal session yet\";\nconst PROFILE_REQUIRED_ERROR_MESSAGE = `${PROFILE_REQUIRED_ERROR_ROOT}; run \\`openmeld start\\` to choose one, or pass \\`--profile <id>\\`.`;\nconst SERVICE_TRACE_PROFILE_REQUIRED_ERROR_MESSAGE = `${PROFILE_REQUIRED_ERROR_ROOT}; dispatch trace needs an acting profile. Run \\`openmeld profile set <profile-id>\\` once, or pass \\`--profile <profile-id>\\` with this trace command. \\`--target-profile\\` only identifies the agent being traced.`;\nconst PROFILE_REQUIRED_ERROR_PREFIX =\n \"no OpenMeld profile is selected for this terminal session yet; run `\";\nconst PROFILE_REQUIRED_ERROR_SUFFIX =\n \" start` to choose one, or pass `--profile <id>`.\";\n\nexport function isSelectedOpenMeldProfileRequiredError(\n error: unknown\n): boolean {\n if (!(error instanceof Error)) {\n return false;\n }\n\n if (error.message === PROFILE_REQUIRED_ERROR_MESSAGE) {\n return true;\n }\n\n if (\n error.message.includes(PROFILE_REQUIRED_ERROR_ROOT) &&\n error.message.includes(\"--profile <\")\n ) {\n return true;\n }\n\n return (\n error.message.startsWith(PROFILE_REQUIRED_ERROR_PREFIX) &&\n error.message.endsWith(PROFILE_REQUIRED_ERROR_SUFFIX)\n );\n}\n\nexport async function resolveOpenMeldProfileOrNull(\n input: ResolveOpenMeldProfileInput = {}\n): Promise<OpenMeldProfile | null> {\n const explicitOpenMeldProfileId = normalizeOptionalString(\n input.openMeldProfileId\n );\n if (explicitOpenMeldProfileId) {\n return await resolveExplicitOpenMeldProfile(explicitOpenMeldProfileId, {\n profileKind: input.profileKind,\n allowUnauthenticated: input.allowUnauthenticated === true,\n persistSelection: input.persistSelection !== false,\n });\n }\n\n const selectedOpenMeldProfileId = await getSelectedOpenMeldProfileId();\n if (selectedOpenMeldProfileId) {\n const selectedProfile = await resolveSelectedOpenMeldProfile(\n selectedOpenMeldProfileId,\n {\n profileKind: input.profileKind,\n allowUnauthenticated: input.allowUnauthenticated === true,\n }\n );\n if (selectedProfile) {\n return selectedProfile;\n }\n }\n\n if (input.allowUnauthenticated === true) {\n const authState = await getAuthSessionState({\n validateRemote: false,\n });\n if (authState.state !== \"valid\") {\n return null;\n }\n }\n\n if (input.allowDefaultFallback !== true) {\n return null;\n }\n\n let fallbackProfile: OpenMeldProfile;\n try {\n fallbackProfile = await resolveOpenMeldProfile({\n profileKind: input.profileKind,\n });\n } catch (error) {\n if (input.allowUnauthenticated === true && isAuthRequiredError(error)) {\n return null;\n }\n throw error;\n }\n if (input.persistSelection !== false) {\n await setSelectedOpenMeldProfileId(fallbackProfile.openMeldProfileId);\n }\n return fallbackProfile;\n}\n\nasync function resolveExplicitOpenMeldProfile(\n openMeldProfileId: string,\n input: {\n profileKind?: OpenMeldProfileKind;\n allowUnauthenticated: boolean;\n persistSelection: boolean;\n }\n): Promise<OpenMeldProfile | null> {\n try {\n const profile = await resolveOpenMeldProfileByIdOrName({\n profileIdentifier: openMeldProfileId,\n profileKind: input.profileKind,\n });\n if (input.persistSelection) {\n await setSelectedOpenMeldProfileId(profile.openMeldProfileId);\n }\n return profile;\n } catch (error) {\n if (isAuthRequiredError(error) && input.allowUnauthenticated) {\n return null;\n }\n throw error;\n }\n}\n\nexport async function requireOpenMeldProfile(\n input: ResolveOpenMeldProfileInput = {}\n): Promise<OpenMeldProfile> {\n const profile = await resolveOpenMeldProfileOrNull(input);\n if (profile) {\n return profile;\n }\n\n const authState = await getAuthSessionState({\n validateRemote: false,\n });\n if (authState.state === \"valid\") {\n throw new Error(\n formatInlineOpenMeldCliCommands(\n resolveProfileRequiredErrorMessage(input.authAction)\n )\n );\n }\n const reason = resolveAuthenticationReasonFromState(authState.state);\n throw createAuthenticationError({\n reason: reason ?? \"required\",\n action: input.authAction,\n });\n}\n\nfunction resolveProfileRequiredErrorMessage(authAction?: string): string {\n if (authAction === \"reading a dispatch trace\") {\n return SERVICE_TRACE_PROFILE_REQUIRED_ERROR_MESSAGE;\n }\n\n return PROFILE_REQUIRED_ERROR_MESSAGE;\n}\n\nasync function resolveSelectedOpenMeldProfile(\n selectedOpenMeldProfileId: string,\n input: {\n profileKind?: OpenMeldProfileKind;\n allowUnauthenticated: boolean;\n }\n): Promise<OpenMeldProfile | null> {\n try {\n return await resolveOpenMeldProfile({\n openMeldProfileId: selectedOpenMeldProfileId,\n profileKind: input.profileKind,\n });\n } catch (error) {\n if (isAuthRequiredError(error)) {\n if (input.allowUnauthenticated) {\n return null;\n }\n throw error;\n }\n\n if (isProfileMissingError(error)) {\n await clearSelectedOpenMeldProfileId();\n return null;\n }\n\n throw error;\n }\n}\n\nfunction normalizeOptionalString(value: unknown): string | null {\n const normalized = String(value ?? \"\").trim();\n return normalized.length > 0 ? normalized : null;\n}\n\nfunction isAuthRequiredError(error: unknown): boolean {\n return resolveAuthenticationGuidanceFromError(error) !== null;\n}\n\nfunction isProfileMissingError(error: unknown): boolean {\n const code =\n error && typeof error === \"object\" && \"code\" in error\n ? String((error as { code?: unknown }).code ?? \"\")\n : \"\";\n if (code === \"profile.not_found\") {\n return true;\n }\n\n const message = error instanceof Error ? error.message : String(error ?? \"\");\n return message.includes(\"profile not found\");\n}\n","import { openMeldProfileIdSchema } from \"@openmeld/schemas\";\nimport { getSelectedOpenMeldProfileId } from \"./openmeld-profile-selection\";\nimport { resolveOpenMeldProfileByIdOrName } from \"./openmeld-profiles-api\";\n\nexport async function resolveViewProfileKey(\n inputProfile?: string\n): Promise<string | null> {\n const explicit = normalizeOptionalString(inputProfile);\n if (explicit) {\n const profileId = openMeldProfileIdSchema.safeParse(explicit);\n if (profileId.success) {\n return profileId.data;\n }\n const profile = await resolveOpenMeldProfileByIdOrName({\n profileIdentifier: explicit,\n }).catch(() => null);\n return profile?.openMeldProfileId ?? explicit;\n }\n\n const selected = await getSelectedOpenMeldProfileId();\n if (selected) {\n return selected;\n }\n\n return null;\n}\n\nfunction normalizeOptionalString(value: unknown): string | null {\n const normalized = String(value ?? \"\").trim();\n return normalized.length > 0 ? normalized : null;\n}\n","import { getProfileDefaultView } from \"../config/profile-view\";\nimport { resolveOpenMeldProfileOrNull } from \"../config/resolve-openmeld-profile\";\nimport {\n getConfiguredViewCustomization,\n type RuntimeViewCustomization,\n} from \"../config/runtime-config\";\nimport { resolveViewProfileKey } from \"../config/view-profile-key\";\nimport type { CliViewMode, RuntimeContext } from \"./types\";\n\nexport type { CliViewMode, RuntimeContext } from \"./types\";\n\nexport async function resolveRuntimeContext(input?: {\n view?: string;\n profile?: string;\n interactive?: boolean;\n}): Promise<RuntimeContext> {\n const viewOpenMeldProfileId = await resolveViewProfileKey(input?.profile);\n const configuredViewMode = await readConfiguredDefaultView(\n viewOpenMeldProfileId\n );\n const viewMode = parseCliViewMode(input?.view ?? configuredViewMode);\n const interactive = input?.interactive ?? isInteractiveSession();\n const viewCustomization = await readViewCustomization();\n\n if (viewMode === \"human\" || viewMode === \"agent\") {\n return {\n viewMode,\n resolvedView: viewMode,\n interactive,\n ...(viewOpenMeldProfileId\n ? { openMeldProfileId: viewOpenMeldProfileId }\n : {}),\n ...(viewCustomization ? { viewCustomization } : {}),\n };\n }\n\n const openMeldProfile = await resolveOpenMeldProfileOrNull({\n openMeldProfileId: input?.profile,\n allowUnauthenticated: true,\n persistSelection: false,\n allowDefaultFallback: false,\n }).catch(() => null);\n const resolvedView =\n openMeldProfile?.profileKind === \"agent\" ? \"agent\" : \"human\";\n const resolvedOpenMeldProfileId = openMeldProfile\n ? openMeldProfile.openMeldProfileId\n : viewOpenMeldProfileId;\n\n return {\n viewMode,\n resolvedView,\n interactive,\n ...(resolvedOpenMeldProfileId\n ? { openMeldProfileId: resolvedOpenMeldProfileId }\n : {}),\n ...(openMeldProfile?.profileKind\n ? { profileKind: openMeldProfile.profileKind }\n : {}),\n ...(viewCustomization ? { viewCustomization } : {}),\n };\n}\n\nexport function parseCliViewMode(value?: string): CliViewMode {\n const normalized = String(value ?? \"auto\")\n .trim()\n .toLowerCase();\n if (\n normalized === \"auto\" ||\n normalized === \"human\" ||\n normalized === \"agent\"\n ) {\n return normalized;\n }\n\n throw new Error(`invalid --view value: ${normalized} (use auto|human|agent)`);\n}\n\nfunction readViewCustomization(): Promise<RuntimeViewCustomization | null> {\n return getConfiguredViewCustomization().catch(() => null);\n}\n\nfunction readConfiguredDefaultView(\n openMeldProfileId?: string | null\n): Promise<CliViewMode> {\n if (!openMeldProfileId) {\n return Promise.resolve(\"auto\");\n }\n return getProfileDefaultView(openMeldProfileId).catch(() => \"auto\");\n}\n\nfunction isInteractiveSession(): boolean {\n return Boolean(process.stdin.isTTY && process.stdout.isTTY);\n}\n"],"mappings":";;;;;;;;;;;;AAyBA,eAAsB,sBACpB,mBAC6B;CAC7B,MAAM,8BACJ,2BAA2B,iBAAiB;CAC9C,MAAM,OAAO,MAAM,8BAA8B,2BAA2B;CAC5E,MAAM,MAAM,MAAM,SAAS,MAAM,MAAM,CAAC,CA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AAY,MAAM;AACpE;AAEA,SAAS,uBAAgC;CACvC,OAAO,QAAQ,QAAQ,MAAM,SAAS,QAAQ,OAAO,KAAK;AAC5D"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { c as agentControllerConversationRefSchema, s as runtimeTransportModeSchema } from "./controller-contract-
|
|
3
|
+
import { c as agentControllerConversationRefSchema, s as runtimeTransportModeSchema } from "./controller-contract-DAOCaefz.js";
|
|
4
4
|
import { B as number, F as iso, G as string, J as union, L as literal, N as enumFactory, O as array, W as strictObject, j as discriminatedUnion, k as boolean, z as nullFactory } from "./local-components-B6SCXZf9.js";
|
|
5
5
|
import * as z$1 from "zod/v4";
|
|
6
6
|
//#region ../../packages/schemas/dist/schemas/protocol/shared.js
|
|
@@ -679,4 +679,4 @@ const openMeldDaemonControlPlaneResponseSchema = discriminatedUnion("code", [
|
|
|
679
679
|
//#endregion
|
|
680
680
|
export { profileKindSchema as A, conversationExecutionStateSchema as C, normalizeOptionalWorkingDirectory as D, agentProfileIdSchema as E, uuidProfileIdSchema as F, finiteIntegerNumber as I, nonEmptyTrimmedStringFromUnknown as L, profileSchema as M, profileWorkingDirectorySchema as N, openMeldRuntimeProfileIdSchema as O, profileWorkspaceModeSchema as P, optionalBooleanQuerySchema as R, bootstrapTemplateFactsSchema as S, MAX_PROFILE_WORKING_DIRECTORY_LENGTH as T, openMeldDaemonSetProfileWorkspaceRequestPayloadSchema as _, openMeldDaemonCancelRequestPayloadSchema as a, skippedDaemonProfileSchema as b, openMeldDaemonConversationExecutionStatusPayloadSchema as c, openMeldDaemonInterruptRequestPayloadSchema as d, openMeldDaemonManageLocalAgentInstallationPayloadSchema as f, openMeldDaemonSetProfileWorkspacePayloadSchema as g, openMeldDaemonSetLocalAgentEnabledRequestPayloadSchema as h, openMeldDaemonCancelPayloadSchema as i, profileLabelSchema as j, profileHandleSchema as k, openMeldDaemonConversationExecutionStatusRequestPayloadSchema as l, openMeldDaemonSetLocalAgentEnabledPayloadSchema as m, OPENMELD_DAEMON_CANCEL_WITHDRAWN_BEFORE_START_REASON_CODE as n, openMeldDaemonControlPlaneRequestSchema as o, openMeldDaemonManageLocalAgentInstallationRequestPayloadSchema as p, localAgentInstallationOptionSchema as r, openMeldDaemonControlPlaneResponseSchema as s, OPENMELD_DAEMON_CANCEL_STOP_REQUESTED_AFTER_START_REASON_CODE as t, openMeldDaemonInterruptPayloadSchema as u, openMeldDaemonSyncRouteCatalogPayloadSchema as v, dispatchExecutionSchema as w, providerDispatchRuntimeContextSchema as x, openMeldDaemonSyncRouteCatalogRequestPayloadSchema as y, trimmedStringFromUnknown as z };
|
|
681
681
|
|
|
682
|
-
//# sourceMappingURL=control-plane-
|
|
682
|
+
//# sourceMappingURL=control-plane-BDS63N7Y.js.map
|