@oddington/sdk 0.1.24 → 0.1.25
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/browser.js +156 -40
- package/dist/index.js +2 -2
- package/dist/types/packages/sdk/src/public.d.ts +2 -2
- package/dist/types/packages/sdk/src/routine-definition-types.d.ts +17 -0
- package/dist/types/shared/connection-runtime.d.ts +13 -2
- package/dist/types/shared/files-contract.d.ts +11 -2
- package/dist/types/shared/inbox-member-types.d.ts +2 -0
- package/dist/types/shared/routine-ai-contract.d.ts +40 -0
- package/dist/types/shared/routine-definition-contract.d.ts +1 -1
- package/dist/types/shared/routine-deployment-contract.d.ts +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import type { AskInput, CapturedRecords, DigestInput, InboxFile, PublicationRequ
|
|
|
2
2
|
import type { FileAddOptions } from '../../../shared/inbox-files.js';
|
|
3
3
|
import type { RecordReadInput } from '../../../shared/record-capture.js';
|
|
4
4
|
import type { RecordDeleteRequest, RecordUpdateRequest, RecordWriteRequest } from '../../../shared/record-write.js';
|
|
5
|
-
export type { RoutineSchema, RoutineSchemaValue, RoutineDefinition, RoutineInput, RoutineRuntime, RoutineAccess, RoutineCapabilities, RoutineStep, RoutineSteps, RoutineStepInput, RoutineStepResult, RoutineStepOutput, RoutineArtifactInput, RoutineArtifact } from './routine-definition-types.js';
|
|
5
|
+
export type { RoutineSchema, RoutineSchemaValue, RoutineDefinition, RoutineInput, RoutineRuntime, RoutineAccess, RoutineCapabilities, RoutineStep, RoutineSteps, RoutineStepInput, RoutineStepResult, RoutineStepOutput, RoutineArtifactInput, RoutineArtifact, RoutineAI } from './routine-definition-types.js';
|
|
6
6
|
export declare const defineRoutine: import('./routine-definition-types.js').DefineRoutine;
|
|
7
7
|
export declare const schema: import('./routine-definition-types.js').RoutineSchemaBuilders;
|
|
8
8
|
export declare const file: import('./routine-definition-types.js').RoutineFileSchema;
|
|
@@ -15,7 +15,7 @@ export type { RecordDeleteRequest, RecordUpdateRequest, RecordWriteRequest } fro
|
|
|
15
15
|
export { RoutineRecordWriteError } from '../../../shared/record-write.js';
|
|
16
16
|
export { AirtableOperationError } from '../../../shared/airtable-contract.js';
|
|
17
17
|
export type { AirtableField, AirtableTable, AirtableRecord, AirtableListInput, AirtableGetInput, AirtableCreateInput, AirtableUpdateInput, AirtableDeleteInput, AirtableReceipt, AirtableWriteResult, AirtableClient } from '../../../shared/airtable-contract.js';
|
|
18
|
-
export type { GmailRuntimeConnection, AirtableRuntimeConnection, RuntimeConnection } from '../../../shared/connection-runtime.js';
|
|
18
|
+
export type { GmailRuntimeConnection, AirtableRuntimeConnection, DropboxRuntimeConnection, RuntimeConnection } from '../../../shared/connection-runtime.js';
|
|
19
19
|
export type { Connections } from '../../../shared/airtable-contract.js';
|
|
20
20
|
export declare const connections: import('../../../shared/airtable-contract.js').Connections;
|
|
21
21
|
export { DataOperationError } from '../../../shared/data-contract.js';
|
|
@@ -6,6 +6,7 @@ import type { DataRepository } from '../../../shared/data-contract.js';
|
|
|
6
6
|
import type { Handler } from '../../../shared/inbox-contract.js';
|
|
7
7
|
import type { files, RoutinePublicationClient } from './public.js';
|
|
8
8
|
import type { RoutineAccess } from '../../../shared/routine-definition-contract.js';
|
|
9
|
+
import type { RoutineAIInput } from '../../../shared/routine-ai-contract.js';
|
|
9
10
|
export type { RoutineAccess } from '../../../shared/routine-definition-contract.js';
|
|
10
11
|
declare const valueType: unique symbol;
|
|
11
12
|
/** Serializable declaration; the phantom type never carries authority. */
|
|
@@ -15,6 +16,21 @@ export type RoutineSchema<Value, Defaulted extends boolean = boolean> = AppValue
|
|
|
15
16
|
readonly hasDefault?: Defaulted;
|
|
16
17
|
};
|
|
17
18
|
export type RoutineSchemaValue<Schema> = Schema extends RoutineSchema<infer Value> ? Value : undefined;
|
|
19
|
+
export type RoutineAI = {
|
|
20
|
+
generateText(input: {
|
|
21
|
+
instructions: string;
|
|
22
|
+
input: RoutineAIInput;
|
|
23
|
+
}): Promise<{
|
|
24
|
+
text: string;
|
|
25
|
+
}>;
|
|
26
|
+
generateObject<Schema extends RoutineSchema<unknown>>(input: {
|
|
27
|
+
instructions: string;
|
|
28
|
+
input: RoutineAIInput;
|
|
29
|
+
schema: Schema;
|
|
30
|
+
}): Promise<{
|
|
31
|
+
object: RoutineSchemaValue<Schema>;
|
|
32
|
+
}>;
|
|
33
|
+
};
|
|
18
34
|
export type RoutineStepOutput = {
|
|
19
35
|
summary: unknown;
|
|
20
36
|
data: unknown;
|
|
@@ -54,6 +70,7 @@ export type RoutineCapabilities<Access extends RoutineAccess> = {
|
|
|
54
70
|
readonly run: {
|
|
55
71
|
readonly id: string;
|
|
56
72
|
};
|
|
73
|
+
readonly ai: Access['ai'] extends true ? RoutineAI : {};
|
|
57
74
|
readonly data: {
|
|
58
75
|
repository<Name extends Extract<keyof Access['repositories'], string>>(name: Name): RepositoryFor<NonNullable<Access['repositories']>[Name]>;
|
|
59
76
|
};
|
|
@@ -16,5 +16,16 @@ export type AirtableRuntimeConnection = {
|
|
|
16
16
|
accessToken: string;
|
|
17
17
|
runExpiresAt: string;
|
|
18
18
|
};
|
|
19
|
-
export type
|
|
20
|
-
|
|
19
|
+
export type DropboxRuntimeConnection = {
|
|
20
|
+
id: `dropbox/${string}`;
|
|
21
|
+
provider: 'dropbox';
|
|
22
|
+
name: string;
|
|
23
|
+
accountId: string;
|
|
24
|
+
access: 'full_dropbox';
|
|
25
|
+
rootPath: string;
|
|
26
|
+
scopes: string[];
|
|
27
|
+
accessToken: string;
|
|
28
|
+
expiresAt: string;
|
|
29
|
+
};
|
|
30
|
+
export type RuntimeConnection = GmailRuntimeConnection | AirtableRuntimeConnection | DropboxRuntimeConnection;
|
|
31
|
+
export type RuntimeConnectionFor<Name extends string> = string extends Name ? RuntimeConnection : Name extends `gmail/${string}` ? GmailRuntimeConnection : Name extends `airtable/${string}` ? AirtableRuntimeConnection : Name extends `dropbox/${string}` ? DropboxRuntimeConnection : never;
|
|
@@ -77,20 +77,29 @@ export declare function parseFileEnrichMetadata(value: unknown, maxBytes: number
|
|
|
77
77
|
export declare function safeFileName(value: unknown): value is string;
|
|
78
78
|
export declare function safeFilePath(value: unknown): value is string;
|
|
79
79
|
/** Private transport metadata: normalized material options exclude the request key and size declaration. */
|
|
80
|
+
export declare const ORIGINAL_MEDIA_TYPES: readonly ['application/pdf', 'text/plain', 'text/markdown', 'application/json', 'image/png', 'image/jpeg'];
|
|
81
|
+
export type OriginalMediaType = typeof ORIGINAL_MEDIA_TYPES[number];
|
|
82
|
+
/** Normalize declarations only; no byte interpretation or filename inference. */
|
|
83
|
+
export declare function declaredOriginalMediaType(value: string): OriginalMediaType | undefined;
|
|
80
84
|
export type FileCreateMetadata = {
|
|
81
85
|
name: string;
|
|
82
86
|
path: string;
|
|
83
87
|
storage?: FileStorage;
|
|
84
88
|
csv?: Required<FileCsvHints>;
|
|
85
|
-
inputMediaType?:
|
|
89
|
+
inputMediaType?: OriginalMediaType;
|
|
86
90
|
size: number;
|
|
87
91
|
requestKey: string;
|
|
88
92
|
};
|
|
89
|
-
/**
|
|
93
|
+
/** Declared types are descriptive metadata; this rule never reads original bytes. */
|
|
90
94
|
export declare function declaredOriginalFormat(input: Pick<FileCreateMetadata, 'name' | 'inputMediaType'>): {
|
|
91
95
|
mediaType: 'application/pdf';
|
|
92
96
|
details: {
|
|
93
97
|
kind: 'pdf';
|
|
94
98
|
};
|
|
99
|
+
} | {
|
|
100
|
+
mediaType: "application/json" | "image/jpeg" | "image/png" | "text/markdown" | "text/plain";
|
|
101
|
+
details: {
|
|
102
|
+
kind: 'other';
|
|
103
|
+
};
|
|
95
104
|
} | undefined;
|
|
96
105
|
export declare function parseFileCreateMetadata(value: unknown, maxBytes: number): FileCreateMetadata;
|
|
@@ -129,6 +129,8 @@ export interface ResponseAcceptance {
|
|
|
129
129
|
}
|
|
130
130
|
export interface AnswerableQuestion {
|
|
131
131
|
itemId: string;
|
|
132
|
+
/** Parent Ask's workspace-scoped Inbox number, stable across revisions. */
|
|
133
|
+
number: number;
|
|
132
134
|
revision: number;
|
|
133
135
|
title: string;
|
|
134
136
|
inboxUrl: string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type AppValueSchema } from './app-routine-contract.js';
|
|
2
|
+
import { type File } from './files-contract.js';
|
|
3
|
+
/** Control values, explicit text and accepted output share the Run value bound.
|
|
4
|
+
* Raw Files have no universal AI byte cap: adapters must measure their final
|
|
5
|
+
* encoded request against their own transport limit before dispatch. */
|
|
6
|
+
export declare const ROUTINE_AI_VALUE_BYTES: number;
|
|
7
|
+
export declare const ROUTINE_AI_EVIDENCE_BYTES: number;
|
|
8
|
+
export declare const ROUTINE_AI_OPERATION_MS = 120000;
|
|
9
|
+
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
|
+
export type RoutineAIErrorCode = typeof ROUTINE_AI_ERROR_CODES[number];
|
|
11
|
+
/** Safe failures contain only an allowlisted code, never provider payloads. */
|
|
12
|
+
export declare class RoutineAIError extends Error {
|
|
13
|
+
readonly code: RoutineAIErrorCode;
|
|
14
|
+
constructor(code: RoutineAIErrorCode);
|
|
15
|
+
}
|
|
16
|
+
/** Private transports carry only the bounded failure code. */
|
|
17
|
+
export declare function parseRoutineAIError(value: unknown): RoutineAIError;
|
|
18
|
+
export type RoutineAIInput = string | File;
|
|
19
|
+
export type RoutineAIRequest = {
|
|
20
|
+
kind: 'generateText';
|
|
21
|
+
instructions: string;
|
|
22
|
+
input: RoutineAIInput;
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'generateObject';
|
|
25
|
+
instructions: string;
|
|
26
|
+
input: RoutineAIInput;
|
|
27
|
+
schema: AppValueSchema;
|
|
28
|
+
};
|
|
29
|
+
export type RoutineAIResult = {
|
|
30
|
+
text: string;
|
|
31
|
+
} | {
|
|
32
|
+
object: unknown;
|
|
33
|
+
};
|
|
34
|
+
export type RoutineAITransport = (request: RoutineAIRequest) => Promise<RoutineAIResult>;
|
|
35
|
+
/** Inert schema grammar only. SDK builders must be resolved before transport. */
|
|
36
|
+
export declare function parseRoutineAIRequest(value: unknown): RoutineAIRequest;
|
|
37
|
+
/** Validate results again at delivery; provider text is never implicitly repaired. */
|
|
38
|
+
export declare function parseRoutineAIResult(request: RoutineAIRequest, value: unknown): RoutineAIResult;
|
|
39
|
+
/** Native adapters discard reasoning and pass only the final text here. */
|
|
40
|
+
export declare function acceptRoutineAIOutput(request: RoutineAIRequest, text: unknown): RoutineAIResult;
|
|
@@ -2,7 +2,7 @@ import { type AppValueSchema } from './app-routine-contract.js';
|
|
|
2
2
|
export type RoutineAccess = {
|
|
3
3
|
readonly repositories?: Readonly<Record<string, 'read' | 'write'>>;
|
|
4
4
|
readonly connections?: readonly string[];
|
|
5
|
-
readonly
|
|
5
|
+
readonly ai?: true;
|
|
6
6
|
readonly files?: 'read' | 'read-write';
|
|
7
7
|
readonly publish?: readonly ('asks' | 'digests')[];
|
|
8
8
|
};
|