@spotpatch/runtime 1.13.0 → 1.15.0
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/{chunk-2WA6XVA4.js → chunk-DCN6OMLH.js} +13 -3
- package/dist/{chunk-2WA6XVA4.js.map → chunk-DCN6OMLH.js.map} +1 -1
- package/dist/chunk-PXJKFEUJ.js +14 -0
- package/dist/chunk-PXJKFEUJ.js.map +1 -0
- package/dist/contextual-ask-panel.cjs +1727 -0
- package/dist/contextual-ask-panel.cjs.map +1 -0
- package/dist/contextual-ask-panel.d.cts +165 -0
- package/dist/contextual-ask-panel.d.ts +165 -0
- package/dist/contextual-ask-panel.js +1684 -0
- package/dist/contextual-ask-panel.js.map +1 -0
- package/dist/data-flow-panel.cjs +12 -2
- package/dist/data-flow-panel.cjs.map +1 -1
- package/dist/data-flow-panel.d.cts +1 -1
- package/dist/data-flow-panel.d.ts +1 -1
- package/dist/data-flow-panel.js +7 -1
- package/dist/data-flow-panel.js.map +1 -1
- package/dist/{data-flow-runtime-DMmV0d3E.d.cts → data-flow-runtime-CacBbxN0.d.cts} +2 -1
- package/dist/{data-flow-runtime-DMmV0d3E.d.ts → data-flow-runtime-CacBbxN0.d.ts} +2 -1
- package/dist/data-flow.cjs +13 -2
- package/dist/data-flow.cjs.map +1 -1
- package/dist/data-flow.d.cts +1 -1
- package/dist/data-flow.d.ts +1 -1
- package/dist/data-flow.js +3 -1
- package/dist/external-handoff-panel.cjs +22 -6
- package/dist/external-handoff-panel.cjs.map +1 -1
- package/dist/external-handoff-panel.d.cts +5 -2
- package/dist/external-handoff-panel.d.ts +5 -2
- package/dist/external-handoff-panel.js +21 -6
- package/dist/external-handoff-panel.js.map +1 -1
- package/dist/index.cjs +107 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +99 -9
- package/dist/index.js.map +1 -1
- package/dist/motion-extension-contract-B3m26CML.d.cts +72 -0
- package/dist/motion-extension-contract-B3m26CML.d.ts +72 -0
- package/dist/motion.d.cts +3 -71
- package/dist/motion.d.ts +3 -71
- package/package.json +15 -2
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { SpotTargetContext, PageContext, SpotPatchLocale } from '@spotpatch/shared';
|
|
2
|
+
import { ContextualAskCapability, AskJobSnapshot, AskJobCreateRequest, AskJobEvent, AskJobResultResponse, AskAnswerResult, ErrorCode, AskDraftOrigin, AskSourceReference, AskJobStatus, AskAnswerWarningCode } from '@spotpatch/shared/contextual-ask-browser';
|
|
3
|
+
import { c as FloatingSurfaceProjection } from './motion-extension-contract-B3m26CML.js';
|
|
4
|
+
|
|
5
|
+
interface SelectionSnapshotTarget extends Omit<SpotTargetContext, "page" | "warnings"> {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly page: PageContext;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface ContextualAskApi {
|
|
11
|
+
readonly capability: () => Promise<ContextualAskCapability>;
|
|
12
|
+
readonly cancelJob: (jobId: string) => Promise<AskJobSnapshot>;
|
|
13
|
+
readonly cancelPending: () => void;
|
|
14
|
+
readonly createJob: (request: AskJobCreateRequest) => Promise<AskJobSnapshot>;
|
|
15
|
+
readonly dispose: () => void;
|
|
16
|
+
readonly events: (jobId: string, afterSequence: number, onEvent: (event: AskJobEvent) => void) => Promise<void>;
|
|
17
|
+
readonly result: (jobId: string) => Promise<AskJobResultResponse>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type ClipboardWriter = Readonly<{
|
|
21
|
+
writeText(value: string): Promise<void>;
|
|
22
|
+
}>;
|
|
23
|
+
|
|
24
|
+
interface ContextualAskSelectionPreview {
|
|
25
|
+
readonly contextReady: boolean;
|
|
26
|
+
readonly targetCount: number;
|
|
27
|
+
readonly sourceCount: number;
|
|
28
|
+
}
|
|
29
|
+
interface ContextualAskSelectionDraft {
|
|
30
|
+
readonly locale: SpotPatchLocale;
|
|
31
|
+
readonly targets: readonly SelectionSnapshotTarget[];
|
|
32
|
+
}
|
|
33
|
+
interface ContextualAskPanel {
|
|
34
|
+
readonly cancelButton: HTMLButtonElement;
|
|
35
|
+
readonly consentCheckbox: HTMLInputElement;
|
|
36
|
+
readonly convertButton: HTMLButtonElement;
|
|
37
|
+
readonly copyButton: HTMLButtonElement;
|
|
38
|
+
readonly executorSelect: HTMLSelectElement;
|
|
39
|
+
readonly newQuestionButton: HTMLButtonElement;
|
|
40
|
+
readonly questionInput: HTMLTextAreaElement;
|
|
41
|
+
readonly root: HTMLElement;
|
|
42
|
+
readonly styles: HTMLStyleElement;
|
|
43
|
+
readonly submitButton: HTMLButtonElement;
|
|
44
|
+
readonly clear: () => void;
|
|
45
|
+
readonly dispose: () => void;
|
|
46
|
+
readonly focusQuestion: () => void;
|
|
47
|
+
readonly mode: () => "ask" | "change";
|
|
48
|
+
readonly notify: (event: "copied" | "copy-failed" | "converted" | "source-open-failed") => void;
|
|
49
|
+
readonly readConsent: () => boolean;
|
|
50
|
+
readonly readExecutorId: () => string | undefined;
|
|
51
|
+
readonly readModel: () => string | undefined;
|
|
52
|
+
readonly readQuestion: () => string;
|
|
53
|
+
readonly renderAnswer: (result: AskAnswerResult, stale: boolean) => void;
|
|
54
|
+
readonly renderCapability: (capability?: ContextualAskCapability) => void;
|
|
55
|
+
readonly renderError: (code?: ErrorCode) => void;
|
|
56
|
+
readonly renderEvent: (event: AskJobEvent) => void;
|
|
57
|
+
readonly renderJob: (snapshot: AskJobSnapshot) => void;
|
|
58
|
+
readonly selectedSourceId: (target: EventTarget | null) => string | undefined;
|
|
59
|
+
readonly setBusy: (busy: boolean) => void;
|
|
60
|
+
readonly setConsent: (granted: boolean) => void;
|
|
61
|
+
readonly setMode: (mode: "ask" | "change") => void;
|
|
62
|
+
readonly setOrigin: (origin?: AskDraftOrigin) => void;
|
|
63
|
+
readonly setSelectionPreview: (preview: ContextualAskSelectionPreview) => void;
|
|
64
|
+
readonly setSelectionVisible: (visible: boolean) => void;
|
|
65
|
+
readonly sourceById: (sourceId: string) => AskSourceReference | undefined;
|
|
66
|
+
readonly answerPlainText: () => string;
|
|
67
|
+
}
|
|
68
|
+
interface ContextualAskWorkflow {
|
|
69
|
+
readonly beginSelection: () => void;
|
|
70
|
+
readonly cancelPending: () => void;
|
|
71
|
+
readonly dispose: () => void;
|
|
72
|
+
readonly isBusy: () => boolean;
|
|
73
|
+
readonly mount: () => void;
|
|
74
|
+
readonly selectionChanged: () => void;
|
|
75
|
+
}
|
|
76
|
+
interface ContextualAskExtension {
|
|
77
|
+
readonly createPanel: (input: Readonly<{
|
|
78
|
+
document: Document;
|
|
79
|
+
locale: () => SpotPatchLocale;
|
|
80
|
+
subscribeLocale: (listener: () => void) => () => void;
|
|
81
|
+
changeRoot: HTMLElement;
|
|
82
|
+
changeActions: HTMLElement;
|
|
83
|
+
announce: (message: string) => void;
|
|
84
|
+
onModeChange: (mode: "ask" | "change", title: string, subtitle: string) => void;
|
|
85
|
+
onExecutionChange: (projection?: FloatingSurfaceProjection) => void;
|
|
86
|
+
onViewChange: () => void;
|
|
87
|
+
}>) => ContextualAskPanel;
|
|
88
|
+
readonly createWorkflow: (input: Readonly<{
|
|
89
|
+
api?: ContextualAskApi;
|
|
90
|
+
clipboard?: ClipboardWriter;
|
|
91
|
+
createId: () => string;
|
|
92
|
+
fetch: typeof globalThis.fetch;
|
|
93
|
+
getSelection: () => ContextualAskSelectionDraft | undefined;
|
|
94
|
+
onConvert: (origin: AskDraftOrigin) => void;
|
|
95
|
+
onBusyChange: (busy: boolean) => void;
|
|
96
|
+
onOpenSource: (source: AskSourceReference) => Promise<void>;
|
|
97
|
+
panel: ContextualAskPanel;
|
|
98
|
+
sessionToken: string;
|
|
99
|
+
}>) => ContextualAskWorkflow;
|
|
100
|
+
}
|
|
101
|
+
declare function registerContextualAskExtension(extension: ContextualAskExtension): void;
|
|
102
|
+
declare function getContextualAskExtension(): ContextualAskExtension | undefined;
|
|
103
|
+
|
|
104
|
+
interface ContextualAskMessages {
|
|
105
|
+
readonly mode: Readonly<{
|
|
106
|
+
ask: string;
|
|
107
|
+
change: string;
|
|
108
|
+
label: string;
|
|
109
|
+
}>;
|
|
110
|
+
readonly title: string;
|
|
111
|
+
readonly subtitle: string;
|
|
112
|
+
readonly questionLabel: string;
|
|
113
|
+
readonly questionPlaceholder: string;
|
|
114
|
+
readonly suggestionsLabel: string;
|
|
115
|
+
readonly suggestions: readonly string[];
|
|
116
|
+
readonly executorLabel: string;
|
|
117
|
+
readonly modelLabel: string;
|
|
118
|
+
readonly loadingExecutors: string;
|
|
119
|
+
readonly noExecutor: string;
|
|
120
|
+
readonly unavailable: string;
|
|
121
|
+
readonly consent: string;
|
|
122
|
+
readonly dataSummary: (targets: number, sources: number) => string;
|
|
123
|
+
readonly safety: string;
|
|
124
|
+
readonly submit: string;
|
|
125
|
+
readonly cancel: string;
|
|
126
|
+
readonly newQuestion: string;
|
|
127
|
+
readonly copy: string;
|
|
128
|
+
readonly convert: string;
|
|
129
|
+
readonly answerTitle: string;
|
|
130
|
+
readonly sourcesTitle: string;
|
|
131
|
+
readonly stale: string;
|
|
132
|
+
readonly convertedTitle: string;
|
|
133
|
+
readonly convertedBody: string;
|
|
134
|
+
readonly status: Readonly<Record<AskJobStatus, string>>;
|
|
135
|
+
readonly sourceLabel: (path: string, start: number, end: number) => string;
|
|
136
|
+
readonly readSource: (path: string) => string;
|
|
137
|
+
readonly readFiles: (bucket: string) => string;
|
|
138
|
+
readonly copied: string;
|
|
139
|
+
readonly copyFailed: string;
|
|
140
|
+
readonly sourceOpenFailed: string;
|
|
141
|
+
readonly converted: string;
|
|
142
|
+
readonly error: (code?: ErrorCode) => string;
|
|
143
|
+
readonly warning: (code: AskAnswerWarningCode) => string;
|
|
144
|
+
}
|
|
145
|
+
declare function contextualAskMessages(locale: SpotPatchLocale): ContextualAskMessages;
|
|
146
|
+
|
|
147
|
+
interface CreateContextualAskPanelInput {
|
|
148
|
+
readonly document: Document;
|
|
149
|
+
readonly locale: Parameters<typeof contextualAskMessages>[0] extends never ? never : () => Parameters<typeof contextualAskMessages>[0];
|
|
150
|
+
readonly subscribeLocale: (listener: () => void) => () => void;
|
|
151
|
+
readonly changeRoot: HTMLElement;
|
|
152
|
+
readonly changeActions: HTMLElement;
|
|
153
|
+
readonly announce: (message: string) => void;
|
|
154
|
+
readonly onModeChange: (mode: "ask" | "change", title: string, subtitle: string) => void;
|
|
155
|
+
readonly onExecutionChange: (projection?: FloatingSurfaceProjection) => void;
|
|
156
|
+
readonly onViewChange: () => void;
|
|
157
|
+
}
|
|
158
|
+
declare function createContextualAskPanel(input: CreateContextualAskPanelInput): ContextualAskPanel;
|
|
159
|
+
|
|
160
|
+
type WorkflowInput = Parameters<ContextualAskExtension["createWorkflow"]>[0];
|
|
161
|
+
declare function createContextualAskWorkflow(input: WorkflowInput): ContextualAskWorkflow;
|
|
162
|
+
|
|
163
|
+
declare function installContextualAskExtension(): void;
|
|
164
|
+
|
|
165
|
+
export { type ContextualAskExtension, type ContextualAskPanel, type ContextualAskWorkflow, createContextualAskPanel, createContextualAskWorkflow, getContextualAskExtension, installContextualAskExtension, registerContextualAskExtension };
|