@raidiant/notifai 0.1.7 → 0.1.8
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/README.md +9 -2
- package/dist/atomic-file.d.ts +12 -0
- package/dist/atomic-file.js +55 -0
- package/dist/atomic-file.js.map +1 -0
- package/dist/client.d.ts +2 -1
- package/dist/client.js +1 -0
- package/dist/client.js.map +1 -1
- package/dist/commands.d.ts +17 -4
- package/dist/commands.js +643 -212
- package/dist/commands.js.map +1 -1
- package/dist/hooks.d.ts +20 -7
- package/dist/hooks.js +472 -149
- package/dist/hooks.js.map +1 -1
- package/dist/install-hooks.d.ts +8 -4
- package/dist/install-hooks.js +45 -64
- package/dist/install-hooks.js.map +1 -1
- package/dist/main.js +45 -33
- package/dist/main.js.map +1 -1
- package/dist/native-skills.d.ts +31 -0
- package/dist/native-skills.js +117 -0
- package/dist/native-skills.js.map +1 -0
- package/dist/opencode-plugin.d.ts +1 -0
- package/dist/opencode-plugin.js +37 -4
- package/dist/opencode-plugin.js.map +1 -1
- package/dist/send.d.ts +0 -3
- package/dist/send.js +28 -13
- package/dist/send.js.map +1 -1
- package/package.json +12 -12
- package/src/atomic-file.ts +73 -0
- package/src/client.ts +3 -0
- package/src/commands.test.ts +932 -63
- package/src/commands.ts +780 -225
- package/src/config.test.ts +68 -6
- package/src/hooks.test.ts +398 -5
- package/src/hooks.ts +557 -161
- package/src/install-hooks.test.ts +36 -1
- package/src/install-hooks.ts +50 -68
- package/src/main.ts +54 -37
- package/src/native-skills.ts +177 -0
- package/src/opencode-plugin.ts +38 -5
- package/src/send.ts +32 -12
- package/src/skill.test.ts +43 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raidiant/notifai",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Send native phone notifications from agents and local programs",
|
|
6
6
|
"bin": {
|
|
@@ -11,14 +11,9 @@
|
|
|
11
11
|
"src",
|
|
12
12
|
"tsconfig.json"
|
|
13
13
|
],
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsc -p tsconfig.json",
|
|
16
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
17
|
-
"test": "vitest run"
|
|
18
|
-
},
|
|
19
14
|
"dependencies": {
|
|
20
15
|
"@clack/prompts": "^1.7.0",
|
|
21
|
-
"@raidiant/notifai-protocol": "0.1.
|
|
16
|
+
"@raidiant/notifai-protocol": "0.1.2",
|
|
22
17
|
"commander": "^14.0.0",
|
|
23
18
|
"smol-toml": "^1.4.0"
|
|
24
19
|
},
|
|
@@ -31,16 +26,16 @@
|
|
|
31
26
|
},
|
|
32
27
|
"license": "Apache-2.0",
|
|
33
28
|
"author": "Rafael Vidaurre",
|
|
34
|
-
"homepage": "https://github.com/
|
|
29
|
+
"homepage": "https://github.com/Raidiant-io/notifai#readme",
|
|
35
30
|
"bugs": {
|
|
36
|
-
"url": "https://github.com/
|
|
31
|
+
"url": "https://github.com/Raidiant-io/notifai/issues"
|
|
37
32
|
},
|
|
38
33
|
"publishConfig": {
|
|
39
34
|
"access": "public"
|
|
40
35
|
},
|
|
41
36
|
"repository": {
|
|
42
37
|
"type": "git",
|
|
43
|
-
"url": "git+https://github.com/
|
|
38
|
+
"url": "git+https://github.com/Raidiant-io/notifai.git",
|
|
44
39
|
"directory": "apps/cli"
|
|
45
40
|
},
|
|
46
41
|
"keywords": [
|
|
@@ -52,5 +47,10 @@
|
|
|
52
47
|
"ai",
|
|
53
48
|
"claude",
|
|
54
49
|
"codex"
|
|
55
|
-
]
|
|
56
|
-
|
|
50
|
+
],
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "tsc -p tsconfig.json",
|
|
53
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
54
|
+
"test": "vitest run"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { randomBytes } from 'node:crypto'
|
|
2
|
+
import {
|
|
3
|
+
closeSync,
|
|
4
|
+
fsyncSync,
|
|
5
|
+
lstatSync,
|
|
6
|
+
mkdirSync,
|
|
7
|
+
openSync,
|
|
8
|
+
renameSync,
|
|
9
|
+
unlinkSync,
|
|
10
|
+
writeFileSync,
|
|
11
|
+
} from 'node:fs'
|
|
12
|
+
import path from 'node:path'
|
|
13
|
+
|
|
14
|
+
export interface AtomicWriteOptions {
|
|
15
|
+
/** Mode for a newly created file. Existing regular files keep their mode. */
|
|
16
|
+
mode?: number
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Replace one regular file without exposing a truncated intermediate state.
|
|
21
|
+
*
|
|
22
|
+
* The temporary file is a unique sibling, so rename is atomic on every
|
|
23
|
+
* supported filesystem. The contents are flushed before the rename, and a
|
|
24
|
+
* symlink target is refused instead of silently writing through it.
|
|
25
|
+
*/
|
|
26
|
+
export function atomicWriteFileSync(
|
|
27
|
+
file: string,
|
|
28
|
+
contents: string,
|
|
29
|
+
options: AtomicWriteOptions = {},
|
|
30
|
+
): void {
|
|
31
|
+
mkdirSync(path.dirname(file), { recursive: true })
|
|
32
|
+
const mode = targetMode(file, options.mode ?? 0o600)
|
|
33
|
+
const temp = path.join(
|
|
34
|
+
path.dirname(file),
|
|
35
|
+
`.${path.basename(file)}.notifai-${process.pid}-${randomBytes(6).toString('hex')}.tmp`,
|
|
36
|
+
)
|
|
37
|
+
let handle: number | undefined
|
|
38
|
+
try {
|
|
39
|
+
handle = openSync(temp, 'wx', mode)
|
|
40
|
+
writeFileSync(handle, contents)
|
|
41
|
+
fsyncSync(handle)
|
|
42
|
+
closeSync(handle)
|
|
43
|
+
handle = undefined
|
|
44
|
+
renameSync(temp, file)
|
|
45
|
+
} catch (err) {
|
|
46
|
+
if (handle !== undefined) closeSync(handle)
|
|
47
|
+
try {
|
|
48
|
+
unlinkSync(temp)
|
|
49
|
+
} catch {
|
|
50
|
+
// Preserve the original error; the temp may not have been created.
|
|
51
|
+
}
|
|
52
|
+
throw err
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Mode to preserve, or the mode for a new file. Refuses a non-regular target. */
|
|
57
|
+
function targetMode(file: string, fallback: number): number {
|
|
58
|
+
let stat
|
|
59
|
+
try {
|
|
60
|
+
stat = lstatSync(file)
|
|
61
|
+
} catch (err) {
|
|
62
|
+
if ((err as NodeJS.ErrnoException).code === 'ENOENT') return fallback
|
|
63
|
+
throw err
|
|
64
|
+
}
|
|
65
|
+
if (stat.isSymbolicLink()) {
|
|
66
|
+
throw new Error(
|
|
67
|
+
`${file} is a symlink; refusing to write through it. Replace it with a regular file, ` +
|
|
68
|
+
'or use a different state directory.',
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
if (!stat.isFile()) throw new Error(`${file} is not a regular file; refusing to replace it.`)
|
|
72
|
+
return stat.mode & 0o777
|
|
73
|
+
}
|
package/src/client.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
ApiErrorBody,
|
|
3
|
+
AccountAccessResponse,
|
|
3
4
|
BeginPairingResponse,
|
|
4
5
|
CapabilityDocument,
|
|
5
6
|
CreateMediaUploadRequestT,
|
|
@@ -47,6 +48,7 @@ export interface ApiClient {
|
|
|
47
48
|
poll_verifier_hash: string
|
|
48
49
|
}): Promise<BeginPairingResponse>
|
|
49
50
|
pollPairing(pairingId: string, pollVerifier: string): Promise<PollPairingResponse>
|
|
51
|
+
accessStatus(): Promise<AccountAccessResponse>
|
|
50
52
|
listDevices(): Promise<ListDevicesResponse>
|
|
51
53
|
capabilities(platform?: Platform): Promise<CapabilityDocument>
|
|
52
54
|
submit(body: SubmitNotificationRequestT, waitSeconds: number): Promise<SubmissionReceipt>
|
|
@@ -138,6 +140,7 @@ export function createClient(
|
|
|
138
140
|
beginPairing: (body) => call('POST', '/api/v1/pairings', body),
|
|
139
141
|
pollPairing: (pairingId, pollVerifier) =>
|
|
140
142
|
call('POST', `/api/v1/pairings/${pairingId}/poll`, { poll_verifier: pollVerifier }),
|
|
143
|
+
accessStatus: () => call('GET', '/api/v1/account/access'),
|
|
141
144
|
listDevices: () => call('GET', '/api/v1/devices'),
|
|
142
145
|
capabilities: (platform = 'ios') => call('GET', `/api/v1/capabilities/${platform}`),
|
|
143
146
|
submit: (body, waitSeconds) =>
|