@b3os/cli 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.
Files changed (93) hide show
  1. package/README.md +72 -26
  2. package/bin/b3os.js +13 -3
  3. package/dist/commands/_common.d.ts +49 -0
  4. package/dist/commands/_common.js +174 -0
  5. package/dist/commands/_common.js.map +1 -0
  6. package/dist/commands/actions.d.ts +43 -0
  7. package/dist/commands/actions.js +184 -0
  8. package/dist/commands/actions.js.map +1 -0
  9. package/dist/commands/api.d.ts +24 -0
  10. package/dist/commands/api.js +14 -8
  11. package/dist/commands/api.js.map +1 -1
  12. package/dist/commands/app.d.ts +2 -0
  13. package/dist/commands/app.js +577 -0
  14. package/dist/commands/app.js.map +1 -0
  15. package/dist/commands/auth.d.ts +58 -0
  16. package/dist/commands/auth.js +228 -20
  17. package/dist/commands/auth.js.map +1 -1
  18. package/dist/commands/bench.d.ts +22 -0
  19. package/dist/commands/bench.js +19 -7
  20. package/dist/commands/bench.js.map +1 -1
  21. package/dist/commands/connect.d.ts +52 -0
  22. package/dist/commands/connect.js +221 -0
  23. package/dist/commands/connect.js.map +1 -0
  24. package/dist/commands/infer.d.ts +47 -0
  25. package/dist/commands/infer.js +152 -0
  26. package/dist/commands/infer.js.map +1 -0
  27. package/dist/commands/init.d.ts +45 -0
  28. package/dist/commands/init.js +267 -0
  29. package/dist/commands/init.js.map +1 -0
  30. package/dist/commands/keys.d.ts +42 -0
  31. package/dist/commands/keys.js +70 -38
  32. package/dist/commands/keys.js.map +1 -1
  33. package/dist/commands/manifest.d.ts +63 -0
  34. package/dist/commands/manifest.js +398 -0
  35. package/dist/commands/manifest.js.map +1 -0
  36. package/dist/commands/mcp.d.ts +65 -0
  37. package/dist/commands/mcp.js +167 -50
  38. package/dist/commands/mcp.js.map +1 -1
  39. package/dist/commands/render.d.ts +119 -0
  40. package/dist/commands/render.js +294 -0
  41. package/dist/commands/render.js.map +1 -0
  42. package/dist/commands/requests.d.ts +41 -0
  43. package/dist/commands/requests.js +99 -0
  44. package/dist/commands/requests.js.map +1 -0
  45. package/dist/commands/routine.d.ts +53 -1
  46. package/dist/commands/routine.js +246 -110
  47. package/dist/commands/routine.js.map +1 -1
  48. package/dist/commands/sandbox.d.ts +130 -0
  49. package/dist/commands/sandbox.js +327 -55
  50. package/dist/commands/sandbox.js.map +1 -1
  51. package/dist/commands/vision.d.ts +196 -0
  52. package/dist/commands/vision.js +478 -0
  53. package/dist/commands/vision.js.map +1 -0
  54. package/dist/commands/webhooks.d.ts +20 -0
  55. package/dist/commands/webhooks.js +76 -0
  56. package/dist/commands/webhooks.js.map +1 -0
  57. package/dist/ctx.d.ts +80 -6
  58. package/dist/ctx.js +233 -24
  59. package/dist/ctx.js.map +1 -1
  60. package/dist/main.d.ts +4 -1
  61. package/dist/main.js +78 -41
  62. package/dist/main.js.map +1 -1
  63. package/dist/manifest/apply.d.ts +79 -0
  64. package/dist/manifest/apply.js +123 -0
  65. package/dist/manifest/apply.js.map +1 -0
  66. package/dist/manifest/grant.d.ts +1 -0
  67. package/dist/manifest/grant.js +3 -0
  68. package/dist/manifest/grant.js.map +1 -0
  69. package/dist/manifest/load.d.ts +6 -0
  70. package/dist/manifest/load.js +35 -0
  71. package/dist/manifest/load.js.map +1 -0
  72. package/dist/manifest/plan.d.ts +1 -0
  73. package/dist/manifest/plan.js +4 -0
  74. package/dist/manifest/plan.js.map +1 -0
  75. package/dist/manifest/record.d.ts +98 -0
  76. package/dist/manifest/record.js +233 -0
  77. package/dist/manifest/record.js.map +1 -0
  78. package/dist/manifest/skip.d.ts +1 -0
  79. package/dist/manifest/skip.js +3 -0
  80. package/dist/manifest/skip.js.map +1 -0
  81. package/dist/manifest/source.d.ts +48 -0
  82. package/dist/manifest/source.js +223 -0
  83. package/dist/manifest/source.js.map +1 -0
  84. package/dist/registry.d.ts +19 -0
  85. package/dist/registry.js +52 -0
  86. package/dist/registry.js.map +1 -0
  87. package/dist/suggest.d.ts +9 -0
  88. package/dist/suggest.js +51 -0
  89. package/dist/suggest.js.map +1 -0
  90. package/package.json +9 -6
  91. package/dist/commands/web.d.ts +0 -4
  92. package/dist/commands/web.js +0 -205
  93. package/dist/commands/web.js.map +0 -1
@@ -0,0 +1,79 @@
1
+ import { type ApplyMode, type DeploySummary, type EngineState, type Plan } from "@b3os/deploy";
2
+ import type { B3OS } from "@b3os/sdk";
3
+ import type { Loaded } from "./load.ts";
4
+ import * as git from "./source.ts";
5
+ export { type ApplyMode, all, type DeploySummary, listTagged, newDeployId, retire, revTag, type SummaryItem, TAG, validDeployId, } from "@b3os/deploy";
6
+ export interface ApplyOptions {
7
+ mode: ApplyMode;
8
+ /** Remove the `x` items (apply only). */
9
+ prune?: boolean;
10
+ /** Services to give a new generation even when their spec did not change. */
11
+ replace?: string[];
12
+ /** Upload a service root that holds tracked `.env*` or `*.pem` files. */
13
+ allowSecretFiles?: boolean;
14
+ /** The deploy id (default: now plus 8 random hex). Tests and recordings pass one. */
15
+ deployId?: string;
16
+ /** Progress, one line at a time (stderr). */
17
+ log: (line: string) => void;
18
+ /** Asked once after the plan and before the first write; false stops with nothing changed. */
19
+ confirm: (plan: Plan) => Promise<boolean>;
20
+ /** Aborted on Ctrl-C: apply stops at the next step boundary and cleans up. */
21
+ signal?: AbortSignal;
22
+ /** Milliseconds between process polls while an old generation drains (default 1,000). */
23
+ pollMs?: number;
24
+ }
25
+ export interface ApplyOutcome {
26
+ exit: number;
27
+ plan: Plan;
28
+ /** Absent for a dry run and for a plan with a problem. */
29
+ summary?: DeploySummary;
30
+ }
31
+ export interface Planned {
32
+ plan: Plan;
33
+ state: EngineState;
34
+ /** The local clone the plan read (null outside git), which the writes read again. */
35
+ repo: git.GitRepository | null;
36
+ /** The client the plan read with, which the writes use (the engine keeps no client in its state). */
37
+ b3: B3OS;
38
+ /** What the deploy record says about the source: the repository's top level, the commit, uncommitted changes. */
39
+ source: {
40
+ root: string | null;
41
+ head: string | null;
42
+ dirty: boolean;
43
+ manifestInRepo: string | null;
44
+ };
45
+ /** `b3os app rollback`: the deploy it deploys again (its record's `rollback_of` when it is a `dep_` id). */
46
+ rollbackOf?: string;
47
+ }
48
+ /** Build a v1 plan (no writes; the dry run's only POST is /v1/routines/validate, as for v0). */
49
+ export declare function planV1(b3: B3OS, loaded: Loaded, baseUrl: string, o: ApplyOptions): Promise<Planned>;
50
+ /** What `b3os app rollback` deploys again: a commit, the deploy that ran it, when that went live, and what runs now. */
51
+ export interface RollbackTarget {
52
+ /** The full commit id, in the local repository. */
53
+ commit: string;
54
+ /** The deploy that ran it (`dep_…` or a CLI id). */
55
+ deploy: string;
56
+ /** When that deploy went live, from its record. */
57
+ liveAt: string | null;
58
+ /** Without a record: when its first generation started. */
59
+ startedAt?: string | null;
60
+ /** The commit (7 hex) of what runs now, or null. */
61
+ from: string | null;
62
+ }
63
+ /**
64
+ * Plan a rollback: the manifest and the source as the target commit has them, read from the local repository without
65
+ * a checkout (the deployer's way of reading a commit), so the working tree and HEAD stay as they are. The plan's first
66
+ * line says it is a rollback, and every object it makes carries the target's id (`b3os.rollback`), so a later
67
+ * keepalive and app status say what runs is a rollback. `root` and `manifestInRepo` locate b3os.yaml in the
68
+ * repository, as the working tree has it.
69
+ */
70
+ export declare function planRollback(b3: B3OS, root: string, manifestInRepo: string, target: RollbackTarget, baseUrl: string, o: ApplyOptions): Promise<Planned | {
71
+ problem: string;
72
+ }>;
73
+ /**
74
+ * Run the plan's writes. `planned` must have no problem; the caller checked and confirmed. `afterStep` sees the run
75
+ * after each step (the deploy record follows it).
76
+ */
77
+ export declare function execute(planned: Planned, o: ApplyOptions, afterStep?: (st: EngineState) => Promise<void> | void): Promise<DeploySummary>;
78
+ /** Ends a plan with a problem without a write, as the deployer does (`refused`), for the deploy record. */
79
+ export declare function refusePlan(planned: Planned, o: ApplyOptions): void;
@@ -0,0 +1,123 @@
1
+ // `b3os apply` for b3os.yaml v1 (draft): the CLI's driver of @b3os/deploy's engine (packages/deploy/src/engine.ts),
2
+ // which the edge's GitHub App deployer runs too. The engine plans and writes in steps that resume; the CLI runs
3
+ // them all in this one process (`run: "inline"`): a long wait, such as an install or a readiness wait, runs inside
4
+ // its step, streamed to stderr. What stays here is the working tree, which only the CLI has: the repository the
5
+ // file is in, its HEAD, and the uncommitted-changes checks (a `-dirty` revision, an uncommitted b3os.yaml).
6
+ //
7
+ // The order of the writes and what a failure leaves are the engine's (its header comment). Ctrl-C or SIGTERM (the
8
+ // signal option) stops at the next step boundary, or aborts the call in flight where that leaves nothing apply cannot
9
+ // find (an upload, an install, a snapshot, a drain), and cleans up as a failure does (exit 130).
10
+ import { dirname, resolve as resolvePath } from "node:path";
11
+ import { loadFromSource, planDeploy, refuse, runToEnd, } from "@b3os/deploy";
12
+ import * as git from "./source.js";
13
+ export { all, listTagged, newDeployId, retire, revTag, TAG, validDeployId, } from "@b3os/deploy";
14
+ function deps(b3, repo, o) {
15
+ return {
16
+ b3,
17
+ repo,
18
+ run: "inline",
19
+ log: o.log,
20
+ ...(o.signal ? { signal: o.signal } : {}),
21
+ ...(o.pollMs !== undefined ? { pollMs: o.pollMs } : {}),
22
+ };
23
+ }
24
+ /** Build a v1 plan (no writes; the dry run's only POST is /v1/routines/validate, as for v0). */
25
+ export async function planV1(b3, loaded, baseUrl, o) {
26
+ const root = loaded.path ? git.repoOf(dirname(loaded.path)) : null;
27
+ const dirRel = root && loaded.path ? git.inRepo(root, dirname(loaded.path)) : ".";
28
+ const manifestInRepo = root && loaded.path ? git.inRepo(root, loaded.path) : null;
29
+ const head = root ? git.resolveCommit(root, "HEAD") : null;
30
+ const dirtyTree = root && head ? git.dirty(root, [dirRel]) : false;
31
+ // b3os.yaml and its routine files deploy only as committed, like the services' source: a deploy is what its
32
+ // b3os.rev names, so keepalive can recreate it and the plan says what runs. (Keepalive reads the deployed commit.)
33
+ const uncommitted = [];
34
+ const outside = [];
35
+ if (root && head && manifestInRepo && loaded.path && o.mode !== "keepalive") {
36
+ const here = dirname(loaded.path);
37
+ const files = [manifestInRepo];
38
+ for (const r of loaded.routines) {
39
+ let rel;
40
+ try {
41
+ rel = git.inRepo(root, resolvePath(here, r.file));
42
+ }
43
+ catch {
44
+ rel = git.join(dirRel, r.file);
45
+ }
46
+ (rel.startsWith("../") ? outside : files).push(rel);
47
+ }
48
+ uncommitted.push(...git.uncommitted(root, files));
49
+ }
50
+ const repo = root ? new git.GitRepository(root) : null;
51
+ const planned = await planDeploy(deps(b3, repo, o), {
52
+ loaded,
53
+ manifestInRepo,
54
+ head,
55
+ workingTree: { dirty: dirtyTree, uncommitted, outside },
56
+ baseUrl,
57
+ options: {
58
+ mode: o.mode,
59
+ ...(o.prune !== undefined ? { prune: o.prune } : {}),
60
+ ...(o.replace ? { replace: o.replace } : {}),
61
+ ...(o.allowSecretFiles !== undefined ? { allowSecretFiles: o.allowSecretFiles } : {}),
62
+ ...(o.deployId ? { deployId: o.deployId } : {}),
63
+ },
64
+ });
65
+ return { ...planned, repo, b3, source: { root, head, dirty: dirtyTree, manifestInRepo } };
66
+ }
67
+ /**
68
+ * Plan a rollback: the manifest and the source as the target commit has them, read from the local repository without
69
+ * a checkout (the deployer's way of reading a commit), so the working tree and HEAD stay as they are. The plan's first
70
+ * line says it is a rollback, and every object it makes carries the target's id (`b3os.rollback`), so a later
71
+ * keepalive and app status say what runs is a rollback. `root` and `manifestInRepo` locate b3os.yaml in the
72
+ * repository, as the working tree has it.
73
+ */
74
+ export async function planRollback(b3, root, manifestInRepo, target, baseUrl, o) {
75
+ const repo = new git.GitRepository(root);
76
+ const src = repo.at(target.commit);
77
+ if ((await src.kind(manifestInRepo)) !== "file")
78
+ return { problem: `commit ${target.commit.slice(0, 12)} has no ${manifestInRepo}: nothing to roll back to there` };
79
+ const loaded = await loadFromSource(src, manifestInRepo);
80
+ if (!loaded.manifest || loaded.diagnostics.some((d) => d.level === "error"))
81
+ return {
82
+ problem: `${manifestInRepo} at ${target.commit.slice(0, 12)} does not load: ${loaded.diagnostics.find((d) => d.level === "error")?.message ?? "no manifest"}`,
83
+ };
84
+ const planned = await planDeploy(deps(b3, repo, o), {
85
+ loaded,
86
+ manifestInRepo,
87
+ head: target.commit,
88
+ workingTree: { dirty: false, uncommitted: [], outside: [] },
89
+ baseUrl,
90
+ options: {
91
+ mode: o.mode,
92
+ ...(o.allowSecretFiles !== undefined ? { allowSecretFiles: o.allowSecretFiles } : {}),
93
+ ...(o.deployId ? { deployId: o.deployId } : {}),
94
+ },
95
+ rollback: { deploy: target.deploy, items: [] },
96
+ });
97
+ planned.plan.rollback = {
98
+ to: target.commit.slice(0, 7),
99
+ deploy: target.deploy,
100
+ live_at: target.liveAt,
101
+ ...(target.startedAt ? { started_at: target.startedAt } : {}),
102
+ from: target.from,
103
+ };
104
+ return {
105
+ ...planned,
106
+ repo,
107
+ b3,
108
+ source: { root, head: target.commit, dirty: false, manifestInRepo },
109
+ rollbackOf: target.deploy,
110
+ };
111
+ }
112
+ /**
113
+ * Run the plan's writes. `planned` must have no problem; the caller checked and confirmed. `afterStep` sees the run
114
+ * after each step (the deploy record follows it).
115
+ */
116
+ export function execute(planned, o, afterStep) {
117
+ return runToEnd(deps(planned.b3, planned.repo, o), planned.state, afterStep);
118
+ }
119
+ /** Ends a plan with a problem without a write, as the deployer does (`refused`), for the deploy record. */
120
+ export function refusePlan(planned, o) {
121
+ refuse(deps(planned.b3, planned.repo, o), planned.state);
122
+ }
123
+ //# sourceMappingURL=apply.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply.js","sourceRoot":"","sources":["../../src/manifest/apply.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,gHAAgH;AAChH,mHAAmH;AACnH,gHAAgH;AAChH,4GAA4G;AAC5G,EAAE;AACF,kHAAkH;AAClH,sHAAsH;AACtH,iGAAiG;AAEjG,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAKL,cAAc,EAEd,UAAU,EACV,MAAM,EACN,QAAQ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AAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;AAC3D,CAAC"}
@@ -0,0 +1 @@
1
+ export { type DerivedGrant, deriveGrant, MAX_GRANT_CONNECTIONS, scopesFor } from "@b3os/deploy";
@@ -0,0 +1,3 @@
1
+ // A service's B3OS grant from its `uses`: in @b3os/deploy (packages/deploy/src/grant.ts).
2
+ export { deriveGrant, MAX_GRANT_CONNECTIONS, scopesFor } from "@b3os/deploy";
3
+ //# sourceMappingURL=grant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grant.js","sourceRoot":"","sources":["../../src/manifest/grant.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAE1F,OAAO,EAAqB,WAAW,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { type Loaded, type ManifestFiles } from "@b3os/deploy";
2
+ export { allSteps, type BuildDecl, type Command, type Diagnostic, describeSchemaError, type EgressDecl, inside, type Loaded, type LoadedRoutine, MANIFEST_FILE, type Manifest, type ManifestFiles, type ModelDecl, modelCalls, type PackCall, type PackDecl, type PackTrigger, type PoolDecl, packCalls, packTriggers, type ReadinessDecl, type ResourceDecl, type RoutineDecl, type SandboxDecl, type ServiceDecl, schema, serviceRoot, type ToolDecl, tidy, } from "@b3os/deploy";
3
+ /** The working tree under `base` (the folder that holds b3os.yaml), as the loader reads it. */
4
+ export declare function diskFiles(base: string): ManifestFiles;
5
+ /** Read and check a b3os.yaml. Never throws for a problem in the file: every finding is a diagnostic. */
6
+ export declare function loadManifest(file: string, cwd?: string): Loaded;
@@ -0,0 +1,35 @@
1
+ // b3os.yaml v0 (design preview) and v1 (draft), read from disk. The format, its precompiled schemas and every check
2
+ // live in @b3os/deploy (packages/deploy/src/load.ts), which the edge's GitHub App deployer runs too; this module is
3
+ // the CLI's view of the files: the working tree, relative to the folder that holds b3os.yaml.
4
+ import { existsSync, readFileSync, statSync } from "node:fs";
5
+ import { dirname, isAbsolute, relative, resolve } from "node:path";
6
+ import { loadManifestText } from "@b3os/deploy";
7
+ export { allSteps, describeSchemaError, inside, MANIFEST_FILE, modelCalls, packCalls, packTriggers, schema, serviceRoot, tidy, } from "@b3os/deploy";
8
+ /** The working tree under `base` (the folder that holds b3os.yaml), as the loader reads it. */
9
+ export function diskFiles(base) {
10
+ return {
11
+ read(path) {
12
+ try {
13
+ return { text: readFileSync(resolve(base, path), "utf8") };
14
+ }
15
+ catch (e) {
16
+ return { error: e.code === "ENOENT" ? "file not found" : e.message };
17
+ }
18
+ },
19
+ exists: (path) => existsSync(resolve(base, path)),
20
+ isDir: (path) => {
21
+ const p = resolve(base, path);
22
+ return existsSync(p) && statSync(p).isDirectory();
23
+ },
24
+ };
25
+ }
26
+ /** Read and check a b3os.yaml. Never throws for a problem in the file: every finding is a diagnostic. */
27
+ export function loadManifest(file, cwd = process.cwd()) {
28
+ const abs = isAbsolute(file) ? file : resolve(cwd, file);
29
+ // Shown relative to the working directory when it is under it, else as given.
30
+ const rel = relative(cwd, abs);
31
+ const shown = rel && !rel.startsWith("..") ? rel : file;
32
+ const text = existsSync(abs) ? readFileSync(abs, "utf8") : null;
33
+ return loadManifestText(text, shown, diskFiles(dirname(abs)), text === null ? undefined : abs);
34
+ }
35
+ //# sourceMappingURL=load.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load.js","sourceRoot":"","sources":["../../src/manifest/load.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,oHAAoH;AACpH,8FAA8F;AAE9F,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAe,gBAAgB,EAAsB,MAAM,cAAc,CAAC;AAEjF,OAAO,EACL,QAAQ,EAIR,mBAAmB,EAEnB,MAAM,EAGN,aAAa,EAIb,UAA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AAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IACxD,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAChE,OAAO,gBAAgB,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AACjG,CAAC"}
@@ -0,0 +1 @@
1
+ export { buildPlan, canonical, changedFields, connText, defaultConnection, FORMAT_V0, FORMAT_V1, forbidden, formatPlan, grants, matchConnection, notFound, type Plan, type PlanAction, type PlanBlock, type PlanItem, type PlanOptions, type PlanReader, type RoutineState, readerFor, SYMBOL, } from "@b3os/deploy";
@@ -0,0 +1,4 @@
1
+ // `b3os apply --dry-run`'s plan and its text: in @b3os/deploy (packages/deploy/src/plan.ts), shared with the edge's
2
+ // GitHub App deployer.
3
+ export { buildPlan, canonical, changedFields, connText, defaultConnection, FORMAT_V0, FORMAT_V1, forbidden, formatPlan, grants, matchConnection, notFound, readerFor, SYMBOL, } from "@b3os/deploy";
4
+ //# sourceMappingURL=plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan.js","sourceRoot":"","sources":["../../src/manifest/plan.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,uBAAuB;AAEvB,OAAO,EACL,SAAS,EACT,SAAS,EACT,aAAa,EACb,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,SAAS,EACT,SAAS,EACT,UAAU,EACV,MAAM,EACN,eAAe,EACf,QAAQ,EAQR,SAAS,EACT,MAAM,GACP,MAAM,cAAc,CAAC"}
@@ -0,0 +1,98 @@
1
+ import { type EngineState } from "@b3os/deploy";
2
+ import type { B3OS } from "@b3os/sdk";
3
+ import type { Planned } from "./apply.ts";
4
+ /** Below the edge's promise (an update at least every 5 minutes; the sweep waits 20). */
5
+ export declare const HEARTBEAT_MS: number;
6
+ /** Whether `scopes` hold sandboxes:write, which recording a deploy takes. */
7
+ export declare function canRecord(scopes: readonly string[]): boolean;
8
+ type Env = Record<string, string | undefined>;
9
+ /** What a GitHub Actions run says about itself (GITHUB_*), when the CLI runs in one on github.com. */
10
+ export declare function actionsContext(env: Env, head: string | null): {
11
+ repository: {
12
+ id: number | null;
13
+ full_name: string;
14
+ } | null;
15
+ run_url: string | null;
16
+ requested_by: string | null;
17
+ branch: string | null;
18
+ } | null;
19
+ /**
20
+ * The body of Record a deploy, from the plan: what runs, from where, and the plan as printed. A keepalive's (opened
21
+ * only once it recreates something) names what it recreates and why (`recreated`) and the commit those run.
22
+ */
23
+ export declare function openBody(planned: Planned, env?: Env): {
24
+ run_url?: string | null | undefined;
25
+ requested_by?: string | null | undefined;
26
+ manifest_path: string;
27
+ manifest_sha: string;
28
+ plan: {
29
+ text: string;
30
+ summary: {
31
+ remove: number;
32
+ problem: number;
33
+ create: number;
34
+ update: number;
35
+ ok: number;
36
+ gap: number;
37
+ unchecked: number;
38
+ down?: number;
39
+ };
40
+ findings: import("@b3os/deploy").Finding[];
41
+ };
42
+ repository?: {
43
+ id: number | null;
44
+ full_name: string;
45
+ } | undefined;
46
+ rollback_of?: string | undefined;
47
+ recreated?: import("@b3os/deploy").Lost[] | undefined;
48
+ app: string;
49
+ source: string;
50
+ commit: {
51
+ sha: string;
52
+ message: string | null;
53
+ branch: string | null;
54
+ dirty: boolean;
55
+ } | null;
56
+ };
57
+ /**
58
+ * Where the dashboard shows deploy `id` of `app`: the dashboard is the API host without `-api`
59
+ * (`beta-api.b3os.org` -> `beta.b3os.org/app/...`). Null for any other API host (a local edge, a proxy), where the
60
+ * dashboard's address is not known.
61
+ */
62
+ export declare function consoleUrl(baseUrl: string, app: string, id: string): string | null;
63
+ /** A deploy record that b3os apply opened, and moves as the run goes. */
64
+ export declare class DeployRecord {
65
+ private last;
66
+ private chain;
67
+ private timer;
68
+ private said;
69
+ private state;
70
+ private readonly b3;
71
+ readonly id: string;
72
+ private readonly log;
73
+ private constructor();
74
+ /**
75
+ * Opens the record (`queued`) under an Idempotency-Key of the plan's own deploy id, so a retried request makes one
76
+ * row. Null, with one line said, when it could not be opened: the deploy then goes on unrecorded.
77
+ */
78
+ static open(b3: B3OS, planned: Planned, log: (line: string) => void): Promise<DeployRecord | null>;
79
+ /** Sends one update after the ones before it; a failure is said once and never thrown. The answer, or null. */
80
+ private send;
81
+ /**
82
+ * The run starts writing: `building`, with the plan as printed (it names this record's id, which the plan the
83
+ * record opened with did not), and the heartbeat from here to the end.
84
+ */
85
+ start(st: EngineState): Promise<void>;
86
+ /** After each step: the status when it changed (applying at the cutover), else the step now and then. */
87
+ follow(st: EngineState): Promise<void>;
88
+ /**
89
+ * The run ended (or never started: a refused plan): its outcome, then no more updates. A run that went wrong
90
+ * after its cutover is recorded live, with its error: its new generations serve. When going live replaced a
91
+ * deploy the GitHub App kept alive, the edge says so in the answer's `reason`, and that is said here: from now on
92
+ * nothing renews the application but b3os apply.
93
+ */
94
+ finish(st: EngineState): Promise<void>;
95
+ /** The CLI itself failed part-way (an error the engine did not end the run on): `failed`, in its words. */
96
+ abort(e: unknown): Promise<void>;
97
+ }
98
+ export {};
@@ -0,0 +1,233 @@
1
+ // The deploy record `b3os apply` keeps on B3OS (design.md 2.4; POST and PATCH /v1/deploys): a `dep_` row like the
2
+ // GitHub App's, with `source: cli` from a machine or `github_actions` from a workflow, so the dashboard lists every
3
+ // deploy of an application wherever it ran. The row's id becomes the deploy id the objects are tagged with.
4
+ //
5
+ // It is best effort and never stops a deploy. It is opened only when the key holds sandboxes:write (the routes'
6
+ // scope, which a deploy of services needs anyway); a key without it, an API that does not take records yet, or any
7
+ // failure to open one leaves the deploy unrecorded, with one line saying so, and the dashboard rebuilds it from the
8
+ // tags as before. Once open, it moves as the run does (building, applying at the cutover, then live, failed or
9
+ // cancelled, the same mapping as the deployer's), and while a long step runs (an install streamed inline) a
10
+ // heartbeat tells the edge every HEARTBEAT_MS that the CLI still runs it: one silent for 20 minutes is failed by the
11
+ // edge's sweep. A failed update is said once and the deploy goes on.
12
+ import { deployRecordOf, formatPlan, recreatedOf } from "@b3os/deploy";
13
+ import * as git from "./source.js";
14
+ /** Below the edge's promise (an update at least every 5 minutes; the sweep waits 20). */
15
+ export const HEARTBEAT_MS = 4 * 60_000;
16
+ /** Step names sent at most this often between status changes (the heartbeat sends the latest anyway). */
17
+ const STEP_EVERY_MS = 15_000;
18
+ /** Whether `scopes` hold sandboxes:write, which recording a deploy takes. */
19
+ export function canRecord(scopes) {
20
+ return scopes.some((s) => s === "*" || s === "sandboxes:*" || s === "sandboxes:write");
21
+ }
22
+ /** What a GitHub Actions run says about itself (GITHUB_*), when the CLI runs in one on github.com. */
23
+ export function actionsContext(env, head) {
24
+ if (env.GITHUB_ACTIONS !== "true")
25
+ return null;
26
+ const repo = env.GITHUB_REPOSITORY ?? "";
27
+ const onGithub = (env.GITHUB_SERVER_URL ?? "https://github.com") === "https://github.com";
28
+ const fullName = /^[A-Za-z0-9-]{1,39}\/[A-Za-z0-9._-]{1,100}$/.test(repo) ? repo : null;
29
+ const id = Number(env.GITHUB_REPOSITORY_ID);
30
+ const run = /^\d{1,20}$/.test(env.GITHUB_RUN_ID ?? "") ? env.GITHUB_RUN_ID : null;
31
+ const attempt = Number(env.GITHUB_RUN_ATTEMPT ?? "1");
32
+ const actor = env.GITHUB_ACTOR ?? "";
33
+ return {
34
+ repository: fullName && onGithub ? { id: Number.isSafeInteger(id) && id > 0 ? id : null, full_name: fullName } : null,
35
+ run_url: fullName && onGithub && run
36
+ ? `https://github.com/${fullName}/actions/runs/${run}${attempt > 1 ? `/attempts/${attempt}` : ""}`
37
+ : null,
38
+ requested_by: /^[A-Za-z0-9][A-Za-z0-9-]{0,38}(\[bot\])?$/.test(actor) ? actor : null,
39
+ // The workflow's branch names the commit only when it is the one checked out (a rollback checks out another).
40
+ branch: env.GITHUB_REF_TYPE === "branch" && env.GITHUB_SHA === head ? (env.GITHUB_REF_NAME ?? null) : null,
41
+ };
42
+ }
43
+ /**
44
+ * The commit a keepalive recreates (the first recreated service's `b3os.rev`, resolved in the local clone the engine
45
+ * read it from), not the checkout's: after a rollback the two differ (harness run 3). No branch: it ran that commit.
46
+ */
47
+ function recreatedCommit(st, root) {
48
+ const rev = st.services.find((s) => s.recreate && s.prep)?.prep?.rev;
49
+ const short = rev ? /^([0-9a-f]{7,40})(-dirty)?\./.exec(rev)?.[1] : undefined;
50
+ const sha = short && root ? git.resolveCommit(root, short) : null;
51
+ return sha ? { sha, message: git.commitSubject(root, sha), branch: null, dirty: false } : null;
52
+ }
53
+ /**
54
+ * The body of Record a deploy, from the plan: what runs, from where, and the plan as printed. A keepalive's (opened
55
+ * only once it recreates something) names what it recreates and why (`recreated`) and the commit those run.
56
+ */
57
+ export function openBody(planned, env = process.env) {
58
+ const st = planned.state;
59
+ const src = planned.source;
60
+ const gha = actionsContext(env, src.head);
61
+ // A rollback deploys an older commit than the branch checked out: it names no branch.
62
+ const branch = planned.rollbackOf ? null : gha ? gha.branch : src.root ? git.currentBranch(src.root) : null;
63
+ const recreated = recreatedOf(st);
64
+ return {
65
+ app: st.app,
66
+ source: gha ? "github_actions" : "cli",
67
+ commit: st.mode === "keepalive"
68
+ ? recreatedCommit(st, src.root)
69
+ : src.head
70
+ ? {
71
+ sha: src.head,
72
+ message: src.root ? git.commitSubject(src.root, src.head) : null,
73
+ branch: branch && branch.length <= 255 ? branch : null,
74
+ dirty: src.dirty,
75
+ }
76
+ : null,
77
+ ...(recreated.length ? { recreated: recreated.slice(0, 10) } : {}),
78
+ // `b3os app rollback`: the deploy it runs again, when that one was recorded (a `dep_` id).
79
+ ...(planned.rollbackOf?.startsWith("dep_") ? { rollback_of: planned.rollbackOf } : {}),
80
+ ...(gha?.repository ? { repository: gha.repository } : {}),
81
+ manifest_path: src.manifestInRepo ?? "b3os.yaml",
82
+ manifest_sha: st.manifestSha,
83
+ plan: planOf(st),
84
+ ...(gha ? { run_url: gha.run_url, requested_by: gha.requested_by } : {}),
85
+ };
86
+ }
87
+ /**
88
+ * Where the dashboard shows deploy `id` of `app`: the dashboard is the API host without `-api`
89
+ * (`beta-api.b3os.org` -> `beta.b3os.org/app/...`). Null for any other API host (a local edge, a proxy), where the
90
+ * dashboard's address is not known.
91
+ */
92
+ export function consoleUrl(baseUrl, app, id) {
93
+ let host;
94
+ try {
95
+ const u = new URL(baseUrl);
96
+ if (u.protocol !== "https:")
97
+ return null;
98
+ host = u.hostname;
99
+ }
100
+ catch {
101
+ return null;
102
+ }
103
+ const m = /^([a-z0-9-]+)-api\.([a-z0-9.-]+)$/.exec(host);
104
+ if (!m)
105
+ return null;
106
+ return `https://${m[1]}.${m[2]}/app/applications/${encodeURIComponent(app)}?tab=deployments&deploy=${id}`;
107
+ }
108
+ function planOf(st) {
109
+ return {
110
+ // As the record keeps it: read after the deploy ran, in the dashboard.
111
+ text: formatPlan(st.plan, { record: true }).slice(0, 200_000),
112
+ summary: { ...st.plan.summary, remove: st.plan.summary.remove ?? 0 },
113
+ findings: st.findings.slice(0, 500),
114
+ };
115
+ }
116
+ const errorWords = (e) => {
117
+ const x = e;
118
+ return x.code ? `${x.status ?? "no answer"} ${x.code}` : (x.message ?? String(e));
119
+ };
120
+ /** A deploy record that b3os apply opened, and moves as the run goes. */
121
+ export class DeployRecord {
122
+ last = { status: "queued", step: "", at: 0 };
123
+ chain = Promise.resolve();
124
+ timer = null;
125
+ said = false;
126
+ state = null;
127
+ b3;
128
+ id;
129
+ log;
130
+ constructor(b3, id, log) {
131
+ this.b3 = b3;
132
+ this.id = id;
133
+ this.log = log;
134
+ }
135
+ /**
136
+ * Opens the record (`queued`) under an Idempotency-Key of the plan's own deploy id, so a retried request makes one
137
+ * row. Null, with one line said, when it could not be opened: the deploy then goes on unrecorded.
138
+ */
139
+ static async open(b3, planned, log) {
140
+ try {
141
+ const d = await b3.request({ method: "POST", path: "/v1/deploys", body: openBody(planned), edge: true, timeoutMs: 15_000 }, { idempotencyKey: `b3os-apply:${planned.state.dep}`, maxRetries: 2 });
142
+ if (!d?.id || !/^dep_[0-9a-hjkmnp-tv-z]{26}$/.test(d.id))
143
+ throw new Error("the answer named no deploy");
144
+ return new DeployRecord(b3, d.id, log);
145
+ }
146
+ catch (e) {
147
+ log(`deploy record: not written (${errorWords(e)}); the deploy goes on, and the dashboard reads it from its tags`);
148
+ return null;
149
+ }
150
+ }
151
+ /** Sends one update after the ones before it; a failure is said once and never thrown. The answer, or null. */
152
+ send(body) {
153
+ const sent = this.chain.then(async () => {
154
+ try {
155
+ return await this.b3.request({ method: "PATCH", path: `/v1/deploys/${this.id}`, body, edge: true, timeoutMs: 15_000 }, { maxRetries: 2 });
156
+ }
157
+ catch (e) {
158
+ if (!this.said)
159
+ this.log(`deploy record ${this.id}: not updated (${errorWords(e)}); the deploy goes on`);
160
+ this.said = true;
161
+ return null;
162
+ }
163
+ });
164
+ this.chain = sent.then(() => undefined);
165
+ return sent;
166
+ }
167
+ /**
168
+ * The run starts writing: `building`, with the plan as printed (it names this record's id, which the plan the
169
+ * record opened with did not), and the heartbeat from here to the end.
170
+ */
171
+ start(st) {
172
+ this.state = st;
173
+ this.timer = setInterval(() => {
174
+ const s = this.state;
175
+ if (s)
176
+ void this.send({ step: deployRecordOf(s).step });
177
+ }, HEARTBEAT_MS);
178
+ this.timer.unref?.();
179
+ return this.follow(st);
180
+ }
181
+ /** After each step: the status when it changed (applying at the cutover), else the step now and then. */
182
+ async follow(st) {
183
+ const r = deployRecordOf(st);
184
+ if (r.status === "live" || r.status === "failed" || r.status === "cancelled")
185
+ return;
186
+ const now = Date.now();
187
+ if (r.status === this.last.status && (r.step === this.last.step || now - this.last.at < STEP_EVERY_MS))
188
+ return;
189
+ const first = this.last.status === "queued";
190
+ const moved = r.status !== this.last.status;
191
+ this.last = { status: r.status, step: r.step, at: now };
192
+ await this.send({
193
+ ...(moved ? { status: r.status } : {}),
194
+ step: r.step,
195
+ items: r.items,
196
+ ...(first ? { plan: planOf(st) } : {}),
197
+ });
198
+ }
199
+ /**
200
+ * The run ended (or never started: a refused plan): its outcome, then no more updates. A run that went wrong
201
+ * after its cutover is recorded live, with its error: its new generations serve. When going live replaced a
202
+ * deploy the GitHub App kept alive, the edge says so in the answer's `reason`, and that is said here: from now on
203
+ * nothing renews the application but b3os apply.
204
+ */
205
+ async finish(st) {
206
+ if (this.timer)
207
+ clearInterval(this.timer);
208
+ this.timer = null;
209
+ const r = deployRecordOf(st);
210
+ const answer = await this.send({
211
+ status: r.status,
212
+ step: r.step,
213
+ items: r.items,
214
+ manifest_sha: st.manifestSha,
215
+ ...(this.last.status === "queued" ? { plan: planOf(st) } : {}),
216
+ ...(r.error ? { error: r.error.slice(0, 2000) } : {}),
217
+ ...(r.reason ? { reason: r.reason.slice(0, 1000) } : {}),
218
+ });
219
+ if (r.status === "live" && r.error)
220
+ this.log(`deploy record ${this.id}: live, since its new generations serve; the error is noted on it`);
221
+ if (r.status === "live" && typeof answer?.reason === "string" && answer.reason)
222
+ this.log(`deploy record ${this.id}: ${answer.reason}`);
223
+ }
224
+ /** The CLI itself failed part-way (an error the engine did not end the run on): `failed`, in its words. */
225
+ async abort(e) {
226
+ if (this.timer)
227
+ clearInterval(this.timer);
228
+ this.timer = null;
229
+ const why = e instanceof Error ? e.message : String(e);
230
+ await this.send({ status: "failed", error: `b3os apply stopped: ${why}`.slice(0, 2000) });
231
+ }
232
+ }
233
+ //# sourceMappingURL=record.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record.js","sourceRoot":"","sources":["../../src/manifest/record.ts"],"names":[],"mappings":"AAAA,kHAAkH;AAClH,oHAAoH;AACpH,4GAA4G;AAC5G,EAAE;AACF,gHAAgH;AAChH,mHAAmH;AACnH,oHAAoH;AACpH,+GAA+G;AAC/G,4GAA4G;AAC5G,qHAAqH;AACrH,qEAAqE;AAErE,OAAO,EAAE,cAAc,EA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