@raidiant/notifai 10.1.0 → 10.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/README.md +3 -0
- package/dist/cli-bin.d.ts +21 -1
- package/dist/cli-bin.js +141 -10
- package/dist/cli-bin.js.map +1 -1
- package/dist/cli-update-contract.d.ts +7 -0
- package/dist/cli-update-contract.js +10 -0
- package/dist/cli-update-contract.js.map +1 -0
- package/dist/client.d.ts +6 -1
- package/dist/client.js +1 -0
- package/dist/client.js.map +1 -1
- package/dist/codex-wake.d.ts +2 -0
- package/dist/codex-wake.js +2 -1
- package/dist/codex-wake.js.map +1 -1
- package/dist/commands-auth.d.ts +15 -1
- package/dist/commands-auth.js +29 -11
- package/dist/commands-auth.js.map +1 -1
- package/dist/commands-core.d.ts +9 -2
- package/dist/commands-core.js +11 -4
- package/dist/commands-core.js.map +1 -1
- package/dist/commands-devices.d.ts +10 -1
- package/dist/commands-devices.js +17 -13
- package/dist/commands-devices.js.map +1 -1
- package/dist/commands-doctor.js +93 -49
- package/dist/commands-doctor.js.map +1 -1
- package/dist/commands-hooks.js +47 -10
- package/dist/commands-hooks.js.map +1 -1
- package/dist/commands-init.d.ts +16 -0
- package/dist/commands-init.js +254 -93
- package/dist/commands-init.js.map +1 -1
- package/dist/commands-send-support.js +3 -0
- package/dist/commands-send-support.js.map +1 -1
- package/dist/commands-send.d.ts +1 -1
- package/dist/commands-send.js +121 -35
- package/dist/commands-send.js.map +1 -1
- package/dist/commands-skill.js +72 -54
- package/dist/commands-skill.js.map +1 -1
- package/dist/commands-update.d.ts +10 -0
- package/dist/commands-update.js +141 -0
- package/dist/commands-update.js.map +1 -0
- package/dist/commands.d.ts +2 -1
- package/dist/commands.js +2 -1
- package/dist/commands.js.map +1 -1
- package/dist/hook-adapter.d.ts +2 -0
- package/dist/hook-adapter.js +12 -1
- package/dist/hook-adapter.js.map +1 -1
- package/dist/hooks.d.ts +43 -2
- package/dist/hooks.js +163 -21
- package/dist/hooks.js.map +1 -1
- package/dist/invocation-context.d.ts +1 -0
- package/dist/invocation-context.js +9 -1
- package/dist/invocation-context.js.map +1 -1
- package/dist/main-run.d.ts +1 -0
- package/dist/main-run.js +42 -0
- package/dist/main-run.js.map +1 -0
- package/dist/main.js +10 -31
- package/dist/main.js.map +1 -1
- package/dist/native-skills.d.ts +13 -3
- package/dist/native-skills.js +51 -12
- package/dist/native-skills.js.map +1 -1
- package/dist/node-floor.d.ts +19 -0
- package/dist/node-floor.js +39 -0
- package/dist/node-floor.js.map +1 -0
- package/dist/orca-session-title.d.ts +5 -4
- package/dist/orca-session-title.js +32 -19
- package/dist/orca-session-title.js.map +1 -1
- package/dist/platform.d.ts +11 -17
- package/dist/platform.js +20 -23
- package/dist/platform.js.map +1 -1
- package/dist/program.d.ts +2 -1
- package/dist/program.js +22 -5
- package/dist/program.js.map +1 -1
- package/dist/question-settlement-process.d.ts +15 -0
- package/dist/question-settlement-process.js +35 -0
- package/dist/question-settlement-process.js.map +1 -0
- package/dist/readiness.d.ts +25 -1
- package/dist/readiness.js +32 -2
- package/dist/readiness.js.map +1 -1
- package/dist/release.d.ts +5 -5
- package/dist/release.js +5 -5
- package/dist/setup-destinations.d.ts +23 -0
- package/dist/setup-destinations.js +44 -0
- package/dist/setup-destinations.js.map +1 -0
- package/dist/skill-integrity.d.ts +49 -0
- package/dist/skill-integrity.js +154 -0
- package/dist/skill-integrity.js.map +1 -0
- package/dist/skill-source/manifest.json +16 -0
- package/dist/skill-source/notifai/SKILL.md +390 -0
- package/dist/skill-source/notifai/references/harness-setup.md +220 -0
- package/package.json +11 -14
- package/src/atomic-file.ts +0 -198
- package/src/claude-wake.test.ts +0 -321
- package/src/claude-wake.ts +0 -499
- package/src/cli-bin.test.ts +0 -38
- package/src/cli-bin.ts +0 -67
- package/src/cli-release.test.ts +0 -46
- package/src/cli-release.ts +0 -78
- package/src/client.test.ts +0 -390
- package/src/client.ts +0 -345
- package/src/codex-wake.test.ts +0 -254
- package/src/codex-wake.ts +0 -297
- package/src/command-session.ts +0 -38
- package/src/commands-agent-sessions.ts +0 -72
- package/src/commands-auth.ts +0 -205
- package/src/commands-config.ts +0 -336
- package/src/commands-core.ts +0 -298
- package/src/commands-devices.test.ts +0 -15
- package/src/commands-devices.ts +0 -173
- package/src/commands-doctor.ts +0 -1440
- package/src/commands-guidance.ts +0 -181
- package/src/commands-harness-context.ts +0 -207
- package/src/commands-hook-shape.ts +0 -69
- package/src/commands-hooks.ts +0 -2268
- package/src/commands-init.ts +0 -878
- package/src/commands-io.ts +0 -108
- package/src/commands-logs.ts +0 -243
- package/src/commands-project.ts +0 -47
- package/src/commands-send-support.test.ts +0 -156
- package/src/commands-send-support.ts +0 -311
- package/src/commands-send.ts +0 -769
- package/src/commands-setup-proof.test.ts +0 -72
- package/src/commands-setup-proof.ts +0 -124
- package/src/commands-skill.test.ts +0 -44
- package/src/commands-skill.ts +0 -204
- package/src/commands-sounds.test.ts +0 -106
- package/src/commands-sounds.ts +0 -49
- package/src/commands.test.ts +0 -7828
- package/src/commands.ts +0 -75
- package/src/config-schema.test.ts +0 -153
- package/src/config-schema.ts +0 -349
- package/src/config.test.ts +0 -581
- package/src/config.ts +0 -475
- package/src/credentials.test.ts +0 -403
- package/src/credentials.ts +0 -403
- package/src/file-lock-process-worker.test.ts +0 -64
- package/src/file-lock.test.ts +0 -320
- package/src/file-lock.ts +0 -393
- package/src/fixtures/hermes-0.20.6-classic-cli-local.json +0 -50
- package/src/fixtures/openclaw-2026.7.1-2-agent-local.json +0 -57
- package/src/generated-session-label.ts +0 -155
- package/src/guidance-content.ts +0 -278
- package/src/guidance-render.ts +0 -56
- package/src/guidance.test.ts +0 -327
- package/src/guidance.ts +0 -233
- package/src/harness-integration.test.ts +0 -294
- package/src/harnesses.test.ts +0 -149
- package/src/harnesses.ts +0 -164
- package/src/hook-adapter.test.ts +0 -496
- package/src/hook-adapter.ts +0 -410
- package/src/hook-input.test.ts +0 -39
- package/src/hook-input.ts +0 -72
- package/src/hooks.test.ts +0 -5549
- package/src/hooks.ts +0 -3759
- package/src/install-hooks.test.ts +0 -1614
- package/src/install-hooks.ts +0 -1501
- package/src/interactive.test.ts +0 -387
- package/src/interactive.ts +0 -858
- package/src/invocation-context.test.ts +0 -352
- package/src/invocation-context.ts +0 -197
- package/src/logging-process-worker.test.ts +0 -45
- package/src/logging.test.ts +0 -544
- package/src/logging.ts +0 -698
- package/src/main.ts +0 -36
- package/src/native-skills.test.ts +0 -115
- package/src/native-skills.ts +0 -162
- package/src/onboarding-docs.test.ts +0 -25
- package/src/openclaw-plugin.ts +0 -409
- package/src/opencode-plugin.ts +0 -298
- package/src/orca-session-title.test.ts +0 -54
- package/src/orca-session-title.ts +0 -103
- package/src/pack-feedback-slice.test.ts +0 -212
- package/src/pack-feedback-slice.ts +0 -187
- package/src/platform.test.ts +0 -152
- package/src/platform.ts +0 -173
- package/src/program.test.ts +0 -282
- package/src/program.ts +0 -818
- package/src/project-enablement.test.ts +0 -55
- package/src/project-enablement.ts +0 -99
- package/src/question-caps.test.ts +0 -49
- package/src/question-timing.ts +0 -56
- package/src/readiness.test.ts +0 -25
- package/src/readiness.ts +0 -179
- package/src/release.ts +0 -51
- package/src/send-attempts.test.ts +0 -143
- package/src/send-attempts.ts +0 -188
- package/src/send.test.ts +0 -28
- package/src/send.ts +0 -436
- package/src/session-activation.ts +0 -61
- package/src/session-end-log-lock-worker.test.ts +0 -35
- package/src/session-labels.test.ts +0 -490
- package/src/session-labels.ts +0 -474
- package/src/skill.test.ts +0 -415
- package/src/sound-ref.test.ts +0 -31
- package/src/sound-ref.ts +0 -34
- package/src/trust-policy.test.ts +0 -701
- package/src/ui/banner.ts +0 -95
- package/src/ui/config-view.test.ts +0 -90
- package/src/ui/config-view.ts +0 -138
- package/src/ui/help.test.ts +0 -16
- package/src/ui/help.ts +0 -128
- package/src/ui/theme.test.ts +0 -92
- package/src/ui/theme.ts +0 -265
- package/src/url-policy.ts +0 -399
- package/tsconfig.json +0 -10
package/src/commands.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
EXIT,
|
|
3
|
-
log,
|
|
4
|
-
type CommandDeps,
|
|
5
|
-
type CommandIo,
|
|
6
|
-
type CommandSpinner,
|
|
7
|
-
} from './commands-core.js'
|
|
8
|
-
export {
|
|
9
|
-
accessStatusCommand,
|
|
10
|
-
authStatusCommand,
|
|
11
|
-
loginCommand,
|
|
12
|
-
logoutCommand,
|
|
13
|
-
} from './commands-auth.js'
|
|
14
|
-
export {
|
|
15
|
-
canDeviceReceive,
|
|
16
|
-
capabilitiesCommand,
|
|
17
|
-
deviceInventory,
|
|
18
|
-
devicesCommand,
|
|
19
|
-
} from './commands-devices.js'
|
|
20
|
-
export { soundsCommand } from './commands-sounds.js'
|
|
21
|
-
export {
|
|
22
|
-
contradictingAnswer,
|
|
23
|
-
repliesCommand,
|
|
24
|
-
sendCommand,
|
|
25
|
-
statusCommand,
|
|
26
|
-
} from './commands-send.js'
|
|
27
|
-
export { waitForReply } from './commands-send-support.js'
|
|
28
|
-
export {
|
|
29
|
-
HOOK_EVENTS,
|
|
30
|
-
acknowledgeCommand,
|
|
31
|
-
askCommand,
|
|
32
|
-
buildQuestions,
|
|
33
|
-
closeCommand,
|
|
34
|
-
describeHookFailure,
|
|
35
|
-
hookDefersDiagnosticsUntilAfterCleanup,
|
|
36
|
-
hookRunCommand,
|
|
37
|
-
hooksInstallCommand,
|
|
38
|
-
hooksUninstallCommand,
|
|
39
|
-
runningViaNpx,
|
|
40
|
-
reportAskFailure,
|
|
41
|
-
type AskFlags,
|
|
42
|
-
type BuiltQuestions,
|
|
43
|
-
type HookEvent,
|
|
44
|
-
type HooksInstallFlags,
|
|
45
|
-
} from './commands-hooks.js'
|
|
46
|
-
export {
|
|
47
|
-
configExplainCommand,
|
|
48
|
-
configSetCommand,
|
|
49
|
-
configShowCommand,
|
|
50
|
-
configUnsetCommand,
|
|
51
|
-
} from './commands-config.js'
|
|
52
|
-
export {
|
|
53
|
-
guidanceSetCommand,
|
|
54
|
-
guidanceShowCommand,
|
|
55
|
-
guidanceUnsetCommand,
|
|
56
|
-
} from './commands-guidance.js'
|
|
57
|
-
export { logsCommand, parseSince, type LogsFlags } from './commands-logs.js'
|
|
58
|
-
export { SKILLS_SOURCE } from './commands-skill.js'
|
|
59
|
-
export {
|
|
60
|
-
initCommand,
|
|
61
|
-
projectSlugFrom,
|
|
62
|
-
type InitFlags,
|
|
63
|
-
type SetupScope,
|
|
64
|
-
} from './commands-init.js'
|
|
65
|
-
export { assessReadiness, doctorCommand } from './commands-doctor.js'
|
|
66
|
-
export {
|
|
67
|
-
projectDisableCommand,
|
|
68
|
-
projectEnableCommand,
|
|
69
|
-
projectStatusCommand,
|
|
70
|
-
} from './commands-project.js'
|
|
71
|
-
export {
|
|
72
|
-
agentSessionRenameCommand,
|
|
73
|
-
type AgentSessionRenameFlags,
|
|
74
|
-
} from './commands-agent-sessions.js'
|
|
75
|
-
export { realIo } from './commands-io.js'
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest'
|
|
2
|
-
import {
|
|
3
|
-
BOOLEAN_CONFIG_KEYS,
|
|
4
|
-
CONFIG_KEYS,
|
|
5
|
-
NUMERIC_CONFIG_KEYS,
|
|
6
|
-
configBounds,
|
|
7
|
-
type ConfigKey,
|
|
8
|
-
} from './config.js'
|
|
9
|
-
import {
|
|
10
|
-
CONFIG_GROUPS,
|
|
11
|
-
acceptedValues,
|
|
12
|
-
configInfo,
|
|
13
|
-
configKeysByGroup,
|
|
14
|
-
describeSource,
|
|
15
|
-
formatDuration,
|
|
16
|
-
formatValue,
|
|
17
|
-
} from './config-schema.js'
|
|
18
|
-
|
|
19
|
-
describe('coverage', () => {
|
|
20
|
-
it('describes every configuration key', () => {
|
|
21
|
-
// The failure this prevents is silent: a key added to `config.ts` without
|
|
22
|
-
// an entry here still resolves, still applies, and still appears in
|
|
23
|
-
// `config show` — with no label, no summary and no way for the reader to
|
|
24
|
-
// find out what it does.
|
|
25
|
-
for (const key of CONFIG_KEYS) {
|
|
26
|
-
const info = configInfo(key)
|
|
27
|
-
expect(info.label, key).toBeTruthy()
|
|
28
|
-
expect(info.summary, key).toBeTruthy()
|
|
29
|
-
expect(info.detail, key).toBeTruthy()
|
|
30
|
-
expect(info.detail.length, key).toBeGreaterThan(info.summary.length)
|
|
31
|
-
}
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
it('files every key under exactly one declared group', () => {
|
|
35
|
-
const grouped = CONFIG_GROUPS.flatMap((group) => configKeysByGroup(group.id).map((info) => info.key))
|
|
36
|
-
expect([...grouped].sort()).toEqual([...CONFIG_KEYS].sort())
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
it('keeps summaries short enough to sit beside a value', () => {
|
|
40
|
-
for (const key of CONFIG_KEYS) {
|
|
41
|
-
expect(configInfo(key).summary.length, key).toBeLessThanOrEqual(80)
|
|
42
|
-
}
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
it('agrees with config.ts about which keys are numbers and toggles', () => {
|
|
46
|
-
// Two sources of truth for a key's type would let the prompt offer a text
|
|
47
|
-
// box for something `config set` will only accept as `true` or `false`.
|
|
48
|
-
for (const key of NUMERIC_CONFIG_KEYS) expect(configInfo(key).kind, key).toBe('integer')
|
|
49
|
-
for (const key of BOOLEAN_CONFIG_KEYS) expect(configInfo(key).kind, key).toBe('boolean')
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
it('offers choices for every enum key', () => {
|
|
53
|
-
for (const key of CONFIG_KEYS) {
|
|
54
|
-
const info = configInfo(key)
|
|
55
|
-
if (info.kind !== 'enum') continue
|
|
56
|
-
expect(info.choices, key).toBeDefined()
|
|
57
|
-
expect(info.choices!.length, key).toBeGreaterThan(1)
|
|
58
|
-
for (const choice of info.choices!) expect(info.choiceHints?.[choice], `${key}.${choice}`).toBeTruthy()
|
|
59
|
-
}
|
|
60
|
-
})
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
describe('acceptedValues', () => {
|
|
64
|
-
it('states the range for a bounded number', () => {
|
|
65
|
-
const bounds = configBounds('ask_grace_seconds')!
|
|
66
|
-
expect(acceptedValues('ask_grace_seconds')).toBe(
|
|
67
|
-
`a whole number from ${bounds.min}s–${bounds.max}s`,
|
|
68
|
-
)
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
it('lists the choices for an enum', () => {
|
|
72
|
-
expect(acceptedValues('sound')).toContain('none')
|
|
73
|
-
expect(acceptedValues('sound')).toContain('custom sound')
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
it('names both values for a toggle', () => {
|
|
77
|
-
expect(acceptedValues('ask_notifications')).toBe('true or false')
|
|
78
|
-
})
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
describe('formatValue', () => {
|
|
82
|
-
it('renders toggles as words rather than JSON', () => {
|
|
83
|
-
expect(formatValue('ask_notifications', true)).toBe('yes')
|
|
84
|
-
expect(formatValue('ask_notifications', false)).toBe('no')
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
it('explains what an unset value means instead of printing null', () => {
|
|
88
|
-
// `sound = null` is accurate and tells the reader nothing about what will
|
|
89
|
-
// happen; the whole complaint about the old output in one line.
|
|
90
|
-
expect(formatValue('sound', null)).toBe('not set; each kind brings its own sound')
|
|
91
|
-
expect(formatValue('devices', null)).toBe('every device that can receive')
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
it('renders durations in units a person reads', () => {
|
|
95
|
-
expect(formatValue('ask_grace_seconds', 300)).toBe('5m')
|
|
96
|
-
expect(formatValue('ttl_seconds', 86400)).toBe('1d')
|
|
97
|
-
expect(formatValue('wait_seconds', 10)).toBe('10s')
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
it('joins a device list', () => {
|
|
101
|
-
expect(formatValue('devices', ['dev_a', 'dev_b'])).toBe('dev_a, dev_b')
|
|
102
|
-
})
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
describe('formatDuration', () => {
|
|
106
|
-
it('keeps exact values readable across scales', () => {
|
|
107
|
-
expect(formatDuration(0, 's')).toBe('0s (immediately)')
|
|
108
|
-
expect(formatDuration(45, 's')).toBe('45s')
|
|
109
|
-
expect(formatDuration(120, 's')).toBe('2m')
|
|
110
|
-
expect(formatDuration(3600, 's')).toBe('1h')
|
|
111
|
-
expect(formatDuration(90, 's')).toBe('1m 30s')
|
|
112
|
-
})
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
describe('describeSource', () => {
|
|
116
|
-
it('turns a tagged path into words plus the file', () => {
|
|
117
|
-
expect(describeSource('default')).toEqual({ label: 'default', path: null })
|
|
118
|
-
expect(describeSource('global:/home/me/.config/notifai/config.toml')).toEqual({
|
|
119
|
-
label: 'this machine',
|
|
120
|
-
path: '/home/me/.config/notifai/config.toml',
|
|
121
|
-
})
|
|
122
|
-
expect(describeSource('project:/repo/.notifai/config.toml').label).toBe('this project (shared)')
|
|
123
|
-
expect(describeSource('project-local:/repo/.notifai/config.local.toml').label).toBe(
|
|
124
|
-
'this project (personal)',
|
|
125
|
-
)
|
|
126
|
-
})
|
|
127
|
-
|
|
128
|
-
it('does not invent a label for an unrecognised layer', () => {
|
|
129
|
-
expect(describeSource('future-layer:/tmp/x').label).toBe('future-layer')
|
|
130
|
-
})
|
|
131
|
-
})
|
|
132
|
-
|
|
133
|
-
describe('examples', () => {
|
|
134
|
-
it('suggests a value `config set` would actually accept', () => {
|
|
135
|
-
// The explain screen prints `notifai config set <key> <example>` as a
|
|
136
|
-
// copyable line, so an example that fails validation is worse than none.
|
|
137
|
-
for (const key of CONFIG_KEYS as readonly ConfigKey[]) {
|
|
138
|
-
const info = configInfo(key)
|
|
139
|
-
if (info.example === undefined) continue
|
|
140
|
-
if (info.kind === 'integer') {
|
|
141
|
-
const bounds = configBounds(key)
|
|
142
|
-
const parsed = Number(info.example)
|
|
143
|
-
expect(Number.isInteger(parsed), key).toBe(true)
|
|
144
|
-
if (bounds) {
|
|
145
|
-
expect(parsed, key).toBeGreaterThanOrEqual(bounds.min)
|
|
146
|
-
expect(parsed, key).toBeLessThanOrEqual(bounds.max)
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
if (info.kind === 'boolean') expect(['true', 'false']).toContain(info.example)
|
|
150
|
-
if (info.kind === 'enum') expect(info.choices).toContain(info.example)
|
|
151
|
-
}
|
|
152
|
-
})
|
|
153
|
-
})
|
package/src/config-schema.ts
DELETED
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What every configuration key means, in the reader's words.
|
|
3
|
-
*
|
|
4
|
-
* `config.ts` already documented every key carefully — but in TypeScript
|
|
5
|
-
* comments, which is the one audience that never needed them. Someone running
|
|
6
|
-
* `notifai config show` saw `ask_grace_seconds = 0` and had no way to learn
|
|
7
|
-
* what it did short of reading the source, so this module is that knowledge
|
|
8
|
-
* moved to where it can be printed.
|
|
9
|
-
*
|
|
10
|
-
* It is the single source for `config show`, `config set`'s errors, `config
|
|
11
|
-
* explain`, the help footer, and the interactive settings screen. One
|
|
12
|
-
* description, rendered five ways, so the surfaces cannot disagree.
|
|
13
|
-
*
|
|
14
|
-
* `summary` is the one-line form that fits beside a value in a list.
|
|
15
|
-
* `detail` is the paragraph shown once the reader has asked for this key
|
|
16
|
-
* specifically — progressive disclosure, so the list of settings stays a list
|
|
17
|
-
* and not an essay.
|
|
18
|
-
*/
|
|
19
|
-
import { CLI_SOUNDS, INTERRUPTION_LEVELS } from '@raidiant/notifai-protocol'
|
|
20
|
-
import { LOG_LEVELS, configBounds, type ConfigKey } from './config.js'
|
|
21
|
-
|
|
22
|
-
export type ConfigKind = 'string' | 'url' | 'integer' | 'boolean' | 'enum' | 'list'
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Which surface a key belongs to. Grouping is the difference between a flat
|
|
26
|
-
* list of keys and a few short ones a reader can hold in their head.
|
|
27
|
-
*/
|
|
28
|
-
export type ConfigGroup = 'questions' | 'delivery' | 'project' | 'trust' | 'diagnostics'
|
|
29
|
-
|
|
30
|
-
export const CONFIG_GROUPS: { id: ConfigGroup; title: string; blurb: string }[] = [
|
|
31
|
-
{
|
|
32
|
-
id: 'questions',
|
|
33
|
-
title: 'Questions',
|
|
34
|
-
blurb: 'Whether a question an agent registered may leave this terminal and reach your devices, and how soon.',
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
id: 'delivery',
|
|
38
|
-
title: 'Delivery defaults',
|
|
39
|
-
blurb: 'What a notification looks and behaves like when a command does not say otherwise.',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
id: 'project',
|
|
43
|
-
title: 'This project',
|
|
44
|
-
blurb: 'How work in this directory identifies itself. House rules for agents live in `notifai guidance`.',
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
id: 'trust',
|
|
48
|
-
title: 'Network trust',
|
|
49
|
-
blurb: 'Origins this machine may fetch from or open beyond the safe defaults. Only you can widen these — a repository cannot.',
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
id: 'diagnostics',
|
|
53
|
-
title: 'Local logs',
|
|
54
|
-
blurb: 'What this machine records about its own activity, so an agent can find out afterwards what happened.',
|
|
55
|
-
},
|
|
56
|
-
]
|
|
57
|
-
|
|
58
|
-
export interface ConfigKeyInfo {
|
|
59
|
-
key: ConfigKey
|
|
60
|
-
/** Human words for the key, used as a list label. */
|
|
61
|
-
label: string
|
|
62
|
-
group: ConfigGroup
|
|
63
|
-
kind: ConfigKind
|
|
64
|
-
/** One line. Must fit beside a value without wrapping on an 80-column terminal. */
|
|
65
|
-
summary: string
|
|
66
|
-
/** The full explanation, shown when the reader asks about this key. */
|
|
67
|
-
detail: string
|
|
68
|
-
/** Allowed values for `enum`. */
|
|
69
|
-
choices?: readonly string[]
|
|
70
|
-
/** What a choice means, keyed by choice. */
|
|
71
|
-
choiceHints?: Record<string, string>
|
|
72
|
-
/** Unit suffix rendered after numbers, e.g. `s`. */
|
|
73
|
-
unit?: string
|
|
74
|
-
/** What the key means when it holds no value. */
|
|
75
|
-
unsetMeans?: string
|
|
76
|
-
/** A valid value, for error messages and placeholders. */
|
|
77
|
-
example?: string
|
|
78
|
-
/**
|
|
79
|
-
* Advanced keys are hidden behind an explicit reveal in the interactive
|
|
80
|
-
* settings screen. They are still listed by `config show` — hiding a value
|
|
81
|
-
* that is in force would be worse than showing one nobody needs.
|
|
82
|
-
*/
|
|
83
|
-
advanced?: boolean
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const INFO: Record<ConfigKey, Omit<ConfigKeyInfo, 'key'>> = {
|
|
87
|
-
ask_notifications: {
|
|
88
|
-
label: 'Send questions to my devices',
|
|
89
|
-
group: 'questions',
|
|
90
|
-
kind: 'boolean',
|
|
91
|
-
summary: 'Whether a registered question may reach your Companion devices at all',
|
|
92
|
-
detail:
|
|
93
|
-
'The master switch for question routing. When this is off, a question an agent registers with `notifai ask` stays in the terminal and never leaves this machine, whatever else is configured. Turn it off to stop being reached for a while without uninstalling the harness hooks.',
|
|
94
|
-
example: 'true',
|
|
95
|
-
},
|
|
96
|
-
ask_grace_seconds: {
|
|
97
|
-
label: 'Terminal-first grace',
|
|
98
|
-
group: 'questions',
|
|
99
|
-
kind: 'integer',
|
|
100
|
-
unit: 's',
|
|
101
|
-
summary: 'Optional delay before a question may reach your devices',
|
|
102
|
-
detail:
|
|
103
|
-
'Zero (the default) sends the question to your devices as soon as the agent turn ends. Set a positive duration to offer the terminal an exclusive answer window first; the timer is measured from the moment the agent asked.\n\nThis controls when the question reaches devices, not how the harness keeps the Agent Session available afterward. Claude Code waits out of band; Codex holds the asking turn.',
|
|
104
|
-
example: '0',
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
reply_window_seconds: {
|
|
108
|
-
label: 'How long an answer is accepted',
|
|
109
|
-
group: 'questions',
|
|
110
|
-
kind: 'integer',
|
|
111
|
-
unit: 's',
|
|
112
|
-
summary: 'How long the service keeps accepting your answer to a question',
|
|
113
|
-
detail:
|
|
114
|
-
'A question stays answerable for this long after it reaches the service. The default is a day, so a question that arrives while you are away is still yours to answer when you come back.\n\nQuestion Routing keeps the exact Agent Session available for this complete window. Claude Code waits out of band and wakes the Agent Session; Codex keeps its turn held. This is separate from `--reply-timeout`, which controls how long a direct `send --reply` command blocks.',
|
|
115
|
-
example: '86400',
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
sound: {
|
|
119
|
-
label: 'Sound',
|
|
120
|
-
group: 'delivery',
|
|
121
|
-
kind: 'enum',
|
|
122
|
-
choices: CLI_SOUNDS,
|
|
123
|
-
choiceHints: {
|
|
124
|
-
default: 'Device default',
|
|
125
|
-
done: 'the completion chime',
|
|
126
|
-
attention: 'a distinct attention tone',
|
|
127
|
-
alert: 'the most insistent tone',
|
|
128
|
-
none: 'silent — arrives without a sound',
|
|
129
|
-
},
|
|
130
|
-
summary: 'Set the sound notifications from here use',
|
|
131
|
-
detail:
|
|
132
|
-
'Setting this pins one sound for every notification sent from here, whatever kind it is. Shipped names are `default` (Device default), `done`, `attention`, `alert`, and `none`; an Account custom sound name or id from `notifai sounds` is accepted too.\n\nLeave it unset and each notification arrives with the sound its kind implies: the completion chime when work finished, the most insistent tone when it failed, a distinct attention tone for a question or blocked work, and Device default for ordinary news. A common explicit preference is `none`, to make a noisy project completely silent.',
|
|
133
|
-
unsetMeans: 'not set; each kind brings its own sound',
|
|
134
|
-
},
|
|
135
|
-
interruption_level: {
|
|
136
|
-
label: 'Interruption level',
|
|
137
|
-
group: 'delivery',
|
|
138
|
-
kind: 'enum',
|
|
139
|
-
choices: INTERRUPTION_LEVELS,
|
|
140
|
-
choiceHints: {
|
|
141
|
-
passive: 'no sound or wake — waits in the notification list',
|
|
142
|
-
active: 'wakes the screen and plays the sound',
|
|
143
|
-
time_sensitive: 'marks the notification urgent; Focus breakthrough is not available yet',
|
|
144
|
-
},
|
|
145
|
-
summary: 'Set how insistently notifications reach Apple devices',
|
|
146
|
-
detail:
|
|
147
|
-
'Apple interruption level controls how hard a notification tries to reach you in the operating system\'s terms. Setting this pins one Apple-only level for sends from here; kind chooses the sound, never this. Android does not accept caller-selected interruption levels: its product-owned channels and your device settings own attention.\n\nLeave this unset to omit the field and let each destination use its normal behavior. `time_sensitive` is accepted on Apple platforms and marks the notification urgent, but Focus breakthrough is not available yet — run `notifai capabilities --platform <platform>` for the exact contract.',
|
|
148
|
-
unsetMeans: 'not specified; each destination uses its normal behavior',
|
|
149
|
-
},
|
|
150
|
-
devices: {
|
|
151
|
-
label: 'Default devices',
|
|
152
|
-
group: 'delivery',
|
|
153
|
-
kind: 'list',
|
|
154
|
-
summary: 'Which of your devices receive by default',
|
|
155
|
-
detail:
|
|
156
|
-
'A comma-separated list of device ids. When set, notifications go only to these devices unless a command overrides it.\n\nRun `notifai devices` to see the ids and which of them can currently receive.',
|
|
157
|
-
unsetMeans: 'every device that can receive',
|
|
158
|
-
example: 'dev_abc123,dev_def456',
|
|
159
|
-
},
|
|
160
|
-
ttl_seconds: {
|
|
161
|
-
label: 'Delivery window',
|
|
162
|
-
group: 'delivery',
|
|
163
|
-
kind: 'integer',
|
|
164
|
-
unit: 's',
|
|
165
|
-
summary: 'How long the service keeps trying to deliver before giving up',
|
|
166
|
-
detail:
|
|
167
|
-
'A notification for a device that is off or offline is held for this long and delivered when the device reappears. After it lapses the notification is dropped rather than arriving stale.\n\nThe default of 86400 is one day.',
|
|
168
|
-
example: '86400',
|
|
169
|
-
},
|
|
170
|
-
wait_seconds: {
|
|
171
|
-
label: 'Wait for outcomes',
|
|
172
|
-
group: 'delivery',
|
|
173
|
-
kind: 'integer',
|
|
174
|
-
unit: 's',
|
|
175
|
-
summary: 'How long `send` waits to report what happened to a notification',
|
|
176
|
-
detail:
|
|
177
|
-
'After a notification is accepted, `notifai send` can wait for the delivery outcome so its exit code reflects what actually happened rather than only that the service took it.\n\nSet to 0 to return as soon as the service accepts, which is the fastest option and the one that tells you least.',
|
|
178
|
-
example: '10',
|
|
179
|
-
},
|
|
180
|
-
collapse_key: {
|
|
181
|
-
label: 'Collapse key',
|
|
182
|
-
group: 'delivery',
|
|
183
|
-
kind: 'string',
|
|
184
|
-
summary: 'Replace earlier notifications carrying the same key',
|
|
185
|
-
detail:
|
|
186
|
-
'Two notifications sharing a collapse key do not stack — the newer one replaces the older on the lock screen. This is how a status that changes repeatedly stays one line instead of becoming twenty.\n\nSetting it here applies one key to everything sent from here, which is usually too broad; most uses pass `--collapse-key` per send instead.',
|
|
187
|
-
unsetMeans: 'each notification stands on its own',
|
|
188
|
-
advanced: true,
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
project: {
|
|
192
|
-
label: 'Project id',
|
|
193
|
-
group: 'project',
|
|
194
|
-
kind: 'string',
|
|
195
|
-
summary: 'The name this project reports itself as',
|
|
196
|
-
detail:
|
|
197
|
-
'Stamped on every notification sent from this directory, and how the companion apps group and filter what arrives. When unset, the CLI infers a stable identifier from Git (shared across linked worktrees) or the current directory. Set it in `.notifai/config.toml` only when that inferred name is not the identity you want.',
|
|
198
|
-
unsetMeans: 'inferred from Git or the current directory',
|
|
199
|
-
example: 'my-app',
|
|
200
|
-
},
|
|
201
|
-
media_origins: {
|
|
202
|
-
label: 'Extra image origins',
|
|
203
|
-
group: 'trust',
|
|
204
|
-
kind: 'list',
|
|
205
|
-
summary: 'Origins remote --image URLs may use beyond public HTTPS',
|
|
206
|
-
detail:
|
|
207
|
-
'By default a remote `--image` URL must be HTTPS to a publicly routable host, and every redirect hop is held to the same rule — an agent given a hostile URL cannot be used to reach this machine\'s local network. List an exact origin (`scheme://host[:port]`) here to allow a self-hosted or intranet image server, including plain-http ones.\n\nThis key is yours alone: it is read from your machine and personal-project configuration and ignored in the repository\'s shared `.notifai/config.toml`, so a cloned repository can never widen it.',
|
|
208
|
-
unsetMeans: 'public HTTPS only',
|
|
209
|
-
example: 'http://imgs.intranet.example:8080',
|
|
210
|
-
advanced: true,
|
|
211
|
-
},
|
|
212
|
-
approve_origins: {
|
|
213
|
-
label: 'Extra approval origins',
|
|
214
|
-
group: 'trust',
|
|
215
|
-
kind: 'list',
|
|
216
|
-
summary: 'Dashboard origins a pairing approval link may open',
|
|
217
|
-
detail:
|
|
218
|
-
'During `notifai login` the server names the browser page where you approve this machine. The CLI opens that link only when it is the Notifai dashboard, the origin you are pairing with, or loopback. If you self-host with the dashboard on its own origin, list that exact origin (`scheme://host[:port]`) here.\n\nThis key is yours alone: it is read from your machine and personal-project configuration and ignored in the repository\'s shared `.notifai/config.toml`, so a cloned repository can never widen it.',
|
|
219
|
-
unsetMeans: 'the Notifai dashboard, the pairing origin, and loopback',
|
|
220
|
-
example: 'https://dash.selfhost.example',
|
|
221
|
-
advanced: true,
|
|
222
|
-
},
|
|
223
|
-
log_level: {
|
|
224
|
-
label: 'Log level',
|
|
225
|
-
group: 'diagnostics',
|
|
226
|
-
kind: 'enum',
|
|
227
|
-
choices: LOG_LEVELS,
|
|
228
|
-
choiceHints: {
|
|
229
|
-
off: 'record nothing',
|
|
230
|
-
error: 'only failures',
|
|
231
|
-
info: 'commands, notifications, and every question decision',
|
|
232
|
-
debug: 'adds config resolution and per-request detail',
|
|
233
|
-
},
|
|
234
|
-
summary: 'How much this machine records about what it did',
|
|
235
|
-
detail:
|
|
236
|
-
'Notifai keeps a local record of what it did — every command, every notification, and in particular every decision a harness hook made about whether a question could leave the terminal. Hooks run headless, so without this there is no account of them at all: `notifai logs` is how an agent finds out afterwards why a question never reached your device.\n\nThe log never leaves this machine. It is not uploaded, and nothing sends it anywhere.\n\n`debug` also records which config layer won and the detail of each request, which is what to turn on when something is behaving in a way the ordinary log does not explain.',
|
|
237
|
-
example: 'info',
|
|
238
|
-
},
|
|
239
|
-
log_max_bytes: {
|
|
240
|
-
label: 'Log file size',
|
|
241
|
-
group: 'diagnostics',
|
|
242
|
-
kind: 'integer',
|
|
243
|
-
summary: 'How large the log grows before it is rotated',
|
|
244
|
-
detail:
|
|
245
|
-
'When the active log reaches this size it is renamed aside and a fresh one starts. Together with the number of files kept, this is the whole disk budget: nothing here grows without a ceiling.',
|
|
246
|
-
advanced: true,
|
|
247
|
-
example: '2000000',
|
|
248
|
-
},
|
|
249
|
-
log_max_files: {
|
|
250
|
-
label: 'Log files kept',
|
|
251
|
-
group: 'diagnostics',
|
|
252
|
-
kind: 'integer',
|
|
253
|
-
summary: 'How many rotated log files are kept before the oldest is deleted',
|
|
254
|
-
detail:
|
|
255
|
-
'Counts the active file. At the defaults — three files of two megabytes — the logs occupy about six megabytes, which is weeks of ordinary agent traffic.\n\nRaise it when you need to look further back than the log currently reaches; lower it to one to keep only the file being written.',
|
|
256
|
-
advanced: true,
|
|
257
|
-
example: '3',
|
|
258
|
-
},
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
export function configInfo(key: ConfigKey): ConfigKeyInfo {
|
|
262
|
-
return { key, ...INFO[key] }
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
/** Every key in its group, in the order a reader should meet them. */
|
|
266
|
-
export function configKeysByGroup(group: ConfigGroup): ConfigKeyInfo[] {
|
|
267
|
-
return (Object.keys(INFO) as ConfigKey[])
|
|
268
|
-
.filter((key) => INFO[key].group === group)
|
|
269
|
-
.map((key) => configInfo(key))
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
/** Bounds rendered the way an error message wants them, or null. */
|
|
273
|
-
export function boundsHint(key: ConfigKey): string | null {
|
|
274
|
-
const bounds = configBounds(key)
|
|
275
|
-
if (bounds === undefined) return null
|
|
276
|
-
const info = INFO[key]
|
|
277
|
-
const unit = info.unit ?? ''
|
|
278
|
-
return `${bounds.min}${unit}–${bounds.max}${unit}`
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
/** What a `config set` caller may legally pass, phrased for an error message. */
|
|
282
|
-
export function acceptedValues(key: ConfigKey): string {
|
|
283
|
-
const info = INFO[key]
|
|
284
|
-
if (key === 'sound') {
|
|
285
|
-
return `${CLI_SOUNDS.join(', ')}, a custom sound id, or a custom sound name`
|
|
286
|
-
}
|
|
287
|
-
switch (info.kind) {
|
|
288
|
-
case 'boolean':
|
|
289
|
-
return 'true or false'
|
|
290
|
-
case 'enum':
|
|
291
|
-
return (info.choices ?? []).join(', ')
|
|
292
|
-
case 'integer': {
|
|
293
|
-
const bounds = boundsHint(key)
|
|
294
|
-
return bounds === null ? 'a whole number' : `a whole number from ${bounds}`
|
|
295
|
-
}
|
|
296
|
-
case 'list':
|
|
297
|
-
return 'a comma-separated list'
|
|
298
|
-
case 'url':
|
|
299
|
-
return 'a URL'
|
|
300
|
-
case 'string':
|
|
301
|
-
return 'any text'
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
/** How a resolved value should read in a list. */
|
|
306
|
-
export function formatValue(key: ConfigKey, value: unknown): string {
|
|
307
|
-
const info = INFO[key]
|
|
308
|
-
if (value === null || value === undefined) return info.unsetMeans ?? 'not set'
|
|
309
|
-
if (Array.isArray(value)) return value.length === 0 ? (info.unsetMeans ?? 'not set') : value.join(', ')
|
|
310
|
-
if (typeof value === 'boolean') return value ? 'yes' : 'no'
|
|
311
|
-
if (typeof value === 'number' && info.unit !== undefined) return formatDuration(value, info.unit)
|
|
312
|
-
return String(value)
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Where a value came from, in words rather than in a tagged path.
|
|
317
|
-
*
|
|
318
|
-
* `global:/Users/you/.config/notifai/config.toml` answers "which file" but not
|
|
319
|
-
* "why is this the value" — and the second question is the one someone reading
|
|
320
|
-
* `config show` is actually asking. The path is still available for anyone
|
|
321
|
-
* about to edit the file; it is just no longer the whole answer.
|
|
322
|
-
*/
|
|
323
|
-
export function describeSource(source: string): { label: string; path: string | null } {
|
|
324
|
-
if (source === 'default') return { label: 'default', path: null }
|
|
325
|
-
if (source === 'flag') return { label: 'this command', path: null }
|
|
326
|
-
if (source === 'env') return { label: 'environment', path: null }
|
|
327
|
-
const separator = source.indexOf(':')
|
|
328
|
-
if (separator === -1) return { label: source, path: null }
|
|
329
|
-
const layer = source.slice(0, separator)
|
|
330
|
-
const filePath = source.slice(separator + 1)
|
|
331
|
-
const labels: Record<string, string> = {
|
|
332
|
-
session: 'this session',
|
|
333
|
-
'project-local': 'this project (personal)',
|
|
334
|
-
project: 'this project (shared)',
|
|
335
|
-
global: 'this machine',
|
|
336
|
-
}
|
|
337
|
-
return { label: labels[layer] ?? layer, path: filePath === '' ? null : filePath }
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
/** Seconds as something a person reads: `300s` is true, `5m` is legible. */
|
|
341
|
-
export function formatDuration(value: number, unit: string): string {
|
|
342
|
-
if (unit !== 's') return `${value}${unit}`
|
|
343
|
-
if (value === 0) return '0s (immediately)'
|
|
344
|
-
if (value < 60) return `${value}s`
|
|
345
|
-
if (value % 86400 === 0) return `${value / 86400}d`
|
|
346
|
-
if (value % 3600 === 0) return `${value / 3600}h`
|
|
347
|
-
if (value % 60 === 0) return `${value / 60}m`
|
|
348
|
-
return `${Math.floor(value / 60)}m ${value % 60}s`
|
|
349
|
-
}
|