@raidiant/notifai 8.0.0 → 9.0.0
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 +41 -0
- package/README.md +20 -13
- package/dist/atomic-file.d.ts +14 -0
- package/dist/atomic-file.js +27 -2
- package/dist/atomic-file.js.map +1 -1
- package/dist/cli-bin.d.ts +4 -0
- package/dist/cli-bin.js +62 -0
- package/dist/cli-bin.js.map +1 -0
- package/dist/cli-release.d.ts +10 -0
- package/dist/cli-release.js +75 -0
- package/dist/cli-release.js.map +1 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.js +13 -3
- package/dist/client.js.map +1 -1
- package/dist/commands-auth.d.ts +6 -0
- package/dist/commands-auth.js +28 -3
- package/dist/commands-auth.js.map +1 -1
- package/dist/commands-config.js +22 -3
- package/dist/commands-config.js.map +1 -1
- package/dist/commands-core.d.ts +12 -0
- package/dist/commands-core.js +27 -3
- package/dist/commands-core.js.map +1 -1
- package/dist/commands-doctor.d.ts +1 -0
- package/dist/commands-doctor.js +71 -15
- package/dist/commands-doctor.js.map +1 -1
- package/dist/commands-guidance.d.ts +7 -3
- package/dist/commands-guidance.js +63 -28
- package/dist/commands-guidance.js.map +1 -1
- package/dist/commands-hooks.d.ts +9 -4
- package/dist/commands-hooks.js +430 -32
- package/dist/commands-hooks.js.map +1 -1
- package/dist/commands-init.d.ts +10 -18
- package/dist/commands-init.js +114 -32
- package/dist/commands-init.js.map +1 -1
- package/dist/commands-send-support.d.ts +17 -2
- package/dist/commands-send-support.js +61 -5
- package/dist/commands-send-support.js.map +1 -1
- package/dist/commands-send.js +60 -11
- package/dist/commands-send.js.map +1 -1
- package/dist/commands-setup-proof.d.ts +8 -0
- package/dist/commands-setup-proof.js +31 -2
- package/dist/commands-setup-proof.js.map +1 -1
- package/dist/commands-skill.d.ts +11 -1
- package/dist/commands-skill.js +61 -11
- package/dist/commands-skill.js.map +1 -1
- package/dist/commands.d.ts +1 -1
- package/dist/commands.js.map +1 -1
- package/dist/config-schema.d.ts +1 -1
- package/dist/config-schema.js +25 -0
- package/dist/config-schema.js.map +1 -1
- package/dist/config.d.ts +24 -3
- package/dist/config.js +37 -5
- package/dist/config.js.map +1 -1
- package/dist/credentials.d.ts +10 -1
- package/dist/credentials.js +25 -12
- package/dist/credentials.js.map +1 -1
- package/dist/guidance-content.d.ts +20 -0
- package/dist/guidance-content.js +73 -8
- package/dist/guidance-content.js.map +1 -1
- package/dist/guidance.d.ts +21 -0
- package/dist/guidance.js +73 -18
- package/dist/guidance.js.map +1 -1
- package/dist/hook-adapter.js +37 -3
- package/dist/hook-adapter.js.map +1 -1
- package/dist/hooks.d.ts +68 -7
- package/dist/hooks.js +231 -85
- package/dist/hooks.js.map +1 -1
- package/dist/install-hooks.d.ts +10 -18
- package/dist/install-hooks.js +110 -23
- package/dist/install-hooks.js.map +1 -1
- package/dist/interactive.d.ts +1 -1
- package/dist/interactive.js +1 -1
- package/dist/interactive.js.map +1 -1
- package/dist/logging.d.ts +8 -1
- package/dist/logging.js +43 -2
- package/dist/logging.js.map +1 -1
- package/dist/main.js +2 -13
- package/dist/main.js.map +1 -1
- package/dist/native-skills.d.ts +19 -0
- package/dist/native-skills.js +30 -8
- package/dist/native-skills.js.map +1 -1
- package/dist/opencode-plugin.js +14 -1
- package/dist/opencode-plugin.js.map +1 -1
- package/dist/program.js +13 -8
- package/dist/program.js.map +1 -1
- package/dist/send.d.ts +8 -1
- package/dist/send.js +17 -1
- package/dist/send.js.map +1 -1
- package/dist/session-activation.d.ts +15 -0
- package/dist/session-activation.js +35 -0
- package/dist/session-activation.js.map +1 -0
- package/dist/url-policy.d.ts +85 -0
- package/dist/url-policy.js +369 -0
- package/dist/url-policy.js.map +1 -0
- package/package.json +3 -3
- package/src/atomic-file.ts +36 -2
- package/src/cli-bin.test.ts +38 -0
- package/src/cli-bin.ts +67 -0
- package/src/cli-release.test.ts +46 -0
- package/src/cli-release.ts +78 -0
- package/src/client.test.ts +95 -0
- package/src/client.ts +16 -3
- package/src/commands-auth.ts +32 -3
- package/src/commands-config.ts +25 -2
- package/src/commands-core.ts +38 -3
- package/src/commands-doctor.ts +99 -13
- package/src/commands-guidance.ts +75 -29
- package/src/commands-hooks.ts +503 -34
- package/src/commands-init.ts +139 -38
- package/src/commands-send-support.test.ts +156 -0
- package/src/commands-send-support.ts +67 -5
- package/src/commands-send.ts +73 -10
- package/src/commands-setup-proof.ts +36 -2
- package/src/commands-skill.ts +78 -15
- package/src/commands.test.ts +1083 -101
- package/src/commands.ts +1 -0
- package/src/config-schema.ts +28 -1
- package/src/config.test.ts +1 -1
- package/src/config.ts +49 -5
- package/src/credentials.test.ts +71 -3
- package/src/credentials.ts +29 -15
- package/src/guidance-content.ts +74 -8
- package/src/guidance.test.ts +42 -11
- package/src/guidance.ts +100 -18
- package/src/hook-adapter.test.ts +113 -1
- package/src/hook-adapter.ts +37 -3
- package/src/hooks.test.ts +746 -165
- package/src/hooks.ts +299 -124
- package/src/install-hooks.test.ts +135 -16
- package/src/install-hooks.ts +113 -25
- package/src/interactive.ts +1 -1
- package/src/logging.test.ts +66 -3
- package/src/logging.ts +45 -2
- package/src/main.ts +2 -14
- package/src/native-skills.test.ts +41 -1
- package/src/native-skills.ts +40 -6
- package/src/opencode-plugin.ts +14 -1
- package/src/program.test.ts +37 -2
- package/src/program.ts +40 -12
- package/src/send.test.ts +28 -0
- package/src/send.ts +28 -2
- package/src/session-activation.ts +45 -0
- package/src/skill.test.ts +120 -4
- package/src/trust-policy.test.ts +701 -0
- package/src/url-policy.ts +399 -0
|
@@ -2,34 +2,62 @@ import { existsSync, mkdirSync, rmSync, writeFileSync } from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { describeSource } from './config-schema.js';
|
|
4
4
|
import { EXIT } from './commands-core.js';
|
|
5
|
-
import { SHIPPED_GUIDANCE, shippedGuidanceTopic } from './guidance-content.js';
|
|
5
|
+
import { GUIDANCE_TRUST_PREAMBLE, SHIPPED_GUIDANCE, shippedGuidanceTopic, } from './guidance-content.js';
|
|
6
6
|
import { GUIDANCE_TOPIC_MAX_BYTES, GUIDANCE_TOPIC_PATTERN, findProjectGuidanceDir, globalGuidanceDir, personalProjectGuidanceDir, resolveGuidance, } from './guidance.js';
|
|
7
7
|
// ---------------------------------------------------------------------------
|
|
8
8
|
// guidance show / set / unset
|
|
9
9
|
// ---------------------------------------------------------------------------
|
|
10
|
+
/** How each authority is named in the marker above a topic. */
|
|
11
|
+
const AUTHORITY_LABEL = {
|
|
12
|
+
user: 'you',
|
|
13
|
+
repository: 'this repository',
|
|
14
|
+
shipped: 'shipped default',
|
|
15
|
+
};
|
|
10
16
|
/**
|
|
11
|
-
* The
|
|
12
|
-
*
|
|
13
|
-
*
|
|
17
|
+
* The token that makes a marker line ours.
|
|
18
|
+
*
|
|
19
|
+
* Without it, a repository topic could open with a handwritten
|
|
20
|
+
* `<!-- when-to-notify · this machine · /Users/... -->` and everything after
|
|
21
|
+
* it would read as the User's own standing word. The marker therefore carries
|
|
22
|
+
* a fixed token, and any occurrence of that token inside file content is
|
|
23
|
+
* defanged below — so the only lines that can claim to be provenance are the
|
|
24
|
+
* ones this command wrote.
|
|
25
|
+
*/
|
|
26
|
+
const MARKER_TOKEN = 'notifai:guidance';
|
|
27
|
+
function markerSafe(content) {
|
|
28
|
+
return content.replaceAll(MARKER_TOKEN, `${MARKER_TOKEN.replace(':', '-')} [not a provenance marker]`);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The whole effective guidance, ready to be followed as read.
|
|
32
|
+
*
|
|
33
|
+
* The trust preamble comes first and belongs to the CLI: it says who supplied
|
|
34
|
+
* each topic and what no topic may ask for. Each topic then follows its own
|
|
35
|
+
* marker, so a reader can tell the User's standing word from a repository's
|
|
36
|
+
* house rules from the shipped default without the output stopping being
|
|
37
|
+
* Markdown.
|
|
14
38
|
*/
|
|
15
39
|
export function guidanceShowCommand(deps, flags) {
|
|
16
40
|
const topics = resolveGuidance({ cwd: deps.cwd, env: deps.env });
|
|
17
41
|
if (flags.json) {
|
|
18
|
-
deps.io.out(JSON.stringify(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
42
|
+
deps.io.out(JSON.stringify({
|
|
43
|
+
trust: GUIDANCE_TRUST_PREAMBLE,
|
|
44
|
+
topics: topics.map((topic) => ({
|
|
45
|
+
name: topic.name,
|
|
46
|
+
source: topic.source,
|
|
47
|
+
authority: topic.authority,
|
|
48
|
+
summary: topic.summary,
|
|
49
|
+
content: topic.content,
|
|
50
|
+
})),
|
|
51
|
+
}, null, 2));
|
|
24
52
|
return EXIT.ok;
|
|
25
53
|
}
|
|
26
54
|
const blocks = topics.map((topic) => {
|
|
27
|
-
const {
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
return
|
|
55
|
+
const { path: filePath } = describeSource(topic.source);
|
|
56
|
+
const marker = `<!-- ${MARKER_TOKEN} topic=${topic.name} from=${AUTHORITY_LABEL[topic.authority]}` +
|
|
57
|
+
`${filePath === null ? '' : ` file=${encodeURIComponent(filePath)}`} -->`;
|
|
58
|
+
return `${marker}\n${markerSafe(topic.content).trimEnd()}`;
|
|
31
59
|
});
|
|
32
|
-
deps.io.out(blocks.join('\n\n'));
|
|
60
|
+
deps.io.out([GUIDANCE_TRUST_PREAMBLE, ...blocks].join('\n\n'));
|
|
33
61
|
return EXIT.ok;
|
|
34
62
|
}
|
|
35
63
|
/**
|
|
@@ -57,9 +85,9 @@ async function guidanceMutationTarget(deps, topic, flags) {
|
|
|
57
85
|
deps.io.interactive === true &&
|
|
58
86
|
deps.io.select) {
|
|
59
87
|
const selected = await deps.io.select('Where should this guidance live?', [
|
|
60
|
-
{ value: 'global', label: 'This machine', hint: 'applies across projects' },
|
|
61
|
-
{ value: 'project', label: 'This project (shared)', hint: '.notifai/guidance/' },
|
|
62
|
-
{ value: 'local', label: 'This project (personal)', hint: '
|
|
88
|
+
{ value: 'global', label: 'This machine', hint: 'your standing word, applies across projects' },
|
|
89
|
+
{ value: 'project', label: 'This project (shared)', hint: '.notifai/guidance/ — committed, read as project policy' },
|
|
90
|
+
{ value: 'local', label: 'This project (personal)', hint: 'your standing word here, stored outside the repo' },
|
|
63
91
|
]);
|
|
64
92
|
if (selected === null) {
|
|
65
93
|
deps.io.err('No guidance layer selected.');
|
|
@@ -67,7 +95,7 @@ async function guidanceMutationTarget(deps, topic, flags) {
|
|
|
67
95
|
}
|
|
68
96
|
layer = selected;
|
|
69
97
|
}
|
|
70
|
-
return path.join(guidanceLayerDir(deps, layer), `${topic}.md`);
|
|
98
|
+
return { path: path.join(guidanceLayerDir(deps, layer), `${topic}.md`), layer };
|
|
71
99
|
}
|
|
72
100
|
/**
|
|
73
101
|
* Writes one topic at one layer, replacing the shipped topic of that name for
|
|
@@ -92,37 +120,44 @@ export async function guidanceSetCommand(deps, topic, text, flags) {
|
|
|
92
120
|
const replaces = shipped === undefined
|
|
93
121
|
? `Add guidance topic "${topic}"`
|
|
94
122
|
: `Replace the shipped "${topic}" guidance for this scope`;
|
|
95
|
-
const confirmed = await deps.io.confirm(`${replaces} at ${target}?`);
|
|
123
|
+
const confirmed = await deps.io.confirm(`${replaces} at ${target.path}?`);
|
|
96
124
|
if (!confirmed) {
|
|
97
125
|
deps.io.err('Not confirmed. Pass --yes to skip the confirmation gate.');
|
|
98
126
|
return EXIT.usage;
|
|
99
127
|
}
|
|
100
128
|
}
|
|
101
|
-
mkdirSync(path.dirname(target), { recursive: true });
|
|
102
|
-
writeFileSync(target, text.endsWith('\n') ? text : `${text}\n`);
|
|
103
|
-
deps.io.out(`Wrote ${topic} to ${target}`);
|
|
129
|
+
mkdirSync(path.dirname(target.path), { recursive: true });
|
|
130
|
+
writeFileSync(target.path, text.endsWith('\n') ? text : `${text}\n`);
|
|
131
|
+
deps.io.out(`Wrote ${topic} to ${target.path}`);
|
|
104
132
|
if (shipped !== undefined) {
|
|
105
133
|
deps.io.out(`This file now replaces the shipped "${topic}" guidance wherever it applies.`);
|
|
106
134
|
}
|
|
135
|
+
// A shared file is committed and travels to everyone who clones this
|
|
136
|
+
// repository, where it is read as the project's policy rather than as
|
|
137
|
+
// anyone's personal standing word. Worth saying at the moment of writing:
|
|
138
|
+
// the same sentence means something different in the two locations.
|
|
139
|
+
if (target.layer === 'project') {
|
|
140
|
+
deps.io.out('This is shared project policy: it is committed, everyone working here reads it, and it is never read as the User\'s own standing word. Use --local for a personal preference.');
|
|
141
|
+
}
|
|
107
142
|
return EXIT.ok;
|
|
108
143
|
}
|
|
109
144
|
export async function guidanceUnsetCommand(deps, topic, flags) {
|
|
110
145
|
const target = await guidanceMutationTarget(deps, topic, flags);
|
|
111
146
|
if (target === null)
|
|
112
147
|
return EXIT.usage;
|
|
113
|
-
if (!existsSync(target)) {
|
|
114
|
-
deps.io.out(`${topic} is not set at ${target}`);
|
|
148
|
+
if (!existsSync(target.path)) {
|
|
149
|
+
deps.io.out(`${topic} is not set at ${target.path}`);
|
|
115
150
|
return EXIT.ok;
|
|
116
151
|
}
|
|
117
152
|
if (!flags.yes) {
|
|
118
|
-
const confirmed = await deps.io.confirm(`Remove ${target}?`);
|
|
153
|
+
const confirmed = await deps.io.confirm(`Remove ${target.path}?`);
|
|
119
154
|
if (!confirmed) {
|
|
120
155
|
deps.io.err('Not confirmed. Pass --yes to skip the confirmation gate.');
|
|
121
156
|
return EXIT.usage;
|
|
122
157
|
}
|
|
123
158
|
}
|
|
124
|
-
rmSync(target, { force: true });
|
|
125
|
-
deps.io.out(`Removed ${target}; the inherited guidance now applies.`);
|
|
159
|
+
rmSync(target.path, { force: true });
|
|
160
|
+
deps.io.out(`Removed ${target.path}; the inherited guidance now applies.`);
|
|
126
161
|
return EXIT.ok;
|
|
127
162
|
}
|
|
128
163
|
//# sourceMappingURL=commands-guidance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands-guidance.js","sourceRoot":"","sources":["../src/commands-guidance.ts"],"names":[],"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,EAAE,CAAC,GAAG,CACT,+KAA+K,CAChL,CAAA;IACH,CAAC;IACD,OAAO,IAAI,CAAC,EAAE,CAAA;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,IAAiB,EACjB,KAAa,EACb,KAA4B;IAE5B,MAAM,MAAM,GAAG,MAAM,sBAAsB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;IAC/D,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC,KAAK,CAAA;IACtC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7B,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,kBAAkB,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;QACpD,OAAO,IAAI,CAAC,EAAE,CAAA;IAChB,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QACf,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,UAAU,MAAM,CAAC,IAAI,GAAG,CAAC,CAAA;QACjE,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAA;YACvE,OAAO,IAAI,CAAC,KAAK,CAAA;QACnB,CAAC;IACH,CAAC;IACD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IACpC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,WAAW,MAAM,CAAC,IAAI,uCAAuC,CAAC,CAAA;IAC1E,OAAO,IAAI,CAAC,EAAE,CAAA;AAChB,CAAC"}
|
package/dist/commands-hooks.d.ts
CHANGED
|
@@ -3,14 +3,16 @@ import { type HookHarness } from './hooks.js';
|
|
|
3
3
|
import { type Harness, type Installation } from './install-hooks.js';
|
|
4
4
|
import { type CommandDeps } from './commands-core.js';
|
|
5
5
|
import { type ActiveHarnessSession } from './commands-harness-context.js';
|
|
6
|
-
export declare const HOOK_EVENTS: readonly ["user-prompt-submit", "stop", "session-end"];
|
|
6
|
+
export declare const HOOK_EVENTS: readonly ["session-start", "subagent-start", "activation-stop", "user-prompt-submit", "stop", "session-end"];
|
|
7
7
|
export type HookEvent = (typeof HOOK_EVENTS)[number];
|
|
8
|
+
/** Lifecycle handlers one installed harness must carry in this CLI build. */
|
|
9
|
+
export declare function requiredHookEvents(harness: Harness): readonly HookEvent[];
|
|
8
10
|
/** SessionEnd cleanup must precede every diagnostic that can wait on a file lock. */
|
|
9
11
|
export declare function hookDefersDiagnosticsUntilAfterCleanup(event: unknown): event is 'session-end';
|
|
10
12
|
/**
|
|
11
13
|
* Runs one harness hook. Contract with every harness: hook JSON arrives on
|
|
12
|
-
* stdin,
|
|
13
|
-
* exit 0 with no stdout means "no decision — carry on as normal".
|
|
14
|
+
* stdin, harness output (if any) goes to stdout, diagnostics go to stderr, and
|
|
15
|
+
* exit 0 with no stdout means "no decision or added context — carry on as normal".
|
|
14
16
|
*
|
|
15
17
|
* Every failure path in here must reach that no-decision state. A hook that
|
|
16
18
|
* throws, or that blocks past the harness's timeout, degrades the agent for a
|
|
@@ -40,6 +42,8 @@ export interface AskFlags {
|
|
|
40
42
|
multi?: boolean;
|
|
41
43
|
/** Optional Markdown context appended after the question block. */
|
|
42
44
|
body?: string;
|
|
45
|
+
/** Allow visible backslash-n sequences in `--body`. */
|
|
46
|
+
literalBackslashN?: boolean;
|
|
43
47
|
/** Raw JSON for a multi-question form; replaces the positional question. */
|
|
44
48
|
form?: string;
|
|
45
49
|
image?: string[];
|
|
@@ -99,8 +103,9 @@ export declare function acknowledgeCommand(deps: CommandDeps, requestId: string,
|
|
|
99
103
|
json?: boolean;
|
|
100
104
|
}): Promise<number>;
|
|
101
105
|
/** Retire a question so a late answer is rejected rather than silently lost. */
|
|
102
|
-
export declare function closeCommand(deps: CommandDeps, requestId: string, flags?: {
|
|
106
|
+
export declare function closeCommand(deps: CommandDeps, requestId: string | undefined, flags?: {
|
|
103
107
|
json?: boolean;
|
|
108
|
+
pending?: boolean;
|
|
104
109
|
}): Promise<number>;
|
|
105
110
|
export interface HooksInstallFlags {
|
|
106
111
|
harness?: string;
|