@raidiant/notifai 11.7.1 → 12.0.0-beta.6
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/CHANGELOG.md +48 -0
- package/NOTICE +16 -0
- package/THIRD_PARTY_NOTICES +725 -0
- package/bin/notifai.mjs +11387 -0
- package/data/install.ps1 +318 -0
- package/data/release.json +1 -0
- package/inventory.json +1 -0
- package/npm-adapter-files.json +52 -0
- package/package.json +14 -44
- package/README.md +0 -168
- package/dist/agent-update-notice.d.ts +0 -7
- package/dist/agent-update-notice.js +0 -77
- package/dist/agent-update-notice.js.map +0 -1
- package/dist/atomic-file.d.ts +0 -30
- package/dist/atomic-file.js +0 -148
- package/dist/atomic-file.js.map +0 -1
- package/dist/attendant-update.d.ts +0 -15
- package/dist/attendant-update.js +0 -96
- package/dist/attendant-update.js.map +0 -1
- package/dist/claude-wake.d.ts +0 -108
- package/dist/claude-wake.js +0 -369
- package/dist/claude-wake.js.map +0 -1
- package/dist/cli-bin.d.ts +0 -26
- package/dist/cli-bin.js +0 -220
- package/dist/cli-bin.js.map +0 -1
- package/dist/cli-contract.d.ts +0 -16
- package/dist/cli-contract.js +0 -27
- package/dist/cli-contract.js.map +0 -1
- package/dist/cli-release.d.ts +0 -36
- package/dist/cli-release.js +0 -85
- package/dist/cli-release.js.map +0 -1
- package/dist/client.d.ts +0 -109
- package/dist/client.js +0 -217
- package/dist/client.js.map +0 -1
- package/dist/codex-answer-control.d.ts +0 -14
- package/dist/codex-answer-control.js +0 -41
- package/dist/codex-answer-control.js.map +0 -1
- package/dist/codex-answer-presentation.d.ts +0 -18
- package/dist/codex-answer-presentation.js +0 -113
- package/dist/codex-answer-presentation.js.map +0 -1
- package/dist/codex-input-lifecycle.d.ts +0 -10
- package/dist/codex-input-lifecycle.js +0 -63
- package/dist/codex-input-lifecycle.js.map +0 -1
- package/dist/codex-native-control.d.ts +0 -13
- package/dist/codex-native-control.js +0 -120
- package/dist/codex-native-control.js.map +0 -1
- package/dist/codex-native-turn.d.ts +0 -37
- package/dist/codex-native-turn.js +0 -155
- package/dist/codex-native-turn.js.map +0 -1
- package/dist/codex-question-bindings.d.ts +0 -76
- package/dist/codex-question-bindings.js +0 -151
- package/dist/codex-question-bindings.js.map +0 -1
- package/dist/codex-queue-control.d.ts +0 -21
- package/dist/codex-queue-control.js +0 -59
- package/dist/codex-queue-control.js.map +0 -1
- package/dist/codex-tool-messages.d.ts +0 -7
- package/dist/codex-tool-messages.js +0 -126
- package/dist/codex-tool-messages.js.map +0 -1
- package/dist/codex-wake.d.ts +0 -58
- package/dist/codex-wake.js +0 -135
- package/dist/codex-wake.js.map +0 -1
- package/dist/command-session.d.ts +0 -14
- package/dist/command-session.js +0 -31
- package/dist/command-session.js.map +0 -1
- package/dist/commands-acknowledge.d.ts +0 -13
- package/dist/commands-acknowledge.js +0 -116
- package/dist/commands-acknowledge.js.map +0 -1
- package/dist/commands-agent-sessions.d.ts +0 -6
- package/dist/commands-agent-sessions.js +0 -51
- package/dist/commands-agent-sessions.js.map +0 -1
- package/dist/commands-ask.d.ts +0 -62
- package/dist/commands-ask.js +0 -503
- package/dist/commands-ask.js.map +0 -1
- package/dist/commands-auth.d.ts +0 -76
- package/dist/commands-auth.js +0 -421
- package/dist/commands-auth.js.map +0 -1
- package/dist/commands-close.d.ts +0 -6
- package/dist/commands-close.js +0 -273
- package/dist/commands-close.js.map +0 -1
- package/dist/commands-config.d.ts +0 -31
- package/dist/commands-config.js +0 -272
- package/dist/commands-config.js.map +0 -1
- package/dist/commands-core.d.ts +0 -145
- package/dist/commands-core.js +0 -190
- package/dist/commands-core.js.map +0 -1
- package/dist/commands-devices.d.ts +0 -41
- package/dist/commands-devices.js +0 -144
- package/dist/commands-devices.js.map +0 -1
- package/dist/commands-doctor.d.ts +0 -25
- package/dist/commands-doctor.js +0 -1553
- package/dist/commands-doctor.js.map +0 -1
- package/dist/commands-guidance.d.ts +0 -27
- package/dist/commands-guidance.js +0 -150
- package/dist/commands-guidance.js.map +0 -1
- package/dist/commands-harness-context.d.ts +0 -57
- package/dist/commands-harness-context.js +0 -102
- package/dist/commands-harness-context.js.map +0 -1
- package/dist/commands-hook-attend.d.ts +0 -70
- package/dist/commands-hook-attend.js +0 -655
- package/dist/commands-hook-attend.js.map +0 -1
- package/dist/commands-hook-diagnostics.d.ts +0 -37
- package/dist/commands-hook-diagnostics.js +0 -136
- package/dist/commands-hook-diagnostics.js.map +0 -1
- package/dist/commands-hook-install.d.ts +0 -26
- package/dist/commands-hook-install.js +0 -784
- package/dist/commands-hook-install.js.map +0 -1
- package/dist/commands-hook-run.d.ts +0 -29
- package/dist/commands-hook-run.js +0 -933
- package/dist/commands-hook-run.js.map +0 -1
- package/dist/commands-hook-shape.d.ts +0 -19
- package/dist/commands-hook-shape.js +0 -48
- package/dist/commands-hook-shape.js.map +0 -1
- package/dist/commands-init.d.ts +0 -42
- package/dist/commands-init.js +0 -901
- package/dist/commands-init.js.map +0 -1
- package/dist/commands-io.d.ts +0 -2
- package/dist/commands-io.js +0 -117
- package/dist/commands-io.js.map +0 -1
- package/dist/commands-logs.d.ts +0 -30
- package/dist/commands-logs.js +0 -201
- package/dist/commands-logs.js.map +0 -1
- package/dist/commands-native-acknowledge.d.ts +0 -8
- package/dist/commands-native-acknowledge.js +0 -114
- package/dist/commands-native-acknowledge.js.map +0 -1
- package/dist/commands-project.d.ts +0 -4
- package/dist/commands-project.js +0 -41
- package/dist/commands-project.js.map +0 -1
- package/dist/commands-receive.d.ts +0 -3
- package/dist/commands-receive.js +0 -59
- package/dist/commands-receive.js.map +0 -1
- package/dist/commands-send-support.d.ts +0 -59
- package/dist/commands-send-support.js +0 -258
- package/dist/commands-send-support.js.map +0 -1
- package/dist/commands-send.d.ts +0 -34
- package/dist/commands-send.js +0 -900
- package/dist/commands-send.js.map +0 -1
- package/dist/commands-setup-proof.d.ts +0 -43
- package/dist/commands-setup-proof.js +0 -134
- package/dist/commands-setup-proof.js.map +0 -1
- package/dist/commands-skill.d.ts +0 -21
- package/dist/commands-skill.js +0 -199
- package/dist/commands-skill.js.map +0 -1
- package/dist/commands-sounds.d.ts +0 -12
- package/dist/commands-sounds.js +0 -35
- package/dist/commands-sounds.js.map +0 -1
- package/dist/commands-update-check.d.ts +0 -6
- package/dist/commands-update-check.js +0 -102
- package/dist/commands-update-check.js.map +0 -1
- package/dist/commands-update-resume.d.ts +0 -7
- package/dist/commands-update-resume.js +0 -143
- package/dist/commands-update-resume.js.map +0 -1
- package/dist/commands-update-skill.d.ts +0 -5
- package/dist/commands-update-skill.js +0 -36
- package/dist/commands-update-skill.js.map +0 -1
- package/dist/commands-update.d.ts +0 -11
- package/dist/commands-update.js +0 -286
- package/dist/commands-update.js.map +0 -1
- package/dist/commands.d.ts +0 -26
- package/dist/commands.js +0 -27
- package/dist/commands.js.map +0 -1
- package/dist/config-schema.d.ts +0 -62
- package/dist/config-schema.js +0 -302
- package/dist/config-schema.js.map +0 -1
- package/dist/config.d.ts +0 -181
- package/dist/config.js +0 -357
- package/dist/config.js.map +0 -1
- package/dist/credentials.d.ts +0 -96
- package/dist/credentials.js +0 -342
- package/dist/credentials.js.map +0 -1
- package/dist/file-lock.d.ts +0 -34
- package/dist/file-lock.js +0 -367
- package/dist/file-lock.js.map +0 -1
- package/dist/generated-session-label.d.ts +0 -2
- package/dist/generated-session-label.js +0 -152
- package/dist/generated-session-label.js.map +0 -1
- package/dist/guidance-content.d.ts +0 -53
- package/dist/guidance-content.js +0 -248
- package/dist/guidance-content.js.map +0 -1
- package/dist/guidance-render.d.ts +0 -25
- package/dist/guidance-render.js +0 -47
- package/dist/guidance-render.js.map +0 -1
- package/dist/guidance.d.ts +0 -69
- package/dist/guidance.js +0 -173
- package/dist/guidance.js.map +0 -1
- package/dist/harness-session-title.d.ts +0 -22
- package/dist/harness-session-title.js +0 -74
- package/dist/harness-session-title.js.map +0 -1
- package/dist/harnesses.d.ts +0 -65
- package/dist/harnesses.js +0 -159
- package/dist/harnesses.js.map +0 -1
- package/dist/hermes-attendant.d.ts +0 -38
- package/dist/hermes-attendant.js +0 -337
- package/dist/hermes-attendant.js.map +0 -1
- package/dist/hermes-plugin.d.ts +0 -11
- package/dist/hermes-plugin.js +0 -299
- package/dist/hermes-plugin.js.map +0 -1
- package/dist/hook-acknowledgements.d.ts +0 -70
- package/dist/hook-acknowledgements.js +0 -490
- package/dist/hook-acknowledgements.js.map +0 -1
- package/dist/hook-adapter.d.ts +0 -48
- package/dist/hook-adapter.js +0 -419
- package/dist/hook-adapter.js.map +0 -1
- package/dist/hook-events.d.ts +0 -105
- package/dist/hook-events.js +0 -130
- package/dist/hook-events.js.map +0 -1
- package/dist/hook-gates.d.ts +0 -7
- package/dist/hook-gates.js +0 -20
- package/dist/hook-gates.js.map +0 -1
- package/dist/hook-input.d.ts +0 -10
- package/dist/hook-input.js +0 -64
- package/dist/hook-input.js.map +0 -1
- package/dist/hook-lifecycle.d.ts +0 -112
- package/dist/hook-lifecycle.js +0 -2031
- package/dist/hook-lifecycle.js.map +0 -1
- package/dist/hook-project-sessions.d.ts +0 -28
- package/dist/hook-project-sessions.js +0 -141
- package/dist/hook-project-sessions.js.map +0 -1
- package/dist/hook-question-lock.d.ts +0 -29
- package/dist/hook-question-lock.js +0 -217
- package/dist/hook-question-lock.js.map +0 -1
- package/dist/hook-question-retirement.d.ts +0 -74
- package/dist/hook-question-retirement.js +0 -314
- package/dist/hook-question-retirement.js.map +0 -1
- package/dist/hook-question-state.d.ts +0 -58
- package/dist/hook-question-state.js +0 -239
- package/dist/hook-question-state.js.map +0 -1
- package/dist/hook-session-state.d.ts +0 -127
- package/dist/hook-session-state.js +0 -488
- package/dist/hook-session-state.js.map +0 -1
- package/dist/hook-types.d.ts +0 -476
- package/dist/hook-types.js +0 -4
- package/dist/hook-types.js.map +0 -1
- package/dist/injection-render.d.ts +0 -36
- package/dist/injection-render.js +0 -61
- package/dist/injection-render.js.map +0 -1
- package/dist/install-hooks.d.ts +0 -470
- package/dist/install-hooks.js +0 -1622
- package/dist/install-hooks.js.map +0 -1
- package/dist/integration-health.d.ts +0 -26
- package/dist/integration-health.js +0 -133
- package/dist/integration-health.js.map +0 -1
- package/dist/interactive.d.ts +0 -22
- package/dist/interactive.js +0 -644
- package/dist/interactive.js.map +0 -1
- package/dist/invocation-context.d.ts +0 -47
- package/dist/invocation-context.js +0 -164
- package/dist/invocation-context.js.map +0 -1
- package/dist/local-path.d.ts +0 -7
- package/dist/local-path.js +0 -27
- package/dist/local-path.js.map +0 -1
- package/dist/logging.d.ts +0 -157
- package/dist/logging.js +0 -599
- package/dist/logging.js.map +0 -1
- package/dist/main-run.d.ts +0 -1
- package/dist/main-run.js +0 -42
- package/dist/main-run.js.map +0 -1
- package/dist/main.d.ts +0 -2
- package/dist/main.js +0 -12
- package/dist/main.js.map +0 -1
- package/dist/native-answer-operation.d.ts +0 -70
- package/dist/native-answer-operation.js +0 -247
- package/dist/native-answer-operation.js.map +0 -1
- package/dist/native-skills.d.ts +0 -64
- package/dist/native-skills.js +0 -167
- package/dist/native-skills.js.map +0 -1
- package/dist/node-floor.d.ts +0 -19
- package/dist/node-floor.js +0 -32
- package/dist/node-floor.js.map +0 -1
- package/dist/npm-invocation.d.ts +0 -34
- package/dist/npm-invocation.js +0 -53
- package/dist/npm-invocation.js.map +0 -1
- package/dist/openclaw-continuation-bridge.d.ts +0 -7
- package/dist/openclaw-continuation-bridge.js +0 -64
- package/dist/openclaw-continuation-bridge.js.map +0 -1
- package/dist/openclaw-gateway-readiness.d.ts +0 -1
- package/dist/openclaw-gateway-readiness.js +0 -24
- package/dist/openclaw-gateway-readiness.js.map +0 -1
- package/dist/openclaw-generation.d.ts +0 -21
- package/dist/openclaw-generation.js +0 -115
- package/dist/openclaw-generation.js.map +0 -1
- package/dist/openclaw-message-bridge.d.ts +0 -8
- package/dist/openclaw-message-bridge.js +0 -93
- package/dist/openclaw-message-bridge.js.map +0 -1
- package/dist/openclaw-pending.d.ts +0 -8
- package/dist/openclaw-pending.js +0 -47
- package/dist/openclaw-pending.js.map +0 -1
- package/dist/openclaw-plugin.d.ts +0 -75
- package/dist/openclaw-plugin.js +0 -1353
- package/dist/openclaw-plugin.js.map +0 -1
- package/dist/openclaw-session-access.d.ts +0 -12
- package/dist/openclaw-session-access.js +0 -79
- package/dist/openclaw-session-access.js.map +0 -1
- package/dist/opencode-plugin.d.ts +0 -88
- package/dist/opencode-plugin.js +0 -286
- package/dist/opencode-plugin.js.map +0 -1
- package/dist/orca-session-title.d.ts +0 -11
- package/dist/orca-session-title.js +0 -111
- package/dist/orca-session-title.js.map +0 -1
- package/dist/pack-feedback-slice.d.ts +0 -35
- package/dist/pack-feedback-slice.js +0 -126
- package/dist/pack-feedback-slice.js.map +0 -1
- package/dist/pairing-qr.d.ts +0 -5
- package/dist/pairing-qr.js +0 -24
- package/dist/pairing-qr.js.map +0 -1
- package/dist/pending-pairing.d.ts +0 -38
- package/dist/pending-pairing.js +0 -70
- package/dist/pending-pairing.js.map +0 -1
- package/dist/platform.d.ts +0 -67
- package/dist/platform.js +0 -140
- package/dist/platform.js.map +0 -1
- package/dist/process-identity.d.ts +0 -26
- package/dist/process-identity.js +0 -82
- package/dist/process-identity.js.map +0 -1
- package/dist/program.d.ts +0 -59
- package/dist/program.js +0 -691
- package/dist/program.js.map +0 -1
- package/dist/project-enablement.d.ts +0 -21
- package/dist/project-enablement.js +0 -71
- package/dist/project-enablement.js.map +0 -1
- package/dist/question-settlement-process.d.ts +0 -17
- package/dist/question-settlement-process.js +0 -35
- package/dist/question-settlement-process.js.map +0 -1
- package/dist/question-timing.d.ts +0 -46
- package/dist/question-timing.js +0 -48
- package/dist/question-timing.js.map +0 -1
- package/dist/readiness.d.ts +0 -153
- package/dist/readiness.js +0 -149
- package/dist/readiness.js.map +0 -1
- package/dist/release.d.ts +0 -31
- package/dist/release.js +0 -52
- package/dist/release.js.map +0 -1
- package/dist/send-attempts.d.ts +0 -26
- package/dist/send-attempts.js +0 -139
- package/dist/send-attempts.js.map +0 -1
- package/dist/send.d.ts +0 -115
- package/dist/send.js +0 -421
- package/dist/send.js.map +0 -1
- package/dist/session-activation.d.ts +0 -13
- package/dist/session-activation.js +0 -64
- package/dist/session-activation.js.map +0 -1
- package/dist/session-attendant-probe.d.ts +0 -85
- package/dist/session-attendant-probe.js +0 -173
- package/dist/session-attendant-probe.js.map +0 -1
- package/dist/session-attendant-state.d.ts +0 -70
- package/dist/session-attendant-state.js +0 -256
- package/dist/session-attendant-state.js.map +0 -1
- package/dist/session-attendant.d.ts +0 -143
- package/dist/session-attendant.js +0 -520
- package/dist/session-attendant.js.map +0 -1
- package/dist/session-delivery.d.ts +0 -249
- package/dist/session-delivery.js +0 -576
- package/dist/session-delivery.js.map +0 -1
- package/dist/session-handoff.d.ts +0 -98
- package/dist/session-handoff.js +0 -118
- package/dist/session-handoff.js.map +0 -1
- package/dist/session-input-wakes.d.ts +0 -78
- package/dist/session-input-wakes.js +0 -239
- package/dist/session-input-wakes.js.map +0 -1
- package/dist/session-inputs.d.ts +0 -57
- package/dist/session-inputs.js +0 -434
- package/dist/session-inputs.js.map +0 -1
- package/dist/session-labels.d.ts +0 -56
- package/dist/session-labels.js +0 -396
- package/dist/session-labels.js.map +0 -1
- package/dist/session-message-handoff.d.ts +0 -39
- package/dist/session-message-handoff.js +0 -107
- package/dist/session-message-handoff.js.map +0 -1
- package/dist/setup-destinations.d.ts +0 -23
- package/dist/setup-destinations.js +0 -44
- package/dist/setup-destinations.js.map +0 -1
- package/dist/skill-integrity.d.ts +0 -54
- package/dist/skill-integrity.js +0 -164
- package/dist/skill-integrity.js.map +0 -1
- package/dist/skill-source/manifest.json +0 -40
- package/dist/skill-source/notifai/SKILL.md +0 -350
- package/dist/skill-source/notifai/references/diagnostics.md +0 -36
- package/dist/skill-source/notifai/references/harness-setup.md +0 -384
- package/dist/skill-source/notifai/references/native-questions.md +0 -51
- package/dist/skill-source/notifai/references/notes-and-edits.md +0 -54
- package/dist/skill-source/notifai/references/send-details.md +0 -14
- package/dist/skill-source/notifai/references/updates.md +0 -116
- package/dist/skill-source/notifai/references/writing-examples.md +0 -56
- package/dist/sound-ref.d.ts +0 -23
- package/dist/sound-ref.js +0 -28
- package/dist/sound-ref.js.map +0 -1
- package/dist/ui/banner.d.ts +0 -22
- package/dist/ui/banner.js +0 -87
- package/dist/ui/banner.js.map +0 -1
- package/dist/ui/config-view.d.ts +0 -30
- package/dist/ui/config-view.js +0 -108
- package/dist/ui/config-view.js.map +0 -1
- package/dist/ui/help.d.ts +0 -44
- package/dist/ui/help.js +0 -107
- package/dist/ui/help.js.map +0 -1
- package/dist/ui/theme.d.ts +0 -90
- package/dist/ui/theme.js +0 -244
- package/dist/ui/theme.js.map +0 -1
- package/dist/update-handoff.d.ts +0 -29
- package/dist/update-handoff.js +0 -69
- package/dist/update-handoff.js.map +0 -1
- package/dist/url-policy.d.ts +0 -85
- package/dist/url-policy.js +0 -369
- package/dist/url-policy.js.map +0 -1
- package/dist/version.d.ts +0 -40
- package/dist/version.js +0 -132
- package/dist/version.js.map +0 -1
- package/dist/wake-support.d.ts +0 -40
- package/dist/wake-support.js +0 -95
- package/dist/wake-support.js.map +0 -1
package/dist/url-policy.js
DELETED
|
@@ -1,369 +0,0 @@
|
|
|
1
|
-
import { lookup as dnsLookup } from 'node:dns/promises';
|
|
2
|
-
import { request as httpRequest } from 'node:http';
|
|
3
|
-
import { request as httpsRequest } from 'node:https';
|
|
4
|
-
import { BlockList, isIP } from 'node:net';
|
|
5
|
-
import { Readable } from 'node:stream';
|
|
6
|
-
/**
|
|
7
|
-
* The URL trust policy: which network destinations this CLI will touch on
|
|
8
|
-
* input it did not author. `docs/TRUST.md` is the written policy; this module
|
|
9
|
-
* is its enforcement, and the two must change together.
|
|
10
|
-
*
|
|
11
|
-
* The threat is not a hostile user — it is hostile *input* reaching a
|
|
12
|
-
* trusted user's CLI: a cloned repository, a compromised server response, or
|
|
13
|
-
* an agent following text it found in a working tree. Every rule here is
|
|
14
|
-
* therefore fail-closed, and every escape hatch resolves only from
|
|
15
|
-
* configuration layers the User owns — never from a repository.
|
|
16
|
-
*/
|
|
17
|
-
/** The one dashboard origin the shipped service uses for pairing approval. */
|
|
18
|
-
export const CANONICAL_DASHBOARD_ORIGIN = 'https://app.notifai.sh';
|
|
19
|
-
/** Redirect hops a remote image fetch may follow, each re-validated. */
|
|
20
|
-
export const MEDIA_REDIRECT_LIMIT = 3;
|
|
21
|
-
/** One address attempt must not hold an agent command indefinitely. */
|
|
22
|
-
export const MEDIA_FETCH_TIMEOUT_MS = 15_000;
|
|
23
|
-
/**
|
|
24
|
-
* Normalize one configured origin entry to `scheme://host[:port]`, or null
|
|
25
|
-
* when the entry is not a bare http(s) origin. Paths, queries, fragments, and
|
|
26
|
-
* userinfo are rejected rather than stripped: a config entry that carries
|
|
27
|
-
* them says the author expected them to matter, and silently ignoring parts
|
|
28
|
-
* of a trust rule is how allowlists rot.
|
|
29
|
-
*/
|
|
30
|
-
export function normalizeOrigin(entry) {
|
|
31
|
-
let url;
|
|
32
|
-
try {
|
|
33
|
-
url = new URL(entry);
|
|
34
|
-
}
|
|
35
|
-
catch {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
if (url.protocol !== 'https:' && url.protocol !== 'http:')
|
|
39
|
-
return null;
|
|
40
|
-
if (url.username !== '' || url.password !== '')
|
|
41
|
-
return null;
|
|
42
|
-
if (url.pathname !== '/' || url.search !== '' || url.hash !== '')
|
|
43
|
-
return null;
|
|
44
|
-
// `https://*.example` parses, and would then match exactly one impossible
|
|
45
|
-
// host while reading like a wildcard. Refusing it is how someone finds out
|
|
46
|
-
// that origins are exact before they trust one that never matches.
|
|
47
|
-
if (!/^(?:[a-z0-9-]+(?:\.[a-z0-9-]+)*|\[[0-9a-f:.]+\])$/i.test(url.hostname))
|
|
48
|
-
return null;
|
|
49
|
-
return url.origin;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Addresses that are not publicly routable: loopback, RFC 1918, link-local
|
|
53
|
-
* (including cloud metadata at 169.254.169.254), CGNAT, benchmark,
|
|
54
|
-
* documentation, multicast, and reserved space; for IPv6 also unspecified,
|
|
55
|
-
* unique-local, site-local, and discard prefixes. IPv4-mapped IPv6 addresses
|
|
56
|
-
* are classified as the IPv4 address they carry.
|
|
57
|
-
*/
|
|
58
|
-
const NON_PUBLIC = new BlockList();
|
|
59
|
-
const PUBLIC_IPV6 = new BlockList();
|
|
60
|
-
PUBLIC_IPV6.addSubnet('2000::', 3, 'ipv6');
|
|
61
|
-
for (const [subnet, prefix] of [
|
|
62
|
-
['0.0.0.0', 8],
|
|
63
|
-
['10.0.0.0', 8],
|
|
64
|
-
['100.64.0.0', 10],
|
|
65
|
-
['127.0.0.0', 8],
|
|
66
|
-
['169.254.0.0', 16],
|
|
67
|
-
['172.16.0.0', 12],
|
|
68
|
-
['192.0.0.0', 24],
|
|
69
|
-
['192.0.2.0', 24],
|
|
70
|
-
['192.88.99.0', 24],
|
|
71
|
-
['192.168.0.0', 16],
|
|
72
|
-
['198.18.0.0', 15],
|
|
73
|
-
['198.51.100.0', 24],
|
|
74
|
-
['203.0.113.0', 24],
|
|
75
|
-
['224.0.0.0', 4],
|
|
76
|
-
['240.0.0.0', 4],
|
|
77
|
-
]) {
|
|
78
|
-
NON_PUBLIC.addSubnet(subnet, prefix, 'ipv4');
|
|
79
|
-
}
|
|
80
|
-
for (const [subnet, prefix] of [
|
|
81
|
-
['::', 128],
|
|
82
|
-
['::1', 128],
|
|
83
|
-
['64:ff9b::', 96], // NAT64 — fail closed rather than trust the embedded address
|
|
84
|
-
['64:ff9b:1::', 48],
|
|
85
|
-
['100::', 64],
|
|
86
|
-
['2001::', 32], // Teredo embeds an IPv4 destination
|
|
87
|
-
['2001:2::', 48],
|
|
88
|
-
['2001:10::', 28],
|
|
89
|
-
['2001:20::', 28],
|
|
90
|
-
['2001:db8::', 32],
|
|
91
|
-
['2002::', 16], // 6to4 embeds an IPv4 address; fail closed
|
|
92
|
-
['3fff::', 20],
|
|
93
|
-
['fc00::', 7],
|
|
94
|
-
['fe80::', 10],
|
|
95
|
-
['fec0::', 10],
|
|
96
|
-
['ff00::', 8],
|
|
97
|
-
// Deliberately no `::ffff:0:0/96` rule: Node checks an IPv4 address against
|
|
98
|
-
// IPv6 rules through its own IPv4-mapped form, so that entry would classify
|
|
99
|
-
// every address on the internet as private. `mappedIpv4` handles the mapped
|
|
100
|
-
// spellings instead.
|
|
101
|
-
]) {
|
|
102
|
-
NON_PUBLIC.addSubnet(subnet, prefix, 'ipv6');
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* The IPv4 address an IPv4-mapped IPv6 address carries, in either spelling:
|
|
106
|
-
* `::ffff:127.0.0.1` and `::ffff:7f00:1` are the same address, and only the
|
|
107
|
-
* first would survive being classified as IPv6.
|
|
108
|
-
*/
|
|
109
|
-
function mappedIpv4(address) {
|
|
110
|
-
const lower = address.toLowerCase();
|
|
111
|
-
if (!lower.startsWith('::ffff:'))
|
|
112
|
-
return null;
|
|
113
|
-
const rest = lower.slice('::ffff:'.length);
|
|
114
|
-
if (isIP(rest) === 4)
|
|
115
|
-
return rest;
|
|
116
|
-
const hex = /^([0-9a-f]{1,4}):([0-9a-f]{1,4})$/.exec(rest);
|
|
117
|
-
if (hex === null)
|
|
118
|
-
return null;
|
|
119
|
-
const high = Number.parseInt(hex[1], 16);
|
|
120
|
-
const low = Number.parseInt(hex[2], 16);
|
|
121
|
-
return `${high >> 8}.${high & 0xff}.${low >> 8}.${low & 0xff}`;
|
|
122
|
-
}
|
|
123
|
-
/** Whether one IP literal is publicly routable. */
|
|
124
|
-
export function isPublicAddress(address) {
|
|
125
|
-
const candidate = mappedIpv4(address) ?? address;
|
|
126
|
-
const family = isIP(candidate);
|
|
127
|
-
if (family === 0)
|
|
128
|
-
return false;
|
|
129
|
-
// Fail closed outside the currently allocated global-unicast block. This
|
|
130
|
-
// catches reserved IPv6 space without depending on an inevitably stale
|
|
131
|
-
// enumeration; explicit exclusions below then carve special-use prefixes
|
|
132
|
-
// out of global unicast itself.
|
|
133
|
-
if (family === 6 && !PUBLIC_IPV6.check(candidate, 'ipv6'))
|
|
134
|
-
return false;
|
|
135
|
-
return !NON_PUBLIC.check(candidate, family === 6 ? 'ipv6' : 'ipv4');
|
|
136
|
-
}
|
|
137
|
-
/** A URL hostname as an address-or-name: IPv6 hosts arrive bracketed. */
|
|
138
|
-
function hostnameAddress(hostname) {
|
|
139
|
-
return hostname.startsWith('[') && hostname.endsWith(']')
|
|
140
|
-
? hostname.slice(1, -1)
|
|
141
|
-
: hostname;
|
|
142
|
-
}
|
|
143
|
-
export function isLoopbackHostname(hostname) {
|
|
144
|
-
const host = hostnameAddress(hostname).toLowerCase();
|
|
145
|
-
if (host === 'localhost' || host.endsWith('.localhost'))
|
|
146
|
-
return true;
|
|
147
|
-
const family = isIP(host);
|
|
148
|
-
if (family === 4)
|
|
149
|
-
return host.startsWith('127.');
|
|
150
|
-
if (family === 6)
|
|
151
|
-
return host === '::1' || /^::ffff:127\./.test(host);
|
|
152
|
-
return false;
|
|
153
|
-
}
|
|
154
|
-
async function resolveAddresses(hostname, policy) {
|
|
155
|
-
if (policy.lookup !== undefined) {
|
|
156
|
-
try {
|
|
157
|
-
return await policy.lookup(hostname);
|
|
158
|
-
}
|
|
159
|
-
catch {
|
|
160
|
-
return null;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
try {
|
|
164
|
-
const results = await dnsLookup(hostname, { all: true, verbatim: true });
|
|
165
|
-
return results.map((entry) => entry.address);
|
|
166
|
-
}
|
|
167
|
-
catch {
|
|
168
|
-
return null;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Whether one URL is a destination remote media may be fetched from.
|
|
173
|
-
*
|
|
174
|
-
* Default policy: `https` to a host every resolved address of which is
|
|
175
|
-
* publicly routable. A User-allowed origin skips the scheme and address
|
|
176
|
-
* checks — the User said that exact origin is theirs to trust — but nothing
|
|
177
|
-
* skips the userinfo refusal, and every redirect hop is checked again.
|
|
178
|
-
*
|
|
179
|
-
* The approved addresses come back with the verdict rather than being
|
|
180
|
-
* rediscovered later: `fetchMediaUrl` connects to one of exactly these, so a
|
|
181
|
-
* resolver that would answer differently on a second lookup cannot rebind the
|
|
182
|
-
* request onto a private address between the check and the connection.
|
|
183
|
-
*/
|
|
184
|
-
export async function checkMediaUrl(target, policy) {
|
|
185
|
-
if (target.username !== '' || target.password !== '') {
|
|
186
|
-
return { ok: false, reason: 'Image URLs with embedded credentials are never fetched.' };
|
|
187
|
-
}
|
|
188
|
-
if (target.protocol !== 'https:' && target.protocol !== 'http:') {
|
|
189
|
-
return { ok: false, reason: `Only http(s) image URLs are supported, not ${target.protocol.replace(/:$/, '')}.` };
|
|
190
|
-
}
|
|
191
|
-
const userAllowed = policy.allowOrigins.includes(target.origin);
|
|
192
|
-
const escapeHatch = 'Remote images use public HTTPS; for a self-hosted or intranet image server, allow its exact origin with `notifai config set media_origins <origin>`.';
|
|
193
|
-
if (!userAllowed && target.protocol !== 'https:') {
|
|
194
|
-
return { ok: false, reason: `${target.origin} is http. ${escapeHatch}` };
|
|
195
|
-
}
|
|
196
|
-
const literal = hostnameAddress(target.hostname);
|
|
197
|
-
if (isIP(literal) !== 0) {
|
|
198
|
-
return userAllowed || isPublicAddress(literal)
|
|
199
|
-
? { ok: true, addresses: [literal] }
|
|
200
|
-
: { ok: false, reason: `${target.hostname} is not a public address. ${escapeHatch}` };
|
|
201
|
-
}
|
|
202
|
-
const addresses = await resolveAddresses(target.hostname, policy);
|
|
203
|
-
if (addresses === null || addresses.length === 0) {
|
|
204
|
-
return { ok: false, reason: `Could not resolve ${target.hostname}.` };
|
|
205
|
-
}
|
|
206
|
-
if (addresses.some((address) => isIP(address) === 0)) {
|
|
207
|
-
return { ok: false, reason: `${target.hostname} resolved to an invalid address.` };
|
|
208
|
-
}
|
|
209
|
-
if (!userAllowed && !addresses.every((address) => isPublicAddress(address))) {
|
|
210
|
-
return { ok: false, reason: `${target.hostname} resolves to a non-public address. ${escapeHatch}` };
|
|
211
|
-
}
|
|
212
|
-
return { ok: true, addresses };
|
|
213
|
-
}
|
|
214
|
-
const REDIRECT_STATUSES = new Set([301, 302, 303, 307, 308]);
|
|
215
|
-
function responseHeaders(response) {
|
|
216
|
-
const headers = new Headers();
|
|
217
|
-
for (const [name, value] of Object.entries(response.headers)) {
|
|
218
|
-
if (Array.isArray(value)) {
|
|
219
|
-
for (const entry of value)
|
|
220
|
-
headers.append(name, entry);
|
|
221
|
-
}
|
|
222
|
-
else if (value !== undefined) {
|
|
223
|
-
headers.set(name, value);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
return headers;
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Fetch through one already-vetted address while retaining the URL hostname
|
|
230
|
-
* for Host and TLS verification. This closes the DNS-rebinding gap between
|
|
231
|
-
* policy resolution and the connection: the request cannot resolve the name
|
|
232
|
-
* a second time to a private address.
|
|
233
|
-
*/
|
|
234
|
-
async function fetchPinned(target, addresses) {
|
|
235
|
-
let lastError = new Error(`No address was available for ${target.hostname}.`);
|
|
236
|
-
for (const address of addresses) {
|
|
237
|
-
try {
|
|
238
|
-
return await new Promise((resolve, reject) => {
|
|
239
|
-
const family = isIP(address);
|
|
240
|
-
const request = (target.protocol === 'https:' ? httpsRequest : httpRequest)(target, {
|
|
241
|
-
method: 'GET',
|
|
242
|
-
headers: { 'accept-encoding': 'identity' },
|
|
243
|
-
signal: AbortSignal.timeout(MEDIA_FETCH_TIMEOUT_MS),
|
|
244
|
-
// Node asks for every address at once when it is racing address
|
|
245
|
-
// families, and for a single one otherwise. Answering in the wrong
|
|
246
|
-
// shape throws inside the connect path rather than failing the
|
|
247
|
-
// request, so both forms are answered explicitly.
|
|
248
|
-
lookup: (_hostname, options, callback) => {
|
|
249
|
-
if (options.all === true) {
|
|
250
|
-
callback(null, [{ address, family }]);
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
callback(null, address, family);
|
|
254
|
-
},
|
|
255
|
-
}, (incoming) => {
|
|
256
|
-
const status = incoming.statusCode ?? 500;
|
|
257
|
-
const hasBody = ![101, 204, 205, 304].includes(status);
|
|
258
|
-
const body = hasBody
|
|
259
|
-
? Readable.toWeb(incoming)
|
|
260
|
-
: null;
|
|
261
|
-
resolve(new Response(body, {
|
|
262
|
-
status,
|
|
263
|
-
...(incoming.statusMessage === undefined
|
|
264
|
-
? {}
|
|
265
|
-
: { statusText: incoming.statusMessage }),
|
|
266
|
-
headers: responseHeaders(incoming),
|
|
267
|
-
}));
|
|
268
|
-
});
|
|
269
|
-
request.once('error', reject);
|
|
270
|
-
request.end();
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
catch (error) {
|
|
274
|
-
lastError = error;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
throw lastError;
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Fetch a remote image under the media URL policy, following at most
|
|
281
|
-
* `MEDIA_REDIRECT_LIMIT` redirects and re-validating every hop — a public
|
|
282
|
-
* HTTPS URL redirecting into an intranet is the exact attack the per-hop
|
|
283
|
-
* check exists for.
|
|
284
|
-
*/
|
|
285
|
-
export async function fetchMediaUrl(source, policy, fetchImpl) {
|
|
286
|
-
let target;
|
|
287
|
-
try {
|
|
288
|
-
target = new URL(source);
|
|
289
|
-
}
|
|
290
|
-
catch {
|
|
291
|
-
return { ok: false, reason: `"${source}" is not a valid URL.` };
|
|
292
|
-
}
|
|
293
|
-
for (let hop = 0;; hop += 1) {
|
|
294
|
-
const allowed = await checkMediaUrl(target, policy);
|
|
295
|
-
if (!allowed.ok)
|
|
296
|
-
return allowed;
|
|
297
|
-
const response = fetchImpl === undefined
|
|
298
|
-
? await fetchPinned(target, allowed.addresses)
|
|
299
|
-
: await fetchImpl(target, { redirect: 'manual' });
|
|
300
|
-
if (!REDIRECT_STATUSES.has(response.status))
|
|
301
|
-
return { ok: true, response };
|
|
302
|
-
const location = response.headers.get('location');
|
|
303
|
-
await response.body?.cancel();
|
|
304
|
-
if (location === null) {
|
|
305
|
-
return { ok: false, reason: `${target.origin} redirected without a destination.` };
|
|
306
|
-
}
|
|
307
|
-
if (hop >= MEDIA_REDIRECT_LIMIT) {
|
|
308
|
-
return { ok: false, reason: `${source} redirected more than ${MEDIA_REDIRECT_LIMIT} times.` };
|
|
309
|
-
}
|
|
310
|
-
try {
|
|
311
|
-
target = new URL(location, target);
|
|
312
|
-
}
|
|
313
|
-
catch {
|
|
314
|
-
return { ok: false, reason: `${target.origin} redirected to an invalid URL.` };
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Whether a server-supplied pairing approval URL may be shown and opened.
|
|
320
|
-
*
|
|
321
|
-
* The server chooses `approve_url`, so a compromised or misconfigured one
|
|
322
|
-
* must not be able to drive this machine's browser to an arbitrary
|
|
323
|
-
* destination. Allowed: the canonical dashboard, the exact origin the user
|
|
324
|
-
* pointed this pairing at, loopback for local development, and origins the
|
|
325
|
-
* User allowed (`approve_origins`) for a self-host whose dashboard lives on
|
|
326
|
-
* a different origin than its API.
|
|
327
|
-
*/
|
|
328
|
-
export function checkApproveUrl(raw, baseUrl, allowOrigins) {
|
|
329
|
-
let target;
|
|
330
|
-
try {
|
|
331
|
-
target = new URL(raw);
|
|
332
|
-
}
|
|
333
|
-
catch {
|
|
334
|
-
return { ok: false, reason: `the server sent an invalid approval URL.` };
|
|
335
|
-
}
|
|
336
|
-
if (target.protocol !== 'https:' && target.protocol !== 'http:') {
|
|
337
|
-
return {
|
|
338
|
-
ok: false,
|
|
339
|
-
reason: `the server sent a ${target.protocol.replace(/:$/, '')} approval URL; only http(s) is ever opened.`,
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
if (target.username !== '' || target.password !== '') {
|
|
343
|
-
return { ok: false, reason: 'the server sent an approval URL with embedded credentials.' };
|
|
344
|
-
}
|
|
345
|
-
if (target.origin === CANONICAL_DASHBOARD_ORIGIN)
|
|
346
|
-
return { ok: true };
|
|
347
|
-
if (isLoopbackHostname(target.hostname))
|
|
348
|
-
return { ok: true };
|
|
349
|
-
let pairingOrigin = null;
|
|
350
|
-
try {
|
|
351
|
-
pairingOrigin = new URL(baseUrl).origin;
|
|
352
|
-
}
|
|
353
|
-
catch {
|
|
354
|
-
pairingOrigin = null;
|
|
355
|
-
}
|
|
356
|
-
if (allowOrigins.includes(target.origin))
|
|
357
|
-
return { ok: true };
|
|
358
|
-
if (pairingOrigin !== null &&
|
|
359
|
-
target.origin === pairingOrigin &&
|
|
360
|
-
target.protocol === 'https:') {
|
|
361
|
-
return { ok: true };
|
|
362
|
-
}
|
|
363
|
-
return {
|
|
364
|
-
ok: false,
|
|
365
|
-
reason: `the server sent an approval URL on ${target.origin}, which is not the Notifai dashboard, ` +
|
|
366
|
-
'the origin being paired with, loopback, or an origin in `approve_origins`.',
|
|
367
|
-
};
|
|
368
|
-
}
|
|
369
|
-
//# sourceMappingURL=url-policy.js.map
|
package/dist/url-policy.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"url-policy.js","sourceRoot":"","sources":["../src/url-policy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAwB,MAAM,WAAW,CAAA;AACxE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC;;;;;;;;;;GAUG;AAEH,8EAA8E;AAC9E,MAAM,CAAC,MAAM,0BAA0B,GAAG,wBAAwB,CAAA;AAElE,wEAAwE;AACxE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAA;AAErC,uEAAuE;AACvE,MAAM,C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,CAAA;IACzC,CAAC;IAAC,MAAM,CAAC;QACP,aAAa,GAAG,IAAI,CAAA;IACtB,CAAC;IACD,IAAI,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAA;IAC7D,IACE,aAAa,KAAK,IAAI;QACtB,MAAM,CAAC,MAAM,KAAK,aAAa;QAC/B,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAC5B,CAAC;QACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAA;IACrB,CAAC;IACD,OAAO;QACL,EAAE,EAAE,KAAK;QACT,MAAM,EACJ,sCAAsC,MAAM,CAAC,MAAM,wCAAwC;YAC3F,4EAA4E;KAC/E,CAAA;AACH,CAAC"}
|
package/dist/version.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/** @typedef {'before' | 'equal' | 'after' | 'unparseable'} VersionComparison */
|
|
2
|
-
/**
|
|
3
|
-
* The numeric release identity shared by CLI, harness, and runtime checks.
|
|
4
|
-
* Pre-release/build suffixes identify artifacts but do not change capability
|
|
5
|
-
* floors, matching the version comparisons these callers previously owned.
|
|
6
|
-
*
|
|
7
|
-
* @param {string} value
|
|
8
|
-
* @returns {readonly [number, number, number] | null}
|
|
9
|
-
*/
|
|
10
|
-
export function parseVersion(value: string): readonly [number, number, number] | null;
|
|
11
|
-
/**
|
|
12
|
-
* Compare two release identities without silently treating malformed input as
|
|
13
|
-
* zero. Every caller must choose its own safe posture for `unparseable`.
|
|
14
|
-
*
|
|
15
|
-
* @param {string} left
|
|
16
|
-
* @param {string} right
|
|
17
|
-
* @returns {VersionComparison}
|
|
18
|
-
*/
|
|
19
|
-
export function compareVersions(left: string, right: string): VersionComparison;
|
|
20
|
-
/** @param {string} value */
|
|
21
|
-
export function isSemVer(value: string): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Order two published releases by full SemVer 2.0.0 precedence: a prerelease
|
|
24
|
-
* sorts before its stable release (`1.0.0-beta.2` < `1.0.0`), and build
|
|
25
|
-
* metadata is ignored. Use this for release ordering only; capability floors
|
|
26
|
-
* keep `compareVersions`. Anything that is not strict SemVer is `unparseable`
|
|
27
|
-
* and the caller chooses its safe posture.
|
|
28
|
-
*
|
|
29
|
-
* @param {string} left
|
|
30
|
-
* @param {string} right
|
|
31
|
-
* @returns {VersionComparison}
|
|
32
|
-
*/
|
|
33
|
-
export function compareReleasePrecedence(left: string, right: string): VersionComparison;
|
|
34
|
-
/**
|
|
35
|
-
* Whether a strict SemVer release carries a prerelease, such as a beta.
|
|
36
|
-
*
|
|
37
|
-
* @param {string} value
|
|
38
|
-
*/
|
|
39
|
-
export function isPrerelease(value: string): boolean;
|
|
40
|
-
export type VersionComparison = "before" | "equal" | "after" | "unparseable";
|
package/dist/version.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
const SEMVER = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
|
|
2
|
-
const NUMERIC_IDENTIFIER = /^\d+$/;
|
|
3
|
-
const ORDERED_VERSION = /^v?(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/;
|
|
4
|
-
/** @typedef {'before' | 'equal' | 'after' | 'unparseable'} VersionComparison */
|
|
5
|
-
/**
|
|
6
|
-
* The numeric release identity shared by CLI, harness, and runtime checks.
|
|
7
|
-
* Pre-release/build suffixes identify artifacts but do not change capability
|
|
8
|
-
* floors, matching the version comparisons these callers previously owned.
|
|
9
|
-
*
|
|
10
|
-
* @param {string} value
|
|
11
|
-
* @returns {readonly [number, number, number] | null}
|
|
12
|
-
*/
|
|
13
|
-
export function parseVersion(value) {
|
|
14
|
-
const match = ORDERED_VERSION.exec(value);
|
|
15
|
-
if (match === null)
|
|
16
|
-
return null;
|
|
17
|
-
const parsed = /** @type {readonly [number, number, number]} */ ([
|
|
18
|
-
Number(match[1]),
|
|
19
|
-
Number(match[2]),
|
|
20
|
-
Number(match[3]),
|
|
21
|
-
]);
|
|
22
|
-
return parsed.every(Number.isSafeInteger) ? parsed : null;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Compare two release identities without silently treating malformed input as
|
|
26
|
-
* zero. Every caller must choose its own safe posture for `unparseable`.
|
|
27
|
-
*
|
|
28
|
-
* @param {string} left
|
|
29
|
-
* @param {string} right
|
|
30
|
-
* @returns {VersionComparison}
|
|
31
|
-
*/
|
|
32
|
-
export function compareVersions(left, right) {
|
|
33
|
-
const a = parseVersion(left);
|
|
34
|
-
const b = parseVersion(right);
|
|
35
|
-
if (a === null || b === null)
|
|
36
|
-
return 'unparseable';
|
|
37
|
-
for (let index = 0; index < a.length; index += 1) {
|
|
38
|
-
const leftPart = a[index];
|
|
39
|
-
const rightPart = b[index];
|
|
40
|
-
if (leftPart === undefined || rightPart === undefined)
|
|
41
|
-
return 'unparseable';
|
|
42
|
-
if (leftPart === rightPart)
|
|
43
|
-
continue;
|
|
44
|
-
return leftPart < rightPart ? 'before' : 'after';
|
|
45
|
-
}
|
|
46
|
-
return 'equal';
|
|
47
|
-
}
|
|
48
|
-
/** @param {string} value */
|
|
49
|
-
export function isSemVer(value) {
|
|
50
|
-
return SEMVER.test(value);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Order digit strings without leading zeros (SemVer forbids them), so values
|
|
54
|
-
* beyond Number.MAX_SAFE_INTEGER still compare exactly.
|
|
55
|
-
*
|
|
56
|
-
* @param {string} left
|
|
57
|
-
* @param {string} right
|
|
58
|
-
* @returns {-1 | 0 | 1}
|
|
59
|
-
*/
|
|
60
|
-
function compareDigits(left, right) {
|
|
61
|
-
if (left.length !== right.length)
|
|
62
|
-
return left.length < right.length ? -1 : 1;
|
|
63
|
-
return left === right ? 0 : left < right ? -1 : 1;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* SemVer 2.0.0 section 11: numeric identifiers compare numerically and rank
|
|
67
|
-
* below alphanumeric ones; a longer list wins when every shared field is equal.
|
|
68
|
-
*
|
|
69
|
-
* @param {readonly string[]} left
|
|
70
|
-
* @param {readonly string[]} right
|
|
71
|
-
* @returns {-1 | 0 | 1}
|
|
72
|
-
*/
|
|
73
|
-
function comparePrerelease(left, right) {
|
|
74
|
-
for (let index = 0; index < Math.max(left.length, right.length); index += 1) {
|
|
75
|
-
const a = left[index];
|
|
76
|
-
const b = right[index];
|
|
77
|
-
if (a === undefined)
|
|
78
|
-
return -1;
|
|
79
|
-
if (b === undefined)
|
|
80
|
-
return 1;
|
|
81
|
-
const aNumeric = NUMERIC_IDENTIFIER.test(a);
|
|
82
|
-
const bNumeric = NUMERIC_IDENTIFIER.test(b);
|
|
83
|
-
const order = aNumeric && bNumeric
|
|
84
|
-
? compareDigits(a, b)
|
|
85
|
-
: aNumeric !== bNumeric
|
|
86
|
-
? (aNumeric ? -1 : 1)
|
|
87
|
-
: a === b ? 0 : a < b ? -1 : 1;
|
|
88
|
-
if (order !== 0)
|
|
89
|
-
return order;
|
|
90
|
-
}
|
|
91
|
-
return 0;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Order two published releases by full SemVer 2.0.0 precedence: a prerelease
|
|
95
|
-
* sorts before its stable release (`1.0.0-beta.2` < `1.0.0`), and build
|
|
96
|
-
* metadata is ignored. Use this for release ordering only; capability floors
|
|
97
|
-
* keep `compareVersions`. Anything that is not strict SemVer is `unparseable`
|
|
98
|
-
* and the caller chooses its safe posture.
|
|
99
|
-
*
|
|
100
|
-
* @param {string} left
|
|
101
|
-
* @param {string} right
|
|
102
|
-
* @returns {VersionComparison}
|
|
103
|
-
*/
|
|
104
|
-
export function compareReleasePrecedence(left, right) {
|
|
105
|
-
const a = SEMVER.exec(left);
|
|
106
|
-
const b = SEMVER.exec(right);
|
|
107
|
-
if (a === null || b === null)
|
|
108
|
-
return 'unparseable';
|
|
109
|
-
for (let index = 1; index <= 3; index += 1) {
|
|
110
|
-
const order = compareDigits(/** @type {string} */ (a[index]), /** @type {string} */ (b[index]));
|
|
111
|
-
if (order !== 0)
|
|
112
|
-
return order < 0 ? 'before' : 'after';
|
|
113
|
-
}
|
|
114
|
-
const aPrerelease = a[4];
|
|
115
|
-
const bPrerelease = b[4];
|
|
116
|
-
if (aPrerelease === undefined || bPrerelease === undefined) {
|
|
117
|
-
if (aPrerelease === bPrerelease)
|
|
118
|
-
return 'equal';
|
|
119
|
-
return aPrerelease === undefined ? 'after' : 'before';
|
|
120
|
-
}
|
|
121
|
-
const order = comparePrerelease(aPrerelease.split('.'), bPrerelease.split('.'));
|
|
122
|
-
return order === 0 ? 'equal' : order < 0 ? 'before' : 'after';
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Whether a strict SemVer release carries a prerelease, such as a beta.
|
|
126
|
-
*
|
|
127
|
-
* @param {string} value
|
|
128
|
-
*/
|
|
129
|
-
export function isPrerelease(value) {
|
|
130
|
-
return SEMVER.exec(value)?.[4] !== undefined;
|
|
131
|
-
}
|
|
132
|
-
//# sourceMappingURL=version.js.map
|
package/dist/version.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.js"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,mLAAmL,CAAA;AAClM,MAAM,kBAAkB,GAAG,OAAO,CAAA;AAClC,MAAM,eAAe,GAAG,oCAAoC,CAAA;AAE5D,gFAAgF;AAEhF;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,KAAK;IAChC,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACzC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAA;IAC/B,MAAM,MAAM,GAAG,gDA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EAAE,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;IAC/E,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAA;AAC/D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAK;IAChC,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,SAAS,CAAA;AAC9C,CAAC"}
|
package/dist/wake-support.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { DeliveryOutcome } from './hook-types.js';
|
|
2
|
-
export declare function holdForNextTurn(reason: string): DeliveryOutcome;
|
|
3
|
-
/** `log.reason` of a claimed write stopped at its boundary before any byte left. */
|
|
4
|
-
export declare const WRITE_ABORTED_REASON = "write-aborted";
|
|
5
|
-
export declare function abortedDelivery(): DeliveryOutcome;
|
|
6
|
-
/**
|
|
7
|
-
* The last check before a claimed write's first byte: a connected socket asks
|
|
8
|
-
* `writable()`, and a connection still pending after `remainingMs()` is
|
|
9
|
-
* abandoned. Either way nothing is written.
|
|
10
|
-
*/
|
|
11
|
-
export interface WriteGuard {
|
|
12
|
-
writable(): boolean;
|
|
13
|
-
remainingMs(): number;
|
|
14
|
-
}
|
|
15
|
-
/** Thrown when a guarded write was stopped before any byte left. */
|
|
16
|
-
export declare class WriteAbortedError extends Error {
|
|
17
|
-
}
|
|
18
|
-
export declare function cancelledDelivery(): DeliveryOutcome;
|
|
19
|
-
/**
|
|
20
|
-
* Run one harness child and preserve its diagnostic stderr on failure.
|
|
21
|
-
*
|
|
22
|
-
* With `onSpawn` the child is started in its own process group (its pid is
|
|
23
|
-
* the group id) and reported at once, so a writer can journal the whole group
|
|
24
|
-
* that might still write if the writer itself dies. It is still awaited.
|
|
25
|
-
*/
|
|
26
|
-
/** A subprocess writer was stopped at its deadline; it may already have written. */
|
|
27
|
-
export declare class WriteDeadlineError extends Error {
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Run one harness command to completion. With `onSpawn` it runs in its own
|
|
31
|
-
* process group (reported as soon as it exists). With `signal`, an abort
|
|
32
|
-
* SIGKILLs that whole group — or the child, without one — and rejects with
|
|
33
|
-
* `WriteDeadlineError` at once: nothing the command started keeps running.
|
|
34
|
-
*/
|
|
35
|
-
export declare function runWakeCommand(command: string, args: readonly string[], options?: {
|
|
36
|
-
cwd?: string;
|
|
37
|
-
env?: NodeJS.ProcessEnv;
|
|
38
|
-
onSpawn?: (pgid: number) => void;
|
|
39
|
-
signal?: AbortSignal;
|
|
40
|
-
}): Promise<string>;
|