2026-09-28 20:29:21 -07:00
symbol JavaScript id "target:org.quixos.execution.javascript@1";
2026-09-19 22:33:20 -07:00
// Shared record definitions, repeated explicitly in independently locked resources.
external atom Document id "atom:reader:document";
external atom Highlight id "atom:reader:highlight";
external atom Comment id "atom:reader:comment";
type SourceRange = record {
sourceRevision: string;
start: int32;
end: int32;
};
type CommentContent = record {
text: string;
tags: list<string>;
};
type DocumentSeed = record { sourceRevision: string; content: string; };
import interface DocumentData;
import interface HighlightData;
import interface CommentData;
type CommentSeed = record { content: CommentContent; };
type HighlightSeed = record {
range: SourceRange;
comments: list<record { key: string; target: atom-ref<Comment>; }>;
};
package ReaderRuntime id "package:reader-runtime"
revision "package:reader-runtime@1" {
operation addHighlight id "reader:add-highlight"
: SourceRange -> atom-ref<Highlight>
2026-09-28 20:29:21 -07:00
mode call execution transaction targets [JavaScript, server]
2026-09-19 22:33:20 -07:00
receiver atom Document requires {
interface document id "reader:add:document" : DocumentData
using [sourceRevision.get, content.get, highlights.connect];
creation highlight id "reader:add:highlight" : Highlight input HighlightSeed;
creation comment id "reader:add:comment" : Comment input CommentSeed;
};
operation excerpt id "reader:excerpt" : unit -> string
2026-09-28 20:29:21 -07:00
mode call execution snapshot targets [JavaScript, server]
2026-09-19 22:33:20 -07:00
receiver atom Highlight requires {
state range id "reader:excerpt:range" : SourceRange [read];
interface document id "reader:excerpt:document" : DocumentData
using [sourceRevision.get, content.get];
};
// A receiverless function needs no synthetic service object.
function validateRange id "reader:validate-range"
: record { range: SourceRange; content: string; } -> bool
2026-09-28 20:29:21 -07:00
execution snapshot targets [JavaScript, server];
2026-09-19 22:33:20 -07:00
function createDocument id "reader:create-document"
: DocumentSeed -> atom-ref<Document>
2026-09-28 20:29:21 -07:00
execution transaction targets [JavaScript, server] requires {
2026-09-19 22:33:20 -07:00
creation document id "reader:create:document" : Document input DocumentSeed;
};
query ReplicaInputs id "reader:replica-inputs" root DocumentData
document "queries/replica-inputs.graphql" operation "ReplicaInputs" {
replica;
view Highlight as HighlightData;
view Comment as CommentData;
max rows 5000;
max depth 8;
max result-bytes 8388608;
}
query ReaderScreen id "reader:screen" root DocumentData
document "queries/reader-screen.graphql" operation "ReaderScreen" {
local from ReplicaInputs;
view Highlight as HighlightData;
view Comment as CommentData;
max rows 5000;
max depth 8;
max result-bytes 8388608;
watch;
}
query HighlightScope id "reader:highlight-scope" root workspace HighlightData document "queries/highlight-scope.graphql" operation "HighlightScope" { view Comment as CommentData; replica; max rows 200; }
2026-09-20 02:42:13 -07:00
query HighlightWindow id "reader:highlight-window" root workspace HighlightData document "queries/highlight-window.graphql" operation "HighlightWindow" { view Comment as CommentData; replica; max rows 200; }
2026-09-19 22:33:20 -07:00
query HighlightList id "reader:highlight-list" root workspace HighlightData document "queries/highlight-list.graphql" operation "HighlightList" { view Comment as CommentData; local from HighlightScope; max rows 200; watch; }
2026-09-20 03:44:49 -07:00
query HighlightWindowList id "reader:highlight-window-list" root workspace HighlightData document "queries/highlight-list.graphql" operation "HighlightList" { view Comment as CommentData; local from HighlightWindow; max rows 200; watch; }
2026-09-19 22:33:20 -07:00
query HighlightEditorInputs id "reader:editor-inputs" root HighlightData document "queries/editor-inputs.graphql" operation "HighlightEditorInputs" { view Comment as CommentData; replica; max rows 1; }
query HighlightEditorView id "reader:editor-view" root HighlightData document "queries/editor-view.graphql" operation "HighlightEditorView" { view Comment as CommentData; local from HighlightEditorInputs; max rows 1; watch; }
2026-09-21 00:10:45 -07:00
query ConfirmedColor id "reader:confirmed-color" root HighlightData document "queries/confirmed-color.graphql" operation "ConfirmedColor" { view Comment as CommentData; max rows 1; watch; }
2026-09-19 22:33:20 -07:00
}