@north-light/sdk 0.3.694 → 0.3.696
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/README.md +5 -72
- package/dist/client.d.ts +12 -80
- package/dist/client.js +7 -255
- package/dist/index.d.ts +3 -7
- package/dist/index.js +1 -3
- package/dist/oauth/index.d.ts +3 -6
- package/dist/oauth/index.js +6 -11
- package/dist/resources/canvas.d.ts +2 -9
- package/dist/resources/canvas.js +1 -26
- package/dist/resources/files.d.ts +0 -10
- package/dist/resources/files.js +0 -14
- package/dist/resources/identifiers.d.ts +0 -5
- package/dist/resources/identifiers.js +3 -23
- package/dist/resources/models/credentials.d.ts +1 -3
- package/dist/resources/models/credentials.js +0 -6
- package/dist/resources/models.d.ts +0 -2
- package/dist/resources/models.js +0 -3
- package/dist/resources/run-stream.d.ts +3 -29
- package/dist/resources/run-stream.js +4 -44
- package/dist/resources/runs.d.ts +0 -3
- package/dist/resources/runs.js +0 -9
- package/dist/skill/northlight/SKILL.md +2 -2
- package/dist/types.d.ts +0 -50
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -5
- package/dist/resources/activity.d.ts +0 -22
- package/dist/resources/activity.js +0 -43
- package/dist/resources/bash.d.ts +0 -9
- package/dist/resources/bash.js +0 -15
- package/dist/resources/canvas/history.d.ts +0 -11
- package/dist/resources/canvas/history.js +0 -20
- package/dist/resources/crons.d.ts +0 -15
- package/dist/resources/crons.js +0 -33
- package/dist/resources/human/inbox.d.ts +0 -14
- package/dist/resources/human/inbox.js +0 -30
- package/dist/resources/human/requests.d.ts +0 -13
- package/dist/resources/human/requests.js +0 -26
- package/dist/resources/human.d.ts +0 -8
- package/dist/resources/human.js +0 -10
- package/dist/resources/models/config.d.ts +0 -8
- package/dist/resources/models/config.js +0 -9
- package/dist/resources/node-stream.d.ts +0 -34
- package/dist/resources/node-stream.js +0 -176
- package/dist/resources/nodes/jobs.d.ts +0 -9
- package/dist/resources/nodes/jobs.js +0 -14
- package/dist/resources/nodes/result.d.ts +0 -8
- package/dist/resources/nodes/result.js +0 -11
- package/dist/resources/nodes/worktree.d.ts +0 -9
- package/dist/resources/nodes/worktree.js +0 -14
- package/dist/resources/nodes.d.ts +0 -23
- package/dist/resources/nodes.js +0 -47
- package/dist/resources/structured-requests.d.ts +0 -14
- package/dist/resources/structured-requests.js +0 -19
package/README.md
CHANGED
|
@@ -30,20 +30,7 @@ crtr # first run: the installer signs you in to a mode
|
|
|
30
30
|
|
|
31
31
|
## Connect
|
|
32
32
|
|
|
33
|
-
In Node, `new Crouter()` uses the local unix socket and starts the daemon on the first request when the socket is cold. In a browser or a remote process, pass the TCP URL and bearer token returned by `crtr sys connect` — the owner token, or a scoped token from `crtr sys connect --scopes` whose list caps what the application and its runs may do.
|
|
34
|
-
|
|
35
|
-
```ts
|
|
36
|
-
import Crouter from '@north-light/sdk';
|
|
37
|
-
|
|
38
|
-
const client = new Crouter();
|
|
39
|
-
const status = await client.auth.status();
|
|
40
|
-
|
|
41
|
-
if (status.next_step !== null) {
|
|
42
|
-
console.log(status.instructions);
|
|
43
|
-
} else {
|
|
44
|
-
console.log('The daemon and selected provider are ready.');
|
|
45
|
-
}
|
|
46
|
-
```
|
|
33
|
+
In Node, `new Crouter()` uses the local unix socket and starts the daemon on the first request when the socket is cold. In a browser or a remote process, pass the TCP URL and bearer token returned by `crtr sys connect` — the owner token, or a scoped token from `crtr sys connect --scopes` whose list caps what the application and its runs may do.
|
|
47
34
|
|
|
48
35
|
```ts
|
|
49
36
|
const client = new Crouter({
|
|
@@ -52,6 +39,8 @@ const client = new Crouter({
|
|
|
52
39
|
});
|
|
53
40
|
```
|
|
54
41
|
|
|
42
|
+
The SDK wraps the app routes (`runs`, `uploads`, `docs`, `memory`, …). To create nodes, run bash, arm crons or answer the human inbox on your own daemon, use `CrtrClient` from `@north-light/api` or the `crtr` CLI.
|
|
43
|
+
|
|
55
44
|
## Runtime compatibility
|
|
56
45
|
|
|
57
46
|
Compatibility between the SDK and a runtime is a **contract level** (`MAJOR.MINOR`), not the package version. The SDK exports it as `CONTRACT_LEVEL` and its manifest carries it as `crouterContract`. The level changes only when the `/v1` surface changes in a way the release check can see or an author declared, so most releases leave it alone.
|
|
@@ -75,44 +64,7 @@ try {
|
|
|
75
64
|
|
|
76
65
|
## Run and parse a result
|
|
77
66
|
|
|
78
|
-
`parse()`
|
|
79
|
-
|
|
80
|
-
```ts
|
|
81
|
-
import Crouter from '@north-light/sdk';
|
|
82
|
-
import { z } from 'zod';
|
|
83
|
-
|
|
84
|
-
const client = new Crouter();
|
|
85
|
-
const run = await client.nodes.parse({
|
|
86
|
-
prompt: 'Read package.json and return its name and version.',
|
|
87
|
-
cwd: '/absolute/path/to/project',
|
|
88
|
-
scopes: ['crtr:llm', 'crtr:files:read:user:.'],
|
|
89
|
-
output_schema: z.object({ name: z.string(), version: z.string() }),
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
if (run.kind === 'result') console.log(run.output_parsed.name, run.output_parsed.version);
|
|
93
|
-
else if (run.reason === 'declined') console.warn(run.declined?.reason);
|
|
94
|
-
else console.error(run.reason, run.detail);
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
## Stream a run
|
|
98
|
-
|
|
99
|
-
`nodes.stream()` creates a run and opens its event stream. `followActivity()` turns tool-call events into snapshots for an activity view. Disconnecting or calling `stream.abort()` stops the stream, not the run.
|
|
100
|
-
|
|
101
|
-
```ts
|
|
102
|
-
import { followActivity } from '@north-light/sdk';
|
|
103
|
-
|
|
104
|
-
const stream = client.nodes.stream({
|
|
105
|
-
prompt: 'Inspect the repository and report the failing tests.',
|
|
106
|
-
cwd: '/absolute/path/to/project',
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
for await (const steps of followActivity(stream)) {
|
|
110
|
-
renderActivity(steps);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const outcome = await stream.finalOutcome();
|
|
114
|
-
console.log(outcome.kind);
|
|
115
|
-
```
|
|
67
|
+
`runs.parse()` starts a run, waits for it to end, and types `output_parsed` from a Zod or Standard Schema. See [Typed results](https://sdk.docs.northlight.ai/docs/guides/typed-results) and [Stream a run](https://sdk.docs.northlight.ai/docs/guides/stream-a-run).
|
|
116
68
|
|
|
117
69
|
## Follow the reply to a message
|
|
118
70
|
|
|
@@ -139,21 +91,6 @@ A run working in the background reports what it is doing on `runs.get(runId).act
|
|
|
139
91
|
|
|
140
92
|
`runs.listAll(filters)` and `memory.listAll(params)` (the person's knowledge and preference documents the caller can read: `public` by default, `private` too with `crtr:memory:read_private:user`, every privacy level with `crtr:memory:manage:user`) iterate every item across pages with `for await`, fetching the next page only as you go. `runs.delete(runId)` deletes a running run too — it stops the run's turns and sandboxes itself, so there is no need to `cancel` first; deleting a run that is already gone throws `NotFoundError`.
|
|
141
93
|
|
|
142
|
-
## Read files and run bash
|
|
143
|
-
|
|
144
|
-
File paths and the bash working directory are absolute. `bash.run()` returns non-zero exits as values.
|
|
145
|
-
|
|
146
|
-
```ts
|
|
147
|
-
const source = await client.files.read('/absolute/path/to/project/package.json');
|
|
148
|
-
const command = await client.bash.run({
|
|
149
|
-
command: 'npm test',
|
|
150
|
-
cwd: '/absolute/path/to/project',
|
|
151
|
-
timeout_s: 60,
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
console.log(source.content, command.exit_code);
|
|
155
|
-
```
|
|
156
|
-
|
|
157
94
|
## PostgreSQL connection store (Node)
|
|
158
95
|
|
|
159
96
|
For a multi-process OAuth app, install `pg` in the app (`npm install pg`) and import the optional `@north-light/sdk/stores/postgres` subpath; the SDK's main entry never loads `pg`. `new PostgresConnectionStore(pool, { table: 'connection' })` implements `load`, `save`, `lock`, `remove(userId, refreshToken)`, and `listStale(before: Date)`. Pass it as `new OAuth2Client({..., store})`. Use one shared database and the same table for all workers. The lock keeps one PostgreSQL transaction and client open across the entire refresh callback (including the token request), so provision the pool for concurrent refreshes and avoid a transaction timeout shorter than the request. The table name accepts one or two lowercase SQL identifiers (schema.table), never SQL fragments.
|
|
@@ -180,13 +117,9 @@ CREATE INDEX connection_updated_at_idx ON connection (updated_at, user_id);
|
|
|
180
117
|
|
|
181
118
|
`PostgresObjectStore` from `@north-light/sdk/stores/postgres` keeps per-person custom objects, the nodes watching them, and a durable publish outbox. `objectKitSchemaSql(tables?)` returns the DDL for the three tables (`watch_object`, `watch_watcher`, `watch_publish` by default) for your migration. `new PostgresObjectStore(pool, {providerId, runtime: (sub) => oauth.appClient(sub), tables?, log?})` has `instance(sub, kind, target, {name, description})`, `watch(objectId, node, machine?)`, `enqueue(client, objectId, {event, summary, state?})` (pass your open transaction's client), `tick(batch?)` and `startPublisher({tick: 5000, batch: 100})`. Delivery is at least once under an advisory lock, backs off to 15 minutes, and drops a row after 24 hours or a permanent refusal (HTTP 400, 404 or 422). Full guide: [Watchable objects](https://sdk.docs.northlight.ai/docs/guides/watchable-objects).
|
|
182
119
|
|
|
183
|
-
## Example application
|
|
184
|
-
|
|
185
|
-
See the complete [localhost SDK demo](https://github.com/Northlight-Systems/crouter/tree/main/examples/localhost-demo) for streaming, structured output, and an HTTP plugin in one local page.
|
|
186
|
-
|
|
187
120
|
## Reference
|
|
188
121
|
|
|
189
|
-
The [app builder docs](https://sdk.docs.northlight.ai) cover quick setup, concepts, guides, providers, errors and the generated reference. For a daemon you run yourself, the [SDK guide](https://crouter.docs.northlight.ai/docs/sdk) covers [client construction](https://crouter.docs.northlight.ai/docs/sdk/client), [
|
|
122
|
+
The [app builder docs](https://sdk.docs.northlight.ai) cover quick setup, concepts, guides, providers, errors and the generated reference. For a daemon you run yourself, the [SDK guide](https://crouter.docs.northlight.ai/docs/sdk) covers [client construction](https://crouter.docs.northlight.ai/docs/sdk/client), [Docker](https://crouter.docs.northlight.ai/docs/sdk/docker), [daemon errors](https://crouter.docs.northlight.ai/docs/sdk/errors), and the complete [resource map](https://crouter.docs.northlight.ai/docs/sdk/resources).
|
|
190
123
|
|
|
191
124
|
`@north-light/sdk/errors` exports `errorCodes`/`ErrorCode` (the daemon's codes), `sdkErrorCodes`/`SdkErrorCode` (the codes the SDK raises itself, such as `oauth_state_mismatch`; `CrouterError.code` is typed with them), and `mapError`, which turns a plain `APIError` into its status class (`NotFoundError`, …) for app tests.
|
|
192
125
|
|
package/dist/client.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { type CheckDTO
|
|
2
|
-
import { Bash } from './resources/bash.js';
|
|
1
|
+
import { type CheckDTO } from '@north-light/api';
|
|
3
2
|
import { Canvas } from './resources/canvas.js';
|
|
4
|
-
import { Crons } from './resources/crons.js';
|
|
5
3
|
import { Docs } from './resources/docs.js';
|
|
6
4
|
import { Charges } from './resources/charges.js';
|
|
7
5
|
import { SpendLimits } from './resources/spend-limits.js';
|
|
@@ -10,38 +8,15 @@ import { Schemas } from './resources/schemas.js';
|
|
|
10
8
|
import { CustomObjects } from './resources/custom-objects.js';
|
|
11
9
|
import { Attachments } from './resources/attachments.js';
|
|
12
10
|
import { Files } from './resources/files.js';
|
|
13
|
-
import { Human } from './resources/human.js';
|
|
14
11
|
import { Models } from './resources/models.js';
|
|
15
|
-
import { NodesResource } from './resources/nodes.js';
|
|
16
|
-
import { NodeStream } from './resources/node-stream.js';
|
|
17
12
|
import { Questions } from './resources/questions.js';
|
|
18
13
|
import { Providers } from './resources/providers.js';
|
|
19
14
|
import { Runs } from './resources/runs.js';
|
|
20
15
|
import { Shares } from './resources/shares.js';
|
|
21
|
-
import { StructuredRequests } from './resources/structured-requests.js';
|
|
22
16
|
import { Memory } from './resources/memory.js';
|
|
23
17
|
import { Uploads } from './resources/uploads.js';
|
|
24
|
-
import type {
|
|
18
|
+
import type { RequestOptions } from './types.js';
|
|
25
19
|
import type { AppProfile } from './resources/runs.js';
|
|
26
|
-
type CoreNodes = {
|
|
27
|
-
create: (params: NodeCreateParams, options?: RequestOptions) => Promise<NodeDetailDTO>;
|
|
28
|
-
retrieve: (id: string, options?: RequestOptions) => Promise<NodeDetailDTO>;
|
|
29
|
-
list: (query?: ListNodesQuery, options?: RequestOptions) => Promise<NodeSummaryDTO[]>;
|
|
30
|
-
outcome: (id: string, options?: NodeOutcomeOptions) => Promise<NodeOutcomeResponseDTO>;
|
|
31
|
-
waitForOutcome: (id: string, options?: RequestOptions) => Promise<NodeOutcomeDTO>;
|
|
32
|
-
createAndWait: (params: NodeCreateParams, options?: RequestOptions) => Promise<NodeOutcomeDTO>;
|
|
33
|
-
parse: <TSchema extends OutputSchema>(params: NodeCreateParams & {
|
|
34
|
-
output_schema: TSchema;
|
|
35
|
-
}, options?: RequestOptions) => Promise<ParsedOutcome<SchemaOutput<TSchema>>>;
|
|
36
|
-
message: (id: string, body: string | MessageParams, options?: RequestOptions) => Promise<MessageResultDTO>;
|
|
37
|
-
cancel: (id: string, body?: CancelParams, options?: RequestOptions) => Promise<unknown>;
|
|
38
|
-
interrupt: (id: string, options?: RequestOptions) => Promise<unknown>;
|
|
39
|
-
stream: (params: NodeCreateParams, options?: RequestOptions) => NodeStream;
|
|
40
|
-
events: (id: string, options?: NodeEventsOptions) => NodeStream;
|
|
41
|
-
reports: {
|
|
42
|
-
list: (id: string, query?: ReportsQuery, options?: RequestOptions) => Promise<ReportDTO[]>;
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
20
|
/** Connection settings for a Crouter daemon. `headers` lets a Docker environment's
|
|
46
21
|
* `connection()` result pass directly to this constructor. */
|
|
47
22
|
export interface CrouterOptions {
|
|
@@ -73,59 +48,33 @@ export interface CrouterOptions {
|
|
|
73
48
|
autostart?: boolean;
|
|
74
49
|
}
|
|
75
50
|
/** The namespaces of `Crouter` that only the owner's own daemon serves. A person's app listener answers them `404 unknown operation`. */
|
|
76
|
-
export type OwnerOnly = 'spendLimits' | '
|
|
77
|
-
/** What an app reaches on a person's runtime (the app listener): `Crouter` without the owner-daemon namespaces,
|
|
78
|
-
*
|
|
79
|
-
export type AppClient = Omit<Crouter, OwnerOnly
|
|
51
|
+
export type OwnerOnly = 'spendLimits' | 'customObjects' | 'models';
|
|
52
|
+
/** What an app reaches on a person's runtime (the app listener): `Crouter` without the owner-daemon namespaces, and
|
|
53
|
+
* `customObjects` narrowed to register/publish/unregister. `Crouter` is assignable to it, so a function that takes `AppClient` takes either. */
|
|
54
|
+
export type AppClient = Omit<Crouter, OwnerOnly> & {
|
|
80
55
|
/** Register, publish to and unregister the custom objects the app owns (`receive` and `ack` are owner-daemon only). */
|
|
81
56
|
readonly customObjects: Pick<CustomObjects, 'register' | 'publish' | 'unregister'>;
|
|
82
|
-
/** Link nodes to the app's objects: `watch` and `unwatch` with `watcher` (and `watcher_machine` for a node of another machine), under `crtr:objects:link:node`. */
|
|
83
|
-
readonly canvas: Pick<Canvas, 'watch' | 'unwatch'>;
|
|
84
|
-
/** A download link for a file an agent handed over, by its id (`files.link`); the other `files` calls are owner-daemon only. */
|
|
85
|
-
readonly files: Pick<Files, 'link'>;
|
|
86
|
-
/** The profiles the app may start runs with (`profiles.list`); `ensure` and `retrieve` are owner-daemon only. */
|
|
87
|
-
readonly profiles: Pick<Crouter['profiles'], 'list'>;
|
|
88
57
|
};
|
|
89
58
|
/**
|
|
90
|
-
* The client
|
|
91
|
-
*
|
|
59
|
+
* The client an application constructs for a person's runtime. Each namespace below wraps a family of app
|
|
60
|
+
* routes; `request` is the escape hatch for a route with no wrapper. A daemon owner driving nodes, bash, crons
|
|
61
|
+
* or the human inbox uses `CrtrClient` from `@north-light/api`.
|
|
92
62
|
*/
|
|
93
63
|
export declare class Crouter {
|
|
94
|
-
/**
|
|
95
|
-
readonly nodes: NodesResource & CoreNodes;
|
|
96
|
-
/** Run one command in an absolute working directory. */
|
|
97
|
-
readonly bash: Bash;
|
|
98
|
-
/** Canvas-wide views: attention, snapshot, roster, dashboard, prune, and history. */
|
|
64
|
+
/** Link nodes to the app's objects: `watch` and `unwatch` with `watcher` (and `watcher_machine` for a node of another machine), under `crtr:objects:link:node`. */
|
|
99
65
|
readonly canvas: Canvas;
|
|
100
|
-
/** Scheduled commands. */
|
|
101
|
-
readonly crons: Crons;
|
|
102
|
-
/** Durable structured requests with deadlines and one settlement. */
|
|
103
|
-
readonly structuredRequests: StructuredRequests;
|
|
104
66
|
/** Register, publish, receive, and acknowledge custom canvas objects. */
|
|
105
67
|
readonly customObjects: CustomObjects;
|
|
106
|
-
/**
|
|
107
|
-
readonly human: Human;
|
|
108
|
-
/** Model credentials and model configuration. */
|
|
68
|
+
/** Install a model credential (`models.credentials.install`); the person's own client only. */
|
|
109
69
|
readonly models: Models;
|
|
110
70
|
/** Agent profiles. */
|
|
111
71
|
readonly profiles: {
|
|
112
|
-
ensure: (name: string, params?: EnsureProfileParams, options?: RequestOptions) => Promise<ProfileDTO>;
|
|
113
|
-
retrieve: (name: string, options?: RequestOptions) => Promise<ProfileDTO>;
|
|
114
72
|
/** The profiles an app may start runs with (app listener only): its own, and those of other apps its grant covers. `default` marks its default profile. */
|
|
115
73
|
list: (options?: RequestOptions) => Promise<{
|
|
116
74
|
profiles: AppProfile[];
|
|
117
75
|
}>;
|
|
118
76
|
};
|
|
119
|
-
/**
|
|
120
|
-
readonly system: {
|
|
121
|
-
status: (options?: RequestOptions) => Promise<StatusDTO>;
|
|
122
|
-
health: (options?: RequestOptions) => Promise<HealthDTO>;
|
|
123
|
-
};
|
|
124
|
-
/** Whether this client can reach a daemon that can run a model. */
|
|
125
|
-
readonly auth: {
|
|
126
|
-
status: (params?: AuthStatusParams, options?: RequestOptions) => Promise<AuthStatus>;
|
|
127
|
-
};
|
|
128
|
-
/** Read, write, and list absolute host paths. */
|
|
77
|
+
/** A download link for a file an agent handed over, by its id (`files.link`). */
|
|
129
78
|
readonly files: Files;
|
|
130
79
|
/** Start a run on the person's runtime, read its status, outcome and trace, parse a typed result, message it, and stream or watch it. */
|
|
131
80
|
readonly runs: Runs;
|
|
@@ -161,12 +110,6 @@ export declare class Crouter {
|
|
|
161
110
|
since?: string;
|
|
162
111
|
}) => Promise<import('@north-light/api').GrantGetDTO>;
|
|
163
112
|
};
|
|
164
|
-
readonly health: {
|
|
165
|
-
get: (options?: RequestOptions) => Promise<{
|
|
166
|
-
status: 'ok';
|
|
167
|
-
api_version: string;
|
|
168
|
-
}>;
|
|
169
|
-
};
|
|
170
113
|
/** @deprecated Use `charges.list`. The caller's month-to-date spend (`usage.get`): user-paid model and priced tool usage, app-paid usage,
|
|
171
114
|
* the grant's `spend_cap`, and `reset_at`. The cap counts priced tool calls as well as model calls. Once user-paid spend reaches
|
|
172
115
|
* `spend_cap`, calls billed to the user answer `cap_exhausted` (a `RateLimitError`, status 402, `userAction: 'raise_cap'`,
|
|
@@ -193,19 +136,8 @@ export declare class Crouter {
|
|
|
193
136
|
private openRunEvents;
|
|
194
137
|
/** Sends one request to any daemon route, for routes the namespaces above do not wrap. */
|
|
195
138
|
request<T>(method: string, path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
196
|
-
private authStatus;
|
|
197
|
-
private stream;
|
|
198
|
-
private events;
|
|
199
|
-
/** Opening a stream under the call's deadline: the open (token hook included) is abandoned and aborted at
|
|
200
|
-
* `deadlineAt`. Once open, a stream has no deadline: it lives until it ends or `signal` aborts. */
|
|
201
|
-
private openWithin;
|
|
202
|
-
private outcome;
|
|
203
|
-
private waitForOutcome;
|
|
204
|
-
private createAndWait;
|
|
205
|
-
private parse;
|
|
206
139
|
/** Runs `operation` with the connection token, refreshing it once after a 401. `options` carries the call's one
|
|
207
140
|
* deadline (resolved by `deadline`): the token fetch, the refresh and every attempt share it, and `operation`
|
|
208
141
|
* receives the options with the deadline resolved. */
|
|
209
142
|
private call;
|
|
210
143
|
}
|
|
211
|
-
export {};
|
package/dist/client.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { APIError, CrtrClient, CONTRACT_HEADER, CONTRACT_LEVEL, MINIMUM_RUNTIME_VERSION_HEADER, REQUIRED_CONTRACT_HEADER, RUNTIME_VERSION_HEADER, contractSatisfies, routes, } from '@north-light/api';
|
|
2
|
-
import {
|
|
3
|
-
import { Bash } from './resources/bash.js';
|
|
2
|
+
import { CrouterError, mapError } from './errors.js';
|
|
4
3
|
import { Canvas } from './resources/canvas.js';
|
|
5
|
-
import { Crons } from './resources/crons.js';
|
|
6
4
|
import { Docs } from './resources/docs.js';
|
|
7
5
|
import { Charges } from './resources/charges.js';
|
|
8
6
|
import { SpendLimits } from './resources/spend-limits.js';
|
|
@@ -11,52 +9,32 @@ import { Schemas } from './resources/schemas.js';
|
|
|
11
9
|
import { CustomObjects } from './resources/custom-objects.js';
|
|
12
10
|
import { Attachments } from './resources/attachments.js';
|
|
13
11
|
import { Files } from './resources/files.js';
|
|
14
|
-
import { Human } from './resources/human.js';
|
|
15
12
|
import { Models } from './resources/models.js';
|
|
16
|
-
import { NodesResource } from './resources/nodes.js';
|
|
17
|
-
import { nodeId, pathSegment } from './resources/identifiers.js';
|
|
18
|
-
import { NodeStream } from './resources/node-stream.js';
|
|
19
13
|
import { Questions } from './resources/questions.js';
|
|
20
14
|
import { Providers } from './resources/providers.js';
|
|
21
15
|
import { CAUSED_BY_HEADER, Runs } from './resources/runs.js';
|
|
22
16
|
import { Shares } from './resources/shares.js';
|
|
23
|
-
import { StructuredRequests } from './resources/structured-requests.js';
|
|
24
17
|
import { Memory } from './resources/memory.js';
|
|
25
18
|
import { Uploads } from './resources/uploads.js';
|
|
26
19
|
import { deadline, heldReadOptions, withinDeadline } from './resources/request.js';
|
|
27
|
-
import { resolveJsonSchema } from './schema.js';
|
|
28
20
|
import { LEGACY_FLOOR, SDK_VERSION } from './version.js';
|
|
29
21
|
const LOCAL_SOCKET_FETCH = Symbol.for('@north-light/api/local-socket-fetch');
|
|
30
22
|
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
31
|
-
const POLL_WAIT_SECONDS = 25;
|
|
32
23
|
/**
|
|
33
|
-
* The client
|
|
34
|
-
*
|
|
24
|
+
* The client an application constructs for a person's runtime. Each namespace below wraps a family of app
|
|
25
|
+
* routes; `request` is the escape hatch for a route with no wrapper. A daemon owner driving nodes, bash, crons
|
|
26
|
+
* or the human inbox uses `CrtrClient` from `@north-light/api`.
|
|
35
27
|
*/
|
|
36
28
|
export class Crouter {
|
|
37
|
-
/**
|
|
38
|
-
nodes;
|
|
39
|
-
/** Run one command in an absolute working directory. */
|
|
40
|
-
bash;
|
|
41
|
-
/** Canvas-wide views: attention, snapshot, roster, dashboard, prune, and history. */
|
|
29
|
+
/** Link nodes to the app's objects: `watch` and `unwatch` with `watcher` (and `watcher_machine` for a node of another machine), under `crtr:objects:link:node`. */
|
|
42
30
|
canvas;
|
|
43
|
-
/** Scheduled commands. */
|
|
44
|
-
crons;
|
|
45
|
-
/** Durable structured requests with deadlines and one settlement. */
|
|
46
|
-
structuredRequests;
|
|
47
31
|
/** Register, publish, receive, and acknowledge custom canvas objects. */
|
|
48
32
|
customObjects;
|
|
49
|
-
/**
|
|
50
|
-
human;
|
|
51
|
-
/** Model credentials and model configuration. */
|
|
33
|
+
/** Install a model credential (`models.credentials.install`); the person's own client only. */
|
|
52
34
|
models;
|
|
53
35
|
/** Agent profiles. */
|
|
54
36
|
profiles;
|
|
55
|
-
/**
|
|
56
|
-
system;
|
|
57
|
-
/** Whether this client can reach a daemon that can run a model. */
|
|
58
|
-
auth;
|
|
59
|
-
/** Read, write, and list absolute host paths. */
|
|
37
|
+
/** A download link for a file an agent handed over, by its id (`files.link`). */
|
|
60
38
|
files;
|
|
61
39
|
/** Start a run on the person's runtime, read its status, outcome and trace, parse a typed result, message it, and stream or watch it. */
|
|
62
40
|
runs;
|
|
@@ -87,7 +65,6 @@ export class Crouter {
|
|
|
87
65
|
* read until the grant's `version` differs from `since` or `wait` seconds pass; the request timeout is extended by
|
|
88
66
|
* `wait`. To follow many people's grants, use `oauth.watchGrants`. */
|
|
89
67
|
grant;
|
|
90
|
-
health;
|
|
91
68
|
/** @deprecated Use `charges.list`. The caller's month-to-date spend (`usage.get`): user-paid model and priced tool usage, app-paid usage,
|
|
92
69
|
* the grant's `spend_cap`, and `reset_at`. The cap counts priced tool calls as well as model calls. Once user-paid spend reaches
|
|
93
70
|
* `spend_cap`, calls billed to the user answer `cap_exhausted` (a `RateLimitError`, status 402, `userAction: 'raise_cap'`,
|
|
@@ -175,65 +152,12 @@ export class Crouter {
|
|
|
175
152
|
}
|
|
176
153
|
}
|
|
177
154
|
const request = (method, path, body, options) => this.request(method, path, body, options);
|
|
178
|
-
const nodes = new NodesResource(request);
|
|
179
|
-
const phaseOneNodes = {
|
|
180
|
-
create: (params, options) => this.call(deadline(options), (options) => this.client.request('POST', routes.nodes(), serializeCreate(params), options)),
|
|
181
|
-
retrieve: async (id, options) => {
|
|
182
|
-
const validId = nodeId(id);
|
|
183
|
-
return this.call(deadline(options), (options) => this.client.request('GET', routes.node(validId), undefined, options));
|
|
184
|
-
},
|
|
185
|
-
list: (query, options) => this.call(deadline(options), (options) => this.client.request('GET', withQuery(routes.nodes(), query), undefined, options)),
|
|
186
|
-
outcome: (id, options) => this.outcome(id, options),
|
|
187
|
-
waitForOutcome: (id, options) => this.waitForOutcome(id, options),
|
|
188
|
-
createAndWait: (params, options) => this.createAndWait(params, options),
|
|
189
|
-
parse: (params, options) => this.parse(params, options),
|
|
190
|
-
message: async (id, body, options) => {
|
|
191
|
-
const validId = nodeId(id);
|
|
192
|
-
return this.call(deadline(options), (options) => this.client.request('POST', routes.nodeMessages(validId), messageBody(body), options));
|
|
193
|
-
},
|
|
194
|
-
cancel: async (id, body, options) => {
|
|
195
|
-
const validId = nodeId(id);
|
|
196
|
-
return this.call(deadline(options), (options) => this.client.request('POST', routes.nodeClose(validId), body ?? {}, options));
|
|
197
|
-
},
|
|
198
|
-
interrupt: async (id, options) => {
|
|
199
|
-
const validId = nodeId(id);
|
|
200
|
-
return this.call(deadline(options), (options) => this.client.request('POST', routes.nodeInterrupt(validId), {}, options));
|
|
201
|
-
},
|
|
202
|
-
stream: (params, options) => this.stream(params, options),
|
|
203
|
-
events: (id, options) => this.events(id, options),
|
|
204
|
-
reports: {
|
|
205
|
-
list: async (id, query, options) => {
|
|
206
|
-
const validId = nodeId(id);
|
|
207
|
-
return this.call(deadline(options), (options) => this.client.request('GET', withQuery(routes.nodeReports(validId), query), undefined, options));
|
|
208
|
-
},
|
|
209
|
-
},
|
|
210
|
-
};
|
|
211
|
-
this.nodes = Object.assign(nodes, phaseOneNodes);
|
|
212
|
-
this.bash = new Bash(request, this.timeout);
|
|
213
155
|
this.canvas = new Canvas(request);
|
|
214
|
-
this.crons = new Crons(request);
|
|
215
|
-
this.structuredRequests = new StructuredRequests(request);
|
|
216
156
|
this.customObjects = new CustomObjects(request, (path, options) => this.openCustomDeliveries(path, options));
|
|
217
|
-
this.human = new Human(request);
|
|
218
157
|
this.models = new Models(request);
|
|
219
158
|
this.profiles = {
|
|
220
|
-
ensure: async (name, params, options) => {
|
|
221
|
-
const validName = pathSegment(name, 'profile name');
|
|
222
|
-
return this.call(deadline(options), (options) => this.client.request('PUT', routes.profile(validName), params ?? {}, options));
|
|
223
|
-
},
|
|
224
|
-
retrieve: async (name, options) => {
|
|
225
|
-
const validName = pathSegment(name, 'profile name');
|
|
226
|
-
return this.call(deadline(options), (options) => this.client.request('GET', routes.profile(validName), undefined, options));
|
|
227
|
-
},
|
|
228
159
|
list: (options) => this.call(deadline(options), (options) => this.client.request('GET', routes.profiles(), undefined, options)),
|
|
229
160
|
};
|
|
230
|
-
this.system = {
|
|
231
|
-
status: (options) => this.call(deadline(options), (options) => this.client.request('GET', routes.status(), undefined, options)),
|
|
232
|
-
health: (options) => this.call(deadline(options), (options) => this.client.request('GET', routes.healthz(), undefined, options)),
|
|
233
|
-
};
|
|
234
|
-
this.auth = {
|
|
235
|
-
status: (params, options) => this.authStatus(params, options),
|
|
236
|
-
};
|
|
237
161
|
this.files = new Files(request);
|
|
238
162
|
this.uploads = new Uploads(request);
|
|
239
163
|
this.attachments = new Attachments(request);
|
|
@@ -252,7 +176,6 @@ export class Crouter {
|
|
|
252
176
|
const held = heldReadOptions(wait, rest);
|
|
253
177
|
return this.request('GET', withQuery('/v1/grant', { wait, since }), undefined, held);
|
|
254
178
|
} };
|
|
255
|
-
this.health = { get: (options) => this.request('GET', '/v1/health', undefined, options) };
|
|
256
179
|
this.usage = { get: (params = {}, options) => this.request('GET', withQuery('/v1/usage', { month: params.month }), undefined, options) };
|
|
257
180
|
}
|
|
258
181
|
/** May the person `subject` (`user:<id>`) do `permission` on `resource` (`<type>:<id>` in the app's own namespace, or a crouter object id with `read|edit|message|use`)? App listener only. */
|
|
@@ -282,125 +205,6 @@ export class Crouter {
|
|
|
282
205
|
request(method, path, body, options) {
|
|
283
206
|
return this.call(deadline(options), (options) => this.client.request(method, path, body, options), path !== '/v1/health');
|
|
284
207
|
}
|
|
285
|
-
async authStatus(params = {}, options) {
|
|
286
|
-
if (this.baseURL === undefined && (!isNodeRuntime() || !await socketIsReachable(this.socketPath))) {
|
|
287
|
-
return connectStatus('Install crtr, run `crtr sys connect`, and paste the base URL and token it prints.');
|
|
288
|
-
}
|
|
289
|
-
let daemon;
|
|
290
|
-
try {
|
|
291
|
-
daemon = await this.call(deadline(options), (options) => this.client.request('GET', routes.status(), undefined, options));
|
|
292
|
-
}
|
|
293
|
-
catch (error) {
|
|
294
|
-
if (!(error instanceof APIError))
|
|
295
|
-
throw error;
|
|
296
|
-
const mapped = mapError(error);
|
|
297
|
-
if (mapped instanceof AuthenticationError) {
|
|
298
|
-
return connectStatus('The daemon rejected the saved token. Run `crtr sys connect` and paste the new base URL and token it prints.');
|
|
299
|
-
}
|
|
300
|
-
if (mapped instanceof APIConnectionError) {
|
|
301
|
-
const instruction = this.baseURL === undefined
|
|
302
|
-
? 'Run `crtr sys connect` and paste the base URL and token it prints.'
|
|
303
|
-
: `The daemon at ${this.baseURL} could not be reached. Run \`crtr sys connect\` and paste the new base URL and token it prints.`;
|
|
304
|
-
return connectStatus(instruction);
|
|
305
|
-
}
|
|
306
|
-
throw mapped;
|
|
307
|
-
}
|
|
308
|
-
const daemonStatus = {
|
|
309
|
-
base_url: this.baseURL ?? daemon.listeners.socket_path,
|
|
310
|
-
runtime_version: daemon.runtime_version,
|
|
311
|
-
api_version: daemon.api_version,
|
|
312
|
-
startup_phase: daemon.startup_phase,
|
|
313
|
-
tcp: daemon.listeners.tcp,
|
|
314
|
-
};
|
|
315
|
-
if (daemon.startup_phase !== 'ready') {
|
|
316
|
-
return { connected: true, daemon: daemonStatus, model: null, next_step: null, instructions: null };
|
|
317
|
-
}
|
|
318
|
-
const model = await this.call(deadline(options), (options) => this.client.request('GET', withQuery(routes.modelAuthReadiness(), params), undefined, options));
|
|
319
|
-
// A runtime older than `hosted_endpoint` omits it: only the person's own sign-in then counts.
|
|
320
|
-
if (model.credential !== 'ready' && model.hosted_endpoint !== true) {
|
|
321
|
-
return {
|
|
322
|
-
connected: true,
|
|
323
|
-
daemon: daemonStatus,
|
|
324
|
-
model,
|
|
325
|
-
next_step: 'login',
|
|
326
|
-
instructions: `Run \`${connectCommand(params)}\` to log in to ${model.provider}.`,
|
|
327
|
-
};
|
|
328
|
-
}
|
|
329
|
-
return { connected: true, daemon: daemonStatus, model, next_step: null, instructions: null };
|
|
330
|
-
}
|
|
331
|
-
stream(params, options) {
|
|
332
|
-
const node = this.nodes.create(params, options);
|
|
333
|
-
const { timeout: _timeout, budgetMs, deadlineAt, ...streamOptions } = options ?? {};
|
|
334
|
-
const opening = deadline({ budgetMs, deadlineAt })?.deadlineAt;
|
|
335
|
-
return new NodeStream(node, async (signal) => {
|
|
336
|
-
const created = await node;
|
|
337
|
-
return this.openWithin(opening, signal, (signal) => this.call(undefined, () => this.client.getNodeEvents(created.node_id, {}, { ...streamOptions, signal })));
|
|
338
|
-
}, options?.signal);
|
|
339
|
-
}
|
|
340
|
-
events(id, options = {}) {
|
|
341
|
-
const { after, budgetMs, deadlineAt, ...streamOptions } = options;
|
|
342
|
-
const opening = deadline({ budgetMs, deadlineAt })?.deadlineAt;
|
|
343
|
-
const node = this.nodes.retrieve(id, { ...streamOptions, ...(opening === undefined ? {} : { deadlineAt: opening }) });
|
|
344
|
-
return new NodeStream(node, async (signal) => {
|
|
345
|
-
const existing = await node;
|
|
346
|
-
return this.openWithin(opening, signal, (signal) => this.call(undefined, () => this.client.getNodeEvents(existing.node_id, { after }, { ...streamOptions, signal })));
|
|
347
|
-
}, options.signal);
|
|
348
|
-
}
|
|
349
|
-
/** Opening a stream under the call's deadline: the open (token hook included) is abandoned and aborted at
|
|
350
|
-
* `deadlineAt`. Once open, a stream has no deadline: it lives until it ends or `signal` aborts. */
|
|
351
|
-
async openWithin(deadlineAt, signal, open) {
|
|
352
|
-
if (deadlineAt === undefined)
|
|
353
|
-
return open(signal);
|
|
354
|
-
const controller = new AbortController();
|
|
355
|
-
const onAbort = () => controller.abort(signal.reason);
|
|
356
|
-
if (signal.aborted)
|
|
357
|
-
onAbort();
|
|
358
|
-
else
|
|
359
|
-
signal.addEventListener('abort', onAbort, { once: true });
|
|
360
|
-
try {
|
|
361
|
-
return await withinDeadline(open(controller.signal), deadlineAt);
|
|
362
|
-
}
|
|
363
|
-
catch (error) {
|
|
364
|
-
controller.abort(error);
|
|
365
|
-
throw error instanceof APIError ? mapError(error) : error;
|
|
366
|
-
}
|
|
367
|
-
finally {
|
|
368
|
-
signal.removeEventListener('abort', onAbort);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
async outcome(id, options = {}) {
|
|
372
|
-
const validId = nodeId(id);
|
|
373
|
-
const { wait, ...requestOptions } = options;
|
|
374
|
-
if (wait !== undefined && (!Number.isInteger(wait) || wait < 0 || wait > POLL_WAIT_SECONDS)) {
|
|
375
|
-
throw new RangeError('wait must be an integer between 0 and 25');
|
|
376
|
-
}
|
|
377
|
-
const timeout = wait === undefined ? requestOptions.timeout : wait * 1_000 + (requestOptions.timeout ?? this.timeout);
|
|
378
|
-
return this.call(deadline({ ...requestOptions, timeout }), (options) => this.client.request('GET', withQuery(routes.nodeOutcome(validId), { wait }), undefined, options));
|
|
379
|
-
}
|
|
380
|
-
async waitForOutcome(id, unbounded) {
|
|
381
|
-
// One deadline for the whole wait: every poll shares it instead of restarting `budgetMs`.
|
|
382
|
-
const options = deadline(unbounded);
|
|
383
|
-
for (;;) {
|
|
384
|
-
const response = await this.outcome(id, { ...options, wait: POLL_WAIT_SECONDS });
|
|
385
|
-
if (response.state === 'settled' && response.outcome !== null)
|
|
386
|
-
return response.outcome;
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
async createAndWait(params, unbounded) {
|
|
390
|
-
const options = deadline(unbounded);
|
|
391
|
-
const node = await this.nodes.create(params, options);
|
|
392
|
-
return this.waitForOutcome(node.node_id, options);
|
|
393
|
-
}
|
|
394
|
-
async parse(params, options) {
|
|
395
|
-
const outcome = await this.createAndWait({
|
|
396
|
-
...params,
|
|
397
|
-
...(params.parent == null && params.root_lifecycle === undefined ? { root_lifecycle: 'terminal' } : {}),
|
|
398
|
-
}, options);
|
|
399
|
-
if (outcome.kind === 'result') {
|
|
400
|
-
return { ...outcome, output_parsed: outcome.structured_result };
|
|
401
|
-
}
|
|
402
|
-
return { ...outcome, output_parsed: null };
|
|
403
|
-
}
|
|
404
208
|
/** Runs `operation` with the connection token, refreshing it once after a 401. `options` carries the call's one
|
|
405
209
|
* deadline (resolved by `deadline`): the token fetch, the refresh and every attempt share it, and `operation`
|
|
406
210
|
* receives the options with the deadline resolved. */
|
|
@@ -448,23 +252,6 @@ async function responseError(response) {
|
|
|
448
252
|
}
|
|
449
253
|
return new APIError(response.status, error?.code ?? 'invalid_response', error?.message ?? `HTTP ${response.status}`, error?.details, response.headers, error);
|
|
450
254
|
}
|
|
451
|
-
function serializeCreate(params) {
|
|
452
|
-
const { output_schema, ...rest } = params;
|
|
453
|
-
const independentRoot = rest.parent === undefined && rest.root === undefined ? { root: true } : {};
|
|
454
|
-
if (output_schema === undefined)
|
|
455
|
-
return { ...independentRoot, ...rest };
|
|
456
|
-
return {
|
|
457
|
-
...independentRoot,
|
|
458
|
-
...rest,
|
|
459
|
-
output_schema: typeof output_schema === 'string' ? output_schema : JSON.stringify(resolveJsonSchema(output_schema)),
|
|
460
|
-
};
|
|
461
|
-
}
|
|
462
|
-
function messageBody(body) {
|
|
463
|
-
if (typeof body === 'string')
|
|
464
|
-
return { body };
|
|
465
|
-
const { from: _from, ...request } = body;
|
|
466
|
-
return request;
|
|
467
|
-
}
|
|
468
255
|
function withQuery(path, query) {
|
|
469
256
|
if (query === undefined)
|
|
470
257
|
return path;
|
|
@@ -476,41 +263,6 @@ function withQuery(path, query) {
|
|
|
476
263
|
const suffix = search.toString();
|
|
477
264
|
return suffix === '' ? path : `${path}?${suffix}`;
|
|
478
265
|
}
|
|
479
|
-
function connectStatus(instructions) {
|
|
480
|
-
return { connected: false, daemon: null, model: null, next_step: 'connect', instructions };
|
|
481
|
-
}
|
|
482
|
-
function connectCommand(params) {
|
|
483
|
-
const selectors = [
|
|
484
|
-
['profile', params.profile],
|
|
485
|
-
['cwd', params.cwd],
|
|
486
|
-
['kind', params.kind],
|
|
487
|
-
['model', params.model],
|
|
488
|
-
].flatMap(([name, value]) => value === undefined ? [] : [`--${name}`, shellArgument(value)]);
|
|
489
|
-
return ['crtr', 'sys', 'connect', ...selectors].join(' ');
|
|
490
|
-
}
|
|
491
|
-
function shellArgument(value) {
|
|
492
|
-
if (/^[A-Za-z0-9_./:-]+$/.test(value))
|
|
493
|
-
return value;
|
|
494
|
-
return `'${value.replaceAll("'", String.fromCharCode(39, 34, 39, 34, 39))}'`;
|
|
495
|
-
}
|
|
496
|
-
async function socketIsReachable(socketPath) {
|
|
497
|
-
const load = new Function('specifier', 'return import(specifier)');
|
|
498
|
-
const [{ createConnection }, { defaultSocketPath }] = await Promise.all([
|
|
499
|
-
load('node:net'),
|
|
500
|
-
load('@north-light/api/node'),
|
|
501
|
-
]);
|
|
502
|
-
const path = socketPath ?? defaultSocketPath();
|
|
503
|
-
return new Promise((resolve) => {
|
|
504
|
-
const socket = createConnection({ path });
|
|
505
|
-
const finish = (reachable) => {
|
|
506
|
-
socket.destroy();
|
|
507
|
-
resolve(reachable);
|
|
508
|
-
};
|
|
509
|
-
socket.once('connect', () => finish(true));
|
|
510
|
-
socket.once('error', () => finish(false));
|
|
511
|
-
socket.setTimeout(100, () => finish(false));
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
266
|
function nodeEnvironment() {
|
|
515
267
|
return isNodeRuntime() ? process.env : {};
|
|
516
268
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
export { Crouter as default, Crouter } from './client.js';
|
|
2
2
|
export type { AppClient, CrouterOptions, OwnerOnly } from './client.js';
|
|
3
|
-
export { NodeStream } from './resources/node-stream.js';
|
|
4
3
|
export { RunStream } from './resources/run-stream.js';
|
|
5
4
|
export { CustomObjects } from './resources/custom-objects.js';
|
|
6
5
|
export type { CustomDeliveryStream, ReceiveOptions } from './resources/custom-objects.js';
|
|
7
|
-
export type { RunEvent,
|
|
6
|
+
export type { RunEvent, RunEventOf, RunEventType, UnknownRunEvent } from './resources/run-stream.js';
|
|
8
7
|
export { RunReply } from './resources/run-reply.js';
|
|
9
8
|
export type { RunReplyCollectOptions, RunReplyEnding, RunReplyEvent, RunReplyResult, SentRunMessage } from './resources/run-reply.js';
|
|
10
9
|
export type { AppProfile, RunActivity, RunDeleteResult, RunObject, RunParsedOutcome, RunParseOptions, RunParseParams, RunRecap, RunStartParams, RunStartResult, RunStatus, RunTrace } from './resources/runs.js';
|
|
@@ -20,7 +19,7 @@ export type { SpendLimits } from './resources/spend-limits.js';
|
|
|
20
19
|
export type { MemoryDocument, MemoryGetParams, MemoryListItem, MemoryListPage, MemoryListParams } from './resources/memory.js';
|
|
21
20
|
export type { Question, QuestionAnswered, QuestionCanceled, QuestionFields, QuestionKind, QuestionResponses, QuestionSlot, QuestionStatus } from './resources/questions.js';
|
|
22
21
|
export type { ProviderToolEntry } from './resources/providers.js';
|
|
23
|
-
export { OAuth2Client, ConnectedCrouter,
|
|
22
|
+
export { OAuth2Client, ConnectedCrouter, MemoryConnectionStore, profileFromClaims } from './oauth/index.js';
|
|
24
23
|
export { authorizationRefusalOf, refusalOf } from './oauth/index.js';
|
|
25
24
|
export type { AuthorizationRefusal, RefreshFailure, Refusal, RefusalKind } from './oauth/index.js';
|
|
26
25
|
export { RunWatcher } from './resources/run-watcher.js';
|
|
@@ -36,9 +35,6 @@ export { INFERENCE_SCOPE, inferenceEndpoint } from './resources/inference-endpoi
|
|
|
36
35
|
export type { InferenceEndpointOptions, InferenceRung, InferenceSettlement, SettlementStore } from './resources/inference-endpoint.js';
|
|
37
36
|
export { RUN_NOTICE_SCOPE, RunNoticeError, verifyRunNotice } from './resources/run-notice.js';
|
|
38
37
|
export type { RunNotice, VerifyRunNoticeOptions } from './resources/run-notice.js';
|
|
39
|
-
export type { NodeStreamEvent, NodeStreamEventListener, NodeStreamEventType } from './resources/node-stream.js';
|
|
40
|
-
export { describeToolDefault, followActivity } from './resources/activity.js';
|
|
41
|
-
export type { ActivityStep, DescribeTool } from './resources/activity.js';
|
|
42
38
|
export { APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, AuthenticationError, BadRequestError, ConflictError, CrouterError, DeadlineExceededError, InternalServerError, NoHostedRuntimeError, NotGrantedError, NotFoundError, PermissionDeniedError, RateLimitError, RuntimeVersionError, UnprocessableEntityError, mapError, } from './errors.js';
|
|
43
39
|
export type { DeadlineDetails, RuntimeVersionDetails } from './errors.js';
|
|
44
40
|
export type { CapExhaustedDetails } from '@north-light/api';
|
|
@@ -46,5 +42,5 @@ export { SDK_VERSION } from './version.js';
|
|
|
46
42
|
export { setupLink } from './setup-link.js';
|
|
47
43
|
export { sdkErrorCodes } from './error-codes.js';
|
|
48
44
|
export type { SdkErrorCode } from './error-codes.js';
|
|
49
|
-
export type {
|
|
45
|
+
export type { JsonSchema, OutputSchema, RequestOptions, SchemaOutput } from './types.js';
|
|
50
46
|
export type * from '@north-light/api';
|