@aidenhq/sdk 0.4.0 → 0.4.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/README.md +13 -6
- package/dist/src/caller.js +2 -2
- package/dist/src/fence.js +2 -2
- package/dist/src/instance-paths.js +5 -3
- package/dist/src/source-store.js +4 -4
- package/dist/src/vendor/needs.js +2 -2
- package/dist/src/vendor/oauth.js +2 -2
- package/dist/src/vendor/proxy.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,12 +5,19 @@ The code AidenHQ modules share, one copy on npm. MIT. Entry points: `types`, `en
|
|
|
5
5
|
kinds), `reviewer` (reviewer@1), `judge` (the judges' model call), `responses` and `provider` (the one streaming Responses reader, the roles a caller names and the error kinds), `paperclip` (the Paperclip HTTP client), `source-store` (source writers; `pg` is a peer
|
|
6
6
|
dependency) and `vendor/proxy`, `vendor/oauth`, `vendor/needs` (vendor connections; the MCP SDK, zod and pino are peer dependencies).
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
Every module imports it, the official ones in this repo included: a service depends on an exact version
|
|
9
|
+
(`"@aidenhq/sdk": "X.Y.Z"`), its `bun.lock` pins the integrity, and its `bunfig.toml` names `minimumReleaseAgeExcludes =
|
|
10
|
+
["@aidenhq/sdk"]` (our own scope is exempt from the 7-day rule, so a pin may be the day it is published). Not everything here
|
|
11
|
+
is on that path yet: the files `scripts/sync-shared.ts` still copies are not imported from npm.
|
|
11
12
|
|
|
12
13
|
## Releasing
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
Bump `version` in `package.json`: merging the change publishes that version. `.github/workflows/sdk-publish.yml` runs on every
|
|
16
|
+
push to `main` that touches this folder, skips a version already on npm, and otherwise publishes with npm trusted publishing
|
|
17
|
+
(provenance, no token). Pull requests that touch this folder dry-run the same publish, and fail when `src/` or `bin/` changed
|
|
18
|
+
without a version bump (services import the published package, so an unpublished change reaches nobody). The pack step
|
|
19
|
+
(`scripts/sdk-pack.ts`) compiles with this folder's own TypeScript: `bun install --frozen-lockfile --ignore-scripts` here first.
|
|
20
|
+
|
|
21
|
+
A change to the SDK lands in two steps: the PR that changes it and bumps the version; then, once it is published, the PRs that
|
|
22
|
+
move each consumer's pin (`bun add --exact @aidenhq/sdk@X.Y.Z` in its folder). A consumer's PR never depends on an SDK change that
|
|
23
|
+
is not yet on npm.
|
package/dist/src/caller.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Who a proxied tool call is for: the kernel's signed caller assertion (X-AidenHQ-Caller, an EdDSA JWT, 60 s), checked
|
|
2
2
|
// against the kernel's keys (GET /v1/jwks). A module trusts nothing else about the caller: not a header, not an argument.
|
|
3
3
|
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
4
|
+
// Every module imports it from npm (@aidenhq/sdk/caller) at an exact pin: a change here needs a version bump in package.json,
|
|
5
|
+
// which is what publishes it.
|
|
6
6
|
import { createPublicKey, verify } from "node:crypto";
|
|
7
7
|
export const CALLER_HEADER = "x-aidenhq-caller";
|
|
8
8
|
const b64 = (s) => Buffer.from(s, "base64url");
|
package/dist/src/fence.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Untrusted text (a tool result, a forwarded message, a document) as data: one marked block an agent reads as information,
|
|
2
2
|
// never as instructions. The closing marker inside the text is neutralised, so the text can't end the block early.
|
|
3
3
|
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
4
|
+
// Every module imports it from npm (@aidenhq/sdk/fence) at an exact pin: a change here needs a version bump in package.json,
|
|
5
|
+
// which is what publishes it.
|
|
6
6
|
export const FENCE_OPEN = "<untrusted-data";
|
|
7
7
|
export const FENCE_CLOSE = "</untrusted-data>";
|
|
8
8
|
export function fence(text, source) {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// The instance repo files an apply may land and a settings write may touch: instance.yaml, apps.yaml, the owner's profile,
|
|
2
2
|
// a module agent's added rules (agents/<key>.md) and handbook fork (agents/<key>/AGENTS.md), and a local module's
|
|
3
|
-
// module.yaml, agents' handbooks and skills
|
|
4
|
-
// codehost-github holds a copy,
|
|
5
|
-
|
|
3
|
+
// module.yaml, agents' handbooks and skills (a skill's SKILL.md and the references/<name>.md files it splits detail into).
|
|
4
|
+
// Pure: the kernel's apply and both code hosts (codehost-local imports it, codehost-github holds a copy,
|
|
5
|
+
// scripts/sync-shared.ts) read this one list.
|
|
6
|
+
// A reference file is one .md, one folder deep; the apply's DIFF_MAX (apply-tier.ts) already bounds what one can bring.
|
|
7
|
+
export const APPLY_PATHS = /^(instance\.yaml|apps\.yaml|owner\/profile\.md|agents\/[\w.-]+\.md|agents\/[a-z0-9][a-z0-9-]*\/AGENTS\.md|modules\/[a-z0-9][a-z0-9-]*\/(module\.yaml|agents\/[a-z0-9][a-z0-9-]*\/AGENTS\.md|skills\/[a-z0-9][a-z0-9-]*\/(SKILL\.md|references\/[A-Za-z0-9][A-Za-z0-9._-]{0,63}\.md)))$/;
|
|
6
8
|
/** Files a change touches outside what apply may land. */
|
|
7
9
|
export const strayFiles = (files) => files.filter((f) => !APPLY_PATHS.test(f));
|
package/dist/src/source-store.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Shared sources (docs/design/sources.md): the writer side. Each source writer (slack-live,
|
|
2
|
-
// github, jira, ops-mcp for meetings, google-workspace for docs) logs in to the warehouse as src_<source>, owns schema src_<source> (
|
|
3
|
-
// creates both) and writes through this: typed upserts that keep first_seen_at, bump src_meta.seq on any difference and
|
|
2
|
+
// github, jira, ops-mcp for meetings, google-workspace for docs) logs in to the warehouse as src_<source>, owns schema src_<source> (its module's
|
|
3
|
+
// warehouse.sources entry; apps-mcp creates both) and writes through this: typed upserts that keep first_seen_at, bump src_meta.seq on any difference and
|
|
4
4
|
// log tracked-field changes, a baseline flag for first syncs, per-scope sync state, and one src_meta.ingest_run per pass.
|
|
5
5
|
// No LLM anywhere: ingest is code.
|
|
6
6
|
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
7
|
+
// Every module imports it from npm (@aidenhq/sdk/source-store) at an exact pin (pg is theirs: a peer dependency): a change here needs a version bump in package.json,
|
|
8
|
+
// which is what publishes it.
|
|
9
9
|
import { readFileSync } from "node:fs";
|
|
10
10
|
import pg from "pg";
|
|
11
11
|
/** Long text is cut to about 4 KB by default; the row keeps a <field>_truncated flag and its url for the rest. */
|
package/dist/src/vendor/needs.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// The one answer a connection gives when only the owner can fix why a call can't be served (spec 2026-11-20 connect on first
|
|
2
2
|
// use §1): an MCP isError result whose structuredContent is { error: "needs_owner", need }. The kernel's tool proxy reads it
|
|
3
3
|
// before fencing, records the connection as down, and decides who hears about it (the owner, in the conversation they asked
|
|
4
|
-
// in, or the daily digest); the agent gets the kernel's own fixed words, never this text. Import-free
|
|
5
|
-
//
|
|
4
|
+
// in, or the daily digest); the agent gets the kernel's own fixed words, never this text. Import-free; every module imports it from
|
|
5
|
+
// npm (@aidenhq/sdk/vendor/needs) at an exact pin.
|
|
6
6
|
/** The causes only the owner can fix. A vendor that is down or a rate limit is a plain error, never a need. */
|
|
7
7
|
export const OWNER_CAUSES = ["not_connected", "expired", "scope", "sso", "restricted"];
|
|
8
8
|
/** The tool result a connection answers when only the owner can fix it. */
|
package/dist/src/vendor/oauth.js
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
// issuer names itself and a resource on the MCP server's origin; no request here follows a redirect or reaches a private
|
|
11
11
|
// network address.
|
|
12
12
|
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
13
|
+
// Every module imports it from npm (@aidenhq/sdk/vendor/oauth) at an exact pin: a change here needs a version bump in package.json,
|
|
14
|
+
// which is what publishes it.
|
|
15
15
|
import { createHash, randomBytes } from "node:crypto";
|
|
16
16
|
import { lookup } from "node:dns";
|
|
17
17
|
import { request } from "node:https";
|
package/dist/src/vendor/proxy.js
CHANGED
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
// connect (never a crash loop, never a silently empty tool list): a needs_owner answer (needs.ts), which the kernel routes to
|
|
16
16
|
// the owner or the digest.
|
|
17
17
|
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
18
|
+
// Every module imports it from npm (@aidenhq/sdk/vendor/proxy) at an exact pin (the MCP SDK, zod and pino are theirs: peer dependencies): a change here needs a version bump in package.json,
|
|
19
|
+
// which is what publishes it.
|
|
20
20
|
import { timingSafeEqual } from "node:crypto";
|
|
21
21
|
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
22
22
|
import { createServer } from "node:http";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aidenhq/sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "The shared code of AidenHQ modules: contract types, engine IO, the caller check and fence, write executors, the reviewer side, the judges' models and call, the source writer and the vendor MCP pass-through.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|