@oddington/sdk 0.1.50 → 0.1.51
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AskInput, DigestInput, PublicationRequest, PublishedAsk, PublishedDigest, ResolutionInput } from '../../../shared/inbox-contract.js';
|
|
2
|
-
export type { RoutineSchema, RoutineSchemaValue, RoutineDefinition, RoutineInput, RoutineRuntime, RoutineAccess, RoutineCapabilities, RoutineStep, RoutineSteps, RoutineStepInput, RoutineStepResult, RoutineStepOutput, RoutineArtifactInput, RoutineArtifact, RoutineAI } from './routine-definition-types.js';
|
|
2
|
+
export type { RoutineSchema, RoutineSchemaValue, RoutineDefinition, RoutineInput, RoutineRuntime, RoutineAccess, RoutineCapabilities, SharedRoutineCapabilities, ResponseCapabilities, ResponseAction, RoutineStep, RoutineSteps, RoutineStepInput, RoutineStepResult, RoutineStepOutput, RoutineArtifactInput, RoutineArtifact, RoutineAI } from './routine-definition-types.js';
|
|
3
|
+
export declare const defineResponse: import('./routine-definition-types.js').DefineResponse;
|
|
3
4
|
export declare const defineRoutine: import('./routine-definition-types.js').DefineRoutine;
|
|
4
5
|
export declare const schema: import('./routine-definition-types.js').RoutineSchemaBuilders;
|
|
5
6
|
export declare const file: import('./routine-definition-types.js').RoutineFileSchema;
|
|
@@ -3,7 +3,7 @@ import type { File } from '../../../shared/files-contract.js';
|
|
|
3
3
|
import type { Connections } from '../../../shared/airtable-contract.js';
|
|
4
4
|
import type { RuntimeConnectionFor } from '../../../shared/connection-runtime.js';
|
|
5
5
|
import type { DataRepository } from '../../../shared/data-contract.js';
|
|
6
|
-
import type { Handler } from '../../../shared/inbox-contract.js';
|
|
6
|
+
import type { Handler, HandlerRuntime, HandlerTransition, JsonValue } 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
9
|
import type { RoutineAIInput } from '../../../shared/routine-ai-contract.js';
|
|
@@ -70,16 +70,8 @@ export type RoutineArtifact = Readonly<{
|
|
|
70
70
|
sha256: string;
|
|
71
71
|
}>;
|
|
72
72
|
type RepositoryFor<Mode> = Mode extends 'write' ? DataRepository : Omit<DataRepository, 'changes'>;
|
|
73
|
-
type ConnectionName<Access extends RoutineAccess> = Access['connections'] extends readonly (infer Name)[] ? Name extends `airtable/${infer Alias}` ? Alias : never : never;
|
|
74
|
-
export type
|
|
75
|
-
readonly run: {
|
|
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>;
|
|
82
|
-
};
|
|
73
|
+
type ConnectionName<Access extends RoutineAccess> = Access['connections'] extends readonly (infer Name)[] ? string extends Name ? string : Name extends `airtable/${infer Alias}` ? Alias : never : never;
|
|
74
|
+
export type SharedRoutineCapabilities<Access extends RoutineAccess> = {
|
|
83
75
|
readonly ai: Access['ai'] extends true ? RoutineAI : {};
|
|
84
76
|
readonly data: {
|
|
85
77
|
repository<Name extends Extract<keyof Access['repositories'], string>>(name: Name): RepositoryFor<NonNullable<Access['repositories']>[Name]>;
|
|
@@ -91,6 +83,32 @@ export type RoutineCapabilities<Access extends RoutineAccess> = {
|
|
|
91
83
|
};
|
|
92
84
|
readonly inbox: Pick<RoutinePublicationClient, (Access['publish'] extends readonly string[] ? 'asks' extends Access['publish'][number] ? 'publishAsk' : never : never) | (Access['publish'] extends readonly string[] ? 'digests' extends Access['publish'][number] ? 'publishDigest' : never : never)>;
|
|
93
85
|
};
|
|
86
|
+
export type RoutineCapabilities<Access extends RoutineAccess> = SharedRoutineCapabilities<Access> & {
|
|
87
|
+
readonly run: {
|
|
88
|
+
readonly id: string;
|
|
89
|
+
/** Report completed work that OS capabilities and Step boundaries cannot observe. */
|
|
90
|
+
progress(value: {
|
|
91
|
+
completed: number;
|
|
92
|
+
total: number;
|
|
93
|
+
}): Promise<void>;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
/** Access is supplied by the owning routine at invocation, never by the action. */
|
|
97
|
+
export type ResponseCapabilities = SharedRoutineCapabilities<{
|
|
98
|
+
repositories: Record<string, 'write'>;
|
|
99
|
+
files: 'read-write';
|
|
100
|
+
connections: readonly string[];
|
|
101
|
+
ai: true;
|
|
102
|
+
publish: readonly ('asks' | 'digests')[];
|
|
103
|
+
}>;
|
|
104
|
+
export type ResponseAction<Input extends JsonValue = JsonValue> = Omit<Handler<Input>, 'run'> & {
|
|
105
|
+
run(context: HandlerRuntime<Input>, os: ResponseCapabilities): Promise<HandlerTransition>;
|
|
106
|
+
};
|
|
107
|
+
export type DefineResponse = <Input extends JsonValue, const Id extends string = string>(value: ResponseAction<Input> & {
|
|
108
|
+
id: Id;
|
|
109
|
+
}) => Handler<Input> & ResponseAction<Input> & {
|
|
110
|
+
id: Id;
|
|
111
|
+
};
|
|
94
112
|
type RoutineStepCalls<Steps extends RoutineSteps> = {
|
|
95
113
|
[Key in keyof Steps]: {
|
|
96
114
|
input: Parameters<Steps[Key]['run']> extends [] ? [] : [input: RoutineStepInput<Steps[Key]> | RoutineInput<RoutineStepInput<Steps[Key]>>];
|