@mostra/protocol 0.10.0 → 0.12.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.
Files changed (129) hide show
  1. package/dist/actions.d.ts +11 -3
  2. package/dist/actions.d.ts.map +1 -1
  3. package/dist/actions.js.map +1 -1
  4. package/dist/browser.d.ts +43 -1
  5. package/dist/browser.d.ts.map +1 -1
  6. package/dist/browser.js +29 -1
  7. package/dist/browser.js.map +1 -1
  8. package/dist/diagnostics/codes/action.d.ts +1 -1
  9. package/dist/diagnostics/codes/action.d.ts.map +1 -1
  10. package/dist/diagnostics/codes/action.js +12 -1
  11. package/dist/diagnostics/codes/action.js.map +1 -1
  12. package/dist/diagnostics/codes/index.d.ts +3 -2
  13. package/dist/diagnostics/codes/index.d.ts.map +1 -1
  14. package/dist/diagnostics/codes/index.js +3 -1
  15. package/dist/diagnostics/codes/index.js.map +1 -1
  16. package/dist/diagnostics/codes/remote.d.ts +1 -1
  17. package/dist/diagnostics/codes/remote.d.ts.map +1 -1
  18. package/dist/diagnostics/codes/remote.js +78 -1
  19. package/dist/diagnostics/codes/remote.js.map +1 -1
  20. package/dist/diagnostics/codes/submit.d.ts +1 -1
  21. package/dist/diagnostics/codes/submit.d.ts.map +1 -1
  22. package/dist/diagnostics/codes/submit.js +12 -1
  23. package/dist/diagnostics/codes/submit.js.map +1 -1
  24. package/dist/diagnostics/codes/team.d.ts +8 -0
  25. package/dist/diagnostics/codes/team.d.ts.map +1 -0
  26. package/dist/diagnostics/codes/team.js +44 -0
  27. package/dist/diagnostics/codes/team.js.map +1 -0
  28. package/dist/diagnostics/diagnostic.d.ts +1 -1
  29. package/dist/diagnostics/diagnostic.d.ts.map +1 -1
  30. package/dist/diagnostics/diagnostic.js +2 -1
  31. package/dist/diagnostics/diagnostic.js.map +1 -1
  32. package/dist/index.d.ts +17 -7
  33. package/dist/index.js +14 -4
  34. package/dist/interaction.d.ts +17 -3
  35. package/dist/interaction.d.ts.map +1 -1
  36. package/dist/interaction.js +17 -13
  37. package/dist/interaction.js.map +1 -1
  38. package/dist/manifest.d.ts +3 -0
  39. package/dist/manifest.d.ts.map +1 -1
  40. package/dist/manifest.js +5 -2
  41. package/dist/manifest.js.map +1 -1
  42. package/dist/methods/artifact/pause.d.ts +33 -0
  43. package/dist/methods/artifact/pause.d.ts.map +1 -0
  44. package/dist/methods/artifact/pause.js +33 -0
  45. package/dist/methods/artifact/pause.js.map +1 -0
  46. package/dist/methods/index.d.ts.map +1 -1
  47. package/dist/methods/index.js +16 -2
  48. package/dist/methods/index.js.map +1 -1
  49. package/dist/methods/port/relay-author.d.ts +28 -0
  50. package/dist/methods/port/relay-author.d.ts.map +1 -0
  51. package/dist/methods/port/relay-author.js +42 -0
  52. package/dist/methods/port/relay-author.js.map +1 -0
  53. package/dist/methods/port/trusted-controls-policy.d.ts +1 -1
  54. package/dist/methods/remote/link.d.ts +40 -0
  55. package/dist/methods/remote/link.d.ts.map +1 -0
  56. package/dist/methods/remote/link.js +40 -0
  57. package/dist/methods/remote/link.js.map +1 -0
  58. package/dist/methods/results/get.d.ts +3 -1
  59. package/dist/methods/results/get.d.ts.map +1 -1
  60. package/dist/methods/results/get.js +4 -3
  61. package/dist/methods/results/get.js.map +1 -1
  62. package/dist/methods/results/list.d.ts +33 -0
  63. package/dist/methods/results/list.d.ts.map +1 -0
  64. package/dist/methods/results/list.js +35 -0
  65. package/dist/methods/results/list.js.map +1 -0
  66. package/dist/methods/roster/add.d.ts +47 -0
  67. package/dist/methods/roster/add.d.ts.map +1 -0
  68. package/dist/methods/roster/add.js +46 -0
  69. package/dist/methods/roster/add.js.map +1 -0
  70. package/dist/methods/roster/get.d.ts +18 -0
  71. package/dist/methods/roster/get.d.ts.map +1 -0
  72. package/dist/methods/roster/get.js +22 -0
  73. package/dist/methods/roster/get.js.map +1 -0
  74. package/dist/methods/roster/remove.d.ts +28 -0
  75. package/dist/methods/roster/remove.d.ts.map +1 -0
  76. package/dist/methods/roster/remove.js +31 -0
  77. package/dist/methods/roster/remove.js.map +1 -0
  78. package/dist/methods/share/start.d.ts +15 -2
  79. package/dist/methods/share/start.d.ts.map +1 -1
  80. package/dist/methods/share/start.js +5 -1
  81. package/dist/methods/share/start.js.map +1 -1
  82. package/dist/methods/state/get.d.ts +1 -1
  83. package/dist/methods/state/patch.d.ts +1 -1
  84. package/dist/methods/view/url.d.ts +1 -1
  85. package/dist/methods/wait/wait.d.ts +1 -1
  86. package/dist/operator.d.ts +511 -0
  87. package/dist/operator.d.ts.map +1 -0
  88. package/dist/operator.js +134 -0
  89. package/dist/operator.js.map +1 -0
  90. package/dist/team-settings.d.ts +21 -0
  91. package/dist/team-settings.d.ts.map +1 -0
  92. package/dist/team-settings.js +27 -0
  93. package/dist/team-settings.js.map +1 -0
  94. package/dist/team.d.ts +221 -0
  95. package/dist/team.d.ts.map +1 -0
  96. package/dist/team.js +162 -0
  97. package/dist/team.js.map +1 -0
  98. package/dist/verify.d.ts +7 -0
  99. package/dist/verify.d.ts.map +1 -1
  100. package/dist/verify.js.map +1 -1
  101. package/dist/worker.d.ts +1 -1
  102. package/package.json +11 -1
  103. package/schemas/protocol.draft-07.json +1027 -45
  104. package/schemas/protocol.schema.json +996 -46
  105. package/src/actions.ts +8 -4
  106. package/src/browser.ts +64 -0
  107. package/src/diagnostics/codes/action.ts +12 -0
  108. package/src/diagnostics/codes/index.ts +6 -2
  109. package/src/diagnostics/codes/remote.ts +84 -0
  110. package/src/diagnostics/codes/submit.ts +12 -0
  111. package/src/diagnostics/codes/team.ts +53 -0
  112. package/src/diagnostics/diagnostic.ts +3 -1
  113. package/src/index.ts +66 -2
  114. package/src/interaction.ts +30 -5
  115. package/src/manifest.ts +5 -0
  116. package/src/methods/artifact/pause.ts +59 -0
  117. package/src/methods/index.ts +14 -0
  118. package/src/methods/port/relay-author.ts +57 -0
  119. package/src/methods/remote/link.ts +65 -0
  120. package/src/methods/results/get.ts +3 -2
  121. package/src/methods/results/list.ts +61 -0
  122. package/src/methods/roster/add.ts +77 -0
  123. package/src/methods/roster/get.ts +30 -0
  124. package/src/methods/roster/remove.ts +49 -0
  125. package/src/methods/share/start.ts +23 -3
  126. package/src/operator.ts +660 -0
  127. package/src/team-settings.ts +38 -0
  128. package/src/team.ts +398 -0
  129. package/src/verify.ts +7 -0
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@ import { AccountId, ArtifactId, CommentId, Cursor, DeliveryId, HomeId, LinkId, M
2
2
  import { ACTION_ARGS_MAX, ACTION_RESULT_MAX, ActionError, Batches, CallRequest, LIVE_KEY_PATTERN, LIVE_RING_DEFAULT, LIVE_RING_MAX, LIVE_VALUE_MAX, LiveRequest, READABLE_LIVE_KEY_PATTERN, RUN_KEY_MAX, RUN_LOG_MAX, RUN_LOG_TRUNCATED, RUN_STATUSES, RunAttachRequest, RunCancelRequest, RunProgress, RunRequest, RunState, SECRET_NAME_PATTERN, SECRET_VALUE_MAX, TALLY_LIVE_PREFIX, isFinalRunStatus } from "./actions.js";
3
3
  import { Duration, durationMs } from "./duration.js";
4
4
  import { SubmissionPolicy } from "./policy.js";
5
+ import { DEFAULT_TEAM_VISIBILITY, TeamSettings, TeamVisibility } from "./team-settings.js";
5
6
  import { ARTIFACT_MANIFEST_KEYS, ArtifactLink, ArtifactManifest, HOSTED_OFFLINE_LIMIT_DEFAULT, HOSTED_OFFLINE_LIMIT_MAX_MS, HostedSettings, TALLY_CHOICES_MAX, TALLY_CHOICES_MIN, TallySpec, manifestProblem } from "./manifest.js";
6
7
  import { ArtifactDetail, ArtifactRef, ArtifactSummary, PublishReceipt, SourceRef, VersionSummary } from "./artifact.js";
7
8
  import { DIAGNOSTIC_AREAS, Diagnostic, DiagnosticFix, DiagnosticLocation, DiagnosticPhase, DiagnosticSeverity } from "./diagnostics/diagnostic.js";
@@ -12,7 +13,7 @@ import { receivable } from "./receive.js";
12
13
  import { RpcPeer, parseParams } from "./rpc/peer.js";
13
14
  import { ControlsPolicy, REVIEW_SET_ID_PATTERN, SubmitChannel, TrustedControl, VersionRef, ViewContext, ViewContextWire, readViewContext } from "./view.js";
14
15
  import { BRIDGE_FIELDS_MAX, BRIDGE_MESSAGES, BRIDGE_TEXT_MAX, CONTROL_LABEL_MAX, MCP_APPS_PROTOCOL_VERSION, OPEN_LINK_SCHEMES, connectBridge, mostraControlsRequest, mostraFieldFocus, mostraFields, mostraFlush, mostraFrameSessionEntered, mostraFrameSessionFailed, mostraPage, mostraReady, mostraVersionAvailable, uiInitialize, uiInitialized, uiOpenLink, uiSizeChanged } from "./bridge.js";
15
- import { Actor, DeliveryStatus, DocumentRevision, EventFilter, EventOrigin, EventRecord, EventTypePattern, FIELD_ID_MAX_LENGTH, FieldConflict, FieldOp, FieldState, MutationResult, ResultComment, Results, SIGNAL_NAME_PATTERN, SubmissionSummary, Viewer, ViewerSpec, WaitCondition, isFieldId } from "./interaction.js";
16
+ import { Actor, DeliveryStatus, DocumentRevision, EventFilter, EventOrigin, EventRecord, EventTypePattern, FIELD_ID_MAX_LENGTH, FieldConflict, FieldOp, FieldState, MutationResult, ResultComment, Results, SIGNAL_NAME_PATTERN, SubmissionSummary, Viewer, ViewerKind, ViewerSpec, WaitCondition, isFieldId } from "./interaction.js";
16
17
  import { BROWSER_PROTOCOL_REVISION, BROWSER_PROTOCOL_REVISIONS, CarryOver, ChooseRequest, DocumentSnapshot, EnterRequest, EnterResult, FRAME_SESSION_HEADER, FieldsRequest, FollowRequest, FrameSessionFacts, FrameTicket, OrphanedField, PollResult, SHELL_SESSION_HEADER, SIGNAL_PAYLOAD_MAX_BYTES, ShellSubmitRequest, SignalRequest, StreamSnapshot, StreamTicket, StreamTicketRequest, SubmitRequest } from "./browser.js";
17
18
  import { BUNDLE_NAME, BUNDLE_PLATFORMS, BUNDLE_SETUP_MARKER, BundleAsset, BundleBrowser, BundleFileEntry, BundleFiles, BundleInfo, BundleLinkEntry, BundlePins, BundlePlatformSchema, BundleSetup, bundleAssetName, isWindowsBundle } from "./bundle.js";
18
19
  import { canonicalJson } from "./canonical.js";
@@ -42,6 +43,7 @@ import { shareDiagnosticCodes } from "./diagnostics/codes/share.js";
42
43
  import { smokeDiagnosticCodes } from "./diagnostics/codes/smoke.js";
43
44
  import { submitDiagnosticCodes } from "./diagnostics/codes/submit.js";
44
45
  import { targetDiagnosticCodes } from "./diagnostics/codes/target.js";
46
+ import { teamDiagnosticCodes } from "./diagnostics/codes/team.js";
45
47
  import { typeDiagnosticCodes } from "./diagnostics/codes/type.js";
46
48
  import { verifyDiagnosticCodes } from "./diagnostics/codes/verify.js";
47
49
  import { createDiagnostic, diagnosticCatalog } from "./diagnostics/codes/index.js";
@@ -52,6 +54,7 @@ import { ExportClass, artifactExportMethod } from "./methods/artifact/export.js"
52
54
  import { artifactGetMethod } from "./methods/artifact/get.js";
53
55
  import { artifactImportMethod } from "./methods/artifact/import.js";
54
56
  import { artifactListMethod } from "./methods/artifact/list.js";
57
+ import { artifactPauseMethod } from "./methods/artifact/pause.js";
55
58
  import { artifactPublishMethod } from "./methods/artifact/publish.js";
56
59
  import { ARTIFACT_PROGRESS, ArtifactProgressParams, DEFAULT_VIEWPORTS, ScreenshotPolicy, VERIFY_PROBE, VERIFY_REPORT, VERIFY_RUNNER_METHODS, VerifyVerdict, ariaSummary, estimateImageTokens, viewportsFor } from "./verify.js";
57
60
  import { artifactVerifyMethod } from "./methods/artifact/verify.js";
@@ -70,6 +73,9 @@ import { instanceCheckMethod } from "./methods/instance/check.js";
70
73
  import { OwnerLinkInfo, RemoteLink, ServerOrigin } from "./remote.js";
71
74
  import { HOST_PROTOCOL_REVISIONS, Revision, negotiateRevision } from "./revision.js";
72
75
  import { CLI_CLIENT_NAME, ClientCapabilities, ClientInfo, DependencyPolicy, HomeConfig, InstanceCapabilities, InstanceInfo, PortName, mostraInitializeMethod } from "./methods/mostra/initialize.js";
76
+ import { PRESENCE_COORDINATE_MAX, PresenceCursor, PresencePeer, PresenceRequest, PresenceSelection, PresenceState, ROSTER_MAX, Respondent, RespondentForPage, RespondentSpec, RespondentStatus, RespondentsRequest, Roster, RosterCounts, RosterForPage } from "./team.js";
77
+ import { CapabilityLink, viewUrlMethod } from "./methods/view/url.js";
78
+ import { RespondentLink, rosterAddMethod } from "./methods/roster/add.js";
73
79
  import { PUBLIC_SHARE_DEFAULT_TTL, PUBLIC_SHARE_MAX_TTL_MS, Share, ShareVia, shareStartMethod } from "./methods/share/start.js";
74
80
  import { ChildProcessStatus, DeliveryCounts, GatewayStatus, WorkerStatus, instanceStatusMethod } from "./methods/instance/status.js";
75
81
  import { livePushMethod } from "./methods/live/push.js";
@@ -77,6 +83,7 @@ import { mostraShutdownMethod } from "./methods/mostra/shutdown.js";
77
83
  import { ExternalBase, OriginString, portAddressingExternalBaseMethod } from "./methods/port/addressing-external-base.js";
78
84
  import { DraftMirror, portDraftsMirrorMethod } from "./methods/port/drafts-mirror.js";
79
85
  import { portIdentityResolveMethod } from "./methods/port/identity-resolve.js";
86
+ import { RELAY_AUTHOR_METHODS, portRelayAuthorMethod } from "./methods/port/relay-author.js";
80
87
  import { RelayViewer, portRelayRunMethod } from "./methods/port/relay-run.js";
81
88
  import { portRelayCallMethod } from "./methods/port/relay-call.js";
82
89
  import { portRelayCancelMethod } from "./methods/port/relay-cancel.js";
@@ -89,12 +96,16 @@ import { relayCallBatchMethod } from "./methods/relay/call-batch.js";
89
96
  import { relayEffectMethod } from "./methods/relay/effect.js";
90
97
  import { relayLiveValueMethod } from "./methods/relay/live-value.js";
91
98
  import { relayRunUpdateMethod } from "./methods/relay/run-update.js";
99
+ import { remoteLinkMethod } from "./methods/remote/link.js";
92
100
  import { remoteLoginMethod } from "./methods/remote/login.js";
93
101
  import { remoteLoginWaitMethod } from "./methods/remote/login-wait.js";
94
102
  import { remoteLogoutMethod } from "./methods/remote/logout.js";
95
103
  import { remoteStatusMethod } from "./methods/remote/status.js";
96
104
  import { remoteTokenMethod } from "./methods/remote/token.js";
97
- import { ResultsMarkdown, resultsGetMethod } from "./methods/results/get.js";
105
+ import { ResultsGetResult, ResultsMarkdown, resultsGetMethod } from "./methods/results/get.js";
106
+ import { RESULTS_LIST_MAX, resultsListMethod } from "./methods/results/list.js";
107
+ import { rosterGetMethod } from "./methods/roster/get.js";
108
+ import { rosterRemoveMethod } from "./methods/roster/remove.js";
98
109
  import { secretDeleteMethod } from "./methods/secret/delete.js";
99
110
  import { SecretEntry, secretSetMethod } from "./methods/secret/set.js";
100
111
  import { secretListMethod } from "./methods/secret/list.js";
@@ -102,7 +113,6 @@ import { shareListMethod } from "./methods/share/list.js";
102
113
  import { shareStopMethod } from "./methods/share/stop.js";
103
114
  import { stateGetMethod } from "./methods/state/get.js";
104
115
  import { statePatchMethod } from "./methods/state/patch.js";
105
- import { CapabilityLink, viewUrlMethod } from "./methods/view/url.js";
106
116
  import { viewDefaultMethod } from "./methods/view/default.js";
107
117
  import { viewLaunchMethod } from "./methods/view/launch.js";
108
118
  import { viewRevokeMethod } from "./methods/view/revoke.js";
@@ -112,4 +122,4 @@ import { hostMethods, hostNotifications } from "./methods/index.js";
112
122
  import { LineSplitter, MAX_LINE_LENGTH, encodeLine } from "./rpc/lines.js";
113
123
  import { ARGUMENT_BIGINT_DIGITS_MAX, RemoteError, SerializationError, UNSERIALIZABLE_CODE, ValueReader, ValueWriter, checkArgumentFrames, deserializeAll, fromBase64, serializeAll, toBase64, wireError } from "./serializer.js";
114
124
  import { DEFAULT_WORKER_LIMITS, ServerEmitParams, ServerLiveValueParams, ServerLogParams, ServerProgressParams, ServerSecretParams, ServerSignalParams, ServerStateGetParams, ServerStatePatchParams, WORKER_CHANNEL_REVISION, WORKER_METHODS, WorkerBatchParams, WorkerCallOutcome, WorkerCallParams, WorkerPingResult, WorkerStartParams, WorkerStartResult, WorkerVersionRef } from "./worker.js";
115
- export { ACTION_ARGS_MAX, ACTION_RESULT_MAX, ALL_SCOPES, ARGUMENT_BIGINT_DIGITS_MAX, ARTIFACT_MANIFEST_KEYS, ARTIFACT_PROGRESS, AccountId, ActionError, Actor, AddedPackage, ArtifactDetail, ArtifactId, ArtifactLink, ArtifactManifest, ArtifactProgressParams, ArtifactRef, ArtifactSummary, BRIDGE_FIELDS_MAX, BRIDGE_MESSAGES, BRIDGE_TEXT_MAX, BROWSER_PROTOCOL_REVISION, BROWSER_PROTOCOL_REVISIONS, BUNDLE_NAME, BUNDLE_PLATFORMS, BUNDLE_SETUP_MARKER, Batches, BundleAsset, BundleBrowser, BundleFileEntry, BundleFiles, BundleInfo, BundleLinkEntry, BundlePins, BundlePlatformSchema, BundleSetup, CLI_CLIENT_NAME, CONTROL_LABEL_MAX, CSRF_HEADER, CallRequest, CapabilityLink, CapabilityScope, CarryOver, ChildProcessStatus, ChooseRequest, ClientCapabilities, ClientInfo, CommentId, ControlsPolicy, Cursor, DEFAULT_DOCS_BASE, DEFAULT_VIEWPORTS, DEFAULT_WORKER_LIMITS, DEV_NOTIFY, DIAGNOSTIC_AREAS, DeliveryCounts, DeliveryId, DeliveryStatus, DependencyPolicy, DevNotifyParams, Diagnostic, DiagnosticFix, DiagnosticLocation, DiagnosticPhase, DiagnosticSeverity, DocumentRevision, DocumentSnapshot, DraftMirror, Duration, EVENTS_NOTIFY, EVENTS_READ_MAX, EnterRequest, EnterResult, EventFilter, EventOrigin, EventRecord, EventTypePattern, EventsNotifyParams, ExportClass, ExternalBase, FIELD_ID_MAX_LENGTH, FRAME_SESSION_HEADER, FieldConflict, FieldOp, FieldState, FieldsRequest, FollowRequest, FrameSessionFacts, FrameTicket, GatewayStatus, HOSTED_OFFLINE_LIMIT_DEFAULT, HOSTED_OFFLINE_LIMIT_MAX_MS, HOST_PROTOCOL_REVISIONS, HomeConfig, HomeId, HostedRoute, HostedSettings, InstanceCapabilities, InstanceInfo, JSON_RPC_ERROR_CODES, JsonRpcErrorObject, JsonRpcFailure, JsonRpcNotification, JsonRpcRequest, JsonRpcSuccess, LIVE_KEY_PATTERN, LIVE_RING_DEFAULT, LIVE_RING_MAX, LIVE_VALUE_MAX, LineSplitter, LinkId, LiveRequest, MAX_LINE_LENGTH, MCP_APPS_PROTOCOL_VERSION, MutationId, MutationResult, OPEN_LINK_SCHEMES, OriginString, OrphanedField, OwnerLinkInfo, PUBLIC_SHARE_DEFAULT_TTL, PUBLIC_SHARE_MAX_TTL_MS, PollResult, PortName, PublishReceipt, READABLE_LIVE_KEY_PATTERN, REVIEW_SET_ID_PATTERN, RUN_KEY_MAX, RUN_LOG_MAX, RUN_LOG_TRUNCATED, RUN_STATUSES, RelayViewer, RemoteError, RemoteLink, ResultComment, Results, ResultsMarkdown, Revision, RouteId, RpcError, RpcPeer, RunAttachRequest, RunCancelRequest, RunId, RunProgress, RunRequest, RunState, SECRET_NAME_PATTERN, SECRET_VALUE_MAX, SHELL_SESSION_HEADER, SIGNAL_NAME_PATTERN, SIGNAL_PAYLOAD_MAX_BYTES, ScreenshotPolicy, SecretEntry, SerializationError, ServerEmitParams, ServerLiveValueParams, ServerLogParams, ServerOrigin, ServerProgressParams, ServerSecretParams, ServerSignalParams, ServerStateGetParams, ServerStatePatchParams, Share, ShareId, ShareVia, ShellSubmitRequest, SignalRequest, SourceRef, StreamSnapshot, StreamTicket, StreamTicketRequest, SubmissionEnvelope, SubmissionId, SubmissionPolicy, SubmissionSummary, SubmitChannel, SubmitRequest, TALLY_CHOICES_MAX, TALLY_CHOICES_MIN, TALLY_LIVE_PREFIX, TallySpec, ThreadId, TokenId, TrustedControl, UNSERIALIZABLE_CODE, VERIFY_PROBE, VERIFY_REPORT, VERIFY_RUNNER_METHODS, ValueReader, ValueWriter, VerifyVerdict, VersionId, VersionPush, VersionRef, VersionSummary, ViewContext, ViewContextWire, ViewId, Viewer, ViewerId, ViewerSpec, WAIT_MAX_MS, WORKER_CHANNEL_REVISION, WORKER_METHODS, WaitCondition, WorkerBatchParams, WorkerCallOutcome, WorkerCallParams, WorkerPingResult, WorkerStartParams, WorkerStartResult, WorkerStatus, WorkerVersionRef, a11yDiagnosticCodes, actionDiagnosticCodes, ariaSummary, artifactCreateMethod, artifactDiagnosticCodes, artifactExportMethod, artifactGetMethod, artifactImportMethod, artifactListMethod, artifactPublishMethod, artifactVerifyMethod, buildDiagnosticCodes, bundleAssetName, canonicalJson, checkArgumentFrames, checkRequest, classifyMessage, cliDiagnosticCodes, connectBridge, consoleDiagnosticCodes, createDiagnostic, defineMethod, depDiagnosticCodes, depsAddMethod, deserializeAll, devStartMethod, devStopMethod, diagnosticCatalog, docsUrl, durationMs, encodeLine, envDiagnosticCodes, estimateImageTokens, eventsAckMethod, eventsReadMethod, eventsSubscribeMethod, eventsUnsubscribeMethod, fieldDiagnosticCodes, fromBase64, gcRunMethod, headerValue, homeDiagnosticCodes, hostDiagnosticCodes, hostMethods, hostNotifications, hostedPushMethod, hostedSubmissionMethod, hygieneDiagnosticCodes, instanceCheckMethod, instanceStatusMethod, isFieldId, isFinalRunStatus, isJsonContentType, isWindowsBundle, liveDiagnosticCodes, livePushMethod, manifestDiagnosticCodes, manifestProblem, mostraControlsRequest, mostraFieldFocus, mostraFields, mostraFlush, mostraFrameSessionEntered, mostraFrameSessionFailed, mostraInitializeMethod, mostraPage, mostraReady, mostraShutdownMethod, mostraVersionAvailable, negotiateRevision, networkDiagnosticCodes, normalizeScopes, parseParams, platformDiagnosticCodes, portAddressingExternalBaseMethod, portDraftsMirrorMethod, portIdentityResolveMethod, portRelayCallMethod, portRelayCancelMethod, portRelayLiveMethod, portRelayReconcileMethod, portRelayRunMethod, portSecretsGetMethod, portSubmissionsDeliverMethod, portTrustedControlsActivatedMethod, portTrustedControlsPolicyMethod, publishDiagnosticCodes, readViewContext, receivable, refusal, regressionDiagnosticCodes, relayCallBatchMethod, relayEffectMethod, relayLiveValueMethod, relayRunUpdateMethod, remoteDiagnosticCodes, remoteLoginMethod, remoteLoginWaitMethod, remoteLogoutMethod, remoteStatusMethod, remoteTokenMethod, resultsGetMethod, runtimeDiagnosticCodes, safeEqual, safePath, scopeAllows, secretDeleteMethod, secretDiagnosticCodes, secretListMethod, secretSetMethod, serializeAll, shareDiagnosticCodes, shareListMethod, shareStartMethod, shareStopMethod, smokeDiagnosticCodes, stateGetMethod, statePatchMethod, submitDiagnosticCodes, targetDiagnosticCodes, toBase64, typeDiagnosticCodes, uiInitialize, uiInitialized, uiOpenLink, uiSizeChanged, verifyDiagnosticCodes, viewDefaultMethod, viewLaunchMethod, viewRevokeMethod, viewRotateMethod, viewUrlMethod, viewportsFor, waitMethod, wireError };
125
+ export { ACTION_ARGS_MAX, ACTION_RESULT_MAX, ALL_SCOPES, ARGUMENT_BIGINT_DIGITS_MAX, ARTIFACT_MANIFEST_KEYS, ARTIFACT_PROGRESS, AccountId, ActionError, Actor, AddedPackage, ArtifactDetail, ArtifactId, ArtifactLink, ArtifactManifest, ArtifactProgressParams, ArtifactRef, ArtifactSummary, BRIDGE_FIELDS_MAX, BRIDGE_MESSAGES, BRIDGE_TEXT_MAX, BROWSER_PROTOCOL_REVISION, BROWSER_PROTOCOL_REVISIONS, BUNDLE_NAME, BUNDLE_PLATFORMS, BUNDLE_SETUP_MARKER, Batches, BundleAsset, BundleBrowser, BundleFileEntry, BundleFiles, BundleInfo, BundleLinkEntry, BundlePins, BundlePlatformSchema, BundleSetup, CLI_CLIENT_NAME, CONTROL_LABEL_MAX, CSRF_HEADER, CallRequest, CapabilityLink, CapabilityScope, CarryOver, ChildProcessStatus, ChooseRequest, ClientCapabilities, ClientInfo, CommentId, ControlsPolicy, Cursor, DEFAULT_DOCS_BASE, DEFAULT_TEAM_VISIBILITY, DEFAULT_VIEWPORTS, DEFAULT_WORKER_LIMITS, DEV_NOTIFY, DIAGNOSTIC_AREAS, DeliveryCounts, DeliveryId, DeliveryStatus, DependencyPolicy, DevNotifyParams, Diagnostic, DiagnosticFix, DiagnosticLocation, DiagnosticPhase, DiagnosticSeverity, DocumentRevision, DocumentSnapshot, DraftMirror, Duration, EVENTS_NOTIFY, EVENTS_READ_MAX, EnterRequest, EnterResult, EventFilter, EventOrigin, EventRecord, EventTypePattern, EventsNotifyParams, ExportClass, ExternalBase, FIELD_ID_MAX_LENGTH, FRAME_SESSION_HEADER, FieldConflict, FieldOp, FieldState, FieldsRequest, FollowRequest, FrameSessionFacts, FrameTicket, GatewayStatus, HOSTED_OFFLINE_LIMIT_DEFAULT, HOSTED_OFFLINE_LIMIT_MAX_MS, HOST_PROTOCOL_REVISIONS, HomeConfig, HomeId, HostedRoute, HostedSettings, InstanceCapabilities, InstanceInfo, JSON_RPC_ERROR_CODES, JsonRpcErrorObject, JsonRpcFailure, JsonRpcNotification, JsonRpcRequest, JsonRpcSuccess, LIVE_KEY_PATTERN, LIVE_RING_DEFAULT, LIVE_RING_MAX, LIVE_VALUE_MAX, LineSplitter, LinkId, LiveRequest, MAX_LINE_LENGTH, MCP_APPS_PROTOCOL_VERSION, MutationId, MutationResult, OPEN_LINK_SCHEMES, OriginString, OrphanedField, OwnerLinkInfo, PRESENCE_COORDINATE_MAX, PUBLIC_SHARE_DEFAULT_TTL, PUBLIC_SHARE_MAX_TTL_MS, PollResult, PortName, PresenceCursor, PresencePeer, PresenceRequest, PresenceSelection, PresenceState, PublishReceipt, READABLE_LIVE_KEY_PATTERN, RELAY_AUTHOR_METHODS, RESULTS_LIST_MAX, REVIEW_SET_ID_PATTERN, ROSTER_MAX, RUN_KEY_MAX, RUN_LOG_MAX, RUN_LOG_TRUNCATED, RUN_STATUSES, RelayViewer, RemoteError, RemoteLink, Respondent, RespondentForPage, RespondentLink, RespondentSpec, RespondentStatus, RespondentsRequest, ResultComment, Results, ResultsGetResult, ResultsMarkdown, Revision, Roster, RosterCounts, RosterForPage, RouteId, RpcError, RpcPeer, RunAttachRequest, RunCancelRequest, RunId, RunProgress, RunRequest, RunState, SECRET_NAME_PATTERN, SECRET_VALUE_MAX, SHELL_SESSION_HEADER, SIGNAL_NAME_PATTERN, SIGNAL_PAYLOAD_MAX_BYTES, ScreenshotPolicy, SecretEntry, SerializationError, ServerEmitParams, ServerLiveValueParams, ServerLogParams, ServerOrigin, ServerProgressParams, ServerSecretParams, ServerSignalParams, ServerStateGetParams, ServerStatePatchParams, Share, ShareId, ShareVia, ShellSubmitRequest, SignalRequest, SourceRef, StreamSnapshot, StreamTicket, StreamTicketRequest, SubmissionEnvelope, SubmissionId, SubmissionPolicy, SubmissionSummary, SubmitChannel, SubmitRequest, TALLY_CHOICES_MAX, TALLY_CHOICES_MIN, TALLY_LIVE_PREFIX, TallySpec, TeamSettings, TeamVisibility, ThreadId, TokenId, TrustedControl, UNSERIALIZABLE_CODE, VERIFY_PROBE, VERIFY_REPORT, VERIFY_RUNNER_METHODS, ValueReader, ValueWriter, VerifyVerdict, VersionId, VersionPush, VersionRef, VersionSummary, ViewContext, ViewContextWire, ViewId, Viewer, ViewerId, ViewerKind, ViewerSpec, WAIT_MAX_MS, WORKER_CHANNEL_REVISION, WORKER_METHODS, WaitCondition, WorkerBatchParams, WorkerCallOutcome, WorkerCallParams, WorkerPingResult, WorkerStartParams, WorkerStartResult, WorkerStatus, WorkerVersionRef, a11yDiagnosticCodes, actionDiagnosticCodes, ariaSummary, artifactCreateMethod, artifactDiagnosticCodes, artifactExportMethod, artifactGetMethod, artifactImportMethod, artifactListMethod, artifactPauseMethod, artifactPublishMethod, artifactVerifyMethod, buildDiagnosticCodes, bundleAssetName, canonicalJson, checkArgumentFrames, checkRequest, classifyMessage, cliDiagnosticCodes, connectBridge, consoleDiagnosticCodes, createDiagnostic, defineMethod, depDiagnosticCodes, depsAddMethod, deserializeAll, devStartMethod, devStopMethod, diagnosticCatalog, docsUrl, durationMs, encodeLine, envDiagnosticCodes, estimateImageTokens, eventsAckMethod, eventsReadMethod, eventsSubscribeMethod, eventsUnsubscribeMethod, fieldDiagnosticCodes, fromBase64, gcRunMethod, headerValue, homeDiagnosticCodes, hostDiagnosticCodes, hostMethods, hostNotifications, hostedPushMethod, hostedSubmissionMethod, hygieneDiagnosticCodes, instanceCheckMethod, instanceStatusMethod, isFieldId, isFinalRunStatus, isJsonContentType, isWindowsBundle, liveDiagnosticCodes, livePushMethod, manifestDiagnosticCodes, manifestProblem, mostraControlsRequest, mostraFieldFocus, mostraFields, mostraFlush, mostraFrameSessionEntered, mostraFrameSessionFailed, mostraInitializeMethod, mostraPage, mostraReady, mostraShutdownMethod, mostraVersionAvailable, negotiateRevision, networkDiagnosticCodes, normalizeScopes, parseParams, platformDiagnosticCodes, portAddressingExternalBaseMethod, portDraftsMirrorMethod, portIdentityResolveMethod, portRelayAuthorMethod, portRelayCallMethod, portRelayCancelMethod, portRelayLiveMethod, portRelayReconcileMethod, portRelayRunMethod, portSecretsGetMethod, portSubmissionsDeliverMethod, portTrustedControlsActivatedMethod, portTrustedControlsPolicyMethod, publishDiagnosticCodes, readViewContext, receivable, refusal, regressionDiagnosticCodes, relayCallBatchMethod, relayEffectMethod, relayLiveValueMethod, relayRunUpdateMethod, remoteDiagnosticCodes, remoteLinkMethod, remoteLoginMethod, remoteLoginWaitMethod, remoteLogoutMethod, remoteStatusMethod, remoteTokenMethod, resultsGetMethod, resultsListMethod, rosterAddMethod, rosterGetMethod, rosterRemoveMethod, runtimeDiagnosticCodes, safeEqual, safePath, scopeAllows, secretDeleteMethod, secretDiagnosticCodes, secretListMethod, secretSetMethod, serializeAll, shareDiagnosticCodes, shareListMethod, shareStartMethod, shareStopMethod, smokeDiagnosticCodes, stateGetMethod, statePatchMethod, submitDiagnosticCodes, targetDiagnosticCodes, teamDiagnosticCodes, toBase64, typeDiagnosticCodes, uiInitialize, uiInitialized, uiOpenLink, uiSizeChanged, verifyDiagnosticCodes, viewDefaultMethod, viewLaunchMethod, viewRevokeMethod, viewRotateMethod, viewUrlMethod, viewportsFor, waitMethod, wireError };
@@ -1,7 +1,7 @@
1
+ import { Cursor } from "./ids.js";
1
2
  import { SubmissionPolicy } from "./policy.js";
2
3
  import { ArtifactLink } from "./manifest.js";
3
4
  import { ControlsPolicy, SubmitChannel, TrustedControl } from "./view.js";
4
- import { Cursor } from "./ids.js";
5
5
  import * as z from "zod";
6
6
  //#region src/interaction.d.ts
7
7
  /** How Mostra knows a viewer (DATA_MODEL §3 `viewer.kind`). */
@@ -10,6 +10,8 @@ import * as z from "zod";
10
10
  * one per browser who isn't signed in, D165 item 8).
11
11
  */
12
12
  export type ViewerKind = "local" | "tailnet" | "token" | "host" | "account" | "anonymous";
13
+ /** The Zod schema of the `ViewerKind` type (inlined where it is used, never a definition of its own). */
14
+ export declare const ViewerKind: z.ZodType<ViewerKind>;
13
15
  /**
14
16
  * A person who views an artifact (PRODUCT vocabulary). The home's local user is one viewer of kind
15
17
  * `local`; a link minted with `viewer` acts as a viewer of kind `token` (D104).
@@ -23,6 +25,11 @@ export interface Viewer {
23
25
  readonly name?: string;
24
26
  /** The host's own key for this person, as given to `view/url` (D104). */
25
27
  readonly ref?: string;
28
+ /**
29
+ * Whether an identity provider verified the name: `true` for a signed-in account, `false` for an
30
+ * anonymous viewer's self-chosen name (hosted links, D165 item 8). Absent for other kinds.
31
+ */
32
+ readonly verified?: boolean;
26
33
  }
27
34
  /** The Zod schema of the `Viewer` type. */
28
35
  export declare const Viewer: z.ZodType<Viewer>;
@@ -46,6 +53,12 @@ export interface Actor {
46
53
  readonly id?: string;
47
54
  /** A display name, when one is known. */
48
55
  readonly name?: string;
56
+ /**
57
+ * For a viewer, as a page sees another one (D168): an opaque key, stable for that viewer of this
58
+ * artifact, never their viewer ID (D104), so attribution, respondents and presence name one person
59
+ * alike.
60
+ */
61
+ readonly key?: string;
49
62
  }
50
63
  /** The Zod schema of the `Actor` type. */
51
64
  export declare const Actor: z.ZodType<Actor>;
@@ -199,8 +212,9 @@ export interface EventFilter {
199
212
  /** The Zod schema of the `EventFilter` type. */
200
213
  export declare const EventFilter: z.ZodType<EventFilter>;
201
214
  /**
202
- * What `wait` waits for (ARCHITECTURE §6, D103): `submitted`, `signal:<name>`, `state:<fieldId>`
203
- * or `event:<type pattern>`.
215
+ * What `wait` waits for (ARCHITECTURE §6, D103, D168): `submitted`, `submitted:all` (every expected
216
+ * respondent submitted: the roster completed), `submitted:<N>` (N submissions, 1 to 10,000),
217
+ * `signal:<name>`, `state:<fieldId>` or `event:<type pattern>`.
204
218
  */
205
219
  export type WaitCondition = string;
206
220
  /** A signal's name: letters, digits, `.`, `_` and `-`, starting with a letter or digit (D106). */
@@ -1 +1 @@
1
- {"version":3,"file":"interaction.d.ts","names":[],"sources":["../src/interaction.ts"],"mappings":";;;;;;;;;;;YA6BY;;;;;iBAMK;;WAEN;;WAEA,MAAM;;WAEN;;WAEA;;;qBAIE,QAAQ,EAAE,QAAQ;;;;;iBAgBd;;WAEN;;WAEA;;;qBAIE,YAAY,EAAE,QAAQ;;iBAWlB;;WAEN;;WAEA;;WAEA;;;qBAIE,OAAO,EAAE,QAAQ;;qBAcjB;;;;;wBAMG,UAAU,cAAc;;YAY5B;;;;;YAMA;;qBAGC,kBAAkB,EAAE,QAAQ;;;;;iBAYxB;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;qBAIE,SAAS,EAAE,QAAQ;;iBAgBf;;WAEN;;WAEA,UAAU;;WAEV,YAAY;;WAEZ;;WAEA;;WAEA;;WAEA;;;qBAIE,YAAY,EAAE,QAAQ;;;;;iBAmBlB;;WAEN;;WAEA,UAAU;;WAEV;;WAEA;;WAEA,YAAY;;WAEZ;;;qBAIE,eAAe,EAAE,QAAQ;;iBAerB;;WAEN,UAAU;;WAEV;;WAEA,oBAAoB;;;qBAIlB,gBAAgB,EAAE,QAAQ;;;;;;iBAmBtB;;WAEN;;WAEA;;WAEA;;WAEA,QAAQ;;;qBAIN,aAAa,EAAE,QAAQ;;;;;iBAiBnB;;WAEN,QAAQ;;WAER;;WAEA;;WAEA;;WAEA;;WAEA,OAAO;;WAEP,YAAY,SAAS;;WAErB,SAAS,SAAS;;WAElB,SAAS;;;qBAIP,aAAa,EAAE,QAAQ;;;;;YAsBxB;;qBAGC,kBAAkB,EAAE,QAAQ;;;;;;iBAaxB;;WAEN;;WAEA,iBAAiB;;;qBAIf,aAAa,EAAE,QAAQ;;;;;YAexB;;qBAGC,qBAAqB;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;;qBAIE,mBAAmB,EAAE,QAAQ;;iBAuBzB;;WAEN;;WAEA;;WAEA;;WAEA;;;iBAIM;;WAEN;;WAEA;;WAEA;;;iBAIM;;WAEN;;WAEA;;WAEA;aACE,QAAQ;aACR;aACA;;;WAGF;aACE;;aAEA;aACA,OAAO;aACP,WAAW;aACX;aACA;aACA;eACE;eACA;eACA;;aAEF;aACA;eAAmB;eAAwB;;;;WAG7C;aAAiB;aAAuB;aAAwB;;;;;;;;iBAQ1D;;WAEN;aACE;aACA;aACA;aACA;aACA,gBAAgB;;;WAGlB;aACE;aACA;aACA;;aAEA;aACA,QAAQ;aACR,SAAS;aACT,QAAQ;aACR;aACA;aACA;;aAEA;;aAEA;aACA,eAAe;aACf,gBAAgB;aAChB;aACA,UAAU;aACV,qBAAqB;;aAErB,SAAS;;;WAGX,SAAS,SAAS;;WAElB;aACE;aACA;aACA;aACA;aACA,OAAO;;;WAGT,QAAQ,SAAS;;WAEjB;aACE;aACA;aACA;;;WAGF,mBAAmB;;WAEnB;aACE;aACA;aACA;aACA;;;WAGF;aACE;aACA;aACA;aACA;;;WAGF;aACE;aACA;aACA;;;WAGF;;WAEA;;;qBAWE,eAAe,EAAE,QAAQ;;qBAkCzB,SAAS,EAAE,QAAQ"}
@@ -11,19 +11,22 @@ import * as z from "zod";
11
11
  * and results. The host protocol methods (`state/*`, `results/get`, `wait`, `events/*`), the
12
12
  * submissions and drafts ports, and the browser protocol all speak these shapes.
13
13
  */
14
+ /** The Zod schema of the `ViewerKind` type (inlined where it is used, never a definition of its own). */
15
+ const ViewerKind = z.enum([
16
+ "local",
17
+ "tailnet",
18
+ "token",
19
+ "host",
20
+ "account",
21
+ "anonymous"
22
+ ]);
14
23
  /** The Zod schema of the `Viewer` type. */
15
24
  const Viewer = z.object({
16
25
  id: ViewerId.schema,
17
- kind: z.enum([
18
- "local",
19
- "tailnet",
20
- "token",
21
- "host",
22
- "account",
23
- "anonymous"
24
- ]),
26
+ kind: ViewerKind,
25
27
  name: z.string().exactOptional(),
26
- ref: z.string().exactOptional()
28
+ ref: z.string().exactOptional(),
29
+ verified: z.boolean().exactOptional()
27
30
  }).register(wireRegistry, {
28
31
  id: "Viewer",
29
32
  description: "A person who views an artifact: ID, kind, display name and the host's own key."
@@ -45,7 +48,8 @@ const Actor = z.object({
45
48
  "mostra"
46
49
  ]),
47
50
  id: z.string().exactOptional(),
48
- name: z.string().exactOptional()
51
+ name: z.string().exactOptional(),
52
+ key: z.string().exactOptional()
49
53
  }).register(wireRegistry, {
50
54
  id: "Actor",
51
55
  description: "Who caused an event or wrote a field: a viewer, an agent, a host or Mostra."
@@ -151,9 +155,9 @@ const EventFilter = z.object({
151
155
  /** A signal's name: letters, digits, `.`, `_` and `-`, starting with a letter or digit (D106). */
152
156
  const SIGNAL_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
153
157
  /** The Zod schema of the `WaitCondition` type. */
154
- const WaitCondition = z.string().regex(/^(submitted|signal:[A-Za-z0-9][A-Za-z0-9._-]{0,63}|state:[^\u0000-\u001f\u007f]{1,256}|event:[a-z][a-zA-Z0-9_-]*(\.[a-zA-Z0-9_-]+)*(\.\*)?)$/).register(wireRegistry, {
158
+ const WaitCondition = z.string().regex(/^(?:(submitted|signal:[A-Za-z0-9][A-Za-z0-9._-]{0,63}|state:[^\u0000-\u001f\u007f]{1,256}|event:[a-z][a-zA-Z0-9_-]*(\.[a-zA-Z0-9_-]+)*(\.\*)?)$|submitted:(?:all|[1-9][0-9]{0,3}|10000)$)/).register(wireRegistry, {
155
159
  id: "WaitCondition",
156
- description: "What wait waits for: submitted, signal:<name>, state:<fieldId> or event:<type>."
160
+ description: "What wait waits for: submitted, submitted:all, submitted:<N>, signal:<name>, state:<fieldId> or event:<type>."
157
161
  });
158
162
  /** The Zod schema of the `DeliveryStatus` type. */
159
163
  const DeliveryStatus = z.object({
@@ -316,6 +320,6 @@ const Results = z.object({
316
320
  description: "The complete submission: artifact, submission facts, answers, fields, state, choices, comments, orphans, actions, signals."
317
321
  });
318
322
  //#endregion
319
- export { Actor, ControlsPolicy, DeliveryStatus, DocumentRevision, EventFilter, EventOrigin, EventRecord, EventTypePattern, FIELD_ID_MAX_LENGTH, FieldConflict, FieldOp, FieldState, MutationResult, ResultComment, Results, SIGNAL_NAME_PATTERN, SubmissionSummary, SubmitChannel, TrustedControl, Viewer, ViewerSpec, WaitCondition, isFieldId };
323
+ export { Actor, ControlsPolicy, DeliveryStatus, DocumentRevision, EventFilter, EventOrigin, EventRecord, EventTypePattern, FIELD_ID_MAX_LENGTH, FieldConflict, FieldOp, FieldState, MutationResult, ResultComment, Results, SIGNAL_NAME_PATTERN, SubmissionSummary, SubmitChannel, TrustedControl, Viewer, ViewerKind, ViewerSpec, WaitCondition, isFieldId };
320
324
 
321
325
  //# sourceMappingURL=interaction.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"interaction.js","names":[],"sources":["../src/interaction.ts"],"sourcesContent":["/**\n * The interaction ledger's wire types (INTERFACES §4, §6, §7, §8; DATA_MODEL §3, §4): viewers,\n * fields and their mutations, events and their filters, `wait` conditions, submissions, deliveries\n * and results. The host protocol methods (`state/*`, `results/get`, `wait`, `events/*`), the\n * submissions and drafts ports, and the browser protocol all speak these shapes.\n */\nimport * as z from \"zod\";\nimport {\n ArtifactId,\n Cursor,\n DeliveryId,\n SubmissionId,\n VersionId,\n ViewerId,\n ViewId,\n} from \"./ids.ts\";\nimport { ArtifactLink, SubmissionPolicy } from \"./manifest.ts\";\nimport type { SubmitChannel } from \"./view.ts\";\nimport { wireRegistry } from \"./wire-registry.ts\";\n\nexport { ControlsPolicy, SubmitChannel, TrustedControl } from \"./view.ts\";\n\n// ── Viewers and actors ────────────────────────────────────────────────────────────────────\n\n/** How Mostra knows a viewer (DATA_MODEL §3 `viewer.kind`). */\n/**\n * How Mostra knows a viewer: `account` and `anonymous` are hosted links' (a signed-in person, and\n * one per browser who isn't signed in, D165 item 8).\n */\nexport type ViewerKind = \"local\" | \"tailnet\" | \"token\" | \"host\" | \"account\" | \"anonymous\";\n\n/**\n * A person who views an artifact (PRODUCT vocabulary). The home's local user is one viewer of kind\n * `local`; a link minted with `viewer` acts as a viewer of kind `token` (D104).\n */\nexport interface Viewer {\n /** The viewer's ID. */\n readonly id: string;\n /** How Mostra knows the viewer. */\n readonly kind: ViewerKind;\n /** The display name, when one is known. */\n readonly name?: string;\n /** The host's own key for this person, as given to `view/url` (D104). */\n readonly ref?: string;\n}\n\n/** The Zod schema of the `Viewer` type. */\nexport const Viewer: z.ZodType<Viewer> = z\n .object({\n id: ViewerId.schema,\n kind: z.enum([\"local\", \"tailnet\", \"token\", \"host\", \"account\", \"anonymous\"]),\n name: z.string().exactOptional(),\n ref: z.string().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"Viewer\",\n description: \"A person who views an artifact: ID, kind, display name and the host's own key.\",\n });\n\n/**\n * The person a capability link acts for (`view/url`'s `viewer`, D104): the host's stable key for\n * them, such as an email or an account ID, and a display name.\n */\nexport interface ViewerSpec {\n /** The host's stable key for this person: the same `ref` always names the same viewer. */\n readonly ref: string;\n /** The name people see; updated when given again. */\n readonly name?: string;\n}\n\n/** The Zod schema of the `ViewerSpec` type. */\nexport const ViewerSpec: z.ZodType<ViewerSpec> = z\n .object({\n ref: z.string().min(1).max(256),\n name: z.string().min(1).max(256).exactOptional(),\n })\n .register(wireRegistry, {\n id: \"ViewerSpec\",\n description: \"The person a capability link acts for: the host's stable key and a display name.\",\n });\n\n/** Who caused an event or wrote a field (DATA_MODEL §4). */\nexport interface Actor {\n /** Who: a viewer, an agent (a protocol client), a host, or Mostra itself. */\n readonly kind: \"viewer\" | \"agent\" | \"host\" | \"mostra\";\n /** A viewer's ID, or the protocol client's name for agents and hosts. */\n readonly id?: string;\n /** A display name, when one is known. */\n readonly name?: string;\n}\n\n/** The Zod schema of the `Actor` type. */\nexport const Actor: z.ZodType<Actor> = z\n .object({\n kind: z.enum([\"viewer\", \"agent\", \"host\", \"mostra\"]),\n id: z.string().exactOptional(),\n name: z.string().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"Actor\",\n description: \"Who caused an event or wrote a field: a viewer, an agent, a host or Mostra.\",\n });\n\n// ── Fields and mutations ──────────────────────────────────────────────────────────────────\n\n/** The longest field ID, in UTF-16 code units. */\nexport const FIELD_ID_MAX_LENGTH = 256;\n\n/**\n * Whether `id` is a field ID (D52): 1 to 256 characters without control characters; dots separate\n * the parts that nest in results, so none is empty.\n */\nexport function isFieldId(id: unknown): id is string {\n return (\n typeof id === \"string\" &&\n id.length >= 1 &&\n id.length <= FIELD_ID_MAX_LENGTH &&\n // biome-ignore lint/suspicious/noControlCharactersInRegex: control characters are what it refuses.\n !/[\\u0000-\\u001f\\u007f]/.test(id) &&\n !id.split(\".\").includes(\"\")\n );\n}\n\n/** Which document a field belongs to: the viewer's draft, or the artifact's shared state (D63). */\nexport type FieldScope = \"viewer\" | \"artifact\";\n\n/**\n * A document revision: the decimal string of a document's monotonic counter (DATA_MODEL §3).\n * `\"0\"` is a document nothing has written yet.\n */\nexport type DocumentRevision = string;\n\n/** The Zod schema of the `DocumentRevision` type. */\nexport const DocumentRevision: z.ZodType<DocumentRevision> = z\n .string()\n .regex(/^(0|[1-9][0-9]{0,15})$/)\n .register(wireRegistry, {\n id: \"DocumentRevision\",\n description: \"A draft's or artifact state's revision: a non-negative decimal integer string.\",\n });\n\n/**\n * One change to one field. Exactly one of `value` and `delete` is given. The optional metadata\n * travels with the field into results and decides what events redact (D52, D106).\n */\nexport interface FieldOp {\n /** The field ID (D52). */\n readonly id: string;\n /** The new value: any JSON value, `null` included. */\n readonly value?: unknown;\n /** Removes the field. */\n readonly delete?: true;\n /** The label people see in results and the shell's blocker list. */\n readonly label?: string;\n /** Whether the shell asks for it before submit. */\n readonly required?: boolean;\n /** Kept in submissions and results, redacted from events and logs (D52). */\n readonly sensitive?: boolean;\n}\n\n/** The Zod schema of the `FieldOp` type. */\nexport const FieldOp: z.ZodType<FieldOp> = z\n .object({\n id: z.string().min(1).max(FIELD_ID_MAX_LENGTH),\n value: z.unknown().exactOptional(),\n delete: z.literal(true).exactOptional(),\n label: z.string().max(1024).exactOptional(),\n required: z.boolean().exactOptional(),\n sensitive: z.boolean().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"FieldOp\",\n description:\n \"One change to one field: a value or a delete, with optional label, required and sensitive.\",\n }) as z.ZodType<FieldOp>;\n\n/** A field's current state. */\nexport interface FieldState {\n /** The field's value: any JSON value. */\n readonly value: unknown;\n /** The document revision that last wrote it. */\n readonly revision: DocumentRevision;\n /** Who wrote it last. */\n readonly updatedBy?: Actor;\n /** When it was written last. */\n readonly updatedAt: string;\n /** The label people see. */\n readonly label?: string;\n /** Whether the shell asks for it before submit. */\n readonly required?: boolean;\n /** Whether events and logs redact its value (D52). */\n readonly sensitive?: boolean;\n}\n\n/** The Zod schema of the `FieldState` type. */\nexport const FieldState: z.ZodType<FieldState> = z\n .object({\n value: z.unknown(),\n revision: DocumentRevision,\n updatedBy: Actor.exactOptional(),\n updatedAt: z.iso.datetime(),\n label: z.string().exactOptional(),\n required: z.boolean().exactOptional(),\n sensitive: z.boolean().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"FieldState\",\n description: \"A field's current value, the revision that wrote it, who wrote it and when.\",\n }) as z.ZodType<FieldState>;\n\n/**\n * A field op that wasn't applied because the field changed after the mutation's base revision\n * (D22, FAILURE_MODEL §5): what the field holds now, so the writer can keep theirs or take it.\n */\nexport interface FieldConflict {\n /** The field's ID. */\n readonly id: string;\n /** The revision that last changed the field. */\n readonly revision: DocumentRevision;\n /** Its current value; absent when it was deleted. */\n readonly value?: unknown;\n /** `true` when the field was deleted. */\n readonly deleted?: true;\n /** Who changed it. */\n readonly updatedBy?: Actor;\n /** When it changed. */\n readonly updatedAt?: string;\n}\n\n/** The Zod schema of the `FieldConflict` type. */\nexport const FieldConflict: z.ZodType<FieldConflict> = z\n .object({\n id: z.string(),\n revision: DocumentRevision,\n value: z.unknown().exactOptional(),\n deleted: z.literal(true).exactOptional(),\n updatedBy: Actor.exactOptional(),\n updatedAt: z.iso.datetime().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"FieldConflict\",\n description: \"A field op not applied because the field changed after the base revision.\",\n }) as z.ZodType<FieldConflict>;\n\n/** What a mutation did: the document's revision after it, the ops applied, and the conflicts. */\nexport interface MutationResult {\n /** The document's revision after the mutation; unchanged when nothing applied. */\n readonly revision: DocumentRevision;\n /** The field IDs whose ops were applied. */\n readonly applied: readonly string[];\n /** The ops not applied, with what each field holds now. */\n readonly conflicts: readonly FieldConflict[];\n}\n\n/** The Zod schema of the `MutationResult` type. */\nexport const MutationResult: z.ZodType<MutationResult> = z\n .object({\n revision: DocumentRevision,\n applied: z.array(z.string()).readonly(),\n conflicts: z.array(FieldConflict).readonly(),\n })\n .register(wireRegistry, {\n id: \"MutationResult\",\n description:\n \"A mutation's outcome: the revision after it, the applied field IDs, the conflicts.\",\n });\n\n// ── Events ────────────────────────────────────────────────────────────────────────────────\n\n/**\n * Where an owner instance's copy of a hosted record came from (INTERFACES §18.2, D165 item 1): the\n * server, the hosted home, its incarnation and the record's cursor there (a submission's is the\n * cursor of its `submission.created`).\n */\nexport interface EventOrigin {\n /** The server's API origin. */\n readonly server: string;\n /** The hosted home's `hom_` ID. */\n readonly home: string;\n /** The hosted home's incarnation when the record was copied. */\n readonly incarnation: string;\n /** The record's cursor in the hosted home. */\n readonly cursor: Cursor;\n}\n\n/** The Zod schema of the `EventOrigin` type. */\nexport const EventOrigin: z.ZodType<EventOrigin> = z\n .object({\n server: z.string().min(1),\n home: z.string().min(1),\n incarnation: z.string().min(1),\n cursor: Cursor.schema,\n })\n .register(wireRegistry, {\n id: \"EventOrigin\",\n description:\n \"Where an owner's copy of a hosted record came from: server, home, incarnation, cursor.\",\n }) as z.ZodType<EventOrigin>;\n\n/**\n * One durable event (DATA_MODEL §4). Its cursor is its stable ID and its place in the home-wide\n * order; `seq` orders an artifact's own events without gaps.\n */\nexport interface EventRecord {\n /** The event's stable ID and home-wide position. */\n readonly cursor: Cursor;\n /** The artifact, or `null` for a home-wide event. */\n readonly artifactId: string | null;\n /** The artifact's sequence number, or `null` for a home-wide event. */\n readonly seq: number | null;\n /** The type from DATA_MODEL §4's catalog. */\n readonly type: string;\n /** When it was appended. */\n readonly at: string;\n /** Who caused it. */\n readonly actor: Actor;\n /** What caused it: a run, a mutation, a submission. */\n readonly causation?: Readonly<Record<string, string>>;\n /** The event's data; sensitive field values are redacted (D52). */\n readonly payload: Readonly<Record<string, unknown>>;\n /** For an event an owner instance copied from its hosted home: where it came from. */\n readonly origin?: EventOrigin;\n}\n\n/** The Zod schema of the `EventRecord` type. */\nexport const EventRecord: z.ZodType<EventRecord> = z\n .object({\n cursor: Cursor.schema,\n artifactId: ArtifactId.schema.nullable(),\n seq: z.int().min(1).nullable(),\n type: z.string(),\n at: z.iso.datetime(),\n actor: Actor,\n causation: z.record(z.string(), z.string()).exactOptional(),\n payload: z.record(z.string(), z.unknown()),\n origin: EventOrigin.exactOptional(),\n })\n .register(wireRegistry, {\n id: \"EventRecord\",\n description:\n \"One durable event: cursor, artifact, per-artifact sequence, type, time, actor, payload.\",\n }) as z.ZodType<EventRecord>;\n\n/**\n * An event type, or a family of them: `submission.created`, or `submission.*` for every type that\n * starts with `submission.`.\n */\nexport type EventTypePattern = string;\n\n/** The Zod schema of the `EventTypePattern` type. */\nexport const EventTypePattern: z.ZodType<EventTypePattern> = z\n .string()\n .regex(/^[a-z][a-zA-Z0-9_-]*(\\.[a-zA-Z0-9_-]+)*(\\.\\*)?$/)\n .register(wireRegistry, {\n id: \"EventTypePattern\",\n description: \"An event type (submission.created) or a family of them (submission.*).\",\n });\n\n/**\n * Which events a reader wants (IN-08, H-09). Both parts are optional, and an event must pass both.\n * `artifact.compacted` always passes for a matching artifact, so a filtered reader still learns of\n * a compaction (DATA_MODEL §4).\n */\nexport interface EventFilter {\n /** Only these artifacts' events; absent: every artifact's, and home-wide ones. */\n readonly artifacts?: readonly string[];\n /** Only these types; absent: every type. */\n readonly types?: readonly EventTypePattern[];\n}\n\n/** The Zod schema of the `EventFilter` type. */\nexport const EventFilter: z.ZodType<EventFilter> = z\n .object({\n artifacts: z.array(ArtifactId.schema).max(1000).readonly().exactOptional(),\n types: z.array(EventTypePattern).max(100).readonly().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"EventFilter\",\n description:\n \"Which events a reader wants: these artifacts' and these types (patterns allowed).\",\n });\n\n/**\n * What `wait` waits for (ARCHITECTURE §6, D103): `submitted`, `signal:<name>`, `state:<fieldId>`\n * or `event:<type pattern>`.\n */\nexport type WaitCondition = string;\n\n/** A signal's name: letters, digits, `.`, `_` and `-`, starting with a letter or digit (D106). */\nexport const SIGNAL_NAME_PATTERN: RegExp = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;\n\n/** The Zod schema of the `WaitCondition` type. */\nexport const WaitCondition: z.ZodType<WaitCondition> = z\n .string()\n .regex(\n // biome-ignore lint/suspicious/noControlCharactersInRegex: field IDs exclude control characters.\n /^(submitted|signal:[A-Za-z0-9][A-Za-z0-9._-]{0,63}|state:[^\\u0000-\\u001f\\u007f]{1,256}|event:[a-z][a-zA-Z0-9_-]*(\\.[a-zA-Z0-9_-]+)*(\\.\\*)?)$/,\n )\n .register(wireRegistry, {\n id: \"WaitCondition\",\n description: \"What wait waits for: submitted, signal:<name>, state:<fieldId> or event:<type>.\",\n });\n\n// ── Submissions, deliveries and results ──────────────────────────────────────────────────\n\n/** A delivery's state (FAILURE_MODEL §4). */\nexport type DeliveryState = \"pending\" | \"delivered\" | \"rejected\" | \"undeliverable\";\n\n/** One submission's delivery to one host (D105). */\nexport interface DeliveryStatus {\n /** The delivery's stable ID (`dlv_`), repeated by every redelivery. */\n readonly deliveryId: string;\n /**\n * The host: its client name. Empty for Mostra's built-in adapter, which takes submissions when no\n * host does; client names are never empty, so no host can be mistaken for it (D105).\n */\n readonly owner: string;\n /** Where the delivery stands. */\n readonly state: DeliveryState;\n /** How many times Mostra called the host for it. */\n readonly attempts: number;\n /** The host's reason, for a rejection. */\n readonly reason?: string;\n /**\n * `true` while a pending delivery waits: its host isn't connected, or an attempt failed and it\n * will be retried (D47's \"Pending delivery\"). Absent while the first attempt is under way.\n */\n readonly waiting?: true;\n /** When its state last changed. */\n readonly updatedAt: string;\n}\n\n/** The Zod schema of the `DeliveryStatus` type. */\nexport const DeliveryStatus: z.ZodType<DeliveryStatus> = z\n .object({\n deliveryId: DeliveryId.schema,\n owner: z.string(),\n state: z.enum([\"pending\", \"delivered\", \"rejected\", \"undeliverable\"]),\n attempts: z.int().min(0),\n reason: z.string().exactOptional(),\n waiting: z.literal(true).exactOptional(),\n updatedAt: z.iso.datetime(),\n })\n .register(wireRegistry, {\n id: \"DeliveryStatus\",\n description: \"One submission's delivery to one host: owner, state, attempts and reason.\",\n });\n\n/** A submission as a submit answers it (INTERFACES §4). */\nexport interface SubmissionSummary {\n /** The submission's ID. */\n readonly id: string;\n /** When it was made. */\n readonly at: string;\n /** The draft epoch it closed (D103); 1 outside `epochs`. */\n readonly epoch: number;\n /** Where the submit came from (D40). */\n readonly channel: SubmitChannel;\n /** The version the view showed. */\n readonly versionId: string;\n /** That version's number. */\n readonly version: number;\n /** The view it was made from. */\n readonly viewId: string;\n /** Whether a newer version existed when the viewer submitted (H-10). */\n readonly staleView: boolean;\n /** The draft revision it was made from. */\n readonly draftRevision: DocumentRevision;\n /** SHA-256 of the snapshot's canonical JSON (RFC 8785), lowercase hex. */\n readonly digest: string;\n /** Every delivery's state, summed up: the worst of them. */\n readonly delivery: DeliveryState;\n /** Each host's delivery, so a viewer sees which host has it (IN-13). */\n readonly deliveries?: readonly DeliveryStatus[];\n /** `true` when this submit repeated an earlier one and got it back (D22). */\n readonly duplicate?: true;\n}\n\n/** The Zod schema of the `SubmissionSummary` type. */\nexport const SubmissionSummary: z.ZodType<SubmissionSummary> = z\n .object({\n id: SubmissionId.schema,\n at: z.iso.datetime(),\n epoch: z.int().min(1),\n channel: z.enum([\"shell\", \"artifact\"]),\n versionId: VersionId.schema,\n version: z.int().min(1),\n viewId: ViewId.schema,\n staleView: z.boolean(),\n draftRevision: DocumentRevision,\n digest: z.string().regex(/^[0-9a-f]{64}$/),\n delivery: z.enum([\"pending\", \"delivered\", \"rejected\", \"undeliverable\"]),\n deliveries: z.array(DeliveryStatus).readonly().exactOptional(),\n duplicate: z.literal(true).exactOptional(),\n })\n .register(wireRegistry, {\n id: \"SubmissionSummary\",\n description:\n \"A submission as a submit answers it: ID, time, epoch, version, view, digest, delivery.\",\n });\n\n/** A rectangle in CSS pixels, relative to its frame. */\nexport interface Rect {\n /** Distance from the frame's left edge. */\n readonly x: number;\n /** Distance from the frame's top edge. */\n readonly y: number;\n /** Width. */\n readonly width: number;\n /** Height. */\n readonly height: number;\n}\n\n/** A viewport: its size in CSS pixels and its device pixel ratio. */\nexport interface Viewport {\n /** Width in CSS pixels. */\n readonly width: number;\n /** Height in CSS pixels. */\n readonly height: number;\n /** Device pixel ratio. */\n readonly dpr: number;\n}\n\n/** One comment thread in results (INTERFACES §8; built by the review layer, WP-20). */\nexport interface ResultComment {\n /** The thread's ID. */\n readonly threadId: string;\n /** Whether the thread is open or resolved. */\n readonly status: \"open\" | \"resolved\";\n /** The thread's messages, oldest first, each with its author. */\n readonly messages: readonly {\n readonly author: Viewer;\n readonly at: string;\n readonly text: string;\n }[];\n /** Every layer of the anchor that applies (D23). */\n readonly anchor: {\n readonly reviewId?: string;\n /** W3C Web Annotation selectors. */\n readonly selectors?: readonly unknown[];\n readonly rect?: Rect;\n readonly viewport?: Viewport;\n readonly page?: string;\n readonly candidateId?: string;\n readonly terminal?: {\n readonly rows: readonly [number, number];\n readonly cols: readonly [number, number];\n readonly t?: number;\n };\n readonly time?: number;\n readonly slide?: { readonly index: number; readonly step: number };\n };\n /** The screenshot crop, always stored (D23). */\n readonly crop: { readonly path: string; readonly width: number; readonly height: number };\n}\n\n/**\n * The complete submission (INTERFACES §8): what `results/get`, `mostra results` and the\n * submissions port carry. Everything in it comes from the immutable submission and the version it\n * names, never from the live draft (IN-06).\n */\nexport interface Results {\n /** The artifact, with the metadata of the version the viewer saw. */\n readonly artifact: {\n readonly id: string;\n readonly title: string;\n readonly description?: string;\n readonly family?: string;\n readonly links: readonly ArtifactLink[];\n };\n /** The submission's facts: when, how, by whom, from which version and view, and its delivery. */\n readonly submission: {\n readonly id: string;\n readonly at: string;\n readonly epoch: number;\n /** The same viewer's previous submission, under `epochs` (D103). */\n readonly previous?: string;\n readonly policy: SubmissionPolicy;\n readonly channel: SubmitChannel;\n readonly viewer: Viewer;\n readonly versionId: string;\n readonly version: number;\n readonly viewId: string;\n /** Whether a newer version existed when the viewer submitted (H-10). */\n readonly staleView: boolean;\n /** The newest version's number at the time, when the view was stale. */\n readonly latestVersion?: number;\n readonly draftRevision: DocumentRevision;\n readonly stateRevision?: DocumentRevision;\n readonly digest: string;\n readonly delivery: DeliveryState;\n readonly deliveries: readonly DeliveryStatus[];\n /** For a submission imported from a hosted home: where it came from (D165 item 1). */\n readonly origin?: EventOrigin;\n };\n /** The draft's fields by ID, dotted IDs nested (D52). */\n readonly answers: Readonly<Record<string, unknown>>;\n /** Every field in `answers` and `state`, with its label and scope. */\n readonly fields: readonly {\n readonly id: string;\n readonly label?: string;\n readonly required?: boolean;\n readonly sensitive?: boolean;\n readonly scope: FieldScope;\n }[];\n /** Artifact state at `stateRevision`, dotted IDs nested (D63). */\n readonly state?: Readonly<Record<string, unknown>>;\n /** The review sets' choices: the fields `review.<set>.choice` (D65). */\n readonly choices: readonly {\n readonly reviewSetId: string;\n readonly candidateId: string;\n readonly label?: string;\n }[];\n /** Comment threads with their anchors and crops (WP-20). */\n readonly comments: readonly ResultComment[];\n /** Answers a newer version couldn't map (D42). */\n readonly orphaned: readonly {\n readonly id: string;\n readonly label?: string;\n readonly value: unknown;\n readonly fromVersion: number;\n }[];\n /** Action runs started in this view (WP-08). */\n readonly actions: readonly {\n readonly runId: string;\n readonly action: string;\n readonly status: string;\n readonly at: string;\n }[];\n /** Signals raised in this view before the submission: the newest 100, within 1 MiB of payloads. */\n readonly signals: readonly {\n readonly name: string;\n readonly at: string;\n readonly payload?: unknown;\n }[];\n /** How many older signals of the view the limit left out; absent when none. */\n readonly signalsOmitted?: number;\n /** Set when compaction removed events of this view before it submitted, so signals may be missing. */\n readonly signalsCompacted?: true;\n}\n\nconst RectSchema = z.object({\n x: z.number(),\n y: z.number(),\n width: z.number(),\n height: z.number(),\n});\n\n/** The Zod schema of the `ResultComment` type. */\nexport const ResultComment: z.ZodType<ResultComment> = z\n .object({\n threadId: z.string(),\n status: z.enum([\"open\", \"resolved\"]),\n messages: z\n .array(z.object({ author: Viewer, at: z.iso.datetime(), text: z.string() }))\n .readonly(),\n anchor: z.object({\n reviewId: z.string().exactOptional(),\n selectors: z.array(z.unknown()).readonly().exactOptional(),\n rect: RectSchema.exactOptional(),\n viewport: z\n .object({ width: z.number(), height: z.number(), dpr: z.number() })\n .exactOptional(),\n page: z.string().exactOptional(),\n candidateId: z.string().exactOptional(),\n terminal: z\n .object({\n rows: z.tuple([z.int(), z.int()]).readonly(),\n cols: z.tuple([z.int(), z.int()]).readonly(),\n t: z.number().exactOptional(),\n })\n .exactOptional(),\n time: z.number().exactOptional(),\n slide: z.object({ index: z.int(), step: z.int() }).exactOptional(),\n }),\n crop: z.object({ path: z.string(), width: z.int(), height: z.int() }),\n })\n .register(wireRegistry, {\n id: \"ResultComment\",\n description: \"One comment thread in results: messages, anchor layers and the screenshot crop.\",\n }) as z.ZodType<ResultComment>;\n\n/** The Zod schema of the `Results` type. */\nexport const Results: z.ZodType<Results> = z\n .object({\n artifact: z.object({\n id: ArtifactId.schema,\n title: z.string(),\n description: z.string().exactOptional(),\n family: z.string().exactOptional(),\n links: z.array(ArtifactLink).readonly(),\n }),\n submission: z.object({\n id: SubmissionId.schema,\n at: z.iso.datetime(),\n epoch: z.int().min(1),\n previous: SubmissionId.schema.exactOptional(),\n policy: SubmissionPolicy,\n channel: z.enum([\"shell\", \"artifact\"]),\n viewer: Viewer,\n versionId: VersionId.schema,\n version: z.int().min(1),\n viewId: ViewId.schema,\n staleView: z.boolean(),\n latestVersion: z.int().min(1).exactOptional(),\n draftRevision: DocumentRevision,\n stateRevision: DocumentRevision.exactOptional(),\n digest: z.string().regex(/^[0-9a-f]{64}$/),\n delivery: z.enum([\"pending\", \"delivered\", \"rejected\", \"undeliverable\"]),\n deliveries: z.array(DeliveryStatus).readonly(),\n origin: EventOrigin.exactOptional(),\n }),\n answers: z.record(z.string(), z.unknown()),\n fields: z\n .array(\n z.object({\n id: z.string(),\n label: z.string().exactOptional(),\n required: z.boolean().exactOptional(),\n sensitive: z.boolean().exactOptional(),\n scope: z.enum([\"viewer\", \"artifact\"]),\n }),\n )\n .readonly(),\n state: z.record(z.string(), z.unknown()).exactOptional(),\n choices: z\n .array(\n z.object({\n reviewSetId: z.string(),\n candidateId: z.string(),\n label: z.string().exactOptional(),\n }),\n )\n .readonly(),\n comments: z.array(ResultComment).readonly(),\n orphaned: z\n .array(\n z.object({\n id: z.string(),\n label: z.string().exactOptional(),\n value: z.unknown(),\n fromVersion: z.int().min(1),\n }),\n )\n .readonly(),\n actions: z\n .array(\n z.object({\n runId: z.string(),\n action: z.string(),\n status: z.string(),\n at: z.iso.datetime(),\n }),\n )\n .readonly(),\n signals: z\n .array(\n z.object({ name: z.string(), at: z.iso.datetime(), payload: z.unknown().exactOptional() }),\n )\n .readonly(),\n signalsOmitted: z.int().min(1).exactOptional(),\n signalsCompacted: z.literal(true).exactOptional(),\n })\n .register(wireRegistry, {\n id: \"Results\",\n description:\n \"The complete submission: artifact, submission facts, answers, fields, state, choices, comments, orphans, actions, signals.\",\n }) as z.ZodType<Results>;\n"],"mappings":";;;;;;;;;;;;;;AA+CA,MAAa,SAA4B,EACtC,OAAO;CACN,IAAI,SAAS;CACb,MAAM,EAAE,KAAK;EAAC;EAAS;EAAW;EAAS;EAAQ;EAAW;CAAW,CAAC;CAC1E,MAAM,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,EAAE,OAAO;EACP,IAAI,EAAE,OAAO;EACb,OAAO,EAAE,OAAO,CAAC,CAAC,cAAc;EAChC,OAAO,EAAE,QAAQ;EACjB,aAAa,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAC5B,CAAC,CACH,CAAC,CACA,SAAS;CACZ,SAAS,EACN,MACC,EAAE,OAAO;EACP,OAAO,EAAE,OAAO;EAChB,QAAQ,EAAE,OAAO;EACjB,QAAQ,EAAE,OAAO;EACjB,IAAI,EAAE,IAAI,SAAS;CACrB,CAAC,CACH,CAAC,CACA,SAAS;CACZ,SAAS,EACN,MACC,EAAE,OAAO;EAAE,MAAM,EAAE,OAAO;EAAG,IAAI,EAAE,IAAI,SAAS;EAAG,SAAS,EAAE,QAAQ,CAAC,CAAC,cAAc;CAAE,CAAC,CAC3F,CAAC,CACA,SAAS;CACZ,gBAAgB,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;CAC7C,kBAAkB,EAAE,QAAQ,IAAI,CAAC,CAAC,cAAc;AAClD,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC"}
1
+ {"version":3,"file":"interaction.js","names":[],"sources":["../src/interaction.ts"],"sourcesContent":["/**\n * The interaction ledger's wire types (INTERFACES §4, §6, §7, §8; DATA_MODEL §3, §4): viewers,\n * fields and their mutations, events and their filters, `wait` conditions, submissions, deliveries\n * and results. The host protocol methods (`state/*`, `results/get`, `wait`, `events/*`), the\n * submissions and drafts ports, and the browser protocol all speak these shapes.\n */\nimport * as z from \"zod\";\nimport {\n ArtifactId,\n Cursor,\n DeliveryId,\n SubmissionId,\n VersionId,\n ViewerId,\n ViewId,\n} from \"./ids.ts\";\nimport { ArtifactLink, SubmissionPolicy } from \"./manifest.ts\";\nimport type { SubmitChannel } from \"./view.ts\";\nimport { wireRegistry } from \"./wire-registry.ts\";\n\nexport { ControlsPolicy, SubmitChannel, TrustedControl } from \"./view.ts\";\n\n// ── Viewers and actors ────────────────────────────────────────────────────────────────────\n\n/** How Mostra knows a viewer (DATA_MODEL §3 `viewer.kind`). */\n/**\n * How Mostra knows a viewer: `account` and `anonymous` are hosted links' (a signed-in person, and\n * one per browser who isn't signed in, D165 item 8).\n */\nexport type ViewerKind = \"local\" | \"tailnet\" | \"token\" | \"host\" | \"account\" | \"anonymous\";\n\n/** The Zod schema of the `ViewerKind` type (inlined where it is used, never a definition of its own). */\nexport const ViewerKind: z.ZodType<ViewerKind> = z.enum([\n \"local\",\n \"tailnet\",\n \"token\",\n \"host\",\n \"account\",\n \"anonymous\",\n]);\n\n/**\n * A person who views an artifact (PRODUCT vocabulary). The home's local user is one viewer of kind\n * `local`; a link minted with `viewer` acts as a viewer of kind `token` (D104).\n */\nexport interface Viewer {\n /** The viewer's ID. */\n readonly id: string;\n /** How Mostra knows the viewer. */\n readonly kind: ViewerKind;\n /** The display name, when one is known. */\n readonly name?: string;\n /** The host's own key for this person, as given to `view/url` (D104). */\n readonly ref?: string;\n /**\n * Whether an identity provider verified the name: `true` for a signed-in account, `false` for an\n * anonymous viewer's self-chosen name (hosted links, D165 item 8). Absent for other kinds.\n */\n readonly verified?: boolean;\n}\n\n/** The Zod schema of the `Viewer` type. */\nexport const Viewer: z.ZodType<Viewer> = z\n .object({\n id: ViewerId.schema,\n kind: ViewerKind,\n name: z.string().exactOptional(),\n ref: z.string().exactOptional(),\n verified: z.boolean().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"Viewer\",\n description: \"A person who views an artifact: ID, kind, display name and the host's own key.\",\n });\n\n/**\n * The person a capability link acts for (`view/url`'s `viewer`, D104): the host's stable key for\n * them, such as an email or an account ID, and a display name.\n */\nexport interface ViewerSpec {\n /** The host's stable key for this person: the same `ref` always names the same viewer. */\n readonly ref: string;\n /** The name people see; updated when given again. */\n readonly name?: string;\n}\n\n/** The Zod schema of the `ViewerSpec` type. */\nexport const ViewerSpec: z.ZodType<ViewerSpec> = z\n .object({\n ref: z.string().min(1).max(256),\n name: z.string().min(1).max(256).exactOptional(),\n })\n .register(wireRegistry, {\n id: \"ViewerSpec\",\n description: \"The person a capability link acts for: the host's stable key and a display name.\",\n });\n\n/** Who caused an event or wrote a field (DATA_MODEL §4). */\nexport interface Actor {\n /** Who: a viewer, an agent (a protocol client), a host, or Mostra itself. */\n readonly kind: \"viewer\" | \"agent\" | \"host\" | \"mostra\";\n /** A viewer's ID, or the protocol client's name for agents and hosts. */\n readonly id?: string;\n /** A display name, when one is known. */\n readonly name?: string;\n /**\n * For a viewer, as a page sees another one (D168): an opaque key, stable for that viewer of this\n * artifact, never their viewer ID (D104), so attribution, respondents and presence name one person\n * alike.\n */\n readonly key?: string;\n}\n\n/** The Zod schema of the `Actor` type. */\nexport const Actor: z.ZodType<Actor> = z\n .object({\n kind: z.enum([\"viewer\", \"agent\", \"host\", \"mostra\"]),\n id: z.string().exactOptional(),\n name: z.string().exactOptional(),\n key: z.string().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"Actor\",\n description: \"Who caused an event or wrote a field: a viewer, an agent, a host or Mostra.\",\n });\n\n// ── Fields and mutations ──────────────────────────────────────────────────────────────────\n\n/** The longest field ID, in UTF-16 code units. */\nexport const FIELD_ID_MAX_LENGTH = 256;\n\n/**\n * Whether `id` is a field ID (D52): 1 to 256 characters without control characters; dots separate\n * the parts that nest in results, so none is empty.\n */\nexport function isFieldId(id: unknown): id is string {\n return (\n typeof id === \"string\" &&\n id.length >= 1 &&\n id.length <= FIELD_ID_MAX_LENGTH &&\n // biome-ignore lint/suspicious/noControlCharactersInRegex: control characters are what it refuses.\n !/[\\u0000-\\u001f\\u007f]/.test(id) &&\n !id.split(\".\").includes(\"\")\n );\n}\n\n/** Which document a field belongs to: the viewer's draft, or the artifact's shared state (D63). */\nexport type FieldScope = \"viewer\" | \"artifact\";\n\n/**\n * A document revision: the decimal string of a document's monotonic counter (DATA_MODEL §3).\n * `\"0\"` is a document nothing has written yet.\n */\nexport type DocumentRevision = string;\n\n/** The Zod schema of the `DocumentRevision` type. */\nexport const DocumentRevision: z.ZodType<DocumentRevision> = z\n .string()\n .regex(/^(0|[1-9][0-9]{0,15})$/)\n .register(wireRegistry, {\n id: \"DocumentRevision\",\n description: \"A draft's or artifact state's revision: a non-negative decimal integer string.\",\n });\n\n/**\n * One change to one field. Exactly one of `value` and `delete` is given. The optional metadata\n * travels with the field into results and decides what events redact (D52, D106).\n */\nexport interface FieldOp {\n /** The field ID (D52). */\n readonly id: string;\n /** The new value: any JSON value, `null` included. */\n readonly value?: unknown;\n /** Removes the field. */\n readonly delete?: true;\n /** The label people see in results and the shell's blocker list. */\n readonly label?: string;\n /** Whether the shell asks for it before submit. */\n readonly required?: boolean;\n /** Kept in submissions and results, redacted from events and logs (D52). */\n readonly sensitive?: boolean;\n}\n\n/** The Zod schema of the `FieldOp` type. */\nexport const FieldOp: z.ZodType<FieldOp> = z\n .object({\n id: z.string().min(1).max(FIELD_ID_MAX_LENGTH),\n value: z.unknown().exactOptional(),\n delete: z.literal(true).exactOptional(),\n label: z.string().max(1024).exactOptional(),\n required: z.boolean().exactOptional(),\n sensitive: z.boolean().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"FieldOp\",\n description:\n \"One change to one field: a value or a delete, with optional label, required and sensitive.\",\n }) as z.ZodType<FieldOp>;\n\n/** A field's current state. */\nexport interface FieldState {\n /** The field's value: any JSON value. */\n readonly value: unknown;\n /** The document revision that last wrote it. */\n readonly revision: DocumentRevision;\n /** Who wrote it last. */\n readonly updatedBy?: Actor;\n /** When it was written last. */\n readonly updatedAt: string;\n /** The label people see. */\n readonly label?: string;\n /** Whether the shell asks for it before submit. */\n readonly required?: boolean;\n /** Whether events and logs redact its value (D52). */\n readonly sensitive?: boolean;\n}\n\n/** The Zod schema of the `FieldState` type. */\nexport const FieldState: z.ZodType<FieldState> = z\n .object({\n value: z.unknown(),\n revision: DocumentRevision,\n updatedBy: Actor.exactOptional(),\n updatedAt: z.iso.datetime(),\n label: z.string().exactOptional(),\n required: z.boolean().exactOptional(),\n sensitive: z.boolean().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"FieldState\",\n description: \"A field's current value, the revision that wrote it, who wrote it and when.\",\n }) as z.ZodType<FieldState>;\n\n/**\n * A field op that wasn't applied because the field changed after the mutation's base revision\n * (D22, FAILURE_MODEL §5): what the field holds now, so the writer can keep theirs or take it.\n */\nexport interface FieldConflict {\n /** The field's ID. */\n readonly id: string;\n /** The revision that last changed the field. */\n readonly revision: DocumentRevision;\n /** Its current value; absent when it was deleted. */\n readonly value?: unknown;\n /** `true` when the field was deleted. */\n readonly deleted?: true;\n /** Who changed it. */\n readonly updatedBy?: Actor;\n /** When it changed. */\n readonly updatedAt?: string;\n}\n\n/** The Zod schema of the `FieldConflict` type. */\nexport const FieldConflict: z.ZodType<FieldConflict> = z\n .object({\n id: z.string(),\n revision: DocumentRevision,\n value: z.unknown().exactOptional(),\n deleted: z.literal(true).exactOptional(),\n updatedBy: Actor.exactOptional(),\n updatedAt: z.iso.datetime().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"FieldConflict\",\n description: \"A field op not applied because the field changed after the base revision.\",\n }) as z.ZodType<FieldConflict>;\n\n/** What a mutation did: the document's revision after it, the ops applied, and the conflicts. */\nexport interface MutationResult {\n /** The document's revision after the mutation; unchanged when nothing applied. */\n readonly revision: DocumentRevision;\n /** The field IDs whose ops were applied. */\n readonly applied: readonly string[];\n /** The ops not applied, with what each field holds now. */\n readonly conflicts: readonly FieldConflict[];\n}\n\n/** The Zod schema of the `MutationResult` type. */\nexport const MutationResult: z.ZodType<MutationResult> = z\n .object({\n revision: DocumentRevision,\n applied: z.array(z.string()).readonly(),\n conflicts: z.array(FieldConflict).readonly(),\n })\n .register(wireRegistry, {\n id: \"MutationResult\",\n description:\n \"A mutation's outcome: the revision after it, the applied field IDs, the conflicts.\",\n });\n\n// ── Events ────────────────────────────────────────────────────────────────────────────────\n\n/**\n * Where an owner instance's copy of a hosted record came from (INTERFACES §18.2, D165 item 1): the\n * server, the hosted home, its incarnation and the record's cursor there (a submission's is the\n * cursor of its `submission.created`).\n */\nexport interface EventOrigin {\n /** The server's API origin. */\n readonly server: string;\n /** The hosted home's `hom_` ID. */\n readonly home: string;\n /** The hosted home's incarnation when the record was copied. */\n readonly incarnation: string;\n /** The record's cursor in the hosted home. */\n readonly cursor: Cursor;\n}\n\n/** The Zod schema of the `EventOrigin` type. */\nexport const EventOrigin: z.ZodType<EventOrigin> = z\n .object({\n server: z.string().min(1),\n home: z.string().min(1),\n incarnation: z.string().min(1),\n cursor: Cursor.schema,\n })\n .register(wireRegistry, {\n id: \"EventOrigin\",\n description:\n \"Where an owner's copy of a hosted record came from: server, home, incarnation, cursor.\",\n }) as z.ZodType<EventOrigin>;\n\n/**\n * One durable event (DATA_MODEL §4). Its cursor is its stable ID and its place in the home-wide\n * order; `seq` orders an artifact's own events without gaps.\n */\nexport interface EventRecord {\n /** The event's stable ID and home-wide position. */\n readonly cursor: Cursor;\n /** The artifact, or `null` for a home-wide event. */\n readonly artifactId: string | null;\n /** The artifact's sequence number, or `null` for a home-wide event. */\n readonly seq: number | null;\n /** The type from DATA_MODEL §4's catalog. */\n readonly type: string;\n /** When it was appended. */\n readonly at: string;\n /** Who caused it. */\n readonly actor: Actor;\n /** What caused it: a run, a mutation, a submission. */\n readonly causation?: Readonly<Record<string, string>>;\n /** The event's data; sensitive field values are redacted (D52). */\n readonly payload: Readonly<Record<string, unknown>>;\n /** For an event an owner instance copied from its hosted home: where it came from. */\n readonly origin?: EventOrigin;\n}\n\n/** The Zod schema of the `EventRecord` type. */\nexport const EventRecord: z.ZodType<EventRecord> = z\n .object({\n cursor: Cursor.schema,\n artifactId: ArtifactId.schema.nullable(),\n seq: z.int().min(1).nullable(),\n type: z.string(),\n at: z.iso.datetime(),\n actor: Actor,\n causation: z.record(z.string(), z.string()).exactOptional(),\n payload: z.record(z.string(), z.unknown()),\n origin: EventOrigin.exactOptional(),\n })\n .register(wireRegistry, {\n id: \"EventRecord\",\n description:\n \"One durable event: cursor, artifact, per-artifact sequence, type, time, actor, payload.\",\n }) as z.ZodType<EventRecord>;\n\n/**\n * An event type, or a family of them: `submission.created`, or `submission.*` for every type that\n * starts with `submission.`.\n */\nexport type EventTypePattern = string;\n\n/** The Zod schema of the `EventTypePattern` type. */\nexport const EventTypePattern: z.ZodType<EventTypePattern> = z\n .string()\n .regex(/^[a-z][a-zA-Z0-9_-]*(\\.[a-zA-Z0-9_-]+)*(\\.\\*)?$/)\n .register(wireRegistry, {\n id: \"EventTypePattern\",\n description: \"An event type (submission.created) or a family of them (submission.*).\",\n });\n\n/**\n * Which events a reader wants (IN-08, H-09). Both parts are optional, and an event must pass both.\n * `artifact.compacted` always passes for a matching artifact, so a filtered reader still learns of\n * a compaction (DATA_MODEL §4).\n */\nexport interface EventFilter {\n /** Only these artifacts' events; absent: every artifact's, and home-wide ones. */\n readonly artifacts?: readonly string[];\n /** Only these types; absent: every type. */\n readonly types?: readonly EventTypePattern[];\n}\n\n/** The Zod schema of the `EventFilter` type. */\nexport const EventFilter: z.ZodType<EventFilter> = z\n .object({\n artifacts: z.array(ArtifactId.schema).max(1000).readonly().exactOptional(),\n types: z.array(EventTypePattern).max(100).readonly().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"EventFilter\",\n description:\n \"Which events a reader wants: these artifacts' and these types (patterns allowed).\",\n });\n\n/**\n * What `wait` waits for (ARCHITECTURE §6, D103, D168): `submitted`, `submitted:all` (every expected\n * respondent submitted: the roster completed), `submitted:<N>` (N submissions, 1 to 10,000),\n * `signal:<name>`, `state:<fieldId>` or `event:<type pattern>`.\n */\nexport type WaitCondition = string;\n\n/** A signal's name: letters, digits, `.`, `_` and `-`, starting with a letter or digit (D106). */\nexport const SIGNAL_NAME_PATTERN: RegExp = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;\n\n/** The Zod schema of the `WaitCondition` type. */\nexport const WaitCondition: z.ZodType<WaitCondition> = z\n .string()\n .regex(\n // biome-ignore lint/suspicious/noControlCharactersInRegex: field IDs exclude control characters.\n /^(?:(submitted|signal:[A-Za-z0-9][A-Za-z0-9._-]{0,63}|state:[^\\u0000-\\u001f\\u007f]{1,256}|event:[a-z][a-zA-Z0-9_-]*(\\.[a-zA-Z0-9_-]+)*(\\.\\*)?)$|submitted:(?:all|[1-9][0-9]{0,3}|10000)$)/,\n )\n .register(wireRegistry, {\n id: \"WaitCondition\",\n description:\n \"What wait waits for: submitted, submitted:all, submitted:<N>, signal:<name>, state:<fieldId> or event:<type>.\",\n });\n\n// ── Submissions, deliveries and results ──────────────────────────────────────────────────\n\n/** A delivery's state (FAILURE_MODEL §4). */\nexport type DeliveryState = \"pending\" | \"delivered\" | \"rejected\" | \"undeliverable\";\n\n/** One submission's delivery to one host (D105). */\nexport interface DeliveryStatus {\n /** The delivery's stable ID (`dlv_`), repeated by every redelivery. */\n readonly deliveryId: string;\n /**\n * The host: its client name. Empty for Mostra's built-in adapter, which takes submissions when no\n * host does; client names are never empty, so no host can be mistaken for it (D105).\n */\n readonly owner: string;\n /** Where the delivery stands. */\n readonly state: DeliveryState;\n /** How many times Mostra called the host for it. */\n readonly attempts: number;\n /** The host's reason, for a rejection. */\n readonly reason?: string;\n /**\n * `true` while a pending delivery waits: its host isn't connected, or an attempt failed and it\n * will be retried (D47's \"Pending delivery\"). Absent while the first attempt is under way.\n */\n readonly waiting?: true;\n /** When its state last changed. */\n readonly updatedAt: string;\n}\n\n/** The Zod schema of the `DeliveryStatus` type. */\nexport const DeliveryStatus: z.ZodType<DeliveryStatus> = z\n .object({\n deliveryId: DeliveryId.schema,\n owner: z.string(),\n state: z.enum([\"pending\", \"delivered\", \"rejected\", \"undeliverable\"]),\n attempts: z.int().min(0),\n reason: z.string().exactOptional(),\n waiting: z.literal(true).exactOptional(),\n updatedAt: z.iso.datetime(),\n })\n .register(wireRegistry, {\n id: \"DeliveryStatus\",\n description: \"One submission's delivery to one host: owner, state, attempts and reason.\",\n });\n\n/** A submission as a submit answers it (INTERFACES §4). */\nexport interface SubmissionSummary {\n /** The submission's ID. */\n readonly id: string;\n /** When it was made. */\n readonly at: string;\n /** The draft epoch it closed (D103); 1 outside `epochs`. */\n readonly epoch: number;\n /** Where the submit came from (D40). */\n readonly channel: SubmitChannel;\n /** The version the view showed. */\n readonly versionId: string;\n /** That version's number. */\n readonly version: number;\n /** The view it was made from. */\n readonly viewId: string;\n /** Whether a newer version existed when the viewer submitted (H-10). */\n readonly staleView: boolean;\n /** The draft revision it was made from. */\n readonly draftRevision: DocumentRevision;\n /** SHA-256 of the snapshot's canonical JSON (RFC 8785), lowercase hex. */\n readonly digest: string;\n /** Every delivery's state, summed up: the worst of them. */\n readonly delivery: DeliveryState;\n /** Each host's delivery, so a viewer sees which host has it (IN-13). */\n readonly deliveries?: readonly DeliveryStatus[];\n /** `true` when this submit repeated an earlier one and got it back (D22). */\n readonly duplicate?: true;\n}\n\n/** The Zod schema of the `SubmissionSummary` type. */\nexport const SubmissionSummary: z.ZodType<SubmissionSummary> = z\n .object({\n id: SubmissionId.schema,\n at: z.iso.datetime(),\n epoch: z.int().min(1),\n channel: z.enum([\"shell\", \"artifact\"]),\n versionId: VersionId.schema,\n version: z.int().min(1),\n viewId: ViewId.schema,\n staleView: z.boolean(),\n draftRevision: DocumentRevision,\n digest: z.string().regex(/^[0-9a-f]{64}$/),\n delivery: z.enum([\"pending\", \"delivered\", \"rejected\", \"undeliverable\"]),\n deliveries: z.array(DeliveryStatus).readonly().exactOptional(),\n duplicate: z.literal(true).exactOptional(),\n })\n .register(wireRegistry, {\n id: \"SubmissionSummary\",\n description:\n \"A submission as a submit answers it: ID, time, epoch, version, view, digest, delivery.\",\n });\n\n/** A rectangle in CSS pixels, relative to its frame. */\nexport interface Rect {\n /** Distance from the frame's left edge. */\n readonly x: number;\n /** Distance from the frame's top edge. */\n readonly y: number;\n /** Width. */\n readonly width: number;\n /** Height. */\n readonly height: number;\n}\n\n/** A viewport: its size in CSS pixels and its device pixel ratio. */\nexport interface Viewport {\n /** Width in CSS pixels. */\n readonly width: number;\n /** Height in CSS pixels. */\n readonly height: number;\n /** Device pixel ratio. */\n readonly dpr: number;\n}\n\n/** One comment thread in results (INTERFACES §8; built by the review layer, WP-20). */\nexport interface ResultComment {\n /** The thread's ID. */\n readonly threadId: string;\n /** Whether the thread is open or resolved. */\n readonly status: \"open\" | \"resolved\";\n /** The thread's messages, oldest first, each with its author. */\n readonly messages: readonly {\n readonly author: Viewer;\n readonly at: string;\n readonly text: string;\n }[];\n /** Every layer of the anchor that applies (D23). */\n readonly anchor: {\n readonly reviewId?: string;\n /** W3C Web Annotation selectors. */\n readonly selectors?: readonly unknown[];\n readonly rect?: Rect;\n readonly viewport?: Viewport;\n readonly page?: string;\n readonly candidateId?: string;\n readonly terminal?: {\n readonly rows: readonly [number, number];\n readonly cols: readonly [number, number];\n readonly t?: number;\n };\n readonly time?: number;\n readonly slide?: { readonly index: number; readonly step: number };\n };\n /** The screenshot crop, always stored (D23). */\n readonly crop: { readonly path: string; readonly width: number; readonly height: number };\n}\n\n/**\n * The complete submission (INTERFACES §8): what `results/get`, `mostra results` and the\n * submissions port carry. Everything in it comes from the immutable submission and the version it\n * names, never from the live draft (IN-06).\n */\nexport interface Results {\n /** The artifact, with the metadata of the version the viewer saw. */\n readonly artifact: {\n readonly id: string;\n readonly title: string;\n readonly description?: string;\n readonly family?: string;\n readonly links: readonly ArtifactLink[];\n };\n /** The submission's facts: when, how, by whom, from which version and view, and its delivery. */\n readonly submission: {\n readonly id: string;\n readonly at: string;\n readonly epoch: number;\n /** The same viewer's previous submission, under `epochs` (D103). */\n readonly previous?: string;\n readonly policy: SubmissionPolicy;\n readonly channel: SubmitChannel;\n readonly viewer: Viewer;\n readonly versionId: string;\n readonly version: number;\n readonly viewId: string;\n /** Whether a newer version existed when the viewer submitted (H-10). */\n readonly staleView: boolean;\n /** The newest version's number at the time, when the view was stale. */\n readonly latestVersion?: number;\n readonly draftRevision: DocumentRevision;\n readonly stateRevision?: DocumentRevision;\n readonly digest: string;\n readonly delivery: DeliveryState;\n readonly deliveries: readonly DeliveryStatus[];\n /** For a submission imported from a hosted home: where it came from (D165 item 1). */\n readonly origin?: EventOrigin;\n };\n /** The draft's fields by ID, dotted IDs nested (D52). */\n readonly answers: Readonly<Record<string, unknown>>;\n /** Every field in `answers` and `state`, with its label and scope. */\n readonly fields: readonly {\n readonly id: string;\n readonly label?: string;\n readonly required?: boolean;\n readonly sensitive?: boolean;\n readonly scope: FieldScope;\n }[];\n /** Artifact state at `stateRevision`, dotted IDs nested (D63). */\n readonly state?: Readonly<Record<string, unknown>>;\n /** The review sets' choices: the fields `review.<set>.choice` (D65). */\n readonly choices: readonly {\n readonly reviewSetId: string;\n readonly candidateId: string;\n readonly label?: string;\n }[];\n /** Comment threads with their anchors and crops (WP-20). */\n readonly comments: readonly ResultComment[];\n /** Answers a newer version couldn't map (D42). */\n readonly orphaned: readonly {\n readonly id: string;\n readonly label?: string;\n readonly value: unknown;\n readonly fromVersion: number;\n }[];\n /** Action runs started in this view (WP-08). */\n readonly actions: readonly {\n readonly runId: string;\n readonly action: string;\n readonly status: string;\n readonly at: string;\n }[];\n /** Signals raised in this view before the submission: the newest 100, within 1 MiB of payloads. */\n readonly signals: readonly {\n readonly name: string;\n readonly at: string;\n readonly payload?: unknown;\n }[];\n /** How many older signals of the view the limit left out; absent when none. */\n readonly signalsOmitted?: number;\n /** Set when compaction removed events of this view before it submitted, so signals may be missing. */\n readonly signalsCompacted?: true;\n}\n\nconst RectSchema = z.object({\n x: z.number(),\n y: z.number(),\n width: z.number(),\n height: z.number(),\n});\n\n/** The Zod schema of the `ResultComment` type. */\nexport const ResultComment: z.ZodType<ResultComment> = z\n .object({\n threadId: z.string(),\n status: z.enum([\"open\", \"resolved\"]),\n messages: z\n .array(z.object({ author: Viewer, at: z.iso.datetime(), text: z.string() }))\n .readonly(),\n anchor: z.object({\n reviewId: z.string().exactOptional(),\n selectors: z.array(z.unknown()).readonly().exactOptional(),\n rect: RectSchema.exactOptional(),\n viewport: z\n .object({ width: z.number(), height: z.number(), dpr: z.number() })\n .exactOptional(),\n page: z.string().exactOptional(),\n candidateId: z.string().exactOptional(),\n terminal: z\n .object({\n rows: z.tuple([z.int(), z.int()]).readonly(),\n cols: z.tuple([z.int(), z.int()]).readonly(),\n t: z.number().exactOptional(),\n })\n .exactOptional(),\n time: z.number().exactOptional(),\n slide: z.object({ index: z.int(), step: z.int() }).exactOptional(),\n }),\n crop: z.object({ path: z.string(), width: z.int(), height: z.int() }),\n })\n .register(wireRegistry, {\n id: \"ResultComment\",\n description: \"One comment thread in results: messages, anchor layers and the screenshot crop.\",\n }) as z.ZodType<ResultComment>;\n\n/** The Zod schema of the `Results` type. */\nexport const Results: z.ZodType<Results> = z\n .object({\n artifact: z.object({\n id: ArtifactId.schema,\n title: z.string(),\n description: z.string().exactOptional(),\n family: z.string().exactOptional(),\n links: z.array(ArtifactLink).readonly(),\n }),\n submission: z.object({\n id: SubmissionId.schema,\n at: z.iso.datetime(),\n epoch: z.int().min(1),\n previous: SubmissionId.schema.exactOptional(),\n policy: SubmissionPolicy,\n channel: z.enum([\"shell\", \"artifact\"]),\n viewer: Viewer,\n versionId: VersionId.schema,\n version: z.int().min(1),\n viewId: ViewId.schema,\n staleView: z.boolean(),\n latestVersion: z.int().min(1).exactOptional(),\n draftRevision: DocumentRevision,\n stateRevision: DocumentRevision.exactOptional(),\n digest: z.string().regex(/^[0-9a-f]{64}$/),\n delivery: z.enum([\"pending\", \"delivered\", \"rejected\", \"undeliverable\"]),\n deliveries: z.array(DeliveryStatus).readonly(),\n origin: EventOrigin.exactOptional(),\n }),\n answers: z.record(z.string(), z.unknown()),\n fields: z\n .array(\n z.object({\n id: z.string(),\n label: z.string().exactOptional(),\n required: z.boolean().exactOptional(),\n sensitive: z.boolean().exactOptional(),\n scope: z.enum([\"viewer\", \"artifact\"]),\n }),\n )\n .readonly(),\n state: z.record(z.string(), z.unknown()).exactOptional(),\n choices: z\n .array(\n z.object({\n reviewSetId: z.string(),\n candidateId: z.string(),\n label: z.string().exactOptional(),\n }),\n )\n .readonly(),\n comments: z.array(ResultComment).readonly(),\n orphaned: z\n .array(\n z.object({\n id: z.string(),\n label: z.string().exactOptional(),\n value: z.unknown(),\n fromVersion: z.int().min(1),\n }),\n )\n .readonly(),\n actions: z\n .array(\n z.object({\n runId: z.string(),\n action: z.string(),\n status: z.string(),\n at: z.iso.datetime(),\n }),\n )\n .readonly(),\n signals: z\n .array(\n z.object({ name: z.string(), at: z.iso.datetime(), payload: z.unknown().exactOptional() }),\n )\n .readonly(),\n signalsOmitted: z.int().min(1).exactOptional(),\n signalsCompacted: z.literal(true).exactOptional(),\n })\n .register(wireRegistry, {\n id: \"Results\",\n description:\n \"The complete submission: artifact, submission facts, answers, fields, state, choices, comments, orphans, actions, signals.\",\n }) as z.ZodType<Results>;\n"],"mappings":";;;;;;;;;;;;;;AAgCA,MAAa,aAAoC,EAAE,KAAK;CACtD;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;AAuBD,MAAa,SAA4B,EACtC,OAAO;CACN,IAAI,SAAS;CACb,MAAM;CACN,MAAM,EAAE,OAAO,CAAC,CAAC,cAAc;CAC/B,KAAK,EAAE,OAAO,CAAC,CAAC,cAAc;CAC9B,UAAU,EAAE,QAAQ,CAAC,CAAC,cAAc;AACtC,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAcH,MAAa,aAAoC,EAC9C,OAAO;CACN,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;CAC9B,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,cAAc;AACjD,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAmBH,MAAa,QAA0B,EACpC,OAAO;CACN,MAAM,EAAE,KAAK;EAAC;EAAU;EAAS;EAAQ;CAAQ,CAAC;C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E,QAAQ,CAAC,CAAC,cAAc;CAAE,CAAC,CAC3F,CAAC,CACA,SAAS;CACZ,gBAAgB,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;CAC7C,kBAAkB,EAAE,QAAQ,IAAI,CAAC,CAAC,cAAc;AAClD,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { Duration } from "./duration.js";
2
2
  import { SubmissionPolicy } from "./policy.js";
3
+ import { TeamSettings } from "./team-settings.js";
3
4
  import * as z from "zod";
4
5
  //#region src/manifest.d.ts
5
6
  /** The families Mostra's templates and gallery know; any other string is allowed too. */
@@ -117,6 +118,8 @@ export interface ArtifactManifest {
117
118
  readonly tally?: readonly TallySpec[];
118
119
  /** How the artifact behaves on a remote server (D165). */
119
120
  readonly hosted?: HostedSettings;
121
+ /** Team settings: what viewers see of each other's status and presence (D168). */
122
+ readonly team?: TeamSettings;
120
123
  }
121
124
  /** The keys of the artifact manifest, in INTERFACES §2.2 order. Other keys are warnings (FAILURE_MODEL §10). */
122
125
  export declare const ARTIFACT_MANIFEST_KEYS: readonly (keyof ArtifactManifest)[];
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","names":[],"sources":["../src/manifest.ts"],"mappings":";;;;;YAoBY;;iBAaK;;WAEN;;WAEA;;;iBAIM;;WAEN;;WAEA;;WAEA,MAAM,SAAS;;WAEf;;WAEA;;WAEA;;;YAIC;WAEG;WACA;WACA;WACA;;WAEA;WAAyB;;;;;;;;iBAQvB;;WAEN;;WAEA;;WAEA;;;iBAIM;;;;;WAKN;aAAqB;aAAqC,QAAQ;;;WAElE;;WAEA;;WAEA;;;qBAIE;;qBAGA,8BAA8B;;qBAG9B;;qBAEA;;iBAGI;;WAEN;;WAEA;;WAEA;;WAEA,SAAS;;WAET,iBAAiB;;WAEjB;;WAEA,aAAa;;WAEb;aAAiB;aAAkC;;;WAEnD,YAAY,SAAS,eAAe;;WAEpC,QAAQ,SAAS,eAAe;;WAEhC;aACE;aACA;aACA;;;WAGF;aACE;aACA;aACA;aACA;;;WAGF,iBAAiB;;WAEjB,SAAS;;;qBAIP,wCAAwC;;qBAoBxC,cAAc,EAAE,QAAQ;;qBA2BxB,WAAW,EAAE,QAAQ;;qBAiBrB,gBAAgB,EAAE,QAAQ;;qBAmB1B,kBAAkB,EAAE,QAAQ;;;;;;wBA8CzB,gBACd,UAAU;WACE;WAAuB"}
1
+ {"version":3,"file":"manifest.d.ts","names":[],"sources":["../src/manifest.ts"],"mappings":";;;;;;YAqBY;;iBAaK;;WAEN;;WAEA;;;iBAIM;;WAEN;;WAEA;;WAEA,MAAM,SAAS;;WAEf;;WAEA;;WAEA;;;YAIC;WAEG;WACA;WACA;WACA;;WAEA;WAAyB;;;;;;;;iBAQvB;;WAEN;;WAEA;;WAEA;;;iBAIM;;;;;WAKN;aAAqB;aAAqC,QAAQ;;;WAElE;;WAEA;;WAEA;;;qBAIE;;qBAGA,8BAA8B;;qBAG9B;;qBAEA;;iBAGI;;WAEN;;WAEA;;WAEA;;WAEA,SAAS;;WAET,iBAAiB;;WAEjB;;WAEA,aAAa;;WAEb;aAAiB;aAAkC;;;WAEnD,YAAY,SAAS,eAAe;;WAEpC,QAAQ,SAAS,eAAe;;WAEhC;aACE;aACA;aACA;;;WAGF;aACE;aACA;aACA;aACA;;;WAGF,iBAAiB;;WAEjB,SAAS;;WAET,OAAO;;;qBAIL,wCAAwC;;qBAqBxC,cAAc,EAAE,QAAQ;;qBA2BxB,WAAW,EAAE,QAAQ;;qBAiBrB,gBAAgB,EAAE,QAAQ;;qBAmB1B,kBAAkB,EAAE,QAAQ;;;;;;wBA+CzB,gBACd,UAAU;WACE;WAAuB"}
package/dist/manifest.js CHANGED
@@ -2,6 +2,7 @@ import { wireRegistry } from "./wire-registry.js";
2
2
  import { ArtifactId } from "./ids.js";
3
3
  import { Duration, durationMs } from "./duration.js";
4
4
  import { SubmissionPolicy } from "./policy.js";
5
+ import { TeamSettings } from "./team-settings.js";
5
6
  import * as z from "zod";
6
7
  //#region src/manifest.ts
7
8
  /**
@@ -37,7 +38,8 @@ const ARTIFACT_MANIFEST_KEYS = [
37
38
  "limits",
38
39
  "verify",
39
40
  "tally",
40
- "hosted"
41
+ "hosted",
42
+ "team"
41
43
  ];
42
44
  const strings = z.array(z.string()).readonly();
43
45
  /** The Zod schema of the `ArtifactLink` type. */
@@ -114,7 +116,8 @@ const ArtifactManifest = z.object({
114
116
  smoke: z.boolean().exactOptional()
115
117
  }).exactOptional(),
116
118
  tally: z.array(TallySpec).readonly().exactOptional(),
117
- hosted: HostedSettings.exactOptional()
119
+ hosted: HostedSettings.exactOptional(),
120
+ team: TeamSettings.exactOptional()
118
121
  }).register(wireRegistry, {
119
122
  id: "ArtifactManifest",
120
123
  description: "The artifact manifest (INTERFACES §2.2): literal metadata from the entry's defineArtifact call or MDX frontmatter."
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.js","names":[],"sources":["../src/manifest.ts"],"sourcesContent":["/**\n * The artifact manifest (INTERFACES §2.2, D51): the metadata an artifact declares in its entry, as\n * `export const artifact = defineArtifact({...})` in TSX or as YAML frontmatter in MDX. Mostra reads\n * it statically, so every value is a literal. The same type checks `defineArtifact` for authors,\n * validates the extracted literal in the supervisor and travels on the wire in `artifact/get`.\n *\n * ```ts\n * const checked = ArtifactManifest.safeParse(extracted);\n * ```\n */\nimport * as z from \"zod\";\nimport { Duration, durationMs } from \"./duration.ts\";\nimport { SubmissionPolicy } from \"./policy.ts\";\n\nexport { SubmissionPolicy };\n\nimport { ArtifactId } from \"./ids.ts\";\nimport { wireRegistry } from \"./wire-registry.ts\";\n\n/** The families Mostra's templates and gallery know; any other string is allowed too. */\nexport type ArtifactFamily =\n | \"questionnaire\"\n | \"proposal\"\n | \"prototype\"\n | \"review\"\n | \"dashboard\"\n | \"deck\"\n | \"demo\"\n | \"inbox\"\n | \"tasks\"\n | (string & {});\n\n/** A related artifact (PRODUCT J6): a later round, a follow-up, a replacement. */\nexport interface ArtifactLink {\n /** How this artifact relates to the other one. */\n readonly rel: \"round-of\" | \"follows\" | \"replaces\" | (string & {});\n /** The other artifact's ID. */\n readonly artifact: string;\n}\n\n/** A live terminal session the artifact declares (ROUND-3 §5.1, D65). */\nexport interface TerminalSpec {\n /** The program and its arguments. */\n readonly command: readonly string[];\n /** Its working directory, relative to the artifact's source. */\n readonly cwd?: string;\n /** Extra environment variables. */\n readonly env?: Readonly<Record<string, string>>;\n /** The terminal's width in cells. */\n readonly cols?: number;\n /** The terminal's height in cells. */\n readonly rows?: number;\n /** Whether viewers may type into it. Sessions are read-only by default. */\n readonly input?: boolean;\n}\n\n/** A web demo the artifact declares (ROUND-3 §5.4, TM-08): a command to run, or a port to attach to. */\nexport type DemoSpec =\n | {\n readonly command: readonly string[];\n readonly cwd?: string;\n readonly ready?: string;\n readonly bridge?: boolean;\n }\n | { readonly attach: number; readonly bridge?: boolean };\n\n/**\n * A count by choice the artifact opts into (D165 item 12, RM-07): every accepted submission adds\n * one to the choice its viewer-scoped `field` holds, counted in the submit transaction, and viewers\n * read the counts with `useLive(\"$tally/<field>\")`. A value outside `choices`, or none, counts\n * nothing, so free text is never shown.\n */\nexport interface TallySpec {\n /** The viewer-scoped field whose value is counted. */\n readonly field: string;\n /** The values counted: 2 to 50 distinct strings. */\n readonly choices: readonly string[];\n /** Below this many answers (default 0), viewers see only the total, never the counts. */\n readonly minTotal?: number;\n}\n\n/** How the artifact behaves on a remote server (D165, INTERFACES §18). */\nexport interface HostedSettings {\n /**\n * Relayed action runs while the owner instance is away (D165 item 4): `queue` (the default)\n * waits up to `limit` (default `24h`, at most `7d`), `fail` ends a run at once.\n */\n readonly offline?: { readonly actions?: \"queue\" | \"fail\"; readonly limit?: Duration };\n /** Who may trigger relayed actions (D159): `signed-in` (the default) or anyone with the `link`. */\n readonly actions?: \"signed-in\" | \"link\";\n /** Who may submit (D165 item 13): anyone with the `link` (the default), or `signed-in` viewers. */\n readonly submissions?: \"link\" | \"signed-in\";\n /** Link previews (D161): `generic` (the default) or the artifact's `title`. */\n readonly preview?: \"generic\" | \"title\";\n}\n\n/** The longest offline limit a hosted artifact may set: 7 days (D165 item 4). */\nexport const HOSTED_OFFLINE_LIMIT_MAX_MS: number = 7 * 24 * 60 * 60 * 1000;\n\n/** The offline limit of a hosted artifact that sets none: 24 hours (D165 item 4). */\nexport const HOSTED_OFFLINE_LIMIT_DEFAULT: Duration = \"24h\";\n\n/** The fewest and most choices a tally counts (INTERFACES §18.4). */\nexport const TALLY_CHOICES_MIN = 2;\n/** The most choices a tally counts. */\nexport const TALLY_CHOICES_MAX = 50;\n\n/** The artifact manifest (INTERFACES §2.2). Every field except `title` is optional. */\nexport interface ArtifactManifest {\n /** The artifact's ID. Written by `mostra new`; without one, the artifact is bound to its source path at first publish (D51). */\n readonly id?: string;\n /** The title people see. */\n readonly title: string;\n /** One or two sentences on what the artifact is for. */\n readonly description?: string;\n /** What kind of artifact it is; templates and the gallery group by it. */\n readonly family?: ArtifactFamily;\n /** Related artifacts. */\n readonly links?: readonly ArtifactLink[];\n /** How the artifact is built and served: `spa`, the default and the only mode in v1 (D19). */\n readonly mode?: \"spa\";\n /** The submission policy the artifact requests; the host decides (D39, D63). */\n readonly submission?: SubmissionPolicy;\n /** The kit's shadcn base (default `base`, D72) and theme. */\n readonly kit?: { readonly base?: \"base\" | \"radix\"; readonly theme?: string };\n /** Live terminal sessions by name (D65). */\n readonly terminals?: Readonly<Record<string, TerminalSpec>>;\n /** Web demos by name (D65). */\n readonly demos?: Readonly<Record<string, DemoSpec>>;\n /** Stability limits for the artifact's worker (D62). */\n readonly limits?: {\n readonly heapMb?: number;\n readonly watchdogMs?: number;\n readonly idleMinutes?: number;\n };\n /** `verify` settings (D65). */\n readonly verify?: {\n readonly viewports?: readonly string[];\n readonly frames?: readonly string[];\n readonly extraChecks?: readonly string[];\n readonly smoke?: boolean;\n };\n /** Counts by choice of fixed-choice fields (D165 item 12). */\n readonly tally?: readonly TallySpec[];\n /** How the artifact behaves on a remote server (D165). */\n readonly hosted?: HostedSettings;\n}\n\n/** The keys of the artifact manifest, in INTERFACES §2.2 order. Other keys are warnings (FAILURE_MODEL §10). */\nexport const ARTIFACT_MANIFEST_KEYS: readonly (keyof ArtifactManifest)[] = [\n \"id\",\n \"title\",\n \"description\",\n \"family\",\n \"links\",\n \"mode\",\n \"submission\",\n \"kit\",\n \"terminals\",\n \"demos\",\n \"limits\",\n \"verify\",\n \"tally\",\n \"hosted\",\n];\n\nconst strings = z.array(z.string()).readonly();\n\n/** The Zod schema of the `ArtifactLink` type. */\nexport const ArtifactLink: z.ZodType<ArtifactLink> = z\n .object({ rel: z.string().min(1), artifact: z.string().min(1) })\n .register(wireRegistry, {\n id: \"ArtifactLink\",\n description: \"A related artifact: how this one relates (rel) and the other artifact's ID.\",\n });\n\nconst TerminalSpec: z.ZodType<TerminalSpec> = z.object({\n command: z.array(z.string()).min(1).readonly(),\n cwd: z.string().exactOptional(),\n env: z.record(z.string(), z.string()).readonly().exactOptional(),\n cols: z.int().min(1).exactOptional(),\n rows: z.int().min(1).exactOptional(),\n input: z.boolean().exactOptional(),\n});\n\nconst DemoSpec: z.ZodType<DemoSpec> = z.union([\n z.object({\n command: z.array(z.string()).min(1).readonly(),\n cwd: z.string().exactOptional(),\n ready: z.string().exactOptional(),\n bridge: z.boolean().exactOptional(),\n }),\n z.object({ attach: z.int().min(1).max(65535), bridge: z.boolean().exactOptional() }),\n]);\n\n/** The Zod schema of the `TallySpec` type. */\nexport const TallySpec: z.ZodType<TallySpec> = z\n .object({\n field: z.string().min(1).max(256),\n choices: z\n .array(z.string().min(1).max(256))\n .min(TALLY_CHOICES_MIN)\n .max(TALLY_CHOICES_MAX)\n .readonly(),\n minTotal: z.int().min(0).exactOptional(),\n })\n .register(wireRegistry, {\n id: \"TallySpec\",\n description:\n \"A count by choice of a viewer-scoped field: its field, 2 to 50 distinct choices and minTotal.\",\n });\n\n/** The Zod schema of the `HostedSettings` type. */\nexport const HostedSettings: z.ZodType<HostedSettings> = z\n .object({\n offline: z\n .object({\n actions: z.enum([\"queue\", \"fail\"]).exactOptional(),\n limit: Duration.exactOptional(),\n })\n .exactOptional(),\n actions: z.enum([\"signed-in\", \"link\"]).exactOptional(),\n submissions: z.enum([\"link\", \"signed-in\"]).exactOptional(),\n preview: z.enum([\"generic\", \"title\"]).exactOptional(),\n })\n .register(wireRegistry, {\n id: \"HostedSettings\",\n description:\n \"How an artifact behaves on a remote server: offline actions, who may act and submit, previews.\",\n });\n\n/** The Zod schema of the `ArtifactManifest` type. Objects stay open, so newer keys pass through. */\nexport const ArtifactManifest: z.ZodType<ArtifactManifest> = z\n .object({\n id: ArtifactId.schema.exactOptional(),\n title: z.string().min(1),\n description: z.string().exactOptional(),\n family: z.string().min(1).exactOptional(),\n links: z.array(ArtifactLink).readonly().exactOptional(),\n mode: z.literal(\"spa\").exactOptional(),\n submission: SubmissionPolicy.exactOptional(),\n kit: z\n .object({\n base: z.enum([\"base\", \"radix\"]).exactOptional(),\n theme: z.string().exactOptional(),\n })\n .exactOptional(),\n terminals: z.record(z.string(), TerminalSpec).readonly().exactOptional(),\n demos: z.record(z.string(), DemoSpec).readonly().exactOptional(),\n limits: z\n .object({\n heapMb: z.int().min(1).exactOptional(),\n watchdogMs: z.int().min(1).exactOptional(),\n idleMinutes: z.number().min(0).exactOptional(),\n })\n .exactOptional(),\n verify: z\n .object({\n viewports: strings.exactOptional(),\n frames: strings.exactOptional(),\n extraChecks: strings.exactOptional(),\n smoke: z.boolean().exactOptional(),\n })\n .exactOptional(),\n tally: z.array(TallySpec).readonly().exactOptional(),\n hosted: HostedSettings.exactOptional(),\n })\n .register(wireRegistry, {\n id: \"ArtifactManifest\",\n description:\n \"The artifact manifest (INTERFACES §2.2): literal metadata from the entry's defineArtifact call or MDX frontmatter.\",\n });\n\n/**\n * The rules of a manifest that JSON Schema can't state, checked after its schema by everything\n * that reads a manifest (D165 items 4, 12): a tally's choices are distinct, each field is tallied\n * once, and an offline limit is at most 7 days. Answers the first problem, with its field's path.\n */\nexport function manifestProblem(\n manifest: ArtifactManifest,\n): { readonly path: string; readonly message: string } | undefined {\n const fields = new Set<string>();\n for (const [index, tally] of (manifest.tally ?? []).entries()) {\n if (new Set(tally.choices).size !== tally.choices.length) {\n return { path: `tally.${index}.choices`, message: \"a tally's choices must be distinct\" };\n }\n if (fields.has(tally.field)) {\n return { path: `tally.${index}.field`, message: `\\`${tally.field}\\` is tallied twice` };\n }\n fields.add(tally.field);\n }\n const limit = manifest.hosted?.offline?.limit;\n if (limit !== undefined && durationMs(limit) > HOSTED_OFFLINE_LIMIT_MAX_MS) {\n return { path: \"hosted.offline.limit\", message: \"an offline limit is at most 7d\" };\n }\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiGA,MAAa,8BAAsC;;AAGnD,MAAa,+BAAyC;;AAGtD,MAAa,oBAAoB;;AAEjC,MAAa,oBAAoB;;AA4CjC,MAAa,yBAA8D;CACzE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;;AAG7C,MAAa,eAAwC,EAClD,OAAO;CAAE,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAAG,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;AAAE,CAAC,CAAC,CAC/D,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;AAEH,MAAM,eAAwC,EAAE,OAAO;CACrD,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;CAC7C,KAAK,EAAE,OAAO,CAAC,CAAC,cAAc;CAC9B,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CAC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QAAQ,QAAQ,cAAc;EAC9B,aAAa,QAAQ,cAAc;EACnC,OAAO,EAAE,QAAQ,CAAC,CAAC,cAAc;CACnC,CAAC,CAAC,CACD,cAAc;CACjB,OAAO,EAAE,MAAM,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CACnD,QAAQ,eAAe,cAAc;AACvC,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;;;;;;AAOH,SAAgB,gBACd,UACiE;CACjE,MAAM,yBAAS,IAAI,IAAY;CAC/B,KAAK,MAAM,CAAC,OAAO,WAAW,SAAS,SAAS,CAAC,EAAA,CAAG,QAAQ,GAAG;EAC7D,IAAI,IAAI,IAAI,MAAM,OAAO,CAAC,CAAC,SAAS,MAAM,QAAQ,QAChD,OAAO;GAAE,MAAM,SAAS,MAAM;GAAW,SAAS;EAAqC;EAEzF,IAAI,OAAO,IAAI,MAAM,KAAK,GACxB,OAAO;GAAE,MAAM,SAAS,MAAM;GAAS,SAAS,KAAK,MAAM,MAAM;EAAqB;EAExF,OAAO,IAAI,MAAM,KAAK;CACxB;CACA,MAAM,QAAQ,SAAS,QAAQ,SAAS;CACxC,IAAI,UAAU,KAAA,KAAa,WAAW,KAAK,IAAA,QACzC,OAAO;EAAE,MAAM;EAAwB,SAAS;CAAiC;AAGrF"}
1
+ {"version":3,"file":"manifest.js","names":[],"sources":["../src/manifest.ts"],"sourcesContent":["/**\n * The artifact manifest (INTERFACES §2.2, D51): the metadata an artifact declares in its entry, as\n * `export const artifact = defineArtifact({...})` in TSX or as YAML frontmatter in MDX. Mostra reads\n * it statically, so every value is a literal. The same type checks `defineArtifact` for authors,\n * validates the extracted literal in the supervisor and travels on the wire in `artifact/get`.\n *\n * ```ts\n * const checked = ArtifactManifest.safeParse(extracted);\n * ```\n */\nimport * as z from \"zod\";\nimport { Duration, durationMs } from \"./duration.ts\";\nimport { SubmissionPolicy } from \"./policy.ts\";\n\nexport { SubmissionPolicy };\n\nimport { ArtifactId } from \"./ids.ts\";\nimport { TeamSettings } from \"./team-settings.ts\";\nimport { wireRegistry } from \"./wire-registry.ts\";\n\n/** The families Mostra's templates and gallery know; any other string is allowed too. */\nexport type ArtifactFamily =\n | \"questionnaire\"\n | \"proposal\"\n | \"prototype\"\n | \"review\"\n | \"dashboard\"\n | \"deck\"\n | \"demo\"\n | \"inbox\"\n | \"tasks\"\n | (string & {});\n\n/** A related artifact (PRODUCT J6): a later round, a follow-up, a replacement. */\nexport interface ArtifactLink {\n /** How this artifact relates to the other one. */\n readonly rel: \"round-of\" | \"follows\" | \"replaces\" | (string & {});\n /** The other artifact's ID. */\n readonly artifact: string;\n}\n\n/** A live terminal session the artifact declares (ROUND-3 §5.1, D65). */\nexport interface TerminalSpec {\n /** The program and its arguments. */\n readonly command: readonly string[];\n /** Its working directory, relative to the artifact's source. */\n readonly cwd?: string;\n /** Extra environment variables. */\n readonly env?: Readonly<Record<string, string>>;\n /** The terminal's width in cells. */\n readonly cols?: number;\n /** The terminal's height in cells. */\n readonly rows?: number;\n /** Whether viewers may type into it. Sessions are read-only by default. */\n readonly input?: boolean;\n}\n\n/** A web demo the artifact declares (ROUND-3 §5.4, TM-08): a command to run, or a port to attach to. */\nexport type DemoSpec =\n | {\n readonly command: readonly string[];\n readonly cwd?: string;\n readonly ready?: string;\n readonly bridge?: boolean;\n }\n | { readonly attach: number; readonly bridge?: boolean };\n\n/**\n * A count by choice the artifact opts into (D165 item 12, RM-07): every accepted submission adds\n * one to the choice its viewer-scoped `field` holds, counted in the submit transaction, and viewers\n * read the counts with `useLive(\"$tally/<field>\")`. A value outside `choices`, or none, counts\n * nothing, so free text is never shown.\n */\nexport interface TallySpec {\n /** The viewer-scoped field whose value is counted. */\n readonly field: string;\n /** The values counted: 2 to 50 distinct strings. */\n readonly choices: readonly string[];\n /** Below this many answers (default 0), viewers see only the total, never the counts. */\n readonly minTotal?: number;\n}\n\n/** How the artifact behaves on a remote server (D165, INTERFACES §18). */\nexport interface HostedSettings {\n /**\n * Relayed action runs while the owner instance is away (D165 item 4): `queue` (the default)\n * waits up to `limit` (default `24h`, at most `7d`), `fail` ends a run at once.\n */\n readonly offline?: { readonly actions?: \"queue\" | \"fail\"; readonly limit?: Duration };\n /** Who may trigger relayed actions (D159): `signed-in` (the default) or anyone with the `link`. */\n readonly actions?: \"signed-in\" | \"link\";\n /** Who may submit (D165 item 13): anyone with the `link` (the default), or `signed-in` viewers. */\n readonly submissions?: \"link\" | \"signed-in\";\n /** Link previews (D161): `generic` (the default) or the artifact's `title`. */\n readonly preview?: \"generic\" | \"title\";\n}\n\n/** The longest offline limit a hosted artifact may set: 7 days (D165 item 4). */\nexport const HOSTED_OFFLINE_LIMIT_MAX_MS: number = 7 * 24 * 60 * 60 * 1000;\n\n/** The offline limit of a hosted artifact that sets none: 24 hours (D165 item 4). */\nexport const HOSTED_OFFLINE_LIMIT_DEFAULT: Duration = \"24h\";\n\n/** The fewest and most choices a tally counts (INTERFACES §18.4). */\nexport const TALLY_CHOICES_MIN = 2;\n/** The most choices a tally counts. */\nexport const TALLY_CHOICES_MAX = 50;\n\n/** The artifact manifest (INTERFACES §2.2). Every field except `title` is optional. */\nexport interface ArtifactManifest {\n /** The artifact's ID. Written by `mostra new`; without one, the artifact is bound to its source path at first publish (D51). */\n readonly id?: string;\n /** The title people see. */\n readonly title: string;\n /** One or two sentences on what the artifact is for. */\n readonly description?: string;\n /** What kind of artifact it is; templates and the gallery group by it. */\n readonly family?: ArtifactFamily;\n /** Related artifacts. */\n readonly links?: readonly ArtifactLink[];\n /** How the artifact is built and served: `spa`, the default and the only mode in v1 (D19). */\n readonly mode?: \"spa\";\n /** The submission policy the artifact requests; the host decides (D39, D63). */\n readonly submission?: SubmissionPolicy;\n /** The kit's shadcn base (default `base`, D72) and theme. */\n readonly kit?: { readonly base?: \"base\" | \"radix\"; readonly theme?: string };\n /** Live terminal sessions by name (D65). */\n readonly terminals?: Readonly<Record<string, TerminalSpec>>;\n /** Web demos by name (D65). */\n readonly demos?: Readonly<Record<string, DemoSpec>>;\n /** Stability limits for the artifact's worker (D62). */\n readonly limits?: {\n readonly heapMb?: number;\n readonly watchdogMs?: number;\n readonly idleMinutes?: number;\n };\n /** `verify` settings (D65). */\n readonly verify?: {\n readonly viewports?: readonly string[];\n readonly frames?: readonly string[];\n readonly extraChecks?: readonly string[];\n readonly smoke?: boolean;\n };\n /** Counts by choice of fixed-choice fields (D165 item 12). */\n readonly tally?: readonly TallySpec[];\n /** How the artifact behaves on a remote server (D165). */\n readonly hosted?: HostedSettings;\n /** Team settings: what viewers see of each other's status and presence (D168). */\n readonly team?: TeamSettings;\n}\n\n/** The keys of the artifact manifest, in INTERFACES §2.2 order. Other keys are warnings (FAILURE_MODEL §10). */\nexport const ARTIFACT_MANIFEST_KEYS: readonly (keyof ArtifactManifest)[] = [\n \"id\",\n \"title\",\n \"description\",\n \"family\",\n \"links\",\n \"mode\",\n \"submission\",\n \"kit\",\n \"terminals\",\n \"demos\",\n \"limits\",\n \"verify\",\n \"tally\",\n \"hosted\",\n \"team\",\n];\n\nconst strings = z.array(z.string()).readonly();\n\n/** The Zod schema of the `ArtifactLink` type. */\nexport const ArtifactLink: z.ZodType<ArtifactLink> = z\n .object({ rel: z.string().min(1), artifact: z.string().min(1) })\n .register(wireRegistry, {\n id: \"ArtifactLink\",\n description: \"A related artifact: how this one relates (rel) and the other artifact's ID.\",\n });\n\nconst TerminalSpec: z.ZodType<TerminalSpec> = z.object({\n command: z.array(z.string()).min(1).readonly(),\n cwd: z.string().exactOptional(),\n env: z.record(z.string(), z.string()).readonly().exactOptional(),\n cols: z.int().min(1).exactOptional(),\n rows: z.int().min(1).exactOptional(),\n input: z.boolean().exactOptional(),\n});\n\nconst DemoSpec: z.ZodType<DemoSpec> = z.union([\n z.object({\n command: z.array(z.string()).min(1).readonly(),\n cwd: z.string().exactOptional(),\n ready: z.string().exactOptional(),\n bridge: z.boolean().exactOptional(),\n }),\n z.object({ attach: z.int().min(1).max(65535), bridge: z.boolean().exactOptional() }),\n]);\n\n/** The Zod schema of the `TallySpec` type. */\nexport const TallySpec: z.ZodType<TallySpec> = z\n .object({\n field: z.string().min(1).max(256),\n choices: z\n .array(z.string().min(1).max(256))\n .min(TALLY_CHOICES_MIN)\n .max(TALLY_CHOICES_MAX)\n .readonly(),\n minTotal: z.int().min(0).exactOptional(),\n })\n .register(wireRegistry, {\n id: \"TallySpec\",\n description:\n \"A count by choice of a viewer-scoped field: its field, 2 to 50 distinct choices and minTotal.\",\n });\n\n/** The Zod schema of the `HostedSettings` type. */\nexport const HostedSettings: z.ZodType<HostedSettings> = z\n .object({\n offline: z\n .object({\n actions: z.enum([\"queue\", \"fail\"]).exactOptional(),\n limit: Duration.exactOptional(),\n })\n .exactOptional(),\n actions: z.enum([\"signed-in\", \"link\"]).exactOptional(),\n submissions: z.enum([\"link\", \"signed-in\"]).exactOptional(),\n preview: z.enum([\"generic\", \"title\"]).exactOptional(),\n })\n .register(wireRegistry, {\n id: \"HostedSettings\",\n description:\n \"How an artifact behaves on a remote server: offline actions, who may act and submit, previews.\",\n });\n\n/** The Zod schema of the `ArtifactManifest` type. Objects stay open, so newer keys pass through. */\nexport const ArtifactManifest: z.ZodType<ArtifactManifest> = z\n .object({\n id: ArtifactId.schema.exactOptional(),\n title: z.string().min(1),\n description: z.string().exactOptional(),\n family: z.string().min(1).exactOptional(),\n links: z.array(ArtifactLink).readonly().exactOptional(),\n mode: z.literal(\"spa\").exactOptional(),\n submission: SubmissionPolicy.exactOptional(),\n kit: z\n .object({\n base: z.enum([\"base\", \"radix\"]).exactOptional(),\n theme: z.string().exactOptional(),\n })\n .exactOptional(),\n terminals: z.record(z.string(), TerminalSpec).readonly().exactOptional(),\n demos: z.record(z.string(), DemoSpec).readonly().exactOptional(),\n limits: z\n .object({\n heapMb: z.int().min(1).exactOptional(),\n watchdogMs: z.int().min(1).exactOptional(),\n idleMinutes: z.number().min(0).exactOptional(),\n })\n .exactOptional(),\n verify: z\n .object({\n viewports: strings.exactOptional(),\n frames: strings.exactOptional(),\n extraChecks: strings.exactOptional(),\n smoke: z.boolean().exactOptional(),\n })\n .exactOptional(),\n tally: z.array(TallySpec).readonly().exactOptional(),\n hosted: HostedSettings.exactOptional(),\n team: TeamSettings.exactOptional(),\n })\n .register(wireRegistry, {\n id: \"ArtifactManifest\",\n description:\n \"The artifact manifest (INTERFACES §2.2): literal metadata from the entry's defineArtifact call or MDX frontmatter.\",\n });\n\n/**\n * The rules of a manifest that JSON Schema can't state, checked after its schema by everything\n * that reads a manifest (D165 items 4, 12): a tally's choices are distinct, each field is tallied\n * once, and an offline limit is at most 7 days. Answers the first problem, with its field's path.\n */\nexport function manifestProblem(\n manifest: ArtifactManifest,\n): { readonly path: string; readonly message: string } | undefined {\n const fields = new Set<string>();\n for (const [index, tally] of (manifest.tally ?? []).entries()) {\n if (new Set(tally.choices).size !== tally.choices.length) {\n return { path: `tally.${index}.choices`, message: \"a tally's choices must be distinct\" };\n }\n if (fields.has(tally.field)) {\n return { path: `tally.${index}.field`, message: `\\`${tally.field}\\` is tallied twice` };\n }\n fields.add(tally.field);\n }\n const limit = manifest.hosted?.offline?.limit;\n if (limit !== undefined && durationMs(limit) > HOSTED_OFFLINE_LIMIT_MAX_MS) {\n return { path: \"hosted.offline.limit\", message: \"an offline limit is at most 7d\" };\n }\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkGA,MAAa,8BAAsC;;AAGnD,MAAa,+BAAyC;;AAGtD,MAAa,oBAAoB;;AAEjC,MAAa,oBAAoB;;AA8CjC,MAAa,yBAA8D;CACzE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;;AAG7C,MAAa,eAAwC,EAClD,OAAO;CAAE,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAAG,UAAU,EAAE,OAAO,CA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
+ import { ArtifactRef } from "../../artifact.js";
2
+ import { MethodDefinition } from "../../method.js";
3
+ //#region src/methods/artifact/pause.d.ts
4
+ /** Who paused an artifact (D165 item 14). */
5
+ export type PausedBy = "owner" | "operator";
6
+ /** The params of `artifact/pause` (INTERFACES §18.2, D165 item 14). */
7
+ export interface ArtifactPauseParams {
8
+ /** The artifact to pause or resume. */
9
+ readonly artifact: ArtifactRef;
10
+ /** `true` pauses it, `false` resumes it. */
11
+ readonly paused: boolean;
12
+ /** Why, shown to viewers as text while it is paused. */
13
+ readonly reason?: string;
14
+ /** Makes retries idempotent: a repeated `requestId` returns the recorded result (H-03). */
15
+ readonly requestId?: string;
16
+ }
17
+ /** The result of `artifact/pause`: whether the artifact is paused now, and by whom. */
18
+ export interface ArtifactPauseResult {
19
+ /** Whether it is paused after the call. */
20
+ readonly paused: boolean;
21
+ /** Who paused it, while it is paused. */
22
+ readonly by?: PausedBy;
23
+ }
24
+ /**
25
+ * `artifact/pause`: pauses or resumes an artifact. While paused it stays viewable and its shell
26
+ * says so; submissions answer 423 `MOSTRA_SUBMIT_PAUSED` and actions 423 `MOSTRA_ACTION_PAUSED`,
27
+ * each keeping the draft; links stay valid. On an owner instance it acts on the local artifact and,
28
+ * for a hosted one, on every server it is hosted on. An operator's pause can't be resumed by the
29
+ * owner (`MOSTRA_REMOTE_PAUSED_BY_OPERATOR`).
30
+ */
31
+ export declare const artifactPauseMethod: MethodDefinition<ArtifactPauseParams, ArtifactPauseResult>;
32
+ //#endregion
33
+ //# sourceMappingURL=pause.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pause.d.ts","names":[],"sources":["../../../src/methods/artifact/pause.ts"],"mappings":";;;;YAMY;;iBAGK;;WAEN,UAAU;;WAEV;;WAEA;;WAEA;;;iBAIM;;WAEN;;WAEA,KAAK;;;;;;;;;qBA0BH,qBAAqB,iBAAiB,qBAAqB"}