@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/hook-adapter.js
DELETED
|
@@ -1,419 +0,0 @@
|
|
|
1
|
-
import { chmodSync, existsSync, lstatSync, mkdirSync, readFileSync, realpathSync, statSync, } from 'node:fs';
|
|
2
|
-
import os from 'node:os';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { atomicWriteFileSync } from './atomic-file.js';
|
|
5
|
-
import { withTargetFileLock } from './file-lock.js';
|
|
6
|
-
import { sameLocalPath } from './local-path.js';
|
|
7
|
-
import { isWindowsAbsolute } from './platform.js';
|
|
8
|
-
const ADAPTER_MARKER = '# notifai managed hook adapter';
|
|
9
|
-
const WIN32_ADAPTER_MARKER = '// notifai managed hook adapter';
|
|
10
|
-
const ADAPTER_VERSION = 2;
|
|
11
|
-
export function isNpxAdapterTarget(target) {
|
|
12
|
-
return target.kind === 'npx';
|
|
13
|
-
}
|
|
14
|
-
/** Whether a parsed adapter runs the same installed CLI artifact as PATH. */
|
|
15
|
-
export function hookAdapterTargetsArtifact(target, artifactPath) {
|
|
16
|
-
if (target === null || isNpxAdapterTarget(target))
|
|
17
|
-
return false;
|
|
18
|
-
try {
|
|
19
|
-
return realpathSync(target.scriptPath) === realpathSync(artifactPath);
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export function hookHostPlatform(platform = process.platform) {
|
|
26
|
-
return platform === 'win32' ? 'win32' : 'posix';
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* One user-level identity for every harness and every project/global install.
|
|
30
|
-
*
|
|
31
|
-
* The pathname is deliberately outside XDG configuration/state routing. XDG
|
|
32
|
-
* overrides routinely differ between shells, package managers, and harness
|
|
33
|
-
* processes; allowing one to select this path would put mutable environment
|
|
34
|
-
* back into every trusted definition. Only the user's home boundary selects
|
|
35
|
-
* it; CLI, Node, package-manager, checkout, and preference paths stay behind
|
|
36
|
-
* it and may change without changing hook identity.
|
|
37
|
-
*/
|
|
38
|
-
export function hookAdapterPath(homeDir = os.userInfo().homedir) {
|
|
39
|
-
return path.join(homeDir, '.notifai', 'bin', 'hook-adapter');
|
|
40
|
-
}
|
|
41
|
-
function envRequestedHomes(env = process.env, platform = process.platform) {
|
|
42
|
-
if (platform === 'win32') {
|
|
43
|
-
const profile = env['USERPROFILE'];
|
|
44
|
-
const home = env['HOME'];
|
|
45
|
-
// accountHome accepts a Windows-absolute HOME ahead of USERPROFILE.
|
|
46
|
-
// Validate both: one real value must not conceal a relocated other one.
|
|
47
|
-
// Git Bash/MSYS HOME is intentionally ignored by accountHome as well.
|
|
48
|
-
return [
|
|
49
|
-
...(typeof profile === 'string' && profile !== '' ? [profile] : []),
|
|
50
|
-
...(typeof home === 'string' && isWindowsAbsolute(home) ? [home] : []),
|
|
51
|
-
];
|
|
52
|
-
}
|
|
53
|
-
const home = env['HOME'];
|
|
54
|
-
return typeof home === 'string' && home !== '' ? [home] : [];
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Adapter identity is the OS account home. A mutable HOME is not a trusted
|
|
58
|
-
* isolation context: honouring it would retarget every live harness hook.
|
|
59
|
-
* Tests and other explicit callers pass the destination home themselves.
|
|
60
|
-
*/
|
|
61
|
-
export function resolveHookAdapterHome(explicitHome, env = process.env, platform = process.platform) {
|
|
62
|
-
if (explicitHome !== undefined && explicitHome !== '')
|
|
63
|
-
return explicitHome;
|
|
64
|
-
const osHome = os.userInfo().homedir;
|
|
65
|
-
const comparisonPlatform = platform === 'win32' ? 'win32' : 'linux';
|
|
66
|
-
if (envRequestedHomes(env, platform).some((home) => !sameLocalPath(home, osHome, comparisonPlatform))) {
|
|
67
|
-
throw new Error(`Refusing to install the shared hook adapter: HOME or USERPROFILE does not match this account's OS home. Isolated programmatic verification must pass an explicit adapter home; a mutable home cannot retarget trusted hook identity.`);
|
|
68
|
-
}
|
|
69
|
-
return osHome;
|
|
70
|
-
}
|
|
71
|
-
/** Install or repair the stable adapter and atomically retarget its implementation. */
|
|
72
|
-
export function installHookAdapter(target, homeDir, platform = process.platform, env = process.env) {
|
|
73
|
-
const host = hookHostPlatform(platform);
|
|
74
|
-
assertUsableTarget(target, host);
|
|
75
|
-
const resolvedHome = resolveHookAdapterHome(homeDir, env, platform);
|
|
76
|
-
const file = hookAdapterPath(resolvedHome);
|
|
77
|
-
ensureManagedDirectories(resolvedHome, host);
|
|
78
|
-
const source = hookAdapterSource(target, host);
|
|
79
|
-
return withTargetFileLock(file, () => {
|
|
80
|
-
const existing = existsSync(file) ? readSafeManagedFile(file) : null;
|
|
81
|
-
const modeDrift = host === 'posix' && existing !== null && (existing.mode & 0o777) !== 0o700;
|
|
82
|
-
const changed = existing === null || existing.contents !== source || modeDrift;
|
|
83
|
-
if (changed) {
|
|
84
|
-
atomicWriteFileSync(file, source, {
|
|
85
|
-
mode: host === 'posix' ? 0o700 : 0o600,
|
|
86
|
-
preserveMode: false,
|
|
87
|
-
requireCurrentUserOwner: true,
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
return { path: file, changed };
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
function assertUsableTarget(target, host) {
|
|
94
|
-
let exec;
|
|
95
|
-
try {
|
|
96
|
-
exec = statSync(target.execPath);
|
|
97
|
-
}
|
|
98
|
-
catch {
|
|
99
|
-
throw new Error(`Hook adapter runtime ${target.execPath} does not exist.`);
|
|
100
|
-
}
|
|
101
|
-
if (!exec.isFile() || (host === 'posix' && (exec.mode & 0o111) === 0)) {
|
|
102
|
-
throw new Error(`Hook adapter runtime ${target.execPath} is not executable.`);
|
|
103
|
-
}
|
|
104
|
-
if (isNpxAdapterTarget(target)) {
|
|
105
|
-
if (target.spec.trim() === '') {
|
|
106
|
-
throw new Error('Hook adapter npx spec is empty.');
|
|
107
|
-
}
|
|
108
|
-
try {
|
|
109
|
-
if (!statSync(target.npmCli).isFile()) {
|
|
110
|
-
throw new Error(`Hook adapter npm CLI ${target.npmCli} is not a regular file.`);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
catch (err) {
|
|
114
|
-
if (err instanceof Error && err.message.startsWith('Hook adapter npm CLI '))
|
|
115
|
-
throw err;
|
|
116
|
-
throw new Error(`Hook adapter npm CLI ${target.npmCli} does not exist.`);
|
|
117
|
-
}
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
try {
|
|
121
|
-
if (!statSync(target.scriptPath).isFile()) {
|
|
122
|
-
throw new Error(`Hook adapter CLI ${target.scriptPath} is not a regular file.`);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
catch (err) {
|
|
126
|
-
if (err instanceof Error && err.message.startsWith('Hook adapter CLI '))
|
|
127
|
-
throw err;
|
|
128
|
-
throw new Error(`Hook adapter CLI ${target.scriptPath} does not exist.`);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
/** Inspect the shared adapter without executing either it or its registered CLI. */
|
|
132
|
-
export function inspectHookAdapter(homeDir, platform = process.platform) {
|
|
133
|
-
const host = hookHostPlatform(platform);
|
|
134
|
-
const file = hookAdapterPath(homeDir);
|
|
135
|
-
if (!existsSync(file)) {
|
|
136
|
-
return { path: file, target: null, problems: [`${file} is missing; rerun \`notifai hooks install\``] };
|
|
137
|
-
}
|
|
138
|
-
let stat;
|
|
139
|
-
try {
|
|
140
|
-
stat = lstatSync(file);
|
|
141
|
-
}
|
|
142
|
-
catch (err) {
|
|
143
|
-
return { path: file, target: null, problems: [String(err)] };
|
|
144
|
-
}
|
|
145
|
-
if (stat.isSymbolicLink() || !stat.isFile()) {
|
|
146
|
-
return {
|
|
147
|
-
path: file,
|
|
148
|
-
target: null,
|
|
149
|
-
problems: [`${file} is not a regular file; refusing the adapter`],
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
const problems = [];
|
|
153
|
-
if (host === 'posix') {
|
|
154
|
-
const uid = typeof process.getuid === 'function' ? process.getuid() : undefined;
|
|
155
|
-
if (uid !== undefined && stat.uid !== uid) {
|
|
156
|
-
problems.push(`${file} is owned by uid ${stat.uid}, not the current user`);
|
|
157
|
-
}
|
|
158
|
-
if ((stat.mode & 0o077) !== 0 || (stat.mode & 0o700) !== 0o700) {
|
|
159
|
-
problems.push(`${file} permissions are ${(stat.mode & 0o777).toString(8)}, expected 700`);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
const contents = readFileSync(file, 'utf8');
|
|
163
|
-
const format = adapterFormat(contents);
|
|
164
|
-
if (format === null) {
|
|
165
|
-
problems.push(`${file} has no managed adapter marker`);
|
|
166
|
-
}
|
|
167
|
-
else if (format !== host) {
|
|
168
|
-
problems.push(`${file} is not a ${host} managed adapter; rerun \`notifai hooks install\``);
|
|
169
|
-
}
|
|
170
|
-
const version = Number(meta(contents, 'adapter-version') ?? Number.NaN);
|
|
171
|
-
if (version !== ADAPTER_VERSION)
|
|
172
|
-
problems.push(`${file} uses obsolete adapter version ${version}`);
|
|
173
|
-
const target = parseTarget(contents);
|
|
174
|
-
if (target === null) {
|
|
175
|
-
problems.push(`${file} has malformed target metadata`);
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
try {
|
|
179
|
-
const exec = statSync(target.execPath);
|
|
180
|
-
if (!exec.isFile() || (host === 'posix' && (exec.mode & 0o111) === 0)) {
|
|
181
|
-
problems.push(`registered runtime ${target.execPath} is not executable`);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
catch {
|
|
185
|
-
problems.push(`registered runtime ${target.execPath} is missing`);
|
|
186
|
-
}
|
|
187
|
-
if (isNpxAdapterTarget(target)) {
|
|
188
|
-
if (target.spec.trim() === '')
|
|
189
|
-
problems.push('registered npx spec is empty');
|
|
190
|
-
try {
|
|
191
|
-
if (!statSync(target.npmCli).isFile()) {
|
|
192
|
-
problems.push(`registered npm CLI ${target.npmCli} is not a regular file`);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
catch {
|
|
196
|
-
problems.push(`registered npm CLI ${target.npmCli} is missing`);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
try {
|
|
201
|
-
if (!statSync(target.scriptPath).isFile()) {
|
|
202
|
-
problems.push(`registered CLI ${target.scriptPath} is not a regular file`);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
catch {
|
|
206
|
-
problems.push(`registered CLI ${target.scriptPath} is missing`);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
return { path: file, target, problems };
|
|
211
|
-
}
|
|
212
|
-
/** Generate the managed adapter source for one host. Exported so tests can pin bytes. */
|
|
213
|
-
export function hookAdapterSource(target, platform = process.platform) {
|
|
214
|
-
return hookHostPlatform(platform) === 'win32'
|
|
215
|
-
? win32HookAdapterSource(target)
|
|
216
|
-
: posixHookAdapterSource(target);
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Two rungs, and the difference between them is the whole safety argument.
|
|
220
|
-
*
|
|
221
|
-
* The registered runtime is a resolved path, so every node version manager
|
|
222
|
-
* makes it version-scoped: a Homebrew upgrade renames its Cellar directory, an
|
|
223
|
-
* nvm version gets pruned, and the pinned interpreter stops existing. The npm
|
|
224
|
-
* shim this adapter wraps already survives that — `main.ts` starts with
|
|
225
|
-
* `#!/usr/bin/env node` — so pinning the interpreter here was stricter than the
|
|
226
|
-
* binary it stands in front of, and the strictness bought nothing.
|
|
227
|
-
*
|
|
228
|
-
* So PATH may supply the *interpreter*, and never the *code*: both rungs keep
|
|
229
|
-
* the registered script path, and no rung resolves `notifai` from PATH. Which
|
|
230
|
-
* Notifai build a trusted hook definition runs stays a property of the
|
|
231
|
-
* installation, not of whatever environment the harness happens to hand us.
|
|
232
|
-
*/
|
|
233
|
-
function posixHookAdapterSource(target) {
|
|
234
|
-
if (isNpxAdapterTarget(target)) {
|
|
235
|
-
return `#!/bin/sh
|
|
236
|
-
${ADAPTER_MARKER}
|
|
237
|
-
# adapter-version: ${ADAPTER_VERSION}
|
|
238
|
-
# target-kind: npx
|
|
239
|
-
# target-exec-json: ${JSON.stringify(target.execPath)}
|
|
240
|
-
# target-npm-cli-json: ${JSON.stringify(target.npmCli)}
|
|
241
|
-
# target-spec-json: ${JSON.stringify(target.spec)}
|
|
242
|
-
set -eu
|
|
243
|
-
|
|
244
|
-
NOTIFAI_HOOK_SOURCE_PID=$PPID
|
|
245
|
-
export NOTIFAI_HOOK_SOURCE_PID
|
|
246
|
-
|
|
247
|
-
registered_exec=${quote(target.execPath)}
|
|
248
|
-
registered_npm_cli=${quote(target.npmCli)}
|
|
249
|
-
registered_spec=${quote(target.spec)}
|
|
250
|
-
|
|
251
|
-
if [ -x "$registered_exec" ] && [ -f "$registered_npm_cli" ]; then
|
|
252
|
-
exec "$registered_exec" "$registered_npm_cli" exec --yes --package "$registered_spec" -- notifai "$@"
|
|
253
|
-
fi
|
|
254
|
-
|
|
255
|
-
if [ -f "$registered_npm_cli" ] && command -v node >/dev/null 2>&1; then
|
|
256
|
-
exec node "$registered_npm_cli" exec --yes --package "$registered_spec" -- notifai "$@"
|
|
257
|
-
fi
|
|
258
|
-
|
|
259
|
-
printf '%s\n' 'Notifai hook adapter target is stale; run notifai hooks install.' >&2
|
|
260
|
-
exit 127
|
|
261
|
-
`;
|
|
262
|
-
}
|
|
263
|
-
return `#!/bin/sh
|
|
264
|
-
${ADAPTER_MARKER}
|
|
265
|
-
# adapter-version: ${ADAPTER_VERSION}
|
|
266
|
-
# target-exec-json: ${JSON.stringify(target.execPath)}
|
|
267
|
-
# target-script-json: ${JSON.stringify(target.scriptPath)}
|
|
268
|
-
set -eu
|
|
269
|
-
|
|
270
|
-
NOTIFAI_HOOK_SOURCE_PID=$PPID
|
|
271
|
-
export NOTIFAI_HOOK_SOURCE_PID
|
|
272
|
-
|
|
273
|
-
registered_exec=${quote(target.execPath)}
|
|
274
|
-
registered_script=${quote(target.scriptPath)}
|
|
275
|
-
|
|
276
|
-
if [ -x "$registered_exec" ] && [ -f "$registered_script" ]; then
|
|
277
|
-
exec "$registered_exec" "$registered_script" "$@"
|
|
278
|
-
fi
|
|
279
|
-
|
|
280
|
-
if [ -f "$registered_script" ] && command -v node >/dev/null 2>&1; then
|
|
281
|
-
exec node "$registered_script" "$@"
|
|
282
|
-
fi
|
|
283
|
-
|
|
284
|
-
printf '%s\n' 'Notifai hook adapter target is stale; run notifai hooks install.' >&2
|
|
285
|
-
exit 127
|
|
286
|
-
`;
|
|
287
|
-
}
|
|
288
|
-
function win32HookAdapterSource(target) {
|
|
289
|
-
const header = isNpxAdapterTarget(target)
|
|
290
|
-
? `${WIN32_ADAPTER_MARKER}
|
|
291
|
-
// adapter-version: ${ADAPTER_VERSION}
|
|
292
|
-
// target-kind: npx
|
|
293
|
-
// target-exec-json: ${JSON.stringify(target.execPath)}
|
|
294
|
-
// target-npm-cli-json: ${JSON.stringify(target.npmCli)}
|
|
295
|
-
// target-spec-json: ${JSON.stringify(target.spec)}
|
|
296
|
-
`
|
|
297
|
-
: `${WIN32_ADAPTER_MARKER}
|
|
298
|
-
// adapter-version: ${ADAPTER_VERSION}
|
|
299
|
-
// target-exec-json: ${JSON.stringify(target.execPath)}
|
|
300
|
-
// target-script-json: ${JSON.stringify(target.scriptPath)}
|
|
301
|
-
`;
|
|
302
|
-
const argv = isNpxAdapterTarget(target)
|
|
303
|
-
? `[${JSON.stringify(target.npmCli)}, "exec", "--yes", "--package", ${JSON.stringify(target.spec)}, "--", "notifai", ...process.argv.slice(2)]`
|
|
304
|
-
: `[${JSON.stringify(target.scriptPath)}, ...process.argv.slice(2)]`;
|
|
305
|
-
const companion = isNpxAdapterTarget(target)
|
|
306
|
-
? JSON.stringify(target.npmCli)
|
|
307
|
-
: JSON.stringify(target.scriptPath);
|
|
308
|
-
return `${header}"use strict";
|
|
309
|
-
const { spawnSync } = require("node:child_process");
|
|
310
|
-
const { statSync } = require("node:fs");
|
|
311
|
-
const registeredExec = ${JSON.stringify(target.execPath)};
|
|
312
|
-
const registeredCompanion = ${companion};
|
|
313
|
-
|
|
314
|
-
function isFile(file) {
|
|
315
|
-
try {
|
|
316
|
-
return statSync(file).isFile();
|
|
317
|
-
} catch {
|
|
318
|
-
return false;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
// The pinned runtime is preferred; the runtime already executing this shim is
|
|
323
|
-
// the fallback. Only the interpreter is allowed to move — the code stays pinned.
|
|
324
|
-
const runtime = isFile(registeredExec) ? registeredExec : process.execPath;
|
|
325
|
-
|
|
326
|
-
if (isFile(registeredCompanion)) {
|
|
327
|
-
const result = spawnSync(runtime, ${argv}, {
|
|
328
|
-
stdio: "inherit",
|
|
329
|
-
windowsHide: true,
|
|
330
|
-
env: { ...process.env, NOTIFAI_HOOK_SOURCE_PID: String(process.ppid) },
|
|
331
|
-
});
|
|
332
|
-
if (result.error) {
|
|
333
|
-
process.stderr.write("Notifai hook adapter target is stale; run notifai hooks install.\\n");
|
|
334
|
-
process.exit(127);
|
|
335
|
-
}
|
|
336
|
-
process.exit(result.status === null ? 1 : result.status);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
process.stderr.write("Notifai hook adapter target is stale; run notifai hooks install.\\n");
|
|
340
|
-
process.exit(127);
|
|
341
|
-
`;
|
|
342
|
-
}
|
|
343
|
-
function adapterFormat(contents) {
|
|
344
|
-
if (contents.startsWith(`#!/bin/sh\n${ADAPTER_MARKER}\n`))
|
|
345
|
-
return 'posix';
|
|
346
|
-
if (contents.startsWith(`${WIN32_ADAPTER_MARKER}\n`))
|
|
347
|
-
return 'win32';
|
|
348
|
-
return null;
|
|
349
|
-
}
|
|
350
|
-
function meta(contents, key) {
|
|
351
|
-
return new RegExp(`^(?:#|//) ${key}: (.+)$`, 'm').exec(contents)?.[1];
|
|
352
|
-
}
|
|
353
|
-
function parseTarget(contents) {
|
|
354
|
-
const kind = meta(contents, 'target-kind');
|
|
355
|
-
const exec = meta(contents, 'target-exec-json');
|
|
356
|
-
if (exec === undefined)
|
|
357
|
-
return null;
|
|
358
|
-
try {
|
|
359
|
-
const execPath = JSON.parse(exec);
|
|
360
|
-
if (typeof execPath !== 'string')
|
|
361
|
-
return null;
|
|
362
|
-
if (kind === 'npx') {
|
|
363
|
-
const npmCliRaw = meta(contents, 'target-npm-cli-json');
|
|
364
|
-
const specRaw = meta(contents, 'target-spec-json');
|
|
365
|
-
if (npmCliRaw === undefined || specRaw === undefined)
|
|
366
|
-
return null;
|
|
367
|
-
const npmCli = JSON.parse(npmCliRaw);
|
|
368
|
-
const spec = JSON.parse(specRaw);
|
|
369
|
-
return typeof npmCli === 'string' && typeof spec === 'string'
|
|
370
|
-
? { kind: 'npx', execPath, npmCli, spec }
|
|
371
|
-
: null;
|
|
372
|
-
}
|
|
373
|
-
const script = meta(contents, 'target-script-json');
|
|
374
|
-
if (script === undefined)
|
|
375
|
-
return null;
|
|
376
|
-
const scriptPath = JSON.parse(script);
|
|
377
|
-
return typeof scriptPath === 'string' ? { execPath, scriptPath } : null;
|
|
378
|
-
}
|
|
379
|
-
catch {
|
|
380
|
-
return null;
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
function quote(value) {
|
|
384
|
-
return `'${value.replaceAll("'", `'\\''`)}'`;
|
|
385
|
-
}
|
|
386
|
-
function ensureManagedDirectories(homeDir, host) {
|
|
387
|
-
mkdirSync(homeDir, { recursive: true, mode: 0o700 });
|
|
388
|
-
for (const dir of [path.join(homeDir, '.notifai'), path.join(homeDir, '.notifai', 'bin')]) {
|
|
389
|
-
// Recursive creation is deliberately idempotent. Several harness setup
|
|
390
|
-
// processes can reach this account-level adapter at once; an
|
|
391
|
-
// exists-then-create sequence lets one valid creator make another throw
|
|
392
|
-
// EEXIST. The lstat below remains the security postcondition: success from
|
|
393
|
-
// mkdir is not permission to trust a symlink or non-directory occupant.
|
|
394
|
-
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
395
|
-
const stat = lstatSync(dir);
|
|
396
|
-
if (stat.isSymbolicLink() || !stat.isDirectory()) {
|
|
397
|
-
throw new Error(`${dir} is not a regular directory; refusing to install the hook adapter.`);
|
|
398
|
-
}
|
|
399
|
-
if (host === 'posix') {
|
|
400
|
-
const uid = typeof process.getuid === 'function' ? process.getuid() : undefined;
|
|
401
|
-
if (uid !== undefined && stat.uid !== uid) {
|
|
402
|
-
throw new Error(`${dir} is owned by uid ${stat.uid}, not the current user.`);
|
|
403
|
-
}
|
|
404
|
-
chmodSync(dir, 0o700);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
function readSafeManagedFile(file) {
|
|
409
|
-
const stat = lstatSync(file);
|
|
410
|
-
if (stat.isSymbolicLink() || !stat.isFile()) {
|
|
411
|
-
throw new Error(`${file} is not a regular file; refusing to replace it.`);
|
|
412
|
-
}
|
|
413
|
-
const uid = typeof process.getuid === 'function' ? process.getuid() : undefined;
|
|
414
|
-
if (uid !== undefined && stat.uid !== uid) {
|
|
415
|
-
throw new Error(`${file} is owned by uid ${stat.uid}, not the current user.`);
|
|
416
|
-
}
|
|
417
|
-
return { contents: readFileSync(file, 'utf8'), mode: stat.mode };
|
|
418
|
-
}
|
|
419
|
-
//# sourceMappingURL=hook-adapter.js.map
|
package/dist/hook-adapter.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hook-adapter.js","sourceRoot":"","sources":["../src/hook-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,QAAQ,GACT,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEjD,MAAM,cAAc,GAAG,gCAAgC,CAAA;AACvD,MAAM,oBAAoB,GAAG,iCAAiC,CAAA;AAC9D,MAAM,eAAe,GAAG,CAAC,CAAA;AAmBzB,MAAM,UAAU,kBAAkB,CAAC,MAAyB;IAC1D,OAAO,MAAM,CAAC,IAAI,KAAK,KAAK,CAAA;AAC9B,CAAC;AAQD,6EAA6E;AAC7E,MAAM,UAAU,0BAA0B,CACxC,MAAgC,EAChC,YAAoB;IAEpB,IAAI,MAAM,KAAK,IAAI,IAAI,kBAAkB,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAA;IAC/D,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,YAAY,CAAC,YAAY,CAAC,CAAA;IACvE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAA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,IAAI,CAAC,CAAA;IAC5B,IAAI,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,iDAAiD,CAAC,CAAA;IAC3E,CAAC;IACD,MAAM,GAAG,GAAG,OAAO,OAAO,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;IAC/E,IAAI,GAAG,KAAK,SAAS,IAAI,IAAI,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;QAC1C,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,oBAAoB,IAAI,CAAC,GAAG,yBAAyB,CAAC,CAAA;IAC/E,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAA;AAClE,CAAC"}
|
package/dist/hook-events.d.ts
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/** Canonical lifecycle event vocabulary shared by installation and execution. */
|
|
2
|
-
import { type HookInstallableHarness } from './harnesses.js';
|
|
3
|
-
import { type HookHostPlatform } from './hook-adapter.js';
|
|
4
|
-
/**
|
|
5
|
-
* One harness-neutral table for the lifecycle events this CLI build serves.
|
|
6
|
-
*
|
|
7
|
-
* Builders, generated-plugin discovery lists, ownership regexes, and
|
|
8
|
-
* `HOOK_EVENTS` all derive from this. Per-harness *shape* (async Stop,
|
|
9
|
-
* Cursor `loop_limit`, OpenCode native joint names) stays at the adapter;
|
|
10
|
-
* this table owns names, budgets, and which harnesses receive each event.
|
|
11
|
-
*
|
|
12
|
-
* Timeouts are seconds. Document Stop is not taken from `timeoutSeconds`:
|
|
13
|
-
* Question Routing hosts use the full-window budget, and the Cursor `stop`
|
|
14
|
-
* handler uses the non-routing blocking budget.
|
|
15
|
-
*/
|
|
16
|
-
export declare const HOOK_EVENT_TABLE: readonly [{
|
|
17
|
-
readonly notifai: "post-tool-use";
|
|
18
|
-
readonly document: "PostToolUse";
|
|
19
|
-
readonly cursor: null;
|
|
20
|
-
readonly openclaw: false;
|
|
21
|
-
readonly opencodeDiscovery: false;
|
|
22
|
-
readonly timeoutSeconds: 10;
|
|
23
|
-
}, {
|
|
24
|
-
readonly notifai: "session-start";
|
|
25
|
-
readonly document: "SessionStart";
|
|
26
|
-
readonly cursor: "sessionStart";
|
|
27
|
-
readonly openclaw: true;
|
|
28
|
-
readonly opencodeDiscovery: false;
|
|
29
|
-
readonly timeoutSeconds: 5;
|
|
30
|
-
}, {
|
|
31
|
-
readonly notifai: "subagent-start";
|
|
32
|
-
readonly document: "SubagentStart";
|
|
33
|
-
readonly cursor: null;
|
|
34
|
-
readonly openclaw: true;
|
|
35
|
-
readonly opencodeDiscovery: false;
|
|
36
|
-
readonly timeoutSeconds: 5;
|
|
37
|
-
}, {
|
|
38
|
-
readonly notifai: "activation-stop";
|
|
39
|
-
readonly document: null;
|
|
40
|
-
readonly cursor: "stop";
|
|
41
|
-
readonly openclaw: false;
|
|
42
|
-
readonly opencodeDiscovery: false;
|
|
43
|
-
readonly timeoutSeconds: 5;
|
|
44
|
-
readonly cursorLoopLimit: 1;
|
|
45
|
-
}, {
|
|
46
|
-
readonly notifai: "user-prompt-submit";
|
|
47
|
-
readonly document: "UserPromptSubmit";
|
|
48
|
-
readonly cursor: "beforeSubmitPrompt";
|
|
49
|
-
readonly openclaw: true;
|
|
50
|
-
readonly opencodeDiscovery: true;
|
|
51
|
-
readonly timeoutSeconds: 15;
|
|
52
|
-
}, {
|
|
53
|
-
readonly notifai: "stop";
|
|
54
|
-
readonly document: "Stop";
|
|
55
|
-
readonly cursor: "stop";
|
|
56
|
-
readonly openclaw: true;
|
|
57
|
-
readonly opencodeDiscovery: true;
|
|
58
|
-
readonly timeoutSeconds: 5;
|
|
59
|
-
readonly cursorLoopLimit: 3;
|
|
60
|
-
}, {
|
|
61
|
-
readonly notifai: "session-end";
|
|
62
|
-
readonly document: "SessionEnd";
|
|
63
|
-
readonly cursor: "sessionEnd";
|
|
64
|
-
readonly openclaw: true;
|
|
65
|
-
readonly opencodeDiscovery: true;
|
|
66
|
-
readonly timeoutSeconds: 3;
|
|
67
|
-
}, {
|
|
68
|
-
readonly notifai: "attend";
|
|
69
|
-
readonly document: null;
|
|
70
|
-
readonly cursor: null;
|
|
71
|
-
readonly openclaw: false;
|
|
72
|
-
readonly opencodeDiscovery: false;
|
|
73
|
-
readonly timeoutSeconds: 0;
|
|
74
|
-
}];
|
|
75
|
-
export type HookEvent = (typeof HOOK_EVENT_TABLE)[number]['notifai'];
|
|
76
|
-
export declare const HOOK_EVENTS: readonly HookEvent[];
|
|
77
|
-
/** Alternation of Notifai hook-event tokens for command ownership regexes. */
|
|
78
|
-
export declare const HOOK_EVENT_PATTERN: string;
|
|
79
|
-
export declare const HOOK_EVENT_COMMAND_RE: RegExp;
|
|
80
|
-
/**
|
|
81
|
-
* OpenCode has no settings document, so discovery reconstructs the joints
|
|
82
|
-
* the generated module reports as handlers. Session start/subagent start
|
|
83
|
-
* arrive through `experimental.chat.system.transform` rather than this list.
|
|
84
|
-
*/
|
|
85
|
-
export declare const OPENCODE_EVENTS: (readonly ["SessionStart" | "SubagentStart" | "UserPromptSubmit" | "PostToolUse" | "Stop" | "SessionEnd", "stop" | "post-tool-use" | "session-start" | "subagent-start" | "user-prompt-submit" | "session-end"])[];
|
|
86
|
-
export declare const OPENCLAW_EVENTS: (readonly ["SessionStart" | "SubagentStart" | "UserPromptSubmit" | "PostToolUse" | "Stop" | "SessionEnd", "stop" | "post-tool-use" | "session-start" | "subagent-start" | "user-prompt-submit" | "session-end"])[];
|
|
87
|
-
/**
|
|
88
|
-
* Where the Session Attendant handler is installed: SessionStart starts it,
|
|
89
|
-
* and UserPromptSubmit and Stop re-arm a session whose attendant died.
|
|
90
|
-
*/
|
|
91
|
-
export declare const ATTEND_DOCUMENT_EVENTS: readonly ["SessionStart", "UserPromptSubmit", "Stop"];
|
|
92
|
-
/**
|
|
93
|
-
* The attend handler's events for one harness. Codex also needs Interrupt: an
|
|
94
|
-
* interrupted Codex turn fires Interrupt instead of Stop, and the attendant
|
|
95
|
-
* reads a Codex thread's activity from its own turn boundaries.
|
|
96
|
-
*/
|
|
97
|
-
export declare function attendDocumentEvents(harness: HookInstallableHarness | undefined): readonly string[];
|
|
98
|
-
/**
|
|
99
|
-
* Whether this build installs the Session Attendant for a harness: Claude Code
|
|
100
|
-
* and Codex, on POSIX only. Claude Code on Windows has no session descriptor
|
|
101
|
-
* or inbox socket; Codex on Windows has no proven hook parent process.
|
|
102
|
-
*/
|
|
103
|
-
export declare function installsSessionAttendant(harness: HookInstallableHarness | undefined, platform?: NodeJS.Platform | HookHostPlatform): boolean;
|
|
104
|
-
/** Lifecycle handlers one installed harness must carry in this CLI build. */
|
|
105
|
-
export declare function requiredHookEvents(harness: HookInstallableHarness, platform?: NodeJS.Platform | HookHostPlatform): readonly HookEvent[];
|
package/dist/hook-events.js
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/** Canonical lifecycle event vocabulary shared by installation and execution. */
|
|
2
|
-
import {} from './harnesses.js';
|
|
3
|
-
import { hookHostPlatform } from './hook-adapter.js';
|
|
4
|
-
/**
|
|
5
|
-
* One harness-neutral table for the lifecycle events this CLI build serves.
|
|
6
|
-
*
|
|
7
|
-
* Builders, generated-plugin discovery lists, ownership regexes, and
|
|
8
|
-
* `HOOK_EVENTS` all derive from this. Per-harness *shape* (async Stop,
|
|
9
|
-
* Cursor `loop_limit`, OpenCode native joint names) stays at the adapter;
|
|
10
|
-
* this table owns names, budgets, and which harnesses receive each event.
|
|
11
|
-
*
|
|
12
|
-
* Timeouts are seconds. Document Stop is not taken from `timeoutSeconds`:
|
|
13
|
-
* Question Routing hosts use the full-window budget, and the Cursor `stop`
|
|
14
|
-
* handler uses the non-routing blocking budget.
|
|
15
|
-
*/
|
|
16
|
-
export const HOOK_EVENT_TABLE = [
|
|
17
|
-
{
|
|
18
|
-
notifai: 'post-tool-use',
|
|
19
|
-
document: 'PostToolUse',
|
|
20
|
-
cursor: null,
|
|
21
|
-
openclaw: false,
|
|
22
|
-
opencodeDiscovery: false,
|
|
23
|
-
timeoutSeconds: 10,
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
notifai: 'session-start',
|
|
27
|
-
document: 'SessionStart',
|
|
28
|
-
cursor: 'sessionStart',
|
|
29
|
-
openclaw: true,
|
|
30
|
-
opencodeDiscovery: false,
|
|
31
|
-
timeoutSeconds: 5,
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
notifai: 'subagent-start',
|
|
35
|
-
document: 'SubagentStart',
|
|
36
|
-
cursor: null,
|
|
37
|
-
openclaw: true,
|
|
38
|
-
opencodeDiscovery: false,
|
|
39
|
-
timeoutSeconds: 5,
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
notifai: 'activation-stop',
|
|
43
|
-
document: null,
|
|
44
|
-
cursor: 'stop',
|
|
45
|
-
openclaw: false,
|
|
46
|
-
opencodeDiscovery: false,
|
|
47
|
-
timeoutSeconds: 5,
|
|
48
|
-
cursorLoopLimit: 1,
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
notifai: 'user-prompt-submit',
|
|
52
|
-
document: 'UserPromptSubmit',
|
|
53
|
-
cursor: 'beforeSubmitPrompt',
|
|
54
|
-
openclaw: true,
|
|
55
|
-
opencodeDiscovery: true,
|
|
56
|
-
timeoutSeconds: 15,
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
notifai: 'stop',
|
|
60
|
-
document: 'Stop',
|
|
61
|
-
cursor: 'stop',
|
|
62
|
-
openclaw: true,
|
|
63
|
-
opencodeDiscovery: true,
|
|
64
|
-
timeoutSeconds: 5,
|
|
65
|
-
cursorLoopLimit: 3,
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
notifai: 'session-end',
|
|
69
|
-
document: 'SessionEnd',
|
|
70
|
-
cursor: 'sessionEnd',
|
|
71
|
-
openclaw: true,
|
|
72
|
-
opencodeDiscovery: true,
|
|
73
|
-
timeoutSeconds: 3,
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
// The Session Attendant. It is not one document event: it is installed
|
|
77
|
-
// as a second, asynchronous handler on each of ATTEND_DOCUMENT_EVENTS.
|
|
78
|
-
notifai: 'attend',
|
|
79
|
-
document: null,
|
|
80
|
-
cursor: null,
|
|
81
|
-
openclaw: false,
|
|
82
|
-
opencodeDiscovery: false,
|
|
83
|
-
timeoutSeconds: 0,
|
|
84
|
-
},
|
|
85
|
-
];
|
|
86
|
-
export const HOOK_EVENTS = HOOK_EVENT_TABLE.map((row) => row.notifai);
|
|
87
|
-
/** Alternation of Notifai hook-event tokens for command ownership regexes. */
|
|
88
|
-
export const HOOK_EVENT_PATTERN = HOOK_EVENTS.join('|');
|
|
89
|
-
export const HOOK_EVENT_COMMAND_RE = new RegExp(` hook (${HOOK_EVENT_PATTERN})\\b`);
|
|
90
|
-
/**
|
|
91
|
-
* OpenCode has no settings document, so discovery reconstructs the joints
|
|
92
|
-
* the generated module reports as handlers. Session start/subagent start
|
|
93
|
-
* arrive through `experimental.chat.system.transform` rather than this list.
|
|
94
|
-
*/
|
|
95
|
-
export const OPENCODE_EVENTS = HOOK_EVENT_TABLE.filter((row) => row.opencodeDiscovery && row.document !== null).map((row) => [row.document, row.notifai]);
|
|
96
|
-
export const OPENCLAW_EVENTS = HOOK_EVENT_TABLE.filter((row) => row.openclaw && row.document !== null).map((row) => [row.document, row.notifai]);
|
|
97
|
-
/**
|
|
98
|
-
* Where the Session Attendant handler is installed: SessionStart starts it,
|
|
99
|
-
* and UserPromptSubmit and Stop re-arm a session whose attendant died.
|
|
100
|
-
*/
|
|
101
|
-
export const ATTEND_DOCUMENT_EVENTS = ['SessionStart', 'UserPromptSubmit', 'Stop'];
|
|
102
|
-
/**
|
|
103
|
-
* The attend handler's events for one harness. Codex also needs Interrupt: an
|
|
104
|
-
* interrupted Codex turn fires Interrupt instead of Stop, and the attendant
|
|
105
|
-
* reads a Codex thread's activity from its own turn boundaries.
|
|
106
|
-
*/
|
|
107
|
-
export function attendDocumentEvents(harness) {
|
|
108
|
-
return harness === 'codex' ? [...ATTEND_DOCUMENT_EVENTS, 'Interrupt'] : ATTEND_DOCUMENT_EVENTS;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Whether this build installs the Session Attendant for a harness: Claude Code
|
|
112
|
-
* and Codex, on POSIX only. Claude Code on Windows has no session descriptor
|
|
113
|
-
* or inbox socket; Codex on Windows has no proven hook parent process.
|
|
114
|
-
*/
|
|
115
|
-
export function installsSessionAttendant(harness, platform) {
|
|
116
|
-
return (harness === 'claude-code' || harness === 'codex') && hookHostPlatform(platform) === 'posix';
|
|
117
|
-
}
|
|
118
|
-
/** Lifecycle handlers one installed harness must carry in this CLI build. */
|
|
119
|
-
export function requiredHookEvents(harness, platform) {
|
|
120
|
-
if (harness === 'opencode' || harness === 'openclaw' || harness === 'hermes')
|
|
121
|
-
return [];
|
|
122
|
-
return HOOK_EVENT_TABLE.filter((row) => row.notifai === 'post-tool-use'
|
|
123
|
-
? harness === 'codex' && installsSessionAttendant(harness, platform)
|
|
124
|
-
: row.notifai === 'attend'
|
|
125
|
-
? installsSessionAttendant(harness, platform)
|
|
126
|
-
: harness === 'cursor'
|
|
127
|
-
? row.cursor !== null
|
|
128
|
-
: row.document !== null).map((row) => row.notifai);
|
|
129
|
-
}
|
|
130
|
-
//# sourceMappingURL=hook-events.js.map
|