@north-light/sdk 0.3.481 → 0.3.482

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.
@@ -13,6 +13,8 @@ export interface RunStartParams {
13
13
  profile?: string;
14
14
  /** The model the run's root agent runs on: a bare strength (`medium`, resolved against the default provider), `family/strength` (`anthropic/medium`), or a concrete registered model id. Absent uses the run kind's default. Applies to the root only; its child nodes choose their own. An unknown or unregistered value is refused (`invalid_request`, `param: model`). */
15
15
  model?: string;
16
+ /** Wall-clock limit on the run, measured from start: one or more `<int>[smhd]` parts (`10m`, `1h30m`), at most `24h`. When it passes the run settles with outcome `deadline_exceeded` (`runs.get`'s `outcome.reason`) and its agent is stopped. Absent sets no limit. A malformed, zero or over-24h value is refused (`invalid_request`, `param: deadline`). */
17
+ deadline?: string;
16
18
  /** A JSON Schema, or an object with `toJSONSchema()` (a Zod v4 object), the run's result must satisfy.
17
19
  * Sent as a JSON object; the daemon refuses one that is not an object or is over 256 KB serialized
18
20
  * (`invalid_request`, `param: output_schema`), which is raised without a resend. The SDK does not
@@ -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.481"
5
+ sdk-version: "0.3.482"
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.481`. 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.482`. 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
 
@@ -827,17 +827,29 @@ export class FakeCloud {
827
827
  for (const field of ['mode', 'parent', 'fork_from', 'node_id', 'env', 'tools', 'system_prompt'])
828
828
  if (params[field] !== undefined)
829
829
  throw refuse(403, 'owner_only', `${field} is owner-only`, { param: field });
830
- for (const field of ['payer', 'model_policy', 'deadline', 'kind'])
830
+ for (const field of ['payer', 'model_policy', 'kind'])
831
831
  if (params[field] !== undefined)
832
832
  throw invalid(`${field} is not available`, field);
833
833
  for (const field of Object.keys(params))
834
- if (!['prompt', 'scopes', 'metadata', 'profile', 'isolated', 'cwd', 'worktree', 'output_schema', 'message', 'model'].includes(field))
834
+ if (!['prompt', 'scopes', 'metadata', 'profile', 'isolated', 'cwd', 'worktree', 'output_schema', 'message', 'model', 'deadline'].includes(field))
835
835
  throw invalid(`unknown field ${field}`, field);
836
836
  if (params['model'] !== undefined && (typeof params['model'] !== 'string' || !params['model'].trim()))
837
837
  throw invalid('model must be a non-empty string', 'model');
838
838
  // The fake has no model registry, so it checks only the shape the real server also refuses: a strength, a family/strength, or a provider/model id.
839
839
  if (typeof params['model'] === 'string' && !/^(ultra|strong|medium|light|normal|weak|opus|sonnet|haiku|[^/\s]+\/[^\s]+)$/.test(params['model']))
840
840
  throw invalid(`model '${params['model']}' is not a strength, a family/strength, or a provider/model id`, 'model');
841
+ // Same grammar and 24h ceiling as the daemon: `<int>[smhd]` parts, summed, greater than zero.
842
+ if (params['deadline'] !== undefined) {
843
+ const deadline = params['deadline'];
844
+ const ms = typeof deadline === 'string' && /^\+?(?:\d+[smhd])+$/.test(deadline)
845
+ ? [...deadline.matchAll(/(\d+)([smhd])/g)].reduce((sum, [, n, unit]) => sum + Number(n) * { s: 1_000, m: 60_000, h: 3_600_000, d: 86_400_000 }[unit], 0) : null;
846
+ if (ms === null || !Number.isSafeInteger(ms))
847
+ throw invalid(`deadline '${String(deadline)}' is not a duration; use one or more <int>[smhd] parts such as 10m or 1h30m`, 'deadline');
848
+ if (ms <= 0)
849
+ throw invalid('deadline must be greater than zero', 'deadline');
850
+ if (ms > 24 * 3_600_000)
851
+ throw invalid('deadline must be at most 24h', 'deadline');
852
+ }
841
853
  if (params['profile'] !== undefined && (typeof params['profile'] !== 'string' || !params['profile']))
842
854
  throw invalid('profile must be a profile id', 'profile');
843
855
  if (params['isolated'] !== undefined && typeof params['isolated'] !== 'boolean')
@@ -870,6 +882,7 @@ export class FakeCloud {
870
882
  const message = params['message'];
871
883
  const hash = sha256Hex(JSON.stringify({
872
884
  prompt: params['prompt'], scopes, metadata, profile: params['profile'], isolated: params['isolated'], cwd: params['cwd'], ...(params['model'] === undefined ? {} : { model: params['model'] }),
885
+ ...(params['deadline'] === undefined ? {} : { deadline: params['deadline'] }),
873
886
  ...(outputSchema === undefined ? {} : { output_schema: outputSchema }), ...(message === undefined ? {} : { message }),
874
887
  }));
875
888
  if (key !== null) {
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.481";
2
+ export declare const SDK_VERSION = "0.3.482";
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.481';
3
+ export const SDK_VERSION = '0.3.482';
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.481",
4
- "crouterContract": "1.7",
3
+ "version": "0.3.482",
4
+ "crouterContract": "1.8",
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.481",
48
- "@north-light/identity": "0.3.481",
47
+ "@north-light/api": "0.3.482",
48
+ "@north-light/identity": "0.3.482",
49
49
  "jose": "^6.2.1"
50
50
  },
51
51
  "peerDependencies": {