@aidy-dev/server 0.1.0 → 0.2.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
CHANGED
|
@@ -35,13 +35,16 @@ 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
|
|
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. |
|
|
42
43
|
| `AIDY_NAME` | | The assistant's name. Default `Aidy`. |
|
|
43
44
|
| `AIDY_INSTRUCTIONS` | | System instructions, or `@path` to a file. |
|
|
44
45
|
| `AIDY_SKILL_GUIDE` | | Hand-written guide placed first in `/skill.md`, or `@path`. |
|
|
46
|
+
| `AIDY_SKILL_NAME` | | The `/skill.md` frontmatter `name` (a slug). Default: the product's slug, else the first label of the host's hostname. |
|
|
47
|
+
| `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
48
|
| `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
49
|
| `AIDY_MCP_AUTHORIZATION_SERVERS` | | Comma-separated OAuth issuers for MCP clients. |
|
|
47
50
|
| `AIDY_BASE_PATH` | | Prefix of every route when aidy is served below a path. |
|
|
@@ -51,8 +54,8 @@ public origin to the server, and pin the public key in your host kit.
|
|
|
51
54
|
## Docker
|
|
52
55
|
|
|
53
56
|
```bash
|
|
54
|
-
docker run -p 8080:8080 --env-file aidy.env ghcr.io/aidy-dev/aidy-server:v0.
|
|
57
|
+
docker run -p 8080:8080 --env-file aidy.env ghcr.io/aidy-dev/aidy-server:v0.2.0
|
|
55
58
|
```
|
|
56
59
|
|
|
57
60
|
To build on your own base image (an internal registry, say), pass
|
|
58
|
-
`--build-arg BASE_IMAGE=… --build-arg AIDY_VERSION=0.
|
|
61
|
+
`--build-arg BASE_IMAGE=… --build-arg AIDY_VERSION=0.2.0` to this package's `Dockerfile`.
|
package/dist/{cli.mjs → cli.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { r as ConfigError, t as serve } from "./serve-
|
|
3
|
-
import { generateKeyPair } from "@aidy-dev/spec/delegation";
|
|
2
|
+
import { r as ConfigError, t as serve } from "./serve-Mv2At2zq.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-
|
|
1
|
+
export { r as ConfigError, a as loadDocuments, n as nodeHandler, i as readSettings, t as serve } from "./serve-Mv2At2zq.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
|
-
|
|
88
|
-
|
|
89
|
-
kid: jwk.kid
|
|
90
|
-
|
|
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");
|
|
@@ -126,10 +141,10 @@ async function readSettings(env) {
|
|
|
126
141
|
},
|
|
127
142
|
signingKey: await signingKey(env),
|
|
128
143
|
...hostKeys.length > 0 ? { hostKeys: await importPublicKeys(hostKeys) } : {},
|
|
129
|
-
secret,
|
|
144
|
+
secret: previous ? [secret, previous] : secret,
|
|
130
145
|
models: { chain: models(env) },
|
|
131
146
|
...instructions ? { instructions } : {},
|
|
132
|
-
...
|
|
147
|
+
...Object.keys(skill).length > 0 ? { skill } : {},
|
|
133
148
|
...maxSteps ? { limits: { maxSteps } } : {},
|
|
134
149
|
...authorizationServers?.length ? { mcp: { authorizationServers } } : {}
|
|
135
150
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aidy-dev/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
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.
|
|
33
|
-
"@aidy-dev/
|
|
34
|
-
"@aidy-dev/
|
|
35
|
-
"@aidy-dev/
|
|
32
|
+
"@aidy-dev/core": "0.2.0",
|
|
33
|
+
"@aidy-dev/spec": "0.2.0",
|
|
34
|
+
"@aidy-dev/sql": "0.2.0",
|
|
35
|
+
"@aidy-dev/knowledge": "0.2.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@aidy-dev/conformance": "0.1.0"
|
|
File without changes
|
|
File without changes
|