@raidiant/notifai 11.7.1 → 12.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/NOTICE +16 -0
- package/THIRD_PARTY_NOTICES +725 -0
- package/bin/notifai.mjs +11387 -0
- package/data/install.ps1 +318 -0
- package/data/release.json +1 -0
- package/inventory.json +1 -0
- package/npm-adapter-files.json +52 -0
- package/package.json +14 -44
- package/README.md +0 -168
- package/dist/agent-update-notice.d.ts +0 -7
- package/dist/agent-update-notice.js +0 -77
- package/dist/agent-update-notice.js.map +0 -1
- package/dist/atomic-file.d.ts +0 -30
- package/dist/atomic-file.js +0 -148
- package/dist/atomic-file.js.map +0 -1
- package/dist/attendant-update.d.ts +0 -15
- package/dist/attendant-update.js +0 -96
- package/dist/attendant-update.js.map +0 -1
- package/dist/claude-wake.d.ts +0 -108
- package/dist/claude-wake.js +0 -369
- package/dist/claude-wake.js.map +0 -1
- package/dist/cli-bin.d.ts +0 -26
- package/dist/cli-bin.js +0 -220
- package/dist/cli-bin.js.map +0 -1
- package/dist/cli-contract.d.ts +0 -16
- package/dist/cli-contract.js +0 -27
- package/dist/cli-contract.js.map +0 -1
- package/dist/cli-release.d.ts +0 -36
- package/dist/cli-release.js +0 -85
- package/dist/cli-release.js.map +0 -1
- package/dist/client.d.ts +0 -109
- package/dist/client.js +0 -217
- package/dist/client.js.map +0 -1
- package/dist/codex-answer-control.d.ts +0 -14
- package/dist/codex-answer-control.js +0 -41
- package/dist/codex-answer-control.js.map +0 -1
- package/dist/codex-answer-presentation.d.ts +0 -18
- package/dist/codex-answer-presentation.js +0 -113
- package/dist/codex-answer-presentation.js.map +0 -1
- package/dist/codex-input-lifecycle.d.ts +0 -10
- package/dist/codex-input-lifecycle.js +0 -63
- package/dist/codex-input-lifecycle.js.map +0 -1
- package/dist/codex-native-control.d.ts +0 -13
- package/dist/codex-native-control.js +0 -120
- package/dist/codex-native-control.js.map +0 -1
- package/dist/codex-native-turn.d.ts +0 -37
- package/dist/codex-native-turn.js +0 -155
- package/dist/codex-native-turn.js.map +0 -1
- package/dist/codex-question-bindings.d.ts +0 -76
- package/dist/codex-question-bindings.js +0 -151
- package/dist/codex-question-bindings.js.map +0 -1
- package/dist/codex-queue-control.d.ts +0 -21
- package/dist/codex-queue-control.js +0 -59
- package/dist/codex-queue-control.js.map +0 -1
- package/dist/codex-tool-messages.d.ts +0 -7
- package/dist/codex-tool-messages.js +0 -126
- package/dist/codex-tool-messages.js.map +0 -1
- package/dist/codex-wake.d.ts +0 -58
- package/dist/codex-wake.js +0 -135
- package/dist/codex-wake.js.map +0 -1
- package/dist/command-session.d.ts +0 -14
- package/dist/command-session.js +0 -31
- package/dist/command-session.js.map +0 -1
- package/dist/commands-acknowledge.d.ts +0 -13
- package/dist/commands-acknowledge.js +0 -116
- package/dist/commands-acknowledge.js.map +0 -1
- package/dist/commands-agent-sessions.d.ts +0 -6
- package/dist/commands-agent-sessions.js +0 -51
- package/dist/commands-agent-sessions.js.map +0 -1
- package/dist/commands-ask.d.ts +0 -62
- package/dist/commands-ask.js +0 -503
- package/dist/commands-ask.js.map +0 -1
- package/dist/commands-auth.d.ts +0 -76
- package/dist/commands-auth.js +0 -421
- package/dist/commands-auth.js.map +0 -1
- package/dist/commands-close.d.ts +0 -6
- package/dist/commands-close.js +0 -273
- package/dist/commands-close.js.map +0 -1
- package/dist/commands-config.d.ts +0 -31
- package/dist/commands-config.js +0 -272
- package/dist/commands-config.js.map +0 -1
- package/dist/commands-core.d.ts +0 -145
- package/dist/commands-core.js +0 -190
- package/dist/commands-core.js.map +0 -1
- package/dist/commands-devices.d.ts +0 -41
- package/dist/commands-devices.js +0 -144
- package/dist/commands-devices.js.map +0 -1
- package/dist/commands-doctor.d.ts +0 -25
- package/dist/commands-doctor.js +0 -1553
- package/dist/commands-doctor.js.map +0 -1
- package/dist/commands-guidance.d.ts +0 -27
- package/dist/commands-guidance.js +0 -150
- package/dist/commands-guidance.js.map +0 -1
- package/dist/commands-harness-context.d.ts +0 -57
- package/dist/commands-harness-context.js +0 -102
- package/dist/commands-harness-context.js.map +0 -1
- package/dist/commands-hook-attend.d.ts +0 -70
- package/dist/commands-hook-attend.js +0 -655
- package/dist/commands-hook-attend.js.map +0 -1
- package/dist/commands-hook-diagnostics.d.ts +0 -37
- package/dist/commands-hook-diagnostics.js +0 -136
- package/dist/commands-hook-diagnostics.js.map +0 -1
- package/dist/commands-hook-install.d.ts +0 -26
- package/dist/commands-hook-install.js +0 -784
- package/dist/commands-hook-install.js.map +0 -1
- package/dist/commands-hook-run.d.ts +0 -29
- package/dist/commands-hook-run.js +0 -933
- package/dist/commands-hook-run.js.map +0 -1
- package/dist/commands-hook-shape.d.ts +0 -19
- package/dist/commands-hook-shape.js +0 -48
- package/dist/commands-hook-shape.js.map +0 -1
- package/dist/commands-init.d.ts +0 -42
- package/dist/commands-init.js +0 -901
- package/dist/commands-init.js.map +0 -1
- package/dist/commands-io.d.ts +0 -2
- package/dist/commands-io.js +0 -117
- package/dist/commands-io.js.map +0 -1
- package/dist/commands-logs.d.ts +0 -30
- package/dist/commands-logs.js +0 -201
- package/dist/commands-logs.js.map +0 -1
- package/dist/commands-native-acknowledge.d.ts +0 -8
- package/dist/commands-native-acknowledge.js +0 -114
- package/dist/commands-native-acknowledge.js.map +0 -1
- package/dist/commands-project.d.ts +0 -4
- package/dist/commands-project.js +0 -41
- package/dist/commands-project.js.map +0 -1
- package/dist/commands-receive.d.ts +0 -3
- package/dist/commands-receive.js +0 -59
- package/dist/commands-receive.js.map +0 -1
- package/dist/commands-send-support.d.ts +0 -59
- package/dist/commands-send-support.js +0 -258
- package/dist/commands-send-support.js.map +0 -1
- package/dist/commands-send.d.ts +0 -34
- package/dist/commands-send.js +0 -900
- package/dist/commands-send.js.map +0 -1
- package/dist/commands-setup-proof.d.ts +0 -43
- package/dist/commands-setup-proof.js +0 -134
- package/dist/commands-setup-proof.js.map +0 -1
- package/dist/commands-skill.d.ts +0 -21
- package/dist/commands-skill.js +0 -199
- package/dist/commands-skill.js.map +0 -1
- package/dist/commands-sounds.d.ts +0 -12
- package/dist/commands-sounds.js +0 -35
- package/dist/commands-sounds.js.map +0 -1
- package/dist/commands-update-check.d.ts +0 -6
- package/dist/commands-update-check.js +0 -102
- package/dist/commands-update-check.js.map +0 -1
- package/dist/commands-update-resume.d.ts +0 -7
- package/dist/commands-update-resume.js +0 -143
- package/dist/commands-update-resume.js.map +0 -1
- package/dist/commands-update-skill.d.ts +0 -5
- package/dist/commands-update-skill.js +0 -36
- package/dist/commands-update-skill.js.map +0 -1
- package/dist/commands-update.d.ts +0 -11
- package/dist/commands-update.js +0 -286
- package/dist/commands-update.js.map +0 -1
- package/dist/commands.d.ts +0 -26
- package/dist/commands.js +0 -27
- package/dist/commands.js.map +0 -1
- package/dist/config-schema.d.ts +0 -62
- package/dist/config-schema.js +0 -302
- package/dist/config-schema.js.map +0 -1
- package/dist/config.d.ts +0 -181
- package/dist/config.js +0 -357
- package/dist/config.js.map +0 -1
- package/dist/credentials.d.ts +0 -96
- package/dist/credentials.js +0 -342
- package/dist/credentials.js.map +0 -1
- package/dist/file-lock.d.ts +0 -34
- package/dist/file-lock.js +0 -367
- package/dist/file-lock.js.map +0 -1
- package/dist/generated-session-label.d.ts +0 -2
- package/dist/generated-session-label.js +0 -152
- package/dist/generated-session-label.js.map +0 -1
- package/dist/guidance-content.d.ts +0 -53
- package/dist/guidance-content.js +0 -248
- package/dist/guidance-content.js.map +0 -1
- package/dist/guidance-render.d.ts +0 -25
- package/dist/guidance-render.js +0 -47
- package/dist/guidance-render.js.map +0 -1
- package/dist/guidance.d.ts +0 -69
- package/dist/guidance.js +0 -173
- package/dist/guidance.js.map +0 -1
- package/dist/harness-session-title.d.ts +0 -22
- package/dist/harness-session-title.js +0 -74
- package/dist/harness-session-title.js.map +0 -1
- package/dist/harnesses.d.ts +0 -65
- package/dist/harnesses.js +0 -159
- package/dist/harnesses.js.map +0 -1
- package/dist/hermes-attendant.d.ts +0 -38
- package/dist/hermes-attendant.js +0 -337
- package/dist/hermes-attendant.js.map +0 -1
- package/dist/hermes-plugin.d.ts +0 -11
- package/dist/hermes-plugin.js +0 -299
- package/dist/hermes-plugin.js.map +0 -1
- package/dist/hook-acknowledgements.d.ts +0 -70
- package/dist/hook-acknowledgements.js +0 -490
- package/dist/hook-acknowledgements.js.map +0 -1
- package/dist/hook-adapter.d.ts +0 -48
- package/dist/hook-adapter.js +0 -419
- package/dist/hook-adapter.js.map +0 -1
- package/dist/hook-events.d.ts +0 -105
- package/dist/hook-events.js +0 -130
- package/dist/hook-events.js.map +0 -1
- package/dist/hook-gates.d.ts +0 -7
- package/dist/hook-gates.js +0 -20
- package/dist/hook-gates.js.map +0 -1
- package/dist/hook-input.d.ts +0 -10
- package/dist/hook-input.js +0 -64
- package/dist/hook-input.js.map +0 -1
- package/dist/hook-lifecycle.d.ts +0 -112
- package/dist/hook-lifecycle.js +0 -2031
- package/dist/hook-lifecycle.js.map +0 -1
- package/dist/hook-project-sessions.d.ts +0 -28
- package/dist/hook-project-sessions.js +0 -141
- package/dist/hook-project-sessions.js.map +0 -1
- package/dist/hook-question-lock.d.ts +0 -29
- package/dist/hook-question-lock.js +0 -217
- package/dist/hook-question-lock.js.map +0 -1
- package/dist/hook-question-retirement.d.ts +0 -74
- package/dist/hook-question-retirement.js +0 -314
- package/dist/hook-question-retirement.js.map +0 -1
- package/dist/hook-question-state.d.ts +0 -58
- package/dist/hook-question-state.js +0 -239
- package/dist/hook-question-state.js.map +0 -1
- package/dist/hook-session-state.d.ts +0 -127
- package/dist/hook-session-state.js +0 -488
- package/dist/hook-session-state.js.map +0 -1
- package/dist/hook-types.d.ts +0 -476
- package/dist/hook-types.js +0 -4
- package/dist/hook-types.js.map +0 -1
- package/dist/injection-render.d.ts +0 -36
- package/dist/injection-render.js +0 -61
- package/dist/injection-render.js.map +0 -1
- package/dist/install-hooks.d.ts +0 -470
- package/dist/install-hooks.js +0 -1622
- package/dist/install-hooks.js.map +0 -1
- package/dist/integration-health.d.ts +0 -26
- package/dist/integration-health.js +0 -133
- package/dist/integration-health.js.map +0 -1
- package/dist/interactive.d.ts +0 -22
- package/dist/interactive.js +0 -644
- package/dist/interactive.js.map +0 -1
- package/dist/invocation-context.d.ts +0 -47
- package/dist/invocation-context.js +0 -164
- package/dist/invocation-context.js.map +0 -1
- package/dist/local-path.d.ts +0 -7
- package/dist/local-path.js +0 -27
- package/dist/local-path.js.map +0 -1
- package/dist/logging.d.ts +0 -157
- package/dist/logging.js +0 -599
- package/dist/logging.js.map +0 -1
- package/dist/main-run.d.ts +0 -1
- package/dist/main-run.js +0 -42
- package/dist/main-run.js.map +0 -1
- package/dist/main.d.ts +0 -2
- package/dist/main.js +0 -12
- package/dist/main.js.map +0 -1
- package/dist/native-answer-operation.d.ts +0 -70
- package/dist/native-answer-operation.js +0 -247
- package/dist/native-answer-operation.js.map +0 -1
- package/dist/native-skills.d.ts +0 -64
- package/dist/native-skills.js +0 -167
- package/dist/native-skills.js.map +0 -1
- package/dist/node-floor.d.ts +0 -19
- package/dist/node-floor.js +0 -32
- package/dist/node-floor.js.map +0 -1
- package/dist/npm-invocation.d.ts +0 -34
- package/dist/npm-invocation.js +0 -53
- package/dist/npm-invocation.js.map +0 -1
- package/dist/openclaw-continuation-bridge.d.ts +0 -7
- package/dist/openclaw-continuation-bridge.js +0 -64
- package/dist/openclaw-continuation-bridge.js.map +0 -1
- package/dist/openclaw-gateway-readiness.d.ts +0 -1
- package/dist/openclaw-gateway-readiness.js +0 -24
- package/dist/openclaw-gateway-readiness.js.map +0 -1
- package/dist/openclaw-generation.d.ts +0 -21
- package/dist/openclaw-generation.js +0 -115
- package/dist/openclaw-generation.js.map +0 -1
- package/dist/openclaw-message-bridge.d.ts +0 -8
- package/dist/openclaw-message-bridge.js +0 -93
- package/dist/openclaw-message-bridge.js.map +0 -1
- package/dist/openclaw-pending.d.ts +0 -8
- package/dist/openclaw-pending.js +0 -47
- package/dist/openclaw-pending.js.map +0 -1
- package/dist/openclaw-plugin.d.ts +0 -75
- package/dist/openclaw-plugin.js +0 -1353
- package/dist/openclaw-plugin.js.map +0 -1
- package/dist/openclaw-session-access.d.ts +0 -12
- package/dist/openclaw-session-access.js +0 -79
- package/dist/openclaw-session-access.js.map +0 -1
- package/dist/opencode-plugin.d.ts +0 -88
- package/dist/opencode-plugin.js +0 -286
- package/dist/opencode-plugin.js.map +0 -1
- package/dist/orca-session-title.d.ts +0 -11
- package/dist/orca-session-title.js +0 -111
- package/dist/orca-session-title.js.map +0 -1
- package/dist/pack-feedback-slice.d.ts +0 -35
- package/dist/pack-feedback-slice.js +0 -126
- package/dist/pack-feedback-slice.js.map +0 -1
- package/dist/pairing-qr.d.ts +0 -5
- package/dist/pairing-qr.js +0 -24
- package/dist/pairing-qr.js.map +0 -1
- package/dist/pending-pairing.d.ts +0 -38
- package/dist/pending-pairing.js +0 -70
- package/dist/pending-pairing.js.map +0 -1
- package/dist/platform.d.ts +0 -67
- package/dist/platform.js +0 -140
- package/dist/platform.js.map +0 -1
- package/dist/process-identity.d.ts +0 -26
- package/dist/process-identity.js +0 -82
- package/dist/process-identity.js.map +0 -1
- package/dist/program.d.ts +0 -59
- package/dist/program.js +0 -691
- package/dist/program.js.map +0 -1
- package/dist/project-enablement.d.ts +0 -21
- package/dist/project-enablement.js +0 -71
- package/dist/project-enablement.js.map +0 -1
- package/dist/question-settlement-process.d.ts +0 -17
- package/dist/question-settlement-process.js +0 -35
- package/dist/question-settlement-process.js.map +0 -1
- package/dist/question-timing.d.ts +0 -46
- package/dist/question-timing.js +0 -48
- package/dist/question-timing.js.map +0 -1
- package/dist/readiness.d.ts +0 -153
- package/dist/readiness.js +0 -149
- package/dist/readiness.js.map +0 -1
- package/dist/release.d.ts +0 -31
- package/dist/release.js +0 -52
- package/dist/release.js.map +0 -1
- package/dist/send-attempts.d.ts +0 -26
- package/dist/send-attempts.js +0 -139
- package/dist/send-attempts.js.map +0 -1
- package/dist/send.d.ts +0 -115
- package/dist/send.js +0 -421
- package/dist/send.js.map +0 -1
- package/dist/session-activation.d.ts +0 -13
- package/dist/session-activation.js +0 -64
- package/dist/session-activation.js.map +0 -1
- package/dist/session-attendant-probe.d.ts +0 -85
- package/dist/session-attendant-probe.js +0 -173
- package/dist/session-attendant-probe.js.map +0 -1
- package/dist/session-attendant-state.d.ts +0 -70
- package/dist/session-attendant-state.js +0 -256
- package/dist/session-attendant-state.js.map +0 -1
- package/dist/session-attendant.d.ts +0 -143
- package/dist/session-attendant.js +0 -520
- package/dist/session-attendant.js.map +0 -1
- package/dist/session-delivery.d.ts +0 -249
- package/dist/session-delivery.js +0 -576
- package/dist/session-delivery.js.map +0 -1
- package/dist/session-handoff.d.ts +0 -98
- package/dist/session-handoff.js +0 -118
- package/dist/session-handoff.js.map +0 -1
- package/dist/session-input-wakes.d.ts +0 -78
- package/dist/session-input-wakes.js +0 -239
- package/dist/session-input-wakes.js.map +0 -1
- package/dist/session-inputs.d.ts +0 -57
- package/dist/session-inputs.js +0 -434
- package/dist/session-inputs.js.map +0 -1
- package/dist/session-labels.d.ts +0 -56
- package/dist/session-labels.js +0 -396
- package/dist/session-labels.js.map +0 -1
- package/dist/session-message-handoff.d.ts +0 -39
- package/dist/session-message-handoff.js +0 -107
- package/dist/session-message-handoff.js.map +0 -1
- package/dist/setup-destinations.d.ts +0 -23
- package/dist/setup-destinations.js +0 -44
- package/dist/setup-destinations.js.map +0 -1
- package/dist/skill-integrity.d.ts +0 -54
- package/dist/skill-integrity.js +0 -164
- package/dist/skill-integrity.js.map +0 -1
- package/dist/skill-source/manifest.json +0 -40
- package/dist/skill-source/notifai/SKILL.md +0 -350
- package/dist/skill-source/notifai/references/diagnostics.md +0 -36
- package/dist/skill-source/notifai/references/harness-setup.md +0 -384
- package/dist/skill-source/notifai/references/native-questions.md +0 -51
- package/dist/skill-source/notifai/references/notes-and-edits.md +0 -54
- package/dist/skill-source/notifai/references/send-details.md +0 -14
- package/dist/skill-source/notifai/references/updates.md +0 -116
- package/dist/skill-source/notifai/references/writing-examples.md +0 -56
- package/dist/sound-ref.d.ts +0 -23
- package/dist/sound-ref.js +0 -28
- package/dist/sound-ref.js.map +0 -1
- package/dist/ui/banner.d.ts +0 -22
- package/dist/ui/banner.js +0 -87
- package/dist/ui/banner.js.map +0 -1
- package/dist/ui/config-view.d.ts +0 -30
- package/dist/ui/config-view.js +0 -108
- package/dist/ui/config-view.js.map +0 -1
- package/dist/ui/help.d.ts +0 -44
- package/dist/ui/help.js +0 -107
- package/dist/ui/help.js.map +0 -1
- package/dist/ui/theme.d.ts +0 -90
- package/dist/ui/theme.js +0 -244
- package/dist/ui/theme.js.map +0 -1
- package/dist/update-handoff.d.ts +0 -29
- package/dist/update-handoff.js +0 -69
- package/dist/update-handoff.js.map +0 -1
- package/dist/url-policy.d.ts +0 -85
- package/dist/url-policy.js +0 -369
- package/dist/url-policy.js.map +0 -1
- package/dist/version.d.ts +0 -40
- package/dist/version.js +0 -132
- package/dist/version.js.map +0 -1
- package/dist/wake-support.d.ts +0 -40
- package/dist/wake-support.js +0 -95
- package/dist/wake-support.js.map +0 -1
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import type { QuestionT, ReplyAnswerT } from '@raidiant/notifai-protocol';
|
|
2
|
-
import type { ServiceIdentity } from './credentials.js';
|
|
3
|
-
import type { PendingQuestion, SessionState } from './hook-types.js';
|
|
4
|
-
import type { NativeTurnSnapshot } from './codex-native-turn.js';
|
|
5
|
-
export interface CodexQuestionBinding {
|
|
6
|
-
question: QuestionT;
|
|
7
|
-
marker: string;
|
|
8
|
-
native?: {
|
|
9
|
-
turn_id: string;
|
|
10
|
-
call_id: string;
|
|
11
|
-
index: number;
|
|
12
|
-
};
|
|
13
|
-
/** Recomputed from a fresh full registration-turn snapshot before use. */
|
|
14
|
-
verified?: true;
|
|
15
|
-
/** A second occurrence permanently removes this marker's authority. */
|
|
16
|
-
ambiguous?: true;
|
|
17
|
-
}
|
|
18
|
-
export interface CodexQuestionRegistration {
|
|
19
|
-
question_id: string;
|
|
20
|
-
owner_key: string;
|
|
21
|
-
registration_turn_id: string;
|
|
22
|
-
transcript: {
|
|
23
|
-
file: string;
|
|
24
|
-
identity: string;
|
|
25
|
-
registered_offset: number;
|
|
26
|
-
};
|
|
27
|
-
service_identity: ServiceIdentity;
|
|
28
|
-
questions: CodexQuestionBinding[];
|
|
29
|
-
/** Positive receipt evidence only; never an unconfirmed reserved ID. */
|
|
30
|
-
confirmed_request_id?: string;
|
|
31
|
-
/** Ordinary presentation is sticky, including an uncertain stdout write. */
|
|
32
|
-
ordinary_only?: true;
|
|
33
|
-
/** Explicit retirement/withdrawal cannot become native authority again. */
|
|
34
|
-
terminated?: true;
|
|
35
|
-
}
|
|
36
|
-
export declare function nativeQuestionTitle(binding: CodexQuestionBinding): string;
|
|
37
|
-
/** Invocation-local service permission; never stored or reused for later asks. */
|
|
38
|
-
export interface NativeQuestionAdmission {
|
|
39
|
-
owner_key: string;
|
|
40
|
-
turn_id: string;
|
|
41
|
-
service: ServiceIdentity;
|
|
42
|
-
}
|
|
43
|
-
/** Read-only local eligibility. Registration repeats this under its lock. */
|
|
44
|
-
export declare function currentCodexQuestionContext(state: SessionState, sessionId: string, env: NodeJS.ProcessEnv): {
|
|
45
|
-
owner_key: string;
|
|
46
|
-
snapshot: NativeTurnSnapshot;
|
|
47
|
-
} | null;
|
|
48
|
-
/** Called by registration while holding the session lock. Capability absence
|
|
49
|
-
* leaves the ordinary registration untouched and creates no native authority.
|
|
50
|
-
*/
|
|
51
|
-
export declare function reserveCurrentCodexQuestion(state: SessionState, pending: PendingQuestion, sessionId: string, env: NodeJS.ProcessEnv, admission?: NativeQuestionAdmission): SessionState;
|
|
52
|
-
/** Caller holds the registration transaction and has proved the current owner.
|
|
53
|
-
* Reservation and pending registration must be saved in that single write.
|
|
54
|
-
* This creates no native question; only the agent's real tool call can do that.
|
|
55
|
-
*/
|
|
56
|
-
export declare function reserveCodexQuestion(state: SessionState, pending: PendingQuestion, key: string, snapshot: NativeTurnSnapshot): SessionState;
|
|
57
|
-
/** Count every marker occurrence before shape filtering. A changed-options
|
|
58
|
-
* duplicate is still ambiguous. Missing/truncated/replaced evidence removes
|
|
59
|
-
* current eligibility without forgetting the original tuple or ambiguity.
|
|
60
|
-
*/
|
|
61
|
-
export declare function observeCodexQuestions(state: SessionState, key: string, snapshot: NativeTurnSnapshot | null): SessionState;
|
|
62
|
-
/** Mark in the same transaction that consumes the ordinary app answer. */
|
|
63
|
-
export declare function markCodexOrdinaryPresentation(state: SessionState, questionIds: ReadonlySet<string>): SessionState;
|
|
64
|
-
/** Explicit cancellation only, in the transaction selecting the questions. */
|
|
65
|
-
export declare function terminateCodexQuestions(state: SessionState, ids: ReadonlySet<string>): SessionState;
|
|
66
|
-
/** Reservation protects early native answers before the emission observer runs.
|
|
67
|
-
* Apply after matching all pending questions, so sibling ambiguity is preserved.
|
|
68
|
-
*/
|
|
69
|
-
export declare function mayRetireFromPrompt(state: SessionState, pending: PendingQuestion): boolean;
|
|
70
|
-
/** The caller refreshes observation under the owner fence before admission.
|
|
71
|
-
* A fresh native answer remains reportable after ordinary app presentation.
|
|
72
|
-
*/
|
|
73
|
-
export declare function admitBoundNativeAnswer(state: SessionState, questionId: string, key: string, service: ServiceIdentity, answers: ReplyAnswerT[]): {
|
|
74
|
-
requestId?: string;
|
|
75
|
-
service: ServiceIdentity;
|
|
76
|
-
};
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
/** Local association of registered questions with actual accepted Codex forms. */
|
|
2
|
-
import { isDeepStrictEqual } from 'node:util';
|
|
3
|
-
import { readNativeQuestionSnapshot } from './codex-native-turn.js';
|
|
4
|
-
import { readSessionIncarnation, sessionHasEnded } from './hook-session-state.js';
|
|
5
|
-
import { currentCodexTurn } from './session-attendant-state.js';
|
|
6
|
-
import { processIdentityLiveness } from './process-identity.js';
|
|
7
|
-
export function nativeQuestionTitle(binding) {
|
|
8
|
-
return `[nf:${binding.marker}] ${binding.question.text}`;
|
|
9
|
-
}
|
|
10
|
-
/** Read-only local eligibility. Registration repeats this under its lock. */
|
|
11
|
-
export function currentCodexQuestionContext(state, sessionId, env) {
|
|
12
|
-
const owner = readSessionIncarnation(sessionId, env);
|
|
13
|
-
const proof = state.codex_native_turn;
|
|
14
|
-
if (state.harness !== 'codex' || owner === null || proof?.key !== owner.key || sessionHasEnded(sessionId, env) ||
|
|
15
|
-
owner.harness_process === undefined || processIdentityLiveness(owner.harness_process) !== 'alive' ||
|
|
16
|
-
state.codex_tool_hook?.incarnation !== owner.incarnation || state.codex_tool_hook.root_observed?.turn_id !== proof.turn_id ||
|
|
17
|
-
currentCodexTurn(sessionId, env, owner.key) !== proof.turn_id)
|
|
18
|
-
return null;
|
|
19
|
-
const snapshot = readNativeQuestionSnapshot(proof.transcript_path, sessionId, env);
|
|
20
|
-
if (snapshot === null || snapshot.latest.id !== proof.turn_id || snapshot.latest.ended)
|
|
21
|
-
return null;
|
|
22
|
-
return { owner_key: owner.key, snapshot };
|
|
23
|
-
}
|
|
24
|
-
/** Called by registration while holding the session lock. Capability absence
|
|
25
|
-
* leaves the ordinary registration untouched and creates no native authority.
|
|
26
|
-
*/
|
|
27
|
-
export function reserveCurrentCodexQuestion(state, pending, sessionId, env, admission) {
|
|
28
|
-
if (admission === undefined || !isDeepStrictEqual(admission.service, pending.service_identity))
|
|
29
|
-
return state;
|
|
30
|
-
const current = currentCodexQuestionContext(state, sessionId, env);
|
|
31
|
-
if (current === null || current.owner_key !== admission.owner_key || current.snapshot.latest.id !== admission.turn_id)
|
|
32
|
-
return state;
|
|
33
|
-
return reserveCodexQuestion(state, pending, current.owner_key, current.snapshot);
|
|
34
|
-
}
|
|
35
|
-
/** Caller holds the registration transaction and has proved the current owner.
|
|
36
|
-
* Reservation and pending registration must be saved in that single write.
|
|
37
|
-
* This creates no native question; only the agent's real tool call can do that.
|
|
38
|
-
*/
|
|
39
|
-
export function reserveCodexQuestion(state, pending, key, snapshot) {
|
|
40
|
-
if (state.harness !== 'codex' || pending.question_id === undefined || pending.service_identity === undefined ||
|
|
41
|
-
snapshot.latest.ended || snapshot.questions === undefined || !snapshot.positions.has(snapshot.latest.id) ||
|
|
42
|
-
pending.questions === undefined || pending.questions.length === 0 ||
|
|
43
|
-
pending.questions.some(question => question.multi === true) ||
|
|
44
|
-
state.codex_question_bindings?.some(item => item.question_id === pending.question_id))
|
|
45
|
-
return state;
|
|
46
|
-
const used = new Set((state.codex_question_bindings ?? []).flatMap(item => item.questions.map(q => q.marker)));
|
|
47
|
-
// Avoid even an unrelated previously emitted marker visible in this turn.
|
|
48
|
-
for (const emission of snapshot.questions) {
|
|
49
|
-
for (const match of emission.title.matchAll(/\[nf:([0-9A-Z]+)\]/g))
|
|
50
|
-
used.add(match[1]);
|
|
51
|
-
}
|
|
52
|
-
let counter = state.codex_question_marker_counter ?? 0;
|
|
53
|
-
if (!Number.isSafeInteger(counter) || counter < 0)
|
|
54
|
-
return state;
|
|
55
|
-
const questions = [];
|
|
56
|
-
for (const question of pending.questions) {
|
|
57
|
-
let marker;
|
|
58
|
-
do {
|
|
59
|
-
if (counter >= Number.MAX_SAFE_INTEGER)
|
|
60
|
-
return state;
|
|
61
|
-
marker = (++counter).toString(36).toUpperCase().padStart(3, '0');
|
|
62
|
-
} while (used.has(marker));
|
|
63
|
-
used.add(marker);
|
|
64
|
-
questions.push({ question: structuredClone(question), marker });
|
|
65
|
-
}
|
|
66
|
-
return { ...state, codex_question_marker_counter: counter, codex_question_bindings: [
|
|
67
|
-
...(state.codex_question_bindings ?? []), {
|
|
68
|
-
question_id: pending.question_id, owner_key: key, registration_turn_id: snapshot.latest.id,
|
|
69
|
-
transcript: { file: snapshot.file, identity: snapshot.identity, registered_offset: snapshot.size },
|
|
70
|
-
service_identity: { ...pending.service_identity }, questions,
|
|
71
|
-
},
|
|
72
|
-
] };
|
|
73
|
-
}
|
|
74
|
-
/** Count every marker occurrence before shape filtering. A changed-options
|
|
75
|
-
* duplicate is still ambiguous. Missing/truncated/replaced evidence removes
|
|
76
|
-
* current eligibility without forgetting the original tuple or ambiguity.
|
|
77
|
-
*/
|
|
78
|
-
export function observeCodexQuestions(state, key, snapshot) {
|
|
79
|
-
if (state.codex_question_bindings === undefined)
|
|
80
|
-
return state;
|
|
81
|
-
return { ...state, codex_question_bindings: state.codex_question_bindings.map(registration => {
|
|
82
|
-
const covered = registration.terminated !== true && registration.owner_key === key && snapshot !== null &&
|
|
83
|
-
snapshot.file === registration.transcript.file && snapshot.identity === registration.transcript.identity &&
|
|
84
|
-
snapshot.size >= registration.transcript.registered_offset && snapshot.positions.has(registration.registration_turn_id);
|
|
85
|
-
return { ...registration, questions: registration.questions.map(binding => {
|
|
86
|
-
const next = { ...binding };
|
|
87
|
-
delete next.verified;
|
|
88
|
-
if (!covered || binding.ambiguous === true)
|
|
89
|
-
return next;
|
|
90
|
-
const matches = snapshot.questions?.filter(emission => emission.accepted && emission.title.includes(`[nf:${binding.marker}]`)) ?? [];
|
|
91
|
-
// Count multiple copies of the token in a single title as ambiguous too.
|
|
92
|
-
if (matches.length > 1 || matches.some(emission => emission.title.split(`[nf:${binding.marker}]`).length !== 2)) {
|
|
93
|
-
return { ...next, ambiguous: true };
|
|
94
|
-
}
|
|
95
|
-
const emission = matches[0];
|
|
96
|
-
if (emission === undefined || emission.offset < registration.transcript.registered_offset ||
|
|
97
|
-
emission.turn_id !== registration.registration_turn_id ||
|
|
98
|
-
emission.title !== nativeQuestionTitle(binding) ||
|
|
99
|
-
!isDeepStrictEqual(emission.options, binding.question.choices?.map(choice => choice.label)))
|
|
100
|
-
return next;
|
|
101
|
-
const native = { turn_id: emission.turn_id, call_id: emission.call_id, index: emission.index };
|
|
102
|
-
if (binding.native !== undefined && !isDeepStrictEqual(binding.native, native))
|
|
103
|
-
return { ...next, ambiguous: true };
|
|
104
|
-
return { ...next, native, verified: true };
|
|
105
|
-
}) };
|
|
106
|
-
}) };
|
|
107
|
-
}
|
|
108
|
-
/** Mark in the same transaction that consumes the ordinary app answer. */
|
|
109
|
-
export function markCodexOrdinaryPresentation(state, questionIds) {
|
|
110
|
-
if (!state.codex_question_bindings?.some(item => questionIds.has(item.question_id)))
|
|
111
|
-
return state;
|
|
112
|
-
return { ...state, codex_question_bindings: state.codex_question_bindings.map(item => questionIds.has(item.question_id) ? { ...item, ordinary_only: true } : item) };
|
|
113
|
-
}
|
|
114
|
-
/** Explicit cancellation only, in the transaction selecting the questions. */
|
|
115
|
-
export function terminateCodexQuestions(state, ids) {
|
|
116
|
-
if (state.codex_question_bindings === undefined)
|
|
117
|
-
return state;
|
|
118
|
-
return { ...state, codex_question_bindings: state.codex_question_bindings.map(binding => ids.has(binding.question_id) || (binding.confirmed_request_id !== undefined && ids.has(binding.confirmed_request_id))
|
|
119
|
-
? { ...binding, terminated: true } : binding),
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
/** Reservation protects early native answers before the emission observer runs.
|
|
123
|
-
* Apply after matching all pending questions, so sibling ambiguity is preserved.
|
|
124
|
-
*/
|
|
125
|
-
export function mayRetireFromPrompt(state, pending) {
|
|
126
|
-
return !state.codex_question_bindings?.some(item => item.question_id === pending.question_id);
|
|
127
|
-
}
|
|
128
|
-
/** The caller refreshes observation under the owner fence before admission.
|
|
129
|
-
* A fresh native answer remains reportable after ordinary app presentation.
|
|
130
|
-
*/
|
|
131
|
-
export function admitBoundNativeAnswer(state, questionId, key, service, answers) {
|
|
132
|
-
const registration = state.codex_question_bindings?.find(item => item.question_id === questionId);
|
|
133
|
-
if (registration === undefined || registration.terminated === true || registration.owner_key !== key || !isDeepStrictEqual(registration.service_identity, service)) {
|
|
134
|
-
throw new Error('The native question is not registered to this owner and Approved Machine.');
|
|
135
|
-
}
|
|
136
|
-
if (answers.length === 0 || new Set(answers.map(answer => answer.question_id)).size !== answers.length)
|
|
137
|
-
throw new Error('Native answers must name distinct registered questions.');
|
|
138
|
-
for (const answer of answers) {
|
|
139
|
-
const binding = registration.questions.find(item => item.question.id === answer.question_id);
|
|
140
|
-
const choices = answer.choice_ids ?? [];
|
|
141
|
-
if (binding?.verified !== true || binding.native === undefined || binding.ambiguous === true ||
|
|
142
|
-
new Set(choices).size !== choices.length || (binding.question.multi !== true && choices.length > 1) ||
|
|
143
|
-
choices.some(id => !binding.question.choices?.some(choice => choice.id === id)) ||
|
|
144
|
-
(choices.length === 0 && !answer.text?.trim())) {
|
|
145
|
-
throw new Error('The answer does not match one verified native question and its registered choices.');
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return { service: registration.service_identity,
|
|
149
|
-
...(registration.confirmed_request_id === undefined ? {} : { requestId: registration.confirmed_request_id }) };
|
|
150
|
-
}
|
|
151
|
-
//# sourceMappingURL=codex-question-bindings.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codex-question-bindings.js","sourceRoot":"","sources":["../src/codex-question-bindings.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAK7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAA;AACnE,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AA2B/D,MAAM,UAAU,mBAAmB,CAAC,OAA6B;IAC/D,OAAO,OAAO,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAA;AAC1D,CAAC;AASD,6EAA6E;AAC7E,MAAM,UAAU,2BAA2B,CAAC,KAAmB,EAAE,SAAiB,EAAE,GAAsB;IAExG,MAAM,KAAK,GAAG,sBAAsB,CAAC,SAAS,EAAE,GAAG,CAAC,CAAA;IACpD,MAAM,KAAK,GAAG,KAAK,CAAC,iBAAiB,CAAA;IACrC,IAAI,KAAK,CAAC,OA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O,CAAC,QAAQ,CAAC,KAAK,KAAK,IAAI,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;YACnG,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;YAC/E,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;YACnD,MAAM,IAAI,KAAK,CAAC,oFAAoF,CAAC,CAAA;QACvG,CAAC;IACH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,gBAAgB;QAC7C,GAAG,CAAC,YAAY,CAAC,oBAAoB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,YAAY,CAAC,oBAAoB,EAAE,CAAC,EAAE,CAAA;AAClH,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export interface NativeQueueItem {
|
|
2
|
-
id: string;
|
|
3
|
-
clientUserMessageId: string;
|
|
4
|
-
input: Array<{
|
|
5
|
-
type: string;
|
|
6
|
-
text?: string;
|
|
7
|
-
}>;
|
|
8
|
-
}
|
|
9
|
-
export interface QueueControl {
|
|
10
|
-
namespace: string;
|
|
11
|
-
threadId: string;
|
|
12
|
-
add(token: string, text: string): Promise<string>;
|
|
13
|
-
find(token: string, text: string): Promise<'absent' | 'ambiguous' | {
|
|
14
|
-
id: string;
|
|
15
|
-
}>;
|
|
16
|
-
remove(id: string): Promise<boolean>;
|
|
17
|
-
close(): void;
|
|
18
|
-
}
|
|
19
|
-
/** Missing queue capability is a preflight result. Errors after add starts
|
|
20
|
-
* remain uncertain acceptance and cannot authorize another writer. */
|
|
21
|
-
export declare function connectCodexQueue(sessionId: string, env: NodeJS.ProcessEnv, deadlineAt: number, now?: () => number, unavailable?: (stage: string) => void): Promise<QueueControl | null>;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/** Optional exact queue capability on a verified existing Codex connection. */
|
|
2
|
-
import { connectCodexControl } from './codex-native-control.js';
|
|
3
|
-
/** Missing queue capability is a preflight result. Errors after add starts
|
|
4
|
-
* remain uncertain acceptance and cannot authorize another writer. */
|
|
5
|
-
export async function connectCodexQueue(sessionId, env, deadlineAt, now = () => performance.now(), unavailable) {
|
|
6
|
-
const control = await connectCodexControl(sessionId, env, deadlineAt, now, unavailable);
|
|
7
|
-
if (control === null)
|
|
8
|
-
return null;
|
|
9
|
-
const call = control.call;
|
|
10
|
-
try {
|
|
11
|
-
const list = async () => {
|
|
12
|
-
const all = [];
|
|
13
|
-
let cursor = null;
|
|
14
|
-
for (let page = 0; page < 16; page += 1) {
|
|
15
|
-
const result = await call('thread/queue/list', { threadId: sessionId, ...(cursor === null ? {} : { cursor }) });
|
|
16
|
-
if (!Array.isArray(result.data) || !result.data.every(item => typeof item.id === 'string' && typeof item.clientUserMessageId === 'string' && Array.isArray(item.input)))
|
|
17
|
-
throw new Error('Unrecognized native queue response');
|
|
18
|
-
all.push(...result.data);
|
|
19
|
-
if (result.nextCursor === null)
|
|
20
|
-
return all;
|
|
21
|
-
if (typeof result.nextCursor !== 'string' || result.nextCursor === cursor)
|
|
22
|
-
throw new Error('Unrecognized native queue cursor');
|
|
23
|
-
cursor = result.nextCursor;
|
|
24
|
-
}
|
|
25
|
-
throw new Error('Native queue inspection exceeded its bound');
|
|
26
|
-
};
|
|
27
|
-
await list(); // Capability check before any mutation or election.
|
|
28
|
-
return {
|
|
29
|
-
namespace: control.namespace,
|
|
30
|
-
threadId: sessionId,
|
|
31
|
-
add: async (token, text) => {
|
|
32
|
-
const response = await call('thread/queue/add', { threadId: sessionId, clientUserMessageId: token, input: [{ type: 'text', text }] });
|
|
33
|
-
if (typeof response.queuedSubmission?.id !== 'string' || response.queuedSubmission.clientUserMessageId !== token)
|
|
34
|
-
throw new Error('Native queue receipt unknown');
|
|
35
|
-
return response.queuedSubmission.id;
|
|
36
|
-
},
|
|
37
|
-
find: async (token, text) => {
|
|
38
|
-
const matches = (await list()).filter(item => item.clientUserMessageId === token);
|
|
39
|
-
if (matches.length === 0)
|
|
40
|
-
return 'absent';
|
|
41
|
-
const match = matches[0];
|
|
42
|
-
return matches.length === 1 && match.input.length === 1 && match.input[0]?.type === 'text' && match.input[0].text === text ? { id: match.id } : 'ambiguous';
|
|
43
|
-
},
|
|
44
|
-
remove: async (id) => {
|
|
45
|
-
const result = await call('thread/queue/delete', { threadId: sessionId, queuedSubmissionId: id });
|
|
46
|
-
if (typeof result.deleted !== 'boolean')
|
|
47
|
-
throw new Error('Native queue deletion unknown');
|
|
48
|
-
return result.deleted;
|
|
49
|
-
},
|
|
50
|
-
close: () => control.close(),
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
catch {
|
|
54
|
-
control.close();
|
|
55
|
-
unavailable?.('queue-list');
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=codex-queue-control.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codex-queue-control.js","sourceRoot":"","sources":["../src/codex-queue-control.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAY/D;sEACsE;AACtE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,SAAiB,EAAE,GAAsB,EAAE,UAAkB,EAC7D,MAAoB,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAC3C,WAAqC;IAErC,MAAM,OAAO,GAAG,MAAM,mBAAmB,CAAC,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,WAAW,CAAC,CAAA;IACvF,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,IAAI,CAAA;IACjC,MAA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CAAA;YAC7J,CAAC;YACD,MAAM,EAAE,KAAK,EAAC,EAAE,EAAC,EAAE;gBACjB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,qBAAqB,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,kBAAkB,EAAE,EAAE,EAAE,CAA0B,CAAA;gBAC1H,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,SAAS;oBAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAA;gBACzF,OAAO,MAAM,CAAC,OAAO,CAAA;YACvB,CAAC;YACD,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE;SAC7B,CAAA;IACH,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,KAAK,EAAE,CAAA;QACf,WAAW,EAAE,CAAC,YAAY,CAAC,CAAA;QAC3B,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type CommandDeps } from './commands-core.js';
|
|
2
|
-
import type { HookEnvelope } from './hook-types.js';
|
|
3
|
-
import type { Logger } from './logging.js';
|
|
4
|
-
export declare function codexToolHookReady(deps: Pick<CommandDeps, 'env' | 'hookAdapterHome' | 'hookPlatform'>, sessionId: string): boolean;
|
|
5
|
-
export declare const CODEX_TOOL_HOOK_RECOVERY = "Wait for a real tool callback in this turn. If tools complete but this remains unverified, Codex may retain an older hook configuration in memory even when /hooks lists trusted, active definitions. In the existing session, open /hooks and toggle only the already-trusted Notifai PostToolUse handler off and back on to refresh it, then verify the next callback. Do not change approvals or end the Agent Session. The ordinary queue can wait until the active turn finishes; queue acceptance does not prove busy delivery.";
|
|
6
|
-
/** Notes and answers share one bounded stdout document at the trusted boundary. */
|
|
7
|
-
export declare function deliverCodexToolMessage(deps: CommandDeps, envelope: HookEnvelope, logger: Logger): Promise<void>;
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/** A trusted Codex tool boundary observes the turn and drains shared pending input. */
|
|
2
|
-
import { drainSessionInputs, hasSessionInputs } from './session-inputs.js';
|
|
3
|
-
import { makeClient } from './commands-core.js';
|
|
4
|
-
import { readSessionIncarnation, readSessionState, sessionHasEnded, updateSessionState } from './hook-session-state.js';
|
|
5
|
-
import { codexHookIdentityHash, codexTrustKey, codexTrustProblems, findInstallations, handlerEvent } from './install-hooks.js';
|
|
6
|
-
import { currentProcessIdentity, processIdentityLiveness } from './process-identity.js';
|
|
7
|
-
import { currentCodexTurn, readAttendantLease, recordTurnStart } from './session-attendant-state.js';
|
|
8
|
-
import { refreshCodexInputActivity } from './codex-input-lifecycle.js';
|
|
9
|
-
import { readNativeQuestionSnapshot } from './codex-native-turn.js';
|
|
10
|
-
import { observeCodexQuestions } from './codex-question-bindings.js';
|
|
11
|
-
import { codexAnswerPresentation } from './codex-answer-presentation.js';
|
|
12
|
-
import { isDeepStrictEqual } from 'node:util';
|
|
13
|
-
/** Missing, disabled, changed or untrusted hooks retain ordinary queue delivery. */
|
|
14
|
-
function toolHookFingerprint(deps) {
|
|
15
|
-
const installations = findInstallations(deps.env, deps.hookAdapterHome, deps.hookPlatform)
|
|
16
|
-
.filter((installation) => installation.harness === 'codex');
|
|
17
|
-
if (installations.some((installation) => (installation.problems ?? []).length > 0))
|
|
18
|
-
return null;
|
|
19
|
-
const hooks = installations.flatMap((installation) => installation.handlers
|
|
20
|
-
.filter((handler) => ['post-tool-use', 'user-prompt-submit'].includes(handlerEvent(handler.command) ?? ''))
|
|
21
|
-
.map((handler) => ({ installation, handler })));
|
|
22
|
-
if (hooks.length !== 2 || !['PostToolUse', 'UserPromptSubmit'].every((event) => hooks.some(({ handler }) => handler.event === event)))
|
|
23
|
-
return null;
|
|
24
|
-
if (hooks.some(({ installation, handler }) => handler.async === true || handler.asyncRewake === true ||
|
|
25
|
-
codexTrustProblems([{ ...installation, handlers: [handler] }], deps.env).length !== 0))
|
|
26
|
-
return null;
|
|
27
|
-
return hooks.map(({ installation, handler }) => `${codexTrustKey(installation, handler)}:${codexHookIdentityHash(handler)}`).sort().join('|');
|
|
28
|
-
}
|
|
29
|
-
export function codexToolHookReady(deps, sessionId) {
|
|
30
|
-
const fingerprint = toolHookFingerprint(deps);
|
|
31
|
-
const proof = readSessionState(sessionId, deps.env).codex_tool_hook;
|
|
32
|
-
const incarnation = readSessionIncarnation(sessionId, deps.env);
|
|
33
|
-
const turn = incarnation === null ? null : currentCodexTurn(sessionId, deps.env, incarnation.key);
|
|
34
|
-
return fingerprint !== null && proof?.fingerprint === fingerprint &&
|
|
35
|
-
proof.incarnation === incarnation?.incarnation && proof.root_observed !== undefined &&
|
|
36
|
-
(turn === null || proof.root_observed.turn_id === turn);
|
|
37
|
-
}
|
|
38
|
-
export const CODEX_TOOL_HOOK_RECOVERY = 'Wait for a real tool callback in this turn. If tools complete but this remains unverified, Codex may retain an older hook configuration in memory even when /hooks lists trusted, active definitions. In the existing session, open /hooks and toggle only the already-trusted Notifai PostToolUse handler off and back on to refresh it, then verify the next callback. Do not change approvals or end the Agent Session. The ordinary queue can wait until the active turn finishes; queue acceptance does not prove busy delivery.';
|
|
39
|
-
/** Notes and answers share one bounded stdout document at the trusted boundary. */
|
|
40
|
-
export async function deliverCodexToolMessage(deps, envelope, logger) {
|
|
41
|
-
const sessionId = envelope.session_id;
|
|
42
|
-
if (sessionId === undefined || envelope.hook_event_name !== 'PostToolUse' ||
|
|
43
|
-
typeof envelope.turn_id !== 'string' || envelope.turn_id === '')
|
|
44
|
-
return;
|
|
45
|
-
const incarnation = readSessionIncarnation(sessionId, deps.env);
|
|
46
|
-
const sourcePid = Number(deps.env['NOTIFAI_HOOK_SOURCE_PID']);
|
|
47
|
-
const owner = incarnation?.harness_process;
|
|
48
|
-
if (incarnation === null || owner === undefined || owner.pid !== sourcePid)
|
|
49
|
-
return;
|
|
50
|
-
const ownsRoot = () => {
|
|
51
|
-
const current = readSessionIncarnation(sessionId, deps.env);
|
|
52
|
-
return !sessionHasEnded(sessionId, deps.env) && current?.key === incarnation.key &&
|
|
53
|
-
current.incarnation === incarnation.incarnation &&
|
|
54
|
-
processIdentityLiveness(owner) === 'alive';
|
|
55
|
-
};
|
|
56
|
-
// Seeing a definition on disk does not prove an already-running Codex loaded
|
|
57
|
-
// it. Only this exact session's real tool invocation enables busy delivery.
|
|
58
|
-
const fingerprint = toolHookFingerprint(deps);
|
|
59
|
-
if (fingerprint === null || !ownsRoot())
|
|
60
|
-
return;
|
|
61
|
-
// Automatic continuations need not emit UserPromptSubmit. A trusted,
|
|
62
|
-
// synchronous tool callback from this exact owner is also a turn observation.
|
|
63
|
-
// recordTurnStart ignores previously seen/ended turns, so a late callback
|
|
64
|
-
// cannot resurrect an interrupted turn or replace a newer observed turn.
|
|
65
|
-
if (currentCodexTurn(sessionId, deps.env, incarnation.key) !== envelope.turn_id) {
|
|
66
|
-
recordTurnStart(sessionId, deps.env, incarnation.key, envelope.turn_id);
|
|
67
|
-
}
|
|
68
|
-
const mayObserve = () => ownsRoot() &&
|
|
69
|
-
currentCodexTurn(sessionId, deps.env, incarnation.key) === envelope.turn_id;
|
|
70
|
-
if (!mayObserve())
|
|
71
|
-
return;
|
|
72
|
-
refreshCodexInputActivity(sessionId, deps.env, incarnation.key, envelope.transcript_path);
|
|
73
|
-
if (!mayObserve())
|
|
74
|
-
return;
|
|
75
|
-
if (readSessionState(sessionId, deps.env).codex_question_bindings?.length) {
|
|
76
|
-
const snapshot = readNativeQuestionSnapshot(envelope.transcript_path, sessionId, deps.env);
|
|
77
|
-
updateSessionState(sessionId, deps.env, state => mayObserve() ? observeCodexQuestions(state, incarnation.key, snapshot) : state);
|
|
78
|
-
}
|
|
79
|
-
const proof = readSessionState(sessionId, deps.env).codex_tool_hook;
|
|
80
|
-
if (proof?.incarnation !== incarnation.incarnation || proof.fingerprint !== fingerprint ||
|
|
81
|
-
proof.root_observed?.turn_id !== envelope.turn_id) {
|
|
82
|
-
updateSessionState(sessionId, deps.env, (state) => !mayObserve() ? state : ({
|
|
83
|
-
...state, codex_tool_hook: { incarnation: incarnation.incarnation, fingerprint,
|
|
84
|
-
root_observed: { turn_id: envelope.turn_id, at: (deps.now ?? Date.now)() } },
|
|
85
|
-
}));
|
|
86
|
-
}
|
|
87
|
-
// A fresh session may have no service lease until its first question exists.
|
|
88
|
-
// Callback evidence permits registration; only a current lease permits input.
|
|
89
|
-
const lease = readAttendantLease(sessionId, deps.env);
|
|
90
|
-
if (lease === null || lease.incarnation !== incarnation.incarnation)
|
|
91
|
-
return;
|
|
92
|
-
const mayWrite = () => {
|
|
93
|
-
const current = readAttendantLease(sessionId, deps.env);
|
|
94
|
-
return mayObserve() && current?.incarnation === lease.incarnation && current.generation === lease.generation;
|
|
95
|
-
};
|
|
96
|
-
if (!hasSessionInputs(sessionId, deps.env, lease) || !mayWrite())
|
|
97
|
-
return;
|
|
98
|
-
const credential = deps.store.load();
|
|
99
|
-
const writer = currentProcessIdentity();
|
|
100
|
-
if (credential === null || writer === null)
|
|
101
|
-
return;
|
|
102
|
-
const now = deps.now ?? Date.now;
|
|
103
|
-
const deadlineAt = now() + 2_000;
|
|
104
|
-
const mayDeliver = () => now() < deadlineAt && mayWrite();
|
|
105
|
-
const client = makeClient(deps, credential.baseUrl, `Bearer nfm_${credential.machineId}.${credential.secret}`, {
|
|
106
|
-
timeoutMs: 750, deadlineAt, now,
|
|
107
|
-
});
|
|
108
|
-
await drainSessionInputs({
|
|
109
|
-
lease,
|
|
110
|
-
mayWrite: mayDeliver,
|
|
111
|
-
nativeAnswers: codexAnswerPresentation({ sessionId, env: deps.env, lease, ownerKey: incarnation.key,
|
|
112
|
-
turnId: envelope.turn_id, transcriptPath: envelope.transcript_path,
|
|
113
|
-
service: { base_url: credential.baseUrl, machine_id: credential.machineId },
|
|
114
|
-
deadline: performance.now() + 2_000, mayWrite: mayDeliver,
|
|
115
|
-
serviceCurrent: () => isDeepStrictEqual(deps.store.load(), credential) }),
|
|
116
|
-
sequencer: {
|
|
117
|
-
sessionId, env: deps.env, client, writer, log: logger,
|
|
118
|
-
monotonic: () => performance.now(), wall: now,
|
|
119
|
-
recoveryDeadline: performance.now() + 500,
|
|
120
|
-
sleep: async (ms) => { if (now() < deadlineAt)
|
|
121
|
-
await new Promise((resolve) => setTimeout(resolve, Math.min(ms, deadlineAt - now()))); },
|
|
122
|
-
},
|
|
123
|
-
write: (text) => deps.io.out(JSON.stringify({ hookSpecificOutput: { hookEventName: 'PostToolUse', additionalContext: text } })),
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
//# sourceMappingURL=codex-tool-messages.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codex-tool-messages.js","sourceRoot":"","sources":["../src/codex-tool-messages.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAC1E,OAAO,EAAoB,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACjE,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGvH,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAC9H,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AACvF,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AACpG,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAA;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAA;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAE7C,oFAAoF;AACpF,SAAS,mBAAmB,CA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AO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,UAAU,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC;SACvI;QACD,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,kBAAkB,EAAE,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;KAChI,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/codex-wake.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { type EscalationDeliveryRoute } from './hook-types.js';
|
|
2
|
-
/**
|
|
3
|
-
* The per-thread durable inbox `codex queue` writes to, relative to `$CODEX_HOME`.
|
|
4
|
-
*
|
|
5
|
-
* Named for diagnostics only. Notifai never opens it: the schema is private to
|
|
6
|
-
* Codex, versioned by its own migration table, and the supported writer is the
|
|
7
|
-
* CLI. Reading it here would couple Notifai to an internal shape it does not own.
|
|
8
|
-
*/
|
|
9
|
-
export declare const CODEX_QUEUE_STORE_FILE = "queue_1.sqlite";
|
|
10
|
-
export interface CodexWakeAdapters {
|
|
11
|
-
/**
|
|
12
|
-
* Write one message into the thread's durable inbox via `codex queue`.
|
|
13
|
-
* `onSpawn` receives the child's own process group as soon as it exists.
|
|
14
|
-
* When `signal` aborts, the whole group is killed and the call rejects:
|
|
15
|
-
* a claimed write never outlives its claim.
|
|
16
|
-
*/
|
|
17
|
-
queue(threadId: string, cwd: string, context: string, onSpawn?: (pgid: number) => void, signal?: AbortSignal): Promise<void>;
|
|
18
|
-
/**
|
|
19
|
-
* Whether the `codex` executable `queue` runs can be found at all. A
|
|
20
|
-
* resident writer asks once, before it offers to take Session Messages.
|
|
21
|
-
*/
|
|
22
|
-
available?(): boolean;
|
|
23
|
-
}
|
|
24
|
-
export type CodexQueueReadiness = {
|
|
25
|
-
state: 'ready';
|
|
26
|
-
threadId: string;
|
|
27
|
-
} | {
|
|
28
|
-
state: 'unavailable';
|
|
29
|
-
reason: string;
|
|
30
|
-
};
|
|
31
|
-
export declare function codexHome(env: NodeJS.ProcessEnv): string;
|
|
32
|
-
export declare function codexQueueStorePath(env: NodeJS.ProcessEnv): string;
|
|
33
|
-
/**
|
|
34
|
-
* Whether this Stop hook could queue an answer into its own thread.
|
|
35
|
-
*
|
|
36
|
-
* The only precondition the route actually has is an exact thread id: queueing
|
|
37
|
-
* needs no writer lock, no daemon, no socket and no platform syscall, and it
|
|
38
|
-
* succeeds against a live, busy or stopped thread alike. The absence of the
|
|
39
|
-
* queue store is deliberately *not* a blocker — Codex creates it on first
|
|
40
|
-
* write — so this reports readiness, never a store-existence gate.
|
|
41
|
-
*/
|
|
42
|
-
export declare function inspectCodexQueue(threadId: string | undefined, _env: NodeJS.ProcessEnv): CodexQueueReadiness;
|
|
43
|
-
/**
|
|
44
|
-
* Low-level exact-thread wake transport. Production callers wrap this route
|
|
45
|
-
* with sessionInputRoute: only a content-free wake goes into the native queue,
|
|
46
|
-
* and the foreground consumer claims current input immediately before stdout.
|
|
47
|
-
*
|
|
48
|
-
* Queue exit 0 proves storage, never presentation. A busy owner may consume
|
|
49
|
-
* the wake much later; an exited thread keeps it until reopened. There is no
|
|
50
|
-
* cold-resume path here, which would consume the queue and a repeated prompt.
|
|
51
|
-
*/
|
|
52
|
-
export declare function codexWakeRoute(options: {
|
|
53
|
-
threadId: string;
|
|
54
|
-
cwd: string;
|
|
55
|
-
env?: NodeJS.ProcessEnv;
|
|
56
|
-
adapters?: CodexWakeAdapters;
|
|
57
|
-
}): EscalationDeliveryRoute;
|
|
58
|
-
export declare function systemCodexWakeAdapters(env?: NodeJS.ProcessEnv): CodexWakeAdapters;
|