@north-light/cli 0.3.782 → 0.3.783

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 (45) hide show
  1. package/dist/api/contract.d.ts +1 -1
  2. package/dist/api/contract.js +1 -1
  3. package/dist/api/dto/charges.d.ts +3 -3
  4. package/dist/api/dto/charges.js +1 -1
  5. package/dist/builtin-memory/crouter-sdk/release-notes.md +6 -0
  6. package/dist/builtin-memory/internal/marketplaces.md +1 -1
  7. package/dist/builtin-memory/internal/storage-tiers.md +1 -1
  8. package/dist/cli.js +2 -8
  9. package/dist/clients/attach/viewer.js +526 -526
  10. package/dist/commands/pkg/account-installs.d.ts +9 -0
  11. package/dist/commands/pkg/account-installs.js +1 -0
  12. package/dist/commands/sys/setup-core.d.ts +1 -52
  13. package/dist/commands/sys/setup-core.js +6 -6
  14. package/dist/commands/sys/setup-wizard.d.ts +4 -9
  15. package/dist/commands/sys/setup-wizard.js +2 -1
  16. package/dist/commands/sys/setup.js +1 -1
  17. package/dist/commands/sys/signin.js +6 -3
  18. package/dist/core/grants/sync.js +1 -1
  19. package/dist/core/ledger/check.d.ts +6 -2
  20. package/dist/core/ledger/check.js +1 -1
  21. package/dist/core/llm/run.js +2 -2
  22. package/dist/core/runtime/first-run-offer.d.ts +2 -6
  23. package/dist/core/runtime/first-run-offer.js +2 -10
  24. package/dist/core/runtime/front-door.js +8 -9
  25. package/dist/core/runtime/start-refusal-notice.d.ts +5 -0
  26. package/dist/core/runtime/start-refusal-notice.js +1 -0
  27. package/dist/core/scoped-state/seed-terminal-defaults.d.ts +2 -0
  28. package/dist/core/scoped-state/seed-terminal-defaults.js +1 -0
  29. package/dist/daemon/cron-run.js +2 -2
  30. package/dist/daemon/fleet.js +5 -5
  31. package/dist/daemon/reconcilers/node-lifecycle/freeze-lane.js +1 -1
  32. package/docs/sdk/release-notes.md +6 -0
  33. package/package.json +3 -3
  34. package/packages/crouter-api/dist/api/contract.js +1 -1
  35. package/packages/crouter-api/dist/api/dto/charges.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
  40. package/dist/commands/sys/panels/plugin-env-panel.d.ts +0 -19
  41. package/dist/commands/sys/panels/plugin-env-panel.js +0 -2
  42. package/dist/commands/sys/panels/plugins-panel.d.ts +0 -16
  43. package/dist/commands/sys/panels/plugins-panel.js +0 -1
  44. package/dist/core/runtime/front-door-login.d.ts +0 -2
  45. package/dist/core/runtime/front-door-login.js +0 -1
@@ -1,5 +1,5 @@
1
1
  /** The contract level this build serves and requires. Written by `scripts/contract.mjs release`; never edit by hand. */
2
- export declare const CONTRACT_LEVEL = "1.85";
2
+ export declare const CONTRACT_LEVEL = "1.86";
3
3
  /** Request header naming the one contract level the caller needs, e.g. `1.3`. Optional: absent means no check. */
4
4
  export declare const REQUIRED_CONTRACT_HEADER = "Crouter-Required-Contract";
5
5
  /** Response header listing the contract levels the server serves, comma-separated, one per major, e.g. `1.3`. */
@@ -1 +1 @@
1
- var c=Object.defineProperty;var e=(r,t)=>c(r,"name",{value:t,configurable:!0});const f="1.85",i="Crouter-Required-Contract",p="Crouter-Contract";function l(r){const t=/^(\d+)\.(\d+)$/.exec(r.trim());return t===null?null:{major:Number(t[1]),minor:Number(t[2])}}e(l,"parseContractLevel");function a(r){return r==null?[]:r.split(",").map(t=>l(t)).filter(t=>t!==null)}e(a,"parseServedContracts");function s(r,t){const n=l(r);return n===null?!1:(typeof t=="string"||t===null||t===void 0?a(t):t).some(u=>u.major===n.major&&u.minor>=n.minor)}e(s,"contractSatisfies");function C(r,t,n={}){if(r===void 0)return null;if(l(r)===null)return{status:400,code:"invalid_request",param:i,message:`${i} must be a contract level like 1.0.`};if(s(r,t))return null;const o=r.trim();return{status:426,code:"runtime_version_unsupported",message:t===null||a(t).length===0?`The runtime did not name its contract level; the caller requires contract ${o} or later. Roll the runtime forward.`:`The runtime serves contract ${t}; the caller requires contract ${o} or later within the same major. Roll the runtime forward, or pin an SDK whose crouterContract the runtime serves.`,details:{sdk_version:(n.legacyMinimum??"").trim(),runtime_version:n.runtimeVersion??null,required_contract:o,runtime_contract:t}}}e(C,"contractRefusal");export{p as CONTRACT_HEADER,f as CONTRACT_LEVEL,i as REQUIRED_CONTRACT_HEADER,C as contractRefusal,s as contractSatisfies,l as parseContractLevel,a as parseServedContracts};
1
+ var c=Object.defineProperty;var e=(r,t)=>c(r,"name",{value:t,configurable:!0});const f="1.86",i="Crouter-Required-Contract",p="Crouter-Contract";function l(r){const t=/^(\d+)\.(\d+)$/.exec(r.trim());return t===null?null:{major:Number(t[1]),minor:Number(t[2])}}e(l,"parseContractLevel");function a(r){return r==null?[]:r.split(",").map(t=>l(t)).filter(t=>t!==null)}e(a,"parseServedContracts");function s(r,t){const n=l(r);return n===null?!1:(typeof t=="string"||t===null||t===void 0?a(t):t).some(u=>u.major===n.major&&u.minor>=n.minor)}e(s,"contractSatisfies");function C(r,t,n={}){if(r===void 0)return null;if(l(r)===null)return{status:400,code:"invalid_request",param:i,message:`${i} must be a contract level like 1.0.`};if(s(r,t))return null;const o=r.trim();return{status:426,code:"runtime_version_unsupported",message:t===null||a(t).length===0?`The runtime did not name its contract level; the caller requires contract ${o} or later. Roll the runtime forward.`:`The runtime serves contract ${t}; the caller requires contract ${o} or later within the same major. Roll the runtime forward, or pin an SDK whose crouterContract the runtime serves.`,details:{sdk_version:(n.legacyMinimum??"").trim(),runtime_version:n.runtimeVersion??null,required_contract:o,runtime_contract:t}}}e(C,"contractRefusal");export{p as CONTRACT_HEADER,f as CONTRACT_LEVEL,i as REQUIRED_CONTRACT_HEADER,C as contractRefusal,s as contractSatisfies,l as parseContractLevel,a as parseServedContracts};
@@ -110,9 +110,9 @@ export interface SpendLimitRemovedDTO {
110
110
  removed: true;
111
111
  }
112
112
  /** Why a call was refused for payment. `reason` is what an app branches on; never the message text. */
113
- export declare const PAYMENT_REFUSAL_REASONS: readonly ["trial_ended", "card_required", "card_limit", "nothing_left", "app_limit", "team_limit", "app_unpaid", "account_held"];
113
+ export declare const PAYMENT_REFUSAL_REASONS: readonly ["trial_ended", "card_required", "card_limit", "nothing_left", "app_limit", "team_limit", "app_unpaid", "account_held", "operator_stop", "person_limit"];
114
114
  export type PaymentRefusalReasonDTO = typeof PAYMENT_REFUSAL_REASONS[number];
115
- /** The structured refusal carried at `error.details.payment` of a `402 payment_refused`, a `402 cap_exhausted` (`app_limit`) and a `429 all_routes_exhausted` (`nothing_left`). */
115
+ /** The structured refusal carried at `error.details.payment` of a `402 payment_refused`, a `402 cap_exhausted` (every limit) and a `429 all_routes_exhausted` (`nothing_left`). */
116
116
  export interface PaymentRefusalDTO {
117
117
  reason: PaymentRefusalReasonDTO;
118
118
  /** Plain English for the person. */
@@ -124,7 +124,7 @@ export interface PaymentRefusalDTO {
124
124
  }
125
125
  /** The `details` of a `402 cap_exhausted` refusal. */
126
126
  export interface CapExhaustedDetails {
127
- /** Present on a refusal by an app's monthly cap (`reason: 'app_limit'`). */
127
+ /** Present on every limit refusal. */
128
128
  payment?: PaymentRefusalDTO;
129
129
  limit: {
130
130
  id: string;
@@ -1 +1 @@
1
- const i=["trial_ended","card_required","card_limit","nothing_left","app_limit","team_limit","app_unpaid","account_held"];export{i as PAYMENT_REFUSAL_REASONS};
1
+ const t=["trial_ended","card_required","card_limit","nothing_left","app_limit","team_limit","app_unpaid","account_held","operator_stop","person_limit"];export{t as PAYMENT_REFUSAL_REASONS};
@@ -9,6 +9,12 @@ when-and-why-to-read: When you need Release notes, this knowledge should be read
9
9
 
10
10
  Changes to `@north-light/sdk` that can change what an existing app sees. Newest first.
11
11
 
12
+ ## 0.3.783
13
+
14
+ ### Every limit refusal carries `details.payment`
15
+
16
+ A `402 cap_exhausted` now always has `details.payment = { reason, message, pay_url, reset_at }`, whatever limit refused: `app_limit` (link to the app's page on the account site), `card_limit` (billing limit), `card_required`, `operator_stop`, and the new `person_limit` (a limit set with `crtr sys spend`; no link). `message` is the sentence to show the person and is also the error's top-level message. `PAYMENT_REFUSAL_REASONS` gains `operator_stop` and `person_limit`; treat an unknown reason as a sentence with no button. The `nothing_left` link is now `<directory>/account/pay`.
17
+
12
18
  ## 0.3.781
13
19
 
14
20
  `sourcing.read` and `SOURCING_RUN_RULE`. Additive: no request or response an existing app sends or reads changes.
@@ -141,7 +141,7 @@ A marketplace itself registers per-scope:
141
141
 
142
142
  | Scope | Path | Use case |
143
143
  |---|---|---|
144
- | user | `~/.crouter/marketplaces/<name>/` | Private to your machine — your personal subscriptions |
144
+ | user | `~/.crouter/marketplaces/<name>/` | Your account's marketplaces, cloned on this computer; the list itself is the account's terminal-app install block |
145
145
  | project | `<project>/.crouter/marketplaces/<name>/` | Checked into the repo — anyone cloning gets the same marketplace pinned |
146
146
 
147
147
  `crtr pkg market add <git-url> --scope user` is the default. Use `--scope project` when the marketplace is integral to how the repo expects to be developed.
@@ -36,7 +36,7 @@ The layout root is `~/.crouter` on macOS and `/` on Linux (a container or sandbo
36
36
  - `nodes/<node_id>/job/` — `log.jsonl` (the broker's event stream), `broker.log` (raw stdout/stderr), `telemetry.json` and `fault` (current state, not history). `nodes/<node_id>/messages/` holds inbox bodies too long to inline, written for the broker to read.
37
37
  - The node's run folder — `nodes/<node_id>/run/` on macOS, `/run/crtr/nodes/<node_id>/` on Linux — holds `view.sock`, `cli.sock`, `broker-launch.json`, `scopes.json`, `situational-context.md` and per-run `job/` state. It is rebuilt each launch.
38
38
  - `requests/<id>/` — a human request's page revisions (`revisions/<rev>/page.json`, `page.tsx`, `page.js`) and `action.json`, the action binding frozen at creation; `reviews/<id>/` — document review results. A cloud role keeps the same files under the blob prefix `requests/<id>`. A request is not owned by a node: settlement, outcome and the delivery schedule are database rows.
39
- - `plugins/` and `marketplaces/` — user-scope plugin and marketplace checkouts. `repo-sync/<repo>/` — the bare git mirror of a repo object's `refs/crtr/docs`. `bin-shims/<address>/` — symlink shims for bare-binary contributions, prepended to every broker child's PATH and re-derived on demand.
39
+ - `plugins/` and `marketplaces/` — this Mac's on-disk copy of the plugins and marketplaces in the account's terminal-app install block (`app:terminal`). The account is the record; sign-in, `crtr sys setup` and the machine daemon install whatever the block lists and the disk lacks. A new account's block starts with the official marketplace and `capture`. `repo-sync/<repo>/` — the bare git mirror of a repo object's `refs/crtr/docs`. `bin-shims/<address>/` — symlink shims for bare-binary contributions, prepended to every broker child's PATH and re-derived on demand.
40
40
  - `scope/` — the user scope root (`userScopeRoot()`): local files with no database home, such as `feedback/`, `support/<reference>/` (prepared support bundles, zero-egress until submitted), `prompt-reviews/`, viewer pins and completion history. A `config.json` there is legacy: user-scope settings are database rows, read and written through `crtr sys config` and `crtr profile`.
41
41
  - `crtrd.log` (the daemon's event stream), `crtrd.err` (raw residue), `generations/` and `selected` (sealed install generations — install machinery, not storage).
42
42
  - The API socket `api.sock` is here on macOS and in `/run/crtr` on Linux.
package/dist/cli.js CHANGED
@@ -1,10 +1,4 @@
1
1
  #!/usr/bin/env node
2
- var R=Object.defineProperty;var n=(r,o)=>R(r,"name",{value:o,configurable:!0});import"./suppress-experimental-warnings.js";import{mkdirSync as _,openSync as I,readFileSync as b,renameSync as E,rmSync as C,statSync as u,writeFileSync as k}from"node:fs";import{dirname as g,join as s}from"node:path";import{enableCompileCache as O}from"node:module";import{fileURLToPath as h}from"node:url";import{isDaemonControlInvocation as m,isJoinInvocation as A,isPkgInstallInvocation as $,isSignInInvocation as N,personOnlyInvocation as P,resolveDaemonControlRoot as x,resolveRoot as T}from"./build-root.js";import{maybeBootRoot as F}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 L}from"./core/command-plugins/revalidate.js";import{runCli as M}from"./core/command.js";import{dispatchWithStaleRecovery as J}from"./core/manifest-recovery.js";import{installStdoutErrorPolicy as K}from"./core/stdout-errors.js";import{handle as V}from"./core/io.js";import{CrtrError as w,ownerOnly as G}from"./core/errors.js";import{runtimeRoot as W}from"./core/layout.js";import{ApiError as v}from"./api/index.js";import{mark as i}from"./core/timing.js";import{launchSnapshotFile as q,providerProjectionOverBrokerRelay as y,sandboxCliNodeId as z}from"./shared/env.js";import{nodeRunDir as f}from"./core/canvas/paths.js";import{installBrokerConfigSnapshot as H}from"./core/config.js";I(h(import.meta.url),"r"),K(),i("cli.entry",{cmd:process.argv[2]??"(bare)"});try{O()}catch{}i("cli.compile_cache");const Q=s(g(h(import.meta.url)),".."),l=s(W(),"first-run.json");function a(r){return(r instanceof Error?r.message:String(r)).split(/\r?\n/,1)[0]??""}n(a,"errorMessage");function X(r){const o=g(l);_(o,{recursive:!0});const t=`${l}.${process.pid}.${Date.now()}.tmp`;try{k(t,JSON.stringify({packageVersion:r,completedAt:new Date().toISOString()})+`
3
- `,"utf8"),E(t,l)}finally{C(t,{force:!0})}}n(X,"writeFirstRunMarker");async function Y(){if(process.env.CRTR_NO_AUTO_INIT==="1")return;try{if(u(l,{throwIfNoEntry:!1})!==void 0)return}catch(o){process.stderr.write(`crtr: first-run reconcile marker check failed: ${a(o)}
4
- `);return}try{if(u(s(Q,".git"),{throwIfNoEntry:!1})!==void 0)return}catch(o){process.stderr.write(`crtr: first-run reconcile source check failed: ${a(o)}
5
- `);return}let r;try{const{reconcileFirstRun:o}=await import("./commands/sys/setup-core.js");r=await o((t,c)=>{process.stderr.write(`crtr: first-run reconcile ${t} failed: ${a(c)}
6
- `)})}catch(o){process.stderr.write(`crtr: first-run reconcile failed: ${a(o)}
7
- `)}finally{if(r!==void 0)try{X(r)}catch(o){process.stderr.write(`crtr: first-run reconcile marker failed: ${a(o)}
8
- `)}}}n(Y,"maybeReconcileFirstRun");async function Z(){const r=z(),o=r!==void 0;if(r!==void 0){process.env.CRTR_API_SOCKET=s(f(r),"cli.sock");const e=P(process.argv);if(e!==null)throw G(`crtr ${e} is not available to an app's node`,"Run this command from the person's terminal.");const p=JSON.parse(b(q(f(r))??s(f(r),"broker-launch.json"),"utf8"));if(!p.configSnapshot)throw new Error("node launch is missing its config snapshot");H(p.configSnapshot)}const t=n(async()=>(await import("./core/scoped-state/person-store.js")).installPreludeSnapshot({profiles:[],defaults:{},settings:{},state:{},apps:{}}),"installEmptySettings");if(!o&&(await import("./commands/api-client.js")).usesRunToken())await t();else if(!o&&!y()&&(await import("./daemon/machine-link/config.js")).computerIsNotSignedIn()&&!m(process.argv))await t();else if((!o||$(process.argv))&&!m(process.argv)&&!A(process.argv)&&!N(process.argv)){try{o||await(await import("./commands/daemon-generation.js")).assertLocalDaemonMatchesCli(),await(await import("./commands/person-settings.js")).loadPersonSettingsViaApi(),o||await(await import("./core/scoped-state/imported-mac-installs.js")).migrateLegacyInstallsOnce()}catch(e){const p=process.argv.slice(2).some(d=>d==="-h"||d==="--help"),S=e instanceof v&&(e.code==="daemon_unavailable"||e.code==="northlight_unreachable")||e instanceof w&&(e.code==="daemon_generation_mismatch"||e.code==="not_signed_in"||e.code==="northlight_unreachable");if(!(p&&S))throw e;await t()}i("cli.settings_loaded")}if(o||(B(process.argv),y()||await Y()),await F(process.argv),i("cli.front_door_passed"),m(process.argv)){await M(await x(),process.argv);return}o||await L(process.argv),i("cli.plugins_revalidated");const c=await T(process.argv[2]);i("cli.root_resolved"),o||(U(c,process.argv),await j(process.argv),await D(process.argv)),i("cli.dispatch_start"),await J(c,process.argv),i("cli.dispatch_done")}n(Z,"main"),Z().catch(r=>{(r instanceof Error&&r.name==="AbortError"||r instanceof Error&&/operation was aborted/i.test(r.message))&&(process.stderr.write(`crtr: Interrupted
9
- `),process.exit(130)),(r instanceof v||r instanceof w)&&(V(r),process.exit(typeof process.exitCode=="number"?process.exitCode:1));const t=r instanceof Error?r.message:String(r);process.stderr.write(`crtr: ${t}
2
+ var v=Object.defineProperty;var s=(o,r)=>v(o,"name",{value:r,configurable:!0});import"./suppress-experimental-warnings.js";import{openSync as u,readFileSync as w}from"node:fs";import{dirname as y,join as n}from"node:path";import{enableCompileCache as b}from"node:module";import{fileURLToPath as f}from"node:url";import{isDaemonControlInvocation as c,isJoinInvocation as S,isPkgInstallInvocation as _,isSignInInvocation as C,personOnlyInvocation as E,resolveDaemonControlRoot as I,resolveRoot as R}from"./build-root.js";import{maybeBootRoot as P}from"./core/runtime/front-door.js";import{maybeAutoUpdate as x}from"./core/auto-update.js";import{ensureProjectScope as A}from"./core/bootstrap.js";import{provisionExports as O,pruneLegacyExports as k}from"./core/host-exports/export.js";import{revalidateBundlePlugins as T}from"./core/command-plugins/revalidate.js";import{runCli as j}from"./core/command.js";import{dispatchWithStaleRecovery as B}from"./core/manifest-recovery.js";import{installStdoutErrorPolicy as D}from"./core/stdout-errors.js";import{handle as L}from"./core/io.js";import{CrtrError as d,ownerOnly as N}from"./core/errors.js";import{ApiError as g}from"./api/index.js";import{mark as i}from"./core/timing.js";import{launchSnapshotFile as U,providerProjectionOverBrokerRelay as F,sandboxCliNodeId as J}from"./shared/env.js";import{nodeRunDir as p}from"./core/canvas/paths.js";import{installBrokerConfigSnapshot as K}from"./core/config.js";u(f(import.meta.url),"r"),D(),i("cli.entry",{cmd:process.argv[2]??"(bare)"});try{b()}catch{}i("cli.compile_cache");const lo=n(y(f(import.meta.url)),"..");function fo(o){return(o instanceof Error?o.message:String(o)).split(/\r?\n/,1)[0]??""}s(fo,"errorMessage");async function M(){const o=J(),r=o!==void 0;if(o!==void 0){process.env.CRTR_API_SOCKET=n(p(o),"cli.sock");const t=E(process.argv);if(t!==null)throw N(`crtr ${t} is not available to an app's node`,"Run this command from the person's terminal.");const a=JSON.parse(w(U(p(o))??n(p(o),"broker-launch.json"),"utf8"));if(!a.configSnapshot)throw new Error("node launch is missing its config snapshot");K(a.configSnapshot)}const e=s(async()=>(await import("./core/scoped-state/person-store.js")).installPreludeSnapshot({profiles:[],defaults:{},settings:{},state:{},apps:{}}),"installEmptySettings");if(!r&&(await import("./commands/api-client.js")).usesRunToken())await e();else if(!r&&!F()&&(await import("./daemon/machine-link/config.js")).computerIsNotSignedIn()&&!c(process.argv))await e();else if((!r||_(process.argv))&&!c(process.argv)&&!S(process.argv)&&!C(process.argv)){try{r||await(await import("./commands/daemon-generation.js")).assertLocalDaemonMatchesCli(),await(await import("./commands/person-settings.js")).loadPersonSettingsViaApi(),r||await(await import("./core/scoped-state/imported-mac-installs.js")).migrateLegacyInstallsOnce()}catch(t){const a=process.argv.slice(2).some(l=>l==="-h"||l==="--help"),h=t instanceof g&&(t.code==="daemon_unavailable"||t.code==="northlight_unreachable")||t instanceof d&&(t.code==="daemon_generation_mismatch"||t.code==="not_signed_in"||t.code==="northlight_unreachable");if(!(a&&h))throw t;await e()}i("cli.settings_loaded")}if(r||k(process.argv),await P(process.argv),i("cli.front_door_passed"),c(process.argv)){await j(await I(),process.argv);return}r||await T(process.argv),i("cli.plugins_revalidated");const m=await R(process.argv[2]);i("cli.root_resolved"),r||(O(m,process.argv),await A(process.argv),await x(process.argv)),i("cli.dispatch_start"),await B(m,process.argv),i("cli.dispatch_done")}s(M,"main"),M().catch(o=>{(o instanceof Error&&o.name==="AbortError"||o instanceof Error&&/operation was aborted/i.test(o.message))&&(process.stderr.write(`crtr: Interrupted
3
+ `),process.exit(130)),(o instanceof g||o instanceof d)&&(L(o),process.exit(typeof process.exitCode=="number"?process.exitCode:1));const e=o instanceof Error?o.message:String(o);process.stderr.write(`crtr: ${e}
10
4
  `),process.exit(1)});