@oddington/sdk 0.1.34 → 0.1.36
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 +26 -7
- package/dist/browser.js +410 -303
- package/dist/index.js +8 -3
- package/dist/types/packages/sdk/src/public.d.ts +4 -26
- package/dist/types/packages/sdk/src/routine-definition-types.d.ts +1 -0
- package/dist/types/shared/app-routine-contract.d.ts +10 -1
- package/dist/types/shared/files-contract.d.ts +30 -1
- package/dist/types/shared/routine-ai-contract.d.ts +20 -6
- package/dist/types/shared/routine-ai-output-detail.d.ts +11 -0
- package/dist/types/shared/routine-deployment-contract.d.ts +4 -4
- package/package.json +1 -1
- package/dist/types/shared/record-write.d.ts +0 -33
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import type { AskInput,
|
|
1
|
+
import type { AskInput, DigestInput, InboxFile, PublicationRequest, PublishedAsk, PublishedDigest, ResolutionInput } from '../../../shared/inbox-contract.js';
|
|
2
2
|
import type { FileAddOptions } from '../../../shared/inbox-files.js';
|
|
3
|
-
import type { RecordReadInput } from '../../../shared/record-capture.js';
|
|
4
|
-
import type { RecordDeleteRequest, RecordUpdateRequest, RecordWriteRequest } from '../../../shared/record-write.js';
|
|
5
3
|
export type { RoutineSchema, RoutineSchemaValue, RoutineDefinition, RoutineInput, RoutineRuntime, RoutineAccess, RoutineCapabilities, RoutineStep, RoutineSteps, RoutineStepInput, RoutineStepResult, RoutineStepOutput, RoutineArtifactInput, RoutineArtifact, RoutineAI } from './routine-definition-types.js';
|
|
6
4
|
export declare const defineRoutine: import('./routine-definition-types.js').DefineRoutine;
|
|
7
5
|
export declare const schema: import('./routine-definition-types.js').RoutineSchemaBuilders;
|
|
8
6
|
export declare const file: import('./routine-definition-types.js').RoutineFileSchema;
|
|
7
|
+
export { RoutineAIError } from '../../../shared/routine-ai-contract.js';
|
|
8
|
+
export type { RoutineAIOutputIssue } from '../../../shared/routine-ai-output-detail.js';
|
|
9
9
|
export { InboxContractError, asksBlock, continueAsk, defineHandler, fileBlock, question, recordBlock, recordsBlock, resolveAsk, respond, richTextBlock, selection, } from '../../../shared/inbox-contract.js';
|
|
10
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';
|
|
11
11
|
export type { CapturedRecordTableInput, RecordField, RecordTableInput, RecordValue, RecordViewInput, TableColumn, ViewRecord, } from '../../../shared/inbox-views.js';
|
|
12
12
|
export type { FileAddOptions } from '../../../shared/inbox-files.js';
|
|
13
|
-
export type { RecordReadInput } from '../../../shared/record-capture.js';
|
|
14
|
-
export type { RecordDeleteRequest, RecordUpdateRequest, RecordWriteRequest } from '../../../shared/record-write.js';
|
|
15
|
-
export { RoutineRecordWriteError } from '../../../shared/record-write.js';
|
|
16
13
|
export { AirtableOperationError } from '../../../shared/airtable-contract.js';
|
|
17
14
|
export type { AirtableField, AirtableTable, AirtableRecord, AirtableListInput, AirtableGetInput, AirtableCreateInput, AirtableUpdateInput, AirtableDeleteInput, AirtableReceipt, AirtableWriteResult, AirtableClient } from '../../../shared/airtable-contract.js';
|
|
18
15
|
export type { GmailRuntimeConnection, AirtableRuntimeConnection, DropboxRuntimeConnection, RuntimeConnection } from '../../../shared/connection-runtime.js';
|
|
@@ -40,7 +37,7 @@ export { InboxOperationError } from '../../../shared/inbox-member-contract.js';
|
|
|
40
37
|
export type { InboxMember, InboxCurrent, InboxItem, AnswerableQuestion, QuestionSnapshot, ResponseConsequence, LinkedAskSnapshot, AskUpdate, DigestReadConfirmation, RecipientCandidate, RecipientAddition, ResponseAcceptance, InboxAnswerInput, InboxSearchInput } from '../../../shared/inbox-member-types.js';
|
|
41
38
|
export type { RecordSelectionResult } from '../../../shared/record-selection.js';
|
|
42
39
|
export declare const inbox: import('../../../shared/inbox-member-types.js').InboxMember;
|
|
43
|
-
export type { File, FileInput, FileStorage, FileCreateInput, FileCreateOptions, FileEnrichment, FileEnrichOptions, FileEnrichResult, FileErrorCode } from '../../../shared/files-contract.js';
|
|
40
|
+
export type { File, FileInput, FileStorage, FileCreateInput, FileCreateOptions, FileEnrichment, FileEnrichOptions, FileEnrichResult, FileErrorCode, FileErrorDetail } from '../../../shared/files-contract.js';
|
|
44
41
|
export declare const files: {
|
|
45
42
|
create(input: import('../../../shared/files-contract.js').FileCreateInput, options?: import('../../../shared/files-contract.js').FileCreateOptions): Promise<import('../../../shared/files-contract.js').File>;
|
|
46
43
|
get(id: string): Promise<import('../../../shared/files-contract.js').File>;
|
|
@@ -222,25 +219,6 @@ export type RoutinePublicationClient = {
|
|
|
222
219
|
requestKey: string;
|
|
223
220
|
}): Promise<PublishedDigest>;
|
|
224
221
|
publishResolution(askId: string, value: ResolutionInput): Promise<void>;
|
|
225
|
-
readRecords(input: RecordReadInput): Promise<CapturedRecords>;
|
|
226
|
-
repository: {
|
|
227
|
-
readRecords(input: RecordReadInput): Promise<CapturedRecords>;
|
|
228
|
-
updateRecords(input: RecordUpdateRequest, options: {
|
|
229
|
-
requestKey: string;
|
|
230
|
-
}): Promise<{
|
|
231
|
-
receipt: RepositoryReceipt;
|
|
232
|
-
}>;
|
|
233
|
-
writeRecords(input: RecordWriteRequest, options: {
|
|
234
|
-
requestKey: string;
|
|
235
|
-
}): Promise<{
|
|
236
|
-
receipt: RepositoryReceipt;
|
|
237
|
-
}>;
|
|
238
|
-
deleteRecords(input: RecordDeleteRequest, options: {
|
|
239
|
-
requestKey: string;
|
|
240
|
-
}): Promise<{
|
|
241
|
-
receipt: RepositoryReceipt;
|
|
242
|
-
}>;
|
|
243
|
-
};
|
|
244
222
|
files: {
|
|
245
223
|
add(value: FileAddOptions): Promise<InboxFile>;
|
|
246
224
|
};
|
|
@@ -23,6 +23,7 @@ export type RoutineAI = {
|
|
|
23
23
|
}): Promise<{
|
|
24
24
|
text: string;
|
|
25
25
|
}>;
|
|
26
|
+
/** Invalid output throws a catchable RoutineAIError with the original answer. */
|
|
26
27
|
generateObject<Schema extends RoutineSchema<unknown>>(input: {
|
|
27
28
|
instructions: string;
|
|
28
29
|
input: RoutineAIInput;
|
|
@@ -49,7 +49,16 @@ export declare class AppRoutineContractError extends Error {
|
|
|
49
49
|
export declare function isAppRoutineName(value: unknown): value is string;
|
|
50
50
|
/** One operation owns the property budget across input, result and all summaries. */
|
|
51
51
|
export declare function parseAppRoutineContract(value: unknown): AppRoutineContract;
|
|
52
|
-
export
|
|
52
|
+
export type RoutineSchemaIssue = {
|
|
53
|
+
reason: 'missing_field' | 'unexpected_field' | 'wrong_type' | 'out_of_bounds' | 'invalid_file';
|
|
54
|
+
path: string;
|
|
55
|
+
expected: AppValueSchema['type'];
|
|
56
|
+
received: 'missing' | 'null' | 'object' | 'array' | 'boolean' | 'string' | 'number' | 'other';
|
|
57
|
+
constraint?: 'maxLength' | 'maxItems' | 'minimum' | 'maximum';
|
|
58
|
+
limit?: number;
|
|
59
|
+
};
|
|
60
|
+
/** The optional observer explains the existing rejection; it never accepts or repairs a value. */
|
|
61
|
+
export declare function validateRoutineSchemaValue(schema: AppValueSchema, value: unknown, rejected?: (issue: RoutineSchemaIssue) => void): void;
|
|
53
62
|
/** Structural validation grants no execution or File-use authority. Values stay unchanged. */
|
|
54
63
|
export declare function validateAppRoutineInput(contract: AppRoutineContract, value: unknown): void;
|
|
55
64
|
export declare function validateAppRoutineResult(contract: AppRoutineContract, value?: unknown): void;
|
|
@@ -37,12 +37,40 @@ export type File = {
|
|
|
37
37
|
enrichments: Record<string, FileEnrichment>;
|
|
38
38
|
};
|
|
39
39
|
export type FileErrorCode = 'invalid_input' | 'unsupported_context' | 'unauthenticated' | 'access_denied' | 'request_too_large' | 'conflict' | 'local_only' | 'integrity' | 'unavailable' | 'capacity' | 'method_not_allowed';
|
|
40
|
+
declare const fileValidationReasons: {
|
|
41
|
+
invalid_metadata: string;
|
|
42
|
+
invalid_name: string;
|
|
43
|
+
invalid_path: string;
|
|
44
|
+
invalid_storage: string;
|
|
45
|
+
invalid_media_type: string;
|
|
46
|
+
invalid_size: string;
|
|
47
|
+
invalid_request_key: string;
|
|
48
|
+
invalid_enrichment_name: string;
|
|
49
|
+
invalid_replacement: string;
|
|
50
|
+
invalid_bytes: string;
|
|
51
|
+
};
|
|
52
|
+
export type FileErrorDetail = {
|
|
53
|
+
reason: keyof typeof fileValidationReasons | 'size_mismatch' | 'size_limit';
|
|
54
|
+
expectedBytes?: number;
|
|
55
|
+
receivedBytes?: number;
|
|
56
|
+
limitBytes?: number;
|
|
57
|
+
receivedAtLeast?: true;
|
|
58
|
+
};
|
|
59
|
+
/** Only inert, bounded facts cross Files and Run error boundaries. */
|
|
60
|
+
export declare function parseFileErrorDetail(value: unknown): FileErrorDetail | undefined;
|
|
61
|
+
export declare function fileErrorExplanation(detail: FileErrorDetail): string;
|
|
40
62
|
export declare class FileOperationError extends Error {
|
|
41
63
|
readonly code: FileErrorCode;
|
|
42
64
|
readonly status: number;
|
|
43
65
|
readonly retryable: boolean;
|
|
44
|
-
|
|
66
|
+
readonly detail?: FileErrorDetail;
|
|
67
|
+
constructor(code: FileErrorCode, status: number, retryable?: boolean, detail?: FileErrorDetail);
|
|
45
68
|
}
|
|
69
|
+
export declare function fileErrorFacts(error: FileOperationError): {
|
|
70
|
+
code: FileErrorCode;
|
|
71
|
+
retryable?: boolean | undefined;
|
|
72
|
+
detail?: FileErrorDetail | undefined;
|
|
73
|
+
};
|
|
46
74
|
export declare const FILE_ID_PATTERN: RegExp;
|
|
47
75
|
/** Descriptor admission is independent of each runtime's supported writes. */
|
|
48
76
|
export declare const FILE_ORIGINAL_MAX_BYTES: number;
|
|
@@ -74,3 +102,4 @@ export type FileCreateMetadata = {
|
|
|
74
102
|
requestKey: string;
|
|
75
103
|
};
|
|
76
104
|
export declare function parseFileCreateMetadata(value: unknown, maxBytes: number): FileCreateMetadata;
|
|
105
|
+
export {};
|
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
import { type AppValueSchema } from './app-routine-contract.js';
|
|
2
2
|
import { type File } from './files-contract.js';
|
|
3
|
-
|
|
3
|
+
import { type RoutineAIOutputIssue } from './routine-ai-output-detail.js';
|
|
4
|
+
/** Requests use the Run value bound; final answers use the same UTF-8 byte ceiling.
|
|
4
5
|
* Raw Files have no universal AI byte cap: adapters must measure their final
|
|
5
6
|
* encoded request against their own transport limit before dispatch. */
|
|
6
7
|
export declare const ROUTINE_AI_VALUE_BYTES: number;
|
|
8
|
+
/** Worst-case JSON escaping is six bytes per UTF-8 answer byte, plus framing. */
|
|
9
|
+
export declare const ROUTINE_AI_RESULT_BYTES: number;
|
|
7
10
|
export declare const ROUTINE_AI_EVIDENCE_BYTES: number;
|
|
8
11
|
export declare const ROUTINE_AI_OPERATION_MS = 120000;
|
|
9
12
|
export declare const ROUTINE_AI_ERROR_CODES: readonly ['access_denied', 'capability_unavailable', 'invalid_input', 'unsupported_file', 'file_unavailable', 'input_too_large', 'output_too_large', 'provider_failure', 'invalid_output', 'cancelled'];
|
|
10
13
|
export type RoutineAIErrorCode = typeof ROUTINE_AI_ERROR_CODES[number];
|
|
11
|
-
/**
|
|
14
|
+
/** The original answer is explicit recovery data, never part of the message or JSON logging. */
|
|
12
15
|
export declare class RoutineAIError extends Error {
|
|
13
16
|
readonly code: RoutineAIErrorCode;
|
|
14
|
-
|
|
17
|
+
readonly detail?: RoutineAIOutputIssue;
|
|
18
|
+
readonly text?: string;
|
|
19
|
+
constructor(code: RoutineAIErrorCode, options?: {
|
|
20
|
+
detail?: RoutineAIOutputIssue;
|
|
21
|
+
text?: string;
|
|
22
|
+
});
|
|
15
23
|
}
|
|
16
|
-
/**
|
|
24
|
+
/** Explicit private transport projection; ordinary error logging excludes answer text. */
|
|
25
|
+
export declare function routineAIErrorFacts(error: RoutineAIError): {
|
|
26
|
+
code: "access_denied" | "cancelled" | "capability_unavailable" | "file_unavailable" | "input_too_large" | "invalid_input" | "invalid_output" | "output_too_large" | "provider_failure" | "unsupported_file";
|
|
27
|
+
detail?: RoutineAIOutputIssue | undefined;
|
|
28
|
+
text?: string | undefined;
|
|
29
|
+
};
|
|
17
30
|
export declare function parseRoutineAIError(value: unknown): RoutineAIError;
|
|
18
31
|
export type RoutineAIInput = string | File;
|
|
19
32
|
export type RoutineAIRequest = {
|
|
@@ -26,6 +39,7 @@ export type RoutineAIRequest = {
|
|
|
26
39
|
input: RoutineAIInput;
|
|
27
40
|
schema: AppValueSchema;
|
|
28
41
|
};
|
|
42
|
+
/** Keep the existing successful transport shapes for deployed SDK compatibility. */
|
|
29
43
|
export type RoutineAIResult = {
|
|
30
44
|
text: string;
|
|
31
45
|
} | {
|
|
@@ -34,7 +48,7 @@ export type RoutineAIResult = {
|
|
|
34
48
|
export type RoutineAITransport = (request: RoutineAIRequest) => Promise<RoutineAIResult>;
|
|
35
49
|
/** Inert schema grammar only. SDK builders must be resolved before transport. */
|
|
36
50
|
export declare function parseRoutineAIRequest(value: unknown): RoutineAIRequest;
|
|
37
|
-
/**
|
|
51
|
+
/** Delivery revalidates the existing result envelope and caller-supplied schema. */
|
|
38
52
|
export declare function parseRoutineAIResult(request: RoutineAIRequest, value: unknown): RoutineAIResult;
|
|
39
|
-
/** Native adapters discard reasoning and
|
|
53
|
+
/** Native adapters discard reasoning and preserve the original final text on rejection. */
|
|
40
54
|
export declare function acceptRoutineAIOutput(request: RoutineAIRequest, text: unknown): RoutineAIResult;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RoutineSchemaIssue } from './app-routine-contract.js';
|
|
2
|
+
export type RoutineAIOutputIssue = RoutineSchemaIssue | {
|
|
3
|
+
reason: 'invalid_json';
|
|
4
|
+
} | {
|
|
5
|
+
reason: 'invalid_response';
|
|
6
|
+
} | {
|
|
7
|
+
reason: 'empty_text';
|
|
8
|
+
};
|
|
9
|
+
/** Public explanations carry schema facts and types, never model values or unknown field names. */
|
|
10
|
+
export declare function parseRoutineAIOutputIssue(value: unknown): RoutineAIOutputIssue | undefined;
|
|
11
|
+
export declare function routineAIOutputMessage(issue: RoutineAIOutputIssue): string;
|
|
@@ -16,12 +16,12 @@ export type RoutineDeclaration = {
|
|
|
16
16
|
publish: Array<'asks' | 'digests'>;
|
|
17
17
|
};
|
|
18
18
|
runtime: {
|
|
19
|
-
features:
|
|
20
|
-
resources: 'standard'
|
|
21
|
-
maxDuration:
|
|
19
|
+
features: [];
|
|
20
|
+
resources: 'standard';
|
|
21
|
+
maxDuration: '15m';
|
|
22
22
|
};
|
|
23
23
|
retry: {
|
|
24
|
-
maxAttempts:
|
|
24
|
+
maxAttempts: 1;
|
|
25
25
|
};
|
|
26
26
|
assets: string[];
|
|
27
27
|
};
|
package/package.json
CHANGED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { type RecordCreate, type RecordDelete, type RecordUpdate } from './inbox-contract.js';
|
|
2
|
-
export type RecordWrite = RecordCreate | RecordUpdate;
|
|
3
|
-
export type RecordUpdateRequest = {
|
|
4
|
-
repository: string;
|
|
5
|
-
records: RecordUpdate[];
|
|
6
|
-
};
|
|
7
|
-
export type RecordWriteRequest = {
|
|
8
|
-
repository: string;
|
|
9
|
-
records: RecordWrite[];
|
|
10
|
-
};
|
|
11
|
-
export type RecordDeleteRequest = {
|
|
12
|
-
repository: string;
|
|
13
|
-
records: RecordDelete[];
|
|
14
|
-
};
|
|
15
|
-
export type RecordChange = RecordWrite | RecordDelete;
|
|
16
|
-
export type RecordChangeRequest = {
|
|
17
|
-
repository: string;
|
|
18
|
-
records: RecordChange[];
|
|
19
|
-
};
|
|
20
|
-
export type RoutineRecordWriteRequest = {
|
|
21
|
-
input: RecordChangeRequest;
|
|
22
|
-
requestKey: string;
|
|
23
|
-
};
|
|
24
|
-
export declare const RECORD_WRITE_INPUT_LIMIT: number;
|
|
25
|
-
export declare class RoutineRecordWriteError extends Error {
|
|
26
|
-
readonly effect: 'unapplied' | 'uncertain' | 'pending';
|
|
27
|
-
constructor(message: string, effect: 'unapplied' | 'uncertain' | 'pending');
|
|
28
|
-
}
|
|
29
|
-
export declare function validateRecordWrite(value: unknown): RecordWriteRequest;
|
|
30
|
-
export declare function validateRecordUpdate(value: unknown): RecordUpdateRequest;
|
|
31
|
-
export declare function validateRecordDelete(value: unknown): RecordDeleteRequest;
|
|
32
|
-
export declare function validateRecordChange(value: unknown): RecordChangeRequest;
|
|
33
|
-
export declare function validateRoutineRecordWrite(value: unknown): RoutineRecordWriteRequest;
|