@oddington/sdk 0.1.75 → 0.1.76

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.
@@ -8,7 +8,7 @@ export { AIError, RoutineAIError } from '../../../shared/routine-ai-contract.js'
8
8
  export type { RoutineAIOutputIssue } from '../../../shared/routine-ai-output-detail.js';
9
9
  export type { RoutineAIErrorDetail } from '../../../shared/routine-ai-error-detail.js';
10
10
  export { InboxContractError, asksBlock, continueAsk, defineHandler, fileBlock, question, recordBlock, recordsBlock, resolveAsk, respond, richTextBlock, selection, } from '../../../shared/inbox-contract.js';
11
- export type { AskInput, AuthoredSource, DigestInput, Handler, HandlerReference, HandlerRuntime, HandlerTransition, InboxBlock, InboxFile, JsonObject, JsonValue, QualifiedRecordRef, PublishedAsk, PublishedDigest, PublishedView, PublicationRequest, Question, QuestionInput, QuestionResponse, RecordReference, RecordSource, RepositoryReceipt, Resolution, ResolutionInput, ResponseDefinition, } from '../../../shared/inbox-contract.js';
11
+ export type { AskInput, AuthoredSource, DigestInput, Handler, HandlerReference, HandlerRuntime, HandlerTransition, InboxBlock, InboxFile, JsonObject, JsonValue, QualifiedRecordRef, PublishedAsk, PublishedDigest, PublishedView, PublicationRequest, Question, QuestionInput, QuestionResponse, RecordReference, RecordSource, RepositoryReceipt, Resolution, ResolutionInput, ResponseDefinition, LegacyResponseDefinition, LegacyQuestionResponse, RecordPickerSource, SelectionOptionInput, SelectionOption, SelectionDefinitionInput, SelectionDefinition, SelectionResponse, ResponseDefinitionInput, } from '../../../shared/inbox-contract.js';
12
12
  export { AirtableOperationError } from '../../../shared/airtable-contract.js';
13
13
  export type { AirtableField, AirtableTable, AirtableRecord, AirtableListInput, AirtableGetInput, AirtableCreateInput, AirtableUpdateInput, AirtableDeleteInput, AirtableReceipt, AirtableWriteResult, AirtableClient } from '../../../shared/airtable-contract.js';
14
14
  export type { GmailRuntimeConnection, AirtableRuntimeConnection, DropboxRuntimeConnection, OutlookRuntimeConnection, SharePointRuntimeConnection, RuntimeConnection, RuntimeConnectionFor } from '../../../shared/connection-runtime.js';
@@ -3,6 +3,7 @@ export type JsonValue = null | boolean | number | string | JsonValue[] | JsonObj
3
3
  export type JsonObject = {
4
4
  [key: string]: JsonValue;
5
5
  };
6
+ /** @deprecated Author new selections with per-option definitions. */
6
7
  export type AuthoredSource = {
7
8
  type: 'authored';
8
9
  options: Array<{
@@ -24,6 +25,7 @@ export type RecordReference = {
24
25
  repository: string;
25
26
  ref: string;
26
27
  };
28
+ /** @deprecated Record pickers inherit schema display.title. */
27
29
  export type RecordSource = {
28
30
  type: 'records';
29
31
  collection: {
@@ -40,14 +42,62 @@ export type RecordSource = {
40
42
  reason?: string;
41
43
  }>;
42
44
  };
43
- export type ResponseDefinition = {
45
+ export type LegacyResponseDefinition = {
44
46
  type: 'selection';
45
47
  source: AuthoredSource | RecordSource;
46
48
  };
47
- export type QuestionResponse = {
49
+ export type LegacyQuestionResponse = {
48
50
  selection: string | RecordReference;
49
51
  note?: string;
50
52
  };
53
+ export type RecordPickerSource = {
54
+ collection: {
55
+ repository: string;
56
+ name: string;
57
+ };
58
+ refPrefix?: string;
59
+ where?: Record<string, string | number | boolean | null>;
60
+ };
61
+ export type SelectionOptionInput = {
62
+ type: 'choice';
63
+ value: string;
64
+ label: string;
65
+ description?: string;
66
+ note?: {
67
+ placeholder: string;
68
+ };
69
+ } | {
70
+ type: 'record';
71
+ value: RecordReference;
72
+ label: string;
73
+ description?: string;
74
+ } | {
75
+ type: 'record-picker';
76
+ label: string;
77
+ source: RecordPickerSource;
78
+ };
79
+ /** Publication supplies scoped IDs and preserves authored presentation. */
80
+ export type SelectionOption = SelectionOptionInput & {
81
+ id: number;
82
+ };
83
+ export type SelectionDefinitionInput = {
84
+ type: 'selection';
85
+ options: SelectionOptionInput[];
86
+ };
87
+ export type SelectionDefinition = {
88
+ type: 'selection';
89
+ options: SelectionOption[];
90
+ };
91
+ export type ResponseDefinitionInput = SelectionDefinitionInput | LegacyResponseDefinition;
92
+ export type ResponseDefinition = SelectionDefinition | LegacyResponseDefinition;
93
+ export type SelectionResponse = {
94
+ option: number;
95
+ value: string | RecordReference;
96
+ note?: string;
97
+ /** Absent on new answers; keeps existing handlers' selection checks typed. */
98
+ selection?: never;
99
+ };
100
+ export type QuestionResponse = SelectionResponse | LegacyQuestionResponse;
51
101
  export type HandlerReference = {
52
102
  id: string;
53
103
  input: JsonValue;
@@ -58,7 +108,7 @@ export type Question = {
58
108
  allowedResponders: string[];
59
109
  prompt: string;
60
110
  instructions?: string;
61
- response: ResponseDefinition;
111
+ response: ResponseDefinitionInput;
62
112
  handler?: HandlerReference;
63
113
  };
64
114
  export type QuestionInput = Omit<Question, 'allowedResponders'> & {
@@ -266,12 +316,20 @@ export declare function asksBlock(value: Omit<Extract<InboxBlock, {
266
316
  }>, 'kind'>): Extract<InboxBlock, {
267
317
  kind: 'asks';
268
318
  }>;
319
+ export declare function selection(value: {
320
+ options: SelectionOptionInput[];
321
+ }): SelectionDefinitionInput;
322
+ /** @deprecated Use options; retained for existing routine authoring. */
269
323
  export declare function selection(value: {
270
324
  source: AuthoredSource | RecordSource;
271
- }): ResponseDefinition;
325
+ }): LegacyResponseDefinition;
272
326
  export declare function validateRecordReference(value: unknown): RecordReference;
327
+ export declare function validateRecordPickerSource(value: unknown): RecordPickerSource;
273
328
  export declare function validateRecordSource(value: unknown): RecordSource;
274
- export declare function validateResponseDefinition(value: unknown): ResponseDefinition;
329
+ /** Authoring validation never accepts publication-owned IDs. */
330
+ export declare function validateResponseDefinition(value: unknown): ResponseDefinitionInput;
331
+ export declare function validatePublishedSelectionDefinition(value: unknown): SelectionDefinition;
332
+ export declare function validatePublishedResponseDefinition(value: unknown): ResponseDefinition;
275
333
  export declare function validateResponse(definition: unknown, value: unknown): QuestionResponse;
276
334
  export declare function defineHandler<Input extends JsonValue, const Id extends string = string>(value: Handler<Input> & {
277
335
  id: Id;
@@ -19,7 +19,8 @@ export declare const INBOX_RESULT_BYTES: number;
19
19
  export declare const INBOX_INPUT_BYTES = 8192;
20
20
  /** Includes the exact declaration only on the private CLI-authenticated ingress. */
21
21
  export declare const INBOX_LOCAL_INPUT_BYTES: number;
22
- export declare const INBOX_QUESTION_CONTRACT: 'question-work-v1';
22
+ export declare const INBOX_QUESTION_CONTRACT: 'question-work-v2';
23
+ export type InboxQuestionContract = 'question-work-v1' | typeof INBOX_QUESTION_CONTRACT;
23
24
  export declare const INBOX_UUID: RegExp;
24
25
  export type InboxOperation = 'current' | 'items.list' | 'items.read' | 'items.readRecords' | 'items.see' | 'items.markDigestRead' | 'items.rename' | 'items.setLifecycle' | 'items.listRecipientCandidates' | 'items.addRecipient' | 'questions.list' | 'questions.answer' | 'questions.listRecordOptions';
25
26
  export declare function isAppQuestionOperation(operation: InboxOperation): boolean;
@@ -27,13 +28,13 @@ export declare function isAppQuestionOperation(operation: InboxOperation): boole
27
28
  export declare function parseInboxRequest(value: unknown): {
28
29
  operation: InboxOperation;
29
30
  input: Record<string, unknown>;
30
- contract?: typeof INBOX_QUESTION_CONTRACT;
31
+ contract?: InboxQuestionContract;
31
32
  };
32
33
  export declare function parseInboxCurrent(value: unknown): InboxCurrent;
33
34
  export declare function parseInboxItem(value: unknown): InboxItem;
34
35
  /** Exact app-facing vocabulary: an upstream snapshot cannot widen it. */
35
- export declare function parseQuestionWork(value: unknown): QuestionWork;
36
+ export declare function parseQuestionWork(value: unknown, contract?: InboxQuestionContract): QuestionWork;
36
37
  /** Validate the owner's closed vocabulary; never classify infrastructure in a client. */
37
38
  export declare function parseQuestionStatus(value: unknown): QuestionStatus;
38
39
  export declare function parseInboxAcceptance(value: unknown): ResponseAcceptance;
39
- export declare function parseInboxResult(operation: InboxOperation, value: unknown): unknown;
40
+ export declare function parseInboxResult(operation: InboxOperation, value: unknown, contract?: InboxQuestionContract): unknown;
@@ -207,6 +207,7 @@ export type InboxAnswerInput = ItemRevision & {
207
207
  };
208
208
  export type InboxRecordOptionsInput = ItemRevision & {
209
209
  questionId: string;
210
+ option?: number;
210
211
  };
211
212
  /** Hosted listing relevance only; local listing uses its bound declaration. */
212
213
  export type InboxQuestionListInput = {
@@ -4,16 +4,25 @@ export type InboxRecord = QualifiedRecordRef & {
4
4
  record: SelectedRecord | null;
5
5
  schema: CollectionSchema | null;
6
6
  };
7
- export type InboxRecords = {
7
+ export type InboxRecordLink = QualifiedRecordRef & {
8
+ title: string;
9
+ };
10
+ export type LegacyInboxRecords = {
8
11
  records: InboxRecord[];
9
12
  };
10
- export type ReadInboxRecords = (workspace: string, repository: string, refs: string[], authorization: string) => Promise<InboxRecords>;
11
- export type InboxRecordsOutcome = {
13
+ export type InboxRecords = LegacyInboxRecords & {
14
+ links: InboxRecordLink[];
15
+ };
16
+ export type InboxRecordsSummaryMode = 'links-v1';
17
+ export type ReadInboxRecords = (workspace: string, repository: string, refs: string[], authorization: string, summaryMode?: InboxRecordsSummaryMode) => Promise<InboxRecords>;
18
+ export type InboxRecordsOutcome<Result = InboxRecords> = {
12
19
  status: 200;
13
- result: InboxRecords;
20
+ result: Result;
14
21
  } | {
15
22
  status: 403 | 503;
16
23
  };
17
24
  export declare function parseInboxRecordRefs(value: unknown): QualifiedRecordRef[];
18
25
  export declare const recordKey: ({ repository, ref }: QualifiedRecordRef) => string;
26
+ /** Inbox's existing title policy, shared by full Records and immediate summaries. */
27
+ export declare function inboxRecordTitle(entry: InboxRecord): string;
19
28
  export declare function parseInboxRecords(value: unknown): InboxRecords;
@@ -1,4 +1,4 @@
1
- import { InboxContractError, type RecordSource, type RecordReference } from './inbox-contract.js';
1
+ import { InboxContractError, type RecordSource, type RecordPickerSource, type RecordReference } from './inbox-contract.js';
2
2
  export declare const recordOptionCatalogueByteLimit = 7000000;
3
3
  export type LabeledRecord = RecordReference & {
4
4
  label: string;
@@ -20,6 +20,6 @@ export declare function isRecordSelectionProblem(value: unknown): value is Recor
20
20
  * Record values, provider errors and credentials never enter the envelope. */
21
21
  export declare class RecordSelectionError extends InboxContractError {
22
22
  readonly problem: RecordSelectionProblem;
23
- constructor(problem: RecordSelectionProblem, source: RecordSource);
23
+ constructor(problem: RecordSelectionProblem, source: RecordSource | RecordPickerSource);
24
24
  }
25
25
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oddington/sdk",
3
- "version": "0.1.75",
3
+ "version": "0.1.76",
4
4
  "description": "OS routine and response-handler SDK",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",