@oddington/sdk 0.1.20 → 0.1.22
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 +89 -65
- package/dist/browser.js +604 -498
- package/dist/index.js +8 -8
- package/dist/types/packages/sdk/src/public.d.ts +87 -35
- package/dist/types/packages/sdk/src/routine-definition-types.d.ts +48 -20
- package/dist/types/shared/app-descriptor.d.ts +21 -0
- package/dist/types/shared/inbox-contract.d.ts +5 -1
- package/dist/types/shared/inbox-member-contract.d.ts +2 -2
- package/dist/types/shared/inbox-member-types.d.ts +15 -17
- package/dist/types/shared/routine-definition-contract.d.ts +33 -0
- package/dist/types/shared/routine-deployment-contract.d.ts +47 -0
- package/dist/types/shared/routine-deployment-path.d.ts +6 -0
- package/dist/types/shared/routine-source-provenance.d.ts +7 -0
- 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, RoutineArtifactInput, RoutineArtifact } from './routine-definition-types.js';
|
|
5
|
+
export type { RoutineSchema, RoutineSchemaValue, RoutineDefinition, RoutineInput, RoutineRuntime, RoutineAccess, RoutineCapabilities, RoutineStep, RoutineSteps, RoutineStepInput, RoutineStepResult, RoutineStepOutput, RoutineArtifactInput, RoutineArtifact } 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;
|
|
@@ -84,53 +84,105 @@ export declare const auth: {
|
|
|
84
84
|
/** Customer-owned module augmentation supplies types, never runtime authority. */
|
|
85
85
|
export interface AppRoutineTypes {
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
/** Generated app declarations derive inference directly from the authored export. */
|
|
88
|
+
export type RoutineAppBinding<Definition> = Definition extends import('./routine-definition-types.js').RoutineDefinition<infer Input extends import('./routine-definition-types.js').RoutineSchema<unknown> | undefined, infer Steps extends import('./routine-definition-types.js').RoutineSteps, infer Result extends import('./routine-definition-types.js').RoutineSchema<unknown> | undefined, any, any, any> ? Omit<AppRoutineBinding<import('./routine-definition-types.js').RoutineSchemaValue<Input>, import('./routine-definition-types.js').RoutineSchemaValue<Result>, {
|
|
89
|
+
[Key in keyof Steps]: Awaited<ReturnType<Steps[Key]['run']>>;
|
|
90
|
+
}>, 'run'> & {
|
|
91
|
+
run(...input: Input extends undefined | import('./routine-definition-types.js').RoutineSchema<unknown, true> ? [input?: Input extends undefined ? Record<string, never> : import('./routine-definition-types.js').RoutineSchemaValue<Input>] : [input: import('./routine-definition-types.js').RoutineSchemaValue<Input>]): Promise<AppRoutineHandle<import('./routine-definition-types.js').RoutineSchemaValue<Result>, {
|
|
92
|
+
[Key in keyof Steps]: Awaited<ReturnType<Steps[Key]['run']>>;
|
|
93
|
+
}>>;
|
|
94
|
+
} : never;
|
|
95
|
+
export type AppRoutineErrorReason = 'authority_unavailable' | 'execution_unavailable' | 'invalid_input';
|
|
88
96
|
export declare class AppRoutineError extends Error {
|
|
89
97
|
readonly reason: AppRoutineErrorReason;
|
|
90
98
|
constructor(reason: AppRoutineErrorReason);
|
|
91
99
|
}
|
|
92
|
-
export type
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
+
export type AppRoutineHandle<Result, Steps> = {
|
|
101
|
+
current(): Promise<Omit<RunSummary, 'result'> & {
|
|
102
|
+
result?: Result;
|
|
103
|
+
}>;
|
|
104
|
+
watch(): AsyncIterable<Omit<RunSummary, 'result'> & {
|
|
105
|
+
result?: Result;
|
|
106
|
+
}>;
|
|
107
|
+
step<Key extends Extract<keyof Steps, string>>(id: Key): Promise<Omit<StepDetail, 'summary' | 'data'> & (Steps[Key] extends {
|
|
108
|
+
summary: infer Summary;
|
|
109
|
+
data?: infer Data;
|
|
110
|
+
} ? {
|
|
111
|
+
summary?: Summary;
|
|
112
|
+
data?: Data;
|
|
100
113
|
} : {
|
|
101
|
-
summary
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
type: 'finished';
|
|
114
|
+
summary?: unknown;
|
|
115
|
+
data?: unknown;
|
|
116
|
+
})>;
|
|
117
|
+
publish(): Promise<Omit<RunSummary, 'result'> & {
|
|
118
|
+
result?: Result;
|
|
119
|
+
}>;
|
|
120
|
+
};
|
|
121
|
+
export type LocalPublication = {
|
|
122
|
+
state: 'not_needed' | 'ready' | 'published';
|
|
123
|
+
} | {
|
|
112
124
|
state: 'failed';
|
|
113
|
-
|
|
125
|
+
message: string;
|
|
126
|
+
};
|
|
127
|
+
export type StepDetail = {
|
|
128
|
+
id: string;
|
|
129
|
+
title: string;
|
|
130
|
+
status: 'pending' | 'running' | 'completed' | 'failed' | 'skipped';
|
|
131
|
+
startedAt?: string;
|
|
132
|
+
finishedAt?: string;
|
|
133
|
+
summary?: unknown;
|
|
134
|
+
data?: unknown;
|
|
135
|
+
};
|
|
136
|
+
export type RunSummary = {
|
|
137
|
+
id: string;
|
|
138
|
+
routine: string;
|
|
139
|
+
placement: 'local' | 'remote';
|
|
140
|
+
status: 'queued' | 'running' | 'succeeded' | 'failed';
|
|
141
|
+
createdAt: string;
|
|
142
|
+
startedAt?: string;
|
|
143
|
+
finishedAt?: string;
|
|
144
|
+
steps: Array<Omit<StepDetail, 'data'> & {
|
|
145
|
+
detailAvailable: boolean;
|
|
146
|
+
}>;
|
|
147
|
+
result?: unknown;
|
|
148
|
+
failure?: {
|
|
149
|
+
message: string;
|
|
150
|
+
};
|
|
151
|
+
publication?: LocalPublication;
|
|
152
|
+
};
|
|
153
|
+
export type RunHandle = {
|
|
154
|
+
current(): Promise<RunSummary>;
|
|
155
|
+
watch(): AsyncIterable<RunSummary>;
|
|
156
|
+
step(id: string): Promise<StepDetail>;
|
|
157
|
+
publish(): Promise<RunSummary>;
|
|
158
|
+
};
|
|
159
|
+
export type RoutineReadiness = {
|
|
160
|
+
state: 'ready';
|
|
161
|
+
placement: 'local' | 'remote';
|
|
114
162
|
} | {
|
|
115
|
-
|
|
116
|
-
|
|
163
|
+
state: 'unavailable';
|
|
164
|
+
reason: 'not_deployed' | 'definition_invalid' | 'capability_unavailable';
|
|
165
|
+
message: string;
|
|
117
166
|
};
|
|
118
|
-
export type
|
|
119
|
-
|
|
120
|
-
|
|
167
|
+
export type RoutineDescription = Omit<import('../../../shared/app-descriptor.js').AppRoutineDescriptor, 'connections'> & {
|
|
168
|
+
connections: Array<{
|
|
169
|
+
id: string;
|
|
170
|
+
provider: string;
|
|
171
|
+
name: string;
|
|
172
|
+
available: boolean;
|
|
173
|
+
}>;
|
|
174
|
+
readiness: RoutineReadiness;
|
|
121
175
|
};
|
|
122
176
|
export type AppRoutineBinding<Input, Result, Steps> = {
|
|
123
|
-
|
|
124
|
-
available: true;
|
|
125
|
-
steps: Extract<keyof Steps, string>[];
|
|
126
|
-
} | {
|
|
127
|
-
available: false;
|
|
128
|
-
reason: 'not_enabled' | 'authority_unavailable' | 'execution_unavailable';
|
|
129
|
-
}>;
|
|
177
|
+
describe(): Promise<RoutineDescription>;
|
|
130
178
|
run(input: Input): Promise<AppRoutineHandle<Result, Steps>>;
|
|
131
|
-
|
|
179
|
+
runs: {
|
|
180
|
+
list(): Promise<RunSummary[]>;
|
|
181
|
+
get(id: string): Promise<RunHandle>;
|
|
182
|
+
};
|
|
132
183
|
};
|
|
133
184
|
export declare const app: {
|
|
185
|
+
listRoutines(): Promise<RoutineDescription[]>;
|
|
134
186
|
routines: AppRoutineTypes;
|
|
135
187
|
};
|
|
136
188
|
/** A declared stage without a summary takes no second argument. */
|
|
@@ -2,14 +2,32 @@ import type { AppValueSchema } from '../../../shared/app-routine-contract.js';
|
|
|
2
2
|
import type { File } from '../../../shared/files-contract.js';
|
|
3
3
|
import type { Connections } from '../../../shared/airtable-contract.js';
|
|
4
4
|
import type { DataRepository } from '../../../shared/data-contract.js';
|
|
5
|
+
import type { Handler } from '../../../shared/inbox-contract.js';
|
|
5
6
|
import type { files, RoutinePublicationClient } from './public.js';
|
|
7
|
+
import type { RoutineAccess } from '../../../shared/routine-definition-contract.js';
|
|
8
|
+
export type { RoutineAccess } from '../../../shared/routine-definition-contract.js';
|
|
6
9
|
declare const valueType: unique symbol;
|
|
7
10
|
/** Serializable declaration; the phantom type never carries authority. */
|
|
8
|
-
export type RoutineSchema<Value> = AppValueSchema & {
|
|
11
|
+
export type RoutineSchema<Value, Defaulted extends boolean = boolean> = AppValueSchema & {
|
|
9
12
|
readonly [valueType]?: Value;
|
|
13
|
+
default(value: Value): RoutineSchema<Value, true>;
|
|
14
|
+
readonly hasDefault?: Defaulted;
|
|
10
15
|
};
|
|
11
16
|
export type RoutineSchemaValue<Schema> = Schema extends RoutineSchema<infer Value> ? Value : undefined;
|
|
12
|
-
export type
|
|
17
|
+
export type RoutineStepOutput = {
|
|
18
|
+
summary: unknown;
|
|
19
|
+
data: unknown;
|
|
20
|
+
};
|
|
21
|
+
export type RoutineStep<Input = any, Output extends RoutineStepOutput = RoutineStepOutput, Access extends RoutineAccess = RoutineAccess> = {
|
|
22
|
+
readonly title: string;
|
|
23
|
+
readonly run: (input: Input, os: RoutineCapabilities<Access>) => Output | Promise<Output>;
|
|
24
|
+
};
|
|
25
|
+
export type RoutineSteps = Record<string, {
|
|
26
|
+
readonly title: string;
|
|
27
|
+
readonly run: (...args: any[]) => RoutineStepOutput | Promise<RoutineStepOutput>;
|
|
28
|
+
}>;
|
|
29
|
+
export type RoutineStepInput<Step extends RoutineSteps[string]> = Parameters<Step['run']>[0];
|
|
30
|
+
export type RoutineStepResult<Step extends RoutineSteps[string]> = Awaited<ReturnType<Step['run']>>;
|
|
13
31
|
export type RoutineInput<Value> = Value extends object ? {
|
|
14
32
|
readonly [Key in keyof Value]: RoutineInput<Value[Key]>;
|
|
15
33
|
} : Value;
|
|
@@ -29,45 +47,55 @@ export type RoutineArtifact = Readonly<{
|
|
|
29
47
|
size: number;
|
|
30
48
|
sha256: string;
|
|
31
49
|
}>;
|
|
32
|
-
|
|
50
|
+
type RepositoryFor<Mode> = Mode extends 'write' ? DataRepository : Omit<DataRepository, 'changes'>;
|
|
51
|
+
type ConnectionName<Access extends RoutineAccess> = Access['connections'] extends readonly (infer Name)[] ? Name extends `airtable/${infer Alias}` ? Alias : never : never;
|
|
52
|
+
export type RoutineCapabilities<Access extends RoutineAccess> = {
|
|
33
53
|
readonly run: {
|
|
34
54
|
readonly id: string;
|
|
35
55
|
};
|
|
36
56
|
readonly data: {
|
|
37
|
-
repository(name:
|
|
57
|
+
repository<Name extends Extract<keyof Access['repositories'], string>>(name: Name): RepositoryFor<NonNullable<Access['repositories']>[Name]>;
|
|
38
58
|
};
|
|
39
|
-
readonly files: typeof files;
|
|
40
|
-
readonly connections:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
59
|
+
readonly files: Access['files'] extends 'read-write' ? typeof files : Access['files'] extends 'read' ? Pick<typeof files, 'get' | 'read'> : {};
|
|
60
|
+
readonly connections: {
|
|
61
|
+
airtable(name: ConnectionName<Access>): ReturnType<Connections['airtable']>;
|
|
62
|
+
};
|
|
63
|
+
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)>;
|
|
64
|
+
};
|
|
65
|
+
export type RoutineRuntime<Steps extends RoutineSteps, Access extends RoutineAccess = RoutineAccess> = RoutineCapabilities<Access> & {
|
|
66
|
+
step<Key extends Extract<keyof Steps, string>>(id: Key, ...input: Parameters<Steps[Key]['run']> extends [] ? [] : [input: RoutineInput<RoutineStepInput<Steps[Key]>>]): Promise<RoutineStepResult<Steps[Key]>>;
|
|
44
67
|
};
|
|
45
|
-
export type RoutineDefinition<Input extends RoutineSchema<unknown> | undefined, Steps extends RoutineSteps, Result extends RoutineSchema<unknown> | undefined> = {
|
|
68
|
+
export type RoutineDefinition<Input extends RoutineSchema<unknown> | undefined = RoutineSchema<unknown> | undefined, Steps extends RoutineSteps = RoutineSteps, Result extends RoutineSchema<unknown> | undefined = RoutineSchema<unknown> | undefined, Access extends RoutineAccess = RoutineAccess, Responses extends readonly Handler<any>[] = readonly Handler<any>[], Id extends string = string> = {
|
|
69
|
+
readonly id: Id;
|
|
70
|
+
readonly title?: string;
|
|
46
71
|
readonly input?: Input;
|
|
47
72
|
readonly steps?: Steps;
|
|
48
73
|
readonly result?: Result;
|
|
49
|
-
readonly
|
|
74
|
+
readonly access?: Access;
|
|
75
|
+
readonly responses?: Responses;
|
|
76
|
+
readonly run: (input: RoutineInput<Input extends undefined ? Record<string, never> : RoutineSchemaValue<Input>>, os: RoutineRuntime<Steps, Access>) => Result extends undefined ? void | Promise<void> : RoutineSchemaValue<Result> | Promise<RoutineSchemaValue<Result>>;
|
|
50
77
|
};
|
|
51
|
-
export type DefineRoutine = <Input extends RoutineSchema<unknown> | undefined = undefined, const Steps extends
|
|
78
|
+
export type DefineRoutine = <const Id extends string, Input extends RoutineSchema<unknown> | undefined = undefined, const Access extends RoutineAccess = {}, const Steps extends Record<string, RoutineStep<any, RoutineStepOutput, Access>> = {}, Result extends RoutineSchema<unknown> | undefined = undefined, const Responses extends readonly Handler<any>[] = readonly []>(definition: RoutineDefinition<Input, Steps, Result, Access, Responses, Id> & {
|
|
79
|
+
steps?: Steps & Record<string, RoutineStep<any, RoutineStepOutput, Access>>;
|
|
80
|
+
}) => RoutineDefinition<Input, Steps, Result, Access, Responses, Id>;
|
|
52
81
|
export type RoutineSchemaBuilders = {
|
|
53
82
|
object<const Properties extends Record<string, RoutineSchema<unknown>>>(properties: Properties): RoutineSchema<{
|
|
54
83
|
[Key in keyof Properties]: RoutineSchemaValue<Properties[Key]>;
|
|
55
|
-
}>;
|
|
84
|
+
}, false>;
|
|
56
85
|
array<Item extends RoutineSchema<unknown>>(items: Item, options: {
|
|
57
86
|
maxItems: number;
|
|
58
|
-
}): RoutineSchema<RoutineSchemaValue<Item>[]>;
|
|
87
|
+
}): RoutineSchema<RoutineSchemaValue<Item>[], false>;
|
|
59
88
|
string(options?: {
|
|
60
89
|
maxLength?: number;
|
|
61
|
-
}): RoutineSchema<string>;
|
|
90
|
+
}): RoutineSchema<string, false>;
|
|
62
91
|
integer(options?: {
|
|
63
92
|
minimum?: number;
|
|
64
93
|
maximum?: number;
|
|
65
|
-
}): RoutineSchema<number>;
|
|
94
|
+
}): RoutineSchema<number, false>;
|
|
66
95
|
number(options?: {
|
|
67
96
|
minimum?: number;
|
|
68
97
|
maximum?: number;
|
|
69
|
-
}): RoutineSchema<number>;
|
|
70
|
-
boolean(): RoutineSchema<boolean>;
|
|
98
|
+
}): RoutineSchema<number, false>;
|
|
99
|
+
boolean(): RoutineSchema<boolean, false>;
|
|
71
100
|
};
|
|
72
|
-
export type RoutineFileSchema = () => RoutineSchema<File>;
|
|
73
|
-
export {};
|
|
101
|
+
export type RoutineFileSchema = () => RoutineSchema<File, false>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AppValueSchema } from './app-routine-contract.js';
|
|
2
|
+
/** Build-time structure only. Runtime readiness and availability belong to hosts. */
|
|
3
|
+
export type AppRoutineDescriptor = {
|
|
4
|
+
id: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
input: AppValueSchema & {
|
|
7
|
+
default?: unknown;
|
|
8
|
+
};
|
|
9
|
+
connections: {
|
|
10
|
+
id: string;
|
|
11
|
+
provider: string;
|
|
12
|
+
name: string;
|
|
13
|
+
}[];
|
|
14
|
+
steps: {
|
|
15
|
+
id: string;
|
|
16
|
+
title: string;
|
|
17
|
+
}[];
|
|
18
|
+
};
|
|
19
|
+
export type AppDescriptor = {
|
|
20
|
+
routines: AppRoutineDescriptor[];
|
|
21
|
+
};
|
|
@@ -310,7 +310,11 @@ export declare function validateRecordReference(value: unknown): RecordReference
|
|
|
310
310
|
export declare function validateRecordSource(value: unknown): RecordSource;
|
|
311
311
|
export declare function validateResponseDefinition(value: unknown): ResponseDefinition;
|
|
312
312
|
export declare function validateResponse(definition: unknown, value: unknown): QuestionResponse;
|
|
313
|
-
export declare function defineHandler<Input extends JsonValue>(value: Handler<Input>
|
|
313
|
+
export declare function defineHandler<Input extends JsonValue, const Id extends string = string>(value: Handler<Input> & {
|
|
314
|
+
id: Id;
|
|
315
|
+
}): Handler<Input> & {
|
|
316
|
+
id: Id;
|
|
317
|
+
};
|
|
314
318
|
export declare function respond<Input extends JsonValue>(handler: Handler<Input>, input: Input): HandlerReference;
|
|
315
319
|
export declare function question(value: QuestionInput): Question;
|
|
316
320
|
/** Structural validation is shared. Registered view/handler availability,
|
|
@@ -11,8 +11,8 @@ export declare const INBOX_LOCAL_INPUT_BYTES: number;
|
|
|
11
11
|
export declare const INBOX_UUID: RegExp;
|
|
12
12
|
export type InboxOperation = 'current' | 'items.list' | 'items.read' | 'items.see' | 'items.markDigestRead' | 'items.rename' | 'items.setLifecycle' | 'items.listRecipientCandidates' | 'items.addRecipient' | 'questions.list' | 'questions.answer' | 'questions.searchRecords' | 'files.read';
|
|
13
13
|
export declare function isAppQuestionOperation(operation: InboxOperation): boolean;
|
|
14
|
-
/** Closed wire vocabulary
|
|
15
|
-
export declare function parseInboxRequest(value: unknown
|
|
14
|
+
/** Closed wire vocabulary; both placements require an explicit relevance filter. */
|
|
15
|
+
export declare function parseInboxRequest(value: unknown): {
|
|
16
16
|
operation: InboxOperation;
|
|
17
17
|
input: Record<string, unknown>;
|
|
18
18
|
};
|
|
@@ -64,6 +64,7 @@ export type LinkedAskSnapshot = {
|
|
|
64
64
|
done: boolean;
|
|
65
65
|
};
|
|
66
66
|
export interface InboxItem {
|
|
67
|
+
canonicalRoutineId?: string | null;
|
|
67
68
|
id: string;
|
|
68
69
|
workspaceId: string;
|
|
69
70
|
number: number;
|
|
@@ -116,23 +117,20 @@ export interface ResponseAcceptance {
|
|
|
116
117
|
acceptanceOrder?: number;
|
|
117
118
|
}
|
|
118
119
|
export interface AnswerableQuestion {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
120
|
+
itemId: string;
|
|
121
|
+
revision: number;
|
|
122
|
+
title: string;
|
|
123
|
+
inboxUrl: string;
|
|
124
|
+
questionId: string;
|
|
125
|
+
routine: string;
|
|
126
|
+
prompt: string;
|
|
127
|
+
instructions?: string;
|
|
128
|
+
response: ResponseDefinition;
|
|
129
|
+
answerable: boolean;
|
|
130
|
+
recordRefs: Array<{
|
|
131
|
+
repository: string;
|
|
130
132
|
id: string;
|
|
131
|
-
|
|
132
|
-
instructions: string | null;
|
|
133
|
-
response: ResponseDefinition;
|
|
134
|
-
};
|
|
135
|
-
recordRefs: string[];
|
|
133
|
+
}>;
|
|
136
134
|
}
|
|
137
135
|
export interface AskUpdate {
|
|
138
136
|
item: InboxItem;
|
|
@@ -185,7 +183,7 @@ export interface InboxMember {
|
|
|
185
183
|
}): Promise<RecipientAddition>;
|
|
186
184
|
};
|
|
187
185
|
questions: {
|
|
188
|
-
list(input
|
|
186
|
+
list(input: InboxQuestionListInput): Promise<AnswerableQuestion[]>;
|
|
189
187
|
answer(input: InboxAnswerInput): Promise<ResponseAcceptance>;
|
|
190
188
|
searchRecords(input: InboxSearchInput): Promise<RecordSelectionResult>;
|
|
191
189
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type AppValueSchema } from './app-routine-contract.js';
|
|
2
|
+
export type RoutineAccess = {
|
|
3
|
+
readonly repositories?: Readonly<Record<string, 'read' | 'write'>>;
|
|
4
|
+
readonly connections?: readonly string[];
|
|
5
|
+
readonly models?: readonly string[];
|
|
6
|
+
readonly files?: 'read' | 'read-write';
|
|
7
|
+
readonly publish?: readonly ('asks' | 'digests')[];
|
|
8
|
+
};
|
|
9
|
+
export type RoutineContract = {
|
|
10
|
+
id: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
input: AppValueSchema;
|
|
13
|
+
inputDefault?: unknown;
|
|
14
|
+
access: RoutineAccess;
|
|
15
|
+
responses: {
|
|
16
|
+
id: string;
|
|
17
|
+
}[];
|
|
18
|
+
steps: {
|
|
19
|
+
id: string;
|
|
20
|
+
title: string;
|
|
21
|
+
}[];
|
|
22
|
+
result?: AppValueSchema;
|
|
23
|
+
};
|
|
24
|
+
export declare const routineTitle: (value: unknown) => value is string;
|
|
25
|
+
export declare function freezeRoutineMetadata<Value>(value: Value): Value;
|
|
26
|
+
/** Reject values JSON would drop, rewrite, or obtain by invoking authored code. */
|
|
27
|
+
export declare function assertRoutineJson(value: unknown, ancestors?: Set<object>): void;
|
|
28
|
+
/** Inspect property descriptors before reading authored metadata or functions. */
|
|
29
|
+
export declare function assertRoutineFields(value: unknown, allowed?: string[]): asserts value is Record<string, any>;
|
|
30
|
+
export declare function parseRoutineAccess(value: unknown): RoutineAccess;
|
|
31
|
+
/** Inert report/admission grammar shared with authoring; imports no runtime or
|
|
32
|
+
* capability modules and never constructs executable customer functions. */
|
|
33
|
+
export declare function parseRoutineDefinitionContract(value: unknown): RoutineContract;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { RoutineSourceProvenance } from './routine-source-provenance.js';
|
|
2
|
+
import type { RoutineContract } from './routine-definition-contract.js';
|
|
3
|
+
export declare const ROUTINE_DECLARATION_SCHEMA = "https://schemas.oddington.ai/routine/v1.json";
|
|
4
|
+
export declare const ROUTINE_SOURCE_LIMITS: {
|
|
5
|
+
files: number;
|
|
6
|
+
bytes: number;
|
|
7
|
+
declarationBytes: number;
|
|
8
|
+
};
|
|
9
|
+
export type RoutineDeclaration = {
|
|
10
|
+
$schema: typeof ROUTINE_DECLARATION_SCHEMA;
|
|
11
|
+
access: {
|
|
12
|
+
repositories: Record<string, 'read' | 'write'>;
|
|
13
|
+
connections: string[];
|
|
14
|
+
models: string[];
|
|
15
|
+
files?: 'read' | 'read-write';
|
|
16
|
+
publish: Array<'asks' | 'digests'>;
|
|
17
|
+
};
|
|
18
|
+
runtime: {
|
|
19
|
+
features: Array<'python' | 'documents' | 'browser'>;
|
|
20
|
+
resources: 'standard' | 'large';
|
|
21
|
+
maxDuration: string;
|
|
22
|
+
};
|
|
23
|
+
retry: {
|
|
24
|
+
maxAttempts: number;
|
|
25
|
+
};
|
|
26
|
+
assets: string[];
|
|
27
|
+
};
|
|
28
|
+
export type RoutineDeploymentSource = {
|
|
29
|
+
digest: string;
|
|
30
|
+
declaration: RoutineDeclaration;
|
|
31
|
+
definition?: {
|
|
32
|
+
entry: string;
|
|
33
|
+
contract: RoutineContract;
|
|
34
|
+
};
|
|
35
|
+
files: Array<{
|
|
36
|
+
path: string;
|
|
37
|
+
sha256: string;
|
|
38
|
+
size: number;
|
|
39
|
+
}>;
|
|
40
|
+
provenance?: RoutineSourceProvenance;
|
|
41
|
+
};
|
|
42
|
+
/** An authored definition has one fixed, private execution profile. */
|
|
43
|
+
export declare function routineDefinitionDeclaration(contract: RoutineContract): RoutineDeclaration;
|
|
44
|
+
export declare function routineDefinitionDirectory(entry: string): string;
|
|
45
|
+
export declare const routineAlias: (value: unknown) => value is string;
|
|
46
|
+
export declare function routineAssetPattern(value: unknown): value is string;
|
|
47
|
+
export declare function parseRoutineDeclaration(value: unknown): RoutineDeclaration;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const isRoutineSourceDirectory: (value: string) => boolean;
|
|
2
|
+
/** Both the collector and untrusted upload/build admission use this boundary. */
|
|
3
|
+
export declare function eligibleDeploymentPath(path: string): boolean;
|
|
4
|
+
/** Package metadata is admitted only at the root and selected direct child.
|
|
5
|
+
* Inventory parsing has no selection yet; sealing supplies the exact name. */
|
|
6
|
+
export declare function eligibleDeploymentInputPath(path: string, routine?: string): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Checkout evidence is descriptive and never selects routine authority. */
|
|
2
|
+
export type RoutineSourceProvenance = {
|
|
3
|
+
branch?: string;
|
|
4
|
+
commit?: string;
|
|
5
|
+
dirty: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare function parseRoutineSourceProvenance(value: unknown): RoutineSourceProvenance;
|