@mostra/protocol 0.6.2 → 0.7.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 (69) hide show
  1. package/dist/bridge.d.ts +25 -0
  2. package/dist/bridge.d.ts.map +1 -1
  3. package/dist/bridge.js +32 -2
  4. package/dist/bridge.js.map +1 -1
  5. package/dist/browser.d.ts +76 -0
  6. package/dist/browser.d.ts.map +1 -1
  7. package/dist/browser.js +45 -2
  8. package/dist/browser.js.map +1 -1
  9. package/dist/diagnostics/codes/hygiene.d.ts +1 -1
  10. package/dist/diagnostics/codes/hygiene.d.ts.map +1 -1
  11. package/dist/diagnostics/codes/hygiene.js +12 -1
  12. package/dist/diagnostics/codes/hygiene.js.map +1 -1
  13. package/dist/diagnostics/codes/index.d.ts +3 -2
  14. package/dist/diagnostics/codes/index.d.ts.map +1 -1
  15. package/dist/diagnostics/codes/index.js +3 -1
  16. package/dist/diagnostics/codes/index.js.map +1 -1
  17. package/dist/diagnostics/codes/share.d.ts +8 -0
  18. package/dist/diagnostics/codes/share.d.ts.map +1 -0
  19. package/dist/diagnostics/codes/share.js +88 -0
  20. package/dist/diagnostics/codes/share.js.map +1 -0
  21. package/dist/hygiene.d.ts.map +1 -1
  22. package/dist/hygiene.js +2 -1
  23. package/dist/hygiene.js.map +1 -1
  24. package/dist/ids.d.ts +5 -1
  25. package/dist/ids.d.ts.map +1 -1
  26. package/dist/ids.js +3 -1
  27. package/dist/ids.js.map +1 -1
  28. package/dist/index.d.ts +10 -5
  29. package/dist/index.js +9 -4
  30. package/dist/methods/index.d.ts.map +1 -1
  31. package/dist/methods/index.js +9 -1
  32. package/dist/methods/index.js.map +1 -1
  33. package/dist/methods/instance/status.d.ts +24 -0
  34. package/dist/methods/instance/status.d.ts.map +1 -1
  35. package/dist/methods/instance/status.js +11 -2
  36. package/dist/methods/instance/status.js.map +1 -1
  37. package/dist/methods/port/addressing-external-base.d.ts +52 -0
  38. package/dist/methods/port/addressing-external-base.d.ts.map +1 -0
  39. package/dist/methods/port/addressing-external-base.js +61 -0
  40. package/dist/methods/port/addressing-external-base.js.map +1 -0
  41. package/dist/methods/share/list.d.ts +23 -0
  42. package/dist/methods/share/list.d.ts.map +1 -0
  43. package/dist/methods/share/list.js +29 -0
  44. package/dist/methods/share/list.js.map +1 -0
  45. package/dist/methods/share/start.d.ts +96 -0
  46. package/dist/methods/share/start.d.ts.map +1 -0
  47. package/dist/methods/share/start.js +73 -0
  48. package/dist/methods/share/start.js.map +1 -0
  49. package/dist/methods/share/stop.d.ts +29 -0
  50. package/dist/methods/share/stop.d.ts.map +1 -0
  51. package/dist/methods/share/stop.js +32 -0
  52. package/dist/methods/share/stop.js.map +1 -0
  53. package/package.json +2 -2
  54. package/schemas/protocol.draft-07.json +535 -0
  55. package/schemas/protocol.schema.json +507 -0
  56. package/src/bridge.ts +49 -0
  57. package/src/browser.ts +118 -0
  58. package/src/diagnostics/codes/hygiene.ts +12 -0
  59. package/src/diagnostics/codes/index.ts +6 -2
  60. package/src/diagnostics/codes/share.ts +100 -0
  61. package/src/hygiene.ts +1 -0
  62. package/src/ids.ts +9 -1
  63. package/src/index.ts +39 -0
  64. package/src/methods/index.ts +8 -0
  65. package/src/methods/instance/status.ts +38 -0
  66. package/src/methods/port/addressing-external-base.ts +113 -0
  67. package/src/methods/share/list.ts +42 -0
  68. package/src/methods/share/start.ts +150 -0
  69. package/src/methods/share/stop.ts +50 -0
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ArtifactId, CommentId, Cursor, DeliveryId, MutationId, RunId, SubmissionId, ThreadId, TokenId, VersionId, ViewId, ViewerId } from "./ids.js";
1
+ import { ArtifactId, CommentId, Cursor, DeliveryId, MutationId, RunId, ShareId, SubmissionId, ThreadId, TokenId, VersionId, ViewId, ViewerId } from "./ids.js";
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, RUN_KEY_MAX, RUN_LOG_MAX, RUN_LOG_TRUNCATED, RUN_STATUSES, RunAttachRequest, RunCancelRequest, RunProgress, RunRequest, RunState, SECRET_NAME_PATTERN, SECRET_VALUE_MAX, isFinalRunStatus } from "./actions.js";
3
3
  import { ARTIFACT_MANIFEST_KEYS, ArtifactLink, ArtifactManifest, SubmissionPolicy } from "./manifest.js";
4
4
  import { ArtifactDetail, ArtifactRef, ArtifactSummary, PublishReceipt, SourceRef, VersionSummary } from "./artifact.js";
@@ -9,9 +9,9 @@ import { JsonRpcErrorObject, JsonRpcFailure, JsonRpcNotification, JsonRpcRequest
9
9
  import { receivable } from "./receive.js";
10
10
  import { RpcPeer, parseParams } from "./rpc/peer.js";
11
11
  import { ControlsPolicy, REVIEW_SET_ID_PATTERN, SubmitChannel, TrustedControl, VersionRef, ViewContext, ViewContextWire, readViewContext } from "./view.js";
12
- import { BRIDGE_FIELDS_MAX, BRIDGE_MESSAGES, BRIDGE_TEXT_MAX, CONTROL_LABEL_MAX, MCP_APPS_PROTOCOL_VERSION, OPEN_LINK_SCHEMES, connectBridge, mostraControlsRequest, mostraFieldFocus, mostraFields, mostraFlush, mostraPage, mostraReady, mostraVersionAvailable, uiInitialize, uiInitialized, uiOpenLink, uiSizeChanged } from "./bridge.js";
12
+ 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";
13
13
  import { Actor, DeliveryStatus, DocumentRevision, EventFilter, EventRecord, EventTypePattern, FIELD_ID_MAX_LENGTH, FieldConflict, FieldOp, FieldState, MutationResult, ResultComment, Results, SIGNAL_NAME_PATTERN, SubmissionSummary, Viewer, ViewerSpec, WaitCondition, isFieldId } from "./interaction.js";
14
- import { BROWSER_PROTOCOL_REVISION, BROWSER_PROTOCOL_REVISIONS, CarryOver, ChooseRequest, DocumentSnapshot, FieldsRequest, FollowRequest, FrameTicket, OrphanedField, PollResult, SIGNAL_PAYLOAD_MAX_BYTES, ShellSubmitRequest, SignalRequest, StreamSnapshot, SubmitRequest } from "./browser.js";
14
+ import { BROWSER_PROTOCOL_REVISION, BROWSER_PROTOCOL_REVISIONS, CarryOver, ChooseRequest, DocumentSnapshot, EnterRequest, EnterResult, FRAME_SESSION_HEADER, FieldsRequest, FollowRequest, FrameSessionFacts, FrameTicket, OrphanedField, PollResult, SIGNAL_PAYLOAD_MAX_BYTES, ShellSubmitRequest, SignalRequest, StreamSnapshot, StreamTicket, StreamTicketRequest, SubmitRequest } from "./browser.js";
15
15
  import { BUNDLE_NAME, BUNDLE_PLATFORMS, BUNDLE_SETUP_MARKER, BundleAsset, BundleBrowser, BundleFileEntry, BundleFiles, BundleInfo, BundleLinkEntry, BundlePins, BundlePlatformSchema, BundleSetup, bundleAssetName, isWindowsBundle } from "./bundle.js";
16
16
  import { canonicalJson } from "./canonical.js";
17
17
  import { ALL_SCOPES, CapabilityScope, Duration, durationMs, normalizeScopes, scopeAllows } from "./capability.js";
@@ -35,6 +35,7 @@ import { publishDiagnosticCodes } from "./diagnostics/codes/publish.js";
35
35
  import { regressionDiagnosticCodes } from "./diagnostics/codes/regression.js";
36
36
  import { runtimeDiagnosticCodes } from "./diagnostics/codes/runtime.js";
37
37
  import { secretDiagnosticCodes } from "./diagnostics/codes/secret.js";
38
+ import { shareDiagnosticCodes } from "./diagnostics/codes/share.js";
38
39
  import { smokeDiagnosticCodes } from "./diagnostics/codes/smoke.js";
39
40
  import { submitDiagnosticCodes } from "./diagnostics/codes/submit.js";
40
41
  import { targetDiagnosticCodes } from "./diagnostics/codes/target.js";
@@ -60,9 +61,11 @@ import { gcRunMethod } from "./methods/gc/run.js";
60
61
  import { instanceCheckMethod } from "./methods/instance/check.js";
61
62
  import { HOST_PROTOCOL_REVISIONS, Revision, negotiateRevision } from "./revision.js";
62
63
  import { CLI_CLIENT_NAME, ClientCapabilities, ClientInfo, DependencyPolicy, HomeConfig, InstanceCapabilities, InstanceInfo, PortName, mostraInitializeMethod } from "./methods/mostra/initialize.js";
64
+ import { PUBLIC_SHARE_DEFAULT_TTL, PUBLIC_SHARE_MAX_TTL_MS, Share, ShareVia, shareStartMethod } from "./methods/share/start.js";
63
65
  import { ChildProcessStatus, DeliveryCounts, GatewayStatus, WorkerStatus, instanceStatusMethod } from "./methods/instance/status.js";
64
66
  import { livePushMethod } from "./methods/live/push.js";
65
67
  import { mostraShutdownMethod } from "./methods/mostra/shutdown.js";
68
+ import { ExternalBase, OriginString, portAddressingExternalBaseMethod } from "./methods/port/addressing-external-base.js";
66
69
  import { DraftMirror, portDraftsMirrorMethod } from "./methods/port/drafts-mirror.js";
67
70
  import { portIdentityResolveMethod } from "./methods/port/identity-resolve.js";
68
71
  import { portSecretsGetMethod } from "./methods/port/secrets-get.js";
@@ -73,6 +76,8 @@ import { ResultsMarkdown, resultsGetMethod } from "./methods/results/get.js";
73
76
  import { secretDeleteMethod } from "./methods/secret/delete.js";
74
77
  import { SecretEntry, secretSetMethod } from "./methods/secret/set.js";
75
78
  import { secretListMethod } from "./methods/secret/list.js";
79
+ import { shareListMethod } from "./methods/share/list.js";
80
+ import { shareStopMethod } from "./methods/share/stop.js";
76
81
  import { stateGetMethod } from "./methods/state/get.js";
77
82
  import { statePatchMethod } from "./methods/state/patch.js";
78
83
  import { CapabilityLink, viewUrlMethod } from "./methods/view/url.js";
@@ -85,4 +90,4 @@ import { hostMethods, hostNotifications } from "./methods/index.js";
85
90
  import { LineSplitter, MAX_LINE_LENGTH, encodeLine } from "./rpc/lines.js";
86
91
  import { ARGUMENT_BIGINT_DIGITS_MAX, RemoteError, SerializationError, UNSERIALIZABLE_CODE, ValueReader, ValueWriter, checkArgumentFrames, deserializeAll, fromBase64, serializeAll, toBase64, wireError } from "./serializer.js";
87
92
  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";
88
- export { ACTION_ARGS_MAX, ACTION_RESULT_MAX, ALL_SCOPES, ARGUMENT_BIGINT_DIGITS_MAX, ARTIFACT_MANIFEST_KEYS, ARTIFACT_PROGRESS, 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, EventFilter, EventRecord, EventTypePattern, EventsNotifyParams, FIELD_ID_MAX_LENGTH, FieldConflict, FieldOp, FieldState, FieldsRequest, FollowRequest, FrameTicket, GatewayStatus, HOST_PROTOCOL_REVISIONS, HomeConfig, InstanceCapabilities, InstanceInfo, JSON_RPC_ERROR_CODES, JsonRpcErrorObject, JsonRpcFailure, JsonRpcNotification, JsonRpcRequest, JsonRpcSuccess, LIVE_KEY_PATTERN, LIVE_RING_DEFAULT, LIVE_RING_MAX, LIVE_VALUE_MAX, LineSplitter, LiveRequest, MAX_LINE_LENGTH, MCP_APPS_PROTOCOL_VERSION, MutationId, MutationResult, OPEN_LINK_SCHEMES, OrphanedField, PollResult, PortName, PublishReceipt, REVIEW_SET_ID_PATTERN, RUN_KEY_MAX, RUN_LOG_MAX, RUN_LOG_TRUNCATED, RUN_STATUSES, RemoteError, ResultComment, Results, ResultsMarkdown, Revision, RpcError, RpcPeer, RunAttachRequest, RunCancelRequest, RunId, RunProgress, RunRequest, RunState, SECRET_NAME_PATTERN, SECRET_VALUE_MAX, SIGNAL_NAME_PATTERN, SIGNAL_PAYLOAD_MAX_BYTES, ScreenshotPolicy, SecretEntry, SerializationError, ServerEmitParams, ServerLiveValueParams, ServerLogParams, ServerProgressParams, ServerSecretParams, ServerSignalParams, ServerStateGetParams, ServerStatePatchParams, ShellSubmitRequest, SignalRequest, SourceRef, StreamSnapshot, SubmissionEnvelope, SubmissionId, SubmissionPolicy, SubmissionSummary, SubmitChannel, SubmitRequest, ThreadId, TokenId, TrustedControl, UNSERIALIZABLE_CODE, VERIFY_PROBE, VERIFY_REPORT, VERIFY_RUNNER_METHODS, ValueReader, ValueWriter, VerifyVerdict, VersionId, 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, artifactGetMethod, 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, hygieneDiagnosticCodes, instanceCheckMethod, instanceStatusMethod, isFieldId, isFinalRunStatus, isJsonContentType, isWindowsBundle, liveDiagnosticCodes, livePushMethod, manifestDiagnosticCodes, mostraControlsRequest, mostraFieldFocus, mostraFields, mostraFlush, mostraInitializeMethod, mostraPage, mostraReady, mostraShutdownMethod, mostraVersionAvailable, negotiateRevision, networkDiagnosticCodes, normalizeScopes, parseParams, platformDiagnosticCodes, portDraftsMirrorMethod, portIdentityResolveMethod, portSecretsGetMethod, portSubmissionsDeliverMethod, portTrustedControlsActivatedMethod, portTrustedControlsPolicyMethod, publishDiagnosticCodes, readViewContext, receivable, refusal, regressionDiagnosticCodes, resultsGetMethod, runtimeDiagnosticCodes, safeEqual, safePath, scopeAllows, secretDeleteMethod, secretDiagnosticCodes, secretListMethod, secretSetMethod, serializeAll, smokeDiagnosticCodes, stateGetMethod, statePatchMethod, submitDiagnosticCodes, targetDiagnosticCodes, toBase64, typeDiagnosticCodes, uiInitialize, uiInitialized, uiOpenLink, uiSizeChanged, verifyDiagnosticCodes, viewDefaultMethod, viewLaunchMethod, viewRevokeMethod, viewRotateMethod, viewUrlMethod, viewportsFor, waitMethod, wireError };
93
+ export { ACTION_ARGS_MAX, ACTION_RESULT_MAX, ALL_SCOPES, ARGUMENT_BIGINT_DIGITS_MAX, ARTIFACT_MANIFEST_KEYS, ARTIFACT_PROGRESS, 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, EventRecord, EventTypePattern, EventsNotifyParams, ExternalBase, FIELD_ID_MAX_LENGTH, FRAME_SESSION_HEADER, FieldConflict, FieldOp, FieldState, FieldsRequest, FollowRequest, FrameSessionFacts, FrameTicket, GatewayStatus, HOST_PROTOCOL_REVISIONS, HomeConfig, InstanceCapabilities, InstanceInfo, JSON_RPC_ERROR_CODES, JsonRpcErrorObject, JsonRpcFailure, JsonRpcNotification, JsonRpcRequest, JsonRpcSuccess, LIVE_KEY_PATTERN, LIVE_RING_DEFAULT, LIVE_RING_MAX, LIVE_VALUE_MAX, LineSplitter, LiveRequest, MAX_LINE_LENGTH, MCP_APPS_PROTOCOL_VERSION, MutationId, MutationResult, OPEN_LINK_SCHEMES, OriginString, OrphanedField, PUBLIC_SHARE_DEFAULT_TTL, PUBLIC_SHARE_MAX_TTL_MS, PollResult, PortName, PublishReceipt, REVIEW_SET_ID_PATTERN, RUN_KEY_MAX, RUN_LOG_MAX, RUN_LOG_TRUNCATED, RUN_STATUSES, RemoteError, ResultComment, Results, ResultsMarkdown, Revision, RpcError, RpcPeer, RunAttachRequest, RunCancelRequest, RunId, RunProgress, RunRequest, RunState, SECRET_NAME_PATTERN, SECRET_VALUE_MAX, SIGNAL_NAME_PATTERN, SIGNAL_PAYLOAD_MAX_BYTES, ScreenshotPolicy, SecretEntry, SerializationError, ServerEmitParams, ServerLiveValueParams, ServerLogParams, ServerProgressParams, ServerSecretParams, ServerSignalParams, ServerStateGetParams, ServerStatePatchParams, Share, ShareId, ShareVia, ShellSubmitRequest, SignalRequest, SourceRef, StreamSnapshot, StreamTicket, StreamTicketRequest, SubmissionEnvelope, SubmissionId, SubmissionPolicy, SubmissionSummary, SubmitChannel, SubmitRequest, ThreadId, TokenId, TrustedControl, UNSERIALIZABLE_CODE, VERIFY_PROBE, VERIFY_REPORT, VERIFY_RUNNER_METHODS, ValueReader, ValueWriter, VerifyVerdict, VersionId, 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, artifactGetMethod, 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, hygieneDiagnosticCodes, instanceCheckMethod, instanceStatusMethod, isFieldId, isFinalRunStatus, isJsonContentType, isWindowsBundle, liveDiagnosticCodes, livePushMethod, manifestDiagnosticCodes, mostraControlsRequest, mostraFieldFocus, mostraFields, mostraFlush, mostraFrameSessionEntered, mostraFrameSessionFailed, mostraInitializeMethod, mostraPage, mostraReady, mostraShutdownMethod, mostraVersionAvailable, negotiateRevision, networkDiagnosticCodes, normalizeScopes, parseParams, platformDiagnosticCodes, portAddressingExternalBaseMethod, portDraftsMirrorMethod, portIdentityResolveMethod, portSecretsGetMethod, portSubmissionsDeliverMethod, portTrustedControlsActivatedMethod, portTrustedControlsPolicyMethod, publishDiagnosticCodes, readViewContext, receivable, refusal, regressionDiagnosticCodes, 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 };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/methods/index.ts"],"mappings":";;;qBA6Ca,sBAAsB;;qBAyCtB,4BAA4B"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/methods/index.ts"],"mappings":";;;qBAiDa,sBAAsB;;qBA6CtB,4BAA4B"}
@@ -14,9 +14,11 @@ import { eventsUnsubscribeMethod } from "./events/unsubscribe.js";
14
14
  import { gcRunMethod } from "./gc/run.js";
15
15
  import { instanceCheckMethod } from "./instance/check.js";
16
16
  import { mostraInitializeMethod } from "./mostra/initialize.js";
17
+ import { shareStartMethod } from "./share/start.js";
17
18
  import { instanceStatusMethod } from "./instance/status.js";
18
19
  import { livePushMethod } from "./live/push.js";
19
20
  import { mostraShutdownMethod } from "./mostra/shutdown.js";
21
+ import { portAddressingExternalBaseMethod } from "./port/addressing-external-base.js";
20
22
  import { portDraftsMirrorMethod } from "./port/drafts-mirror.js";
21
23
  import { portIdentityResolveMethod } from "./port/identity-resolve.js";
22
24
  import { portSecretsGetMethod } from "./port/secrets-get.js";
@@ -27,6 +29,8 @@ import { resultsGetMethod } from "./results/get.js";
27
29
  import { secretDeleteMethod } from "./secret/delete.js";
28
30
  import { secretSetMethod } from "./secret/set.js";
29
31
  import { secretListMethod } from "./secret/list.js";
32
+ import { shareListMethod } from "./share/list.js";
33
+ import { shareStopMethod } from "./share/stop.js";
30
34
  import { stateGetMethod } from "./state/get.js";
31
35
  import { statePatchMethod } from "./state/patch.js";
32
36
  import { viewUrlMethod } from "./view/url.js";
@@ -73,7 +77,11 @@ const hostMethods = [
73
77
  instanceCheckMethod,
74
78
  devStartMethod,
75
79
  devStopMethod,
76
- portIdentityResolveMethod
80
+ portIdentityResolveMethod,
81
+ shareStartMethod,
82
+ shareStopMethod,
83
+ shareListMethod,
84
+ portAddressingExternalBaseMethod
77
85
  ];
78
86
  /** Every notification the instance sends to its clients (INTERFACES §6). */
79
87
  const hostNotifications = [
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/methods/index.ts"],"sourcesContent":["/**\n * Every host protocol method this package defines. `pnpm gen protocol-method` adds entries at the\n * markers; the method itself lives in its own module under `methods/<group>/`.\n */\nimport type { AnyMethod, AnyNotification } from \"../method.ts\";\nimport { ARTIFACT_PROGRESS, ArtifactProgressParams } from \"../verify.ts\";\nimport { artifactCreateMethod } from \"./artifact/create.ts\";\nimport { artifactGetMethod } from \"./artifact/get.ts\";\nimport { artifactListMethod } from \"./artifact/list.ts\";\nimport { artifactPublishMethod } from \"./artifact/publish.ts\";\nimport { artifactVerifyMethod } from \"./artifact/verify.ts\";\nimport { depsAddMethod } from \"./deps/add.ts\";\nimport { DEV_NOTIFY, DevNotifyParams, devStartMethod } from \"./dev/start.ts\";\nimport { devStopMethod } from \"./dev/stop.ts\";\nimport { eventsAckMethod } from \"./events/ack.ts\";\nimport { eventsReadMethod } from \"./events/read.ts\";\nimport { EVENTS_NOTIFY, EventsNotifyParams, eventsSubscribeMethod } from \"./events/subscribe.ts\";\nimport { eventsUnsubscribeMethod } from \"./events/unsubscribe.ts\";\nimport { gcRunMethod } from \"./gc/run.ts\";\nimport { instanceCheckMethod } from \"./instance/check.ts\";\nimport { instanceStatusMethod } from \"./instance/status.ts\";\nimport { livePushMethod } from \"./live/push.ts\";\nimport { mostraInitializeMethod } from \"./mostra/initialize.ts\";\nimport { mostraShutdownMethod } from \"./mostra/shutdown.ts\";\nimport { portDraftsMirrorMethod } from \"./port/drafts-mirror.ts\";\nimport { portIdentityResolveMethod } from \"./port/identity-resolve.ts\";\nimport { portSecretsGetMethod } from \"./port/secrets-get.ts\";\nimport { portSubmissionsDeliverMethod } from \"./port/submissions-deliver.ts\";\nimport { portTrustedControlsActivatedMethod } from \"./port/trusted-controls-activated.ts\";\nimport { portTrustedControlsPolicyMethod } from \"./port/trusted-controls-policy.ts\";\nimport { resultsGetMethod } from \"./results/get.ts\";\nimport { secretDeleteMethod } from \"./secret/delete.ts\";\nimport { secretListMethod } from \"./secret/list.ts\";\nimport { secretSetMethod } from \"./secret/set.ts\";\nimport { stateGetMethod } from \"./state/get.ts\";\nimport { statePatchMethod } from \"./state/patch.ts\";\nimport { viewDefaultMethod } from \"./view/default.ts\";\nimport { viewLaunchMethod } from \"./view/launch.ts\";\nimport { viewRevokeMethod } from \"./view/revoke.ts\";\nimport { viewRotateMethod } from \"./view/rotate.ts\";\nimport { viewUrlMethod } from \"./view/url.ts\";\nimport { waitMethod } from \"./wait/wait.ts\";\n// gen:method-imports\n\n/** Every host protocol method, in the order they were added. */\nexport const hostMethods: readonly AnyMethod[] = [\n mostraInitializeMethod,\n mostraShutdownMethod,\n instanceStatusMethod,\n artifactCreateMethod,\n artifactPublishMethod,\n artifactListMethod,\n artifactGetMethod,\n depsAddMethod,\n viewUrlMethod,\n viewRevokeMethod,\n viewRotateMethod,\n stateGetMethod,\n resultsGetMethod,\n waitMethod,\n eventsReadMethod,\n eventsSubscribeMethod,\n eventsUnsubscribeMethod,\n statePatchMethod,\n eventsAckMethod,\n portSubmissionsDeliverMethod,\n portDraftsMirrorMethod,\n portTrustedControlsPolicyMethod,\n portTrustedControlsActivatedMethod,\n secretSetMethod,\n secretListMethod,\n secretDeleteMethod,\n livePushMethod,\n portSecretsGetMethod,\n artifactVerifyMethod,\n viewDefaultMethod,\n viewLaunchMethod,\n gcRunMethod,\n instanceCheckMethod,\n devStartMethod,\n devStopMethod,\n portIdentityResolveMethod,\n // gen:methods\n];\n\n/** Every notification the instance sends to its clients (INTERFACES §6). */\nexport const hostNotifications: readonly AnyNotification[] = [\n { method: EVENTS_NOTIFY, params: EventsNotifyParams as AnyNotification[\"params\"] },\n { method: ARTIFACT_PROGRESS, params: ArtifactProgressParams as AnyNotification[\"params\"] },\n { method: DEV_NOTIFY, params: DevNotifyParams as AnyNotification[\"params\"] },\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAa,cAAoC;CAC/C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAEF;;AAGA,MAAa,oBAAgD;CAC3D;EAAE,QAAQ;EAAe,QAAQ;CAAgD;CACjF;EAAE,QAAQ;EAAmB,QAAQ;CAAoD;CACzF;EAAE,QAAQ;EAAY,QAAQ;CAA6C;AAC7E"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/methods/index.ts"],"sourcesContent":["/**\n * Every host protocol method this package defines. `pnpm gen protocol-method` adds entries at the\n * markers; the method itself lives in its own module under `methods/<group>/`.\n */\nimport type { AnyMethod, AnyNotification } from \"../method.ts\";\nimport { ARTIFACT_PROGRESS, ArtifactProgressParams } from \"../verify.ts\";\nimport { artifactCreateMethod } from \"./artifact/create.ts\";\nimport { artifactGetMethod } from \"./artifact/get.ts\";\nimport { artifactListMethod } from \"./artifact/list.ts\";\nimport { artifactPublishMethod } from \"./artifact/publish.ts\";\nimport { artifactVerifyMethod } from \"./artifact/verify.ts\";\nimport { depsAddMethod } from \"./deps/add.ts\";\nimport { DEV_NOTIFY, DevNotifyParams, devStartMethod } from \"./dev/start.ts\";\nimport { devStopMethod } from \"./dev/stop.ts\";\nimport { eventsAckMethod } from \"./events/ack.ts\";\nimport { eventsReadMethod } from \"./events/read.ts\";\nimport { EVENTS_NOTIFY, EventsNotifyParams, eventsSubscribeMethod } from \"./events/subscribe.ts\";\nimport { eventsUnsubscribeMethod } from \"./events/unsubscribe.ts\";\nimport { gcRunMethod } from \"./gc/run.ts\";\nimport { instanceCheckMethod } from \"./instance/check.ts\";\nimport { instanceStatusMethod } from \"./instance/status.ts\";\nimport { livePushMethod } from \"./live/push.ts\";\nimport { mostraInitializeMethod } from \"./mostra/initialize.ts\";\nimport { mostraShutdownMethod } from \"./mostra/shutdown.ts\";\nimport { portAddressingExternalBaseMethod } from \"./port/addressing-external-base.ts\";\nimport { portDraftsMirrorMethod } from \"./port/drafts-mirror.ts\";\nimport { portIdentityResolveMethod } from \"./port/identity-resolve.ts\";\nimport { portSecretsGetMethod } from \"./port/secrets-get.ts\";\nimport { portSubmissionsDeliverMethod } from \"./port/submissions-deliver.ts\";\nimport { portTrustedControlsActivatedMethod } from \"./port/trusted-controls-activated.ts\";\nimport { portTrustedControlsPolicyMethod } from \"./port/trusted-controls-policy.ts\";\nimport { resultsGetMethod } from \"./results/get.ts\";\nimport { secretDeleteMethod } from \"./secret/delete.ts\";\nimport { secretListMethod } from \"./secret/list.ts\";\nimport { secretSetMethod } from \"./secret/set.ts\";\nimport { shareListMethod } from \"./share/list.ts\";\nimport { shareStartMethod } from \"./share/start.ts\";\nimport { shareStopMethod } from \"./share/stop.ts\";\nimport { stateGetMethod } from \"./state/get.ts\";\nimport { statePatchMethod } from \"./state/patch.ts\";\nimport { viewDefaultMethod } from \"./view/default.ts\";\nimport { viewLaunchMethod } from \"./view/launch.ts\";\nimport { viewRevokeMethod } from \"./view/revoke.ts\";\nimport { viewRotateMethod } from \"./view/rotate.ts\";\nimport { viewUrlMethod } from \"./view/url.ts\";\nimport { waitMethod } from \"./wait/wait.ts\";\n// gen:method-imports\n\n/** Every host protocol method, in the order they were added. */\nexport const hostMethods: readonly AnyMethod[] = [\n mostraInitializeMethod,\n mostraShutdownMethod,\n instanceStatusMethod,\n artifactCreateMethod,\n artifactPublishMethod,\n artifactListMethod,\n artifactGetMethod,\n depsAddMethod,\n viewUrlMethod,\n viewRevokeMethod,\n viewRotateMethod,\n stateGetMethod,\n resultsGetMethod,\n waitMethod,\n eventsReadMethod,\n eventsSubscribeMethod,\n eventsUnsubscribeMethod,\n statePatchMethod,\n eventsAckMethod,\n portSubmissionsDeliverMethod,\n portDraftsMirrorMethod,\n portTrustedControlsPolicyMethod,\n portTrustedControlsActivatedMethod,\n secretSetMethod,\n secretListMethod,\n secretDeleteMethod,\n livePushMethod,\n portSecretsGetMethod,\n artifactVerifyMethod,\n viewDefaultMethod,\n viewLaunchMethod,\n gcRunMethod,\n instanceCheckMethod,\n devStartMethod,\n devStopMethod,\n portIdentityResolveMethod,\n shareStartMethod,\n shareStopMethod,\n shareListMethod,\n portAddressingExternalBaseMethod,\n // gen:methods\n];\n\n/** Every notification the instance sends to its clients (INTERFACES §6). */\nexport const hostNotifications: readonly AnyNotification[] = [\n { method: EVENTS_NOTIFY, params: EventsNotifyParams as AnyNotification[\"params\"] },\n { method: ARTIFACT_PROGRESS, params: ArtifactProgressParams as AnyNotification[\"params\"] },\n { method: DEV_NOTIFY, params: DevNotifyParams as AnyNotification[\"params\"] },\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,MAAa,cAAoC;CAC/C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAEF;;AAGA,MAAa,oBAAgD;CAC3D;EAAE,QAAQ;EAAe,QAAQ;CAAgD;CACjF;EAAE,QAAQ;EAAmB,QAAQ;CAAoD;CACzF;EAAE,QAAQ;EAAY,QAAQ;CAA6C;AAC7E"}
@@ -1,5 +1,6 @@
1
1
  import { MethodDefinition } from "../../method.js";
2
2
  import { InstanceInfo } from "../mostra/initialize.js";
3
+ import { Share } from "../share/start.js";
3
4
  import * as z from "zod";
4
5
  //#region src/methods/instance/status.d.ts
5
6
  /** The params of `instance/status` (INTERFACES §6): none. */
@@ -26,6 +27,24 @@ export interface GatewayStatus {
26
27
  readonly artifactId: string;
27
28
  readonly origin: string;
28
29
  }[];
30
+ /**
31
+ * The gateway's external addresses (D158 item 1): a share's tunnel addresses and a host's
32
+ * external bases, each a listener of its own on loopback (WP-13).
33
+ */
34
+ readonly faces?: readonly FaceStatus[];
35
+ }
36
+ /** One external address of the gateway (D158 item 1). */
37
+ export interface FaceStatus {
38
+ /** The origin browsers use. */
39
+ readonly origin: string;
40
+ /** The loopback origin the tunnel or the host forwards it to. */
41
+ readonly local: string;
42
+ /** Which listener it fronts: the shell, or one artifact's frame. */
43
+ readonly listener: "shell" | "artifact";
44
+ /** The artifact, for an artifact's face. */
45
+ readonly artifactId?: string;
46
+ /** Who keeps it: a share's tunnel (`tailnet`, `funnel`, `cloudflare`) or a host (`host`). */
47
+ readonly by: "tailnet" | "funnel" | "cloudflare" | "host" | (string & {});
29
48
  }
30
49
  /**
31
50
  * The result of `instance/status`. The packages that add ports, deliveries, shares and versions
@@ -50,6 +69,11 @@ export interface InstanceStatusResult {
50
69
  readonly workers?: readonly WorkerStatus[];
51
70
  /** When the daemon exits for lack of work, if it will (WP-08, RT-08); absent: it won't. */
52
71
  readonly idleExitAt?: string;
72
+ /**
73
+ * The active shares (WP-13, D158), which keep a daemon from its idle exit. Their `url` is left
74
+ * out here, since status is printed where a link's secret mustn't appear: `share/list` gives it.
75
+ */
76
+ readonly shares?: readonly Share[];
53
77
  }
54
78
  /** One artifact version's worker (RT-03, D62). */
55
79
  export interface WorkerStatus {
@@ -1 +1 @@
1
- {"version":3,"file":"status.d.ts","names":[],"sources":["../../../src/methods/instance/status.ts"],"mappings":";;;;;YAMY,uBAAuB;;iBAGlB;;WAEN;;WAEA;;WAEA;;WAEA;;;iBAIM;;WAEN;;WAEA;;WAEA;aAA+B;aAA6B;;;;;;;iBAOtD;;WAEN,UAAU;;WAEV;;WAEA;;WAEA;;WAEA,oBAAoB;;WAEpB,UAAU;;WAEV,sBAAsB;;WAEtB,mBAAmB;;WAEnB;;;iBAIM;;WAEN;;WAEA;;;;;WAKA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;qBAIE,cAAc,EAAE,QAAQ;;iBAcpB;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;qBAIE,gBAAgB,EAAE,QAAQ;;qBAe1B,eAAe,EAAE,QAAQ;;qBASzB,oBAAoB,EAAE,QAAQ;;qBA+B9B,sBAAsB,iBAAiB,sBAAsB"}
1
+ {"version":3,"file":"status.d.ts","names":[],"sources":["../../../src/methods/instance/status.ts"],"mappings":";;;;;;YAOY,uBAAuB;;iBAGlB;;WAEN;;WAEA;;WAEA;;WAEA;;;iBAIM;;WAEN;;WAEA;;WAEA;aAA+B;aAA6B;;;;;;WAK5D,iBAAiB;;;iBAIX;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;;;;;iBAOM;;WAEN,UAAU;;WAEV;;WAEA;;WAEA;;WAEA,oBAAoB;;WAEpB,UAAU;;WAEV,sBAAsB;;WAEtB,mBAAmB;;WAEnB;;;;;WAKA,kBAAkB;;;iBAIZ;;WAEN;;WAEA;;;;;WAKA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;qBAIE,cAAc,EAAE,QAAQ;;iBAcpB;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;qBAIE,gBAAgB,EAAE,QAAQ;;qBAe1B,eAAe,EAAE,QAAQ;;qBAqBzB,oBAAoB,EAAE,QAAQ;;qBAgC9B,sBAAsB,iBAAiB,sBAAsB"}
@@ -1,6 +1,7 @@
1
1
  import { wireRegistry } from "../../wire-registry.js";
2
2
  import { defineMethod } from "../../method.js";
3
3
  import { InstanceInfo } from "../mostra/initialize.js";
4
+ import { Share } from "../share/start.js";
4
5
  import * as z from "zod";
5
6
  //#region src/methods/instance/status.ts
6
7
  /** The Zod schema of the `WorkerStatus` type. */
@@ -42,7 +43,14 @@ const GatewayStatus = z.object({
42
43
  artifacts: z.array(z.object({
43
44
  artifactId: z.string(),
44
45
  origin: z.string()
45
- })).readonly()
46
+ })).readonly(),
47
+ faces: z.array(z.object({
48
+ origin: z.string(),
49
+ local: z.string(),
50
+ listener: z.enum(["shell", "artifact"]),
51
+ artifactId: z.string().exactOptional(),
52
+ by: z.string()
53
+ })).readonly().exactOptional()
46
54
  }).register(wireRegistry, {
47
55
  id: "GatewayStatus",
48
56
  description: "Where the gateway listens."
@@ -67,7 +75,8 @@ const result = z.object({
67
75
  gateway: GatewayStatus.exactOptional(),
68
76
  deliveries: z.array(DeliveryCounts).readonly().exactOptional(),
69
77
  workers: z.array(WorkerStatus).readonly().exactOptional(),
70
- idleExitAt: z.string().exactOptional()
78
+ idleExitAt: z.string().exactOptional(),
79
+ shares: z.array(Share).readonly().exactOptional()
71
80
  }).register(wireRegistry, { id: "InstanceStatusResult" });
72
81
  /** `instance/status`: reports the instance, its socket, its connections and its child processes. */
73
82
  const instanceStatusMethod = defineMethod({
@@ -1 +1 @@
1
- {"version":3,"file":"status.js","names":[],"sources":["../../../src/methods/instance/status.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\nimport { InstanceInfo } from \"../mostra/initialize.ts\";\n\n/** The params of `instance/status` (INTERFACES §6): none. */\nexport type InstanceStatusParams = Record<string, never>;\n\n/** One child process the instance supervises. */\nexport interface ChildProcessStatus {\n /** The process ID. The child leads its own process group, so this is also its group ID. */\n readonly pid: number;\n /** What the child is: `builder`, `verify`, `worker`, `pty-host`, `demo`, `install` and so on. */\n readonly kind: string;\n /** What the child serves, such as an artifact or version ID. */\n readonly ownerRef: string;\n /** When the instance started it (RFC 3339, UTC). */\n readonly startedAt: string;\n}\n\n/** Where the gateway listens (D99, WP-05). */\nexport interface GatewayStatus {\n /** The address its listeners bind: `127.0.0.1` unless the instance started with `--bind`. */\n readonly bind: string;\n /** The shell's origin, where every capability link points. */\n readonly shell: string;\n /** The artifact origins it is serving now, one per opened artifact. */\n readonly artifacts: readonly { readonly artifactId: string; readonly origin: string }[];\n}\n\n/**\n * The result of `instance/status`. The packages that add ports, deliveries, shares and versions\n * add their fields here (INTERFACES §6).\n */\nexport interface InstanceStatusResult {\n /** The instance itself. */\n readonly instance: InstanceInfo;\n /** When the instance took ownership of its home (RFC 3339, UTC). */\n readonly startedAt: string;\n /** The control socket clients attach to. */\n readonly socket: string;\n /** How many protocol connections are open, this one included. */\n readonly connections: number;\n /** The child processes the instance supervises. */\n readonly processes: readonly ChildProcessStatus[];\n /** Where the gateway listens, once it has started (WP-05). */\n readonly gateway?: GatewayStatus;\n /** The outbox per host (WP-06, D105): how many deliveries are in each state. */\n readonly deliveries?: readonly DeliveryCounts[];\n /** The artifact workers, one per active version with server code (WP-08, RT-03). */\n readonly workers?: readonly WorkerStatus[];\n /** When the daemon exits for lack of work, if it will (WP-08, RT-08); absent: it won't. */\n readonly idleExitAt?: string;\n}\n\n/** One artifact version's worker (RT-03, D62). */\nexport interface WorkerStatus {\n /** The artifact. */\n readonly artifactId: string;\n /** The version. */\n readonly versionId: string;\n /**\n * `starting`, `ready`, `backoff` (it crashed and restarts on the next request after `retryAt`),\n * `parked` (it crashed more than 5 times in 10 minutes, FAILURE_MODEL §2), `stopped`.\n */\n readonly state: \"starting\" | \"ready\" | \"backoff\" | \"parked\" | \"stopped\";\n /** The worker's process, while it runs locally. */\n readonly pid?: number;\n /** Crashes in the last 10 minutes. */\n readonly crashes: number;\n /** The last crash's cause, such as `out of memory` or `event loop blocked for 10 s`. */\n readonly lastCause?: string;\n /** When a worker in `backoff` may start again. */\n readonly retryAt?: string;\n /** Calls, runs and live producers it serves now. */\n readonly active: number;\n}\n\n/** The Zod schema of the `WorkerStatus` type. */\nexport const WorkerStatus: z.ZodType<WorkerStatus> = z\n .object({\n artifactId: z.string(),\n versionId: z.string(),\n state: z.enum([\"starting\", \"ready\", \"backoff\", \"parked\", \"stopped\"]),\n pid: z.int().min(1).exactOptional(),\n crashes: z.int().min(0),\n lastCause: z.string().exactOptional(),\n retryAt: z.string().exactOptional(),\n active: z.int().min(0),\n })\n .register(wireRegistry, { id: \"WorkerStatus\", description: \"One artifact version's worker.\" });\n\n/** One host's deliveries by state (D105). */\nexport interface DeliveryCounts {\n /** The host's client name; empty for Mostra's built-in adapter (D105). */\n readonly owner: string;\n /** Whether a connection of this host has the submissions port registered now. */\n readonly connected: boolean;\n /** Deliveries not yet answered terminally. */\n readonly pending: number;\n /** Deliveries the host accepted. */\n readonly delivered: number;\n /** Deliveries the host rejected terminally. */\n readonly rejected: number;\n /** Deliveries the host declared undeliverable. */\n readonly undeliverable: number;\n}\n\n/** The Zod schema of the `DeliveryCounts` type. */\nexport const DeliveryCounts: z.ZodType<DeliveryCounts> = z\n .object({\n owner: z.string(),\n connected: z.boolean(),\n pending: z.int().min(0),\n delivered: z.int().min(0),\n rejected: z.int().min(0),\n undeliverable: z.int().min(0),\n })\n .register(wireRegistry, {\n id: \"DeliveryCounts\",\n description: \"One host's deliveries by state, and whether it is connected.\",\n });\n\n/** The Zod schema of the `GatewayStatus` type. */\nexport const GatewayStatus: z.ZodType<GatewayStatus> = z\n .object({\n bind: z.string(),\n shell: z.string(),\n artifacts: z.array(z.object({ artifactId: z.string(), origin: z.string() })).readonly(),\n })\n .register(wireRegistry, { id: \"GatewayStatus\", description: \"Where the gateway listens.\" });\n\n/** The Zod schema of the `ChildProcessStatus` type. */\nexport const ChildProcessStatus: z.ZodType<ChildProcessStatus> = z\n .object({\n pid: z.int().min(1),\n kind: z.string(),\n ownerRef: z.string(),\n startedAt: z.iso.datetime(),\n })\n .register(wireRegistry, {\n id: \"ChildProcessStatus\",\n description: \"One child process the instance supervises.\",\n });\n\nconst params: z.ZodType<InstanceStatusParams> = z\n .object({})\n .register(wireRegistry, { id: \"InstanceStatusParams\" });\n\nconst result: z.ZodType<InstanceStatusResult> = z\n .object({\n instance: InstanceInfo,\n startedAt: z.iso.datetime(),\n socket: z.string(),\n connections: z.int().min(0),\n processes: z.array(ChildProcessStatus).readonly(),\n gateway: GatewayStatus.exactOptional(),\n deliveries: z.array(DeliveryCounts).readonly().exactOptional(),\n workers: z.array(WorkerStatus).readonly().exactOptional(),\n idleExitAt: z.string().exactOptional(),\n })\n .register(wireRegistry, { id: \"InstanceStatusResult\" });\n\n/** `instance/status`: reports the instance, its socket, its connections and its child processes. */\nexport const instanceStatusMethod: MethodDefinition<InstanceStatusParams, InstanceStatusResult> =\n defineMethod({\n method: \"instance/status\",\n direction: \"client-to-instance\",\n mutating: false,\n params,\n result,\n });\n"],"mappings":";;;;;;AA+EA,MAAa,eAAwC,EAClD,OAAO;CACN,YAAY,EAAE,OAAO;CACrB,WAAW,EAAE,OAAO;CACpB,OAAO,EAAE,KAAK;EAAC;EAAY;EAAS;EAAW;EAAU;CAAS,CAAC;CACnE,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;CAClC,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACtB,WAAW,EAAE,OAAO,CAAC,CAAC,cAAc;CACpC,SAAS,EAAE,OAAO,CAAC,CAAC,cAAc;CAClC,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;AACvB,CAAC,CAAC,CACD,SAAS,cAAc;CAAE,IAAI;CAAgB,aAAa;AAAiC,CAAC;;AAmB/F,MAAa,iBAA4C,EACtD,OAAO;CACN,OAAO,EAAE,OAAO;CAChB,WAAW,EAAE,QAAQ;CACrB,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACtB,WAAW,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACxB,UAAU,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACvB,eAAe,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;AAC9B,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,gBAA0C,EACpD,OAAO;CACN,MAAM,EAAE,OAAO;CACf,OAAO,EAAE,OAAO;CAChB,WAAW,EAAE,MAAM,EAAE,OAAO;EAAE,YAAY,EAAE,OAAO;EAAG,QAAQ,EAAE,OAAO;CAAE,CAAC,CAAC,CAAC,CAAC,SAAS;AACxF,CAAC,CAAC,CACD,SAAS,cAAc;CAAE,IAAI;CAAiB,aAAa;AAA6B,CAAC;;AAG5F,MAAa,qBAAoD,EAC9D,OAAO;CACN,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAClB,MAAM,EAAE,OAAO;CACf,UAAU,EAAE,OAAO;CACnB,WAAW,EAAE,IAAI,SAAS;AAC5B,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;AAEH,MAAM,SAA0C,EAC7C,OAAO,CAAC,CAAC,CAAC,CACV,SAAS,cAAc,EAAE,IAAI,uBAAuB,CAAC;AAExD,MAAM,SAA0C,EAC7C,OAAO;CACN,UAAU;CACV,WAAW,EAAE,IAAI,SAAS;CAC1B,QAAQ,EAAE,OAAO;CACjB,aAAa,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAC1B,WAAW,EAAE,MAAM,kBAAkB,CAAC,CAAC,SAAS;CAChD,SAAS,cAAc,cAAc;CACrC,YAAY,EAAE,MAAM,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CAC7D,SAAS,EAAE,MAAM,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CACxD,YAAY,EAAE,OAAO,CAAC,CAAC,cAAc;AACvC,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,uBAAuB,CAAC;;AAGxD,MAAa,uBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
1
+ {"version":3,"file":"status.js","names":[],"sources":["../../../src/methods/instance/status.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\nimport { InstanceInfo } from \"../mostra/initialize.ts\";\nimport { Share } from \"../share/start.ts\";\n\n/** The params of `instance/status` (INTERFACES §6): none. */\nexport type InstanceStatusParams = Record<string, never>;\n\n/** One child process the instance supervises. */\nexport interface ChildProcessStatus {\n /** The process ID. The child leads its own process group, so this is also its group ID. */\n readonly pid: number;\n /** What the child is: `builder`, `verify`, `worker`, `pty-host`, `demo`, `install` and so on. */\n readonly kind: string;\n /** What the child serves, such as an artifact or version ID. */\n readonly ownerRef: string;\n /** When the instance started it (RFC 3339, UTC). */\n readonly startedAt: string;\n}\n\n/** Where the gateway listens (D99, WP-05). */\nexport interface GatewayStatus {\n /** The address its listeners bind: `127.0.0.1` unless the instance started with `--bind`. */\n readonly bind: string;\n /** The shell's origin, where every capability link points. */\n readonly shell: string;\n /** The artifact origins it is serving now, one per opened artifact. */\n readonly artifacts: readonly { readonly artifactId: string; readonly origin: string }[];\n /**\n * The gateway's external addresses (D158 item 1): a share's tunnel addresses and a host's\n * external bases, each a listener of its own on loopback (WP-13).\n */\n readonly faces?: readonly FaceStatus[];\n}\n\n/** One external address of the gateway (D158 item 1). */\nexport interface FaceStatus {\n /** The origin browsers use. */\n readonly origin: string;\n /** The loopback origin the tunnel or the host forwards it to. */\n readonly local: string;\n /** Which listener it fronts: the shell, or one artifact's frame. */\n readonly listener: \"shell\" | \"artifact\";\n /** The artifact, for an artifact's face. */\n readonly artifactId?: string;\n /** Who keeps it: a share's tunnel (`tailnet`, `funnel`, `cloudflare`) or a host (`host`). */\n readonly by: \"tailnet\" | \"funnel\" | \"cloudflare\" | \"host\" | (string & {});\n}\n\n/**\n * The result of `instance/status`. The packages that add ports, deliveries, shares and versions\n * add their fields here (INTERFACES §6).\n */\nexport interface InstanceStatusResult {\n /** The instance itself. */\n readonly instance: InstanceInfo;\n /** When the instance took ownership of its home (RFC 3339, UTC). */\n readonly startedAt: string;\n /** The control socket clients attach to. */\n readonly socket: string;\n /** How many protocol connections are open, this one included. */\n readonly connections: number;\n /** The child processes the instance supervises. */\n readonly processes: readonly ChildProcessStatus[];\n /** Where the gateway listens, once it has started (WP-05). */\n readonly gateway?: GatewayStatus;\n /** The outbox per host (WP-06, D105): how many deliveries are in each state. */\n readonly deliveries?: readonly DeliveryCounts[];\n /** The artifact workers, one per active version with server code (WP-08, RT-03). */\n readonly workers?: readonly WorkerStatus[];\n /** When the daemon exits for lack of work, if it will (WP-08, RT-08); absent: it won't. */\n readonly idleExitAt?: string;\n /**\n * The active shares (WP-13, D158), which keep a daemon from its idle exit. Their `url` is left\n * out here, since status is printed where a link's secret mustn't appear: `share/list` gives it.\n */\n readonly shares?: readonly Share[];\n}\n\n/** One artifact version's worker (RT-03, D62). */\nexport interface WorkerStatus {\n /** The artifact. */\n readonly artifactId: string;\n /** The version. */\n readonly versionId: string;\n /**\n * `starting`, `ready`, `backoff` (it crashed and restarts on the next request after `retryAt`),\n * `parked` (it crashed more than 5 times in 10 minutes, FAILURE_MODEL §2), `stopped`.\n */\n readonly state: \"starting\" | \"ready\" | \"backoff\" | \"parked\" | \"stopped\";\n /** The worker's process, while it runs locally. */\n readonly pid?: number;\n /** Crashes in the last 10 minutes. */\n readonly crashes: number;\n /** The last crash's cause, such as `out of memory` or `event loop blocked for 10 s`. */\n readonly lastCause?: string;\n /** When a worker in `backoff` may start again. */\n readonly retryAt?: string;\n /** Calls, runs and live producers it serves now. */\n readonly active: number;\n}\n\n/** The Zod schema of the `WorkerStatus` type. */\nexport const WorkerStatus: z.ZodType<WorkerStatus> = z\n .object({\n artifactId: z.string(),\n versionId: z.string(),\n state: z.enum([\"starting\", \"ready\", \"backoff\", \"parked\", \"stopped\"]),\n pid: z.int().min(1).exactOptional(),\n crashes: z.int().min(0),\n lastCause: z.string().exactOptional(),\n retryAt: z.string().exactOptional(),\n active: z.int().min(0),\n })\n .register(wireRegistry, { id: \"WorkerStatus\", description: \"One artifact version's worker.\" });\n\n/** One host's deliveries by state (D105). */\nexport interface DeliveryCounts {\n /** The host's client name; empty for Mostra's built-in adapter (D105). */\n readonly owner: string;\n /** Whether a connection of this host has the submissions port registered now. */\n readonly connected: boolean;\n /** Deliveries not yet answered terminally. */\n readonly pending: number;\n /** Deliveries the host accepted. */\n readonly delivered: number;\n /** Deliveries the host rejected terminally. */\n readonly rejected: number;\n /** Deliveries the host declared undeliverable. */\n readonly undeliverable: number;\n}\n\n/** The Zod schema of the `DeliveryCounts` type. */\nexport const DeliveryCounts: z.ZodType<DeliveryCounts> = z\n .object({\n owner: z.string(),\n connected: z.boolean(),\n pending: z.int().min(0),\n delivered: z.int().min(0),\n rejected: z.int().min(0),\n undeliverable: z.int().min(0),\n })\n .register(wireRegistry, {\n id: \"DeliveryCounts\",\n description: \"One host's deliveries by state, and whether it is connected.\",\n });\n\n/** The Zod schema of the `GatewayStatus` type. */\nexport const GatewayStatus: z.ZodType<GatewayStatus> = z\n .object({\n bind: z.string(),\n shell: z.string(),\n artifacts: z.array(z.object({ artifactId: z.string(), origin: z.string() })).readonly(),\n faces: z\n .array(\n z.object({\n origin: z.string(),\n local: z.string(),\n listener: z.enum([\"shell\", \"artifact\"]),\n artifactId: z.string().exactOptional(),\n by: z.string(),\n }),\n )\n .readonly()\n .exactOptional(),\n })\n .register(wireRegistry, { id: \"GatewayStatus\", description: \"Where the gateway listens.\" });\n\n/** The Zod schema of the `ChildProcessStatus` type. */\nexport const ChildProcessStatus: z.ZodType<ChildProcessStatus> = z\n .object({\n pid: z.int().min(1),\n kind: z.string(),\n ownerRef: z.string(),\n startedAt: z.iso.datetime(),\n })\n .register(wireRegistry, {\n id: \"ChildProcessStatus\",\n description: \"One child process the instance supervises.\",\n });\n\nconst params: z.ZodType<InstanceStatusParams> = z\n .object({})\n .register(wireRegistry, { id: \"InstanceStatusParams\" });\n\nconst result: z.ZodType<InstanceStatusResult> = z\n .object({\n instance: InstanceInfo,\n startedAt: z.iso.datetime(),\n socket: z.string(),\n connections: z.int().min(0),\n processes: z.array(ChildProcessStatus).readonly(),\n gateway: GatewayStatus.exactOptional(),\n deliveries: z.array(DeliveryCounts).readonly().exactOptional(),\n workers: z.array(WorkerStatus).readonly().exactOptional(),\n idleExitAt: z.string().exactOptional(),\n shares: z.array(Share).readonly().exactOptional(),\n })\n .register(wireRegistry, { id: \"InstanceStatusResult\" });\n\n/** `instance/status`: reports the instance, its socket, its connections and its child processes. */\nexport const instanceStatusMethod: MethodDefinition<InstanceStatusParams, InstanceStatusResult> =\n defineMethod({\n method: \"instance/status\",\n direction: \"client-to-instance\",\n mutating: false,\n params,\n result,\n });\n"],"mappings":";;;;;;;AAwGA,MAAa,eAAwC,EAClD,OAAO;CACN,YAAY,EAAE,OAAO;CACrB,WAAW,EAAE,OAAO;CACpB,OAAO,EAAE,KAAK;EAAC;EAAY;EAAS;EAAW;EAAU;CAAS,CAAC;CACnE,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;CAClC,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACtB,WAAW,EAAE,OAAO,CAAC,CAAC,cAAc;CACpC,SAAS,EAAE,OAAO,CAAC,CAAC,cAAc;CAClC,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;AACvB,CAAC,CAAC,CACD,SAAS,cAAc;CAAE,IAAI;CAAgB,aAAa;AAAiC,CAAC;;AAmB/F,MAAa,iBAA4C,EACtD,OAAO;CACN,OAAO,EAAE,OAAO;CAChB,WAAW,EAAE,QAAQ;CACrB,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACtB,WAAW,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACxB,UAAU,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACvB,eAAe,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;AAC9B,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,gBAA0C,EACpD,OAAO;CACN,MAAM,EAAE,OAAO;CACf,OAAO,EAAE,OAAO;CAChB,WAAW,EAAE,MAAM,EAAE,OAAO;EAAE,YAAY,EAAE,OAAO;EAAG,QAAQ,EAAE,OAAO;CAAE,CAAC,CAAC,CAAC,CAAC,SAAS;CACtF,OAAO,EACJ,MACC,EAAE,OAAO;EACP,QAAQ,EAAE,OAAO;EACjB,OAAO,EAAE,OAAO;EAChB,UAAU,EAAE,KAAK,CAAC,SAAS,UAAU,CAAC;EACtC,YAAY,EAAE,OAAO,CAAC,CAAC,cAAc;EACrC,IAAI,EAAE,OAAO;CACf,CAAC,CACH,CAAC,CACA,SAAS,CAAC,CACV,cAAc;AACnB,CAAC,CAAC,CACD,SAAS,cAAc;CAAE,IAAI;CAAiB,aAAa;AAA6B,CAAC;;AAG5F,MAAa,qBAAoD,EAC9D,OAAO;CACN,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAClB,MAAM,EAAE,OAAO;CACf,UAAU,EAAE,OAAO;CACnB,WAAW,EAAE,IAAI,SAAS;AAC5B,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;AAEH,MAAM,SAA0C,EAC7C,OAAO,CAAC,CAAC,CAAC,CACV,SAAS,cAAc,EAAE,IAAI,uBAAuB,CAAC;AAExD,MAAM,SAA0C,EAC7C,OAAO;CACN,UAAU;CACV,WAAW,EAAE,IAAI,SAAS;CAC1B,QAAQ,EAAE,OAAO;CACjB,aAAa,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAC1B,WAAW,EAAE,MAAM,kBAAkB,CAAC,CAAC,SAAS;CAChD,SAAS,cAAc,cAAc;CACrC,YAAY,EAAE,MAAM,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CAC7D,SAAS,EAAE,MAAM,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CACxD,YAAY,EAAE,OAAO,CAAC,CAAC,cAAc;CACrC,QAAQ,EAAE,MAAM,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;AAClD,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,uBAAuB,CAAC;;AAGxD,MAAa,uBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { MethodDefinition } from "../../method.js";
2
+ import * as z from "zod";
3
+ //#region src/methods/port/addressing-external-base.d.ts
4
+ /**
5
+ * An origin as browsers write it (`https://host.example`, `http://host:8080`): a scheme, a lower
6
+ * case host and a port only when it isn't the scheme's default, with no path, query or fragment.
7
+ */
8
+ export declare const OriginString: z.ZodType<string>;
9
+ /** The params of `port/addressing.externalBase` (INTERFACES §7, D158 item 6). */
10
+ export interface PortAddressingExternalBaseParams {
11
+ /** The artifact whose links or frame this address serves. */
12
+ readonly artifactId: string;
13
+ /**
14
+ * Which of Mostra's listeners the address fronts: `shell` for the artifact's links (the shell
15
+ * that opens them), `artifact` for the artifact's own frame.
16
+ */
17
+ readonly listener: "shell" | "artifact";
18
+ /**
19
+ * The loopback origin the host forwards this address to, such as `http://127.0.0.1:23456`: a
20
+ * port leased for this face, the same across restarts while the face exists.
21
+ */
22
+ readonly local: string;
23
+ }
24
+ /**
25
+ * The host's answer: the origin browsers use for this listener, and optionally how the artifact's
26
+ * frame authenticates there (`worker` by default whenever the shell's and the artifact's hosts
27
+ * differ, D70); `null` when the host offers no external address, so links stay on loopback.
28
+ */
29
+ export type PortAddressingExternalBaseResult = ExternalBase | null;
30
+ /** One external address a host gives a listener (D158 item 6). */
31
+ export interface ExternalBase {
32
+ /** The origin browsers use for the listener, such as `https://host.example.com`. */
33
+ readonly origin: string;
34
+ /**
35
+ * How the frame authenticates there (D70): `cookie` where the shell and the artifact are one
36
+ * site, `worker` where they are two. Absent: `cookie` for one host name, `worker` for two.
37
+ */
38
+ readonly mode?: "cookie" | "worker";
39
+ }
40
+ /** The schema of the `ExternalBase` type. */
41
+ export declare const ExternalBase: z.ZodType<ExternalBase>;
42
+ /**
43
+ * `port/addressing.externalBase`: Mostra asks the host that registered the `addressing` port for
44
+ * the external address of one of its listeners (HO-10, D158 item 6), with 5 seconds to answer,
45
+ * when it mints a link for an artifact and when the shell at such an address opens the artifact's
46
+ * frame. The answer joins the Host allowlist and the links Mostra mints; `null`, or another
47
+ * origin, withdraws the address given before, whose links stop working. A host that fails or
48
+ * answers something the schema refuses leaves links on loopback.
49
+ */
50
+ export declare const portAddressingExternalBaseMethod: MethodDefinition<PortAddressingExternalBaseParams, PortAddressingExternalBaseResult>;
51
+ //#endregion
52
+ //# sourceMappingURL=addressing-external-base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addressing-external-base.d.ts","names":[],"sources":["../../../src/methods/port/addressing-external-base.ts"],"mappings":";;;;;;;qBASa,cAAc,EAAE;;iBAyBZ;;WAEN;;;;;WAKA;;;;;WAKA;;;;;;;YAQC,mCAAmC;;iBAe9B;;WAEN;;;;;WAKA;;;qBAIE,cAAc,EAAE,QAAQ;;;;;;;;;qBAuBxB,kCAAkC,iBAC7C,kCACA"}
@@ -0,0 +1,61 @@
1
+ import { wireRegistry } from "../../wire-registry.js";
2
+ import { ArtifactId } from "../../ids.js";
3
+ import { defineMethod } from "../../method.js";
4
+ import * as z from "zod";
5
+ //#region src/methods/port/addressing-external-base.ts
6
+ /**
7
+ * An origin as browsers write it (`https://host.example`, `http://host:8080`): a scheme, a lower
8
+ * case host and a port only when it isn't the scheme's default, with no path, query or fragment.
9
+ */
10
+ const OriginString = z.string().max(2048).regex(originPattern(), { message: "An origin: http: or https:, a lower case host and a port only when not the default." }).register(wireRegistry, {
11
+ id: "OriginString",
12
+ description: "A web origin: scheme, host and a port only when it isn't the default."
13
+ });
14
+ /**
15
+ * An origin exactly as browsers serialize one, as one regular expression, so JSON Schema and the
16
+ * Rust crate check what Zod checks: a lower case DNS name or bracketed IPv6 literal, a port of 1
17
+ * to 65535, and never the scheme's default port written out.
18
+ */
19
+ function originPattern() {
20
+ const label = "[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?";
21
+ return new RegExp(`^(?!http://[^/]*:80$)(?!https://[^/]*:443$)https?://${`(?:${label}(?:\\.${label})*|\\[[0-9a-f:.]+\\])`}(?::(?:[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?$`);
22
+ }
23
+ const params = z.object({
24
+ artifactId: ArtifactId.schema,
25
+ listener: z.enum(["shell", "artifact"]),
26
+ local: z.string().min(1)
27
+ }).register(wireRegistry, {
28
+ id: "PortAddressingExternalBaseParams",
29
+ description: "Which listener of which artifact needs an external address, and where it listens."
30
+ });
31
+ /** The schema of the `ExternalBase` type. */
32
+ const ExternalBase = z.object({
33
+ origin: OriginString,
34
+ mode: z.enum(["cookie", "worker"]).exactOptional()
35
+ }).register(wireRegistry, {
36
+ id: "ExternalBase",
37
+ description: "The origin browsers use for a listener, and how its frame authenticates there."
38
+ });
39
+ const result = ExternalBase.nullable().register(wireRegistry, {
40
+ id: "PortAddressingExternalBaseResult",
41
+ description: "The external origin a host gives a listener, or null for loopback."
42
+ });
43
+ /**
44
+ * `port/addressing.externalBase`: Mostra asks the host that registered the `addressing` port for
45
+ * the external address of one of its listeners (HO-10, D158 item 6), with 5 seconds to answer,
46
+ * when it mints a link for an artifact and when the shell at such an address opens the artifact's
47
+ * frame. The answer joins the Host allowlist and the links Mostra mints; `null`, or another
48
+ * origin, withdraws the address given before, whose links stop working. A host that fails or
49
+ * answers something the schema refuses leaves links on loopback.
50
+ */
51
+ const portAddressingExternalBaseMethod = defineMethod({
52
+ method: "port/addressing.externalBase",
53
+ direction: "instance-to-host",
54
+ mutating: false,
55
+ params,
56
+ result
57
+ });
58
+ //#endregion
59
+ export { ExternalBase, OriginString, portAddressingExternalBaseMethod };
60
+
61
+ //# sourceMappingURL=addressing-external-base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addressing-external-base.js","names":[],"sources":["../../../src/methods/port/addressing-external-base.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { ArtifactId } from \"../../ids.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/**\n * An origin as browsers write it (`https://host.example`, `http://host:8080`): a scheme, a lower\n * case host and a port only when it isn't the scheme's default, with no path, query or fragment.\n */\nexport const OriginString: z.ZodType<string> = z\n .string()\n .max(2048)\n .regex(originPattern(), {\n message: \"An origin: http: or https:, a lower case host and a port only when not the default.\",\n })\n .register(wireRegistry, {\n id: \"OriginString\",\n description: \"A web origin: scheme, host and a port only when it isn't the default.\",\n });\n\n/**\n * An origin exactly as browsers serialize one, as one regular expression, so JSON Schema and the\n * Rust crate check what Zod checks: a lower case DNS name or bracketed IPv6 literal, a port of 1\n * to 65535, and never the scheme's default port written out.\n */\nfunction originPattern(): RegExp {\n const label = \"[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\";\n const host = `(?:${label}(?:\\\\.${label})*|\\\\[[0-9a-f:.]+\\\\])`;\n const port =\n \"(?:[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])\";\n return new RegExp(`^(?!http://[^/]*:80$)(?!https://[^/]*:443$)https?://${host}(?::${port})?$`);\n}\n\n/** The params of `port/addressing.externalBase` (INTERFACES §7, D158 item 6). */\nexport interface PortAddressingExternalBaseParams {\n /** The artifact whose links or frame this address serves. */\n readonly artifactId: string;\n /**\n * Which of Mostra's listeners the address fronts: `shell` for the artifact's links (the shell\n * that opens them), `artifact` for the artifact's own frame.\n */\n readonly listener: \"shell\" | \"artifact\";\n /**\n * The loopback origin the host forwards this address to, such as `http://127.0.0.1:23456`: a\n * port leased for this face, the same across restarts while the face exists.\n */\n readonly local: string;\n}\n\n/**\n * The host's answer: the origin browsers use for this listener, and optionally how the artifact's\n * frame authenticates there (`worker` by default whenever the shell's and the artifact's hosts\n * differ, D70); `null` when the host offers no external address, so links stay on loopback.\n */\nexport type PortAddressingExternalBaseResult = ExternalBase | null;\n\nconst params: z.ZodType<PortAddressingExternalBaseParams> = z\n .object({\n artifactId: ArtifactId.schema,\n listener: z.enum([\"shell\", \"artifact\"]),\n local: z.string().min(1),\n })\n .register(wireRegistry, {\n id: \"PortAddressingExternalBaseParams\",\n description:\n \"Which listener of which artifact needs an external address, and where it listens.\",\n });\n\n/** One external address a host gives a listener (D158 item 6). */\nexport interface ExternalBase {\n /** The origin browsers use for the listener, such as `https://host.example.com`. */\n readonly origin: string;\n /**\n * How the frame authenticates there (D70): `cookie` where the shell and the artifact are one\n * site, `worker` where they are two. Absent: `cookie` for one host name, `worker` for two.\n */\n readonly mode?: \"cookie\" | \"worker\";\n}\n\n/** The schema of the `ExternalBase` type. */\nexport const ExternalBase: z.ZodType<ExternalBase> = z\n .object({ origin: OriginString, mode: z.enum([\"cookie\", \"worker\"]).exactOptional() })\n .register(wireRegistry, {\n id: \"ExternalBase\",\n description: \"The origin browsers use for a listener, and how its frame authenticates there.\",\n });\n\nconst result: z.ZodType<PortAddressingExternalBaseResult> = ExternalBase.nullable().register(\n wireRegistry,\n {\n id: \"PortAddressingExternalBaseResult\",\n description: \"The external origin a host gives a listener, or null for loopback.\",\n },\n);\n\n/**\n * `port/addressing.externalBase`: Mostra asks the host that registered the `addressing` port for\n * the external address of one of its listeners (HO-10, D158 item 6), with 5 seconds to answer,\n * when it mints a link for an artifact and when the shell at such an address opens the artifact's\n * frame. The answer joins the Host allowlist and the links Mostra mints; `null`, or another\n * origin, withdraws the address given before, whose links stop working. A host that fails or\n * answers something the schema refuses leaves links on loopback.\n */\nexport const portAddressingExternalBaseMethod: MethodDefinition<\n PortAddressingExternalBaseParams,\n PortAddressingExternalBaseResult\n> = defineMethod({\n method: \"port/addressing.externalBase\",\n direction: \"instance-to-host\",\n mutating: false,\n params,\n result,\n});\n"],"mappings":";;;;;;;;;AASA,MAAa,eAAkC,EAC5C,OAAO,CAAC,CACR,IAAI,IAAI,CAAC,CACT,MAAM,cAAc,GAAG,EACtB,SAAS,sFACX,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;;;;;AAOH,SAAS,gBAAwB;CAC/B,MAAM,QAAQ;CAId,OAAO,IAAI,OAAO,uDAAuD,MAHtD,MAAM,QAAQ,MAAM,uBAGuC,gGAAe;AAC/F;AAyBA,MAAM,SAAsD,EACzD,OAAO;CACN,YAAY,WAAW;CACvB,UAAU,EAAE,KAAK,CAAC,SAAS,UAAU,CAAC;CACtC,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;AACzB,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;;AAcH,MAAa,eAAwC,EAClD,OAAO;CAAE,QAAQ;CAAc,MAAM,EAAE,KAAK,CAAC,UAAU,QAAQ,CAAC,CAAC,CAAC,cAAc;AAAE,CAAC,CAAC,CACpF,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;AAEH,MAAM,SAAsD,aAAa,SAAS,CAAC,CAAC,SAClF,cACA;CACE,IAAI;CACJ,aAAa;AACf,CACF;;;;;;;;;AAUA,MAAa,mCAGT,aAAa;CACf,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { ArtifactRef } from "../../artifact.js";
2
+ import { MethodDefinition } from "../../method.js";
3
+ import { Share } from "./start.js";
4
+ //#region src/methods/share/list.d.ts
5
+ /** The params of `share/list` (D158). */
6
+ export interface ShareListParams {
7
+ /** Only this artifact's shares. */
8
+ readonly artifact?: ArtifactRef;
9
+ /** Shares that ended too, newest first; default: active shares only. */
10
+ readonly all?: boolean;
11
+ }
12
+ /** The result of `share/list`. */
13
+ export interface ShareListResult {
14
+ /** Active shares first, each kind newest first. */
15
+ readonly shares: readonly Share[];
16
+ }
17
+ /**
18
+ * `share/list`: the home's shares (D158), each with its tunnel, link, state and, once it ended,
19
+ * why: a tunnel that dropped and couldn't come back shows here.
20
+ */
21
+ export declare const shareListMethod: MethodDefinition<ShareListParams, ShareListResult>;
22
+ //#endregion
23
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","names":[],"sources":["../../../src/methods/share/list.ts"],"mappings":";;;;;iBAOiB;;WAEN,WAAW;;WAEX;;;iBAIM;;WAEN,iBAAiB;;;;;;qBAkBf,iBAAiB,iBAAiB,iBAAiB"}
@@ -0,0 +1,29 @@
1
+ import { wireRegistry } from "../../wire-registry.js";
2
+ import { ArtifactRef } from "../../artifact.js";
3
+ import { defineMethod } from "../../method.js";
4
+ import { Share } from "./start.js";
5
+ import * as z from "zod";
6
+ //#region src/methods/share/list.ts
7
+ const params = z.object({
8
+ artifact: ArtifactRef.exactOptional(),
9
+ all: z.boolean().exactOptional()
10
+ }).register(wireRegistry, { id: "ShareListParams" });
11
+ const result = z.object({ shares: z.array(Share).readonly() }).register(wireRegistry, {
12
+ id: "ShareListResult",
13
+ description: "Shares with their links and state."
14
+ });
15
+ /**
16
+ * `share/list`: the home's shares (D158), each with its tunnel, link, state and, once it ended,
17
+ * why: a tunnel that dropped and couldn't come back shows here.
18
+ */
19
+ const shareListMethod = defineMethod({
20
+ method: "share/list",
21
+ direction: "client-to-instance",
22
+ mutating: false,
23
+ params,
24
+ result
25
+ });
26
+ //#endregion
27
+ export { shareListMethod };
28
+
29
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","names":[],"sources":["../../../src/methods/share/list.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { ArtifactRef } from \"../../artifact.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\nimport { Share } from \"./start.ts\";\n\n/** The params of `share/list` (D158). */\nexport interface ShareListParams {\n /** Only this artifact's shares. */\n readonly artifact?: ArtifactRef;\n /** Shares that ended too, newest first; default: active shares only. */\n readonly all?: boolean;\n}\n\n/** The result of `share/list`. */\nexport interface ShareListResult {\n /** Active shares first, each kind newest first. */\n readonly shares: readonly Share[];\n}\n\nconst params: z.ZodType<ShareListParams> = z\n .object({ artifact: ArtifactRef.exactOptional(), all: z.boolean().exactOptional() })\n .register(wireRegistry, { id: \"ShareListParams\" });\n\nconst result: z.ZodType<ShareListResult> = z\n .object({ shares: z.array(Share).readonly() })\n .register(wireRegistry, {\n id: \"ShareListResult\",\n description: \"Shares with their links and state.\",\n });\n\n/**\n * `share/list`: the home's shares (D158), each with its tunnel, link, state and, once it ended,\n * why: a tunnel that dropped and couldn't come back shows here.\n */\nexport const shareListMethod: MethodDefinition<ShareListParams, ShareListResult> = defineMethod({\n method: \"share/list\",\n direction: \"client-to-instance\",\n mutating: false,\n params,\n result,\n});\n"],"mappings":";;;;;;AAoBA,MAAM,SAAqC,EACxC,OAAO;CAAE,UAAU,YAAY,cAAc;CAAG,KAAK,EAAE,QAAQ,CAAC,CAAC,cAAc;AAAE,CAAC,CAAC,CACnF,SAAS,cAAc,EAAE,IAAI,kBAAkB,CAAC;AAEnD,MAAM,SAAqC,EACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAC7C,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;;;;AAMH,MAAa,kBAAsE,aAAa;CAC9F,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
@@ -0,0 +1,96 @@
1
+ import { ArtifactRef } from "../../artifact.js";
2
+ import { ViewerSpec } from "../../interaction.js";
3
+ import { CapabilityScope, Duration } from "../../capability.js";
4
+ import { MethodDefinition } from "../../method.js";
5
+ import * as z from "zod";
6
+ //#region src/methods/share/start.d.ts
7
+ /**
8
+ * How a share reaches its viewers (D158): `tailnet` through Tailscale Serve, to the people of the
9
+ * user's tailnet, who are known by name; `funnel` through Tailscale Funnel and `cloudflare`
10
+ * through a Cloudflare quick tunnel, both public, where the link is all that admits a viewer.
11
+ */
12
+ export type ShareVia = "tailnet" | "funnel" | "cloudflare";
13
+ /** The Zod schema of the `ShareVia` type. */
14
+ export declare const ShareVia: z.ZodType<ShareVia>;
15
+ /** The longest a public share (Funnel or Cloudflare) may last: 7 days (D158). */
16
+ export declare const PUBLIC_SHARE_MAX_TTL_MS: number;
17
+ /** How long a public share lasts when its `ttl` isn't given: 1 hour (D63 item 5, D158). */
18
+ export declare const PUBLIC_SHARE_DEFAULT_TTL: Duration;
19
+ /** The params of `share/start` (INTERFACES §6, D158). */
20
+ export interface ShareStartParams {
21
+ /** The artifact to share; the link opens its latest version. */
22
+ readonly artifact: ArtifactRef;
23
+ /** The tunnel. A public one (`funnel`, `cloudflare`) is explicit: never a fallback. */
24
+ readonly via: ShareVia;
25
+ /**
26
+ * How long the share and its link last, such as `30m` or `24h`. Public shares: 1 hour by
27
+ * default, at most 7 days. Tailnet shares: until stopped, unless given.
28
+ */
29
+ readonly ttl?: Duration;
30
+ /** What the share's link allows (D97). Default: every scope. */
31
+ readonly scopes?: readonly CapabilityScope[];
32
+ /**
33
+ * The person the share's link acts for (D104). Absent: whoever the tailnet or a host's identity
34
+ * port names, else the link's own viewer, never the home's local user (D158).
35
+ */
36
+ readonly viewer?: ViewerSpec;
37
+ /** Makes retries idempotent: a repeated `requestId` returns the same share (H-03). */
38
+ readonly requestId?: string;
39
+ }
40
+ /** A share, as `share/start` and `share/list` report it. */
41
+ export interface Share {
42
+ /** The share's ID, for `share/stop`. */
43
+ readonly shareId: string;
44
+ /** The artifact shared. */
45
+ readonly artifactId: string;
46
+ /** The tunnel. */
47
+ readonly via: ShareVia;
48
+ /**
49
+ * The share's capability URL, at the tunnel's address. Holding it is the authorization (D06);
50
+ * absent once the share ended, and in `share/list` when the home's key can no longer show it.
51
+ */
52
+ readonly url?: string;
53
+ /** The tunnel's host name: the tailnet device's, or the quick tunnel's random one. */
54
+ readonly hostname: string;
55
+ /**
56
+ * The address the artifact's frame is served at over the tunnel, while the share is active:
57
+ * on a tailnet, the second port of this device that viewers must be allowed to reach.
58
+ */
59
+ readonly artifactOrigin?: string;
60
+ /**
61
+ * How the artifact's frame authenticates over this tunnel (D70): `cookie` where the shell and
62
+ * the artifact are one site (Tailscale), `worker` where they are two (Cloudflare).
63
+ */
64
+ readonly mode: "cookie" | "worker";
65
+ /** The share's link, for `view/rotate` and `view/revoke`. */
66
+ readonly tokenId: string;
67
+ /** When the share started (RFC 3339, UTC). */
68
+ readonly startedAt: string;
69
+ /** When the share and its link end, if they do. */
70
+ readonly expiresAt?: string;
71
+ /** `active` while it serves; `stopped` once it ended. */
72
+ readonly state: "active" | "stopped";
73
+ /** When it ended. */
74
+ readonly stoppedAt?: string;
75
+ /**
76
+ * Why it ended: `stopped` (`share/stop`), `expired` (its TTL), `tunnel` (its tunnel ended and
77
+ * couldn't be set up again), `restart` (a quick tunnel can't outlive its instance), or
78
+ * `revoked` (its link was revoked).
79
+ */
80
+ readonly stopReason?: "stopped" | "expired" | "tunnel" | "restart" | "revoked" | (string & {});
81
+ }
82
+ /** The Zod schema of the `Share` type. */
83
+ export declare const Share: z.ZodType<Share>;
84
+ /** The result of `share/start`: the share, with its link. */
85
+ export type ShareStartResult = Share & {
86
+ readonly url: string;
87
+ };
88
+ /**
89
+ * `share/start`: shares an artifact through a tunnel the instance drives (D158): Tailscale Serve
90
+ * for the tailnet, or Tailscale Funnel or a Cloudflare quick tunnel for anyone with the link. It
91
+ * answers once the tunnel serves, with a new link at the tunnel's address that works there only.
92
+ * A missing or unready tool is a `MOSTRA_SHARE_*` diagnostic saying what to do.
93
+ */
94
+ export declare const shareStartMethod: MethodDefinition<ShareStartParams, ShareStartResult>;
95
+ //#endregion
96
+ //# sourceMappingURL=start.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start.d.ts","names":[],"sources":["../../../src/methods/share/start.ts"],"mappings":";;;;;;;;;;;YAaY;;qBAGC,UAAU,EAAE,QAAQ;;qBAQpB;;qBAGA,0BAA0B;;iBAGtB;;WAEN,UAAU;;WAEV,KAAK;;;;;WAKL,MAAM;;WAEN,kBAAkB;;;;;WAKlB,SAAS;;WAET;;;iBAIM;;WAEN;;WAEA;;WAEA,KAAK;;;;;WAKL;;WAEA;;;;;WAKA;;;;;WAKA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;;;;WAMA;;;qBAoBE,OAAO,EAAE,QAAQ;;YAMlB,mBAAmB;WAAmB;;;;;;;;qBA0BrC,kBAAkB,iBAAiB,kBAAkB"}