@lincyaw/kernel 1.0.0-rc.90 → 1.0.0-rc.91
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/package.json +1 -1
- package/src/contracts/capture.ts +26 -0
package/package.json
CHANGED
package/src/contracts/capture.ts
CHANGED
|
@@ -4,12 +4,30 @@
|
|
|
4
4
|
* (over MCP) check animations and layout with it instead of scripting a browser.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import type { CanonicalSource } from '../ir.ts'
|
|
8
|
+
|
|
9
|
+
/** Identity and location of one capture, kept beside its pictures as capture.json. */
|
|
10
|
+
export interface CaptureEvidence {
|
|
11
|
+
id: string
|
|
12
|
+
createdAt: string
|
|
13
|
+
directory: string
|
|
14
|
+
manifestFile: string
|
|
15
|
+
/** Retained in the service cache instead of being removed with older recent captures. */
|
|
16
|
+
retained: boolean
|
|
17
|
+
/** The source actually shown in the capturing browser, when its hook reports it. */
|
|
18
|
+
source?: CanonicalSource
|
|
19
|
+
/** The document code bundle loaded by that browser; source alone does not identify scene code. */
|
|
20
|
+
codeBundle?: string
|
|
21
|
+
}
|
|
22
|
+
|
|
7
23
|
/** At most this many pictures a request: each is one image in a tool result. */
|
|
8
24
|
export const CAPTURE_MAX_FRAMES = 12
|
|
9
25
|
/** At most this many boxes a picture reports for `measure`. */
|
|
10
26
|
export const CAPTURE_MAX_BOXES = 200
|
|
11
27
|
|
|
12
28
|
export interface SlideCaptureRequest {
|
|
29
|
+
/** Keep this evidence in the service cache beyond its recent-capture cleanup. */
|
|
30
|
+
retain?: boolean
|
|
13
31
|
/** The page (section) id, or its number from 1. */
|
|
14
32
|
section: string
|
|
15
33
|
/** The steps to show, from 0; every step of the page when omitted. */
|
|
@@ -26,6 +44,7 @@ export interface SlideCaptureRequest {
|
|
|
26
44
|
/**
|
|
27
45
|
* How the presentation reaches each step: `direct` (default) draws it from its step and moment; `backward` shows the
|
|
28
46
|
* step after it first and goes back as a presenter does, with the page's own clock, to check that going back works.
|
|
47
|
+
* `backward` and `at` cannot be combined: use separate calls for timed frames and reverse arrival at rest.
|
|
29
48
|
*/
|
|
30
49
|
arrive?: 'direct' | 'backward'
|
|
31
50
|
/** Draw the presentation's captions over the slide (default true); false shows the whole slide, the narration being in `narration`. */
|
|
@@ -33,6 +52,7 @@ export interface SlideCaptureRequest {
|
|
|
33
52
|
}
|
|
34
53
|
|
|
35
54
|
export interface ReadingCaptureRequest {
|
|
55
|
+
retain?: boolean
|
|
36
56
|
/** The page (section) id, or its number from 1. */
|
|
37
57
|
section: string
|
|
38
58
|
/** The window's width in CSS pixels (default 1280; 390 for a phone). */
|
|
@@ -57,6 +77,7 @@ export interface CapturedReading {
|
|
|
57
77
|
|
|
58
78
|
export interface ReadingCaptureResult {
|
|
59
79
|
document: string
|
|
80
|
+
capture?: CaptureEvidence
|
|
60
81
|
width: number
|
|
61
82
|
frames: CapturedReading[]
|
|
62
83
|
problems: string[]
|
|
@@ -94,6 +115,7 @@ export interface CapturedSlide {
|
|
|
94
115
|
|
|
95
116
|
export interface SlideCaptureResult {
|
|
96
117
|
document: string
|
|
118
|
+
capture?: CaptureEvidence
|
|
97
119
|
/** The slide's size in slide pixels. */
|
|
98
120
|
shape: { width: number, height: number }
|
|
99
121
|
frames: CapturedSlide[]
|
|
@@ -102,6 +124,7 @@ export interface SlideCaptureResult {
|
|
|
102
124
|
}
|
|
103
125
|
|
|
104
126
|
export interface OverviewCaptureRequest {
|
|
127
|
+
retain?: boolean
|
|
105
128
|
/** Each page's last step (default), or every step of every page. */
|
|
106
129
|
steps?: 'last' | 'all'
|
|
107
130
|
appearance?: 'light' | 'dark'
|
|
@@ -113,6 +136,7 @@ export interface OverviewCaptureRequest {
|
|
|
113
136
|
|
|
114
137
|
export interface OverviewCaptureResult {
|
|
115
138
|
document: string
|
|
139
|
+
capture?: CaptureEvidence
|
|
116
140
|
/** The directory of the pictures, named so that they sort in reading order (`03-12-page.png`: page 3, step 12 from 0). */
|
|
117
141
|
dir: string
|
|
118
142
|
frames: { section: string, slide: number, step: number, file: string, narration: string }[]
|
|
@@ -138,6 +162,8 @@ export interface DocumentCapture {
|
|
|
138
162
|
|
|
139
163
|
/** The hook a viewer page opened with `?capture` installs, which the capturing browser drives. */
|
|
140
164
|
export interface CaptureHook {
|
|
165
|
+
/** Identity of the source and document code actually loaded in the page. Older viewers may omit it. */
|
|
166
|
+
snapshot?(): { source?: CanonicalSource, codeBundle?: string }
|
|
141
167
|
/** A slide at a step: drawn at the moment `at` (its rest frame when omitted), or reached going back from the step after. */
|
|
142
168
|
show(position: { section: string, step: number, at?: number, arrive?: 'direct' | 'backward' }): Promise<{ problems: string[] }>
|
|
143
169
|
/** A section of the reading page, scrolled through so that its components load, at rest. */
|