@north-light/cli 0.3.693 → 0.3.694

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.
Files changed (39) hide show
  1. package/dist/api/errors.js +1 -1
  2. package/dist/cli.js +6 -6
  3. package/dist/clients/attach/viewer.js +496 -496
  4. package/dist/commands/node/inspect.js +9 -9
  5. package/dist/commands/pkg/market-manage.js +1 -1
  6. package/dist/commands/pkg/plugin-manage.js +1 -1
  7. package/dist/commands/sys/update.js +1 -1
  8. package/dist/core/canvas/canvas.js +6 -6
  9. package/dist/core/config.js +1 -1
  10. package/dist/core/graph/exposures.js +1 -1
  11. package/dist/core/graph/watches.js +1 -1
  12. package/dist/core/installed-plugins.js +1 -1
  13. package/dist/core/scoped-state/imported-mac-installs.d.ts +12 -0
  14. package/dist/core/scoped-state/imported-mac-installs.js +2 -0
  15. package/dist/core/spaces/stop.js +1 -1
  16. package/dist/daemon/api/server.js +1 -1
  17. package/dist/shared/env.d.ts +8 -3
  18. package/dist/shared/env.js +2 -2
  19. package/dist/types.d.ts +1 -1
  20. package/dist/types.js +1 -1
  21. package/package.json +3 -3
  22. package/packages/crouter-api/dist/api/errors.js +1 -1
  23. package/packages/crouter-api/dist/commands/node/inspect.js +16 -2
  24. package/packages/crouter-api/dist/commands/pkg/market-manage.js +22 -19
  25. package/packages/crouter-api/dist/commands/pkg/plugin-manage.js +2 -1
  26. package/packages/crouter-api/dist/commands/sys/update.js +5 -3
  27. package/packages/crouter-api/dist/core/canvas/canvas.js +4 -8
  28. package/packages/crouter-api/dist/core/config.js +10 -3
  29. package/packages/crouter-api/dist/core/graph/exposures.js +1 -1
  30. package/packages/crouter-api/dist/core/graph/watches.js +1 -1
  31. package/packages/crouter-api/dist/core/installed-plugins.js +3 -2
  32. package/packages/crouter-api/dist/core/scoped-state/imported-mac-installs.js +94 -0
  33. package/packages/crouter-api/dist/core/spaces/stop.js +2 -2
  34. package/packages/crouter-api/dist/shared/env.js +15 -4
  35. package/packages/crouter-api/dist/types.js +1 -1
  36. package/packages/crouter-api/package.json +1 -1
  37. package/packages/crouter-identity/package.json +1 -1
  38. package/packages/crouter-plugin/package.json +3 -3
  39. package/runtime.lock.json +14 -14
@@ -1 +1 @@
1
- var u=Object.defineProperty;var r=(t,s)=>u(t,"name",{value:s,configurable:!0});class n extends Error{static{r(this,"APIError")}status;code;details;headers;type;param;origin;retryable;retryAfterS;resetAt;requestId;runId;questionId;scope;userAction;constructor(s,i,a,o,d,e){super(a),this.name="APIError",this.status=s,this.code=i,this.headers=new Headers(d),o!==void 0&&(this.details=o),this.type=e?.type,this.param=e?.param,this.origin=e?.origin,this.retryable=e?.retryable,this.retryAfterS=e?.retry_after_s,this.resetAt=e?.reset_at,this.requestId=e?.request_id??this.headers.get("Request-Id")??void 0,this.runId=e?.run_id,this.questionId=e?.question_id,this.scope=e?.scope,this.userAction=e?.user_action}}function h(t){return t instanceof n?t.status===503&&(t.code==="daemon_unavailable"||t.code==="transport_error"||t.code==="daemon_request_interrupted"||t.code==="northlight_unreachable")||t.status===504&&(t.code==="request_timeout"||t.code==="deadline_exceeded")||t.status>=500&&t.code==="daemon_health_unavailable":!1}r(h,"isDaemonTransportApiError");function f(t){return t instanceof n&&t.status===401}r(f,"isTokenRevokedApiError");function _(t){if(typeof t!="object"||t===null)return!1;const s=t.error;if(typeof s!="object"||s===null)return!1;const{code:i,message:a}=s;return typeof i=="string"&&typeof a=="string"}r(_,"isErrorBody");export{n as APIError,n as ApiError,h as isDaemonTransportApiError,_ as isErrorBody,f as isTokenRevokedApiError};
1
+ var u=Object.defineProperty;var r=(t,s)=>u(t,"name",{value:s,configurable:!0});class n extends Error{static{r(this,"APIError")}status;code;details;headers;type;param;origin;retryable;retryAfterS;resetAt;requestId;runId;questionId;scope;userAction;constructor(s,i,a,d,o,e){super(a),this.name="APIError",this.status=s,this.code=i,this.headers=new Headers(o),d!==void 0&&(this.details=d),this.type=e?.type,this.param=e?.param,this.origin=e?.origin,this.retryable=e?.retryable,this.retryAfterS=e?.retry_after_s,this.resetAt=e?.reset_at,this.requestId=e?.request_id??this.headers.get("Request-Id")??void 0,this.runId=e?.run_id,this.questionId=e?.question_id,this.scope=e?.scope,this.userAction=e?.user_action}}function h(t){return t instanceof n?t.status===503&&(t.code==="daemon_unavailable"||t.code==="transport_error"||t.code==="daemon_request_interrupted"||t.code==="runtime_starting"||t.code==="northlight_unreachable")||t.status===504&&(t.code==="request_timeout"||t.code==="deadline_exceeded")||t.status>=500&&t.code==="daemon_health_unavailable":!1}r(h,"isDaemonTransportApiError");function f(t){return t instanceof n&&t.status===401}r(f,"isTokenRevokedApiError");function _(t){if(typeof t!="object"||t===null)return!1;const s=t.error;if(typeof s!="object"||s===null)return!1;const{code:i,message:a}=s;return typeof i=="string"&&typeof a=="string"}r(_,"isErrorBody");export{n as APIError,n as ApiError,h as isDaemonTransportApiError,_ as isErrorBody,f as isTokenRevokedApiError};
package/dist/cli.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- var R=Object.defineProperty;var s=(r,o)=>R(r,"name",{value:o,configurable:!0});import"./suppress-experimental-warnings.js";import{mkdirSync as S,openSync as b,readFileSync as E,renameSync as I,rmSync as C,statSync as g,writeFileSync as O}from"node:fs";import{dirname as h,join as a}from"node:path";import{enableCompileCache as k}from"node:module";import{fileURLToPath as v}from"node:url";import{isDaemonControlInvocation as m,isJoinInvocation as A,isLayoutMigrationInvocation as N,isPkgInstallInvocation as x,isSignInInvocation as $,personOnlyInvocation as P,resolveDaemonControlRoot as T,resolveLayoutMigrationRoot as F,resolveRoot as M}from"./build-root.js";import{maybeBootRoot as D}from"./core/runtime/front-door.js";import{maybeAutoUpdate as L}from"./core/auto-update.js";import{ensureProjectScope as j}from"./core/bootstrap.js";import{provisionExports as U,pruneLegacyExports as B}from"./core/host-exports/export.js";import{revalidateBundlePlugins as K}from"./core/command-plugins/revalidate.js";import{renderNode as J,runCli as w,walk as V}from"./core/command.js";import{dispatchWithStaleRecovery as W}from"./core/manifest-recovery.js";import{installStdoutErrorPolicy as q}from"./core/stdout-errors.js";import{handle as G}from"./core/io.js";import{CrtrError as f,ownerOnly as z}from"./core/errors.js";import{ExitCode as H}from"./types.js";import{layoutNeedsMigration as Q,runtimeRoot as X}from"./core/layout.js";import{ApiError as y}from"./api/index.js";import{mark as i}from"./core/timing.js";import{launchSnapshotFile as Y,providerProjectionOverBrokerRelay as Z,sandboxCliNodeId as rr}from"./shared/env.js";import{nodeRunDir as d}from"./core/canvas/paths.js";import{installBrokerConfigSnapshot as or}from"./core/config.js";b(v(import.meta.url),"r"),q(),i("cli.entry",{cmd:process.argv[2]??"(bare)"});try{k()}catch{}i("cli.compile_cache");const er=a(h(v(import.meta.url)),".."),l=a(X(),"first-run.json");function c(r){return(r instanceof Error?r.message:String(r)).split(/\r?\n/,1)[0]??""}s(c,"errorMessage");function tr(r){const o=h(l);S(o,{recursive:!0});const t=`${l}.${process.pid}.${Date.now()}.tmp`;try{O(t,JSON.stringify({packageVersion:r,completedAt:new Date().toISOString()})+`
3
- `,"utf8"),I(t,l)}finally{C(t,{force:!0})}}s(tr,"writeFirstRunMarker");async function ir(){if(process.env.CRTR_NO_AUTO_INIT==="1")return;try{if(g(l,{throwIfNoEntry:!1})!==void 0)return}catch(o){process.stderr.write(`crtr: first-run reconcile marker check failed: ${c(o)}
2
+ var R=Object.defineProperty;var s=(r,o)=>R(r,"name",{value:o,configurable:!0});import"./suppress-experimental-warnings.js";import{mkdirSync as S,openSync as b,readFileSync as I,renameSync as E,rmSync as C,statSync as g,writeFileSync as O}from"node:fs";import{dirname as h,join as a}from"node:path";import{enableCompileCache as k}from"node:module";import{fileURLToPath as w}from"node:url";import{isDaemonControlInvocation as m,isJoinInvocation as A,isLayoutMigrationInvocation as N,isPkgInstallInvocation as x,isSignInInvocation as $,personOnlyInvocation as P,resolveDaemonControlRoot as T,resolveLayoutMigrationRoot as F,resolveRoot as L}from"./build-root.js";import{maybeBootRoot as M}from"./core/runtime/front-door.js";import{maybeAutoUpdate as D}from"./core/auto-update.js";import{ensureProjectScope as j}from"./core/bootstrap.js";import{provisionExports as U,pruneLegacyExports as B}from"./core/host-exports/export.js";import{revalidateBundlePlugins as K}from"./core/command-plugins/revalidate.js";import{renderNode as J,runCli as v,walk as V}from"./core/command.js";import{dispatchWithStaleRecovery as W}from"./core/manifest-recovery.js";import{installStdoutErrorPolicy as q}from"./core/stdout-errors.js";import{handle as G}from"./core/io.js";import{CrtrError as f,ownerOnly as z}from"./core/errors.js";import{ExitCode as H}from"./types.js";import{layoutNeedsMigration as Q,runtimeRoot as X}from"./core/layout.js";import{ApiError as y}from"./api/index.js";import{mark as i}from"./core/timing.js";import{launchSnapshotFile as Y,providerProjectionOverBrokerRelay as Z,sandboxCliNodeId as rr}from"./shared/env.js";import{nodeRunDir as d}from"./core/canvas/paths.js";import{installBrokerConfigSnapshot as or}from"./core/config.js";b(w(import.meta.url),"r"),q(),i("cli.entry",{cmd:process.argv[2]??"(bare)"});try{k()}catch{}i("cli.compile_cache");const er=a(h(w(import.meta.url)),".."),l=a(X(),"first-run.json");function c(r){return(r instanceof Error?r.message:String(r)).split(/\r?\n/,1)[0]??""}s(c,"errorMessage");function tr(r){const o=h(l);S(o,{recursive:!0});const e=`${l}.${process.pid}.${Date.now()}.tmp`;try{O(e,JSON.stringify({packageVersion:r,completedAt:new Date().toISOString()})+`
3
+ `,"utf8"),E(e,l)}finally{C(e,{force:!0})}}s(tr,"writeFirstRunMarker");async function ir(){if(process.env.CRTR_NO_AUTO_INIT==="1")return;try{if(g(l,{throwIfNoEntry:!1})!==void 0)return}catch(o){process.stderr.write(`crtr: first-run reconcile marker check failed: ${c(o)}
4
4
  `);return}try{if(g(a(er,".git"),{throwIfNoEntry:!1})!==void 0)return}catch(o){process.stderr.write(`crtr: first-run reconcile source check failed: ${c(o)}
5
- `);return}let r;try{const{reconcileFirstRun:o}=await import("./commands/sys/setup-core.js");r=await o((t,p)=>{process.stderr.write(`crtr: first-run reconcile ${t} failed: ${c(p)}
5
+ `);return}let r;try{const{reconcileFirstRun:o}=await import("./commands/sys/setup-core.js");r=await o((e,p)=>{process.stderr.write(`crtr: first-run reconcile ${e} failed: ${c(p)}
6
6
  `)})}catch(o){process.stderr.write(`crtr: first-run reconcile failed: ${c(o)}
7
7
  `)}finally{if(r!==void 0)try{tr(r)}catch(o){process.stderr.write(`crtr: first-run reconcile marker failed: ${c(o)}
8
- `)}}}s(ir,"maybeReconcileFirstRun");async function nr(){const r=N(process.argv),o=rr(),t=o!==void 0;if(o!==void 0){process.env.CRTR_API_SOCKET=a(d(o),"cli.sock");const e=P(process.argv);if(e!==null)throw z(`crtr ${e} is not available to an app's node`,"Run this command from the person's terminal.");const n=JSON.parse(E(Y(d(o))??a(d(o),"broker-launch.json"),"utf8"));if(!n.configSnapshot)throw new Error("node launch is missing its config snapshot");or(n.configSnapshot)}if(!t&&Q()&&!m(process.argv)&&!r)throw new f("layout_migration_required","run crtr sys migrate while the runtime is offline",H.NETWORK,{next:"Run `crtr sys migrate` while the runtime is offline, then restart it."});if(r){const e=await F();if(process.argv.slice(4).some(n=>n==="-h"||n==="--help")){process.stdout.write(J(V(e,["sys","migrate"]).node)+`
9
- `);return}await w(e,process.argv);return}if((!t||x(process.argv))&&!m(process.argv)&&!A(process.argv)&&!$(process.argv)){try{t||await(await import("./commands/daemon-generation.js")).assertLocalDaemonMatchesCli(),await(await import("./commands/person-settings.js")).loadPersonSettingsViaApi()}catch(e){const n=process.argv.slice(2).some(u=>u==="-h"||u==="--help"),_=e instanceof y&&(e.code==="daemon_unavailable"||e.code==="northlight_unreachable")||e instanceof f&&(e.code==="daemon_generation_mismatch"||e.code==="not_signed_in"||e.code==="move_unfinished"||e.code==="northlight_unreachable");if(!(n&&_))throw e;(await import("./core/scoped-state/person-store.js")).installPreludeSnapshot({profiles:[],defaults:{},settings:{},state:{},apps:{}})}i("cli.settings_loaded")}if(t||(B(process.argv),Z()||await ir()),await D(process.argv),i("cli.front_door_passed"),m(process.argv)){await w(await T(),process.argv);return}t||await K(process.argv),i("cli.plugins_revalidated");const p=await M(process.argv[2]);i("cli.root_resolved"),t||(U(p,process.argv),await j(process.argv),await L(process.argv)),i("cli.dispatch_start"),await W(p,process.argv),i("cli.dispatch_done")}s(nr,"main"),nr().catch(r=>{(r instanceof Error&&r.name==="AbortError"||r instanceof Error&&/operation was aborted/i.test(r.message))&&(process.stderr.write(`crtr: Interrupted
10
- `),process.exit(130)),(r instanceof y||r instanceof f)&&(G(r),process.exit(typeof process.exitCode=="number"?process.exitCode:1));const t=r instanceof Error?r.message:String(r);process.stderr.write(`crtr: ${t}
8
+ `)}}}s(ir,"maybeReconcileFirstRun");async function nr(){const r=N(process.argv),o=rr(),e=o!==void 0;if(o!==void 0){process.env.CRTR_API_SOCKET=a(d(o),"cli.sock");const t=P(process.argv);if(t!==null)throw z(`crtr ${t} is not available to an app's node`,"Run this command from the person's terminal.");const n=JSON.parse(I(Y(d(o))??a(d(o),"broker-launch.json"),"utf8"));if(!n.configSnapshot)throw new Error("node launch is missing its config snapshot");or(n.configSnapshot)}if(!e&&Q()&&!m(process.argv)&&!r)throw new f("layout_migration_required","run crtr sys migrate while the runtime is offline",H.NETWORK,{next:"Run `crtr sys migrate` while the runtime is offline, then restart it."});if(r){const t=await F();if(process.argv.slice(4).some(n=>n==="-h"||n==="--help")){process.stdout.write(J(V(t,["sys","migrate"]).node)+`
9
+ `);return}await v(t,process.argv);return}if((!e||x(process.argv))&&!m(process.argv)&&!A(process.argv)&&!$(process.argv)){try{e||await(await import("./commands/daemon-generation.js")).assertLocalDaemonMatchesCli(),await(await import("./commands/person-settings.js")).loadPersonSettingsViaApi(),e||await(await import("./core/scoped-state/imported-mac-installs.js")).migrateLegacyInstallsOnce()}catch(t){const n=process.argv.slice(2).some(u=>u==="-h"||u==="--help"),_=t instanceof y&&(t.code==="daemon_unavailable"||t.code==="northlight_unreachable")||t instanceof f&&(t.code==="daemon_generation_mismatch"||t.code==="not_signed_in"||t.code==="move_unfinished"||t.code==="northlight_unreachable");if(!(n&&_))throw t;(await import("./core/scoped-state/person-store.js")).installPreludeSnapshot({profiles:[],defaults:{},settings:{},state:{},apps:{}})}i("cli.settings_loaded")}if(e||(B(process.argv),Z()||await ir()),await M(process.argv),i("cli.front_door_passed"),m(process.argv)){await v(await T(),process.argv);return}e||await K(process.argv),i("cli.plugins_revalidated");const p=await L(process.argv[2]);i("cli.root_resolved"),e||(U(p,process.argv),await j(process.argv),await D(process.argv)),i("cli.dispatch_start"),await W(p,process.argv),i("cli.dispatch_done")}s(nr,"main"),nr().catch(r=>{(r instanceof Error&&r.name==="AbortError"||r instanceof Error&&/operation was aborted/i.test(r.message))&&(process.stderr.write(`crtr: Interrupted
10
+ `),process.exit(130)),(r instanceof y||r instanceof f)&&(G(r),process.exit(typeof process.exitCode=="number"?process.exitCode:1));const e=r instanceof Error?r.message:String(r);process.stderr.write(`crtr: ${e}
11
11
  `),process.exit(1)});