@antelopejs/dms 0.18.2 → 0.19.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/CHANGELOG.md +86 -0
- package/README.md +1 -1
- package/bin/control/backend.mjs +1 -1
- package/bin/control/base.mjs +24 -9
- package/bin/control/base.test.mjs +88 -0
- package/bin/control/browser-client.mjs +1 -1
- package/bin/control/commands-stack.mjs +8 -6
- package/bin/control/commands-verify.mjs +2 -2
- package/bin/control/consumer-install.test.mjs +86 -0
- package/bin/control/database.mjs +66 -0
- package/bin/control/doctor.mjs +7 -0
- package/bin/control/frontend-check.mjs +2 -1
- package/bin/control/frontend-mode.test.mjs +24 -0
- package/bin/control/identity.mjs +45 -16
- package/bin/control/journey.mjs +31 -3
- package/bin/control/journey.test.mjs +207 -2
- package/bin/control/launch.mjs +123 -0
- package/bin/control/module-root.mjs +40 -0
- package/bin/control/module-root.test.mjs +67 -0
- package/bin/control/mongo-server.test.mjs +91 -0
- package/bin/control/mongo.mjs +125 -12
- package/bin/control/namespaces.test.mjs +33 -0
- package/bin/control/options.mjs +1 -0
- package/bin/control/pid-reuse.test.mjs +278 -0
- package/bin/control/processes.mjs +91 -29
- package/bin/control/renderer.test.mjs +1 -1
- package/bin/control/run-copy.mjs +6 -1
- package/bin/control/run-state.mjs +31 -12
- package/bin/control/stack.mjs +86 -173
- package/bin/control/verify/behaviour.test.mjs +36 -23
- package/bin/control/verify/decode.mjs +1 -0
- package/bin/control/verify/emit.mjs +11 -11
- package/bin/control/verify/formal.mjs +29 -15
- package/bin/control/verify/formal.test.mjs +15 -0
- package/bin/control/verify/map.test.mjs +2 -6
- package/bin/control/verify/types.mjs +1 -1
- package/bin/control/verify/verdict.mjs +4 -4
- package/bin/dms-control.mjs +4 -2
- package/dist/attachments/save.js +2 -1
- package/dist/attachments/save.js.map +1 -1
- package/dist/db/models/userNotifications.model.js +14 -8
- package/dist/db/models/userNotifications.model.js.map +1 -1
- package/dist/pages/public/auth/not-a-member.d.ts +9 -0
- package/dist/pages/public/auth/not-a-member.js +27 -0
- package/dist/pages/public/auth/not-a-member.js.map +1 -0
- package/dist/pages/public/index.d.ts +1 -0
- package/dist/pages/public/index.js +1 -0
- package/dist/pages/public/index.js.map +1 -1
- package/dist/routes/auth/oauth/identity-resolution.js +10 -0
- package/dist/routes/auth/oauth/identity-resolution.js.map +1 -1
- package/dist/routes/onboarding.js +1 -5
- package/dist/routes/onboarding.js.map +1 -1
- package/dist/utils/ensure-default-tenant.js +23 -3
- package/dist/utils/ensure-default-tenant.js.map +1 -1
- package/frontend-vue/layers/dms-auth/app/build/utils/noWorkspaceRoute.ts +19 -0
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/login.vue +4 -6
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/not-a-member.vue +21 -0
- package/frontend-vue/layers/dms-auth/app/custom-pages/auth/oauth-complete.vue +2 -4
- package/frontend-vue/layers/dms-auth/i18n/locales/auth-en-GB.json +6 -0
- package/frontend-vue/layers/dms-auth/i18n/locales/auth-fr-FR.json +6 -0
- package/frontend-vue/layers/dms-core/app/types/live.ts +2 -0
- package/frontend-vue/layers/dms-ui/app/build/components/containers/drawer/DynamicDrawer.vue +9 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/live/currentPageLive.ts +7 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/live/pageLiveController.ts +23 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/live/usePageDataRefresh.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableViewRealtime.ts +21 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/useTableLiveHold.ts +4 -3
- package/frontend-vue/layers/dms-ui/app/build/utils/accessibilityPreferences.ts +1 -21
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreview.ts +8 -4
- package/frontend-vue/layers/dms-ui/app/build/utils/link.ts +35 -7
- package/frontend-vue/layers/dms-ui/app/components/chart/ApexChartHost.vue +51 -8
- package/frontend-vue/layers/dms-ui/app/components/kpi/KpiCard.vue +3 -0
- package/frontend-vue/layers/dms-ui/app/composables/chart/types.ts +2 -0
- package/frontend-vue/layers/dms-ui/app/composables/chart/useApexChart.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/utils/reducedMotion.ts +22 -0
- package/package.json +6 -6
- package/skills/dms-pages/REFERENCE.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,91 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v0.19.1
|
|
4
|
+
|
|
5
|
+
[compare changes](https://github.com/AntelopeJS/dms/compare/v0.19.0...v0.19.1)
|
|
6
|
+
|
|
7
|
+
### 🚀 Enhancements
|
|
8
|
+
|
|
9
|
+
- **dms-ui:** Show a KPI payload's caption as the card's footnote ([#844](https://github.com/AntelopeJS/dms/pull/844))
|
|
10
|
+
|
|
11
|
+
### 🩹 Fixes
|
|
12
|
+
|
|
13
|
+
- **docs:** Open the sign-in capture signed out so later scenes keep the session ([#836](https://github.com/AntelopeJS/dms/pull/836))
|
|
14
|
+
- **dms-control:** Let read-only commands read a run from another PID namespace ([#843](https://github.com/AntelopeJS/dms/pull/843))
|
|
15
|
+
- **agents:** Type-check the probes' JSDoc with checkJs ([#842](https://github.com/AntelopeJS/dms/pull/842))
|
|
16
|
+
|
|
17
|
+
### 📖 Documentation
|
|
18
|
+
|
|
19
|
+
- **readme:** Tell the one-run story from the X article ([#841](https://github.com/AntelopeJS/dms/pull/841))
|
|
20
|
+
|
|
21
|
+
### 📦 Build
|
|
22
|
+
|
|
23
|
+
- **deps:** Take tooling-configs 0.5.0 ([#840](https://github.com/AntelopeJS/dms/pull/840))
|
|
24
|
+
|
|
25
|
+
### ❤️ Contributors
|
|
26
|
+
|
|
27
|
+
- Antony Rizzitelli ([@Upd4ting](http://github.com/Upd4ting))
|
|
28
|
+
|
|
29
|
+
## v0.19.0
|
|
30
|
+
|
|
31
|
+
[compare changes](https://github.com/AntelopeJS/dms/compare/v0.18.2...v0.19.0)
|
|
32
|
+
|
|
33
|
+
### 🚀 Enhancements
|
|
34
|
+
|
|
35
|
+
- **dms-control:** Serve the dashboard with ajs dms dev under up --dev-frontend ([#829](https://github.com/AntelopeJS/dms/pull/829))
|
|
36
|
+
- **table-view:** Add liveHold.whileOnScreen to let a live table follow its feed on screen ([#808](https://github.com/AntelopeJS/dms/pull/808))
|
|
37
|
+
|
|
38
|
+
### 🩹 Fixes
|
|
39
|
+
|
|
40
|
+
- **verify-dms:** Expect the assistant ask item in the palette no-match journey ([#799](https://github.com/AntelopeJS/dms/pull/799))
|
|
41
|
+
- **notifications:** Undo mark-all-read in one bulk update ([#826](https://github.com/AntelopeJS/dms/pull/826))
|
|
42
|
+
- **dms:** Auto-import isReducedMotionActive for frontend modules ([#823](https://github.com/AntelopeJS/dms/pull/823))
|
|
43
|
+
- **dms-control:** Resolve moduleRoot to the module above a skill playground ([#827](https://github.com/AntelopeJS/dms/pull/827))
|
|
44
|
+
- **preview:** Draw a serialized resource form that reads any path of the site ([#820](https://github.com/AntelopeJS/dms/pull/820))
|
|
45
|
+
- **dms-control:** Key a non-literal module specifier by its structure in the emit fingerprint ([#816](https://github.com/AntelopeJS/dms/pull/816))
|
|
46
|
+
- **dms:** Keep the newest row read when two table row updates answer out of order ([#812](https://github.com/AntelopeJS/dms/pull/812))
|
|
47
|
+
- **dms-ui:** Keep query-only block action links in the browser ([#832](https://github.com/AntelopeJS/dms/pull/832))
|
|
48
|
+
- **chart:** Stop a donut redrawing itself through its parent resize observer ([#835](https://github.com/AntelopeJS/dms/pull/835))
|
|
49
|
+
- **release:** Decide the interface range check as semver does ([#813](https://github.com/AntelopeJS/dms/pull/813))
|
|
50
|
+
- **dms-control:** Let journeys stop and restart the run's mongod ([#831](https://github.com/AntelopeJS/dms/pull/831))
|
|
51
|
+
- **dms-control:** Start the base backend when the base ref has no playground ([#818](https://github.com/AntelopeJS/dms/pull/818))
|
|
52
|
+
- **dms-control:** Start the run's mongod as a single-node replica set ([#830](https://github.com/AntelopeJS/dms/pull/830))
|
|
53
|
+
- **realtime:** Read a page's data again once its subscription is in place ([#810](https://github.com/AntelopeJS/dms/pull/810))
|
|
54
|
+
- **dms-control:** Ship playwright-core as an optional dependency of @antelopejs/dms ([#817](https://github.com/AntelopeJS/dms/pull/817))
|
|
55
|
+
- **auth:** Show a no-workspace screen when no module serves /auth/no-workspace ([#800](https://github.com/AntelopeJS/dms/pull/800))
|
|
56
|
+
- **dms-control:** Fail a formal finding dropped by a check edit instead of counting it fixed ([#821](https://github.com/AntelopeJS/dms/pull/821))
|
|
57
|
+
- **playground:** Load an api that reads RouteHandler.controller ([#819](https://github.com/AntelopeJS/dms/pull/819))
|
|
58
|
+
- **dms-ui:** Build a module drawer's provides from the raw caller provides ([#809](https://github.com/AntelopeJS/dms/pull/809))
|
|
59
|
+
- **dms-control:** Identify each process from the read that finds it, and check it again before each signal ([#801](https://github.com/AntelopeJS/dms/pull/801))
|
|
60
|
+
- **interface-dms:** Answer 400 to a guarded confirmation body that is not a JSON object ([#828](https://github.com/AntelopeJS/dms/pull/828))
|
|
61
|
+
- **interface-dms:** Accept a model row or a PromiseLike from PageRecordLoader ([#815](https://github.com/AntelopeJS/dms/pull/815))
|
|
62
|
+
- **interface-dms:** Refuse upload field options that are not an object ([#825](https://github.com/AntelopeJS/dms/pull/825))
|
|
63
|
+
- **oauth:** Create no account before the platform has its owner ([#807](https://github.com/AntelopeJS/dms/pull/807))
|
|
64
|
+
- **dms:** Stop without waiting for a default tenant provisioning run in progress ([#804](https://github.com/AntelopeJS/dms/pull/804))
|
|
65
|
+
- **tenant-lifecycle:** Name a blocked release and give operators a way to retire it ([#822](https://github.com/AntelopeJS/dms/pull/822))
|
|
66
|
+
- **onboarding:** Keep the register as the one writer of has_onboarded ([#806](https://github.com/AntelopeJS/dms/pull/806))
|
|
67
|
+
|
|
68
|
+
### 💅 Refactors
|
|
69
|
+
|
|
70
|
+
- **iface:** Drop the shape-name suppressions in block-registry describe ([#803](https://github.com/AntelopeJS/dms/pull/803))
|
|
71
|
+
|
|
72
|
+
### 📖 Documentation
|
|
73
|
+
|
|
74
|
+
- Refresh the stale block screenshots ([#802](https://github.com/AntelopeJS/dms/pull/802))
|
|
75
|
+
|
|
76
|
+
### 🏡 Chore
|
|
77
|
+
|
|
78
|
+
- **release:** @antelopejs/interface-dms v0.13.0 ([187e2598](https://github.com/AntelopeJS/dms/commit/187e2598))
|
|
79
|
+
- **dms:** Depend on @antelopejs/interface-dms 0.13 ([#839](https://github.com/AntelopeJS/dms/pull/839))
|
|
80
|
+
|
|
81
|
+
### ✅ Tests
|
|
82
|
+
|
|
83
|
+
- **frontend:** Import the table row actions subject at file load ([#805](https://github.com/AntelopeJS/dms/pull/805))
|
|
84
|
+
|
|
85
|
+
### ❤️ Contributors
|
|
86
|
+
|
|
87
|
+
- Antony Rizzitelli ([@Upd4ting](http://github.com/Upd4ting))
|
|
88
|
+
|
|
3
89
|
## v0.18.2
|
|
4
90
|
|
|
5
91
|
[compare changes](https://github.com/AntelopeJS/dms/compare/v0.18.1...v0.18.2)
|
package/README.md
CHANGED
|
@@ -86,7 +86,7 @@ export class SalesPage extends PageController("sales", {
|
|
|
86
86
|
| `@antelopejs/interface-data-api` | `>=0.6.0 <1.0.0` | `0.6.0` |
|
|
87
87
|
| `@antelopejs/interface-database` | `>=0.3.0 <1.0.0` | `0.3.1` |
|
|
88
88
|
| `@antelopejs/interface-database-decorators` | `>=0.2.0 <1.0.0` | `0.2.1` |
|
|
89
|
-
| `@antelopejs/interface-dms` | `>=0.
|
|
89
|
+
| `@antelopejs/interface-dms` | `>=0.13.0 <0.14.0` | `0.13.0` |
|
|
90
90
|
| `@antelopejs/interface-dms-automation` | `>=0.6.0 <1.0.0` | `0.6.1` |
|
|
91
91
|
| `@antelopejs/interface-email` | `>=0.0.6 <1.0.0` | `0.0.6` |
|
|
92
92
|
| `@antelopejs/interface-file-storage` | `>=0.1.4 <1.0.0` | `0.1.4` |
|
package/bin/control/backend.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { buildChangedSince, missingBuildRoot } from "./build-inputs.mjs";
|
|
2
2
|
import { apiTargetFile, readTarget, writeTarget } from "./forwarder.mjs";
|
|
3
3
|
import { dropDatabase } from "./mongo.mjs";
|
|
4
|
+
import { resolutionFolders } from "./launch.mjs";
|
|
4
5
|
import { killRecorded, stopRecorded } from "./processes.mjs";
|
|
5
6
|
import {
|
|
6
7
|
ensureApi,
|
|
7
8
|
launchBackend,
|
|
8
9
|
liveBackends,
|
|
9
10
|
record,
|
|
10
|
-
resolutionFolders,
|
|
11
11
|
startBackend,
|
|
12
12
|
waitForBackend,
|
|
13
13
|
} from "./stack.mjs";
|
package/bin/control/base.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
1
|
+
import { cpSync, existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
|
-
import { join, relative } from "node:path";
|
|
3
|
+
import { basename, join, relative } from "node:path";
|
|
4
4
|
import { git } from "./git.mjs";
|
|
5
5
|
import { runToEnd } from "./processes.mjs";
|
|
6
6
|
import { saveRun } from "./run-state.mjs";
|
|
7
7
|
import { runPrepare } from "./verify/skill.mjs";
|
|
8
|
-
import { layOutCopy } from "./run-copy.mjs";
|
|
9
|
-
import { cliPaths, ENVIRONMENT, spec } from "./
|
|
8
|
+
import { COPY_SKIPPED, layOutCopy } from "./run-copy.mjs";
|
|
9
|
+
import { cliPaths, ENVIRONMENT, spec } from "./launch.mjs";
|
|
10
10
|
import { restartBackend } from "./backend.mjs";
|
|
11
11
|
|
|
12
12
|
const READY_MARK = ".dms-control-ready";
|
|
@@ -19,22 +19,37 @@ function baseCache() {
|
|
|
19
19
|
/**
|
|
20
20
|
* A prepared worktree of the run's base ref, built once per commit under
|
|
21
21
|
* `~/.cache/dms-control/base/<sha>` with the skill's `prepare` commands.
|
|
22
|
+
* When the base ref has no playground folder, as in the change that adds
|
|
23
|
+
* it, the worktree gets a copy of the run's playground before `prepare`,
|
|
24
|
+
* and is built again on every call so the copy follows the run's.
|
|
22
25
|
*
|
|
23
26
|
* @param {import("./run-state.mjs").RunState} state The run
|
|
24
27
|
* @param {import("./verify/skill.mjs").Skill} skill The skill
|
|
25
|
-
* @returns {{ sha: string, dir: string }} The base commit and its
|
|
28
|
+
* @returns {{ sha: string, dir: string, playground: string }} The base commit, its worktree and its playground
|
|
26
29
|
*/
|
|
27
|
-
function baseCheckout(state, skill) {
|
|
30
|
+
export function baseCheckout(state, skill) {
|
|
28
31
|
const sha = git(["rev-parse", `${state.baseRef}^{commit}`], state.repo);
|
|
29
32
|
const dir = join(baseCache(), sha);
|
|
30
|
-
|
|
33
|
+
const path = relative(state.repo, state.playground);
|
|
34
|
+
const playground = join(dir, path);
|
|
35
|
+
const copied =
|
|
36
|
+
git(["ls-tree", "-d", "--name-only", sha, "--", path], state.repo) === "";
|
|
37
|
+
if (!copied && existsSync(join(dir, READY_MARK))) {
|
|
38
|
+
return { sha, dir, playground };
|
|
39
|
+
}
|
|
31
40
|
rmSync(dir, { recursive: true, force: true });
|
|
32
41
|
mkdirSync(baseCache(), { recursive: true });
|
|
33
42
|
git(["worktree", "prune"], state.repo);
|
|
34
43
|
git(["worktree", "add", "--detach", "--force", dir, sha], state.repo);
|
|
44
|
+
if (copied) {
|
|
45
|
+
cpSync(state.playground, playground, {
|
|
46
|
+
recursive: true,
|
|
47
|
+
filter: (source) => !COPY_SKIPPED.has(basename(source)),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
35
50
|
runPrepare(skill, dir);
|
|
36
51
|
writeFileSync(join(dir, READY_MARK), `${sha}\n`);
|
|
37
|
-
return { sha, dir };
|
|
52
|
+
return { sha, dir, playground };
|
|
38
53
|
}
|
|
39
54
|
|
|
40
55
|
/**
|
|
@@ -55,7 +70,7 @@ export async function withBaseBackend(state, skill, action) {
|
|
|
55
70
|
);
|
|
56
71
|
}
|
|
57
72
|
const base = baseCheckout(state, skill);
|
|
58
|
-
const playground =
|
|
73
|
+
const { playground } = base;
|
|
59
74
|
state.baseRoot = join(state.dir, "base-root");
|
|
60
75
|
rmSync(state.baseRoot, { recursive: true, force: true });
|
|
61
76
|
const cwd = layOutCopy(playground, base.dir, state.baseRoot);
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import {
|
|
3
|
+
existsSync,
|
|
4
|
+
mkdirSync,
|
|
5
|
+
mkdtempSync,
|
|
6
|
+
realpathSync,
|
|
7
|
+
rmSync,
|
|
8
|
+
} from "node:fs";
|
|
9
|
+
import { tmpdir } from "node:os";
|
|
10
|
+
import { join } from "node:path";
|
|
11
|
+
import test from "node:test";
|
|
12
|
+
import { baseCheckout } from "./base.mjs";
|
|
13
|
+
import { git } from "./git.mjs";
|
|
14
|
+
import { setEnv } from "./helpers/env.mjs";
|
|
15
|
+
import { write } from "./helpers/repo.mjs";
|
|
16
|
+
|
|
17
|
+
const PLAYGROUND = join(".agents", "skills", "verify", "playground");
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A repository whose commit `base` has no playground and whose HEAD adds
|
|
21
|
+
* one, with installed modules left untracked. The base cache is scratch.
|
|
22
|
+
*
|
|
23
|
+
* @param {import("node:test").TestContext} t The test
|
|
24
|
+
* @returns {{ repo: string, playground: string }} Its paths
|
|
25
|
+
*/
|
|
26
|
+
function repoWithNewPlayground(t) {
|
|
27
|
+
const root = realpathSync(
|
|
28
|
+
mkdtempSync(join(tmpdir(), "dms-control-base-test-")),
|
|
29
|
+
);
|
|
30
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
31
|
+
setEnv(t, { XDG_CACHE_HOME: join(root, "cache") });
|
|
32
|
+
const repo = join(root, "repo");
|
|
33
|
+
mkdirSync(repo);
|
|
34
|
+
git(["init", "-q", "-b", "main"], repo);
|
|
35
|
+
git(["config", "user.email", "test@example.com"], repo);
|
|
36
|
+
git(["config", "user.name", "test"], repo);
|
|
37
|
+
write(join(repo, "README.md"), "base\n");
|
|
38
|
+
git(["add", "."], repo);
|
|
39
|
+
git(["commit", "-q", "-m", "base"], repo);
|
|
40
|
+
git(["tag", "base"], repo);
|
|
41
|
+
const playground = join(repo, PLAYGROUND);
|
|
42
|
+
write(join(playground, "antelope.config.ts"), "head\n");
|
|
43
|
+
write(join(playground, ".gitignore"), "node_modules\n");
|
|
44
|
+
write(join(playground, "node_modules", "zod", "package.json"), "{}");
|
|
45
|
+
git(["add", "."], repo);
|
|
46
|
+
git(["commit", "-q", "-m", "add the playground"], repo);
|
|
47
|
+
return { repo, playground };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
await test("a base ref without the playground prepares a copy of the run's playground", (t) => {
|
|
51
|
+
const { repo, playground } = repoWithNewPlayground(t);
|
|
52
|
+
const prepare = [
|
|
53
|
+
["grep", "-qx", "head", join(PLAYGROUND, "antelope.config.ts")],
|
|
54
|
+
["grep", "-qx", "base", "README.md"],
|
|
55
|
+
];
|
|
56
|
+
const base = baseCheckout(
|
|
57
|
+
{ repo, playground, baseRef: "base" },
|
|
58
|
+
{ config: { prepare } },
|
|
59
|
+
);
|
|
60
|
+
assert.equal(base.sha, git(["rev-parse", "base"], repo));
|
|
61
|
+
assert.equal(base.playground, join(base.dir, PLAYGROUND));
|
|
62
|
+
assert.equal(existsSync(join(base.playground, "node_modules")), false);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
await test("a copied base playground follows the run's playground from one run to the next", (t) => {
|
|
66
|
+
const { repo, playground } = repoWithNewPlayground(t);
|
|
67
|
+
const state = { repo, playground, baseRef: "base" };
|
|
68
|
+
baseCheckout(state, { config: { prepare: [] } });
|
|
69
|
+
write(join(playground, "antelope.config.ts"), "edited\n");
|
|
70
|
+
const base = baseCheckout(state, {
|
|
71
|
+
config: {
|
|
72
|
+
prepare: [
|
|
73
|
+
["grep", "-qx", "edited", join(PLAYGROUND, "antelope.config.ts")],
|
|
74
|
+
["touch", "prepared"],
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
assert.equal(existsSync(join(base.dir, "prepared")), true);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
await test("a base ref that has the playground is built once", (t) => {
|
|
82
|
+
const { repo, playground } = repoWithNewPlayground(t);
|
|
83
|
+
const state = { repo, playground, baseRef: "HEAD" };
|
|
84
|
+
const first = baseCheckout(state, { config: { prepare: [] } });
|
|
85
|
+
write(join(first.playground, "prepared"), "");
|
|
86
|
+
const second = baseCheckout(state, { config: { prepare: [["false"]] } });
|
|
87
|
+
assert.equal(existsSync(join(second.playground, "prepared")), true);
|
|
88
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isOutcome } from "./browser-wire.mjs";
|
|
2
2
|
import { decode } from "./json.mjs";
|
|
3
|
-
import { CONTROL_BIN } from "./
|
|
3
|
+
import { CONTROL_BIN } from "./launch.mjs";
|
|
4
4
|
import { isSameProcess } from "./identity.mjs";
|
|
5
5
|
import { freePort, startDetached, waitForOk } from "./processes.mjs";
|
|
6
6
|
import { saveRun } from "./run-state.mjs";
|
|
@@ -5,9 +5,10 @@ import { ACTION_NAMES, describeTarget, serveBrowser } from "./browser.mjs";
|
|
|
5
5
|
import { doctor } from "./doctor.mjs";
|
|
6
6
|
import { setUpFrontendWorkspace } from "./frontend-workspace.mjs";
|
|
7
7
|
import { capturedMail, serveMail } from "./mail.mjs";
|
|
8
|
-
import { loadRun } from "./run-state.mjs";
|
|
8
|
+
import { loadRun, readRun } from "./run-state.mjs";
|
|
9
9
|
import { apiRequest, isOk, onboard } from "./session.mjs";
|
|
10
|
-
import {
|
|
10
|
+
import { resolutionFolders } from "./launch.mjs";
|
|
11
|
+
import { down, up } from "./stack.mjs";
|
|
11
12
|
import { freshDatabase } from "./backend.mjs";
|
|
12
13
|
import { apiTargetFile, serveForwarder } from "./forwarder.mjs";
|
|
13
14
|
import { formatTimings, readTimings, summarize, timed } from "./timing.mjs";
|
|
@@ -72,6 +73,7 @@ async function commandUp(values) {
|
|
|
72
73
|
values["no-standby"] === true ||
|
|
73
74
|
process.env.DMS_CONTROL_NO_STANDBY === "1",
|
|
74
75
|
buildCache: !values["no-build-cache"],
|
|
76
|
+
frontendMode: values["dev-frontend"] ? "dev" : "build",
|
|
75
77
|
});
|
|
76
78
|
if (state.frontendBuild?.reason) {
|
|
77
79
|
process.stderr.write(
|
|
@@ -106,7 +108,7 @@ async function commandDoctor(dir, values) {
|
|
|
106
108
|
* @returns {Promise<number>}
|
|
107
109
|
*/
|
|
108
110
|
async function commandOnboard(dir, values) {
|
|
109
|
-
const state =
|
|
111
|
+
const state = readRun(dir);
|
|
110
112
|
const answer = await onboard(state, {
|
|
111
113
|
platformName: values["platform-name"],
|
|
112
114
|
});
|
|
@@ -185,7 +187,7 @@ async function commandBrowser(dir, action, values) {
|
|
|
185
187
|
* @returns {Promise<number>}
|
|
186
188
|
*/
|
|
187
189
|
async function commandApi(dir, method, path, values) {
|
|
188
|
-
const state =
|
|
190
|
+
const state = readRun(dir);
|
|
189
191
|
/** @type {unknown} */
|
|
190
192
|
const body = values.body === undefined ? undefined : JSON.parse(values.body);
|
|
191
193
|
const answer = await apiRequest(state, {
|
|
@@ -237,12 +239,12 @@ export async function runStackCommand(command, rest, values) {
|
|
|
237
239
|
case "api":
|
|
238
240
|
return commandApi(rest[0], rest[1], rest[2], values);
|
|
239
241
|
case "mail":
|
|
240
|
-
print(JSON.stringify(capturedMail(
|
|
242
|
+
print(JSON.stringify(capturedMail(readRun(rest[0]).mail), null, 2));
|
|
241
243
|
return 0;
|
|
242
244
|
case "down":
|
|
243
245
|
return commandDown(rest[0]);
|
|
244
246
|
case "timings":
|
|
245
|
-
print(formatTimings(summarize(readTimings(
|
|
247
|
+
print(formatTimings(summarize(readTimings(readRun(rest[0]).evidence))));
|
|
246
248
|
return 0;
|
|
247
249
|
case "reset": {
|
|
248
250
|
const state = loadRun(rest[0]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { print } from "./commands-stack.mjs";
|
|
3
3
|
import { runJourneyFile } from "./journey.mjs";
|
|
4
|
-
import { loadRun } from "./run-state.mjs";
|
|
4
|
+
import { loadRun, readRun } from "./run-state.mjs";
|
|
5
5
|
import { timed } from "./timing.mjs";
|
|
6
6
|
import { doorLine, flaggedDoors, patchFiles } from "./verify/doors.mjs";
|
|
7
7
|
import {
|
|
@@ -150,7 +150,7 @@ async function commandVerdict(dir, values) {
|
|
|
150
150
|
print("verdict needs --pr <number>");
|
|
151
151
|
return 2;
|
|
152
152
|
}
|
|
153
|
-
const state =
|
|
153
|
+
const state = readRun(dir);
|
|
154
154
|
const skill = await skillOf(values, state);
|
|
155
155
|
const verdict = await renderVerdict(
|
|
156
156
|
skill,
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { cpSync, mkdirSync, mkdtempSync, rmSync, symlinkSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import test from "node:test";
|
|
7
|
+
import { pathToFileURL } from "node:url";
|
|
8
|
+
import manifest from "../../package.json" with { type: "json" };
|
|
9
|
+
import { PACKAGE_ROOT } from "./launch.mjs";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The environment of a consumer's shell: this process's, without the
|
|
13
|
+
* `NODE_PATH` a package manager's bin shim exports, which would resolve
|
|
14
|
+
* packages the consumer never installed.
|
|
15
|
+
*
|
|
16
|
+
* @returns {NodeJS.ProcessEnv} The environment
|
|
17
|
+
*/
|
|
18
|
+
function consumerEnv() {
|
|
19
|
+
return Object.fromEntries(
|
|
20
|
+
Object.entries(process.env).filter(([name]) => name !== "NODE_PATH"),
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* A module repository that depends on `@antelopejs/dms` and declares nothing
|
|
26
|
+
* else: the installed copy gets the `bin` folder it publishes and, beside it,
|
|
27
|
+
* the dependencies an install of that kind gives a dependency.
|
|
28
|
+
*
|
|
29
|
+
* @param {import("node:test").TestContext} t
|
|
30
|
+
* @param {Record<string, string>[]} installed Each dependency list of the manifest the install honours
|
|
31
|
+
* @returns {string} The output of resolving playwright-core the way dms-control does, or its error
|
|
32
|
+
*/
|
|
33
|
+
function resolveFromConsumer(t, installed) {
|
|
34
|
+
const moduleRoot = mkdtempSync(join(tmpdir(), "dms-control-consumer-"));
|
|
35
|
+
t.after(() => rmSync(moduleRoot, { recursive: true, force: true }));
|
|
36
|
+
const dms = join(moduleRoot, "node_modules", "@antelopejs", "dms");
|
|
37
|
+
mkdirSync(dms, { recursive: true });
|
|
38
|
+
cpSync(join(PACKAGE_ROOT, "bin"), join(dms, "bin"), { recursive: true });
|
|
39
|
+
cpSync(join(PACKAGE_ROOT, "package.json"), join(dms, "package.json"));
|
|
40
|
+
for (const name of installed.flatMap((list) => Object.keys(list))) {
|
|
41
|
+
const link = join(dms, "node_modules", name);
|
|
42
|
+
mkdirSync(join(link, ".."), { recursive: true });
|
|
43
|
+
symlinkSync(join(PACKAGE_ROOT, "node_modules", name), link, "dir");
|
|
44
|
+
}
|
|
45
|
+
const mongo = pathToFileURL(join(dms, "bin", "control", "mongo.mjs"));
|
|
46
|
+
const from = [join(moduleRoot, ".agents", "playground"), moduleRoot, dms];
|
|
47
|
+
const run = spawnSync(
|
|
48
|
+
process.execPath,
|
|
49
|
+
[
|
|
50
|
+
"--input-type=module",
|
|
51
|
+
"--eval",
|
|
52
|
+
`const { importFrom } = await import(${JSON.stringify(mongo.href)});
|
|
53
|
+
try {
|
|
54
|
+
const { chromium } = await importFrom("playwright-core", ${JSON.stringify(from)});
|
|
55
|
+
process.stdout.write(chromium.name());
|
|
56
|
+
} catch (error) {
|
|
57
|
+
process.stdout.write(error.message);
|
|
58
|
+
}`,
|
|
59
|
+
],
|
|
60
|
+
{ cwd: moduleRoot, encoding: "utf8", env: consumerEnv() },
|
|
61
|
+
);
|
|
62
|
+
return run.stdout;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
await test("dms-control resolves playwright-core for a module whose install of @antelopejs/dms keeps optional dependencies", (t) => {
|
|
66
|
+
assert.equal(
|
|
67
|
+
resolveFromConsumer(t, [
|
|
68
|
+
manifest.dependencies,
|
|
69
|
+
manifest.optionalDependencies,
|
|
70
|
+
]),
|
|
71
|
+
"chromium",
|
|
72
|
+
);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
await test("dms-control names the install command when the install of @antelopejs/dms omitted optional dependencies", (t) => {
|
|
76
|
+
const spec = `playwright-core@${manifest.optionalDependencies["playwright-core"]}`;
|
|
77
|
+
const message = resolveFromConsumer(t, [manifest.dependencies]);
|
|
78
|
+
assert.ok(
|
|
79
|
+
message.includes(`npm install --save-dev ${spec}`),
|
|
80
|
+
`the error names the npm command: ${message}`,
|
|
81
|
+
);
|
|
82
|
+
assert.ok(
|
|
83
|
+
message.includes(`pnpm add --save-dev ${spec}`),
|
|
84
|
+
`the error names the pnpm command: ${message}`,
|
|
85
|
+
);
|
|
86
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { apiTargetFile, readTarget } from "./forwarder.mjs";
|
|
2
|
+
import { isSameProcess } from "./identity.mjs";
|
|
3
|
+
import { startMongod } from "./mongo.mjs";
|
|
4
|
+
import { killRecorded, stopRecorded } from "./processes.mjs";
|
|
5
|
+
import { resolutionFolders } from "./launch.mjs";
|
|
6
|
+
import { liveBackends, record } from "./stack.mjs";
|
|
7
|
+
|
|
8
|
+
/** @typedef {import("./run-state.mjs").RunState} RunState */
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @param {RunState} state The run
|
|
12
|
+
* @returns {import("./run-state.mjs").ServerRecord} The mongod the run started
|
|
13
|
+
* @throws When the run uses a server it does not own (`--mongo-url`) or recorded no mongod
|
|
14
|
+
*/
|
|
15
|
+
function ownedMongod(state) {
|
|
16
|
+
if (!state.ownsMongo) {
|
|
17
|
+
throw new Error(
|
|
18
|
+
"this run uses --mongo-url: it does not own the server, so it neither stops nor starts it",
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
const mongod = state.processes.find((entry) => entry.name === "mongod");
|
|
22
|
+
if (mongod?.port === undefined) {
|
|
23
|
+
throw new Error("this run recorded no mongod");
|
|
24
|
+
}
|
|
25
|
+
return { ...mongod, port: mongod.port };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Stops the run's mongod, as a crash of the database would: the backend the
|
|
30
|
+
* API forwards to loses its connection until {@link startDatabase}. Every
|
|
31
|
+
* other backend, such as the next database's standby, is killed first, so
|
|
32
|
+
* none that booted without its database is ever promoted. The mongod's
|
|
33
|
+
* record stays, and stopping a mongod that no longer runs signals nothing.
|
|
34
|
+
*
|
|
35
|
+
* @param {RunState} state The run
|
|
36
|
+
* @returns {Promise<void>} Resolves once mongod no longer runs
|
|
37
|
+
* @throws When the run does not own its server, before it stops anything
|
|
38
|
+
*/
|
|
39
|
+
export async function stopDatabase(state) {
|
|
40
|
+
const mongod = ownedMongod(state);
|
|
41
|
+
const target = readTarget(apiTargetFile(state.dir));
|
|
42
|
+
await killRecorded(
|
|
43
|
+
liveBackends(state).filter((backend) => backend.port !== target),
|
|
44
|
+
);
|
|
45
|
+
await stopRecorded([mongod]);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Starts the run's mongod again on its port and data folder, so the URL the
|
|
50
|
+
* backend holds reaches it and the data written before is still there. A
|
|
51
|
+
* mongod that still runs is kept.
|
|
52
|
+
*
|
|
53
|
+
* @param {RunState} state The run
|
|
54
|
+
* @returns {Promise<void>} Resolves once mongod listens
|
|
55
|
+
* @throws When the run does not own its server
|
|
56
|
+
*/
|
|
57
|
+
export async function startDatabase(state) {
|
|
58
|
+
const mongod = ownedMongod(state);
|
|
59
|
+
if (isSameProcess(mongod)) return;
|
|
60
|
+
const started = await startMongod(
|
|
61
|
+
state,
|
|
62
|
+
resolutionFolders(state),
|
|
63
|
+
mongod.port,
|
|
64
|
+
);
|
|
65
|
+
record(state, started.record);
|
|
66
|
+
}
|
package/bin/control/doctor.mjs
CHANGED
|
@@ -203,6 +203,13 @@ async function freshnessLines(state) {
|
|
|
203
203
|
* @param {number} frontendSources
|
|
204
204
|
*/
|
|
205
205
|
async function frontendBuildLine(state, frontendBuild, frontendSources) {
|
|
206
|
+
if (state.frontendMode === "dev") {
|
|
207
|
+
return line(
|
|
208
|
+
"frontend serves the sources with ajs dms dev",
|
|
209
|
+
true,
|
|
210
|
+
"no build to compare",
|
|
211
|
+
);
|
|
212
|
+
}
|
|
206
213
|
const recorded = state.frontendBuild;
|
|
207
214
|
if (!recorded?.key) {
|
|
208
215
|
return line(
|
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
WORKSPACE_FOLDER,
|
|
9
9
|
} from "./build-key.mjs";
|
|
10
10
|
import { layOutCopy } from "./run-copy.mjs";
|
|
11
|
-
import { frontendPackage
|
|
11
|
+
import { frontendPackage } from "./launch.mjs";
|
|
12
|
+
import { workspaceSetup } from "./stack.mjs";
|
|
12
13
|
|
|
13
14
|
const SUFFIX_BYTES = 4;
|
|
14
15
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { newRun } from "./helpers/fake-run.mjs";
|
|
4
|
+
import { loadRun, saveRun } from "./run-state.mjs";
|
|
5
|
+
import { cliPaths } from "./launch.mjs";
|
|
6
|
+
import { frontendSpec } from "./stack.mjs";
|
|
7
|
+
|
|
8
|
+
await test("a run in dev mode serves its dashboard with ajs dms dev on its web port against its API, after a reload of run.json", async (t) => {
|
|
9
|
+
const state = await newRun(t);
|
|
10
|
+
state.frontendMode = "dev";
|
|
11
|
+
state.webPort = 4321;
|
|
12
|
+
saveRun(state);
|
|
13
|
+
const loaded = loadRun(state.dir);
|
|
14
|
+
assert.deepEqual(frontendSpec(loaded).args, [
|
|
15
|
+
cliPaths(state.playground).dms,
|
|
16
|
+
"dev",
|
|
17
|
+
"-e",
|
|
18
|
+
"docs",
|
|
19
|
+
"-b",
|
|
20
|
+
state.apiUrl,
|
|
21
|
+
"-p",
|
|
22
|
+
"4321",
|
|
23
|
+
]);
|
|
24
|
+
});
|