@aidy-dev/server 0.1.0 → 0.2.1

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 CHANGED
@@ -35,13 +35,17 @@ public origin to the server, and pin the public key in your host kit.
35
35
  | `AIDY_HOST_BASE_URL` | | Where aidy reaches your API, when that differs from the origin (an internal service URL). |
36
36
  | `AIDY_HOST_OPENAPI` | | Path or URL of your OpenAPI 3.1 document. Default `/api/openapi.json`. |
37
37
  | `AIDY_SIGNING_KEY` | yes | Private Ed25519 JWK with `kid` (`aidy-server keys`). |
38
- | `AIDY_HOST_KEYS` | | JSON array of public JWKs your host signs deferred-task completions with. |
38
+ | `AIDY_HOST_KEYS` | | JSON array of public JWKs your host signs `Aidy-Host-Assertion`s with (deferred-task completions and `POST /aidy/v0/generate`). |
39
39
  | `AIDY_SECRET` | yes | 32+ bytes; seals stored model API keys. |
40
+ | `AIDY_PREVIOUS_SECRET` | | The secret before a rotation: it still unseals saved settings, which are sealed again with `AIDY_SECRET` on first read. Remove it afterwards. |
40
41
  | `AIDY_DATABASE_URL` | yes | `postgres://…` or `sqlite:<path>`. aidy creates its own `aidy_*` tables; give it its own database or schema. |
41
- | `AIDY_MODELS` | | JSON model chain (`id`, `provider` = `openai-compatible`/`openai`/`anthropic`, `model`, `baseURL`, `apiKey`, `vision`, `providerOptions`). Admins can change it in the app. |
42
+ | `AIDY_MODELS` | | JSON model chain (`id`, `provider` = `openai-compatible`/`openai`/`anthropic`, `model`, `baseURL`, `apiKey`, `vision`, `temperature`, `maxOutputTokens`, `cooldownSeconds` = `{quota, rateLimit, error}`, `providerOptions`). Admins can change it in the app. |
43
+ | `AIDY_PRODUCT_NAME`, `AIDY_PRODUCT_SUMMARY` | | The product's name and summary in `/skill.md` and `/llms.txt` for signed-out callers, when your OpenAPI needs a sign-in. |
42
44
  | `AIDY_NAME` | | The assistant's name. Default `Aidy`. |
43
45
  | `AIDY_INSTRUCTIONS` | | System instructions, or `@path` to a file. |
44
46
  | `AIDY_SKILL_GUIDE` | | Hand-written guide placed first in `/skill.md`, or `@path`. |
47
+ | `AIDY_SKILL_NAME` | | The `/skill.md` frontmatter `name` (a slug). Default: the product's slug, else the first label of the host's hostname. |
48
+ | `AIDY_CLI_COMMAND`, `AIDY_CLI_PACKAGE`, `AIDY_CLI_INSTALL` | | The CLI `/skill.md` and `/llms.txt` name, and how to install it: its npm package, or a free-form install line (which wins), e.g. `curl -fsSL https://tm.example.com/install.sh \| sh`. Default `aidy` from `@aidy-dev/cli`. |
45
49
  | `AIDY_KNOWLEDGE_DIR`, `AIDY_KNOWLEDGE_BASE_URL` | | A directory of Markdown docs indexed for search and answers, and the URL their pages live under. |
46
50
  | `AIDY_MCP_AUTHORIZATION_SERVERS` | | Comma-separated OAuth issuers for MCP clients. |
47
51
  | `AIDY_BASE_PATH` | | Prefix of every route when aidy is served below a path. |
@@ -51,8 +55,8 @@ public origin to the server, and pin the public key in your host kit.
51
55
  ## Docker
52
56
 
53
57
  ```bash
54
- docker run -p 8080:8080 --env-file aidy.env ghcr.io/aidy-dev/aidy-server:v0.1.0
58
+ docker run -p 8080:8080 --env-file aidy.env ghcr.io/aidy-dev/aidy-server:v0.2.0
55
59
  ```
56
60
 
57
61
  To build on your own base image (an internal registry, say), pass
58
- `--build-arg BASE_IMAGE=… --build-arg AIDY_VERSION=0.1.0` to this package's `Dockerfile`.
62
+ `--build-arg BASE_IMAGE=… --build-arg AIDY_VERSION=0.2.0` to this package's `Dockerfile`.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { r as ConfigError, t as serve } from "./serve-C3GDOGWb.mjs";
3
- import { generateKeyPair } from "@aidy-dev/spec/delegation";
2
+ import { r as ConfigError, t as serve } from "./serve-QBQsWOh8.js";
3
+ import { generateKeyPair, portableJwk } from "@aidy-dev/spec/delegation";
4
4
  // src/cli.ts
5
5
  /** The `aidy-server` command. */
6
6
  const USAGE = `usage:
@@ -25,7 +25,7 @@ async function main(command, args) {
25
25
  const privateJwk = await crypto.subtle.exportKey("jwk", pair.signing.privateKey);
26
26
  process.stdout.write(`${JSON.stringify({
27
27
  signingKey: {
28
- ...privateJwk,
28
+ ...portableJwk(privateJwk),
29
29
  kid
30
30
  },
31
31
  publicKey: pair.publicJwk
@@ -1 +1 @@
1
- export { r as ConfigError, a as loadDocuments, n as nodeHandler, i as readSettings, t as serve } from "./serve-C3GDOGWb.mjs";
1
+ export { r as ConfigError, a as loadDocuments, n as nodeHandler, i as readSettings, t as serve } from "./serve-QBQsWOh8.js";
@@ -1,6 +1,6 @@
1
1
  import { readFile, readdir } from "node:fs/promises";
2
2
  import { join, relative, sep } from "node:path";
3
- import { importPublicKeys } from "@aidy-dev/spec/delegation";
3
+ import { importPublicKeys, importSigningKey } from "@aidy-dev/spec/delegation";
4
4
  import { getRequestListener } from "@hono/node-server";
5
5
  import { createServer } from "node:http";
6
6
  import { SqlStore, createAidy } from "@aidy-dev/core";
@@ -84,11 +84,10 @@ async function text(env, name) {
84
84
  async function signingKey(env) {
85
85
  const jwk = json(env, "AIDY_SIGNING_KEY");
86
86
  if (jwk.kty !== "OKP" || jwk.crv !== "Ed25519" || !jwk.d || !jwk.kid) throw new ConfigError("AIDY_SIGNING_KEY must be a private Ed25519 JWK with a kid");
87
- const privateKey = await crypto.subtle.importKey("jwk", jwk, { name: "Ed25519" }, true, ["sign"]);
88
- return {
89
- kid: jwk.kid,
90
- privateKey
91
- };
87
+ return importSigningKey({
88
+ ...jwk,
89
+ kid: jwk.kid
90
+ });
92
91
  }
93
92
  function models(env) {
94
93
  const chain = json(env, "AIDY_MODELS", []);
@@ -101,9 +100,25 @@ function models(env) {
101
100
  async function readSettings(env) {
102
101
  const secret = required(env, "AIDY_SECRET");
103
102
  if (new TextEncoder().encode(secret).length < 32) throw new ConfigError("AIDY_SECRET must be at least 32 bytes");
103
+ const previous = env.AIDY_PREVIOUS_SECRET?.trim();
104
+ if (previous && new TextEncoder().encode(previous).length < 32) throw new ConfigError("AIDY_PREVIOUS_SECRET must be at least 32 bytes");
104
105
  const hostKeys = json(env, "AIDY_HOST_KEYS", []);
105
106
  const instructions = await text(env, "AIDY_INSTRUCTIONS");
106
107
  const guide = await text(env, "AIDY_SKILL_GUIDE");
108
+ const cliCommand = env.AIDY_CLI_COMMAND?.trim();
109
+ const cliPackage = env.AIDY_CLI_PACKAGE?.trim();
110
+ const cliInstall = env.AIDY_CLI_INSTALL?.trim();
111
+ if ((cliPackage || cliInstall) && !cliCommand) throw new ConfigError("AIDY_CLI_PACKAGE and AIDY_CLI_INSTALL need AIDY_CLI_COMMAND");
112
+ const skillName = env.AIDY_SKILL_NAME?.trim();
113
+ const skill = {
114
+ ...skillName ? { name: skillName } : {},
115
+ ...guide ? { guide } : {},
116
+ ...cliCommand ? { cli: {
117
+ command: cliCommand,
118
+ ...cliPackage ? { package: cliPackage } : {},
119
+ ...cliInstall ? { install: cliInstall } : {}
120
+ } } : {}
121
+ };
107
122
  const authorizationServers = env.AIDY_MCP_AUTHORIZATION_SERVERS?.split(",").map((server) => server.trim()).filter(Boolean);
108
123
  const maxSteps = env.AIDY_MAX_STEPS ? Number(env.AIDY_MAX_STEPS) : void 0;
109
124
  if (maxSteps !== void 0 && !(Number.isInteger(maxSteps) && maxSteps > 0)) throw new ConfigError("AIDY_MAX_STEPS must be a positive integer");
@@ -119,6 +134,10 @@ async function readSettings(env) {
119
134
  url: required(env, "AIDY_URL"),
120
135
  ...env.AIDY_NAME ? { name: env.AIDY_NAME } : {},
121
136
  ...env.AIDY_BASE_PATH ? { basePath: env.AIDY_BASE_PATH } : {},
137
+ ...env.AIDY_PRODUCT_NAME ? { product: {
138
+ name: env.AIDY_PRODUCT_NAME,
139
+ ...env.AIDY_PRODUCT_SUMMARY ? { summary: env.AIDY_PRODUCT_SUMMARY } : {}
140
+ } } : {},
122
141
  host: {
123
142
  origin: required(env, "AIDY_HOST_ORIGIN"),
124
143
  ...env.AIDY_HOST_BASE_URL ? { baseUrl: env.AIDY_HOST_BASE_URL } : {},
@@ -126,10 +145,10 @@ async function readSettings(env) {
126
145
  },
127
146
  signingKey: await signingKey(env),
128
147
  ...hostKeys.length > 0 ? { hostKeys: await importPublicKeys(hostKeys) } : {},
129
- secret,
148
+ secret: previous ? [secret, previous] : secret,
130
149
  models: { chain: models(env) },
131
150
  ...instructions ? { instructions } : {},
132
- ...guide ? { skill: { guide } } : {},
151
+ ...Object.keys(skill).length > 0 ? { skill } : {},
133
152
  ...maxSteps ? { limits: { maxSteps } } : {},
134
153
  ...authorizationServers?.length ? { mcp: { authorizationServers } } : {}
135
154
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aidy-dev/server",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Run aidy beside a host in any language: `aidy-server`, a Node handler, and the Docker image.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://aidy.lpythu.workers.dev",
@@ -29,10 +29,10 @@
29
29
  "dependencies": {
30
30
  "@hono/node-server": "^2.1.9",
31
31
  "postgres": "^4.1.1",
32
- "@aidy-dev/core": "0.1.0",
33
- "@aidy-dev/knowledge": "0.1.0",
34
- "@aidy-dev/spec": "0.1.0",
35
- "@aidy-dev/sql": "0.1.0"
32
+ "@aidy-dev/core": "0.2.1",
33
+ "@aidy-dev/knowledge": "0.2.1",
34
+ "@aidy-dev/sql": "0.2.1",
35
+ "@aidy-dev/spec": "0.2.1"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@aidy-dev/conformance": "0.1.0"
File without changes
File without changes