@opencraw/studio 0.0.6 → 0.0.8

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.
Files changed (67) hide show
  1. package/dist/index.esm.js +3632 -861
  2. package/dist/src/document-view/deck-view.mapper.d.ts +70 -0
  3. package/dist/src/document-view/index.d.ts +11 -0
  4. package/dist/src/document-view/pdf-view.mapper.d.ts +47 -0
  5. package/dist/src/document-view/table-preview.use-case.d.ts +152 -0
  6. package/dist/src/document-view/tree-view.mapper.d.ts +47 -0
  7. package/dist/src/document-view/workbook-view.mapper.d.ts +51 -0
  8. package/dist/src/explain-why/index.d.ts +5 -0
  9. package/dist/src/explain-why/item-hint.algorithm.d.ts +13 -0
  10. package/dist/src/explain-why/why-sentence.mapper.d.ts +48 -0
  11. package/dist/src/explain-why/why.use-case.d.ts +26 -0
  12. package/dist/src/flow-recording/action-to-step.mapper.d.ts +16 -0
  13. package/dist/src/flow-recording/index.d.ts +13 -0
  14. package/dist/src/flow-recording/next-link.policy.d.ts +27 -0
  15. package/dist/src/flow-recording/recorded-action.contract.d.ts +114 -0
  16. package/dist/src/flow-recording/recorder-script.client.d.ts +48 -0
  17. package/dist/src/flow-recording/recorder-session.use-case.d.ts +67 -0
  18. package/dist/src/flow-recording/secret-field.policy.d.ts +33 -0
  19. package/dist/src/flow-recording/wait-insertion.policy.d.ts +26 -0
  20. package/dist/src/index.d.ts +4 -3
  21. package/dist/src/page-inspector/dom-tree.mapper.d.ts +32 -0
  22. package/dist/src/page-inspector/index.d.ts +7 -0
  23. package/dist/src/page-inspector/page-data.algorithm.d.ts +39 -0
  24. package/dist/src/page-inspector/responses-seen.use-case.d.ts +36 -0
  25. package/dist/src/page-snapshot/index.d.ts +3 -0
  26. package/dist/src/page-snapshot/pdf-bytes.use-case.d.ts +16 -0
  27. package/dist/src/page-snapshot/reread-csv.use-case.d.ts +22 -0
  28. package/dist/src/page-snapshot/take-snapshot.use-case.d.ts +26 -1
  29. package/dist/src/sample-run/index.d.ts +3 -1
  30. package/dist/src/sample-run/last-run.store.d.ts +17 -0
  31. package/dist/src/sample-run/run-sample.use-case.d.ts +12 -6
  32. package/dist/src/sample-run/sample-run-record.contract.d.ts +30 -1
  33. package/dist/src/studio-api/command.contract.d.ts +359 -0
  34. package/dist/src/studio-api/deck-preview-view.contract.d.ts +28 -0
  35. package/dist/src/studio-api/deck-view.contract.d.ts +127 -0
  36. package/dist/src/studio-api/document-tree-view.contract.d.ts +26 -0
  37. package/dist/src/studio-api/event.contract.d.ts +86 -1
  38. package/dist/src/studio-api/grid-preview-view.contract.d.ts +26 -0
  39. package/dist/src/studio-api/grid-view.contract.d.ts +75 -0
  40. package/dist/src/studio-api/index.d.ts +24 -4
  41. package/dist/src/studio-api/inspect-view.contract.d.ts +62 -0
  42. package/dist/src/studio-api/pdf-view.contract.d.ts +66 -0
  43. package/dist/src/studio-api/responses-seen-view.contract.d.ts +20 -0
  44. package/dist/src/studio-api/snapshot-view.contract.d.ts +22 -1
  45. package/dist/src/studio-api/table-preview-view.contract.d.ts +65 -0
  46. package/dist/src/studio-api/why-view.contract.d.ts +16 -0
  47. package/dist/src/studio-server/deck-preview.handler.d.ts +17 -0
  48. package/dist/src/studio-server/deck-view.handler.d.ts +15 -0
  49. package/dist/src/studio-server/document-tree.handler.d.ts +14 -0
  50. package/dist/src/studio-server/explain-why.handler.d.ts +14 -0
  51. package/dist/src/studio-server/grid-preview.handler.d.ts +17 -0
  52. package/dist/src/studio-server/grid-view.handler.d.ts +20 -0
  53. package/dist/src/studio-server/inspect-page.handler.d.ts +18 -0
  54. package/dist/src/studio-server/pdf-bytes.handler.d.ts +17 -0
  55. package/dist/src/studio-server/pdf-view.handler.d.ts +14 -0
  56. package/dist/src/studio-server/recording.handler.d.ts +33 -0
  57. package/dist/src/studio-server/responses-seen.handler.d.ts +16 -0
  58. package/dist/src/studio-server/studio-http.use-case.d.ts +3 -1
  59. package/dist/src/studio-server/table-preview.handler.d.ts +16 -0
  60. package/dist/src/studio-server/workspace.store.d.ts +8 -3
  61. package/dist/ui/assets/index-DdiGdaTN.js +13 -0
  62. package/dist/ui/assets/pdf-lqXfRfkR.js +56 -0
  63. package/dist/ui/assets/pdf.worker.min-BmVo14Nb.mjs +28 -0
  64. package/dist/ui/assets/pdf.worker.min-D7i8o3wR.js +1 -0
  65. package/dist/ui/index.html +1 -1
  66. package/package.json +3 -2
  67. package/dist/ui/assets/index-BfbrsfCv.js +0 -13
@@ -0,0 +1,18 @@
1
+ import type { InspectPageCommand, InspectView } from '../studio-api/index.js';
2
+ import type { StudioState } from './workspace.store.js';
3
+ /**
4
+ * Handles `inspect-page`: the Inspect panel's DOM tree and data-in-the-page
5
+ * findings, off the same cached snapshot `take-snapshot`/`infer-selector`
6
+ * already use (`page-inspector`, issue #93). `domTree` reads the cached,
7
+ * rewritten snapshot (the same markup the content pane's iframe shows, so a
8
+ * tree row's `nodeId` lines up with it exactly); `pageData` reads the raw
9
+ * capture (`SnapshotResult.rawHtml`), since the display snapshot has had its
10
+ * `<script>` tags stripped for the sandboxed iframe.
11
+ *
12
+ * @param state - The server state.
13
+ * @param command - The command; `command.path` must already have a cached snapshot (call `take-snapshot` first).
14
+ * @returns The tree and the data-in-the-page findings.
15
+ * @throws Error when no workspace is open, or `command.path` has no cached snapshot yet.
16
+ */
17
+ export declare function handleInspectPage(state: StudioState, command: InspectPageCommand): InspectView;
18
+ //# sourceMappingURL=inspect-page.handler.d.ts.map
@@ -0,0 +1,17 @@
1
+ import type { StudioState } from './workspace.store.js';
2
+ /**
3
+ * Handles `GET /api/pdf-bytes`: the raw bytes of a cached PDF snapshot, for
4
+ * the PDF canvas's `pdf.js` to render in the browser (studio plan §3.4,
5
+ * issue #94's 5b). Not a `studio-api` command — the other commands all
6
+ * answer JSON, and pdf.js wants the file itself — so this is its own route,
7
+ * read directly by `studio-http.use-case.ts` (mirrors `static-file.handler.ts`'s
8
+ * own reach outside the command dispatch).
9
+ *
10
+ * @param state - The server state.
11
+ * @param recipeId - The recipe.
12
+ * @param path - The step path; must already have a cached PDF snapshot (call `take-snapshot` first).
13
+ * @returns The raw PDF bytes.
14
+ * @throws Error when `path` has no cached snapshot yet, or the snapshot's document is not a PDF.
15
+ */
16
+ export declare function handlePdfBytes(state: StudioState, recipeId: string, path: string): Promise<Uint8Array>;
17
+ //# sourceMappingURL=pdf-bytes.handler.d.ts.map
@@ -0,0 +1,14 @@
1
+ import type { PdfDocumentView, PdfViewCommand } from '../studio-api/index.js';
2
+ import type { StudioState } from './workspace.store.js';
3
+ /**
4
+ * Handles `pdf-view`: the PDF canvas's cells and rows (`document-view`'s
5
+ * `pdf-view.mapper.ts`, studio plan §3.4, issue #94's 5b), off the same
6
+ * cached snapshot `take-snapshot`/`document-tree` already use.
7
+ *
8
+ * @param state - The server state.
9
+ * @param command - The command; `command.path` must already have a cached snapshot (call `take-snapshot` first).
10
+ * @returns The document's view.
11
+ * @throws Error when no workspace is open, `command.path` has no cached snapshot yet, or the snapshot's document is not a read PDF.
12
+ */
13
+ export declare function handlePdfView(state: StudioState, command: PdfViewCommand): PdfDocumentView;
14
+ //# sourceMappingURL=pdf-view.handler.d.ts.map
@@ -0,0 +1,33 @@
1
+ import type { StartRecordingCommand, StopRecordingCommand } from '../studio-api/index.js';
2
+ import type { StudioState } from './workspace.store.js';
3
+ /**
4
+ * Handles `start-recording`: opens the studio's own headed browser window
5
+ * on the named recipe's start point (issue #95, phase 6) and streams
6
+ * `recording-card`/`recording-note` events as the person drives it. One
7
+ * recording at a time, like one sample run at a time: a second
8
+ * `start-recording` stops whatever was already open first.
9
+ *
10
+ * @param state - The server state: `folder` must already be set, `recorderProfileDir` names the studio's own recorder profile (never a crawl's own, never the person's default browser).
11
+ * @param command - The command.
12
+ * @returns `{ started: true }` once the window is open.
13
+ * @throws Error when no workspace is open, or the recipe cannot be found or loaded.
14
+ */
15
+ export declare function handleStartRecording(state: StudioState, command: StartRecordingCommand): Promise<{
16
+ started: true;
17
+ }>;
18
+ /**
19
+ * Handles `stop-recording`: closes the recording window, if one is open,
20
+ * and answers with every step recorded, in order — enough for the caller to
21
+ * build "make this the login" (`session.bootstrap`) or "keep as steps"
22
+ * without asking the server again. Also broadcasts `recording-stopped`, so
23
+ * every connected client (not only the one that asked) knows the window
24
+ * closed.
25
+ *
26
+ * @param state - The server state holding the active recording, if any.
27
+ * @param _command - The command (carries nothing beyond its type).
28
+ * @returns Every step recorded, in order; empty when nothing was recording.
29
+ */
30
+ export declare function handleStopRecording(state: StudioState, _command: StopRecordingCommand): Promise<{
31
+ steps: Record<string, unknown>[];
32
+ }>;
33
+ //# sourceMappingURL=recording.handler.d.ts.map
@@ -0,0 +1,16 @@
1
+ import type { ResponsesSeenCommand, ResponsesSeenView } from '../studio-api/index.js';
2
+ import type { StudioState } from './workspace.store.js';
3
+ /**
4
+ * Handles `responses-seen`: the JSON responses observed while a recipe's
5
+ * start page rendered (`page-inspector`'s `responses-seen.use-case.ts`,
6
+ * issue #93), for the Inspect panel's "responses seen" list — picking one
7
+ * is the seam the UI uses to switch the recipe to api mode (issue #93's
8
+ * acceptance; the JSON tree canvas that follows is phase 5's).
9
+ *
10
+ * @param state - The server state: `folder` must already be set.
11
+ * @param command - The command.
12
+ * @returns The observed responses.
13
+ * @throws Error when no workspace is open, or the recipe cannot be found or loaded.
14
+ */
15
+ export declare function handleResponsesSeen(state: StudioState, command: ResponsesSeenCommand): Promise<ResponsesSeenView>;
16
+ //# sourceMappingURL=responses-seen.handler.d.ts.map
@@ -12,8 +12,10 @@ export interface StudioServerOptions {
12
12
  * the folder reaches it through the URL's `folder` query param).
13
13
  */
14
14
  initialFolder?: string;
15
- /** Browser launch settings every web-mode command shares (`take-snapshot`, `verify-selector`, `run-sample`); an executable path override (e.g. `OPENCRAW_CHROMIUM`, read by the caller — the server itself has no opinion on env vars) for a sandbox with no full Playwright install. Default: Playwright's own bundled browser. */
15
+ /** Browser launch settings every web-mode command shares (`take-snapshot`, `verify-selector`, `run-sample`, `start-recording`); an executable path override (e.g. `OPENCRAW_CHROMIUM`, read by the caller — the server itself has no opinion on env vars) for a sandbox with no full Playwright install. Default: Playwright's own bundled browser. `start-recording` always forces `headless: false` regardless of what this sets. */
16
16
  browser?: BrowserSessionConfig;
17
+ /** Where the studio's own recorder profile lives (issue #95); default: a fixed directory under the OS temp folder, never a crawl's own profile directory, never the person's default browser. */
18
+ recorderProfileDir?: string;
17
19
  }
18
20
  /** The running server: its URL (token included, ready to open), the token alone, and how to stop it. */
19
21
  export interface StudioServer {
@@ -0,0 +1,16 @@
1
+ import type { TablePreviewCommand, TablePreviewView } from '../studio-api/index.js';
2
+ import type { StudioState } from './workspace.store.js';
3
+ /**
4
+ * Handles `table-preview`: the PDF canvas's live preview of a `table`
5
+ * extract's options (`document-view`'s `table-preview.use-case.ts`, studio
6
+ * plan §3.4, issue #94's 5b), off the same cached snapshot `take-snapshot`
7
+ * already captured — a pure computation over it, so this answers instantly
8
+ * on every option change, no re-fetch or re-parse.
9
+ *
10
+ * @param state - The server state.
11
+ * @param command - The command; `command.path` must already have a cached snapshot (call `take-snapshot` first).
12
+ * @returns The matches, or `error` when an option's pattern does not compile.
13
+ * @throws Error when no workspace is open, or `command.path` has no cached snapshot yet.
14
+ */
15
+ export declare function handleTablePreview(state: StudioState, command: TablePreviewCommand): TablePreviewView;
16
+ //# sourceMappingURL=table-preview.handler.d.ts.map
@@ -1,18 +1,23 @@
1
1
  import type { BrowserSessionConfig } from '@opencraw/core';
2
+ import type { RecorderSessionHandle } from '../flow-recording/index.js';
2
3
  import type { SnapshotCache } from '../page-snapshot/index.js';
3
- import type { SampleRunHandle } from '../sample-run/index.js';
4
+ import type { LastRunCache, SampleRunHandle } from '../sample-run/index.js';
4
5
  import type { StudioEvent } from '../studio-api/index.js';
5
6
  import type { WsConnection } from './websocket.client.js';
6
- /** The server's mutable state: the opened folder, the run in progress (if any), the connected event sockets, the per-recipe snapshot cache `take-snapshot`/`verify-selector`/`infer-selector` share, and the browser launch settings every web-mode command (`take-snapshot`, `verify-selector`, `run-sample`) shares. */
7
+ /** The server's mutable state: the opened folder, the run in progress (if any), the recording in progress (if any, issue #95), the connected event sockets, the per-recipe snapshot cache `take-snapshot`/`verify-selector`/`infer-selector` share, each recipe's last finished sample run (`explain-why`, issue #92), the browser launch settings every web-mode command (`take-snapshot`, `verify-selector`, `run-sample`, `start-recording`) shares, and where the studio's own recorder profile lives. */
7
8
  export interface StudioState {
8
9
  folder?: string;
9
10
  activeRun?: SampleRunHandle;
11
+ activeRecording?: RecorderSessionHandle;
10
12
  sockets: Set<WsConnection>;
11
13
  snapshots: SnapshotCache;
14
+ lastRuns: LastRunCache;
12
15
  /** Set once at server start (`StudioServerOptions.browser`); every web-mode command reads it from here rather than each accepting its own. */
13
16
  browser?: BrowserSessionConfig;
17
+ /** Set once at server start (`StudioServerOptions.recorderProfileDir`), else `defaultRecorderProfileDir()`. */
18
+ recorderProfileDir: string;
14
19
  }
15
- /** @returns Fresh state for a new server instance: no workspace open, no run, no sockets, an empty snapshot cache, Playwright's own default browser. */
20
+ /** @returns Fresh state for a new server instance: no workspace open, no run, no recording, no sockets, an empty snapshot cache, no last runs, Playwright's own default browser, the default recorder profile directory. */
16
21
  export declare function createStudioState(): StudioState;
17
22
  /**
18
23
  * Sends one event to every connected client. A socket that errors while