@raidiant/notifai 11.7.1 → 12.0.0-beta.13
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 +57 -0
- package/NOTICE +16 -0
- package/THIRD_PARTY_NOTICES +725 -0
- package/bin/notifai.mjs +11420 -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/config.d.ts
DELETED
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { INTERRUPTION_LEVELS } from '@raidiant/notifai-protocol';
|
|
2
|
-
/**
|
|
3
|
-
* Layered configuration with provenance. Most specific wins:
|
|
4
|
-
*
|
|
5
|
-
* flag > session > project-local > project > machine-global > default
|
|
6
|
-
*
|
|
7
|
-
* `session` holds what the user told the agent in conversation ("stop
|
|
8
|
-
* notifying me for now"). It lives on disk keyed by harness session id rather
|
|
9
|
-
* than in the agent's context, because context is lost to compaction and a
|
|
10
|
-
* preference that evaporates mid-session is worse than none.
|
|
11
|
-
*
|
|
12
|
-
* `project-local` is a personal file under the user's config directory, keyed
|
|
13
|
-
* by the Project root so a checkout does not have to gitignore anything. Shared
|
|
14
|
-
* `.notifai/config.toml` stays in the tree for committed Project identity.
|
|
15
|
-
*
|
|
16
|
-
* `config show --explain` surfaces the winning layer per key.
|
|
17
|
-
*/
|
|
18
|
-
export type ConfigSource = 'flag' | 'env' | `session:${string}` | `project-local:${string}` | `project:${string}` | `global:${string}` | 'default';
|
|
19
|
-
export interface ResolvedValue<T> {
|
|
20
|
-
value: T;
|
|
21
|
-
source: ConfigSource;
|
|
22
|
-
}
|
|
23
|
-
type CliInterruptionLevel = (typeof INTERRUPTION_LEVELS)[number];
|
|
24
|
-
/**
|
|
25
|
-
* How much the local log records. Defined here rather than in `logging.ts`
|
|
26
|
-
* because it is a configuration vocabulary first — `logging.ts` reads config,
|
|
27
|
-
* so the dependency has to point this way.
|
|
28
|
-
*/
|
|
29
|
-
export declare const LOG_LEVELS: readonly ["off", "error", "info", "debug"];
|
|
30
|
-
export type LogLevel = (typeof LOG_LEVELS)[number];
|
|
31
|
-
export interface CliConfig {
|
|
32
|
-
base_url: ResolvedValue<string>;
|
|
33
|
-
wait_seconds: ResolvedValue<number>;
|
|
34
|
-
ttl_seconds: ResolvedValue<number>;
|
|
35
|
-
collapse_key: ResolvedValue<string | null>;
|
|
36
|
-
devices: ResolvedValue<string[] | null>;
|
|
37
|
-
sound: ResolvedValue<string | null>;
|
|
38
|
-
interruption_level: ResolvedValue<CliInterruptionLevel | null>;
|
|
39
|
-
/** Project identifier stamped on sends; inferred unless explicitly shared in .notifai/config.toml. */
|
|
40
|
-
project: ResolvedValue<string | null>;
|
|
41
|
-
/** Whether a registered agent question may reach companion devices at all. */
|
|
42
|
-
ask_notifications: ResolvedValue<boolean>;
|
|
43
|
-
/**
|
|
44
|
-
* Terminal-first grace window, measured from the moment the question was
|
|
45
|
-
* sent: the agent asks in the terminal and starts a timer, and only once it
|
|
46
|
-
* elapses does the question reach companion devices.
|
|
47
|
-
*
|
|
48
|
-
* A timer, and only a timer. Whether the user happens to be at this keyboard
|
|
49
|
-
* decides nothing; the harness-specific owner continues waiting either in
|
|
50
|
-
* the held turn or out of band.
|
|
51
|
-
*/
|
|
52
|
-
ask_grace_seconds: ResolvedValue<number>;
|
|
53
|
-
/**
|
|
54
|
-
* How much of what this CLI does is recorded to the local log.
|
|
55
|
-
*
|
|
56
|
-
* The log exists for agents: a hook runs headless and its most consequential
|
|
57
|
-
* act is usually a decision to do nothing, which leaves no other trace. `off`
|
|
58
|
-
* disables the sink entirely; `debug` adds config resolution and request
|
|
59
|
-
* detail, which is verbose enough to want a reason.
|
|
60
|
-
*/
|
|
61
|
-
log_level: ResolvedValue<LogLevel>;
|
|
62
|
-
/**
|
|
63
|
-
* Bytes the active log file may reach before it is rotated. With
|
|
64
|
-
* `log_max_files` this is the whole disk budget — nothing here grows without
|
|
65
|
-
* a ceiling, because a log that fills a disk is a bug that outlives its
|
|
66
|
-
* usefulness.
|
|
67
|
-
*/
|
|
68
|
-
log_max_bytes: ResolvedValue<number>;
|
|
69
|
-
/** How long the server accepts an answer and Question Routing owns its return path. */
|
|
70
|
-
reply_window_seconds: ResolvedValue<number>;
|
|
71
|
-
/** Log files kept in total, the active one included. */
|
|
72
|
-
log_max_files: ResolvedValue<number>;
|
|
73
|
-
/**
|
|
74
|
-
* Extra origins remote `--image` URLs may use beyond the default public
|
|
75
|
-
* HTTPS policy — the self-host and intranet escape hatch. User-owned: the
|
|
76
|
-
* repository layer cannot supply it (see `USER_OWNED_CONFIG_KEYS`).
|
|
77
|
-
*/
|
|
78
|
-
media_origins: ResolvedValue<string[]>;
|
|
79
|
-
/**
|
|
80
|
-
* Extra dashboard origins a pairing approval URL may open, for self-hosts
|
|
81
|
-
* whose dashboard lives on a different origin than the API. User-owned.
|
|
82
|
-
*/
|
|
83
|
-
approve_origins: ResolvedValue<string[]>;
|
|
84
|
-
}
|
|
85
|
-
export declare const CONFIG_KEYS: readonly ["wait_seconds", "ttl_seconds", "collapse_key", "devices", "sound", "interruption_level", "project", "ask_notifications", "ask_grace_seconds", "reply_window_seconds", "log_level", "log_max_bytes", "log_max_files", "media_origins", "approve_origins"];
|
|
86
|
-
export type ConfigKey = (typeof CONFIG_KEYS)[number];
|
|
87
|
-
/**
|
|
88
|
-
* Keys only the User may set. The shared `.notifai/config.toml` arrives with
|
|
89
|
-
* a clone, so for most keys an unwanted value is at worst a clamped nuisance —
|
|
90
|
-
* but these keys widen which network destinations this machine will touch,
|
|
91
|
-
* and a hostile repository must not be able to widen them. Resolution skips
|
|
92
|
-
* the repository layer for them entirely.
|
|
93
|
-
*/
|
|
94
|
-
export declare const USER_OWNED_CONFIG_KEYS: readonly ConfigKey[];
|
|
95
|
-
/** Keys whose TOML value must be a list of normalized http(s) origins. */
|
|
96
|
-
export declare const ORIGIN_LIST_CONFIG_KEYS: readonly ConfigKey[];
|
|
97
|
-
/** Keys whose TOML value must parse as a boolean; used by `config set`. */
|
|
98
|
-
export declare const BOOLEAN_CONFIG_KEYS: readonly ConfigKey[];
|
|
99
|
-
/** Keys whose TOML value must parse as an integer within its configured bounds. */
|
|
100
|
-
export declare const NUMERIC_CONFIG_KEYS: readonly ConfigKey[];
|
|
101
|
-
/**
|
|
102
|
-
* Keys whose value must be one of a fixed set.
|
|
103
|
-
*
|
|
104
|
-
* Config is readable from a repository, so an unrecognised value is untrusted
|
|
105
|
-
* input rather than a typo — `coerce` drops it and the layer below wins, which
|
|
106
|
-
* is the same discipline the numeric bounds follow.
|
|
107
|
-
*/
|
|
108
|
-
export declare const ENUM_CONFIG_VALUES: Partial<Record<ConfigKey, readonly string[]>>;
|
|
109
|
-
/** Compiled service origin. Not a user-facing setting; login may override with `--base-url` or `NOTIFAI_BASE_URL`. */
|
|
110
|
-
export declare const DEFAULT_BASE_URL = "https://api.notifai.sh";
|
|
111
|
-
/** The shipped value beneath every user-controlled configuration layer. */
|
|
112
|
-
export declare function configDefaultValue(key: ConfigKey): unknown;
|
|
113
|
-
export declare function globalConfigDir(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): string;
|
|
114
|
-
export declare function globalConfigPath(env?: NodeJS.ProcessEnv): string;
|
|
115
|
-
/**
|
|
116
|
-
* Machine-local mutable state: presence markers, pending questions, frozen
|
|
117
|
-
* session names, and session config overrides. Separate from the config dir
|
|
118
|
-
* because none of it should ever be synced or committed.
|
|
119
|
-
*/
|
|
120
|
-
export declare function stateDir(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): string;
|
|
121
|
-
/** Per-harness-session override file; see the ConfigSource doc comment. */
|
|
122
|
-
export declare function sessionConfigPath(sessionId: string, env?: NodeJS.ProcessEnv): string;
|
|
123
|
-
/**
|
|
124
|
-
* Session ids come from harness JSON, so they reach the filesystem from
|
|
125
|
-
* outside. Hash rather than merely sanitising: replacing unsafe characters
|
|
126
|
-
* collapsed distinct ids onto one file — `a/b` and `a?b` both became `a_b`, and
|
|
127
|
-
* two sessions would then share presence, pending questions and overrides.
|
|
128
|
-
* A readable prefix is kept only so the directory is debuggable.
|
|
129
|
-
*/
|
|
130
|
-
export declare function sanitizeSessionId(sessionId: string): string;
|
|
131
|
-
/**
|
|
132
|
-
* Pointer from a Project directory to the Agent Session currently working in
|
|
133
|
-
* it, written by the UserPromptSubmit hook. Without it `notifai ask` has no way
|
|
134
|
-
* to learn its own Agent Session id: an ordinary agent shell command receives no hook
|
|
135
|
-
* payload, and no harness exports one into the environment.
|
|
136
|
-
*/
|
|
137
|
-
export declare function projectSessionPointerPath(cwd: string, env?: NodeJS.ProcessEnv): string;
|
|
138
|
-
/** Git-owned anchor shared by every linked worktree of one local checkout. */
|
|
139
|
-
export declare function gitCommonDirectory(cwd: string): string | null;
|
|
140
|
-
export declare function findProjectConfigPath(startDir: string): string | null;
|
|
141
|
-
/** Explicit shared configuration is authored in this checkout and merged through Git. */
|
|
142
|
-
export declare function sharedProjectConfigPath(cwd: string): string;
|
|
143
|
-
/**
|
|
144
|
-
* The directory one Project is identified by, from anywhere inside it.
|
|
145
|
-
*
|
|
146
|
-
* Prefer the directory that owns the shared `.notifai/config.toml`, then the
|
|
147
|
-
* git checkout root, then cwd. Subdirectories of one project therefore resolve
|
|
148
|
-
* to one root, and nothing is written inside the repository.
|
|
149
|
-
*
|
|
150
|
-
* Everything keyed per Project — personal preferences, Project Enablement —
|
|
151
|
-
* uses this one answer, so enabling a Project from its root and running a hook
|
|
152
|
-
* from a nested directory cannot disagree about which Project they are in.
|
|
153
|
-
*/
|
|
154
|
-
export declare function projectIdentityRoot(cwd: string): string;
|
|
155
|
-
/** Stable identity for personal project preferences. */
|
|
156
|
-
export declare function personalProjectIdentity(cwd: string): string;
|
|
157
|
-
/** Personal project layer: `$XDG_CONFIG_HOME/notifai/projects/<identity>.toml`. */
|
|
158
|
-
export declare function personalProjectConfigPath(cwd: string, env?: NodeJS.ProcessEnv): string;
|
|
159
|
-
/** Existing personal project file, or null when this checkout has none. */
|
|
160
|
-
export declare function findProjectLocalConfigPath(startDir: string, env?: NodeJS.ProcessEnv): string | null;
|
|
161
|
-
export declare function configBounds(key: ConfigKey): {
|
|
162
|
-
min: number;
|
|
163
|
-
max: number;
|
|
164
|
-
} | undefined;
|
|
165
|
-
export interface FlagOverrides {
|
|
166
|
-
base_url?: string;
|
|
167
|
-
wait_seconds?: number;
|
|
168
|
-
ttl_seconds?: number;
|
|
169
|
-
collapse_key?: string | null;
|
|
170
|
-
devices?: string[];
|
|
171
|
-
sound?: string;
|
|
172
|
-
interruption_level?: CliInterruptionLevel;
|
|
173
|
-
}
|
|
174
|
-
export declare function loadConfig(options: {
|
|
175
|
-
cwd?: string;
|
|
176
|
-
env?: NodeJS.ProcessEnv;
|
|
177
|
-
flags?: FlagOverrides;
|
|
178
|
-
/** Agent Session id; enables the Agent Session override layer when present. */
|
|
179
|
-
sessionId?: string | undefined;
|
|
180
|
-
}): CliConfig;
|
|
181
|
-
export {};
|
package/dist/config.js
DELETED
|
@@ -1,357 +0,0 @@
|
|
|
1
|
-
import { INTERRUPTION_LEVELS, REPLY_MAX_WINDOW_SECONDS, } from '@raidiant/notifai-protocol';
|
|
2
|
-
import { execFileSync } from 'node:child_process';
|
|
3
|
-
import { createHash } from 'node:crypto';
|
|
4
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
5
|
-
import path from 'node:path';
|
|
6
|
-
import { canonicalPath } from './local-path.js';
|
|
7
|
-
import { parse as parseToml } from 'smol-toml';
|
|
8
|
-
import { configHome, stateHome } from './platform.js';
|
|
9
|
-
import { isCliSoundRef } from './sound-ref.js';
|
|
10
|
-
import { normalizeOrigin } from './url-policy.js';
|
|
11
|
-
/**
|
|
12
|
-
* How much the local log records. Defined here rather than in `logging.ts`
|
|
13
|
-
* because it is a configuration vocabulary first — `logging.ts` reads config,
|
|
14
|
-
* so the dependency has to point this way.
|
|
15
|
-
*/
|
|
16
|
-
export const LOG_LEVELS = ['off', 'error', 'info', 'debug'];
|
|
17
|
-
export const CONFIG_KEYS = [
|
|
18
|
-
'wait_seconds',
|
|
19
|
-
'ttl_seconds',
|
|
20
|
-
'collapse_key',
|
|
21
|
-
'devices',
|
|
22
|
-
'sound',
|
|
23
|
-
'interruption_level',
|
|
24
|
-
'project',
|
|
25
|
-
'ask_notifications',
|
|
26
|
-
'ask_grace_seconds',
|
|
27
|
-
'reply_window_seconds',
|
|
28
|
-
'log_level',
|
|
29
|
-
'log_max_bytes',
|
|
30
|
-
'log_max_files',
|
|
31
|
-
'media_origins',
|
|
32
|
-
'approve_origins',
|
|
33
|
-
];
|
|
34
|
-
/**
|
|
35
|
-
* Keys only the User may set. The shared `.notifai/config.toml` arrives with
|
|
36
|
-
* a clone, so for most keys an unwanted value is at worst a clamped nuisance —
|
|
37
|
-
* but these keys widen which network destinations this machine will touch,
|
|
38
|
-
* and a hostile repository must not be able to widen them. Resolution skips
|
|
39
|
-
* the repository layer for them entirely.
|
|
40
|
-
*/
|
|
41
|
-
export const USER_OWNED_CONFIG_KEYS = ['media_origins', 'approve_origins'];
|
|
42
|
-
/** Keys whose TOML value must be a list of normalized http(s) origins. */
|
|
43
|
-
export const ORIGIN_LIST_CONFIG_KEYS = ['media_origins', 'approve_origins'];
|
|
44
|
-
/** Keys whose TOML value must parse as a boolean; used by `config set`. */
|
|
45
|
-
export const BOOLEAN_CONFIG_KEYS = ['ask_notifications'];
|
|
46
|
-
/** Keys whose TOML value must parse as an integer within its configured bounds. */
|
|
47
|
-
export const NUMERIC_CONFIG_KEYS = [
|
|
48
|
-
'wait_seconds',
|
|
49
|
-
'ttl_seconds',
|
|
50
|
-
'ask_grace_seconds',
|
|
51
|
-
'reply_window_seconds',
|
|
52
|
-
'log_max_bytes',
|
|
53
|
-
'log_max_files',
|
|
54
|
-
];
|
|
55
|
-
/**
|
|
56
|
-
* Keys whose value must be one of a fixed set.
|
|
57
|
-
*
|
|
58
|
-
* Config is readable from a repository, so an unrecognised value is untrusted
|
|
59
|
-
* input rather than a typo — `coerce` drops it and the layer below wins, which
|
|
60
|
-
* is the same discipline the numeric bounds follow.
|
|
61
|
-
*/
|
|
62
|
-
export const ENUM_CONFIG_VALUES = {
|
|
63
|
-
interruption_level: INTERRUPTION_LEVELS,
|
|
64
|
-
log_level: LOG_LEVELS,
|
|
65
|
-
};
|
|
66
|
-
/** Compiled service origin. Not a user-facing setting; login may override with `--base-url` or `NOTIFAI_BASE_URL`. */
|
|
67
|
-
export const DEFAULT_BASE_URL = 'https://api.notifai.sh';
|
|
68
|
-
const DEFAULTS = {
|
|
69
|
-
wait_seconds: 10,
|
|
70
|
-
ttl_seconds: 86400,
|
|
71
|
-
collapse_key: null,
|
|
72
|
-
devices: null,
|
|
73
|
-
sound: null,
|
|
74
|
-
interruption_level: null,
|
|
75
|
-
project: null,
|
|
76
|
-
// Installing the hooks is the opt-in; these exist to switch the behaviour
|
|
77
|
-
// back off for a project or a session without uninstalling anything.
|
|
78
|
-
ask_notifications: true,
|
|
79
|
-
// Questions reach devices as soon as the turn ends. A terminal-first grace
|
|
80
|
-
// window is an opt-in delay on top of that.
|
|
81
|
-
ask_grace_seconds: 0,
|
|
82
|
-
// A day. The wire contract's own default, and long enough that a question
|
|
83
|
-
// asked before someone steps away is still answerable when they come back.
|
|
84
|
-
reply_window_seconds: 86_400,
|
|
85
|
-
// On by default: the log is the only account of what a headless hook did, and
|
|
86
|
-
// a diagnostic nobody switched on before the thing went wrong is not one.
|
|
87
|
-
log_level: 'info',
|
|
88
|
-
// 2 MB × 3 files caps the logs at roughly 6 MB, which is weeks of ordinary
|
|
89
|
-
// agent traffic and small enough that nobody has to think about it.
|
|
90
|
-
log_max_bytes: 2_000_000,
|
|
91
|
-
log_max_files: 3,
|
|
92
|
-
// Empty by default: remote images use public HTTPS and pairing approval
|
|
93
|
-
// uses the canonical dashboard, the pairing origin, or loopback. Entries
|
|
94
|
-
// here are the User widening that, never a repository.
|
|
95
|
-
media_origins: [],
|
|
96
|
-
approve_origins: [],
|
|
97
|
-
};
|
|
98
|
-
/** The shipped value beneath every user-controlled configuration layer. */
|
|
99
|
-
export function configDefaultValue(key) {
|
|
100
|
-
return DEFAULTS[key];
|
|
101
|
-
}
|
|
102
|
-
export function globalConfigDir(env = process.env, platform = process.platform) {
|
|
103
|
-
return path.join(configHome(env, platform), 'notifai');
|
|
104
|
-
}
|
|
105
|
-
export function globalConfigPath(env = process.env) {
|
|
106
|
-
return path.join(globalConfigDir(env), 'config.toml');
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Machine-local mutable state: presence markers, pending questions, frozen
|
|
110
|
-
* session names, and session config overrides. Separate from the config dir
|
|
111
|
-
* because none of it should ever be synced or committed.
|
|
112
|
-
*/
|
|
113
|
-
export function stateDir(env = process.env, platform = process.platform) {
|
|
114
|
-
return path.join(stateHome(env, platform), 'notifai');
|
|
115
|
-
}
|
|
116
|
-
/** Per-harness-session override file; see the ConfigSource doc comment. */
|
|
117
|
-
export function sessionConfigPath(sessionId, env = process.env) {
|
|
118
|
-
return path.join(stateDir(env), 'sessions', `${sanitizeSessionId(sessionId)}.config.toml`);
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Session ids come from harness JSON, so they reach the filesystem from
|
|
122
|
-
* outside. Hash rather than merely sanitising: replacing unsafe characters
|
|
123
|
-
* collapsed distinct ids onto one file — `a/b` and `a?b` both became `a_b`, and
|
|
124
|
-
* two sessions would then share presence, pending questions and overrides.
|
|
125
|
-
* A readable prefix is kept only so the directory is debuggable.
|
|
126
|
-
*/
|
|
127
|
-
export function sanitizeSessionId(sessionId) {
|
|
128
|
-
const digest = createHash('sha256').update(sessionId).digest('hex').slice(0, 16);
|
|
129
|
-
const readable = sessionId.replace(/[^A-Za-z0-9_-]/g, '_').slice(0, 32);
|
|
130
|
-
return readable === '' ? digest : `${readable}-${digest}`;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Pointer from a Project directory to the Agent Session currently working in
|
|
134
|
-
* it, written by the UserPromptSubmit hook. Without it `notifai ask` has no way
|
|
135
|
-
* to learn its own Agent Session id: an ordinary agent shell command receives no hook
|
|
136
|
-
* payload, and no harness exports one into the environment.
|
|
137
|
-
*/
|
|
138
|
-
export function projectSessionPointerPath(cwd, env = process.env) {
|
|
139
|
-
const digest = createHash('sha256').update(canonicalDir(cwd)).digest('hex').slice(0, 32);
|
|
140
|
-
return path.join(stateDir(env), 'projects', `${digest}.json`);
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Resolve symlinks before hashing. The harness reports `cwd` as it knows it
|
|
144
|
-
* while a shell reports `process.cwd()` already resolved — on macOS `/tmp` and
|
|
145
|
-
* `/private/tmp` are the same directory, so hashing the unresolved paths gave
|
|
146
|
-
* two different keys and `notifai ask` could never find the pointer the hook
|
|
147
|
-
* had just written.
|
|
148
|
-
*/
|
|
149
|
-
function canonicalDir(dir) {
|
|
150
|
-
return canonicalPath(path.resolve(dir));
|
|
151
|
-
}
|
|
152
|
-
/** Git-owned anchor shared by every linked worktree of one local checkout. */
|
|
153
|
-
export function gitCommonDirectory(cwd) {
|
|
154
|
-
try {
|
|
155
|
-
const raw = execFileSync('git', ['-C', cwd, 'rev-parse', '--git-common-dir'], {
|
|
156
|
-
encoding: 'utf8',
|
|
157
|
-
stdio: ['ignore', 'pipe', 'ignore'],
|
|
158
|
-
timeout: 2_000,
|
|
159
|
-
windowsHide: true,
|
|
160
|
-
}).trim();
|
|
161
|
-
if (raw === '')
|
|
162
|
-
return null;
|
|
163
|
-
return canonicalDir(path.isAbsolute(raw) ? raw : path.resolve(cwd, raw));
|
|
164
|
-
}
|
|
165
|
-
catch {
|
|
166
|
-
return null;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
/** Walk up from cwd looking for .notifai/<name> (Project Override). */
|
|
170
|
-
function findProjectFile(startDir, name) {
|
|
171
|
-
let dir = path.resolve(startDir);
|
|
172
|
-
for (;;) {
|
|
173
|
-
const candidate = path.join(dir, '.notifai', name);
|
|
174
|
-
if (existsSync(candidate))
|
|
175
|
-
return candidate;
|
|
176
|
-
const parent = path.dirname(dir);
|
|
177
|
-
if (parent === dir)
|
|
178
|
-
return null;
|
|
179
|
-
dir = parent;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
export function findProjectConfigPath(startDir) {
|
|
183
|
-
return findProjectFile(startDir, 'config.toml');
|
|
184
|
-
}
|
|
185
|
-
/** Walk up from cwd looking for a `.git` file or directory (worktree or checkout). */
|
|
186
|
-
function findGitRoot(startDir) {
|
|
187
|
-
let dir = path.resolve(startDir);
|
|
188
|
-
for (;;) {
|
|
189
|
-
if (existsSync(path.join(dir, '.git')))
|
|
190
|
-
return canonicalDir(dir);
|
|
191
|
-
const parent = path.dirname(dir);
|
|
192
|
-
if (parent === dir)
|
|
193
|
-
return null;
|
|
194
|
-
dir = parent;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
/** Explicit shared configuration is authored in this checkout and merged through Git. */
|
|
198
|
-
export function sharedProjectConfigPath(cwd) {
|
|
199
|
-
return findProjectConfigPath(cwd) ?? path.join(findGitRoot(cwd) ?? canonicalDir(cwd), '.notifai', 'config.toml');
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* The directory one Project is identified by, from anywhere inside it.
|
|
203
|
-
*
|
|
204
|
-
* Prefer the directory that owns the shared `.notifai/config.toml`, then the
|
|
205
|
-
* git checkout root, then cwd. Subdirectories of one project therefore resolve
|
|
206
|
-
* to one root, and nothing is written inside the repository.
|
|
207
|
-
*
|
|
208
|
-
* Everything keyed per Project — personal preferences, Project Enablement —
|
|
209
|
-
* uses this one answer, so enabling a Project from its root and running a hook
|
|
210
|
-
* from a nested directory cannot disagree about which Project they are in.
|
|
211
|
-
*/
|
|
212
|
-
export function projectIdentityRoot(cwd) {
|
|
213
|
-
const projectConfig = findProjectConfigPath(cwd);
|
|
214
|
-
return canonicalDir(projectConfig !== null ? path.dirname(path.dirname(projectConfig)) : (findGitRoot(cwd) ?? cwd));
|
|
215
|
-
}
|
|
216
|
-
/** Stable identity for personal project preferences. */
|
|
217
|
-
export function personalProjectIdentity(cwd) {
|
|
218
|
-
const anchor = gitCommonDirectory(cwd) ?? projectIdentityRoot(cwd);
|
|
219
|
-
return createHash('sha256').update(anchor).digest('hex').slice(0, 32);
|
|
220
|
-
}
|
|
221
|
-
/** Personal project layer: `$XDG_CONFIG_HOME/notifai/projects/<identity>.toml`. */
|
|
222
|
-
export function personalProjectConfigPath(cwd, env = process.env) {
|
|
223
|
-
return path.join(globalConfigDir(env), 'projects', `${personalProjectIdentity(cwd)}.toml`);
|
|
224
|
-
}
|
|
225
|
-
/** Existing personal project file, or null when this checkout has none. */
|
|
226
|
-
export function findProjectLocalConfigPath(startDir, env = process.env) {
|
|
227
|
-
const file = personalProjectConfigPath(startDir, env);
|
|
228
|
-
return existsSync(file) ? file : null;
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Ranges every layer is clamped to. Config is readable from a repository, so an
|
|
232
|
-
* out-of-range value is attacker input, not a typo.
|
|
233
|
-
*/
|
|
234
|
-
const NUMERIC_BOUNDS = {
|
|
235
|
-
wait_seconds: { min: 0, max: 300 },
|
|
236
|
-
ttl_seconds: { min: 0, max: 7 * 24 * 3600 },
|
|
237
|
-
// Six minutes is the supported terminal-first preference bound. The Stop
|
|
238
|
-
// owner carries separate startup headroom, so this never shortens the answer
|
|
239
|
-
// window that begins after submission.
|
|
240
|
-
ask_grace_seconds: { min: 0, max: 360 },
|
|
241
|
-
// The floor is the shortest window the wire contract accepts; the ceiling is
|
|
242
|
-
// the point past which a question would outlive the retained content it
|
|
243
|
-
// refers to.
|
|
244
|
-
reply_window_seconds: { min: 60, max: REPLY_MAX_WINDOW_SECONDS },
|
|
245
|
-
// The floor keeps rotation from thrashing (a file smaller than a handful of
|
|
246
|
-
// records would rotate on nearly every write); the ceiling is the point past
|
|
247
|
-
// which "local diagnostics" has become "a database on your disk".
|
|
248
|
-
log_max_bytes: { min: 64_000, max: 100_000_000 },
|
|
249
|
-
log_max_files: { min: 1, max: 20 },
|
|
250
|
-
};
|
|
251
|
-
/** Drops values a layer must not be trusted to supply, rather than throwing. */
|
|
252
|
-
function coerce(key, value) {
|
|
253
|
-
const bounds = NUMERIC_BOUNDS[key];
|
|
254
|
-
if (bounds !== undefined) {
|
|
255
|
-
if (typeof value !== 'number' || !Number.isFinite(value))
|
|
256
|
-
return undefined;
|
|
257
|
-
return Math.min(bounds.max, Math.max(bounds.min, Math.trunc(value)));
|
|
258
|
-
}
|
|
259
|
-
if (BOOLEAN_CONFIG_KEYS.includes(key))
|
|
260
|
-
return typeof value === 'boolean' ? value : undefined;
|
|
261
|
-
if (ORIGIN_LIST_CONFIG_KEYS.includes(key)) {
|
|
262
|
-
// A trust rule is all-or-nothing: one malformed entry drops the whole
|
|
263
|
-
// value rather than silently enforcing a subset of what was written.
|
|
264
|
-
if (!Array.isArray(value))
|
|
265
|
-
return undefined;
|
|
266
|
-
const origins = value.map((entry) => (typeof entry === 'string' ? normalizeOrigin(entry) : null));
|
|
267
|
-
return origins.every((origin) => origin !== null) ? origins : undefined;
|
|
268
|
-
}
|
|
269
|
-
if (key === 'sound') {
|
|
270
|
-
return typeof value === 'string' && isCliSoundRef(value) ? value : undefined;
|
|
271
|
-
}
|
|
272
|
-
const allowed = ENUM_CONFIG_VALUES[key];
|
|
273
|
-
if (allowed !== undefined) {
|
|
274
|
-
return typeof value === 'string' && allowed.includes(value) ? value : undefined;
|
|
275
|
-
}
|
|
276
|
-
return value;
|
|
277
|
-
}
|
|
278
|
-
export function configBounds(key) {
|
|
279
|
-
return NUMERIC_BOUNDS[key];
|
|
280
|
-
}
|
|
281
|
-
function readTomlFile(filePath) {
|
|
282
|
-
try {
|
|
283
|
-
return parseToml(readFileSync(filePath, 'utf8'));
|
|
284
|
-
}
|
|
285
|
-
catch (err) {
|
|
286
|
-
throw new Error(`Could not parse ${filePath}: ${String(err)}`);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Service origin is not a user setting. Flag and env are pairing/self-host
|
|
291
|
-
* overrides for unsigned-in traffic (login). Signed-in traffic always uses
|
|
292
|
-
* the origin stored with the Machine Credential.
|
|
293
|
-
*/
|
|
294
|
-
function resolveServiceUrl(flags, env) {
|
|
295
|
-
if (typeof flags.base_url === 'string' && flags.base_url !== '') {
|
|
296
|
-
return { value: flags.base_url, source: 'flag' };
|
|
297
|
-
}
|
|
298
|
-
const fromEnv = env['NOTIFAI_BASE_URL'];
|
|
299
|
-
if (typeof fromEnv === 'string' && fromEnv !== '') {
|
|
300
|
-
return { value: fromEnv, source: 'env' };
|
|
301
|
-
}
|
|
302
|
-
return { value: DEFAULT_BASE_URL, source: 'default' };
|
|
303
|
-
}
|
|
304
|
-
export function loadConfig(options) {
|
|
305
|
-
const env = options.env ?? process.env;
|
|
306
|
-
const flags = options.flags ?? {};
|
|
307
|
-
const globalPath = globalConfigPath(env);
|
|
308
|
-
const globalRaw = existsSync(globalPath) ? readTomlFile(globalPath) : {};
|
|
309
|
-
const cwd = options.cwd ?? process.cwd();
|
|
310
|
-
const projectPath = findProjectConfigPath(cwd);
|
|
311
|
-
const projectRaw = projectPath ? readTomlFile(projectPath) : {};
|
|
312
|
-
const projectLocalPath = findProjectLocalConfigPath(cwd, env);
|
|
313
|
-
const projectLocalRaw = projectLocalPath ? readTomlFile(projectLocalPath) : {};
|
|
314
|
-
const sessionId = options.sessionId ?? env['NOTIFAI_SESSION_ID'];
|
|
315
|
-
const sessionPath = sessionId ? sessionConfigPath(sessionId, env) : null;
|
|
316
|
-
const sessionRaw = sessionPath && existsSync(sessionPath) ? readTomlFile(sessionPath) : {};
|
|
317
|
-
function resolve(key) {
|
|
318
|
-
// The shared project file arrives with a clone, so keys that widen
|
|
319
|
-
// network trust never read from it — whatever a repository writes there.
|
|
320
|
-
const repositoryLayerReadable = !USER_OWNED_CONFIG_KEYS.includes(key);
|
|
321
|
-
const layers = [
|
|
322
|
-
[flags[key], 'flag'],
|
|
323
|
-
[sessionPath ? sessionRaw[key] : undefined, `session:${sessionPath ?? ''}`],
|
|
324
|
-
[projectLocalPath ? projectLocalRaw[key] : undefined, `project-local:${projectLocalPath ?? ''}`],
|
|
325
|
-
[projectPath && repositoryLayerReadable ? projectRaw[key] : undefined, `project:${projectPath ?? ''}`],
|
|
326
|
-
[globalRaw[key], `global:${globalPath}`],
|
|
327
|
-
];
|
|
328
|
-
for (const [raw, source] of layers) {
|
|
329
|
-
if (raw === undefined)
|
|
330
|
-
continue;
|
|
331
|
-
const coerced = coerce(key, raw);
|
|
332
|
-
if (coerced === undefined)
|
|
333
|
-
continue;
|
|
334
|
-
return { value: coerced, source };
|
|
335
|
-
}
|
|
336
|
-
return { value: DEFAULTS[key], source: 'default' };
|
|
337
|
-
}
|
|
338
|
-
return {
|
|
339
|
-
base_url: resolveServiceUrl(flags, env),
|
|
340
|
-
wait_seconds: resolve('wait_seconds'),
|
|
341
|
-
ttl_seconds: resolve('ttl_seconds'),
|
|
342
|
-
collapse_key: resolve('collapse_key'),
|
|
343
|
-
devices: resolve('devices'),
|
|
344
|
-
sound: resolve('sound'),
|
|
345
|
-
interruption_level: resolve('interruption_level'),
|
|
346
|
-
project: resolve('project'),
|
|
347
|
-
ask_notifications: resolve('ask_notifications'),
|
|
348
|
-
ask_grace_seconds: resolve('ask_grace_seconds'),
|
|
349
|
-
reply_window_seconds: resolve('reply_window_seconds'),
|
|
350
|
-
log_level: resolve('log_level'),
|
|
351
|
-
log_max_bytes: resolve('log_max_bytes'),
|
|
352
|
-
log_max_files: resolve('log_max_files'),
|
|
353
|
-
media_origins: resolve('media_origins'),
|
|
354
|
-
approve_origins: resolve('approve_origins'),
|
|
355
|
-
};
|
|
356
|
-
}
|
|
357
|
-
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAmCjD;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAU,CAAA;AA0DpE,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,cAAc;IACd,aAAa;IACb,cAAc;IACd,SAAS;IACT,OAAO;IACP,oBAAoB;IACpB,SAAS;IACT,mBAAmB;IACnB,mBAAmB;IACnB,sBAAsB;IAC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
|
-
secret: string;
|
|
4
|
-
baseUrl: string;
|
|
5
|
-
machineName: string;
|
|
6
|
-
}
|
|
7
|
-
/** Non-secret ownership metadata for a frozen authenticated operation. */
|
|
8
|
-
export interface ServiceIdentity {
|
|
9
|
-
base_url: string;
|
|
10
|
-
machine_id: string;
|
|
11
|
-
}
|
|
12
|
-
export interface CredentialStore {
|
|
13
|
-
load(): MachineCredential | null;
|
|
14
|
-
save(credential: MachineCredential): void;
|
|
15
|
-
clear(): void;
|
|
16
|
-
/** Where the secret lives, for `doctor` and docs. */
|
|
17
|
-
describe(): string;
|
|
18
|
-
}
|
|
19
|
-
export interface RunCommandSpec {
|
|
20
|
-
command: string;
|
|
21
|
-
args: readonly string[];
|
|
22
|
-
input: Buffer;
|
|
23
|
-
timeoutMs?: number;
|
|
24
|
-
}
|
|
25
|
-
export interface RunCommandResult {
|
|
26
|
-
status: number;
|
|
27
|
-
stdout: Buffer;
|
|
28
|
-
}
|
|
29
|
-
/** Injected process seam. Production uses `defaultProcessRunner`. */
|
|
30
|
-
export interface ProcessRunner {
|
|
31
|
-
run(spec: RunCommandSpec): RunCommandResult;
|
|
32
|
-
}
|
|
33
|
-
export interface CredentialStoreOptions {
|
|
34
|
-
env?: NodeJS.ProcessEnv;
|
|
35
|
-
platform?: NodeJS.Platform;
|
|
36
|
-
run?: ProcessRunner;
|
|
37
|
-
keychainAvailable?: boolean;
|
|
38
|
-
}
|
|
39
|
-
/** Which DPAPI operation a process invocation asked for. Args never carry secrets. */
|
|
40
|
-
export declare function windowsDpapiOperation(args: readonly string[]): 'protect' | 'unprotect' | null;
|
|
41
|
-
export declare const defaultProcessRunner: ProcessRunner;
|
|
42
|
-
/**
|
|
43
|
-
* macOS Keychain via the first-party `security` Security.framework client.
|
|
44
|
-
*
|
|
45
|
-
* `security add-generic-password -w <value>` puts the value in process argv.
|
|
46
|
-
* Interactive mode instead parses a command from stdin, so the credential
|
|
47
|
-
* crosses the helper boundary only through the pipe. `-X` keeps arbitrary
|
|
48
|
-
* serialized bytes out of the command parser's quoting rules.
|
|
49
|
-
*/
|
|
50
|
-
export declare class KeychainStore implements CredentialStore {
|
|
51
|
-
private readonly run;
|
|
52
|
-
constructor(options?: CredentialStoreOptions);
|
|
53
|
-
load(): MachineCredential | null;
|
|
54
|
-
save(credential: MachineCredential): void;
|
|
55
|
-
clear(): void;
|
|
56
|
-
describe(): string;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Explicit plaintext file store.
|
|
60
|
-
*
|
|
61
|
-
* Default on Linux, where mode 0600 is a real ACL. Also the
|
|
62
|
-
* `NOTIFAI_CREDENTIALS=file` development and test escape hatch on every
|
|
63
|
-
* platform. POSIX mode bits are not an NTFS ACL, so this is not a protected
|
|
64
|
-
* Windows store.
|
|
65
|
-
*/
|
|
66
|
-
export declare class FileStore implements CredentialStore {
|
|
67
|
-
private readonly env;
|
|
68
|
-
private readonly platform;
|
|
69
|
-
constructor(env?: NodeJS.ProcessEnv, options?: CredentialStoreOptions);
|
|
70
|
-
private filePath;
|
|
71
|
-
load(): MachineCredential | null;
|
|
72
|
-
save(credential: MachineCredential): void;
|
|
73
|
-
clear(): void;
|
|
74
|
-
describe(): string;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Windows default: DPAPI CurrentUser via first-party PowerShell.
|
|
78
|
-
*
|
|
79
|
-
* The protected blob lives under LOCALAPPDATA, never roaming APPDATA.
|
|
80
|
-
* Plaintext crosses the process boundary only on stdin/stdout — never as a
|
|
81
|
-
* command-line argument.
|
|
82
|
-
*/
|
|
83
|
-
export declare class WindowsDpapiStore implements CredentialStore {
|
|
84
|
-
private readonly env;
|
|
85
|
-
private readonly run;
|
|
86
|
-
constructor(env?: NodeJS.ProcessEnv, options?: CredentialStoreOptions);
|
|
87
|
-
private filePath;
|
|
88
|
-
load(): MachineCredential | null;
|
|
89
|
-
save(credential: MachineCredential): void;
|
|
90
|
-
clear(): void;
|
|
91
|
-
describe(): string;
|
|
92
|
-
private protect;
|
|
93
|
-
private unprotect;
|
|
94
|
-
private invoke;
|
|
95
|
-
}
|
|
96
|
-
export declare function defaultCredentialStore(env?: NodeJS.ProcessEnv, options?: CredentialStoreOptions): CredentialStore;
|