@intentius/chant-lexicon-fly 0.91.0 → 0.93.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 +27 -0
- package/dist/components/fly-release.d.ts +51 -4
- package/dist/components/fly-release.d.ts.map +1 -1
- package/dist/composites/catalog.d.ts.map +1 -1
- package/dist/composites/fly-site.d.ts +86 -0
- package/dist/composites/fly-site.d.ts.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/integrity.json +4 -4
- package/dist/manifest.json +1 -1
- package/dist/op/activities/fly-release-step.d.ts +24 -0
- package/dist/op/activities/fly-release-step.d.ts.map +1 -0
- package/dist/op/activities/fly-rollback-step.d.ts +25 -0
- package/dist/op/activities/fly-rollback-step.d.ts.map +1 -0
- package/dist/op/activities/index.d.ts +7 -1
- package/dist/op/activities/index.d.ts.map +1 -1
- package/dist/op/activities/machine-release.d.ts +16 -0
- package/dist/op/activities/machine-release.d.ts.map +1 -1
- package/dist/op/activities/machines-fake.d.ts +4 -2
- package/dist/op/activities/machines-fake.d.ts.map +1 -1
- package/dist/op/activities/machines-local-cli.d.ts +20 -0
- package/dist/op/activities/machines-local-cli.d.ts.map +1 -0
- package/dist/op/activities/machines-local.d.ts +107 -0
- package/dist/op/activities/machines-local.d.ts.map +1 -0
- package/dist/op/activities/sprite-fs.d.ts +12 -3
- package/dist/op/activities/sprite-fs.d.ts.map +1 -1
- package/dist/op/activities/sprite-service-converge.d.ts +107 -0
- package/dist/op/activities/sprite-service-converge.d.ts.map +1 -0
- package/dist/op/activities/sprites-fake.d.ts +18 -1
- package/dist/op/activities/sprites-fake.d.ts.map +1 -1
- package/dist/op/activities/sprites.d.ts +29 -9
- package/dist/op/activities/sprites.d.ts.map +1 -1
- package/dist/op/activity-contracts.d.ts +62 -0
- package/dist/op/activity-contracts.d.ts.map +1 -0
- package/dist/op/builders.d.ts +32 -0
- package/dist/op/builders.d.ts.map +1 -1
- package/dist/skills/chant-fly-ops.md +67 -0
- package/dist/skills/chant-fly-sprites.md +2 -1
- package/package.json +11 -4
- package/src/components/fly-release.test.ts +135 -1
- package/src/components/fly-release.ts +125 -8
- package/src/composites/catalog.test.ts +2 -1
- package/src/composites/catalog.ts +98 -0
- package/src/composites/fly-site.test.ts +66 -0
- package/src/composites/fly-site.ts +140 -0
- package/src/index.ts +8 -0
- package/src/op/activities/fly-release-step.ts +32 -0
- package/src/op/activities/fly-rollback-step.ts +33 -0
- package/src/op/activities/index.ts +25 -0
- package/src/op/activities/machine-release.ts +22 -0
- package/src/op/activities/machines-fake.ts +5 -3
- package/src/op/activities/machines-local-cli.ts +73 -0
- package/src/op/activities/machines-local.test.ts +225 -0
- package/src/op/activities/machines-local.ts +437 -0
- package/src/op/activities/sprite-exec-options.docker.integration.test.ts +70 -0
- package/src/op/activities/sprite-fs.test.ts +55 -0
- package/src/op/activities/sprite-fs.ts +14 -5
- package/src/op/activities/sprite-service-converge.test.ts +268 -0
- package/src/op/activities/sprite-service-converge.ts +268 -0
- package/src/op/activities/sprites-fake.ts +51 -8
- package/src/op/activities/sprites.integration.test.ts +30 -0
- package/src/op/activities/sprites.test.ts +20 -0
- package/src/op/activities/sprites.ts +50 -10
- package/src/op/activity-contracts.test.ts +71 -0
- package/src/op/activity-contracts.ts +67 -0
- package/src/op/builders.ts +32 -0
- package/src/skills/chant-fly-ops.md +67 -0
- package/src/skills/chant-fly-sprites.md +2 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"machines-local.d.ts","sourceRoot":"","sources":["../../../src/op/activities/machines-local.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAQH,OAAO,EAA2C,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEzI,kIAAkI;AAClI,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,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ED,MAAM,WAAW,yBAA0B,SAAQ,oBAAoB;IACrE,8FAA8F;IAC9F,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yBAAyB;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,8EAA8E;IAC9E,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,aAAa,CAAC;IACxB,qDAAqD;IACrD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,GAAE,yBAA8B,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAiC9G"}
|
|
@@ -8,8 +8,12 @@
|
|
|
8
8
|
* read/write move raw file bytes in the body (not JSON), so these use a small
|
|
9
9
|
* raw HTTP client (`SpritesRawHttp`) rather than the JSON `SpritesHttp` the
|
|
10
10
|
* lifecycle activities use; path/mode/mkdir/recursive ride as query params.
|
|
11
|
-
* Endpoint + bearer resolution
|
|
12
|
-
* `
|
|
11
|
+
* Endpoint + bearer resolution go through `sprites.ts`'s shared resolvers
|
|
12
|
+
* (`resolveSpritesEndpoint`/`resolveSpritesToken`) — an explicit `endpoint` /
|
|
13
|
+
* `token` wins, then `SPRITES_BASE_URL`/`SPRITES_API_URL`, then
|
|
14
|
+
* `SPRITES_API_TOKEN`/its `SPRITE_TOKEN` alias (#2711, #2765: this module
|
|
15
|
+
* used to read `SPRITES_API_TOKEN` directly, missing the alias the other
|
|
16
|
+
* Sprites activities honor).
|
|
13
17
|
*/
|
|
14
18
|
/**
|
|
15
19
|
* Build a `/v1/sprites/{id}/fs/{op}?...` URL. `params` values that are undefined
|
|
@@ -29,7 +33,12 @@ export type SpritesRawHttp = (method: string, url: string, body?: string, header
|
|
|
29
33
|
* Default `fetch`-based raw client. Sends the body as-is with an
|
|
30
34
|
* `application/octet-stream` content-type and `Authorization: Bearer <token>`
|
|
31
35
|
* when a token is set (real Sprites); the fake ignores the token. The token
|
|
32
|
-
*
|
|
36
|
+
* resolves through `resolveSpritesToken` at call time — `SPRITES_API_TOKEN`,
|
|
37
|
+
* then its `SPRITE_TOKEN` alias (#2711, #2765) — the same resolver
|
|
38
|
+
* `sprites.ts`'s `defaultSpritesHttp` uses, so every fs activity
|
|
39
|
+
* (`spriteWriteFile`, `spriteReadFile`, `spriteListDir`, `spriteRemove`)
|
|
40
|
+
* authenticates the same way the lifecycle activities do. `fetchImpl` is
|
|
41
|
+
* injectable.
|
|
33
42
|
*/
|
|
34
43
|
export declare function defaultSpritesRawHttp(token?: string, fetchImpl?: typeof fetch): SpritesRawHttp;
|
|
35
44
|
export interface SpriteWriteFileArgs {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sprite-fs.d.ts","sourceRoot":"","sources":["../../../src/op/activities/sprite-fs.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sprite-fs.d.ts","sourceRoot":"","sources":["../../../src/op/activities/sprite-fs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAcH;;;GAGG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,EACxC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,GACnD,MAAM,CAQR;AAID;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,CAC3B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAChC,MAAM,CAAC,EAAE,WAAW,KACjB,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE/C;;;;;;;;;;GA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,CAAC;IACpB,kCAAkC;IAClC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAID,mFAAmF;AACnF,wBAAsB,eAAe,CACnC,IAAI,EAAE,mBAAmB,EACzB,MAAM,CAAC,EAAE,WAAW,EACpB,IAAI,GAAE,cAAkD,GACvD,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAchC;AAED,8EAA8E;AAC9E,wBAAsB,cAAc,CAClC,IAAI,EAAE,kBAAkB,EACxB,MAAM,CAAC,EAAE,WAAW,EACpB,IAAI,GAAE,cAAkD,GACvD,OAAO,CAAC,oBAAoB,CAAC,CAO/B;AAED,oFAAoF;AACpF,wBAAsB,aAAa,CACjC,IAAI,EAAE,iBAAiB,EACvB,MAAM,CAAC,EAAE,WAAW,EACpB,IAAI,GAAE,cAAkD,GACvD,OAAO,CAAC,cAAc,EAAE,CAAC,CAU3B;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,gBAAgB,EACtB,MAAM,CAAC,EAAE,WAAW,EACpB,IAAI,GAAE,cAAkD,GACvD,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAchC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A sprite's services as resources a `ConvergeOp` observes and converges
|
|
3
|
+
* (#2778).
|
|
4
|
+
*
|
|
5
|
+
* A box runs its app, hud, door and site as services a supervisor keeps
|
|
6
|
+
* running: sprite-env on a sprite, and a stand-in with the same command line
|
|
7
|
+
* elsewhere. No lexicon declares them, so a ConvergeOp can't observe them
|
|
8
|
+
* through an environment. It can through an observer step:
|
|
9
|
+
*
|
|
10
|
+
* - `spriteServicesObserve` reads the supervisor's list and probes each
|
|
11
|
+
* declared service's health URL, and returns one verdict per service,
|
|
12
|
+
* `in-sync`, `drifted` or `unknown`: the `ResourceObservation` a
|
|
13
|
+
* `ConvergeOp({ observe })` evaluates its rules against, once per service.
|
|
14
|
+
* - `spriteServiceRestart` restarts one service through the supervisor and
|
|
15
|
+
* waits for its health URL. It is the step of the Op a rule dispatches; the
|
|
16
|
+
* service is the one the rule fired for, which the dispatched run reads
|
|
17
|
+
* from `CHANT_CONVERGE_RESOURCE`.
|
|
18
|
+
*
|
|
19
|
+
* Both work in one of two ways. With no sprite `id`, they run inside the
|
|
20
|
+
* sprite and call `sprite-env services` (found on PATH or in /.sprite/bin,
|
|
21
|
+
* or at `spriteEnv`). With an `id`, they go through the Sprites API
|
|
22
|
+
* (`spriteServiceList`, `spriteServiceStop` and `spriteServiceStart`).
|
|
23
|
+
*/
|
|
24
|
+
import type { SpritesHttp } from "./sprites.js";
|
|
25
|
+
/** One service a box declares. */
|
|
26
|
+
export interface DeclaredSpriteService {
|
|
27
|
+
name: string;
|
|
28
|
+
/** A URL that answers 200 while the service works. Without one, the supervisor's state decides. */
|
|
29
|
+
health?: string;
|
|
30
|
+
/** Not defined yet is not drift: the service is left out until it exists (a site before its first release). */
|
|
31
|
+
optional?: boolean;
|
|
32
|
+
}
|
|
33
|
+
interface Via {
|
|
34
|
+
/** The sprite, for the Sprites API. Without it, `sprite-env` inside the sprite. */
|
|
35
|
+
id?: string;
|
|
36
|
+
/** The `sprite-env` binary. Default: the one on PATH, else /.sprite/bin/sprite-env. */
|
|
37
|
+
spriteEnv?: string;
|
|
38
|
+
endpoint?: string;
|
|
39
|
+
token?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface SpriteServicesObserveArgs extends Via {
|
|
42
|
+
/** The declared services. */
|
|
43
|
+
services?: DeclaredSpriteService[];
|
|
44
|
+
/** A JSON file of `{ services: [...] }`, relative to the working directory, read on each tick. */
|
|
45
|
+
servicesFile?: string;
|
|
46
|
+
/** Health probes before a service counts as drifted. Default 3. */
|
|
47
|
+
probes?: number;
|
|
48
|
+
/** Time between probes, ms. Default 1000. */
|
|
49
|
+
probeIntervalMs?: number;
|
|
50
|
+
}
|
|
51
|
+
export interface SpriteServicesObserveResult {
|
|
52
|
+
resources: {
|
|
53
|
+
name: string;
|
|
54
|
+
status: "in-sync" | "drifted" | "unknown";
|
|
55
|
+
detail: string;
|
|
56
|
+
}[];
|
|
57
|
+
/** Optional services that aren't defined yet. */
|
|
58
|
+
skipped: string[];
|
|
59
|
+
}
|
|
60
|
+
export interface SpriteServiceRestartArgs extends Via {
|
|
61
|
+
/** The service. Default: the resource a ConvergeOp dispatched this run for (`CHANT_CONVERGE_RESOURCE`). */
|
|
62
|
+
name?: string;
|
|
63
|
+
/** Its health URL. Default: the one `services` or `servicesFile` declares for it. */
|
|
64
|
+
health?: string;
|
|
65
|
+
services?: DeclaredSpriteService[];
|
|
66
|
+
servicesFile?: string;
|
|
67
|
+
/** How long to wait for the health URL after the restart, ms. Default 60000. */
|
|
68
|
+
waitMs?: number;
|
|
69
|
+
}
|
|
70
|
+
export interface SpriteServiceRestartResult {
|
|
71
|
+
name: string;
|
|
72
|
+
/** Whether its health URL answered, or null when it declares none. */
|
|
73
|
+
healthy: boolean | null;
|
|
74
|
+
}
|
|
75
|
+
/** The services declared inline and in `servicesFile`, inline first. */
|
|
76
|
+
export declare function declaredServices(args: {
|
|
77
|
+
services?: DeclaredSpriteService[];
|
|
78
|
+
servicesFile?: string;
|
|
79
|
+
}, cwd?: string): DeclaredSpriteService[];
|
|
80
|
+
/** The sprite-env binary, or null when there is none. */
|
|
81
|
+
export declare function findSpriteEnv(explicit?: string, env?: NodeJS.ProcessEnv): string | null;
|
|
82
|
+
/**
|
|
83
|
+
* `sprite-env services list` as name to state. A sprite's sprite-env prints
|
|
84
|
+
* JSON (an array of services with `state.status`); a stand-in may print a
|
|
85
|
+
* tab-separated table whose second column is the state. Pure.
|
|
86
|
+
*/
|
|
87
|
+
export declare function parseServicesList(text: string): Map<string, string | null>;
|
|
88
|
+
/** One GET of a health URL: true on 200. */
|
|
89
|
+
export declare function probeHealth(url: string, signal?: AbortSignal): Promise<boolean>;
|
|
90
|
+
/**
|
|
91
|
+
* Observe the declared services: one verdict each, for a ConvergeOp's rules.
|
|
92
|
+
* A service the supervisor doesn't have, or has stopped, is drifted; one
|
|
93
|
+
* with a health URL is in sync when the URL answers 200 within `probes`
|
|
94
|
+
* tries and drifted when it doesn't; one without is in sync while it runs.
|
|
95
|
+
* When the supervisor can't be read, every service is unknown, and unknown
|
|
96
|
+
* never remediates.
|
|
97
|
+
*/
|
|
98
|
+
export declare function spriteServicesObserve(args: SpriteServicesObserveArgs, signal?: AbortSignal, http?: SpritesHttp): Promise<SpriteServicesObserveResult>;
|
|
99
|
+
/**
|
|
100
|
+
* Restart one service through its supervisor and wait for its health URL.
|
|
101
|
+
* The service is `name`, or the resource the ConvergeOp's rule fired for.
|
|
102
|
+
* Throws when neither names one, when the supervisor refuses, or when the
|
|
103
|
+
* service does not answer its health URL within `waitMs`.
|
|
104
|
+
*/
|
|
105
|
+
export declare function spriteServiceRestart(args: SpriteServiceRestartArgs, signal?: AbortSignal, http?: SpritesHttp): Promise<SpriteServiceRestartResult>;
|
|
106
|
+
export {};
|
|
107
|
+
//# sourceMappingURL=sprite-service-converge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sprite-service-converge.d.ts","sourceRoot":"","sources":["../../../src/op/activities/sprite-service-converge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAOH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAY7C,kCAAkC;AAClC,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,mGAAmG;IACnG,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+GAA+G;IAC/G,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,UAAU,GAAG;IACX,mFAAmF;IACnF,EAAE,CAAC,EAAE,MAA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zD,wBAAgB,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,IAAI,CAMpG;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAoB1E;AAaD,4CAA4C;AAC5C,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CASrF;AAID;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,yBAAyB,EAC/B,MAAM,CAAC,EAAE,WAAW,EACpB,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,2BAA2B,CAAC,CAgDtC;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,wBAAwB,EAC9B,MAAM,CAAC,EAAE,WAAW,EACpB,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,0BAA0B,CAAC,CAyBrC"}
|
|
@@ -73,14 +73,31 @@ interface ExecResult {
|
|
|
73
73
|
stdout: string;
|
|
74
74
|
stderr: string;
|
|
75
75
|
exitCode: number;
|
|
76
|
+
/**
|
|
77
|
+
* Fake-only timing hook (#2765): how long `runExec` should hold the frames
|
|
78
|
+
* before sending them, set by the `sleep` form below. Lets a test prove
|
|
79
|
+
* `spriteExec`'s `timeoutMs` fires without a slow real exec.
|
|
80
|
+
*/
|
|
81
|
+
delayMs?: number;
|
|
76
82
|
}
|
|
77
83
|
/**
|
|
78
84
|
* Run one command against a sprite's `fs`. Not a real shell: it recognizes a
|
|
79
85
|
* small set of forms so a test (and the example `guarded-task` Op) can write a
|
|
80
86
|
* key, then overwrite/fail it, and prove restore rewinds. Segments split on
|
|
81
87
|
* `;` run in order; the exit code is the last segment's (shell `;` semantics).
|
|
88
|
+
*
|
|
89
|
+
* `opts.env`/`opts.dir` (#2765) are the `env`/`dir` exec options after they
|
|
90
|
+
* cross the wire (`env` as `KEY=VALUE` strings, mirroring what the query
|
|
91
|
+
* params carry) — `env` and `pwd` below echo them back so a test can prove
|
|
92
|
+
* they reached the command. Real spritzer only wires `env`/`dir` through in
|
|
93
|
+
* container exec mode (real processes); its interpreter mode — what
|
|
94
|
+
* `fakeExec` otherwise mirrors — has no notion of either, so this pair of
|
|
95
|
+
* forms is fake-only, proven separately from the container-mode docker test.
|
|
82
96
|
*/
|
|
83
|
-
export declare function fakeExec(sprite: SpriteState, cmd: string
|
|
97
|
+
export declare function fakeExec(sprite: SpriteState, cmd: string, opts?: {
|
|
98
|
+
env?: string[];
|
|
99
|
+
dir?: string;
|
|
100
|
+
}): ExecResult;
|
|
84
101
|
/**
|
|
85
102
|
* Immediate children of `dir` in a flat `path → contents` map: a key
|
|
86
103
|
* `${dir}/name` is a file; `${dir}/name/...` contributes the dir `name` once.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sprites-fake.d.ts","sourceRoot":"","sources":["../../../src/op/activities/sprites-fake.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,KAAK,YAAY,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEpE,UAAU,gBAAgB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5B;AAED,UAAU,aAAa;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,GAAG,CAA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M,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrD,oEAAoE;IACpE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACxC,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC,CAAC;CACnE;AAED,UAAU,UAAU;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,WAAW,EACnB,GAAG,EAAE,MAAM,EACX,IAAI,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAC1C,UAAU,CA2DZ;AA4CD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAgBjI;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,CAAC,CAwXpF"}
|
|
@@ -64,10 +64,17 @@ export declare function accumulateExecFrames(frames: Iterable<Uint8Array>): Spri
|
|
|
64
64
|
*/
|
|
65
65
|
export declare function splitCommand(cmd: string): string[];
|
|
66
66
|
/**
|
|
67
|
-
* Build the `wss://.../exec?cmd=...&path=...&stdin=false&cc=true
|
|
68
|
-
* command (http→ws, https→wss).
|
|
67
|
+
* Build the `wss://.../exec?cmd=...&path=...&stdin=false&cc=true[&dir=...][&env=K=V]*`
|
|
68
|
+
* URL for a command (http→ws, https→wss). `dir` and `env` (#2765) are sent the
|
|
69
|
+
* way wisp's and spritzer's real exec API take them: `dir` is a single query
|
|
70
|
+
* param, and each `env` entry is its own repeated `env=KEY=VALUE` param — see
|
|
71
|
+
* wisp's `optsFromValues` (`Dir: q.Get("dir")`, `Env: q["env"]`) and spritzer's
|
|
72
|
+
* container-mode wrapping (`--dir`/`--env` per `real.go`). Pure.
|
|
69
73
|
*/
|
|
70
|
-
export declare function spriteExecWsUrl(base: string, id: string, cmd: string
|
|
74
|
+
export declare function spriteExecWsUrl(base: string, id: string, cmd: string, opts?: {
|
|
75
|
+
env?: Record<string, string>;
|
|
76
|
+
dir?: string;
|
|
77
|
+
}): string;
|
|
71
78
|
/**
|
|
72
79
|
* Parse a checkpoint create NDJSON body (line-delimited JSON progress events)
|
|
73
80
|
* and capture the created version id. Real Sprites tags each event with a
|
|
@@ -107,8 +114,16 @@ export interface SpriteExecArgs {
|
|
|
107
114
|
id: string;
|
|
108
115
|
/** Command to run inside the sprite (tokenized into argv, quotes respected). */
|
|
109
116
|
cmd: string;
|
|
110
|
-
/**
|
|
117
|
+
/**
|
|
118
|
+
* Per-exec timeout in ms (#2765). When it elapses before the command exits,
|
|
119
|
+
* the exec WebSocket is aborted and the activity throws a timeout error —
|
|
120
|
+
* previously declared and never enforced.
|
|
121
|
+
*/
|
|
111
122
|
timeoutMs?: number;
|
|
123
|
+
/** Extra environment variables for the command, on top of the sprite's own (#2765). */
|
|
124
|
+
env?: Record<string, string>;
|
|
125
|
+
/** Working directory to run the command in (#2765). */
|
|
126
|
+
dir?: string;
|
|
112
127
|
endpoint?: string;
|
|
113
128
|
token?: string;
|
|
114
129
|
}
|
|
@@ -176,11 +191,16 @@ export declare function defaultSpritesHttp(token?: string, fetchImpl?: typeof fe
|
|
|
176
191
|
export declare function spriteCreate(args: SpriteCreateArgs, signal?: AbortSignal, http?: SpritesHttp): Promise<SpriteCreateResult>;
|
|
177
192
|
/**
|
|
178
193
|
* Run a command in the sprite over the control WebSocket (non-PTY stream
|
|
179
|
-
* framing, per superfly/sprites-go). Connects to `wss://.../exec
|
|
180
|
-
* single `[4]` (stdin EOF), accumulates
|
|
181
|
-
* exit code from the `[3]` frame. A
|
|
182
|
-
* throws) so a risky step fails its
|
|
183
|
-
* compensation (S5).
|
|
194
|
+
* framing, per superfly/sprites-go). Connects to `wss://.../exec` (`dir`/`env`
|
|
195
|
+
* riding on the URL — #2765), sends a single `[4]` (stdin EOF), accumulates
|
|
196
|
+
* stdout/stderr frames, and reads the exit code from the `[3]` frame. A
|
|
197
|
+
* non-zero exit is a failed activity (it throws) so a risky step fails its
|
|
198
|
+
* phase and triggers `onFailure` compensation (S5).
|
|
199
|
+
*
|
|
200
|
+
* `timeoutMs` (#2765) bounds the whole exec: a timer set at connect time
|
|
201
|
+
* terminates the WebSocket and rejects with a timeout error once it elapses
|
|
202
|
+
* without the command finishing. Previously declared on `SpriteExecArgs` and
|
|
203
|
+
* never read.
|
|
184
204
|
*/
|
|
185
205
|
export declare function spriteExec(args: SpriteExecArgs, signal?: AbortSignal): Promise<SpriteExecResult>;
|
|
186
206
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sprites.d.ts","sourceRoot":"","sources":["../../../src/op/activities/sprites.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AASH,eAAO,MAAM,wBAAwB,4BAA4B,CAAC;AAIlE;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,EAChC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,MAAM,CAGR;AAED;;;;GAIG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H,wBAAsB,aAAa,CACjC,IAAI,EAAE,iBAAiB,EACvB,MAAM,CAAC,EAAE,WAAW,EACpB,IAAI,GAAE,WAA4C,GACjD,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAmBhC;AAED,kGAAkG;AAClG,wBAAsB,aAAa,CACjC,IAAI,EAAE,iBAAiB,EACvB,MAAM,CAAC,EAAE,WAAW,EACpB,IAAI,GAAE,WAA4C,GACjD,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAQhC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,sBAAgB,CAAC;AAC1C,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAEjD,MAAM,WAAW,aAAa;IAC5B,wBAAwB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;GAOG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,aAAa,EACnB,MAAM,CAAC,EAAE,WAAW,EACpB,IAAI,GAAE,WAA4C,GACjD,OAAO,CAAC,eAAe,CAAC,CAgC1B"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Activity contracts for this lexicon's `op/activities` (chant #2101, #2843).
|
|
3
|
+
*
|
|
4
|
+
* Resolved by convention at `@intentius/chant-lexicon-fly/op/activity-contracts`:
|
|
5
|
+
* `loadActivityContracts` (`packages/core/src/op/activity-contract-registry.ts`)
|
|
6
|
+
* merges what it finds here into the map core's OPS012 and OPS013 validate
|
|
7
|
+
* every Op step against.
|
|
8
|
+
*
|
|
9
|
+
* Only the activities a step's output is referenced from are covered.
|
|
10
|
+
* `spriteServicesObserve` is the observer of a `ConvergeOp({ observe })`
|
|
11
|
+
* (#2778), whose Converge step reads the observer's whole output, so OPS013
|
|
12
|
+
* needs its return schema; without one, every project declaring such a
|
|
13
|
+
* ConvergeOp failed `chant build` and `chant lint`. `spriteServiceRestart` is
|
|
14
|
+
* the step of the Op such a ConvergeOp's rule runs, and its result is what a
|
|
15
|
+
* later step would read. The other Sprites activities have no contract yet,
|
|
16
|
+
* which OPS012 skips rather than flags.
|
|
17
|
+
*
|
|
18
|
+
* Each `args` schema mirrors the `*Args` interface in
|
|
19
|
+
* `./activities/sprite-service-converge.ts` and each `returns` schema the
|
|
20
|
+
* `*Result`. Authored with `z.strictObject(...)`, so a misspelled key fails
|
|
21
|
+
* the build instead of vanishing.
|
|
22
|
+
*/
|
|
23
|
+
export declare const spriteServicesObserveContract: import("@intentius/chant/op").ActivityContract<{
|
|
24
|
+
services?: {
|
|
25
|
+
name: string;
|
|
26
|
+
health?: string | undefined;
|
|
27
|
+
optional?: boolean | undefined;
|
|
28
|
+
}[] | undefined;
|
|
29
|
+
servicesFile?: string | undefined;
|
|
30
|
+
probes?: number | undefined;
|
|
31
|
+
probeIntervalMs?: number | undefined;
|
|
32
|
+
id?: string | undefined;
|
|
33
|
+
spriteEnv?: string | undefined;
|
|
34
|
+
endpoint?: string | undefined;
|
|
35
|
+
token?: string | undefined;
|
|
36
|
+
}, {
|
|
37
|
+
resources: {
|
|
38
|
+
name: string;
|
|
39
|
+
status: "unknown" | "drifted" | "in-sync";
|
|
40
|
+
detail: string;
|
|
41
|
+
}[];
|
|
42
|
+
skipped: string[];
|
|
43
|
+
}>;
|
|
44
|
+
export declare const spriteServiceRestartContract: import("@intentius/chant/op").ActivityContract<{
|
|
45
|
+
name?: string | undefined;
|
|
46
|
+
health?: string | undefined;
|
|
47
|
+
services?: {
|
|
48
|
+
name: string;
|
|
49
|
+
health?: string | undefined;
|
|
50
|
+
optional?: boolean | undefined;
|
|
51
|
+
}[] | undefined;
|
|
52
|
+
servicesFile?: string | undefined;
|
|
53
|
+
waitMs?: number | undefined;
|
|
54
|
+
id?: string | undefined;
|
|
55
|
+
spriteEnv?: string | undefined;
|
|
56
|
+
endpoint?: string | undefined;
|
|
57
|
+
token?: string | undefined;
|
|
58
|
+
}, {
|
|
59
|
+
name: string;
|
|
60
|
+
healthy: boolean | null;
|
|
61
|
+
}>;
|
|
62
|
+
//# sourceMappingURL=activity-contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-contracts.d.ts","sourceRoot":"","sources":["../../src/op/activity-contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAmBH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;EAazC,CAAC;AAEF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;EAWxC,CAAC"}
|
package/dist/op/builders.d.ts
CHANGED
|
@@ -31,9 +31,12 @@ import type { SpriteCreateArgs, SpriteExecArgs, SpriteCheckpointArgs, SpriteRest
|
|
|
31
31
|
import type { SpriteWriteFileArgs, SpriteReadFileArgs, SpriteListDirArgs, SpriteRemoveArgs } from "./activities/sprite-fs.js";
|
|
32
32
|
import type { SpriteApplyNetworkPolicyArgs, SpriteApplyServicesArgs } from "./activities/sprite-config.js";
|
|
33
33
|
import type { SpriteServiceCreateArgs, SpriteServiceGetArgs, SpriteServiceListArgs, SpriteServiceStartArgs, SpriteServiceStopArgs, SpriteServiceDeleteArgs, SpriteServiceLogsArgs } from "./activities/sprite-services.js";
|
|
34
|
+
import type { SpriteServicesObserveArgs, SpriteServiceRestartArgs } from "./activities/sprite-service-converge.js";
|
|
34
35
|
import type { SpriteTaskCreateArgs, SpriteTaskRefreshArgs, SpriteTaskReleaseArgs } from "./activities/sprite-tasks.js";
|
|
35
36
|
import type { SpritesUpArgs, SpritesDownArgs } from "./activities/sprites-emulator.js";
|
|
36
37
|
import type { FlyMachineReleaseArgs, FlyMachineExecArgs, FlyMachineStateArgs, FlyMachineVerifyArgs, FlyMachineRestoreArgs } from "./activities/machine-release.js";
|
|
38
|
+
import type { FlyReleaseArgs } from "./activities/fly-release-step.js";
|
|
39
|
+
import type { FlyRollbackArgs } from "./activities/fly-rollback-step.js";
|
|
37
40
|
type StepOpts = {
|
|
38
41
|
profile?: ActivityStep["profile"];
|
|
39
42
|
};
|
|
@@ -79,6 +82,19 @@ export declare const spriteServiceStop: (args: WithStepRefs<SpriteServiceStopArg
|
|
|
79
82
|
export declare const spriteServiceDelete: (args: WithStepRefs<SpriteServiceDeleteArgs> & StepOpts) => NamedActivityStep;
|
|
80
83
|
/** Read a background service's log tail (#2711). Defaults to the `fastIdempotent` profile. */
|
|
81
84
|
export declare const spriteServiceLogs: (args: WithStepRefs<SpriteServiceLogsArgs> & StepOpts) => NamedActivityStep;
|
|
85
|
+
/**
|
|
86
|
+
* Observe a box's declared services for a ConvergeOp (#2778): one verdict per
|
|
87
|
+
* service, `in-sync`, `drifted` or `unknown`, from the supervisor's list and
|
|
88
|
+
* each service's health URL. Pass it as `ConvergeOp({ observe })`. Defaults
|
|
89
|
+
* to the `fastIdempotent` profile.
|
|
90
|
+
*/
|
|
91
|
+
export declare const spriteServicesObserve: (args: WithStepRefs<SpriteServicesObserveArgs> & StepOpts) => NamedActivityStep;
|
|
92
|
+
/**
|
|
93
|
+
* Restart one service through its supervisor and wait for its health URL
|
|
94
|
+
* (#2778). Without `name`, the service is the one a ConvergeOp rule
|
|
95
|
+
* dispatched the run for. Defaults to the `longInfra` profile.
|
|
96
|
+
*/
|
|
97
|
+
export declare const spriteServiceRestart: (args: WithStepRefs<SpriteServiceRestartArgs> & StepOpts) => NamedActivityStep;
|
|
82
98
|
/** Create a keep-alive task — the fully typed twin of core's `spriteTaskCreate`. Defaults to the `fastIdempotent` profile. */
|
|
83
99
|
export declare const spriteTaskCreate: (args: WithStepRefs<SpriteTaskCreateArgs> & StepOpts) => NamedActivityStep;
|
|
84
100
|
/** Refresh a keep-alive task's expiry — the fully typed twin of core's `spriteTaskRefresh`. Defaults to the `fastIdempotent` profile. */
|
|
@@ -101,5 +117,21 @@ export declare const flyMachineStop: (args: WithStepRefs<FlyMachineStateArgs> &
|
|
|
101
117
|
export declare const flyMachineVerify: (args: WithStepRefs<FlyMachineVerifyArgs> & StepOpts) => NamedActivityStep;
|
|
102
118
|
/** Put a recorded Machine config back (restore, rollback). Defaults to the `longInfra` profile. */
|
|
103
119
|
export declare const flyMachineRestore: (args: WithStepRefs<FlyMachineRestoreArgs> & StepOpts) => NamedActivityStep;
|
|
120
|
+
/**
|
|
121
|
+
* Ship a release to a Fly Machine from an Op (#2782): the `fly-release`
|
|
122
|
+
* capability's steps (upload and start, each migration once per environment,
|
|
123
|
+
* verify, restore on failure), for the environment `environment` names. With `source`
|
|
124
|
+
* it puts an approved source tree on the Machine. Defaults to the `longInfra`
|
|
125
|
+
* profile.
|
|
126
|
+
*/
|
|
127
|
+
export declare const flyRelease: (args: WithStepRefs<FlyReleaseArgs> & StepOpts) => NamedActivityStep;
|
|
128
|
+
/**
|
|
129
|
+
* Put an earlier release back on a Fly Machine from an Op (#2800): the
|
|
130
|
+
* `fly-rollback` capability's restore of the Machine config recorded for `to`
|
|
131
|
+
* in `environment`, then its verify. With `source` the archive is checked
|
|
132
|
+
* against its digest, and the recorded config against the archive's tree,
|
|
133
|
+
* before the Machine changes. Defaults to the `longInfra` profile.
|
|
134
|
+
*/
|
|
135
|
+
export declare const flyRollback: (args: WithStepRefs<FlyRollbackArgs> & StepOpts) => NamedActivityStep;
|
|
104
136
|
export {};
|
|
105
137
|
//# sourceMappingURL=builders.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../src/op/buil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iBA4D6D,CAAC;AAC9G,8HAA8H;AAC9H,eAAO,MAAM,gBAAgB,2DA9DmB,iBA8DsD,CAAC;AACvG,yIAAyI;AACzI,eAAO,MAAM,iBAAiB,4DAhEkB,iBAgEyD,CAAC;AAC1G,gIAAgI;AAChI,eAAO,MAAM,iBAAiB,4DAlEkB,iBAkEyD,CAAC;AAE1G,0IAA0I;AAC1I,eAAO,MAAM,SAAS,GAAI,OAAM,YAAY,CAAC,aAAa,CAAC,GAAG,QAAa,KAAG,iBACnB,CAAC;AAC5D,6IAA6I;AAC7I,eAAO,MAAM,WAAW,GAAI,OAAM,YAAY,CAAC,eAAe,CAAC,GAAG,QAAa,KAAG,iBACd,CAAC;AAOrE,qIAAqI;AACrI,eAAO,MAAM,iBAAiB,4DAjFkB,iBAiFoD,CAAC;AACrG,2IAA2I;AAC3I,eAAO,MAAM,cAAc,yDAnFqB,iBAmF4C,CAAC;AAC7F,0GAA0G;AAC1G,eAAO,MAAM,iBAAiB,0DArFkB,iBAqFkD,CAAC;AACnG,yEAAyE;AACzE,eAAO,MAAM,cAAc,0DAvFqB,iBAuF4C,CAAC;AAC7F,uHAAuH;AACvH,eAAO,MAAM,gBAAgB,2DAzFmB,iBAyFiD,CAAC;AAClG,mGAAmG;AACnG,eAAO,MAAM,iBAAiB,4DA3FkB,iBA2FoD,CAAC;AACrG;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,qDAnGyB,iBAmG+B,CAAC;AAChF;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,sDA3GwB,iBA2GkC,CAAC"}
|
|
@@ -86,3 +86,70 @@ The step's output carries `uri` and `digest`, so `chant run --components web --e
|
|
|
86
86
|
Each release's Machine config is kept on `chant/lifecycle` at `<env>/fly/<app>/<machine>/<digest>.json`. `fly-rollback` puts back the config of the release the serving one replaced (or the digest given as `to`), checks it, and outputs that digest so the ledger records it again. `fly-release`'s own saga compensation does the same.
|
|
87
87
|
|
|
88
88
|
The steps are also Op activities, for an Op that composes them itself: `flyMachineRelease`, `flyMachineExec`, `flyMachineRestart`, `flyMachineStop`, `flyMachineVerify` and `flyMachineRestore`. Wrap a migration's `flyMachineExec` in `effect()` so it fires once.
|
|
89
|
+
|
|
90
|
+
### A source tree instead of an image
|
|
91
|
+
|
|
92
|
+
An app with no image of its own ships as its files on the declared runtime image. Give `fly-release` a `source` in place of `image`: an archive made by core's `sourceArchive` step (`git archive` of one directory of a commit, the same bytes for the same commit), the sha256 it must have, the directory it holds, where the files go (default `/srv/app`) and the command that starts the app there. The archive is read only once its bytes hash to that digest, before the Machine changes, so the Machine never gets a tree nobody approved. The files go into the Machine's config, up to 1 MiB base64. A larger app needs an image.
|
|
93
|
+
|
|
94
|
+
An Op runs the same steps with the `flyRelease` activity, which takes the environment it ships to as `environment` (`env` stays the Machine's env vars). A release Op gates on the plan core's `releasePlan` writes and records the release with `releaseRecord`:
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
import { Op, phase, gate, build, sourceArchive, releasePlan, releaseRecord } from "@intentius/chant/op";
|
|
98
|
+
import { flyRelease } from "@intentius/chant-lexicon-fly";
|
|
99
|
+
|
|
100
|
+
const archive = sourceArchive("../app", { id: "archive" });
|
|
101
|
+
const plan = releasePlan({ id: "plan", component: "app", env: "fly", gitSha: archive.out.commit, content: { artifact: { digest: archive.out.digest } } });
|
|
102
|
+
|
|
103
|
+
export default Op({
|
|
104
|
+
name: "release",
|
|
105
|
+
overview: "Ship the app member to Fly once its plan is approved",
|
|
106
|
+
phases: [
|
|
107
|
+
phase("Build", [archive, build(".", { script: "build:fly" })]),
|
|
108
|
+
phase("Plan", [plan]),
|
|
109
|
+
phase("Gate", [gate("ship", { plan: plan.out.digest })]),
|
|
110
|
+
phase("Ship", [
|
|
111
|
+
flyRelease({
|
|
112
|
+
environment: "fly",
|
|
113
|
+
plan: "dist/fly.json",
|
|
114
|
+
digest: plan.out.digest,
|
|
115
|
+
gitSha: archive.out.commit,
|
|
116
|
+
source: { archive: archive.out.archive, digest: archive.out.digest, dir: archive.out.dir, start: "node server.js" },
|
|
117
|
+
}),
|
|
118
|
+
]),
|
|
119
|
+
phase("Record", [releaseRecord({ plan: plan.out.file, digest: plan.out.digest, approval: { op: "release", gate: "ship" } })]),
|
|
120
|
+
],
|
|
121
|
+
});
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
The Machine's metadata names the plan's digest, and so does the ledger record, so `chant components status fly --live` reconciles them. Running the Op again for the same commit plans the same digest, leaves the Machine as it is, and records nothing twice.
|
|
125
|
+
|
|
126
|
+
### Rolling a source release back
|
|
127
|
+
|
|
128
|
+
A rollback Op takes the site back to the release it served before the latest one. Core's `releaseRollbackPlan` reads the release ledger, reads the earlier release's plan back, archives the same directory of the same commit again, and refuses unless the archive hashes to the digest that plan recorded. The gate binds to the rollback plan's digest. `flyRollback` puts back the Machine config `flyRelease` recorded for that release. It checks the archive against its digest before any flaps call, and checks that the recorded config carries exactly that tree. `releaseRollbackRecord` appends the restored release with `restores`, the actor and the approver:
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
import { Op, phase, gate, build, releaseRollbackPlan, releaseRollbackRecord } from "@intentius/chant/op";
|
|
132
|
+
import { flyRollback } from "@intentius/chant-lexicon-fly";
|
|
133
|
+
|
|
134
|
+
const plan = releaseRollbackPlan({ id: "plan", component: "app", env: "fly" });
|
|
135
|
+
|
|
136
|
+
export default Op({
|
|
137
|
+
name: "rollback",
|
|
138
|
+
overview: "Put the previous release back on Fly once the rollback plan is approved",
|
|
139
|
+
phases: [
|
|
140
|
+
phase("Plan", [plan, build(".", { script: "build:fly" })]),
|
|
141
|
+
phase("Gate", [gate("rollback", { plan: plan.out.digest })]),
|
|
142
|
+
phase("Roll back", [
|
|
143
|
+
flyRollback({
|
|
144
|
+
environment: "fly",
|
|
145
|
+
plan: "dist/fly.json",
|
|
146
|
+
to: plan.out.to,
|
|
147
|
+
source: { archive: plan.out.archive, digest: plan.out.archiveDigest, dir: plan.out.dir },
|
|
148
|
+
}),
|
|
149
|
+
]),
|
|
150
|
+
phase("Record", [releaseRollbackRecord({ plan: plan.out.file, digest: plan.out.digest, approval: { op: "rollback", gate: "rollback" } })]),
|
|
151
|
+
],
|
|
152
|
+
});
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
A rollback's own ledger record is not counted as a release, so running the Op again plans the same rollback, leaves the Machine as it is and records nothing. `to: "sha256:..."` on `releaseRollbackPlan` picks another release. Migrations are not undone.
|
|
@@ -17,7 +17,7 @@ Each activity is a direct REST call over an injectable HTTP client, imported fro
|
|
|
17
17
|
| Activity | What it does |
|
|
18
18
|
|----------|--------------|
|
|
19
19
|
| `spriteCreate` | Create a sandbox. The caller-chosen `name` becomes the sprite `id` that every later activity keys on |
|
|
20
|
-
| `spriteExec` | Run a command inside the sprite. A non-zero exit throws, so the phase fails and any `onFailure` compensation runs |
|
|
20
|
+
| `spriteExec` | Run a command inside the sprite, with optional `env`, `dir` and `timeoutMs` (#2765). A non-zero exit or a `timeoutMs` overrun throws, so the phase fails and any `onFailure` compensation runs |
|
|
21
21
|
| `spriteCheckpoint` | Snapshot the sprite under a caller-chosen `label` |
|
|
22
22
|
| `spriteRestore` | Rewind the sprite to a labeled checkpoint |
|
|
23
23
|
| `spriteDestroy` | Destroy the sprite (idempotent; an already-gone sprite is a no-op) |
|
|
@@ -106,6 +106,7 @@ The same lexicon ships more Sprite primitives, all imported from `@intentius/cha
|
|
|
106
106
|
| Filesystem (#848) | `spriteWriteFile` / `spriteReadFile` / `spriteListDir` / `spriteRemove` | stage an input file and read a result out without shelling `spriteExec` + `cat` |
|
|
107
107
|
| Config reconcile (#849) | `spriteApplyNetworkPolicy` / `spriteApplyServices` | reconcile a Sprite's egress allowlist and background services against typed config (validated before any HTTP; a whole-object replace for policy, create-or-update by name for services) |
|
|
108
108
|
| Services (#2711) | `spriteServiceCreate` / `spriteServiceGet` / `spriteServiceList` / `spriteServiceStart` / `spriteServiceStop` / `spriteServiceDelete` / `spriteServiceLogs` | the single-service primitives underneath `spriteApplyServices` — create-and-start one long-lived service (a box's door, hud or chud), inspect or list what's running, stop/start or delete one by name, read its log tail |
|
|
109
|
+
| Converge (#2778) | `spriteServicesObserve` / `spriteServiceRestart` | keep a box's declared services running with a `ConvergeOp`: the observer step gives one verdict per service (`in-sync`, `drifted`, `unknown`) from the supervisor and each health URL, and the restart is the step of the Op a rule dispatches for the drifted service. Inside the sprite they call `sprite-env services`; with a sprite `id` they use the API |
|
|
109
110
|
| Sprite URL / delete (#2711) | `spriteUrl` / `spriteDelete` | resolve a Sprite's URL, optionally waiting until a path on it answers; delete the Sprite (`spriteDelete` is `spriteDestroy` under the name spritzer/wisp and the other lexicons' delete activities use — same call, either name) |
|
|
110
111
|
| Keep-alive (#847) | `spriteTaskCreate` / `spriteTaskRefresh` / `spriteTaskRelease` | hold a Sprite active for a session so it will not pause; a session past the 1-hour task cap refreshes on an interval |
|
|
111
112
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant-lexicon-fly",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.93.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"src/",
|
|
@@ -35,6 +35,11 @@
|
|
|
35
35
|
"types": "./dist/op/activities/index.d.ts",
|
|
36
36
|
"default": "./src/op/activities/index.ts"
|
|
37
37
|
},
|
|
38
|
+
"./op/activity-contracts": {
|
|
39
|
+
"development": "./src/op/activity-contracts.ts",
|
|
40
|
+
"types": "./dist/op/activity-contracts.d.ts",
|
|
41
|
+
"default": "./src/op/activity-contracts.ts"
|
|
42
|
+
},
|
|
38
43
|
"./lint/post-synth": {
|
|
39
44
|
"development": "./src/lint/post-synth/index.ts",
|
|
40
45
|
"types": "./dist/lint/post-synth/index.d.ts",
|
|
@@ -60,11 +65,13 @@
|
|
|
60
65
|
"@intentius/chant": "*",
|
|
61
66
|
"@types/ws": "^8.5.12",
|
|
62
67
|
"tsc-alias": "^1.8.17",
|
|
63
|
-
"typescript": "^5.9.3"
|
|
68
|
+
"typescript": "^5.9.3",
|
|
69
|
+
"zod": "^4.3.6"
|
|
64
70
|
},
|
|
65
71
|
"peerDependencies": {
|
|
66
|
-
"@intentius/chant": "^0.
|
|
67
|
-
"typescript": "^5.9.3"
|
|
72
|
+
"@intentius/chant": "^0.93.0",
|
|
73
|
+
"typescript": "^5.9.3",
|
|
74
|
+
"zod": "^4.3.6"
|
|
68
75
|
},
|
|
69
76
|
"description": "Fly.io Machines lexicon for chant — declarative IaC in TypeScript",
|
|
70
77
|
"license": "Apache-2.0",
|