@crouter/sdk 0.3.382 → 0.3.383

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/client.d.ts CHANGED
@@ -13,6 +13,7 @@ import { Questions } from './resources/questions.js';
13
13
  import { Providers } from './resources/providers.js';
14
14
  import { Runs } from './resources/runs.js';
15
15
  import { Shares } from './resources/shares.js';
16
+ import { StructuredRequests } from './resources/structured-requests.js';
16
17
  import { Memory } from './resources/memory.js';
17
18
  import { Uploads } from './resources/uploads.js';
18
19
  import type { AuthStatus, AuthStatusParams, CancelParams, EnsureProfileParams, MessageParams, NodeCreateParams, NodeEventsOptions, NodeOutcomeOptions, OutputSchema, ParsedOutcome, RequestOptions, SchemaOutput } from './types.js';
@@ -75,6 +76,8 @@ export declare class Crouter {
75
76
  readonly canvas: Canvas;
76
77
  /** Scheduled commands. */
77
78
  readonly crons: Crons;
79
+ /** Durable structured requests with deadlines and one settlement. */
80
+ readonly structuredRequests: StructuredRequests;
78
81
  /** Register, publish, receive, and acknowledge custom canvas objects. */
79
82
  readonly customObjects: CustomObjects;
80
83
  /** Human requests and the human inbox. */
package/dist/client.js CHANGED
@@ -15,6 +15,7 @@ import { Questions } from './resources/questions.js';
15
15
  import { Providers } from './resources/providers.js';
16
16
  import { Runs } from './resources/runs.js';
17
17
  import { Shares } from './resources/shares.js';
18
+ import { StructuredRequests } from './resources/structured-requests.js';
18
19
  import { Memory } from './resources/memory.js';
19
20
  import { Uploads } from './resources/uploads.js';
20
21
  import { resolveJsonSchema } from './schema.js';
@@ -34,6 +35,8 @@ export class Crouter {
34
35
  canvas;
35
36
  /** Scheduled commands. */
36
37
  crons;
38
+ /** Durable structured requests with deadlines and one settlement. */
39
+ structuredRequests;
37
40
  /** Register, publish, receive, and acknowledge custom canvas objects. */
38
41
  customObjects;
39
42
  /** Human requests and the human inbox. */
@@ -182,6 +185,7 @@ export class Crouter {
182
185
  this.bash = new Bash(request, this.timeout);
183
186
  this.canvas = new Canvas(request);
184
187
  this.crons = new Crons(request);
188
+ this.structuredRequests = new StructuredRequests(request);
185
189
  this.customObjects = new CustomObjects(request, (path, options) => this.openCustomDeliveries(path, options));
186
190
  this.human = new Human(request);
187
191
  this.models = new Models(request);
@@ -0,0 +1,14 @@
1
+ import type { CreateStructuredRequest, CreateStructuredRequestResponse, StructuredRequestDTO } from '@crouter/api';
2
+ import type { RequestOptions } from '../types.js';
3
+ import type { Request } from './request.js';
4
+ /** Durable structured requests: a schema-bound question to a new or existing node, settled once. */
5
+ export declare class StructuredRequests {
6
+ private readonly request;
7
+ constructor(request: Request);
8
+ create(body: CreateStructuredRequest, options?: RequestOptions): Promise<CreateStructuredRequestResponse>;
9
+ /** `wait` (0–25 seconds) long-polls until the request settles. */
10
+ retrieve(requestId: string, query?: {
11
+ wait?: number;
12
+ }, options?: RequestOptions): Promise<StructuredRequestDTO>;
13
+ cancel(requestId: string, options?: RequestOptions): Promise<StructuredRequestDTO>;
14
+ }
@@ -0,0 +1,19 @@
1
+ import { pathSegment } from './identifiers.js';
2
+ import { withQuery } from './request.js';
3
+ /** Durable structured requests: a schema-bound question to a new or existing node, settled once. */
4
+ export class StructuredRequests {
5
+ request;
6
+ constructor(request) {
7
+ this.request = request;
8
+ }
9
+ create(body, options) {
10
+ return this.request('POST', '/v1/structured-requests', body, options);
11
+ }
12
+ /** `wait` (0–25 seconds) long-polls until the request settles. */
13
+ retrieve(requestId, query, options) {
14
+ return this.request('GET', withQuery(`/v1/structured-requests/${pathSegment(requestId, 'request id')}`, query), undefined, options);
15
+ }
16
+ cancel(requestId, options) {
17
+ return this.request('POST', `/v1/structured-requests/${pathSegment(requestId, 'request id')}/cancel`, {}, options);
18
+ }
19
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crouter/sdk",
3
- "version": "0.3.382",
3
+ "version": "0.3.383",
4
4
  "description": "Typed Node and browser client for running crouter agents through the crtrd /v1 API.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -31,8 +31,8 @@
31
31
  "build": "tsc -p tsconfig.json && chmod 755 dist/keygen-cli.js"
32
32
  },
33
33
  "dependencies": {
34
- "@crouter/api": "^0.3.382",
35
- "@crouter/identity": "^0.3.382",
34
+ "@crouter/api": "^0.3.383",
35
+ "@crouter/identity": "^0.3.383",
36
36
  "jose": "^6.2.1"
37
37
  },
38
38
  "peerDependencies": {