sanoma 0.5.0 → 0.7.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 +36 -14
- package/dist/check.d.ts +7 -14
- package/dist/check.js +10 -8
- package/dist/check.js.map +1 -1
- package/dist/cli.js +204 -67
- package/dist/cli.js.map +1 -1
- package/dist/env.js +5 -3
- package/dist/env.js.map +1 -1
- package/dist/events.d.ts +29 -0
- package/dist/events.js +12 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +3 -4
- package/dist/init.js +4 -6
- package/dist/init.js.map +1 -1
- package/dist/postgres-bin.d.ts +31 -0
- package/dist/postgres-bin.js +93 -0
- package/dist/postgres-bin.js.map +1 -0
- package/dist/postgres.d.ts +35 -21
- package/dist/postgres.js +308 -72
- package/dist/postgres.js.map +1 -1
- package/dist/serve.d.ts +24 -3
- package/dist/serve.js +62 -14
- package/dist/serve.js.map +1 -1
- package/dist/source.d.ts +9 -4
- package/dist/source.js +230 -27
- package/dist/source.js.map +1 -1
- package/dist/wakeup.d.ts +14 -0
- package/dist/wakeup.js +63 -0
- package/dist/wakeup.js.map +1 -0
- package/oxlint.json +3 -1
- package/package.json +14 -6
- package/template/.env.example +1 -1
- package/template/AGENTS.md +3 -2
- package/template/package.json +1 -1
- package/template/pnpm-workspace.yaml +5 -0
- package/template/policies/changes.cedar +8 -0
package/dist/serve.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.js","sourceRoot":"","sources":["../src/serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,a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,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC;YACnD,GAAG,CAAC,MAAM,EAAE,MAAM,IAAI,EAAE,CAAC;SAC1B,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,MAAM,EAAE,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACrC,MAAM,UAAU,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACxC,MAAM,GAAG,CAAC;IACZ,CAAC;IACD,OAAO;QACL,GAAG,EAAE,GAAG,CAAC,GAAG;QACZ,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,KAAK,CAAC,IAAI;YACR,IAAI,CAAC;gBACH,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YACnB,CAAC;oBAAS,CAAC;gBACT,IAAI,CAAC;oBACH,MAAM,MAAM,EAAE,IAAI,EAAE,CAAC;gBACvB,CAAC;wBAAS,CAAC;oBACT,MAAM,UAAU,CAAC,IAAI,EAAE,CAAC;gBAC1B,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/source.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Source } from "@sanoma-ai/workflows";
|
|
2
2
|
/**
|
|
3
3
|
* The local git checkout at `root` as a `Source`: commits on the current branch, as the
|
|
4
|
-
* machine's git identity with the author named `<author> via Sanoma`,
|
|
5
|
-
* repository by its URL with a token.
|
|
4
|
+
* machine's git identity with the author named `<author> via Sanoma`, pushes a branch to a
|
|
5
|
+
* repository by its URL with a token, and follows one there (a fast-forward). A draft is a git
|
|
6
|
+
* worktree at `<root>/.sanoma/drafts/<id>` on the branch `draft/<id>`, with the root's
|
|
7
|
+
* `node_modules` linked into it; `git worktree list` is the one record of which are open. A
|
|
8
|
+
* draft's `sanoma check` runs on `<databaseUrl>_check` (the launcher's database when it is not given).
|
|
6
9
|
*/
|
|
7
|
-
export declare function localGitSource(root: string
|
|
10
|
+
export declare function localGitSource(root: string, { databaseUrl }?: {
|
|
11
|
+
databaseUrl?: string;
|
|
12
|
+
}): Source;
|
package/dist/source.js
CHANGED
|
@@ -1,42 +1,245 @@
|
|
|
1
1
|
import { execFile } from "node:child_process";
|
|
2
|
+
import { appendFileSync, existsSync, lstatSync, mkdirSync, realpathSync, symlinkSync } from "node:fs";
|
|
3
|
+
import { readFile } from "node:fs/promises";
|
|
4
|
+
import { dirname, join, relative, resolve } from "node:path";
|
|
2
5
|
import { promisify } from "node:util";
|
|
6
|
+
import { errorMessage } from "@sanoma-ai/workflows";
|
|
3
7
|
const run = promisify(execFile);
|
|
8
|
+
/** Git in `cwd`: its output, trimmed. */
|
|
9
|
+
const gitIn = async (cwd, args, env) => (await run("git", args, { cwd, env: { ...process.env, ...env } })).stdout.trim();
|
|
10
|
+
/** Whether git in `cwd` answers yes (exit 0) or no (exit 1); a failure of git's own (exit 128) is thrown. */
|
|
11
|
+
const holds = (cwd, args) => gitIn(cwd, args).then(() => true, (err) => {
|
|
12
|
+
if (err.code === 1)
|
|
13
|
+
return false;
|
|
14
|
+
throw err;
|
|
15
|
+
});
|
|
16
|
+
/** Whether git in `cwd` ignores `path`. */
|
|
17
|
+
const ignores = (cwd, path) => holds(cwd, ["check-ignore", "--quiet", "--", path]);
|
|
18
|
+
/** A draft's id: a name, never a path. */
|
|
19
|
+
const DRAFT_ID = /^[\w-]{1,64}$/;
|
|
20
|
+
/** The draft id `id`, refused unless it is a name. */
|
|
21
|
+
function draftId(id) {
|
|
22
|
+
if (!DRAFT_ID.test(id))
|
|
23
|
+
throw new Error(`A draft's id is letters, digits, _ and -: ${JSON.stringify(id)}`);
|
|
24
|
+
return id;
|
|
25
|
+
}
|
|
26
|
+
/** The branch of the draft `id`. */
|
|
27
|
+
const branchOf = (id) => `draft/${draftId(id)}`;
|
|
28
|
+
// One git write at a time in this process, whichever source makes it: two tool calls of one turn
|
|
29
|
+
// may open, or commit to, one draft at once, and the worker and the app each hold a source.
|
|
30
|
+
let writing = Promise.resolve();
|
|
31
|
+
function serial(write) {
|
|
32
|
+
const done = writing.then(write);
|
|
33
|
+
writing = done.catch(() => undefined);
|
|
34
|
+
return done;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Git's environment for a command that reaches the repository at a URL with `token`: the token in
|
|
38
|
+
* a header, as the runtime image sends it, never in the URL, the arguments or .git/config; no
|
|
39
|
+
* prompt for anything else.
|
|
40
|
+
*/
|
|
41
|
+
const signedIn = (token) => ({
|
|
42
|
+
GIT_TERMINAL_PROMPT: "0",
|
|
43
|
+
GIT_CONFIG_COUNT: "1",
|
|
44
|
+
GIT_CONFIG_KEY_0: "http.extraHeader",
|
|
45
|
+
GIT_CONFIG_VALUE_0: `Authorization: Basic ${Buffer.from(`x-access-token:${token}`).toString("base64")}`,
|
|
46
|
+
});
|
|
47
|
+
/** A failed git command that was given `token`, as an error that never holds it. */
|
|
48
|
+
const withoutToken = (what, token) => (err) => {
|
|
49
|
+
const why = (err.stderr?.trim() || err.message).replaceAll(token, "<token>");
|
|
50
|
+
throw new Error(`${what} failed: ${why}`);
|
|
51
|
+
};
|
|
52
|
+
/** `Source.commit` in the checkout at `cwd`: the root's, or a draft's. */
|
|
53
|
+
const commitIn = (cwd) => ({ paths, message, author }) => serial(async () => {
|
|
54
|
+
// No paths would be every path to git.
|
|
55
|
+
if (!paths.length)
|
|
56
|
+
return undefined;
|
|
57
|
+
await gitIn(cwd, ["add", "--", ...paths]);
|
|
58
|
+
if (!(await gitIn(cwd, ["status", "--porcelain", "--", ...paths])))
|
|
59
|
+
return undefined;
|
|
60
|
+
// Only these paths, whatever else is staged; the email stays the machine's.
|
|
61
|
+
await gitIn(cwd, ["commit", "--quiet", "-m", message, "--", ...paths], {
|
|
62
|
+
GIT_AUTHOR_NAME: `${author} via Sanoma`,
|
|
63
|
+
});
|
|
64
|
+
return { revision: await gitIn(cwd, ["rev-parse", "HEAD"]) };
|
|
65
|
+
});
|
|
4
66
|
/**
|
|
5
67
|
* The local git checkout at `root` as a `Source`: commits on the current branch, as the
|
|
6
|
-
* machine's git identity with the author named `<author> via Sanoma`,
|
|
7
|
-
* repository by its URL with a token.
|
|
68
|
+
* machine's git identity with the author named `<author> via Sanoma`, pushes a branch to a
|
|
69
|
+
* repository by its URL with a token, and follows one there (a fast-forward). A draft is a git
|
|
70
|
+
* worktree at `<root>/.sanoma/drafts/<id>` on the branch `draft/<id>`, with the root's
|
|
71
|
+
* `node_modules` linked into it; `git worktree list` is the one record of which are open. A
|
|
72
|
+
* draft's `sanoma check` runs on `<databaseUrl>_check` (the launcher's database when it is not given).
|
|
8
73
|
*/
|
|
9
|
-
export function localGitSource(root) {
|
|
10
|
-
const git =
|
|
74
|
+
export function localGitSource(root, { databaseUrl } = {}) {
|
|
75
|
+
const git = (args, env) => gitIn(root, args, env);
|
|
76
|
+
const head = (ref = "HEAD") => git(["rev-parse", "--verify", `${ref}^{commit}`]);
|
|
77
|
+
/** Where the draft `id`'s checkout is. */
|
|
78
|
+
const draftAt = (id) => join(root, ".sanoma", "drafts", draftId(id));
|
|
79
|
+
/** Whether the local branch `branch` exists. */
|
|
80
|
+
const branched = (branch) => git(["rev-parse", "--verify", "--quiet", `refs/heads/${branch}`]).then(Boolean, () => false);
|
|
81
|
+
/** The worktrees on a `draft/<id>` branch at their place, by id: whether each is still there. */
|
|
82
|
+
const listed = async () => {
|
|
83
|
+
const at = join(realpathSync(root), ".sanoma", "drafts");
|
|
84
|
+
const entries = (await git(["worktree", "list", "--porcelain", "-z"])).split("\0\0");
|
|
85
|
+
return new Map(entries.flatMap((entry) => {
|
|
86
|
+
const fields = entry.split("\0");
|
|
87
|
+
const path = fields.find((f) => f.startsWith("worktree "))?.slice("worktree ".length);
|
|
88
|
+
const id = fields
|
|
89
|
+
.find((f) => f.startsWith("branch refs/heads/draft/"))
|
|
90
|
+
?.slice("branch refs/heads/draft/".length);
|
|
91
|
+
return id && path === join(at, id) ? [[id, !fields.some((f) => f.startsWith("prunable"))]] : [];
|
|
92
|
+
}));
|
|
93
|
+
};
|
|
11
94
|
return {
|
|
12
95
|
root,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
96
|
+
commit: commitIn(root),
|
|
97
|
+
head,
|
|
98
|
+
async push({ url, token, ref }) {
|
|
99
|
+
await git(["push", "--quiet", "--", url, `refs/heads/${ref}:refs/heads/${ref}`], signedIn(token)).catch(withoutToken(`git push to ${url}`, token));
|
|
100
|
+
},
|
|
101
|
+
remoteUrl: () => git(["remote", "get-url", "origin"]).catch((err) => {
|
|
102
|
+
// Exit 2: no remote of that name.
|
|
103
|
+
if (err.code === 2)
|
|
19
104
|
return undefined;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
105
|
+
throw err;
|
|
106
|
+
}),
|
|
107
|
+
follow: ({ url, token, ref }) => serial(async () => {
|
|
108
|
+
const on = await git(["branch", "--show-current"]);
|
|
109
|
+
if (on !== ref)
|
|
110
|
+
return { skipped: on ? `${on} is checked out, not ${ref}` : `no branch is checked out, not ${ref}` };
|
|
111
|
+
if (await git(["status", "--porcelain"]))
|
|
112
|
+
return { skipped: "the checkout has uncommitted changes" };
|
|
113
|
+
await git(["fetch", "--quiet", "--no-tags", "--", url, `refs/heads/${ref}`], signedIn(token)).catch(withoutToken(`git fetch from ${url}`, token));
|
|
114
|
+
// The commit fetched, pinned: anything else may rewrite FETCH_HEAD before the merge.
|
|
115
|
+
const fetched = await head("FETCH_HEAD");
|
|
116
|
+
if (!(await holds(root, ["merge-base", "--is-ancestor", "HEAD", fetched]))) {
|
|
117
|
+
return { skipped: `${ref} has commits ${url} does not` };
|
|
118
|
+
}
|
|
119
|
+
await git(["merge", "--quiet", "--ff-only", fetched]);
|
|
120
|
+
return { revision: fetched };
|
|
121
|
+
}),
|
|
122
|
+
async draft(id) {
|
|
123
|
+
const [branch, at] = [branchOf(id), draftAt(id)];
|
|
124
|
+
await serial(async () => {
|
|
125
|
+
const here = (await listed()).get(id);
|
|
126
|
+
if (!here) {
|
|
127
|
+
// Ignored, or every file in it would be a change in the live checkout.
|
|
128
|
+
if (!(await ignores(root, at))) {
|
|
129
|
+
throw new Error(`.sanoma/ is not in ${join(root, ".gitignore")}, so a draft there would be a change here`);
|
|
130
|
+
}
|
|
131
|
+
// One whose directory is gone (`git clean -X`) is still listed: added again over that entry alone (`-f`).
|
|
132
|
+
const over = here === false ? ["-f"] : [];
|
|
133
|
+
const from = (await branched(branch)) ? [at, branch] : ["-b", branch, at, "HEAD"];
|
|
134
|
+
await git(["worktree", "add", "--quiet", ...over, ...from]);
|
|
135
|
+
}
|
|
136
|
+
const [installed, modules] = [join(root, "node_modules"), join(at, "node_modules")];
|
|
137
|
+
if (existsSync(installed) && !lstatSync(modules, { throwIfNoEntry: false })) {
|
|
138
|
+
// Relative, so it holds when the repository moves.
|
|
139
|
+
symlinkSync(relative(at, installed), modules, "dir");
|
|
140
|
+
// `node_modules/` names a directory, not a link: the repository's own exclude file names it then.
|
|
141
|
+
if (!(await ignores(at, "node_modules"))) {
|
|
142
|
+
const exclude = resolve(at, await gitIn(at, ["rev-parse", "--git-path", "info/exclude"]));
|
|
143
|
+
mkdirSync(dirname(exclude), { recursive: true });
|
|
144
|
+
appendFileSync(exclude, "\n/node_modules\n");
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
return { branch, root: at, commit: commitIn(at) };
|
|
23
149
|
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
await git(["push", "--quiet", "--", url, `refs/heads/${ref}:refs/heads/${ref}`], env).catch((err) => {
|
|
36
|
-
const why = (err.stderr?.trim() || err.message).replaceAll(token, "<token>");
|
|
37
|
-
throw new Error(`git push to ${url} failed: ${why}`);
|
|
150
|
+
closeDraft: async (id) => {
|
|
151
|
+
const [branch, at] = [branchOf(id), draftAt(id)];
|
|
152
|
+
// Not under a check still running in it.
|
|
153
|
+
await checkingAt.get(at);
|
|
154
|
+
return serial(async () => {
|
|
155
|
+
// Forced: whatever it holds uncommitted goes with it, and one whose directory is gone too.
|
|
156
|
+
if ((await listed()).has(id))
|
|
157
|
+
await git(["worktree", "remove", "--force", at]);
|
|
158
|
+
if (await branched(branch))
|
|
159
|
+
await git(["branch", "--quiet", "-D", branch]);
|
|
38
160
|
});
|
|
39
161
|
},
|
|
162
|
+
check: async (id) => checks(draftAt(id), databaseUrl, async () => (await listed()).get(id) === true),
|
|
163
|
+
drafts: async () => [...(await listed())].flatMap(([id, here]) => (here ? [id] : [])).toSorted(),
|
|
164
|
+
async diff(id) {
|
|
165
|
+
// Three dots: from where the branch left the checked-out one, so what was merged since is not shown.
|
|
166
|
+
// No renames, so a moved file's old path is a file too; no colour, whatever the user's config.
|
|
167
|
+
const range = `HEAD...${branchOf(id)}`;
|
|
168
|
+
const [names, summary] = await Promise.all([
|
|
169
|
+
git(["diff", "--no-renames", "--name-only", "-z", range, "--"]),
|
|
170
|
+
git(["diff", "--no-renames", "--no-color", "--stat", range, "--"]),
|
|
171
|
+
]);
|
|
172
|
+
return { files: names.split("\0").filter(Boolean), summary };
|
|
173
|
+
},
|
|
40
174
|
};
|
|
41
175
|
}
|
|
176
|
+
/** How long a check may take before it is stopped and its result is that. */
|
|
177
|
+
const CHECK_TIMEOUT_MS = 15 * 60_000;
|
|
178
|
+
/**
|
|
179
|
+
* `sanoma check` on the draft at `root` (a `Source.draft`'s), as a child in it: the `sanoma` its
|
|
180
|
+
* `node_modules` holds, with this Node, an environment of `PATH`, `HOME` and `databaseUrl` alone
|
|
181
|
+
* (no credential of this process, no `.env`: a draft has none), and `SANOMA_EVENTS=1` for its
|
|
182
|
+
* result. One at a time in the process, whichever the draft and whichever source asks (the app's
|
|
183
|
+
* and the worker's): every check runs its scenarios on the one `<database>_check`. A check that
|
|
184
|
+
* gives no result (a draft not open when its turn comes, a config that does not load, no install,
|
|
185
|
+
* the timeout) is a result of one problem, saying why.
|
|
186
|
+
*/
|
|
187
|
+
function checks(root, databaseUrl, open) {
|
|
188
|
+
const done = checking.then(async () => {
|
|
189
|
+
if (!(await open()))
|
|
190
|
+
return failed(`the draft at ${root} is not open`);
|
|
191
|
+
return checkNow(root, databaseUrl).catch((err) => failed(errorMessage(err)));
|
|
192
|
+
});
|
|
193
|
+
checking = done;
|
|
194
|
+
checkingAt.set(root, done);
|
|
195
|
+
void done.then(() => checkingAt.get(root) === done && checkingAt.delete(root));
|
|
196
|
+
return done;
|
|
197
|
+
}
|
|
198
|
+
/** The last check queued, if any. */
|
|
199
|
+
let checking = Promise.resolve();
|
|
200
|
+
/** Each draft's last check queued, by its checkout, until it ends: what closing it waits for. */
|
|
201
|
+
const checkingAt = new Map();
|
|
202
|
+
const failed = (why) => ({ ok: false, problems: [`sanoma check: ${why}`], warnings: [] });
|
|
203
|
+
async function checkNow(root, databaseUrl) {
|
|
204
|
+
// The company's own install (linked into the draft).
|
|
205
|
+
const sanoma = join(root, "node_modules", "sanoma");
|
|
206
|
+
const { bin } = JSON.parse(await readFile(join(sanoma, "package.json"), "utf8"));
|
|
207
|
+
const env = { SANOMA_EVENTS: "1", ...(databaseUrl && { SANOMA_DATABASE_URL: databaseUrl }) };
|
|
208
|
+
for (const name of ["PATH", "HOME"])
|
|
209
|
+
if (process.env[name])
|
|
210
|
+
env[name] = process.env[name];
|
|
211
|
+
const ran = await promisify(execFile)(process.execPath, [join(sanoma, typeof bin === "string" ? bin : bin.sanoma), "check"], {
|
|
212
|
+
cwd: root,
|
|
213
|
+
env,
|
|
214
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
215
|
+
timeout: CHECK_TIMEOUT_MS,
|
|
216
|
+
}).catch((err) => ({ ...err, stderr: err.stderr || err.message }));
|
|
217
|
+
if (ran.code === "ERR_CHILD_PROCESS_STDIO_MAXBUFFER")
|
|
218
|
+
return failed("it printed more than its 64 MiB");
|
|
219
|
+
if (ran.killed)
|
|
220
|
+
return failed(`stopped after ${CHECK_TIMEOUT_MS / 60_000} minutes`);
|
|
221
|
+
// Beside the lines a person reads (and DBOS's), each event is a line of its own. The last one
|
|
222
|
+
// counts: the draft's own code, which the check imports, prints on the same stdout before it.
|
|
223
|
+
let result;
|
|
224
|
+
let error;
|
|
225
|
+
for (const line of ran.stdout.split("\n")) {
|
|
226
|
+
if (!line.startsWith('{"sanoma":1,'))
|
|
227
|
+
continue;
|
|
228
|
+
let event;
|
|
229
|
+
try {
|
|
230
|
+
event = JSON.parse(line);
|
|
231
|
+
}
|
|
232
|
+
catch {
|
|
233
|
+
continue; // Not the launcher's: printed by the draft's own code.
|
|
234
|
+
}
|
|
235
|
+
if (event.event === "checked") {
|
|
236
|
+
// Every field of the result, the grid among them.
|
|
237
|
+
const { sanoma: _, event: __, ...fields } = event;
|
|
238
|
+
result = fields;
|
|
239
|
+
}
|
|
240
|
+
if (event.event === "error")
|
|
241
|
+
error = event.message;
|
|
242
|
+
}
|
|
243
|
+
return result ?? failed(error ?? (ran.stderr.trim().split("\n").at(-1) || "it gave no result"));
|
|
244
|
+
}
|
|
42
245
|
//# sourceMappingURL=source.js.map
|
package/dist/source.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.js","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,MAAM,GAAG,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEhC;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,GAAG,GAAG,KAAK,EAAE,IAAc,EAAE,GAAuB,EAAE,EAAE,CAC5D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
|
+
export interface WakeupServed extends Stoppable {
|
|
3
|
+
/** Where it listens, such as `http://127.0.0.1:3100`. */
|
|
4
|
+
url: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Starts the wakeup service on `databaseUrl` and serves it on `host` and `port`: its routes, and
|
|
8
|
+
* `GET /healthz` for a host's probe; anything else is a 404. `stop` closes the server, then the service.
|
|
9
|
+
*/
|
|
10
|
+
export declare function runWakeup(databaseUrl: string, { host, port, log }: {
|
|
11
|
+
host: string;
|
|
12
|
+
port: number;
|
|
13
|
+
log: (line: string) => void;
|
|
14
|
+
}): Promise<WakeupServed>;
|
package/dist/wakeup.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { createServer } from "node:http";
|
|
2
|
+
import { errorMessage } from "@sanoma-ai/workflows";
|
|
3
|
+
import { startWakeupService } from "@sanoma-ai/workflows/wakeup-service";
|
|
4
|
+
import { NodeRequest, sendNodeResponse } from "srvx/node";
|
|
5
|
+
/** The route a path falls under: `route.path` itself, or a path under it, as the app's `ingress` matches. */
|
|
6
|
+
const routeAt = (routes, path) => routes.find((route) => path === route.path || path.startsWith(`${route.path}/`));
|
|
7
|
+
const text = (res, status, body) => {
|
|
8
|
+
res.writeHead(status, { "content-type": "text/plain; charset=utf-8", "cache-control": "no-store" });
|
|
9
|
+
res.end(body);
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Starts the wakeup service on `databaseUrl` and serves it on `host` and `port`: its routes, and
|
|
13
|
+
* `GET /healthz` for a host's probe; anything else is a 404. `stop` closes the server, then the service.
|
|
14
|
+
*/
|
|
15
|
+
export async function runWakeup(databaseUrl, { host, port, log }) {
|
|
16
|
+
const service = await startWakeupService({ databaseUrl, log: { info: log, warn: log } });
|
|
17
|
+
const server = createServer((req, res) => {
|
|
18
|
+
const path = (req.url ?? "/").split("?")[0];
|
|
19
|
+
if (path === "/healthz" && (req.method === "GET" || req.method === "HEAD"))
|
|
20
|
+
return text(res, 200, "ok\n");
|
|
21
|
+
const route = routeAt(service.routes, path);
|
|
22
|
+
if (!route)
|
|
23
|
+
return text(res, 404, "not found\n");
|
|
24
|
+
route
|
|
25
|
+
.handle(new NodeRequest({ req, res }))
|
|
26
|
+
.then((response) => sendNodeResponse(res, response))
|
|
27
|
+
.catch((err) => {
|
|
28
|
+
log(`sanoma wakeup: a request failed: ${errorMessage(err)}`);
|
|
29
|
+
if (res.headersSent)
|
|
30
|
+
res.destroy();
|
|
31
|
+
else
|
|
32
|
+
text(res, 500, "internal error\n");
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
try {
|
|
36
|
+
await new Promise((resolve, reject) => {
|
|
37
|
+
server.once("error", reject);
|
|
38
|
+
server.listen(port, host, () => resolve());
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
await service.stop();
|
|
43
|
+
throw err;
|
|
44
|
+
}
|
|
45
|
+
// As the app names where it listens: any address as localhost, IPv6 in brackets.
|
|
46
|
+
const { address, family, port: bound } = server.address();
|
|
47
|
+
const named = address === "0.0.0.0" || address === "::" ? "localhost" : family === "IPv6" ? `[${address}]` : address;
|
|
48
|
+
return {
|
|
49
|
+
url: `http://${named}:${bound}`,
|
|
50
|
+
async stop() {
|
|
51
|
+
try {
|
|
52
|
+
await new Promise((resolve) => {
|
|
53
|
+
server.close(() => resolve());
|
|
54
|
+
server.closeAllConnections();
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
finally {
|
|
58
|
+
await service.stop();
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=wakeup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wakeup.js","sourceRoot":"","sources":["../src/wakeup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,WAAW,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,C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K,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC;IACrH,OAAO;QACL,GAAG,EAAE,UAAU,KAAK,IAAI,KAAK,EAAE;QAC/B,KAAK,CAAC,IAAI;YACR,IAAI,CAAC;gBACH,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;oBAClC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;oBAC9B,MAAM,CAAC,mBAAmB,EAAE,CAAC;gBAC/B,CAAC,CAAC,CAAC;YACL,CAAC;oBAAS,CAAC;gBACT,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;YACvB,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/oxlint.json
CHANGED
|
@@ -164,11 +164,13 @@
|
|
|
164
164
|
"group": [
|
|
165
165
|
"@sanoma-ai/connector-*/fake",
|
|
166
166
|
"@sanoma-ai/connector-*/driver",
|
|
167
|
+
"@sanoma-ai/connector-*/remote",
|
|
167
168
|
"@sanoma-ai/workflows/describe",
|
|
168
169
|
"@sanoma-ai/workflows/fake",
|
|
169
170
|
"@sanoma-ai/workflows/plugin",
|
|
170
171
|
"@sanoma-ai/workflows/scenario",
|
|
171
|
-
"@sanoma-ai/workflows/scenarios"
|
|
172
|
+
"@sanoma-ai/workflows/scenarios",
|
|
173
|
+
"@sanoma-ai/workflows/wakeup-service"
|
|
172
174
|
],
|
|
173
175
|
"message": "A workflow must call vendors through ctx, so the policy sees every call: import the connector itself, `@sanoma-ai/connector-<vendor>`."
|
|
174
176
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sanoma",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "One command over a Sanoma repo: run the worker and the app, check it, write its .env.example, export a run's ledger",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"approvals",
|
|
@@ -63,22 +63,30 @@
|
|
|
63
63
|
"access": "public"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@sanoma-ai/app": "0.
|
|
67
|
-
"@sanoma-ai/bridge": "0.4.
|
|
68
|
-
"@sanoma-ai/workflows": "0.
|
|
66
|
+
"@sanoma-ai/app": "0.7.0",
|
|
67
|
+
"@sanoma-ai/bridge": "0.4.5",
|
|
68
|
+
"@sanoma-ai/workflows": "0.7.0",
|
|
69
69
|
"@types/node": "^26.6.4",
|
|
70
70
|
"oxlint": "^1.87.0",
|
|
71
71
|
"pg": "^8.23.1",
|
|
72
|
+
"srvx": "^0.11.22",
|
|
72
73
|
"typescript": "^7.0.2",
|
|
73
74
|
"zod": "^4.6.5"
|
|
74
75
|
},
|
|
75
76
|
"devDependencies": {
|
|
76
|
-
"@sanoma-ai/connector-ghost": "0.4.
|
|
77
|
+
"@sanoma-ai/connector-ghost": "0.4.5",
|
|
77
78
|
"@sanoma-ai/testing": "0.1.0",
|
|
78
79
|
"@types/pg": "^8.23.1"
|
|
79
80
|
},
|
|
81
|
+
"optionalDependencies": {
|
|
82
|
+
"@sanoma-ai/postgres-darwin-arm64": "0.1.0",
|
|
83
|
+
"@sanoma-ai/postgres-darwin-x64": "0.1.0",
|
|
84
|
+
"@sanoma-ai/postgres-linux-arm64": "0.1.0",
|
|
85
|
+
"@sanoma-ai/postgres-linux-x64": "0.1.0",
|
|
86
|
+
"@sanoma-ai/postgres-win32-x64": "0.1.0"
|
|
87
|
+
},
|
|
80
88
|
"engines": {
|
|
81
|
-
"node": "
|
|
89
|
+
"node": ">=26"
|
|
82
90
|
},
|
|
83
91
|
"scripts": {
|
|
84
92
|
"build": "node scripts/oxlint.ts && tsc -p tsconfig.build.json",
|
package/template/.env.example
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# value set here wins over a stored one and cannot be changed from the page. An empty value is
|
|
5
5
|
# the same as unset.
|
|
6
6
|
|
|
7
|
-
# Optional. Postgres for the worker and the app; default
|
|
7
|
+
# Optional. Postgres for the worker and the app; default the company's own in .sanoma/postgres.
|
|
8
8
|
# SANOMA_DATABASE_URL=
|
|
9
9
|
# Optional. Encrypts the stored credentials, and signs GitHub sign-in's cookie: 32 random bytes,
|
|
10
10
|
# base64. `sanoma` writes one here when none is set; keep it with the database.
|
package/template/AGENTS.md
CHANGED
|
@@ -23,7 +23,7 @@ The app's name is `package.json`'s `name`. `.env.example` (written by `sanoma en
|
|
|
23
23
|
With the package manager whose lockfile is here (`npm run <script>`, `pnpm <script>`, …):
|
|
24
24
|
|
|
25
25
|
```sh
|
|
26
|
-
npm run dev #
|
|
26
|
+
npm run dev # the company's own Postgres (.sanoma/postgres), the worker and the app; the app at the printed address
|
|
27
27
|
npm run check # tsc, the lint, the policies, what the worker would refuse, the sites' build and types, and every scenario
|
|
28
28
|
npm run env # rewrites .env.example from the connectors' variables
|
|
29
29
|
```
|
|
@@ -35,10 +35,11 @@ npm run env # rewrites .env.example from the connectors' variables
|
|
|
35
35
|
- Every operation a workflow calls is listed in its `uses`; add the connector to `sanoma.config.ts` and to `package.json`.
|
|
36
36
|
- Declare the company's own records as collections in `resources/data.ts`, which imports only `collection` from `sanoma/data` and holds nothing else: the runtime imports it, and so does a workflow that names a collection's operations (`import { outbound } from "../resources/data.ts"`, the one file outside `workflows/` a workflow may import). Every other data file is read, never run.
|
|
37
37
|
- Only a person declared with `sanoma.person` (in `resources/people.ts` by convention, a data file like any other) signs in to the app (by `id` on this machine; with GitHub sign-in by email, then `github` login), starts a run, calls an operation or decides an approval, in the groups that list them (`sanoma.group({ name, members: [ada, refundBot] })`, the one place a membership is written). An agent (`sanoma.agent({ id, onBehalfOf: bo })`) is in the group `agents` besides; it never signs in. A new colleague is an edit to that file before their first sign-in. Nobody decides an approval on a run they started while someone else in the group could; alone in it, they decide, and the ledger says so.
|
|
38
|
-
- The policies are `policies/*.cedar`, written in [Cedar](https://docs.cedarpolicy.com) against `.sanoma/schema.cedarschema`. Everything is allowed unless a `forbid` refuses it; the runtime writes the `permit` for people and agents, so a `permit` here is a problem unless it is for a public site's visitors (its principal `in Sanoma::Group::"visitors"` or `== Sanoma::Principal::"anonymous"`), who may do nothing else. A `forbid` with `@hold("<group>")` (or a person's id, or `"on-behalf-of"` for whom an agent acts) waits for that approver, with `@title` as its title in the Inbox, and the run goes on once they approve; one without `@hold` is denied, with `@reason` as the message. Actions are each operation's id (`Sanoma::Action::"ghost.post.publish"`), in its effect's group (`Sanoma::Action::"effect:publish"`), and `Sanoma::Action::"workflow:<name>"` for starting a run; `principal in Sanoma::Group::"editor"` is membership; `context.input` is the call's input. The app's Permissions page shows what they answer for each group. The `check` script reports a policy problem (a field, action or group the schema lacks, a `@hold` naming no one declared) at its `file:line:col`, and runs no scenario until there are none; `npm run dev` refuses to start on them.
|
|
38
|
+
- The policies are `policies/*.cedar`, written in [Cedar](https://docs.cedarpolicy.com) against `.sanoma/schema.cedarschema`. Everything is allowed unless a `forbid` refuses it; the runtime writes the `permit` for people and agents, so a `permit` here is a problem unless it is for a public site's visitors (its principal `in Sanoma::Group::"visitors"` or `== Sanoma::Principal::"anonymous"`), who may do nothing else. A `forbid` with `@hold("<group>")` (or a person's id, or `"on-behalf-of"` for whom an agent acts) waits for that approver, with `@title` as its title in the Inbox, and the run goes on once they approve; one without `@hold` is denied, with `@reason` as the message. Actions are each operation's id (`Sanoma::Action::"ghost.post.publish"`), in its effect's group (`Sanoma::Action::"effect:publish"`), and `Sanoma::Action::"workflow:<name>"` for starting a run; `principal in Sanoma::Group::"editor"` is membership; `context.input` is the call's input. A change to this repository is decided on its merge, `Sanoma::Action::"sanoma.change.merge"`, on a `Sanoma::Change` whose attributes are its facts (`resource.touches.contains("resources/finance/")`: every path it edits and each parent directory); `policies/changes.cedar` holds every change for `admin`, and a change to `policies/` or the people waits for `admin` whatever the policies say. The app's Permissions page shows what they answer for each group. The `check` script reports a policy problem (a field, action or group the schema lacks, a `@hold` naming no one declared) at its `file:line:col`, and runs no scenario until there are none; `npm run dev` refuses to start on them.
|
|
39
39
|
- Describe each workflow's expected runs in `scenarios/<workflow>/<name>.feature`, and run the `check` script after every change. A scenario runs as the runtime's own agent `scenarios` unless it says who is acting (`Given reviewer is acting`), and checks the policy with `Then <op> was held for group "<group>"` and `Then <op> was denied with "<reason>"`; a scenario's approver (`is approved by reviewer`) must be declared. `reviewer` in `resources/people.ts` is a stand-in who can sign in and approve: replace them with a real colleague, in the scenarios too.
|
|
40
40
|
- A site, `sites/<name>/routes/` (pages the app serves under `/sites/<name>/`, with an optional `sites/<name>/site.ts` naming it with `defineSite`), is browser code: no server code, credential or `process.env` under `sites/`, which the `check` script holds it to, and the folder's name is its URL segment (lowercase letters, digits and dashes). Its route files import `createFileRoute` from `@tanstack/react-router`; what talks to the app from `sanoma/site`: routing (`Link`, `Outlet`, `useNavigate`, `defineSite`, …), `api`, `<RunForm workflow="<name>" />` (the app's start form for a workflow) and `useActor()` (who is signed in); and how a page looks from `sanoma/ui`, the app's own components, presentational only (`Button`, `Card`, `Table`, `PageHeader`, `Region`, `Facts`, `FloatingCard`, …): `import { RunForm } from "sanoma/site";` beside `import { Region } from "sanoma/ui";`. Colour a page with the theme's utilities (`bg-card`, `text-muted-foreground`, `border-border`, `bg-primary/10` for a tint), never raw colours: the app's theme has no `bg-white` or `text-red-500` (a public site with a look of its own brings its own stylesheet, as the app package's README shows). A page reaches data and workflows only through `api` from `sanoma/site`, as the person on the page: `api.data.<collection>.list()`, a vendor's read such as `api.<vendor>.<resource>.get(…)`, `await api.<workflow>(input)` or `api.<workflow>.start(input)` (the workflow's name in camelCase); see the app package's README (Sites). Name what a page calls with literals (`workflow="announce"`, `api.announce.start(…)`, not a variable): the app reads a site's calls from its code to list them under each workflow's Used by, and the `check` script fails on a call to a workflow, collection or operation that does not exist. While the `dev` script runs, an edit to a site shows in the open page as it is saved, and a new site folder is live without a restart.
|
|
41
41
|
- Never put credentials in a file here. They live in `.env` or on the app's connector pages, which store them encrypted in the database.
|
|
42
|
+
- Never delete `.sanoma/postgres`: unless `SANOMA_DATABASE_URL` names another database, it is the company's database, every record and run in it.
|
|
42
43
|
|
|
43
44
|
## Example: a public site with a visitor login
|
|
44
45
|
|
package/template/package.json
CHANGED
|
@@ -2,3 +2,8 @@
|
|
|
2
2
|
minimumReleaseAgeExclude:
|
|
3
3
|
- sanoma
|
|
4
4
|
- "@sanoma-ai/*"
|
|
5
|
+
# pnpm 11 stops an install on a dependency's build script it was not told about: these two come
|
|
6
|
+
# with the app's Pi agent (its model providers) and are not needed.
|
|
7
|
+
allowBuilds:
|
|
8
|
+
"@google/genai": false
|
|
9
|
+
protobufjs: false
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Every change to this repository waits for admin before it merges: one reviewer for everything
|
|
2
|
+
// at the start. Edit or replace it when another group should own part of the repository, with a
|
|
3
|
+
// rule on the change's facts, such as `when { resource.touches.contains("resources/finance/") }`.
|
|
4
|
+
// A change to policies/ or to the people waits for admin whatever this file says.
|
|
5
|
+
@id("changes-wait-for-admin")
|
|
6
|
+
@hold("admin")
|
|
7
|
+
@title("Every change waits for admin")
|
|
8
|
+
forbid (principal, action == Sanoma::Action::"sanoma.change.merge", resource is Sanoma::Change);
|