@north-light/sdk 0.3.481 → 0.3.483
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.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/resources/runs.d.ts +2 -0
- package/dist/setup-link.d.ts +7 -0
- package/dist/setup-link.js +10 -0
- package/dist/skill/northlight/SKILL.md +2 -2
- package/dist/testing/cloud.js +16 -2
- package/dist/testing/users.d.ts +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export type { ActivityStep, DescribeTool } from './resources/activity.js';
|
|
|
35
35
|
export { APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, AuthenticationError, BadRequestError, ConflictError, CrouterError, DeadlineExceededError, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, RuntimeVersionError, UnprocessableEntityError, mapError, } from './errors.js';
|
|
36
36
|
export type { DeadlineDetails, RuntimeVersionDetails } from './errors.js';
|
|
37
37
|
export { SDK_VERSION } from './version.js';
|
|
38
|
+
export { setupLink } from './setup-link.js';
|
|
38
39
|
export { sdkErrorCodes } from './error-codes.js';
|
|
39
40
|
export type { SdkErrorCode } from './error-codes.js';
|
|
40
41
|
export type { AuthStatus, AuthStatusParams, CancelParams, EnsureProfileParams, JsonSchema, MessageParams, NodeCreateParams, NodeEventsOptions, NodeOutcomeOptions, OutputSchema, ParsedOutcome, RequestOptions, SchemaOutput, } from './types.js';
|
package/dist/index.js
CHANGED
|
@@ -14,4 +14,5 @@ export { RUN_NOTICE_SCOPE, RunNoticeError, verifyRunNotice } from './resources/r
|
|
|
14
14
|
export { describeToolDefault, followActivity } from './resources/activity.js';
|
|
15
15
|
export { APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, AuthenticationError, BadRequestError, ConflictError, CrouterError, DeadlineExceededError, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, RuntimeVersionError, UnprocessableEntityError, mapError, } from './errors.js';
|
|
16
16
|
export { SDK_VERSION } from './version.js';
|
|
17
|
+
export { setupLink } from './setup-link.js';
|
|
17
18
|
export { sdkErrorCodes } from './error-codes.js';
|
package/dist/resources/runs.d.ts
CHANGED
|
@@ -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
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ProviderDependency } from '@north-light/api';
|
|
2
|
+
/** The link that sends the person to a dependency's setup page and back: `dependency.next` with `return_to` set to
|
|
3
|
+
* `returnTo` (an `https` URL on your app's registered redirect origin), percent-encoded. Any query `next` already
|
|
4
|
+
* carries, such as `client_id`, is kept. Throws when `next` is not an absolute URL or `returnTo` is empty. */
|
|
5
|
+
export declare function setupLink(dependency: Pick<ProviderDependency, 'next'>, options: {
|
|
6
|
+
returnTo: string;
|
|
7
|
+
}): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** The link that sends the person to a dependency's setup page and back: `dependency.next` with `return_to` set to
|
|
2
|
+
* `returnTo` (an `https` URL on your app's registered redirect origin), percent-encoded. Any query `next` already
|
|
3
|
+
* carries, such as `client_id`, is kept. Throws when `next` is not an absolute URL or `returnTo` is empty. */
|
|
4
|
+
export function setupLink(dependency, options) {
|
|
5
|
+
if (!options.returnTo)
|
|
6
|
+
throw new TypeError('setupLink: returnTo is required');
|
|
7
|
+
const url = new URL(dependency.next);
|
|
8
|
+
url.searchParams.set('return_to', options.returnTo);
|
|
9
|
+
return url.href;
|
|
10
|
+
}
|
|
@@ -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.
|
|
5
|
+
sdk-version: "0.3.483"
|
|
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.
|
|
14
|
+
This skill is for SDK version `0.3.483`. 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/testing/cloud.js
CHANGED
|
@@ -245,6 +245,7 @@ export class FakeCloud {
|
|
|
245
245
|
const dependency = {
|
|
246
246
|
state: setupState, ...(options.message === undefined ? {} : { message: options.message }),
|
|
247
247
|
next: options.next ?? `${cloud.issuer}/connect/setup/${provider}?client_id=${cloud.clientId}`,
|
|
248
|
+
...(options.step === undefined ? {} : { step: options.step }),
|
|
248
249
|
};
|
|
249
250
|
state.dependencies = { ...state.dependencies, [provider]: dependency };
|
|
250
251
|
state.wakeHolds();
|
|
@@ -827,17 +828,29 @@ export class FakeCloud {
|
|
|
827
828
|
for (const field of ['mode', 'parent', 'fork_from', 'node_id', 'env', 'tools', 'system_prompt'])
|
|
828
829
|
if (params[field] !== undefined)
|
|
829
830
|
throw refuse(403, 'owner_only', `${field} is owner-only`, { param: field });
|
|
830
|
-
for (const field of ['payer', 'model_policy', '
|
|
831
|
+
for (const field of ['payer', 'model_policy', 'kind'])
|
|
831
832
|
if (params[field] !== undefined)
|
|
832
833
|
throw invalid(`${field} is not available`, field);
|
|
833
834
|
for (const field of Object.keys(params))
|
|
834
|
-
if (!['prompt', 'scopes', 'metadata', 'profile', 'isolated', 'cwd', 'worktree', 'output_schema', 'message', 'model'].includes(field))
|
|
835
|
+
if (!['prompt', 'scopes', 'metadata', 'profile', 'isolated', 'cwd', 'worktree', 'output_schema', 'message', 'model', 'deadline'].includes(field))
|
|
835
836
|
throw invalid(`unknown field ${field}`, field);
|
|
836
837
|
if (params['model'] !== undefined && (typeof params['model'] !== 'string' || !params['model'].trim()))
|
|
837
838
|
throw invalid('model must be a non-empty string', 'model');
|
|
838
839
|
// 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
840
|
if (typeof params['model'] === 'string' && !/^(ultra|strong|medium|light|normal|weak|opus|sonnet|haiku|[^/\s]+\/[^\s]+)$/.test(params['model']))
|
|
840
841
|
throw invalid(`model '${params['model']}' is not a strength, a family/strength, or a provider/model id`, 'model');
|
|
842
|
+
// Same grammar and 24h ceiling as the daemon: `<int>[smhd]` parts, summed, greater than zero.
|
|
843
|
+
if (params['deadline'] !== undefined) {
|
|
844
|
+
const deadline = params['deadline'];
|
|
845
|
+
const ms = typeof deadline === 'string' && /^\+?(?:\d+[smhd])+$/.test(deadline)
|
|
846
|
+
? [...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;
|
|
847
|
+
if (ms === null || !Number.isSafeInteger(ms))
|
|
848
|
+
throw invalid(`deadline '${String(deadline)}' is not a duration; use one or more <int>[smhd] parts such as 10m or 1h30m`, 'deadline');
|
|
849
|
+
if (ms <= 0)
|
|
850
|
+
throw invalid('deadline must be greater than zero', 'deadline');
|
|
851
|
+
if (ms > 24 * 3_600_000)
|
|
852
|
+
throw invalid('deadline must be at most 24h', 'deadline');
|
|
853
|
+
}
|
|
841
854
|
if (params['profile'] !== undefined && (typeof params['profile'] !== 'string' || !params['profile']))
|
|
842
855
|
throw invalid('profile must be a profile id', 'profile');
|
|
843
856
|
if (params['isolated'] !== undefined && typeof params['isolated'] !== 'boolean')
|
|
@@ -870,6 +883,7 @@ export class FakeCloud {
|
|
|
870
883
|
const message = params['message'];
|
|
871
884
|
const hash = sha256Hex(JSON.stringify({
|
|
872
885
|
prompt: params['prompt'], scopes, metadata, profile: params['profile'], isolated: params['isolated'], cwd: params['cwd'], ...(params['model'] === undefined ? {} : { model: params['model'] }),
|
|
886
|
+
...(params['deadline'] === undefined ? {} : { deadline: params['deadline'] }),
|
|
873
887
|
...(outputSchema === undefined ? {} : { output_schema: outputSchema }), ...(message === undefined ? {} : { message }),
|
|
874
888
|
}));
|
|
875
889
|
if (key !== null) {
|
package/dist/testing/users.d.ts
CHANGED
|
@@ -110,6 +110,7 @@ export interface FakeUser {
|
|
|
110
110
|
setup(provider: string, state: SetupState, options?: {
|
|
111
111
|
message?: string;
|
|
112
112
|
next?: string;
|
|
113
|
+
step?: string;
|
|
113
114
|
}): void;
|
|
114
115
|
/** A grant sync with unchanged content: nothing changes, no held read wakes. */
|
|
115
116
|
sync(): void;
|
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.
|
|
2
|
+
export declare const SDK_VERSION = "0.3.483";
|
|
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.
|
|
3
|
+
export const SDK_VERSION = '0.3.483';
|
|
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.
|
|
4
|
-
"crouterContract": "1.
|
|
3
|
+
"version": "0.3.483",
|
|
4
|
+
"crouterContract": "1.9",
|
|
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.
|
|
48
|
-
"@north-light/identity": "0.3.
|
|
47
|
+
"@north-light/api": "0.3.483",
|
|
48
|
+
"@north-light/identity": "0.3.483",
|
|
49
49
|
"jose": "^6.2.1"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|