@north-light/cli 0.3.720 → 0.3.722

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 (60) hide show
  1. package/dist/api/contract.d.ts +1 -1
  2. package/dist/api/contract.js +1 -1
  3. package/dist/api/dto/recovery.d.ts +2 -0
  4. package/dist/builtin-memory/crouter-sdk/release-notes.md +6 -0
  5. package/dist/cli.js +8 -8
  6. package/dist/clients/attach/viewer.js +314 -314
  7. package/dist/commands/api-client.d.ts +2 -0
  8. package/dist/commands/api-client.js +2 -2
  9. package/dist/commands/node/inspect.js +7 -7
  10. package/dist/commands/profile/environment.js +2 -2
  11. package/dist/core/canvas/schema-pg/031-environment-pull-request-write-default.sql +2 -0
  12. package/dist/core/canvas/schema-pg/032-model-cooldown-vendor-limit.sql +4 -0
  13. package/dist/core/canvas/schema-version.d.ts +1 -1
  14. package/dist/core/canvas/schema-version.js +1 -1
  15. package/dist/core/environments.js +1 -1
  16. package/dist/core/graph/reader.js +1 -1
  17. package/dist/core/import/load/open-grants.d.ts +1 -0
  18. package/dist/core/import/load/open-grants.js +1 -0
  19. package/dist/core/import/load/run.d.ts +3 -1
  20. package/dist/core/import/load/run.js +2 -2
  21. package/dist/core/llm/run.js +2 -2
  22. package/dist/core/managed-providers.d.ts +9 -1
  23. package/dist/core/provider-failure.d.ts +2 -0
  24. package/dist/core/provider-failure.js +1 -1
  25. package/dist/core/runtime/broker/model-adapter.js +3 -3
  26. package/dist/core/runtime/revive.d.ts +2 -0
  27. package/dist/core/runtime/revive.js +2 -2
  28. package/dist/core/runtime/runner/blaxel/image-build.d.ts +3 -0
  29. package/dist/core/runtime/runner/blaxel/image-build.js +6 -6
  30. package/dist/core/subscription-state.d.ts +4 -4
  31. package/dist/core/subscription-state.js +1 -1
  32. package/dist/daemon/api/handlers/messages.js +2 -2
  33. package/dist/daemon/api/handlers/nodes.js +1 -1
  34. package/dist/daemon/api/handlers/profiles.js +1 -1
  35. package/dist/daemon/api/operations.js +1 -1
  36. package/dist/daemon/api/router.d.ts +4 -0
  37. package/dist/daemon/api/router.js +1 -1
  38. package/dist/daemon/reconcilers/broker-supervision.js +3 -3
  39. package/docs/sdk/release-notes.md +6 -0
  40. package/package.json +3 -3
  41. package/packages/crouter-api/dist/api/contract.js +1 -1
  42. package/packages/crouter-api/dist/commands/api-client.js +3 -1
  43. package/packages/crouter-api/dist/commands/node/inspect.js +2 -1
  44. package/packages/crouter-api/dist/commands/profile/environment.js +2 -2
  45. package/packages/crouter-api/dist/core/canvas/schema-version.js +1 -1
  46. package/packages/crouter-api/dist/core/environments.js +1 -1
  47. package/packages/crouter-api/dist/core/graph/reader.js +3 -3
  48. package/packages/crouter-api/dist/core/llm/run.js +13 -2
  49. package/packages/crouter-api/dist/core/provider-failure.js +9 -0
  50. package/packages/crouter-api/dist/core/runtime/broker/model-adapter.js +3 -1
  51. package/packages/crouter-api/dist/core/runtime/revive.js +11 -0
  52. package/packages/crouter-api/dist/core/runtime/runner/blaxel/image-build.js +16 -1
  53. package/packages/crouter-api/dist/core/subscription-state.js +26 -10
  54. package/packages/crouter-api/dist/daemon/api/operations.js +2 -2
  55. package/packages/crouter-api/dist/daemon/api/router.js +1 -1
  56. package/packages/crouter-api/dist/daemon/reconcilers/broker-supervision.js +3 -1
  57. package/packages/crouter-api/package.json +1 -1
  58. package/packages/crouter-identity/package.json +1 -1
  59. package/packages/crouter-plugin/package.json +3 -3
  60. package/runtime.lock.json +14 -14
@@ -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.70";
2
+ export declare const CONTRACT_LEVEL = "1.71";
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.70",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.71",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,3 +1,4 @@
1
+ import type { PaymentRefusalDTO } from './charges.js';
1
2
  export type FaultLink = 'pi→provider' | 'viewer↔broker' | 'relay↔broker' | 'viewer↔crtrd' | 'daemon→node' | 'crtr→pi';
2
3
  export type FaultKind = 'rate-limit' | 'overloaded' | 'connection' | 'auth' | 'protocol' | 'context-overflow' | 'other' | 'wedged' | 'model-not-found';
3
4
  export interface FaultRetry {
@@ -28,6 +29,7 @@ export interface FaultProviderError {
28
29
  model?: string;
29
30
  headers: Record<string, string>;
30
31
  };
32
+ payment?: PaymentRefusalDTO;
31
33
  }
32
34
  export interface RecoveryFaultDTO {
33
35
  fault_id: string;
@@ -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.721
13
+
14
+ ### `inferenceEndpoint` serves an app that pays for its own model calls (`billing: 'app'`)
15
+
16
+ An app outside the Northlight team cannot use the directory's `admit-model` and `settle-model` (they answer 403, which the helper reported as 503). Pass `billing: 'app'` and omit `directoryToken` and `settlements`: the helper still verifies the runtime's token (directory keys, issuer, `aud` = `baseURL`, expiry, scope `crtr:llm`), then forwards the Anthropic Messages call to Anthropic with `apiKey` and makes no directory billing call. Northlight records no charge and `sweep` does nothing; usage goes only to `log`. Without `billing`, behavior is unchanged. `directoryToken` and `settlements` become optional in the type; the constructor throws when either is missing and `billing` is not `'app'`.
17
+
12
18
  ## 0.3.708
13
19
 
14
20
  ### Review comments anchor to quoted text (breaking)
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 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
- `);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((e,p)=>{process.stderr.write(`crtr: first-run reconcile ${e} failed: ${c(p)}
2
+ var _=Object.defineProperty;var s=(r,o)=>_(r,"name",{value:o,configurable:!0});import"./suppress-experimental-warnings.js";import{mkdirSync as b,openSync as E,readFileSync as I,renameSync as C,rmSync as O,statSync as h,writeFileSync as k}from"node:fs";import{dirname as w,join as a}from"node:path";import{enableCompileCache as A}from"node:module";import{fileURLToPath as y}from"node:url";import{isDaemonControlInvocation as m,isJoinInvocation as N,isLayoutMigrationInvocation as x,isPkgInstallInvocation as $,isSignInInvocation as P,personOnlyInvocation as T,resolveDaemonControlRoot as F,resolveLayoutMigrationRoot as L,resolveRoot as M}from"./build-root.js";import{maybeBootRoot as D}from"./core/runtime/front-door.js";import{maybeAutoUpdate as j}from"./core/auto-update.js";import{ensureProjectScope as U}from"./core/bootstrap.js";import{provisionExports as B,pruneLegacyExports as K}from"./core/host-exports/export.js";import{revalidateBundlePlugins as J}from"./core/command-plugins/revalidate.js";import{renderNode as V,runCli as v,walk as W}from"./core/command.js";import{dispatchWithStaleRecovery as q}from"./core/manifest-recovery.js";import{installStdoutErrorPolicy as G}from"./core/stdout-errors.js";import{handle as z}from"./core/io.js";import{CrtrError as f,ownerOnly as H}from"./core/errors.js";import{ExitCode as Q}from"./types.js";import{layoutNeedsMigration as X,runtimeRoot as Y}from"./core/layout.js";import{ApiError as R}from"./api/index.js";import{mark as i}from"./core/timing.js";import{launchSnapshotFile as Z,providerProjectionOverBrokerRelay as rr,sandboxCliNodeId as or}from"./shared/env.js";import{nodeRunDir as d}from"./core/canvas/paths.js";import{installBrokerConfigSnapshot as tr}from"./core/config.js";E(y(import.meta.url),"r"),G(),i("cli.entry",{cmd:process.argv[2]??"(bare)"});try{A()}catch{}i("cli.compile_cache");const er=a(w(y(import.meta.url)),".."),l=a(Y(),"first-run.json");function c(r){return(r instanceof Error?r.message:String(r)).split(/\r?\n/,1)[0]??""}s(c,"errorMessage");function ir(r){const o=w(l);b(o,{recursive:!0});const t=`${l}.${process.pid}.${Date.now()}.tmp`;try{k(t,JSON.stringify({packageVersion:r,completedAt:new Date().toISOString()})+`
3
+ `,"utf8"),C(t,l)}finally{O(t,{force:!0})}}s(ir,"writeFirstRunMarker");async function nr(){if(process.env.CRTR_NO_AUTO_INIT==="1")return;try{if(h(l,{throwIfNoEntry:!1})!==void 0)return}catch(o){process.stderr.write(`crtr: first-run reconcile marker check failed: ${c(o)}
4
+ `);return}try{if(h(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)}
6
6
  `)})}catch(o){process.stderr.write(`crtr: first-run reconcile failed: ${c(o)}
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(),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}
7
+ `)}finally{if(r!==void 0)try{ir(r)}catch(o){process.stderr.write(`crtr: first-run reconcile marker failed: ${c(o)}
8
+ `)}}}s(nr,"maybeReconcileFirstRun");async function sr(){const r=x(process.argv),o=or(),t=o!==void 0;if(o!==void 0){process.env.CRTR_API_SOCKET=a(d(o),"cli.sock");const e=T(process.argv);if(e!==null)throw H(`crtr ${e} is not available to an app's node`,"Run this command from the person's terminal.");const n=JSON.parse(I(Z(d(o))??a(d(o),"broker-launch.json"),"utf8"));if(!n.configSnapshot)throw new Error("node launch is missing its config snapshot");tr(n.configSnapshot)}if(!t&&X()&&!m(process.argv)&&!r)throw new f("layout_migration_required","run crtr sys migrate while the runtime is offline",Q.NETWORK,{next:"Run `crtr sys migrate` while the runtime is offline, then restart it."});if(r){const e=await L();if(process.argv.slice(4).some(n=>n==="-h"||n==="--help")){process.stdout.write(V(W(e,["sys","migrate"]).node)+`
9
+ `);return}await v(e,process.argv);return}const p=s(async()=>(await import("./core/scoped-state/person-store.js")).installPreludeSnapshot({profiles:[],defaults:{},settings:{},state:{},apps:{}}),"installEmptySettings");if(!t&&(await import("./commands/api-client.js")).usesRunToken())await p();else if((!t||$(process.argv))&&!m(process.argv)&&!N(process.argv)&&!P(process.argv)){try{t||await(await import("./commands/daemon-generation.js")).assertLocalDaemonMatchesCli(),await(await import("./commands/person-settings.js")).loadPersonSettingsViaApi(),t||await(await import("./core/scoped-state/imported-mac-installs.js")).migrateLegacyInstallsOnce()}catch(e){const n=process.argv.slice(2).some(g=>g==="-h"||g==="--help"),S=e instanceof R&&(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&&S))throw e;await p()}i("cli.settings_loaded")}if(t||(K(process.argv),rr()||await nr()),await D(process.argv),i("cli.front_door_passed"),m(process.argv)){await v(await F(),process.argv);return}t||await J(process.argv),i("cli.plugins_revalidated");const u=await M(process.argv[2]);i("cli.root_resolved"),t||(B(u,process.argv),await U(process.argv),await j(process.argv)),i("cli.dispatch_start"),await q(u,process.argv),i("cli.dispatch_done")}s(sr,"main"),sr().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 R||r instanceof f)&&(z(r),process.exit(typeof process.exitCode=="number"?process.exitCode:1));const t=r instanceof Error?r.message:String(r);process.stderr.write(`crtr: ${t}
11
11
  `),process.exit(1)});