@halonicjs/testing 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/http-kit/src/connector-host-class.d.ts +14 -0
- package/dist/adapters/http-kit/src/connector-host-class.js +34 -0
- package/dist/adapters/http-kit/src/index.d.ts +2 -0
- package/dist/adapters/http-kit/src/index.js +2 -0
- package/dist/adapters/http-kit/src/ollama-tags.d.ts +20 -0
- package/dist/adapters/http-kit/src/ollama-tags.js +38 -0
- package/dist/adapters/integration-kit/src/index.d.ts +2 -1
- package/dist/adapters/integration-kit/src/index.js +1 -0
- package/dist/adapters/integration-kit/src/loader.d.ts +2 -12
- package/dist/adapters/integration-kit/src/loader.js +3 -20
- package/dist/adapters/integration-kit/src/workspace-choices.d.ts +37 -0
- package/dist/adapters/integration-kit/src/workspace-choices.js +37 -0
- package/dist/core/events/src/connector-listing-failed.d.ts +18 -0
- package/dist/core/events/src/connector-listing-failed.js +1 -0
- package/dist/core/events/src/home-path.d.ts +4 -1
- package/dist/core/events/src/home-path.js +14 -3
- package/dist/core/events/src/index.d.ts +4 -2
- package/dist/core/events/src/index.js +2 -0
- package/dist/core/events/src/provider-notes.d.ts +16 -0
- package/dist/core/events/src/provider-notes.js +24 -0
- package/dist/core/events/src/run-basics.d.ts +103 -5
- package/dist/core/events/src/run-event.d.ts +72 -7
- package/dist/core/events/src/run-summary.d.ts +11 -1
- package/dist/core/events/src/sandbox-opened-read.d.ts +2 -1
- package/dist/core/events/src/sandbox-opened-read.js +27 -2
- package/dist/core/events/src/sandbox-opened.d.ts +37 -4
- package/dist/core/events/src/sandbox-opened.js +13 -3
- package/dist/core/events/src/summarize.js +3 -0
- package/dist/core/events/src/tool-failure-cause.d.ts +25 -0
- package/dist/core/events/src/tool-failure-cause.js +66 -0
- package/dist/core/format/src/index.d.ts +3 -2
- package/dist/core/format/src/index.js +3 -1
- package/dist/core/format/src/kinds/agent/harness-limits.d.ts +14 -0
- package/dist/core/format/src/kinds/agent/harness-limits.js +27 -0
- package/dist/core/format/src/kinds/agent/schema.d.ts +5 -0
- package/dist/core/format/src/kinds/agent/schema.js +3 -0
- package/dist/core/format/src/kinds/connector/kind.js +24 -3
- package/dist/core/format/src/kinds/connector/schema.d.ts +14 -0
- package/dist/core/format/src/kinds/connector/schema.js +18 -0
- package/dist/core/format/src/kinds/integration/schema.js +1 -1
- package/dist/core/format/src/kinds/integration/sign-in-checks.d.ts +2 -1
- package/dist/core/format/src/kinds/integration/sign-in-checks.js +33 -3
- package/dist/core/format/src/kinds/plugin/checks.d.ts +3 -2
- package/dist/core/format/src/kinds/plugin/checks.js +17 -5
- package/dist/core/format/src/kinds/plugin/schema.js +24 -4
- package/dist/core/format/src/kinds/provider/kind.js +40 -1
- package/dist/core/format/src/kinds/provider/types.d.ts +19 -0
- package/dist/core/format/src/kinds/provider/types.js +22 -0
- package/dist/core/format/src/kinds/routine/schema.d.ts +10 -5
- package/dist/core/format/src/kinds/routine/schema.js +21 -15
- package/dist/core/format/src/kinds/workspace/schema.js +5 -4
- package/dist/core/format/src/parse-file.js +3 -1
- package/dist/core/format/src/shared/fields.d.ts +9 -2
- package/dist/core/format/src/shared/fields.js +15 -6
- package/dist/core/format/src/shared/guard.d.ts +8 -0
- package/dist/core/format/src/shared/guard.js +50 -1
- package/dist/core/format/src/shared/missing-keys.d.ts +17 -0
- package/dist/core/format/src/shared/missing-keys.js +110 -0
- package/dist/core/ports/src/chat.d.ts +8 -0
- package/dist/core/ports/src/connector-start-failure.d.ts +31 -0
- package/dist/core/ports/src/connector-start-failure.js +32 -0
- package/dist/core/ports/src/connector-tool-error.d.ts +33 -0
- package/dist/core/ports/src/connector-tool-error.js +40 -0
- package/dist/core/ports/src/definition-store-left-out.d.ts +46 -0
- package/dist/core/ports/src/definition-store-left-out.js +47 -0
- package/dist/core/ports/src/definition-store.d.ts +13 -3
- package/dist/core/ports/src/definition-store.js +1 -1
- package/dist/core/ports/src/deploy-target.d.ts +358 -0
- package/dist/core/ports/src/deploy-target.js +2 -0
- package/dist/core/ports/src/harness-bridge-server.d.ts +55 -4
- package/dist/core/ports/src/harness.d.ts +33 -2
- package/dist/core/ports/src/host-too-old.d.ts +23 -0
- package/dist/core/ports/src/host-too-old.js +27 -0
- package/dist/core/ports/src/index.d.ts +16 -5
- package/dist/core/ports/src/index.js +15 -3
- package/dist/core/ports/src/llm-provider.d.ts +37 -6
- package/dist/core/ports/src/llm-provider.js +43 -3
- package/dist/core/ports/src/pairing-codes.d.ts +111 -0
- package/dist/core/ports/src/pairing-codes.js +336 -0
- package/dist/core/ports/src/pairing-qr-bytes.d.ts +32 -0
- package/dist/core/ports/src/pairing-qr-bytes.js +116 -0
- package/dist/core/ports/src/port-versions.d.ts +6 -2
- package/dist/core/ports/src/port-versions.js +8 -0
- package/dist/core/ports/src/remote-control.d.ts +159 -0
- package/dist/core/ports/src/remote-control.js +26 -0
- package/dist/core/ports/src/remote-gateway-protocol.d.ts +220 -0
- package/dist/core/ports/src/remote-gateway-protocol.js +62 -0
- package/dist/core/ports/src/remote-gateway-session.d.ts +194 -0
- package/dist/core/ports/src/remote-gateway-session.js +241 -0
- package/dist/core/ports/src/run-executor.d.ts +39 -3
- package/dist/core/ports/src/run-executor.js +1 -1
- package/dist/core/ports/src/sandbox.d.ts +19 -0
- package/dist/core/ports/src/sandbox.js +14 -0
- package/dist/core/ports/src/secrets.d.ts +32 -1
- package/dist/core/ports/src/secrets.js +19 -2
- package/dist/core/ports/src/tunnel-provider.d.ts +117 -0
- package/dist/core/ports/src/tunnel-provider.js +65 -0
- package/dist/core/ports/src/tunnel-resolver.d.ts +83 -0
- package/dist/core/ports/src/tunnel-resolver.js +36 -0
- package/dist/core/ports/src/vcs.d.ts +30 -0
- package/dist/core/schema-kit/src/builders.d.ts +5 -0
- package/dist/core/schema-kit/src/builders.js +5 -0
- package/dist/core/std/src/hidden-characters.d.ts +9 -0
- package/dist/core/std/src/hidden-characters.js +18 -0
- package/dist/core/std/src/index.d.ts +3 -1
- package/dist/core/std/src/index.js +3 -1
- package/dist/core/std/src/path-overlap.d.ts +22 -0
- package/dist/core/std/src/path-overlap.js +57 -0
- package/dist/core/std/src/public-suffixes.generated.d.ts +1 -1
- package/dist/core/std/src/public-suffixes.generated.js +0 -1
- package/dist/core/std/src/word-diff.d.ts +28 -0
- package/dist/core/std/src/word-diff.js +77 -0
- package/dist/core/yaml/src/edit-data.d.ts +7 -0
- package/dist/core/yaml/src/edit-data.js +62 -3
- package/dist/core/yaml/src/edit.d.ts +7 -0
- package/dist/core/yaml/src/edit.js +34 -3
- package/dist/core/yaml/src/splice-node.d.ts +6 -0
- package/dist/core/yaml/src/splice-node.js +10 -0
- package/dist/core/yaml/src/splice.js +20 -10
- package/dist/testing/integration/src/checks.d.ts +5 -3
- package/dist/testing/integration/src/checks.js +31 -3
- package/package.json +9 -2
|
@@ -6,40 +6,51 @@ export type { ChatMessage, ChatParams, ChatRequest, ChatResponse, ChatStreamEven
|
|
|
6
6
|
export { type Clock, clockVersion } from "./clock.js";
|
|
7
7
|
export { type ConnectionKey, type ConnectionSettingsRecord, type ConnectionSettingsStore, connectionSettingsStoreVersion, } from "./connection-settings-store.js";
|
|
8
8
|
export { type ConnectorCallOptions, type ConnectorClient, type ConnectorConfig, type ConnectorFactory, type ConnectorFactoryContext, type ConnectorPin, type ConnectorTool, type ConnectorTransport, connectorClientVersion, passesNameRule, type ToolRisk, type TrustGrant, } from "./connector-client.js";
|
|
9
|
+
export { type ConnectorStartFailure, connectorStartFailureOf, } from "./connector-start-failure.js";
|
|
10
|
+
export { ConnectorToolError, isConnectorToolError } from "./connector-tool-error.js";
|
|
9
11
|
export { type Coordination, type CounterResult, coordinationVersion, type Lease, type WindowCount, } from "./coordination.js";
|
|
10
12
|
export { checkPublicWorkspacePath, checkWorkspacePath, type DefinitionSource, type DefinitionStore, type DefinitionWatch, type DefinitionWatchListener, definitionStoreVersion, type ExpectedContent, isPrivateWorkspacePath, isUnreadableWorkspaceFolderError, type RemoveOptions, type RemoveResult, segmentAsOpened, UnreadableWorkspaceFolderError, type WorkspaceFileChange, type WriteOptions, type WriteResult, } from "./definition-store.js";
|
|
13
|
+
export { checkLeaveOut, isLeftOut, type LeaveOut, type ListOptions, type VersionOptions, } from "./definition-store-left-out.js";
|
|
14
|
+
export * from "./deploy-target.js";
|
|
11
15
|
export { type Digest, digestVersion } from "./digest.js";
|
|
12
16
|
export { type FolderEntriesOptions, type FolderEntry, type FolderReader, folderReaderVersion, } from "./folder-reader.js";
|
|
13
17
|
export { addHarnessEnvironment, type Harness, type HarnessBridge, type HarnessDetection, type HarnessDetectOptions, type HarnessEvent, type HarnessInput, type HarnessRun, type HarnessSignIn, type HarnessTask, harnessBridgeTokenHeader, harnessVersion, } from "./harness.js";
|
|
14
18
|
export { type BridgeApprovalDecision, type BridgeApprovalRequest, type BridgeApprovals, type BridgeCallCharge, type BridgeEvent, type BridgeProvider, type BridgeProviderAccess, type BridgeRecorder, type BridgeToolCheck, type BridgeToolResult, type BridgeTools, bridgeCallCharge, bridgeCallCost, type HarnessBridgeOptions, type HarnessBridgeServer, harnessBridgeServerVersion, type OpenHarnessBridge, } from "./harness-bridge-server.js";
|
|
15
19
|
export { type SignInShell, signInCommandText } from "./harness-sign-in-command.js";
|
|
16
20
|
export { changeSavedHostSettings, type HostSettingsStore, type HostSettingValue, type HostSettingValues, hostSettingsMaxBytes, hostSettingsStoreVersion, isHostSettingKey, readSavedHostSettings, type SavedHostSettingsChange, } from "./host-settings-store.js";
|
|
21
|
+
export { HostTooOld, isHostTooOld } from "./host-too-old.js";
|
|
17
22
|
export { type HttpClient, httpClientVersion } from "./http-client.js";
|
|
18
23
|
export { type IdGenerator, idGeneratorVersion } from "./id-generator.js";
|
|
19
24
|
export { type InstructionChanges, type InstructionPin, type InstructionTrustKey, type InstructionTrustRecord, type InstructionTrustStore, instructionTrustStoreVersion, isInstructionTrustFor, } from "./instruction-trust-store.js";
|
|
20
25
|
export { type AuthPlacement, type Integration, type IntegrationConnection, type IntegrationHost, type IntegrationHttpClient, type IntegrationRequestInit, type IntegrationTool, integrationVersion, maxIntegrationWaitMs, type SecretPlacement, SignInNeededError, type SignInPlacement, type SignInTokens, } from "./integration.js";
|
|
21
26
|
export { type KnowledgeCapabilities, type KnowledgeDoc, type KnowledgeHit, type KnowledgeProvider, type KnowledgeProviderContext, type KnowledgeProviderFactory, knowledgeProviderVersion, } from "./knowledge-provider.js";
|
|
22
27
|
export { type LlmCache, llmCacheVersion } from "./llm-cache.js";
|
|
23
|
-
export { isModelCallError, isModelOutOfMemory, isVendorErrorText, type LlmCapabilities, type LlmProvider, type LlmProviderFactory, llmProviderVersion, ModelCallError, type ModelCallErrorReason, modelCallErrorReasons, type ProviderConfig, type ProviderFactoryContext, VendorErrorText, } from "./llm-provider.js";
|
|
28
|
+
export { isModelCallError, isModelOutOfMemory, isVendorErrorText, type LlmCapabilities, type LlmProvider, type LlmProviderFactory, llmProviderVersion, ModelCallError, type ModelCallErrorReason, modelCallErrorReasons, networkCauseOf, type ProviderConfig, type ProviderFactoryContext, VendorErrorText, } from "./llm-provider.js";
|
|
24
29
|
export { type ModelPrice, priceOf } from "./model-price.js";
|
|
30
|
+
export { checkCodeFromBytes, checkCodeInfo, checkCodeInputBytes, checkCodeLength, decodePairingQr, encodePairingQr, formatCheckCode, formatPairingCode, newPairingCode, type PairingQrPayload, pairingAlphabet, pairingCodeLength, pairingPskInfo, pairingPskInput, pairingQrMaxBytes, pairingQrMaxEndpoints, pairingQrMaxHostNameBytes, pairingQrPrefix, readCheckCode, readPairingCode, } from "./pairing-codes.js";
|
|
25
31
|
export { type PasswordHasher, passwordHasherVersion } from "./password-hasher.js";
|
|
26
32
|
export { checkPluginFiles, checkPluginId, type PlacePluginOptions, type PluginFolderWriter, type PluginPlacement, pluginFolderWriterVersion, } from "./plugin-folder-writer.js";
|
|
27
33
|
export { type PortName, portVersions } from "./port-versions.js";
|
|
28
34
|
export { type ProgramProbe, type ProgramProbeResult, type ProgramQuestion, type ProgramSettingsFolder, programProbeVersion, } from "./program-probe.js";
|
|
29
35
|
export { defaultBaseUrl } from "./provider-default-base-url.js";
|
|
30
36
|
export { type CurrentRecord, compactedChanges, foldRecords, formatRecordLines, parseRecordLines, type RecordChange, type RecordStore, recordStoreVersion, } from "./record-store.js";
|
|
37
|
+
export { type CodeEndReason, codeEndReasons, type PairedPhone, type PairingEndReason, type PairingEvent, type PairingSession, type PhonePlatform, pairingEndReasons, phonePlatforms, type RemoteControl, type RemoteState, remoteControlVersion, } from "./remote-control.js";
|
|
38
|
+
export { type GatewayApproval, type GatewayClientMessage, type GatewayErrorCode, type GatewayEventBody, type GatewayHostMessage, type GatewayPairDeniedReason, type GatewaySession, gatewayClosingErrorCodes, gatewayErrorCodes, gatewayMaxBufferedBytes, gatewayMaxIdLength, gatewayMaxMessageBytes, gatewayMaxPromptLength, gatewayMaxWatches, gatewayProtocolVersion, gatewayRefusalCodes, } from "./remote-gateway-protocol.js";
|
|
39
|
+
export { decodeCleartextFrame, encodeCleartextFrame, type GatewayCleartextFrame, type GatewayFrameKind, gatewayFallbackHostName, gatewayFallbackPhoneName, gatewayFrameKinds, gatewayHostName, gatewayMaxFrameBytes, gatewayMaxHandshakeBytes, gatewayMaxNameBytes, gatewayNoisePrologue, gatewayPairingPattern, gatewayReadableName, gatewayReconnectPattern, gatewaySessionLimits, noiseMaxMessageBytes, type PairCommitPayload, type PairHostPayload, type PairPhonePayload, type PairRefusedReason, pairCommitInput, pairCommitLabel, pairCommitNonceBytes, pairingRules, pairRefusedReasons, } from "./remote-gateway-session.js";
|
|
31
40
|
export { type FolderSize, type ProcessUsage, type ResourceProbe, resourceProbeVersion, } from "./resource-probe.js";
|
|
32
|
-
export { type ChatAgentSettings, type ChatTurnRefusal, type ChatTurnRequest, type ChatTurnResponse, type ChatTurnSkip, type EngineConnection, type EngineConnectionState, type RunEventListener, type RunExecutor, type RunSubscription, runExecutorVersion, type SendOptions, type StartAgentRequest, type StartRunRequest, } from "./run-executor.js";
|
|
41
|
+
export { type ChatAgentSettings, type ChatTurnRefusal, type ChatTurnRequest, type ChatTurnResponse, type ChatTurnSkip, type ChatTurnWaiting, type EngineConnection, type EngineConnectionState, type RunEventListener, type RunExecutor, type RunSubscription, runExecutorVersion, type SendOptions, type StartAgentRequest, type StartRunRequest, } from "./run-executor.js";
|
|
33
42
|
export { type AdapterFailure, adapterFailures, isRunFailureError, RunFailureError, } from "./run-failure-error.js";
|
|
34
43
|
export { type AppendOptions, type AppendResult, checkRunAppend, checkRunId, compareRunSummaries, formatLogLines, isRunId, matchesRunFilter, parseLogLines, type RunFilter, type RunLockRecord, type RunSnapshot, type RunStore, runLockFormat, runLockStaleAfterMs, runLockTakeoverStaleAfterMs, runStoreVersion, startedAtOrAfter, } from "./run-store.js";
|
|
35
44
|
export { isRunTargetNotFound, type RunTargetKind, RunTargetNotFound, } from "./run-target-not-found.js";
|
|
36
|
-
export { type Sandbox, type SandboxBlock, type SandboxBlockListener, type SandboxBridge, type SandboxCapabilities, type SandboxCheck, type SandboxCommand, type SandboxExit, type SandboxFence, type SandboxFileAccess, type SandboxFix, type SandboxNetwork, type SandboxPackageManager, type SandboxProcess, type SandboxProfile, type SandboxSession, type SandboxStrength, type SandboxUnavailableReason, sandboxPackageManagers, sandboxUnavailableReasons, sandboxVersion, } from "./sandbox.js";
|
|
45
|
+
export { type Sandbox, type SandboxBlock, type SandboxBlockListener, type SandboxBridge, type SandboxCapabilities, type SandboxCheck, type SandboxCommand, type SandboxExit, type SandboxFence, type SandboxFileAccess, type SandboxFix, type SandboxNetwork, type SandboxPackageManager, type SandboxProcess, type SandboxProfile, type SandboxResidual, type SandboxSession, type SandboxStrength, type SandboxUnavailableReason, sandboxPackageManagers, sandboxResiduals, sandboxUnavailableReasons, sandboxVersion, } from "./sandbox.js";
|
|
37
46
|
export { isSandboxSetting, type SandboxBackendId, type SandboxSetting, type SandboxSettingStore, sandboxBackendIds, sandboxSettingStoreVersion, } from "./sandbox-setting-store.js";
|
|
38
47
|
export { type ScheduledTimer, type Scheduler, type SchedulerFactory, type SchedulerListener, schedulerVersion, } from "./scheduler.js";
|
|
39
|
-
export { checkSecretValue, describeSecretName, halonicSecretNames, isHalonicSecretName, isPluginSecretName, isQuotableSecretName, isSecretName, maxSecretNameLength, maxSecretValueLength, pluginSecretNamePrefix, pluginSecretSeparator, pluginSecrets, type SecretStore, type Secrets, secretKey, secretsVersion, tokenNamePrefix, workspaceSecrets, } from "./secrets.js";
|
|
48
|
+
export { checkSecretValue, describeSecretName, halonicSecretNames, hostSecretNames, isHalonicSecretName, isPluginSecretName, isQuotableSecretName, isSecretName, type KeyOrigins, maxAllowedOrigins, maxSecretNameLength, maxSecretValueLength, noKeyOrigins, pluginSecretNamePrefix, pluginSecretSeparator, pluginSecrets, type SecretStore, type Secrets, secretKey, secretsVersion, tokenNamePrefix, workspaceSecrets, } from "./secrets.js";
|
|
40
49
|
export { type TokenStore, tokenStoreVersion } from "./token-store.js";
|
|
41
50
|
export { isUnreadableToolApprovalError, keptWaitingVersions, type ListedToolFingerprint, type ListedToolText, listedToolFingerprintPattern, maxWaitingTools, maxWaitingVersions, type ToolApproval, type ToolApprovalKey, type ToolApprovalStore, type ToolServer, toolApprovalStoreVersion, UnreadableToolApprovalError, type WaitingVersion, type WrittenDigest, waitingVersionKeptMs, } from "./tool-approval-store.js";
|
|
42
51
|
export { type TrustOrigin, type TrustRecord, type TrustStore, trustStoreVersion, } from "./trust-store.js";
|
|
52
|
+
export { assertGatewayTunnelConfig, assertTunnelConfig, type TunnelCapabilities, type TunnelConfig, type TunnelEndpoint, type TunnelProvider, type TunnelReason, type TunnelState, type TunnelStatus, tunnelProviderVersion, tunnelReasons, tunnelStates, } from "./tunnel-provider.js";
|
|
53
|
+
export { type TunnelResolver, type TunnelTransport, type TunnelTransportState, tunnelBackoff, tunnelReconnectDelayMs, tunnelResolverVersion, } from "./tunnel-resolver.js";
|
|
43
54
|
export { type UnfencedRunConsent, type UnfencedRunConsentStore, unfencedRunConsentStoreVersion, } from "./unfenced-run-consent-store.js";
|
|
44
|
-
export { checkCommitId, checkProposalRef, unversionedFolders, type Vcs, type VcsApplyOptions, type VcsChange, type VcsCommit, type VcsCommitVersionOptions, type VcsCommitWorktreeOptions, type VcsDiffStatus, type VcsFileDiff, type VcsFileStatus, type VcsStatus, type VcsWorktree, vcsVersion, } from "./vcs.js";
|
|
55
|
+
export { checkCommitId, checkProposalRef, unversionedFolders, type Vcs, type VcsApplyOptions, type VcsChange, type VcsCommit, type VcsCommitVersionOptions, type VcsCommitWorktreeOptions, type VcsDiffStatus, type VcsDivergence, type VcsFileDiff, type VcsFileStatus, type VcsStatus, type VcsWorktree, vcsVersion, } from "./vcs.js";
|
|
45
56
|
export { parseStatus } from "./vcs-status.js";
|
|
@@ -5,40 +5,52 @@ export { CantTryError, isCantTryError } from "./cant-try-error.js";
|
|
|
5
5
|
export { clockVersion } from "./clock.js";
|
|
6
6
|
export { connectionSettingsStoreVersion, } from "./connection-settings-store.js";
|
|
7
7
|
export { connectorClientVersion, passesNameRule, } from "./connector-client.js";
|
|
8
|
+
export { connectorStartFailureOf, } from "./connector-start-failure.js";
|
|
9
|
+
export { ConnectorToolError, isConnectorToolError } from "./connector-tool-error.js";
|
|
8
10
|
export { coordinationVersion, } from "./coordination.js";
|
|
9
11
|
export { checkPublicWorkspacePath, checkWorkspacePath, definitionStoreVersion, isPrivateWorkspacePath, isUnreadableWorkspaceFolderError, segmentAsOpened, UnreadableWorkspaceFolderError, } from "./definition-store.js";
|
|
12
|
+
export { checkLeaveOut, isLeftOut, } from "./definition-store-left-out.js";
|
|
13
|
+
// biome-ignore lint/performance/noReExportAll: keeps the barrel under the file-size limit; the names are listed in that file
|
|
14
|
+
export * from "./deploy-target.js";
|
|
10
15
|
export { digestVersion } from "./digest.js";
|
|
11
16
|
export { folderReaderVersion, } from "./folder-reader.js";
|
|
12
17
|
export { addHarnessEnvironment, harnessBridgeTokenHeader, harnessVersion, } from "./harness.js";
|
|
13
18
|
export { bridgeCallCharge, bridgeCallCost, harnessBridgeServerVersion, } from "./harness-bridge-server.js";
|
|
14
19
|
export { signInCommandText } from "./harness-sign-in-command.js";
|
|
15
20
|
export { changeSavedHostSettings, hostSettingsMaxBytes, hostSettingsStoreVersion, isHostSettingKey, readSavedHostSettings, } from "./host-settings-store.js";
|
|
21
|
+
export { HostTooOld, isHostTooOld } from "./host-too-old.js";
|
|
16
22
|
export { httpClientVersion } from "./http-client.js";
|
|
17
23
|
export { idGeneratorVersion } from "./id-generator.js";
|
|
18
24
|
export { instructionTrustStoreVersion, isInstructionTrustFor, } from "./instruction-trust-store.js";
|
|
19
25
|
export { integrationVersion, maxIntegrationWaitMs, SignInNeededError, } from "./integration.js";
|
|
20
26
|
export { knowledgeProviderVersion, } from "./knowledge-provider.js";
|
|
21
27
|
export { llmCacheVersion } from "./llm-cache.js";
|
|
22
|
-
export { isModelCallError, isModelOutOfMemory, isVendorErrorText, llmProviderVersion, ModelCallError, modelCallErrorReasons, VendorErrorText, } from "./llm-provider.js";
|
|
28
|
+
export { isModelCallError, isModelOutOfMemory, isVendorErrorText, llmProviderVersion, ModelCallError, modelCallErrorReasons, networkCauseOf, VendorErrorText, } from "./llm-provider.js";
|
|
23
29
|
export { priceOf } from "./model-price.js";
|
|
30
|
+
export { checkCodeFromBytes, checkCodeInfo, checkCodeInputBytes, checkCodeLength, decodePairingQr, encodePairingQr, formatCheckCode, formatPairingCode, newPairingCode, pairingAlphabet, pairingCodeLength, pairingPskInfo, pairingPskInput, pairingQrMaxBytes, pairingQrMaxEndpoints, pairingQrMaxHostNameBytes, pairingQrPrefix, readCheckCode, readPairingCode, } from "./pairing-codes.js";
|
|
24
31
|
export { passwordHasherVersion } from "./password-hasher.js";
|
|
25
32
|
export { checkPluginFiles, checkPluginId, pluginFolderWriterVersion, } from "./plugin-folder-writer.js";
|
|
26
33
|
export { portVersions } from "./port-versions.js";
|
|
27
34
|
export { programProbeVersion, } from "./program-probe.js";
|
|
28
35
|
export { defaultBaseUrl } from "./provider-default-base-url.js";
|
|
29
36
|
export { compactedChanges, foldRecords, formatRecordLines, parseRecordLines, recordStoreVersion, } from "./record-store.js";
|
|
37
|
+
export { codeEndReasons, pairingEndReasons, phonePlatforms, remoteControlVersion, } from "./remote-control.js";
|
|
38
|
+
export { gatewayClosingErrorCodes, gatewayErrorCodes, gatewayMaxBufferedBytes, gatewayMaxIdLength, gatewayMaxMessageBytes, gatewayMaxPromptLength, gatewayMaxWatches, gatewayProtocolVersion, gatewayRefusalCodes, } from "./remote-gateway-protocol.js";
|
|
39
|
+
export { decodeCleartextFrame, encodeCleartextFrame, gatewayFallbackHostName, gatewayFallbackPhoneName, gatewayFrameKinds, gatewayHostName, gatewayMaxFrameBytes, gatewayMaxHandshakeBytes, gatewayMaxNameBytes, gatewayNoisePrologue, gatewayPairingPattern, gatewayReadableName, gatewayReconnectPattern, gatewaySessionLimits, noiseMaxMessageBytes, pairCommitInput, pairCommitLabel, pairCommitNonceBytes, pairingRules, pairRefusedReasons, } from "./remote-gateway-session.js";
|
|
30
40
|
export { resourceProbeVersion, } from "./resource-probe.js";
|
|
31
41
|
export { runExecutorVersion, } from "./run-executor.js";
|
|
32
42
|
export { adapterFailures, isRunFailureError, RunFailureError, } from "./run-failure-error.js";
|
|
33
43
|
export { checkRunAppend, checkRunId, compareRunSummaries, formatLogLines, isRunId, matchesRunFilter, parseLogLines, runLockFormat, runLockStaleAfterMs, runLockTakeoverStaleAfterMs, runStoreVersion, startedAtOrAfter, } from "./run-store.js";
|
|
34
44
|
export { isRunTargetNotFound, RunTargetNotFound, } from "./run-target-not-found.js";
|
|
35
|
-
export { sandboxPackageManagers, sandboxUnavailableReasons, sandboxVersion, } from "./sandbox.js";
|
|
45
|
+
export { sandboxPackageManagers, sandboxResiduals, sandboxUnavailableReasons, sandboxVersion, } from "./sandbox.js";
|
|
36
46
|
export { isSandboxSetting, sandboxBackendIds, sandboxSettingStoreVersion, } from "./sandbox-setting-store.js";
|
|
37
47
|
export { schedulerVersion, } from "./scheduler.js";
|
|
38
|
-
export { checkSecretValue, describeSecretName, halonicSecretNames, isHalonicSecretName, isPluginSecretName, isQuotableSecretName, isSecretName, maxSecretNameLength, maxSecretValueLength, pluginSecretNamePrefix, pluginSecretSeparator, pluginSecrets, secretKey, secretsVersion, tokenNamePrefix, workspaceSecrets, } from "./secrets.js";
|
|
48
|
+
export { checkSecretValue, describeSecretName, halonicSecretNames, hostSecretNames, isHalonicSecretName, isPluginSecretName, isQuotableSecretName, isSecretName, maxAllowedOrigins, maxSecretNameLength, maxSecretValueLength, noKeyOrigins, pluginSecretNamePrefix, pluginSecretSeparator, pluginSecrets, secretKey, secretsVersion, tokenNamePrefix, workspaceSecrets, } from "./secrets.js";
|
|
39
49
|
export { tokenStoreVersion } from "./token-store.js";
|
|
40
50
|
export { isUnreadableToolApprovalError, keptWaitingVersions, listedToolFingerprintPattern, maxWaitingTools, maxWaitingVersions, toolApprovalStoreVersion, UnreadableToolApprovalError, waitingVersionKeptMs, } from "./tool-approval-store.js";
|
|
41
51
|
export { trustStoreVersion, } from "./trust-store.js";
|
|
52
|
+
export { assertGatewayTunnelConfig, assertTunnelConfig, tunnelProviderVersion, tunnelReasons, tunnelStates, } from "./tunnel-provider.js";
|
|
53
|
+
export { tunnelBackoff, tunnelReconnectDelayMs, tunnelResolverVersion, } from "./tunnel-resolver.js";
|
|
42
54
|
export { unfencedRunConsentStoreVersion, } from "./unfenced-run-consent-store.js";
|
|
43
55
|
export { checkCommitId, checkProposalRef, unversionedFolders, vcsVersion, } from "./vcs.js";
|
|
44
56
|
export { parseStatus } from "./vcs-status.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RunFailureCause, RunFailureKind } from "../../events/src/index.js";
|
|
1
2
|
import type { ChatRequest, ChatResponse, ChatStreamEvent } from "./chat.js";
|
|
2
3
|
import type { HttpClient } from "./http-client.js";
|
|
3
4
|
import type { Secrets } from "./secrets.js";
|
|
@@ -26,7 +27,7 @@ export interface LlmProvider {
|
|
|
26
27
|
* Makes one model call.
|
|
27
28
|
*
|
|
28
29
|
* @throws {ModelCallError} when the call fails, with the reason why: no
|
|
29
|
-
* key, offline, the model is missing, it can't call tools, it ran out of
|
|
30
|
+
* key, offline, no first answer in time, the model is missing, it can't call tools, it ran out of
|
|
30
31
|
* memory, the key wasn't accepted, the account is out of credit, the
|
|
31
32
|
* provider is busy, or the provider refused. Callers treat any other error as `refused`, except the abort
|
|
32
33
|
* error when `request.signal` aborts the call.
|
|
@@ -46,24 +47,27 @@ export interface LlmProvider {
|
|
|
46
47
|
stream?(request: ChatRequest): AsyncIterable<ChatStreamEvent>;
|
|
47
48
|
}
|
|
48
49
|
/** Every reason a model call can fail with, in {@link ModelCallErrorReason} order. */
|
|
49
|
-
export declare const modelCallErrorReasons: readonly ["no-key", "offline", "model-missing", "model-no-tools", "out-of-memory", "key-refused", "out-of-credit", "provider-busy", "refused", "local-only"];
|
|
50
|
+
export declare const modelCallErrorReasons: readonly ["no-key", "offline", "model-missing", "model-no-tools", "out-of-memory", "timeout", "key-refused", "out-of-credit", "provider-busy", "refused", "local-only"];
|
|
50
51
|
/**
|
|
51
52
|
* Why a model call failed:
|
|
52
53
|
* - `no-key`: the provider needs a key and its secret isn't set. A provider
|
|
53
54
|
* that has a key and is turned away says `key-refused`.
|
|
54
55
|
* - `offline`: the provider couldn't be reached, such as no network, a DNS
|
|
55
|
-
* failure, a refused connection or a
|
|
56
|
+
* failure, a refused connection or a reply that went silent. The error names the `host`
|
|
56
57
|
* when the provider knows it.
|
|
57
58
|
* - `model-missing`: the provider doesn't have the model asked for.
|
|
58
59
|
* - `model-no-tools`: the model can't call tools and the request offered some.
|
|
59
60
|
* - `out-of-memory`: the model doesn't fit in the memory of the machine that
|
|
60
61
|
* runs it. Providers find it with {@link isModelOutOfMemory}.
|
|
62
|
+
* - `timeout`: the provider was reached but gave no first answer in time (10
|
|
63
|
+
* minutes by default). The error names the `host` when the provider knows it.
|
|
61
64
|
* - `key-refused`: the provider didn't accept the key (HTTP 401 or 403).
|
|
62
65
|
* - `out-of-credit`: the account at the provider has no credit left or
|
|
63
66
|
* reached its spending limit, such as HTTP 402 or OpenAI's 429 with
|
|
64
67
|
* `insufficient_quota`. This is never Halonic's own budget.
|
|
65
68
|
* - `provider-busy`: the provider is overloaded or asked the caller to slow
|
|
66
|
-
* down, such as any other HTTP 429, a
|
|
69
|
+
* down, such as any other HTTP 429, a 500, 502, 503 or 504, or Anthropic's
|
|
70
|
+
* 529. A 501 or 505 says the server doesn't do what was asked, and is `refused`.
|
|
67
71
|
* - `refused`: anything else the provider turned down or failed on.
|
|
68
72
|
* - `local-only`: the workspace is local only (`privacy.localOnly: true`)
|
|
69
73
|
* and the model's provider isn't local, so the engine never called it.
|
|
@@ -85,21 +89,48 @@ export declare class ModelCallError extends Error {
|
|
|
85
89
|
readonly name = "ModelCallError";
|
|
86
90
|
readonly reason: ModelCallErrorReason;
|
|
87
91
|
/**
|
|
88
|
-
* With `offline` only: the host that didn't answer, as its name and port,
|
|
92
|
+
* With `offline` and `timeout` only: the host that didn't answer, as its name and port,
|
|
89
93
|
* such as `localhost:11434`. Never a URL with a path, a query or a key.
|
|
90
94
|
*/
|
|
91
95
|
readonly host: string | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* The kind of the typed cause, when the call failed for one the engine
|
|
98
|
+
* logs (requirement `ports.model-call-cause`). Absent otherwise, so
|
|
99
|
+
* `errorKindOf` reads such an error as `internal` and logs no cause.
|
|
100
|
+
*/
|
|
101
|
+
readonly kind?: RunFailureKind;
|
|
102
|
+
/** The code and detail of the typed cause, such as `proxy.refused`; absent without one. */
|
|
103
|
+
readonly failureCause?: Pick<RunFailureCause, "code" | "detail">;
|
|
92
104
|
/**
|
|
93
105
|
* @param reason - why the call failed
|
|
94
106
|
* @param message - plain text for the run log, never a key
|
|
95
107
|
* @param options - `cause` keeps the error this one wraps; `host` names the
|
|
96
|
-
* host that didn't answer, and is kept only with `offline`
|
|
108
|
+
* host that didn't answer, and is kept only with `offline` and `timeout`;
|
|
109
|
+
* `failureCause` is the typed cause the engine puts in `run.failed`, such
|
|
110
|
+
* as {@link networkCauseOf} finds on a network error
|
|
97
111
|
*/
|
|
98
112
|
constructor(reason: ModelCallErrorReason, message: string, options?: {
|
|
99
113
|
cause?: unknown;
|
|
100
114
|
host?: string;
|
|
115
|
+
failureCause?: RunFailureCause | undefined;
|
|
101
116
|
});
|
|
102
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* The typed cause a network error carries, so a provider can pass it on in a
|
|
120
|
+
* {@link ModelCallError} (requirement `ports.model-call-cause`). The HTTP
|
|
121
|
+
* client's `ProxyError` has one, such as `proxy.refused` with the proxy and
|
|
122
|
+
* the host: without it, a proxy that refused reads as no internet.
|
|
123
|
+
*
|
|
124
|
+
* It reads the error's own `kind` and `failureCause` by their fields, not
|
|
125
|
+
* `instanceof`, because the error comes from another package. It doesn't
|
|
126
|
+
* check them: the engine checks every cause before it logs it.
|
|
127
|
+
*
|
|
128
|
+
* @returns `undefined` for an error without a string `kind` and an object `failureCause`
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* new ModelCallError("offline", message, { cause, failureCause: networkCauseOf(cause) });
|
|
132
|
+
*/
|
|
133
|
+
export declare function networkCauseOf(error: unknown): RunFailureCause | undefined;
|
|
103
134
|
/**
|
|
104
135
|
* Whether `value` is a {@link ModelCallError}: an `Error` named
|
|
105
136
|
* "ModelCallError" with one of the known reasons. It works across copies of
|
|
@@ -7,6 +7,7 @@ export const modelCallErrorReasons = [
|
|
|
7
7
|
"model-missing",
|
|
8
8
|
"model-no-tools",
|
|
9
9
|
"out-of-memory",
|
|
10
|
+
"timeout",
|
|
10
11
|
"key-refused",
|
|
11
12
|
"out-of-credit",
|
|
12
13
|
"provider-busy",
|
|
@@ -29,7 +30,7 @@ export class ModelCallError extends Error {
|
|
|
29
30
|
name = "ModelCallError";
|
|
30
31
|
reason;
|
|
31
32
|
/**
|
|
32
|
-
* With `offline` only: the host that didn't answer, as its name and port,
|
|
33
|
+
* With `offline` and `timeout` only: the host that didn't answer, as its name and port,
|
|
33
34
|
* such as `localhost:11434`. Never a URL with a path, a query or a key.
|
|
34
35
|
*/
|
|
35
36
|
host;
|
|
@@ -37,14 +38,53 @@ export class ModelCallError extends Error {
|
|
|
37
38
|
* @param reason - why the call failed
|
|
38
39
|
* @param message - plain text for the run log, never a key
|
|
39
40
|
* @param options - `cause` keeps the error this one wraps; `host` names the
|
|
40
|
-
* host that didn't answer, and is kept only with `offline`
|
|
41
|
+
* host that didn't answer, and is kept only with `offline` and `timeout`;
|
|
42
|
+
* `failureCause` is the typed cause the engine puts in `run.failed`, such
|
|
43
|
+
* as {@link networkCauseOf} finds on a network error
|
|
41
44
|
*/
|
|
42
45
|
constructor(reason, message, options) {
|
|
43
46
|
super(message, options);
|
|
44
47
|
this.reason = reason;
|
|
45
|
-
this.host = reason === "offline" ? options?.host : undefined;
|
|
48
|
+
this.host = reason === "offline" || reason === "timeout" ? options?.host : undefined;
|
|
49
|
+
const typed = options?.failureCause;
|
|
50
|
+
if (typed !== undefined) {
|
|
51
|
+
const { kind, ...named } = typed;
|
|
52
|
+
this.kind = kind;
|
|
53
|
+
this.failureCause = named;
|
|
54
|
+
}
|
|
46
55
|
}
|
|
47
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* The typed cause a network error carries, so a provider can pass it on in a
|
|
59
|
+
* {@link ModelCallError} (requirement `ports.model-call-cause`). The HTTP
|
|
60
|
+
* client's `ProxyError` has one, such as `proxy.refused` with the proxy and
|
|
61
|
+
* the host: without it, a proxy that refused reads as no internet.
|
|
62
|
+
*
|
|
63
|
+
* It reads the error's own `kind` and `failureCause` by their fields, not
|
|
64
|
+
* `instanceof`, because the error comes from another package. It doesn't
|
|
65
|
+
* check them: the engine checks every cause before it logs it.
|
|
66
|
+
*
|
|
67
|
+
* @returns `undefined` for an error without a string `kind` and an object `failureCause`
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* new ModelCallError("offline", message, { cause, failureCause: networkCauseOf(cause) });
|
|
71
|
+
*/
|
|
72
|
+
export function networkCauseOf(error) {
|
|
73
|
+
if (!(error instanceof Error))
|
|
74
|
+
return undefined;
|
|
75
|
+
const { kind, failureCause } = error;
|
|
76
|
+
if (typeof kind !== "string" || typeof failureCause !== "object" || failureCause === null) {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
const { code, detail } = failureCause;
|
|
80
|
+
return {
|
|
81
|
+
kind: kind,
|
|
82
|
+
...(typeof code === "string" ? { code } : {}),
|
|
83
|
+
...(typeof detail === "object" && detail !== null
|
|
84
|
+
? { detail: detail }
|
|
85
|
+
: {}),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
48
88
|
/**
|
|
49
89
|
* Whether `value` is a {@link ModelCallError}: an `Error` named
|
|
50
90
|
* "ModelCallError" with one of the known reasons. It works across copies of
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The codes of phone pairing: the 12-character pairing code, the 6-character
|
|
3
|
+
* check code and the QR payload (requirement `ports.pairing-codes`, ADR
|
|
4
|
+
* "Pairing and the end-to-end session"). These are pure codecs. The HKDF
|
|
5
|
+
* steps are done by the Noise adapter, which has the platform's crypto; the
|
|
6
|
+
* test vectors in `golden/pairing-vectors.json` pin both, so the phone's Rust
|
|
7
|
+
* side can check itself against the same values.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* The 31 symbols of both codes: digits and capitals without 0, O, 1, I and L,
|
|
11
|
+
* which are easy to mistake for each other.
|
|
12
|
+
*/
|
|
13
|
+
export declare const pairingAlphabet = "23456789ABCDEFGHJKMNPQRSTUVWXYZ";
|
|
14
|
+
/** A pairing code is this many symbols, about 59 bits, shown in three groups of four. */
|
|
15
|
+
export declare const pairingCodeLength = 12;
|
|
16
|
+
/** A check code is this many symbols, shown in two groups of three. */
|
|
17
|
+
export declare const checkCodeLength = 6;
|
|
18
|
+
/**
|
|
19
|
+
* The HKDF-SHA256 info that turns a pairing code into the Noise psk: the
|
|
20
|
+
* input is {@link pairingPskInput}, the salt is empty and the output 32 bytes.
|
|
21
|
+
*/
|
|
22
|
+
export declare const pairingPskInfo = "halonic pair psk v1";
|
|
23
|
+
/**
|
|
24
|
+
* The HKDF-SHA256 info that turns the pairing handshake's hash into the bytes
|
|
25
|
+
* of the check code: the salt is empty and the output
|
|
26
|
+
* {@link checkCodeInputBytes} bytes, for {@link checkCodeFromBytes}.
|
|
27
|
+
*/
|
|
28
|
+
export declare const checkCodeInfo = "halonic pair check v1";
|
|
29
|
+
/** How many HKDF bytes {@link checkCodeFromBytes} reads. */
|
|
30
|
+
export declare const checkCodeInputBytes = 8;
|
|
31
|
+
/**
|
|
32
|
+
* A new pairing code from `randomBytes`, which gives that many bytes from a
|
|
33
|
+
* cryptographic source, such as `crypto.getRandomValues`. A byte of 248 or more
|
|
34
|
+
* is skipped, so each symbol is equally likely. Throws an `Error` when
|
|
35
|
+
* {@link pairingCodeMaxDraws} draws don't give 12 symbols: the source is broken.
|
|
36
|
+
*/
|
|
37
|
+
export declare function newPairingCode(randomBytes: (length: number) => Uint8Array): string;
|
|
38
|
+
/**
|
|
39
|
+
* A pairing code as a person typed it: in any case, with spaces, dots,
|
|
40
|
+
* dashes or middle dots anywhere. Gives the code in its plain form, or
|
|
41
|
+
* `undefined` when it isn't 12 symbols of the alphabet. Only ASCII is
|
|
42
|
+
* uppercased, so a character such as `ſ` can't turn into an `S`.
|
|
43
|
+
*/
|
|
44
|
+
export declare function readPairingCode(typed: string): string | undefined;
|
|
45
|
+
/** A check code read the same way as {@link readPairingCode}, or `undefined`. */
|
|
46
|
+
export declare function readCheckCode(typed: string): string | undefined;
|
|
47
|
+
/** A pairing code as shown: three groups of four, `7KQ2 M9XF 4HTA`. */
|
|
48
|
+
export declare function formatPairingCode(code: string): string;
|
|
49
|
+
/** A check code as shown: two groups of three, `4F7 · 2KQ`. */
|
|
50
|
+
export declare function formatCheckCode(code: string): string;
|
|
51
|
+
/** The HKDF input for the psk: the ASCII bytes of the code in its plain form. */
|
|
52
|
+
export declare function pairingPskInput(code: string): Uint8Array;
|
|
53
|
+
/**
|
|
54
|
+
* The check code from the 8 HKDF bytes of the handshake hash: read as an
|
|
55
|
+
* unsigned 64-bit big-endian number, reduced mod 31⁶, written in the alphabet
|
|
56
|
+
* most significant symbol first. The bias of the reduction is under 2⁻³⁴.
|
|
57
|
+
*/
|
|
58
|
+
export declare function checkCodeFromBytes(bytes: Uint8Array): string;
|
|
59
|
+
/** What a pairing QR code says. */
|
|
60
|
+
export interface PairingQrPayload {
|
|
61
|
+
/** The host's static X25519 public key, 32 bytes: the phone pins it. */
|
|
62
|
+
readonly hostKey: Uint8Array;
|
|
63
|
+
/** The pairing code, in its plain form. */
|
|
64
|
+
readonly code: string;
|
|
65
|
+
/** The host's name, at most {@link pairingQrMaxHostNameBytes} bytes of UTF-8. */
|
|
66
|
+
readonly hostName: string;
|
|
67
|
+
/**
|
|
68
|
+
* Where the phone reaches the gateway: 1 to 3 URLs, the one to try first
|
|
69
|
+
* first, each in its canonical form: `tcp://`, `wss://` or `https://`, an
|
|
70
|
+
* IPv4 address or a lower-case host name, and a port only when it isn't the
|
|
71
|
+
* scheme's default (443 for `wss:` and `https:`; `tcp:` always has one), as
|
|
72
|
+
* `tcp://192.168.1.20:4100` or `wss://studio.tail1234.ts.net`.
|
|
73
|
+
*/
|
|
74
|
+
readonly endpoints: readonly string[];
|
|
75
|
+
}
|
|
76
|
+
/** The text every pairing QR code starts with. */
|
|
77
|
+
export declare const pairingQrPrefix = "halonic-pair:";
|
|
78
|
+
/** The longest QR text, in bytes: it fits a version 8 QR code at level M, which holds 152. */
|
|
79
|
+
export declare const pairingQrMaxBytes = 150;
|
|
80
|
+
/** The longest host name in a QR code, in bytes of UTF-8; a longer one is cut. */
|
|
81
|
+
export declare const pairingQrMaxHostNameBytes = 32;
|
|
82
|
+
/** The most endpoints in a QR code. */
|
|
83
|
+
export declare const pairingQrMaxEndpoints = 3;
|
|
84
|
+
/**
|
|
85
|
+
* Writes a pairing QR code's text: `halonic-pair:` and base64url, without
|
|
86
|
+
* padding, of a record of the version (1), the host key, the code as one
|
|
87
|
+
* base-31 number in 8 bytes, the host name (a length byte, then UTF-8, cut
|
|
88
|
+
* at a whole character to 32 bytes) and the endpoints (a count, then an
|
|
89
|
+
* entry for each, see {@link writeEndpoint}).
|
|
90
|
+
*
|
|
91
|
+
* The endpoints are kept in their order, and one that would take the text
|
|
92
|
+
* past {@link pairingQrMaxBytes} is left out, so the host lists the LAN
|
|
93
|
+
* endpoint first. `endpoints` in the result are the ones kept. Throws a
|
|
94
|
+
* `RangeError` for a key that isn't 32 bytes, a code that isn't a pairing
|
|
95
|
+
* code, an endpoint that isn't in its canonical form (see
|
|
96
|
+
* {@link PairingQrPayload.endpoints}) or is an IPv6 address, or when no
|
|
97
|
+
* endpoint fits.
|
|
98
|
+
*/
|
|
99
|
+
export declare function encodePairingQr(payload: PairingQrPayload): {
|
|
100
|
+
readonly text: string;
|
|
101
|
+
readonly endpoints: readonly string[];
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Reads a pairing QR code's text, exactly as {@link encodePairingQr} writes
|
|
105
|
+
* it. Anything else is `undefined`: another prefix, padding or a character
|
|
106
|
+
* outside base64url, another version, a code past 31¹², a name that isn't
|
|
107
|
+
* UTF-8 or is too long, no endpoint or more than three, an endpoint entry
|
|
108
|
+
* that writing wouldn't give, a missing or an extra byte, or a text over 150
|
|
109
|
+
* bytes.
|
|
110
|
+
*/
|
|
111
|
+
export declare function decodePairingQr(text: string): PairingQrPayload | undefined;
|