@north-light/sdk 0.3.519 → 0.3.521

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.
@@ -57,6 +57,7 @@ const packageJson = () => `${JSON.stringify({
57
57
  allowScripts: { esbuild: false },
58
58
  }, null, 2)}\n`;
59
59
  const ENV_TEXT = `CROUTER_ISSUER=${DEFAULT_ISSUER}\nAPP_ORIGIN=${DEFAULT_ORIGIN}\nCROUTER_CLIENT_ID=\nCROUTER_KEY_FILE=${KEY_FILE}\n`;
60
+ const PROVIDER_REGISTRY = `@northlight-providers:registry=${DEFAULT_ISSUER}/npm/`;
60
61
  const exists = (path) => stat(path).then(() => true, () => false);
61
62
  /** Writes `text` to a file that must not exist yet. */
62
63
  async function createFile(path, text, mode = 0o644) {
@@ -88,6 +89,23 @@ async function ensureLocalIgnored(root) {
88
89
  await appendFile(path, `${current === '' || current.endsWith('\n') ? '' : '\n'}local/\n`);
89
90
  return 'added';
90
91
  }
92
+ /** Creates the project registry config or adds its scope line without changing existing settings. */
93
+ async function ensureProviderRegistry(root) {
94
+ const path = join(root, '.npmrc');
95
+ const current = await readFile(path, 'utf8').catch((error) => {
96
+ if (error.code === 'ENOENT')
97
+ return undefined;
98
+ throw error;
99
+ });
100
+ if (current === undefined) {
101
+ await createFile(path, `${PROVIDER_REGISTRY}\n`);
102
+ return 'created';
103
+ }
104
+ if (current.split(/\r?\n/).some((line) => /^\s*@northlight-providers:registry\s*=/.test(line)))
105
+ return 'present';
106
+ await appendFile(path, `${current === '' || current.endsWith('\n') ? '' : '\n'}${PROVIDER_REGISTRY}\n`);
107
+ return 'added';
108
+ }
91
109
  /** Runs `npm i --save-exact @north-light/sdk@<this version>` in `cwd` (no shell). */
92
110
  function installSdk(cwd) {
93
111
  const result = spawnSync('npm', ['i', '--save-exact', `@north-light/sdk@${SDK_VERSION}`], { cwd, stdio: ['ignore', 2, 2] });
@@ -185,6 +203,7 @@ export async function runInit(argv, options = {}) {
185
203
  }
186
204
  // Before the key exists, so a key is never on disk in a directory git would pick up. A new app's scaffold already wrote it.
187
205
  const ignored = existingProject ? await ensureLocalIgnored(root) : 'present';
206
+ const registry = await ensureProviderRegistry(root);
188
207
  let publicJwk;
189
208
  if (!(await exists(keyPath)))
190
209
  publicJwk = JSON.stringify((await createKeyFile(keyPath)).publicJwk);
@@ -197,6 +216,7 @@ export async function runInit(argv, options = {}) {
197
216
  existingProject ? `Added @north-light/sdk@${SDK_VERSION}, a signing key and the \`northlight\` skill to ${shown(root)}.` : `Created a Northlight app in ${shown(root)}:`,
198
217
  ...(existingProject ? [] : [' package.json server.ts .gitignore local/app.env', '']),
199
218
  ...(ignored === 'present' ? [] : [`${ignored === 'created' ? 'Created' : 'Updated'} ${shown(join(root, '.gitignore'))} so git ignores local/.`]),
219
+ `${registry === 'created' ? 'Created' : registry === 'added' ? 'Updated' : 'Kept'} ${shown(join(root, '.npmrc'))}${registry === 'present' ? ' with its existing @northlight-providers registry setting.' : ` with ${PROVIDER_REGISTRY}.`}`,
200
220
  `Private key: ${shown(keyPath)} (mode 0600, ignored by git). Never paste or commit it.`,
201
221
  'Skill:',
202
222
  ...skillPaths.map((path) => ` ${globalSkill ? path : shown(path)}`),
@@ -2,7 +2,7 @@
2
2
  name: northlight
3
3
  description: "Use when building, debugging or shipping an app that signs people in with Northlight, starts runs on their Northlight runtime, or calls Northlight providers (sms, search, integrations, context, device) with @north-light/sdk."
4
4
  metadata:
5
- sdk-version: "0.3.519"
5
+ sdk-version: "0.3.521"
6
6
  ---
7
7
 
8
8
  # Building a Northlight app
@@ -11,7 +11,7 @@ An app on Northlight signs people in with their Northlight account, then starts
11
11
 
12
12
  ## First: check this skill matches the SDK
13
13
 
14
- This skill is for SDK version `0.3.519`. If the project has `node_modules/@north-light/sdk/package.json`, compare its `version` with that number. If they differ, run `npx @north-light/sdk skill` in the project, then read the rewritten `.agents/skills/northlight/SKILL.md` (or `.claude/skills/northlight/SKILL.md`) instead of this copy. That command needs no account and no crtr. A project that has no SDK yet starts with `npx @north-light/sdk@latest init <dir>`.
14
+ This skill is for SDK version `0.3.521`. If the project has `node_modules/@north-light/sdk/package.json`, compare its `version` with that number. If they differ, run `npx @north-light/sdk skill` in the project, then read the rewritten `.agents/skills/northlight/SKILL.md` (or `.claude/skills/northlight/SKILL.md`) instead of this copy. That command needs no account and no crtr. A project that has no SDK yet starts with `npx @north-light/sdk@latest init <dir>`.
15
15
 
16
16
  ## Where things run
17
17
 
package/dist/version.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /** This SDK's release version. Informational only: compatibility is the contract level, not this number. */
2
- export declare const SDK_VERSION = "0.3.519";
2
+ export declare const SDK_VERSION = "0.3.521";
3
3
  /** The release sent in `Crouter-Minimum-Runtime-Version` on every request. It is frozen, so a runtime from before the
4
4
  * contract level existed (which only knows this header) refuses this SDK, while every later runtime accepts it. */
5
5
  export declare const LEGACY_FLOOR = "0.3.423";
package/dist/version.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // SDK_VERSION is written by scripts/release-version.mjs on every release; do not edit by hand.
2
2
  /** This SDK's release version. Informational only: compatibility is the contract level, not this number. */
3
- export const SDK_VERSION = '0.3.519';
3
+ export const SDK_VERSION = '0.3.521';
4
4
  // LEGACY_FLOOR is written once by `scripts/contract.mjs release`, at the first release that carries the contract level
5
5
  // (the `0.0.0` placeholder is replaced there and never again); do not edit by hand.
6
6
  /** The release sent in `Crouter-Minimum-Runtime-Version` on every request. It is frozen, so a runtime from before the
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@north-light/sdk",
3
- "version": "0.3.519",
4
- "crouterContract": "1.24",
3
+ "version": "0.3.521",
4
+ "crouterContract": "1.25",
5
5
  "description": "Typed Node and browser client for running crouter agents through the crtrd /v1 API.",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
@@ -44,8 +44,8 @@
44
44
  "prepublishOnly": "node -e \"if (process.env.npm_config_tag !== 'next') { console.error('@north-light/sdk publishes only with --tag next; scripts/promote-sdk.mjs is the only mover of latest.'); process.exit(1); }\""
45
45
  },
46
46
  "dependencies": {
47
- "@north-light/api": "0.3.519",
48
- "@north-light/identity": "0.3.519",
47
+ "@north-light/api": "0.3.521",
48
+ "@north-light/identity": "0.3.521",
49
49
  "jose": "^6.2.1"
50
50
  },
51
51
  "peerDependencies": {