@oddington/sdk 0.1.40 → 0.1.42

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.
@@ -175,8 +175,8 @@ type Result<Schemas extends Catalogue, Query extends RecordsQuery> = Widened<Que
175
175
  };
176
176
  type Checked<Schemas extends Catalogue, Query> = Widened<Query> extends true ? unknown : CheckQuery<Schemas, Query>;
177
177
  type SchemaRepository<Schemas extends Catalogue> = Omit<DataRepository, 'records'> & {
178
- records: Omit<DataRepository['records'], 'select' | 'pages' | 'all'> & {
179
- select<const Query extends RecordsQuery>(query: Query & Checked<Schemas, Query>): Promise<Result<Schemas, Query>>;
178
+ records: Omit<DataRepository['records'], 'query' | 'pages' | 'all'> & {
179
+ query<const Query extends RecordsQuery>(query: Query & Checked<Schemas, Query>): Promise<Result<Schemas, Query>>;
180
180
  pages<const Query extends RecordsQuery>(query: Query & Checked<Schemas, Query>): AsyncIterable<Result<Schemas, Query>>;
181
181
  all<const Query extends RecordsQuery>(query: Query & Checked<Schemas, Query>, options: {
182
182
  maxRecords: number;
@@ -5,6 +5,7 @@ export declare const schema: import('./routine-definition-types.js').RoutineSche
5
5
  export declare const file: import('./routine-definition-types.js').RoutineFileSchema;
6
6
  export { AIError, RoutineAIError } from '../../../shared/routine-ai-contract.js';
7
7
  export type { RoutineAIOutputIssue } from '../../../shared/routine-ai-output-detail.js';
8
+ export type { RoutineAIErrorDetail } from '../../../shared/routine-ai-error-detail.js';
8
9
  export { InboxContractError, asksBlock, continueAsk, defineHandler, fileBlock, question, recordBlock, recordsBlock, resolveAsk, respond, richTextBlock, selection, } from '../../../shared/inbox-contract.js';
9
10
  export type { AskInput, AuthoredSource, CapturedRecords, DigestInput, Handler, HandlerReference, HandlerRuntime, HandlerTransition, InboxBlock, InboxFile, JsonObject, JsonValue, PresentedField, PresentedRecord, PresentedRecordSummary, PublishedAsk, PublishedDigest, PublishedView, PublicationRequest, Question, QuestionInput, QuestionResponse, RecordCreate, RecordDelete, RecordReference, RecordSource, RecordUpdate, RepositoryCapabilities, RepositoryReceipt, Resolution, ResolutionInput, ResponseDefinition, } from '../../../shared/inbox-contract.js';
10
11
  export type { CapturedRecordTableInput, RecordField, RecordTableInput, RecordValue, RecordViewInput, TableColumn, ViewRecord, } from '../../../shared/inbox-views.js';
@@ -152,6 +153,10 @@ export type StepDetail = {
152
153
  status: 'pending' | 'running' | 'completed' | 'failed' | 'skipped';
153
154
  startedAt?: string;
154
155
  finishedAt?: string;
156
+ progress?: {
157
+ completed: number;
158
+ total: number;
159
+ };
155
160
  summary?: unknown;
156
161
  data?: unknown;
157
162
  };
@@ -20,6 +20,7 @@ export type RoutineAI = {
20
20
  generateText(input: {
21
21
  instructions: string;
22
22
  input: RoutineAIInput;
23
+ tools?: boolean;
23
24
  }): Promise<{
24
25
  text: string;
25
26
  }>;
@@ -28,6 +29,7 @@ export type RoutineAI = {
28
29
  instructions: string;
29
30
  input: RoutineAIInput;
30
31
  schema: Schema;
32
+ tools?: boolean;
31
33
  }): Promise<{
32
34
  object: RoutineSchemaValue<Schema>;
33
35
  }>;
@@ -72,6 +74,11 @@ type ConnectionName<Access extends RoutineAccess> = Access['connections'] extend
72
74
  export type RoutineCapabilities<Access extends RoutineAccess> = {
73
75
  readonly run: {
74
76
  readonly id: string;
77
+ /** Report completed work that OS capabilities and Step boundaries cannot observe. */
78
+ progress(value: {
79
+ completed: number;
80
+ total: number;
81
+ }): Promise<void>;
75
82
  };
76
83
  readonly ai: Access['ai'] extends true ? RoutineAI : {};
77
84
  readonly data: {
@@ -211,7 +211,7 @@ export interface DataRepository {
211
211
  schema(name: string): Promise<CollectionSchema>;
212
212
  };
213
213
  records: {
214
- select<Query extends RecordsQuery>(query: Query): Promise<RecordsResult<Query>>;
214
+ query<Query extends RecordsQuery>(query: Query): Promise<RecordsResult<Query>>;
215
215
  pages<Query extends RecordsQuery>(query: Query): AsyncIterable<RecordsResult<Query>>;
216
216
  all<Query extends RecordsQuery>(query: Query, options: {
217
217
  maxRecords: number;
@@ -46,12 +46,19 @@ declare const fileValidationReasons: {
46
46
  invalid_size: string;
47
47
  invalid_request_key: string;
48
48
  invalid_enrichment_name: string;
49
+ invalid_enrichment_request: string;
49
50
  invalid_replacement: string;
50
51
  invalid_bytes: string;
51
52
  original_changed: string;
52
53
  };
54
+ declare const localStorageReasons: {
55
+ local_storage_legacy: string;
56
+ local_storage_ambiguous: string;
57
+ local_storage_unrecognized: string;
58
+ local_storage_tracked: string;
59
+ };
53
60
  export type FileErrorDetail = {
54
- reason: keyof typeof fileValidationReasons | 'size_mismatch' | 'size_limit';
61
+ reason: keyof typeof fileValidationReasons | keyof typeof localStorageReasons | 'size_mismatch' | 'size_limit';
55
62
  expectedBytes?: number;
56
63
  receivedBytes?: number;
57
64
  limitBytes?: number;
@@ -60,8 +67,15 @@ export type FileErrorDetail = {
60
67
  /** Only inert, bounded facts cross Files and Run error boundaries. */
61
68
  export declare function parseFileErrorDetail(value: unknown): FileErrorDetail | undefined;
62
69
  export declare function fileErrorExplanation(detail: FileErrorDetail): string;
70
+ export declare function fileErrorDetailForCode(code: FileErrorCode, detail: unknown): FileErrorDetail | undefined;
63
71
  export declare const FILE_CAPACITY_MESSAGE: string;
64
72
  export declare const FILE_INTEGRITY_MESSAGE: string;
73
+ /** Shared SDK and terminal copy is derived only from bounded error facts. */
74
+ export declare function fileErrorMessage(error: {
75
+ code: FileErrorCode;
76
+ retryable?: boolean;
77
+ detail?: unknown;
78
+ }): string;
65
79
  export declare class FileOperationError extends Error {
66
80
  readonly code: FileErrorCode;
67
81
  readonly status: number;
@@ -1,6 +1,6 @@
1
1
  import { type AppValueSchema } from './app-routine-contract.js';
2
2
  import { type File } from './files-contract.js';
3
- import { type RoutineAIOutputIssue } from './routine-ai-output-detail.js';
3
+ import { type RoutineAIErrorDetail } from './routine-ai-error-detail.js';
4
4
  /** Requests use the Run value bound; final answers use the same UTF-8 byte ceiling.
5
5
  * Raw Files have no universal AI byte cap: adapters must measure their final
6
6
  * encoded request against their own transport limit before dispatch. */
@@ -14,10 +14,10 @@ export type RoutineAIErrorCode = typeof ROUTINE_AI_ERROR_CODES[number];
14
14
  /** The original answer is explicit recovery data, never part of the message or JSON logging. */
15
15
  export declare class AIError extends Error {
16
16
  readonly code: RoutineAIErrorCode;
17
- readonly detail?: RoutineAIOutputIssue;
17
+ readonly detail?: RoutineAIErrorDetail;
18
18
  readonly text?: string;
19
19
  constructor(code: RoutineAIErrorCode, options?: {
20
- detail?: RoutineAIOutputIssue;
20
+ detail?: RoutineAIErrorDetail;
21
21
  text?: string;
22
22
  });
23
23
  }
@@ -26,7 +26,7 @@ export { AIError as RoutineAIError };
26
26
  /** Explicit private transport projection; ordinary error logging excludes answer text. */
27
27
  export declare function routineAIErrorFacts(error: AIError): {
28
28
  code: "access_denied" | "cancelled" | "capability_unavailable" | "file_unavailable" | "input_too_large" | "invalid_input" | "invalid_output" | "output_too_large" | "provider_failure" | "unsupported_file";
29
- detail?: RoutineAIOutputIssue | undefined;
29
+ detail?: RoutineAIErrorDetail | undefined;
30
30
  text?: string | undefined;
31
31
  };
32
32
  export declare function parseRoutineAIError(value: unknown): AIError;
@@ -35,10 +35,12 @@ export type RoutineAIRequest = {
35
35
  kind: 'generateText';
36
36
  instructions: string;
37
37
  input: RoutineAIInput;
38
+ tools?: boolean;
38
39
  } | {
39
40
  kind: 'generateObject';
40
41
  instructions: string;
41
42
  input: RoutineAIInput;
43
+ tools?: boolean;
42
44
  schema: AppValueSchema;
43
45
  };
44
46
  /** Keep the existing successful transport shapes for deployed SDK compatibility. */
@@ -0,0 +1,19 @@
1
+ import type { RoutineAIErrorCode } from './routine-ai-contract.js';
2
+ import { type RoutineAIOutputIssue } from './routine-ai-output-detail.js';
3
+ export type RoutineAIErrorDetail = RoutineAIOutputIssue | {
4
+ reason: 'turn_limit';
5
+ limit: number;
6
+ } | {
7
+ reason: 'runner_exit';
8
+ exitCode?: number;
9
+ } | {
10
+ reason: 'runner_error' | 'invalid_runner_response' | 'unexpected_runner_configuration';
11
+ } | {
12
+ reason: 'invalid_tools' | 'tools_require_file';
13
+ } | {
14
+ reason: 'unsupported_media_type';
15
+ mediaType: string;
16
+ };
17
+ /** Diagnostics are finite facts, never runner logs, model text or rejected values. */
18
+ export declare function parseRoutineAIErrorDetail(code: RoutineAIErrorCode, value: unknown): RoutineAIErrorDetail | undefined;
19
+ export declare function routineAIErrorMessage(code: RoutineAIErrorCode, value?: unknown): string;
@@ -5,6 +5,8 @@ export type RoutineAIOutputIssue = RoutineSchemaIssue | {
5
5
  reason: 'invalid_response';
6
6
  } | {
7
7
  reason: 'empty_text';
8
+ } | {
9
+ reason: 'structured_output_limit';
8
10
  };
9
11
  /** Public explanations carry schema facts and types, never model values or unknown field names. */
10
12
  export declare function parseRoutineAIOutputIssue(value: unknown): RoutineAIOutputIssue | undefined;
@@ -18,7 +18,7 @@ export type RoutineDeclaration = {
18
18
  runtime: {
19
19
  features: [];
20
20
  resources: 'standard';
21
- maxDuration: '15m';
21
+ maxDuration: '15m' | '60m';
22
22
  };
23
23
  retry: {
24
24
  maxAttempts: 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oddington/sdk",
3
- "version": "0.1.40",
3
+ "version": "0.1.42",
4
4
  "description": "OS routine and response-handler SDK",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",