@signalhousellc/sdk 1.5.1 → 1.6.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/README.md +5 -56
- package/index.d.ts +1 -0
- package/index.js +2 -0
- package/package.json +32 -34
- package/voice-browser.d.ts +1 -0
- package/voice-browser.js +2 -0
- package/warn.js +7 -0
- package/webhooks.d.ts +1 -0
- package/webhooks.js +2 -0
- package/scripts/install-skills.mjs +0 -329
- package/skills/VENDORED.json +0 -22
- package/skills/signalhouse-10dlc/SKILL.md +0 -172
- package/skills/signalhouse-10dlc/examples/brightsmile-onboarding.md +0 -62
- package/skills/signalhouse-10dlc/references/tcr-rejection-causes.md +0 -104
- package/skills/signalhouse-advisor/SKILL.md +0 -84
- package/skills/signalhouse-numbers/SKILL.md +0 -82
- package/skills/signalhouse-setup/SKILL.md +0 -121
- package/skills/signalhouse-sms/SKILL.md +0 -81
- package/skills/signalhouse-webhooks/SKILL.md +0 -148
- package/src/SignalHouseSDK.js +0 -201
- package/src/domains/Agents.js +0 -987
- package/src/domains/Auth.js +0 -225
- package/src/domains/Billing.js +0 -265
- package/src/domains/Brands.js +0 -566
- package/src/domains/Campaigns.js +0 -691
- package/src/domains/Dnc.js +0 -168
- package/src/domains/Groups.js +0 -187
- package/src/domains/Landings.js +0 -237
- package/src/domains/Messages.js +0 -609
- package/src/domains/Notifications.js +0 -62
- package/src/domains/Numbers.js +0 -574
- package/src/domains/Onboarding.js +0 -128
- package/src/domains/Registrations.js +0 -246
- package/src/domains/Shortlinks.js +0 -80
- package/src/domains/Subgroups.js +0 -136
- package/src/domains/Subscriptions.js +0 -164
- package/src/domains/Templates.js +0 -403
- package/src/domains/Tickets.js +0 -100
- package/src/domains/Users.js +0 -228
- package/src/domains/Voice.js +0 -41
- package/src/domains/Webhooks.js +0 -125
- package/src/domains/voice/Analytics.js +0 -82
- package/src/domains/voice/CallLogs.js +0 -111
- package/src/domains/voice/Calls.js +0 -118
- package/src/domains/voice/GlobalVoiceSettings.js +0 -54
- package/src/domains/voice/NumberRoutes.js +0 -82
- package/src/domains/voice/ProgrammableVoiceProfiles.js +0 -191
- package/src/domains/voice/SipProfiles.js +0 -203
- package/src/domains/voice/SipTrunks.js +0 -203
- package/src/domains/voice/Tokens.js +0 -96
- package/src/domains/voice/browser/Call.js +0 -366
- package/src/domains/voice/browser/Device.js +0 -484
- package/src/domains/voice/browser/index.js +0 -17
- package/src/webhooks/verifySignature.js +0 -66
package/README.md
CHANGED
|
@@ -1,57 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
> **This package has moved.** `@signalhousellc/sdk` is now [`@signalhouse-sms/sdk`](https://www.npmjs.com/package/@signalhouse-sms/sdk), developed at
|
|
2
|
+
> https://github.com/signalhouse-sms/sdk-js. This package is a thin shim that installs `@signalhouse-sms/sdk` at the
|
|
3
|
+
> same version and re-exports it. It receives every release until **2027-05-01**, then stops.
|
|
4
|
+
>
|
|
5
|
+
> **Migrate:** `npm install @signalhouse-sms/sdk`, then change every import from `@signalhousellc/sdk` to `@signalhouse-sms/sdk`. The API is identical.
|
|
2
6
|
|
|
3
|
-
A lightweight Node.js SDK for the Signal House platform.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @signalhouse/sdk
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Agent skills
|
|
12
|
-
|
|
13
|
-
The package bundles the Signal House agent skills, which teach a coding agent the order the
|
|
14
|
-
platform enforces, what carriers require, and what a send cannot do before a campaign is approved.
|
|
15
|
-
|
|
16
|
-
If your project already has a `.claude/` or `.agents/` directory, installing the SDK offers to copy
|
|
17
|
-
them in. Otherwise, install them yourself:
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npx signalhouse-skills # install into the current project
|
|
21
|
-
npx signalhouse-skills --force # create the agent directory if the project has none yet
|
|
22
|
-
npx signalhouse-skills --path .. # install somewhere else
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
The installer only ever writes inside the project, never your home directory, and never overwrites
|
|
26
|
-
a skill you have edited. Set `SIGNALHOUSE_SKILLS=0` to turn it off, or `SIGNALHOUSE_SKILLS=1` to
|
|
27
|
-
install during a postinstall into a project that has no agent directory yet. The automatic
|
|
28
|
-
postinstall is skipped in CI; running the command yourself is not.
|
|
29
|
-
|
|
30
|
-
Quick Start
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
import { SignalHouseSDK } from '@signalhouse/sdk';
|
|
34
|
-
|
|
35
|
-
const sdk = new SignalHouseSDK({
|
|
36
|
-
apiKey: 'your-api-key',
|
|
37
|
-
baseUrl: 'api url'
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
const token = await sdk.auth.login({
|
|
41
|
-
email: 'youremail',
|
|
42
|
-
password: 'yourpassword'
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
console.log(token);
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Features
|
|
49
|
-
Full support for Signal House API v2
|
|
50
|
-
Integrated Axios with standardized returns
|
|
51
|
-
Lightweight and tree-shakeable
|
|
52
|
-
|
|
53
|
-
Documentation
|
|
54
|
-
For full API reference and advanced usage, visit https://api.signalhouse.io
|
|
55
|
-
|
|
56
|
-
License
|
|
57
|
-
ISC © Signal House
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@signalhouse-sms/sdk";
|
package/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,48 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signalhousellc/sdk",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.6.0",
|
|
4
|
+
"description": "Deprecated: moved to @signalhouse-sms/sdk. This package installs and re-exports it.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"types": "./index.d.ts",
|
|
7
8
|
"exports": {
|
|
8
|
-
".":
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./index.d.ts",
|
|
11
|
+
"default": "./index.js"
|
|
12
|
+
},
|
|
13
|
+
"./voice-browser": {
|
|
14
|
+
"types": "./voice-browser.d.ts",
|
|
15
|
+
"default": "./voice-browser.js"
|
|
16
|
+
},
|
|
17
|
+
"./webhooks": {
|
|
18
|
+
"types": "./webhooks.d.ts",
|
|
19
|
+
"default": "./webhooks.js"
|
|
20
|
+
}
|
|
11
21
|
},
|
|
12
22
|
"files": [
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
23
|
+
"index.js",
|
|
24
|
+
"index.d.ts",
|
|
25
|
+
"voice-browser.js",
|
|
26
|
+
"voice-browser.d.ts",
|
|
27
|
+
"webhooks.js",
|
|
28
|
+
"webhooks.d.ts",
|
|
29
|
+
"warn.js",
|
|
16
30
|
"README.md"
|
|
17
31
|
],
|
|
18
|
-
"
|
|
19
|
-
"signalhouse-
|
|
20
|
-
},
|
|
21
|
-
"scripts": {
|
|
22
|
-
"postinstall": "node scripts/install-skills.mjs",
|
|
23
|
-
"sync-skills": "node scripts/sync-skills.mjs",
|
|
24
|
-
"build:types": "tsc -p tsconfig.json",
|
|
25
|
-
"check:types": "tsc -p tsconfig.json --noEmit"
|
|
26
|
-
},
|
|
27
|
-
"agents": {
|
|
28
|
-
"skills": "./skills"
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@signalhouse-sms/sdk": "1.6.0"
|
|
29
34
|
},
|
|
30
35
|
"author": "Signal House LLC",
|
|
31
36
|
"license": "ISC",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"jssip": "^3.13.0"
|
|
37
|
-
},
|
|
38
|
-
"peerDependenciesMeta": {
|
|
39
|
-
"jssip": {
|
|
40
|
-
"optional": true
|
|
41
|
-
}
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/signalhouse-sms/sdk-js.git",
|
|
40
|
+
"directory": "legacy"
|
|
42
41
|
},
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
"typescript": "^5.9.3"
|
|
42
|
+
"homepage": "https://github.com/signalhouse-sms/sdk-js#readme",
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
47
45
|
}
|
|
48
46
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@signalhouse-sms/sdk/voice-browser";
|
package/voice-browser.js
ADDED
package/warn.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Guarded because ./voice-browser runs in browsers, where process is undefined.
|
|
2
|
+
if (typeof process !== "undefined" && typeof process.emitWarning === "function") {
|
|
3
|
+
process.emitWarning("@signalhousellc/sdk has moved to @signalhouse-sms/sdk. Install @signalhouse-sms/sdk and update your imports; this package stops receiving releases on 2027-05-01.", {
|
|
4
|
+
type: "DeprecationWarning",
|
|
5
|
+
code: "SIGNALHOUSE_SDK_MOVED",
|
|
6
|
+
});
|
|
7
|
+
}
|
package/webhooks.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@signalhouse-sms/sdk/webhooks";
|
package/webhooks.js
ADDED
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* SKILLS-05 - place the bundled Signal House skills where a coding agent will find them.
|
|
4
|
-
*
|
|
5
|
-
* Runs as the package postinstall, and also by hand as `npx signalhouse-skills`.
|
|
6
|
-
*
|
|
7
|
-
* A postinstall that writes outside its own package is intrusive, so this one is deliberately
|
|
8
|
-
* narrow:
|
|
9
|
-
*
|
|
10
|
-
* - PROJECT scope only. It writes to `<project>/.claude/skills/` and `<project>/.agents/skills/`,
|
|
11
|
-
* never to the home directory. A dependency install must not modify a developer's global agent
|
|
12
|
-
* configuration.
|
|
13
|
-
* - It only acts when the project ALREADY uses one of those agent directories, so installing the
|
|
14
|
-
* SDK into a project that has never heard of agent skills changes nothing. Set
|
|
15
|
-
* SIGNALHOUSE_SKILLS=1 to install anyway.
|
|
16
|
-
* - It is skipped entirely in CI, and by SIGNALHOUSE_SKILLS=0.
|
|
17
|
-
* - It never overwrites a file whose content differs from what a previous run wrote. An edited
|
|
18
|
-
* skill is the developer's, and silently replacing it on the next `npm update` would be a bug.
|
|
19
|
-
* - It always exits 0. Nothing here is important enough to fail somebody's install.
|
|
20
|
-
*
|
|
21
|
-
* The skills themselves are bundled in the package (see scripts/sync-skills.mjs), so this does no
|
|
22
|
-
* network access and works offline.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
import { createHash } from "node:crypto";
|
|
26
|
-
import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
27
|
-
import { dirname, isAbsolute, join, resolve, sep } from "node:path";
|
|
28
|
-
import { fileURLToPath } from "node:url";
|
|
29
|
-
|
|
30
|
-
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
31
|
-
const PKG_ROOT = resolve(HERE, "..");
|
|
32
|
-
const BUNDLED = join(PKG_ROOT, "skills");
|
|
33
|
-
|
|
34
|
-
// Project-scope paths, taken from the `skills` CLI's own agent table (vercel-labs/skills).
|
|
35
|
-
// Claude Code reads .claude/skills/; Cursor and GitHub Copilot both read .agents/skills/.
|
|
36
|
-
const AGENT_DIRS = [
|
|
37
|
-
{ marker: ".claude", dest: join(".claude", "skills"), label: "Claude Code" },
|
|
38
|
-
{ marker: ".agents", dest: join(".agents", "skills"), label: "Cursor / Copilot" },
|
|
39
|
-
];
|
|
40
|
-
|
|
41
|
-
const RECEIPT = ".signalhouse-skills.json";
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* sha256 of a file, as hex.
|
|
45
|
-
*
|
|
46
|
-
* @param {string} path - Absolute file path.
|
|
47
|
-
* @returns {string} - Hex digest.
|
|
48
|
-
*/
|
|
49
|
-
function sha256(path) {
|
|
50
|
-
return createHash("sha256").update(readFileSync(path)).digest("hex");
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Every file under a directory, relative to it.
|
|
55
|
-
*
|
|
56
|
-
* @param {string} root - Directory to walk.
|
|
57
|
-
* @param {string} [prefix=""] - Accumulated relative prefix.
|
|
58
|
-
* @returns {string[]} - Relative file paths.
|
|
59
|
-
*/
|
|
60
|
-
function walk(root, prefix = "") {
|
|
61
|
-
const out = [];
|
|
62
|
-
for (const entry of readdirSync(join(root, prefix))) {
|
|
63
|
-
const rel = prefix ? join(prefix, entry) : entry;
|
|
64
|
-
if (statSync(join(root, rel)).isDirectory()) out.push(...walk(root, rel));
|
|
65
|
-
else out.push(rel);
|
|
66
|
-
}
|
|
67
|
-
return out;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/** True when npm is running this as the package's postinstall rather than a user invoking the bin. */
|
|
71
|
-
const IS_POSTINSTALL = process.env.npm_lifecycle_event === "postinstall";
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Locate the project to install into.
|
|
75
|
-
*
|
|
76
|
-
* The two entry points need different answers, and conflating them is why the bin used to do
|
|
77
|
-
* nothing:
|
|
78
|
-
*
|
|
79
|
-
* - As a POSTINSTALL, the only trustworthy signal is INIT_CWD, which npm sets to the directory the
|
|
80
|
-
* install was started from. `process.cwd()` during a lifecycle script is the package's own
|
|
81
|
-
* directory inside node_modules, so falling back to it would write skills into node_modules.
|
|
82
|
-
* Absent INIT_CWD there is no safe guess, so it does nothing.
|
|
83
|
-
* - As the BIN (`npx signalhouse-skills`), npm sets no INIT_CWD, and the user is standing in the
|
|
84
|
-
* project they mean. `process.cwd()` is exactly right.
|
|
85
|
-
*
|
|
86
|
-
* @param {string|null} [override=null] - Explicit --path argument, which always wins.
|
|
87
|
-
* @returns {string|null} - Absolute project path, or null when it cannot be determined safely.
|
|
88
|
-
*/
|
|
89
|
-
function findProjectRoot(override = null) {
|
|
90
|
-
if (override) return resolve(override);
|
|
91
|
-
|
|
92
|
-
if (!IS_POSTINSTALL) return process.cwd();
|
|
93
|
-
|
|
94
|
-
const initCwd = process.env.INIT_CWD;
|
|
95
|
-
if (!initCwd) return null;
|
|
96
|
-
const resolved = resolve(initCwd);
|
|
97
|
-
if (resolved === PKG_ROOT) return null;
|
|
98
|
-
// Split on the separator rather than a substring match, so a project living under a directory
|
|
99
|
-
// merely NAMED something like "my-node_modules-tools" is not mistaken for a nested install.
|
|
100
|
-
if (resolved.split(sep).includes("node_modules")) return null;
|
|
101
|
-
return resolved;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* True when a path really lands inside the project, following symlinks.
|
|
106
|
-
*
|
|
107
|
-
* `resolve()` only normalises text, so it cannot see that `.claude` is a symlink to somewhere else.
|
|
108
|
-
* A project that symlinks its agent directory to a shared or home-directory config is a normal
|
|
109
|
-
* setup, and without this check a dependency's postinstall would write straight through it -
|
|
110
|
-
* exactly the "never outside the project, never your home directory" promise this script makes.
|
|
111
|
-
*
|
|
112
|
-
* realpathSync needs an existing path, so this walks up to the nearest ancestor that exists and
|
|
113
|
-
* resolves that instead.
|
|
114
|
-
*
|
|
115
|
-
* @param {string} projectRoot - Absolute project path.
|
|
116
|
-
* @param {string} candidate - Absolute path the installer wants to write under.
|
|
117
|
-
* @returns {boolean} - Whether the real destination is contained by the real project root.
|
|
118
|
-
*/
|
|
119
|
-
function resolvesInsideProject(projectRoot, candidate) {
|
|
120
|
-
let probe = candidate;
|
|
121
|
-
while (!existsSync(probe)) {
|
|
122
|
-
const parent = dirname(probe);
|
|
123
|
-
if (parent === probe) return false;
|
|
124
|
-
probe = parent;
|
|
125
|
-
}
|
|
126
|
-
try {
|
|
127
|
-
const realProbe = realpathSync(probe);
|
|
128
|
-
const realRoot = realpathSync(projectRoot);
|
|
129
|
-
return realProbe === realRoot || realProbe.startsWith(realRoot + sep);
|
|
130
|
-
} catch {
|
|
131
|
-
return false;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Install the bundled skills into one agent directory.
|
|
137
|
-
*
|
|
138
|
-
* @param {string} projectRoot - Absolute project path.
|
|
139
|
-
* @param {{marker: string, dest: string, label: string}} agent - Target agent directory.
|
|
140
|
-
* @param {Object} receipt - Path-to-hash map written by the previous run, empty on first install.
|
|
141
|
-
* @returns {{written: string[], skipped: string[], target: string}} - What changed.
|
|
142
|
-
*/
|
|
143
|
-
function installTo(projectRoot, agent, receipt) {
|
|
144
|
-
const target = join(projectRoot, agent.dest);
|
|
145
|
-
const written = [];
|
|
146
|
-
const skipped = [];
|
|
147
|
-
|
|
148
|
-
for (const skill of readdirSync(BUNDLED)) {
|
|
149
|
-
const skillDir = join(BUNDLED, skill);
|
|
150
|
-
if (!statSync(skillDir).isDirectory()) continue;
|
|
151
|
-
|
|
152
|
-
for (const rel of walk(skillDir)) {
|
|
153
|
-
const src = join(skillDir, rel);
|
|
154
|
-
const dst = join(target, skill, rel);
|
|
155
|
-
const key = join(agent.dest, skill, rel);
|
|
156
|
-
|
|
157
|
-
if (existsSync(dst)) {
|
|
158
|
-
const current = sha256(dst);
|
|
159
|
-
if (current === sha256(src)) continue;
|
|
160
|
-
// Present, different, and not what we last wrote: the developer edited it. Leave it.
|
|
161
|
-
// An absent receipt entry reads the same way, since we cannot claim we wrote it.
|
|
162
|
-
if (receipt[key] !== current) {
|
|
163
|
-
skipped.push(join(skill, rel));
|
|
164
|
-
continue;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
mkdirSync(dirname(dst), { recursive: true });
|
|
169
|
-
copyFileSync(src, dst);
|
|
170
|
-
receipt[key] = sha256(dst);
|
|
171
|
-
written.push(join(skill, rel));
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return { written, skipped, target };
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* True when a receipt key must never be turned into a filesystem path.
|
|
180
|
-
*
|
|
181
|
-
* @param {string} key - Receipt key, expected to be a project-relative path we wrote.
|
|
182
|
-
* @returns {boolean} - Whether the key is absolute or contains a parent-directory segment.
|
|
183
|
-
*/
|
|
184
|
-
function isUnsafeKey(key) {
|
|
185
|
-
if (typeof key !== "string" || !key) return true;
|
|
186
|
-
if (isAbsolute(key)) return true;
|
|
187
|
-
return key.split(/[\\/]/).includes("..");
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Remove skill files a previous run wrote that the current bundle no longer contains.
|
|
192
|
-
*
|
|
193
|
-
* Upgrades are otherwise additive: a file dropped or renamed upstream stays on disk forever and
|
|
194
|
-
* keeps feeding an agent instructions the release deliberately withdrew. The receipt records exactly
|
|
195
|
-
* what we wrote, so a file whose hash still matches its receipt entry is provably ours and
|
|
196
|
-
* unmodified, and only those are removed. A developer's edit is reported instead, never deleted.
|
|
197
|
-
*
|
|
198
|
-
* @param {string} projectRoot - Absolute project path.
|
|
199
|
-
* @param {Object} receipt - Path-to-hash map from the previous run, mutated in place.
|
|
200
|
-
* @param {Set<string>} currentKeys - Receipt keys the current bundle just wrote or verified.
|
|
201
|
-
* @returns {{removed: string[], orphaned: string[], refused: string[]}} - Deleted paths, stale ones
|
|
202
|
-
* left alone, and entries refused as unsafe.
|
|
203
|
-
*/
|
|
204
|
-
function pruneObsolete(projectRoot, receipt, currentKeys) {
|
|
205
|
-
const removed = [];
|
|
206
|
-
const orphaned = [];
|
|
207
|
-
const refused = [];
|
|
208
|
-
|
|
209
|
-
for (const key of Object.keys(receipt)) {
|
|
210
|
-
if (key === "_ref" || currentKeys.has(key)) continue;
|
|
211
|
-
const dst = join(projectRoot, key);
|
|
212
|
-
// The receipt is a file on disk, so its keys are untrusted input to a delete. A key that is
|
|
213
|
-
// absolute or climbs out with `..` would aim rmSync at something we never wrote. Such an
|
|
214
|
-
// entry is dropped, never followed: there is no honest reading of it.
|
|
215
|
-
if (isUnsafeKey(key) || !resolvesInsideProject(projectRoot, dst)) {
|
|
216
|
-
delete receipt[key];
|
|
217
|
-
refused.push(key);
|
|
218
|
-
continue;
|
|
219
|
-
}
|
|
220
|
-
if (!existsSync(dst)) {
|
|
221
|
-
delete receipt[key];
|
|
222
|
-
continue;
|
|
223
|
-
}
|
|
224
|
-
if (sha256(dst) !== receipt[key]) {
|
|
225
|
-
orphaned.push(key);
|
|
226
|
-
continue;
|
|
227
|
-
}
|
|
228
|
-
rmSync(dst);
|
|
229
|
-
delete receipt[key];
|
|
230
|
-
removed.push(key);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
return { removed, orphaned, refused };
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
try {
|
|
237
|
-
const args = process.argv.slice(2);
|
|
238
|
-
const pathArg = args.includes("--path") ? args[args.indexOf("--path") + 1] : null;
|
|
239
|
-
// An explicit --force, and an explicit run of the bin at all, are the user asking for this.
|
|
240
|
-
// A postinstall is not, so it stays conservative.
|
|
241
|
-
const forced = args.includes("--force") || process.env.SIGNALHOUSE_SKILLS === "1";
|
|
242
|
-
|
|
243
|
-
if (process.env.SIGNALHOUSE_SKILLS === "0") process.exit(0);
|
|
244
|
-
// CI skipping applies to the unattended path. Someone typing the command in CI means it.
|
|
245
|
-
if (IS_POSTINSTALL && process.env.CI && !forced) process.exit(0);
|
|
246
|
-
// An INSTALLED copy of this package always lives under node_modules. When it does not, this is
|
|
247
|
-
// the source checkout, and a postinstall here is the SDK's own monorepo running its workspace
|
|
248
|
-
// install - which would write skills and an untracked receipt into the shared engineering repo
|
|
249
|
-
// on every `npm install` at the root. Running the bin by hand from a checkout is still allowed,
|
|
250
|
-
// because that is somebody asking for it.
|
|
251
|
-
if (IS_POSTINSTALL && !PKG_ROOT.split(sep).includes("node_modules")) process.exit(0);
|
|
252
|
-
if (!existsSync(BUNDLED)) process.exit(0);
|
|
253
|
-
|
|
254
|
-
const projectRoot = findProjectRoot(pathArg);
|
|
255
|
-
if (!projectRoot) process.exit(0);
|
|
256
|
-
const candidates = AGENT_DIRS.filter((a) => forced || existsSync(join(projectRoot, a.marker)));
|
|
257
|
-
// A marker that resolves outside the project is skipped rather than followed. Silently writing
|
|
258
|
-
// through it would break the guarantee at the top of this file.
|
|
259
|
-
const targets = candidates.filter((a) => {
|
|
260
|
-
if (resolvesInsideProject(projectRoot, join(projectRoot, a.dest))) return true;
|
|
261
|
-
console.log(`Skipping ${a.label}: ${a.dest} resolves outside this project.`);
|
|
262
|
-
return false;
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
if (targets.length === 0) {
|
|
266
|
-
const vendored = JSON.parse(readFileSync(join(BUNDLED, "VENDORED.json"), "utf8"));
|
|
267
|
-
// The advice has to differ by how we were invoked. Telling someone who just RAN this command
|
|
268
|
-
// to run it again is a loop; they need --force. A postinstall is not a request, so it only
|
|
269
|
-
// mentions the command exists.
|
|
270
|
-
const advice = IS_POSTINSTALL
|
|
271
|
-
? "Run `npx signalhouse-skills --force` to install them into this project."
|
|
272
|
-
: `No agent directory found in ${projectRoot}. Re-run with --force to create one.`;
|
|
273
|
-
console.log(
|
|
274
|
-
`\n@signalhousellc/sdk bundles ${vendored.skills.length} agent skills ` +
|
|
275
|
-
`(${vendored.skills.join(", ")}).\n${advice}\n`,
|
|
276
|
-
);
|
|
277
|
-
process.exit(0);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
const receiptPath = join(projectRoot, RECEIPT);
|
|
281
|
-
const receipt = existsSync(receiptPath) ? JSON.parse(readFileSync(receiptPath, "utf8")) : {};
|
|
282
|
-
const previousRef = receipt._ref ?? null;
|
|
283
|
-
const vendored = JSON.parse(readFileSync(join(BUNDLED, "VENDORED.json"), "utf8"));
|
|
284
|
-
|
|
285
|
-
let totalWritten = 0;
|
|
286
|
-
const allSkipped = new Set();
|
|
287
|
-
const labels = [];
|
|
288
|
-
|
|
289
|
-
const currentKeys = new Set();
|
|
290
|
-
for (const agent of targets) {
|
|
291
|
-
const { written, skipped } = installTo(projectRoot, agent, receipt);
|
|
292
|
-
totalWritten += written.length;
|
|
293
|
-
for (const s of skipped) allSkipped.add(s);
|
|
294
|
-
if (written.length > 0) labels.push(agent.label);
|
|
295
|
-
for (const skill of readdirSync(BUNDLED)) {
|
|
296
|
-
const skillDir = join(BUNDLED, skill);
|
|
297
|
-
if (!statSync(skillDir).isDirectory()) continue;
|
|
298
|
-
for (const rel of walk(skillDir)) currentKeys.add(join(agent.dest, skill, rel));
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
const { removed, orphaned, refused } = pruneObsolete(projectRoot, receipt, currentKeys);
|
|
303
|
-
if (removed.length) console.log(`Removed ${removed.length} skill file(s) withdrawn upstream.`);
|
|
304
|
-
if (orphaned.length) console.log(`Left ${orphaned.length} edited file(s) no longer bundled: ${orphaned.join(", ")}`);
|
|
305
|
-
if (refused.length) console.log(`Ignored ${refused.length} receipt entr(ies) pointing outside this project.`);
|
|
306
|
-
|
|
307
|
-
receipt._ref = vendored.ref;
|
|
308
|
-
writeFileSync(receiptPath, `${JSON.stringify(receipt, null, 2)}\n`);
|
|
309
|
-
|
|
310
|
-
// The version notification: say what moved, not just that something did. On a first install
|
|
311
|
-
// that is the skill list; on an upgrade it is the ref it moved from.
|
|
312
|
-
if (totalWritten > 0) {
|
|
313
|
-
const moved = previousRef && previousRef !== vendored.ref
|
|
314
|
-
? `updated ${previousRef} -> ${vendored.ref}`
|
|
315
|
-
: `installed ${vendored.ref}`;
|
|
316
|
-
console.log(`\nSignal House agent skills ${moved} for ${labels.join(" and ")}.`);
|
|
317
|
-
console.log(` ${vendored.skills.join(", ")}`);
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
if (allSkipped.size > 0) {
|
|
321
|
-
console.log(` Left ${allSkipped.size} locally modified file(s) alone: ${[...allSkipped].join(", ")}`);
|
|
322
|
-
}
|
|
323
|
-
if (totalWritten > 0 || allSkipped.size > 0) console.log("");
|
|
324
|
-
} catch (error) {
|
|
325
|
-
// Never fail an install over this.
|
|
326
|
-
if (process.env.SIGNALHOUSE_SKILLS_DEBUG) console.error(error);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
process.exit(0);
|
package/skills/VENDORED.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"source": "https://github.com/bonzo-signalhouse/agent-skills.git",
|
|
3
|
-
"ref": "v0.3.0",
|
|
4
|
-
"skills": [
|
|
5
|
-
"signalhouse-10dlc",
|
|
6
|
-
"signalhouse-advisor",
|
|
7
|
-
"signalhouse-numbers",
|
|
8
|
-
"signalhouse-setup",
|
|
9
|
-
"signalhouse-sms",
|
|
10
|
-
"signalhouse-webhooks"
|
|
11
|
-
],
|
|
12
|
-
"files": {
|
|
13
|
-
"signalhouse-10dlc/SKILL.md": "6a46fddf1572b39849c07855c6ece3d3499c711e5ffa6f466d73ab54182fd49f",
|
|
14
|
-
"signalhouse-10dlc/examples/brightsmile-onboarding.md": "b5c04a551bc918f2563f1d1e59e516cf2e60fa7233490e3312a92dd1d1e9d473",
|
|
15
|
-
"signalhouse-10dlc/references/tcr-rejection-causes.md": "312d754c55dfdf8e21d085724728ae4b2288d7b485fba1c61c78f94a42780e8c",
|
|
16
|
-
"signalhouse-advisor/SKILL.md": "5e5070dc4742a1fe0195989471f809170c30fd7d8f63c33e4778215a2a446146",
|
|
17
|
-
"signalhouse-numbers/SKILL.md": "f996be53809ea2f90e49b32452f162eeff5369056e1f63e422b8fdb46d2896ff",
|
|
18
|
-
"signalhouse-setup/SKILL.md": "ca87a6d71f3f82614b83ad283971385fc55c13c097b76595b1b85def235373ec",
|
|
19
|
-
"signalhouse-sms/SKILL.md": "ec7ed8985ad590b0ab5d40c9ddb003eb8cbc566a1309ac5e330f570e0404ec42",
|
|
20
|
-
"signalhouse-webhooks/SKILL.md": "d16062e9e0a7cdda3c02aee485bd5114659405d00b1d635da1280db0179490a7"
|
|
21
|
-
}
|
|
22
|
-
}
|