@intentius/chant-lexicon-fly 0.93.0 → 0.95.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/dist/integrity.json +3 -3
- package/dist/manifest.json +1 -1
- package/dist/op/activities/box-services.d.ts +40 -0
- package/dist/op/activities/box-services.d.ts.map +1 -0
- package/dist/op/activities/index.d.ts +5 -3
- package/dist/op/activities/index.d.ts.map +1 -1
- package/dist/op/activities/sprite-config.d.ts +54 -3
- package/dist/op/activities/sprite-config.d.ts.map +1 -1
- package/dist/op/activities/sprite-service-converge.d.ts +24 -1
- package/dist/op/activities/sprite-service-converge.d.ts.map +1 -1
- package/dist/op/activities/sprite-services.d.ts +2 -2
- package/dist/op/activities/sprites.d.ts +1 -1
- package/dist/op/activity-contracts.d.ts +33 -3
- package/dist/op/activity-contracts.d.ts.map +1 -1
- package/dist/op/builders.d.ts +7 -1
- package/dist/op/builders.d.ts.map +1 -1
- package/dist/skills/chant-fly-sprites.md +4 -4
- package/package.json +2 -2
- package/src/op/activities/box-services.ts +78 -0
- package/src/op/activities/index.ts +9 -0
- package/src/op/activities/sprite-box-services.test.ts +318 -0
- package/src/op/activities/sprite-config.ts +214 -4
- package/src/op/activities/sprite-service-converge.ts +31 -3
- package/src/op/activities/sprite-services.ts +2 -2
- package/src/op/activities/sprites.ts +1 -1
- package/src/op/activity-contracts.test.ts +19 -2
- package/src/op/activity-contracts.ts +37 -3
- package/src/op/builders.ts +7 -1
- package/src/skills/chant-fly-sprites.md +4 -4
package/dist/integrity.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"algorithm": "sha256",
|
|
3
3
|
"artifacts": {
|
|
4
|
-
"manifest.json": "
|
|
4
|
+
"manifest.json": "866370edd67e1f81fbaa190701f9694c2c3f29898a1a95663f5d4762d4e3f2d8",
|
|
5
5
|
"meta.json": "273f2a523b66f08ca91642dba2592c44765ab59ddf7329998884a0b08c6c3f24",
|
|
6
6
|
"types/index.d.ts": "63ec7f2eaa8dddd3abb273748c646c4870d99616db53fc04b53edd0588ccf260",
|
|
7
7
|
"rules/guest-sizing.ts": "bc749d218df8f3cc3d8fbe388205ae96e6b204ae0d6d77e8bf82cb936cc53ff6",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"skills/chant-fly.md": "04277509e0abd81869047e66c58a10f4c8eaaa60a56be28bfcbfbe1cce20ad7c",
|
|
14
14
|
"skills/chant-fly-patterns.md": "9452bf83c9e499b36a01a305a4ef28965725426436df115fd7f21e3a773f98da",
|
|
15
15
|
"skills/chant-fly-ops.md": "db5d9c9270c5700bc15951f2f8015360f91d0a18914e286ff7be91b4c2ee450f",
|
|
16
|
-
"skills/chant-fly-sprites.md": "
|
|
16
|
+
"skills/chant-fly-sprites.md": "3d100680422151b58d082c3a7b30a286edfc52faa4887995c9ad5553873bab95"
|
|
17
17
|
},
|
|
18
|
-
"composite": "
|
|
18
|
+
"composite": "909c420ad95750137db05b5b062e66d1617bf3707b671a8e47bf7ffaf8dafe50"
|
|
19
19
|
}
|
package/dist/manifest.json
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A box's declared services (#2880), read for the activities that take
|
|
3
|
+
* `box: true`: `spriteServicesObserve`, `spriteServiceRestart` and
|
|
4
|
+
* `spriteApplyServices`.
|
|
5
|
+
*
|
|
6
|
+
* The list is the `services` of the box block of the workspace member whose
|
|
7
|
+
* directory holds the working directory, read with core's declaration reader
|
|
8
|
+
* (`@intentius/chant/workspace/box-services`), so it is checked the way
|
|
9
|
+
* `chant workspace check` checks it. The module is imported when a step
|
|
10
|
+
* runs, since a core older than the field has no such module.
|
|
11
|
+
*/
|
|
12
|
+
/** One declared service, as the declaration states it (core's `BoxService`, less its pointer). */
|
|
13
|
+
export interface BoxServiceDeclaration {
|
|
14
|
+
name: string;
|
|
15
|
+
/** As written: `${VAR}` references are expanded by {@link expandServiceCommand}. */
|
|
16
|
+
cmd: string;
|
|
17
|
+
needs: string[];
|
|
18
|
+
httpPort: number | null;
|
|
19
|
+
duration: string | null;
|
|
20
|
+
health: string | null;
|
|
21
|
+
optional: boolean;
|
|
22
|
+
}
|
|
23
|
+
/** The box block's services for the member whose directory holds `cwd`, in file order. */
|
|
24
|
+
export declare function boxServices(cwd?: string): Promise<BoxServiceDeclaration[]>;
|
|
25
|
+
/**
|
|
26
|
+
* A service's command with each `${VAR}` replaced from `env`. Throws naming
|
|
27
|
+
* the first variable `env` does not set, so no service is defined with an
|
|
28
|
+
* empty path in it. Pure.
|
|
29
|
+
*/
|
|
30
|
+
export declare function expandServiceCommand(name: string, cmd: string, env?: NodeJS.ProcessEnv): string;
|
|
31
|
+
/**
|
|
32
|
+
* The services in an order each one's `needs` come before it, and in file
|
|
33
|
+
* order otherwise. The list is one the declaration reader accepted, so every
|
|
34
|
+
* `needs` is declared and none forms a cycle. Pure.
|
|
35
|
+
*/
|
|
36
|
+
export declare function inStartOrder<T extends {
|
|
37
|
+
name: string;
|
|
38
|
+
needs: readonly string[];
|
|
39
|
+
}>(services: readonly T[]): T[];
|
|
40
|
+
//# sourceMappingURL=box-services.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"box-services.d.ts","sourceRoot":"","sources":["../../../src/op/activities/box-services.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,kGAAkG;AAClG,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,oFAAoF;IACpF,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,0FAA0F;AAC1F,wBAAsB,WAAW,CAAC,GAAG,SAAgB,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAiBvF;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAM5G;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,EAAE,CAe9G"}
|
|
@@ -19,12 +19,14 @@ export { spriteCreate, spriteExec, spriteCheckpoint, spriteRestore, listCheckpoi
|
|
|
19
19
|
export type { SpritesHttp, SpriteCreateArgs, SpriteCreateResult, SpriteExecArgs, SpriteExecResult, SpriteCheckpointArgs, SpriteCheckpointResult, SpriteRestoreArgs, ListCheckpointsArgs, Checkpoint, SpriteDestroyArgs, SpriteDeleteArgs, SpriteUrlArgs, SpriteUrlResult, } from "./sprites.js";
|
|
20
20
|
export { spriteServiceCreate, spriteServiceGet, spriteServiceList, spriteServiceStart, spriteServiceStop, spriteServiceDelete, spriteServiceLogs, spriteServiceCreateBody, parseServiceLogNdjson, } from "./sprite-services.js";
|
|
21
21
|
export type { SpriteService, SpriteServiceState, SpriteServiceCreateArgs, SpriteServiceGetArgs, SpriteServiceListArgs, SpriteServiceStartArgs, SpriteServiceStopArgs, SpriteServiceDeleteArgs, SpriteServiceLogsArgs, SpriteServiceLogsResult, } from "./sprite-services.js";
|
|
22
|
-
export { spriteServicesObserve, spriteServiceRestart, declaredServices, findSpriteEnv, parseServicesList, probeHealth, } from "./sprite-service-converge.js";
|
|
22
|
+
export { spriteServicesObserve, spriteServiceRestart, declaredServices, resolveDeclaredServices, findSpriteEnv, parseServicesList, probeHealth, } from "./sprite-service-converge.js";
|
|
23
23
|
export type { DeclaredSpriteService, SpriteServicesObserveArgs, SpriteServicesObserveResult, SpriteServiceRestartArgs, SpriteServiceRestartResult, } from "./sprite-service-converge.js";
|
|
24
24
|
export { spriteWriteFile, spriteReadFile, spriteListDir, spriteRemove, spriteFsUrl, defaultSpritesRawHttp, } from "./sprite-fs.js";
|
|
25
25
|
export type { SpritesRawHttp, SpriteWriteFileArgs, SpriteReadFileArgs, SpriteReadFileResult, SpriteListDirArgs, SpriteDirEntry, SpriteRemoveArgs, } from "./sprite-fs.js";
|
|
26
|
-
export { spriteApplyNetworkPolicy, spriteApplyServices, validateNetworkRules, networkRulesEqual, validateServices, serviceConfigEqual, } from "./sprite-config.js";
|
|
27
|
-
export
|
|
26
|
+
export { spriteApplyNetworkPolicy, spriteApplyServices, validateNetworkRules, networkRulesEqual, validateServices, serviceConfigEqual, parseServiceDefinitions, listedServiceDiffers, spriteEnvCreateArgs, } from "./sprite-config.js";
|
|
27
|
+
export { boxServices, expandServiceCommand, inStartOrder } from "./box-services.js";
|
|
28
|
+
export type { BoxServiceDeclaration } from "./box-services.js";
|
|
29
|
+
export type { NetworkRule, SpriteApplyNetworkPolicyArgs, SpriteApplyNetworkPolicyResult, ServiceSpec, SpriteApplyServicesArgs, SpriteApplyServicesResult, ServiceApplyAction, ListedService, } from "./sprite-config.js";
|
|
28
30
|
export { spriteTaskCreate, spriteTaskRefresh, spriteTaskRelease, spriteTasksUrl, spriteTaskUrl, } from "./sprite-tasks.js";
|
|
29
31
|
export type { SpriteTaskCreateArgs, SpriteTaskRefreshArgs, SpriteTaskReleaseArgs, } from "./sprite-tasks.js";
|
|
30
32
|
export { spritesUp, spritesDown, spritesRunCommand, spritesRmCommand, spritesExistsCommand, spritesHealthUrl, spritesEndpoint, } from "./sprites-emulator.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/op/activities/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,QAAQ,EACR,aAAa,EACb,SAAS,EACT,QAAQ,EAC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,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/op/activities/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,QAAQ,EACR,aAAa,EACb,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,SAAS,EACT,YAAY,EACZ,aAAa,EACb,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,eAAe,EACf,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,eAAe,EACf,cAAc,EACd,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAMlH,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3E,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,WAAW,EACX,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EACL,OAAO,EACP,SAAS,EACT,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,aAAa,GACd,MAAM,SAAS,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X,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAMrB,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACjF,YAAY,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC5D,YAAY,EACV,WAAW,EACX,4BAA4B,EAC5B,8BAA8B,EAC9B,WAAW,EACX,uBAAuB,EACvB,yBAAyB,EACzB,kBAAkB,EAClB,aAAa,GACd,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AAMxB,OAAO,EACL,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -15,7 +15,13 @@
|
|
|
15
15
|
* construction); services reconcile is additive + update (create-or-update each
|
|
16
16
|
* desired service, optionally start). Owned-only prune of stale services is out
|
|
17
17
|
* of scope — the documented Services REST surface exposes no delete.
|
|
18
|
+
*
|
|
19
|
+
* `spriteApplyServices` with no `id` runs inside the sprite instead (#2880):
|
|
20
|
+
* it applies the box block's services (`box: true`) through `sprite-env
|
|
21
|
+
* services`, which has no update, so a changed service is deleted and created.
|
|
22
|
+
* It deletes nothing the box block does not declare.
|
|
18
23
|
*/
|
|
24
|
+
import { type BoxServiceDeclaration } from "./box-services.js";
|
|
19
25
|
import { type SpritesHttp } from "./sprites.js";
|
|
20
26
|
/** One outbound rule. Ordered — specificity is positional, so order is significant. */
|
|
21
27
|
export interface NetworkRule {
|
|
@@ -59,18 +65,43 @@ export interface ServiceSpec {
|
|
|
59
65
|
http_port?: number;
|
|
60
66
|
}
|
|
61
67
|
export interface SpriteApplyServicesArgs {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
/**
|
|
68
|
+
/** The sprite, for the Sprites API. Without it, the step runs inside the sprite and applies the box block's services through `sprite-env` (#2880). */
|
|
69
|
+
id?: string;
|
|
70
|
+
/** The services, for the Sprites API. Required with `id`. */
|
|
71
|
+
services?: ServiceSpec[];
|
|
72
|
+
/** Without `id`: apply the services of the box block of the workspace member whose directory holds the working directory (#2880). Required without `id`. */
|
|
73
|
+
box?: boolean;
|
|
74
|
+
/** Without `id`: apply only these declared services, in dependency order. An `optional` service is applied only when named here. */
|
|
75
|
+
only?: string[];
|
|
76
|
+
/**
|
|
77
|
+
* Start services after applying, in dependency order. With `id`, every
|
|
78
|
+
* service; without, every applied one that is not running (a created or
|
|
79
|
+
* replaced one is started by its create). Default: false.
|
|
80
|
+
*/
|
|
65
81
|
start?: boolean;
|
|
82
|
+
/** Without `id`: restart each applied service that was already converged. Default: false. */
|
|
83
|
+
restart?: boolean;
|
|
84
|
+
/** Without `id`: the `sprite-env` binary. Default: the one on PATH, else /.sprite/bin/sprite-env. */
|
|
85
|
+
spriteEnv?: string;
|
|
66
86
|
endpoint?: string;
|
|
67
87
|
token?: string;
|
|
68
88
|
}
|
|
89
|
+
/** What an apply through sprite-env did to one service (#2880). */
|
|
90
|
+
export type ServiceApplyAction = "created" | "replaced" | "restarted" | "started" | "left";
|
|
69
91
|
export interface SpriteApplyServicesResult {
|
|
70
92
|
/** Names that were created or updated (converged services are skipped). */
|
|
71
93
|
applied: string[];
|
|
72
94
|
/** Names that were started (empty unless `start`). */
|
|
73
95
|
started: string[];
|
|
96
|
+
/**
|
|
97
|
+
* Without `id`: each service applied, in the order it was applied, with
|
|
98
|
+
* what the apply did to it (#2880). `left` is a converged service that was
|
|
99
|
+
* not restarted or started.
|
|
100
|
+
*/
|
|
101
|
+
services?: {
|
|
102
|
+
name: string;
|
|
103
|
+
action: ServiceApplyAction;
|
|
104
|
+
}[];
|
|
74
105
|
}
|
|
75
106
|
/**
|
|
76
107
|
* Validate a service set: names are unique, every `needs` target exists, and the
|
|
@@ -88,4 +119,24 @@ export declare function serviceConfigEqual(a: Partial<ServiceSpec>, b: Partial<S
|
|
|
88
119
|
* scope (no delete in the Services REST surface).
|
|
89
120
|
*/
|
|
90
121
|
export declare function spriteApplyServices(args: SpriteApplyServicesArgs, signal?: AbortSignal, http?: SpritesHttp): Promise<SpriteApplyServicesResult>;
|
|
122
|
+
/** A service as `sprite-env services list` reports it. A field the listing does not carry is undefined. */
|
|
123
|
+
export interface ListedService {
|
|
124
|
+
name: string;
|
|
125
|
+
status: string | null;
|
|
126
|
+
cmd?: string;
|
|
127
|
+
needs?: string[];
|
|
128
|
+
httpPort?: number | null;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* `sprite-env services list` with each service's definition. A sprite's
|
|
132
|
+
* sprite-env prints JSON (`[{ name, cmd, args, needs, http_port, state: {
|
|
133
|
+
* status } }]`); the studio kit's stand-in has printed a table of name,
|
|
134
|
+
* state, needs (`-` for none), http port (`-`) and cmd, tab-separated. A
|
|
135
|
+
* table with fewer columns gives the name and state only. Pure.
|
|
136
|
+
*/
|
|
137
|
+
export declare function parseServiceDefinitions(text: string): ListedService[];
|
|
138
|
+
/** Whether a listed service differs from the declared one in `cmd`, `needs` or `httpPort`. A field the listing does not carry is not compared. Pure. */
|
|
139
|
+
export declare function listedServiceDiffers(listed: ListedService, declared: BoxServiceDeclaration, cmd: string): string | null;
|
|
140
|
+
/** The arguments of `sprite-env services create` for a declared service. Pure. */
|
|
141
|
+
export declare function spriteEnvCreateArgs(s: BoxServiceDeclaration, cmd: string): string[];
|
|
91
142
|
//# sourceMappingURL=sprite-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sprite-config.d.ts","sourceRoot":"","sources":["../../../src/op/activities/sprite-config.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sprite-config.d.ts","sourceRoot":"","sources":["../../../src/op/activities/sprite-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,OAAO,EAAmD,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE7G,OAAO,EAA8C,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAczF,uFAAuF;AACvF,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,4BAA4B;IAC3C,EAAE,EAAE,MAAM,CAAC;IACX,2DAA2D;IAC3D,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,8BAA8B;IAC7C,yFAAyF;IACzF,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,IAAI,CAS/D;AAED,gFAAgF;AAChF,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE,CAAC,EAAE,WAAW,EAAE,GAAG,OAAO,CAG7E;AAKD;;;;GAIG;AACH,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,4BAA4B,EAClC,MAAM,CAAC,EAAE,WAAW,EACpB,IAAI,GAAE,WAA4C,G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C3D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,MAAM,EAAE,CA0BlE;AAED,2EAA2E;AAC3E,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,OAAO,CAW5F;AAkBD;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,uBAAuB,EAC7B,MAAM,CAAC,EAAE,WAAW,EACpB,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,yBAAyB,CAAC,CAOpC;AAgDD,2GAA2G;AAC3G,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CAsCrE;AAED,wJAAwJ;AACxJ,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,qBAAqB,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CASvH;AAED,kFAAkF;AAClF,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,qBAAqB,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAYnF"}
|
|
@@ -20,6 +20,11 @@
|
|
|
20
20
|
* sprite and call `sprite-env services` (found on PATH or in /.sprite/bin,
|
|
21
21
|
* or at `spriteEnv`). With an `id`, they go through the Sprites API
|
|
22
22
|
* (`spriteServiceList`, `spriteServiceStop` and `spriteServiceStart`).
|
|
23
|
+
*
|
|
24
|
+
* The declared services come from `services`, from a `servicesFile`, or,
|
|
25
|
+
* with `box: true`, from the `services` of the box block of the workspace
|
|
26
|
+
* member whose directory holds the working directory (#2880), the list
|
|
27
|
+
* `chant workspace status --json` prints as `members[].box.services`.
|
|
23
28
|
*/
|
|
24
29
|
import type { SpritesHttp } from "./sprites.js";
|
|
25
30
|
/** One service a box declares. */
|
|
@@ -43,6 +48,12 @@ export interface SpriteServicesObserveArgs extends Via {
|
|
|
43
48
|
services?: DeclaredSpriteService[];
|
|
44
49
|
/** A JSON file of `{ services: [...] }`, relative to the working directory, read on each tick. */
|
|
45
50
|
servicesFile?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Read the services from the box block of the workspace member whose
|
|
53
|
+
* directory holds the working directory, on each tick (#2880), in place of
|
|
54
|
+
* `services` and `servicesFile`.
|
|
55
|
+
*/
|
|
56
|
+
box?: boolean;
|
|
46
57
|
/** Health probes before a service counts as drifted. Default 3. */
|
|
47
58
|
probes?: number;
|
|
48
59
|
/** Time between probes, ms. Default 1000. */
|
|
@@ -60,10 +71,12 @@ export interface SpriteServicesObserveResult {
|
|
|
60
71
|
export interface SpriteServiceRestartArgs extends Via {
|
|
61
72
|
/** The service. Default: the resource a ConvergeOp dispatched this run for (`CHANT_CONVERGE_RESOURCE`). */
|
|
62
73
|
name?: string;
|
|
63
|
-
/** Its health URL. Default: the one `services` or `
|
|
74
|
+
/** Its health URL. Default: the one `services`, `servicesFile` or the box block (`box: true`) declares for it. */
|
|
64
75
|
health?: string;
|
|
65
76
|
services?: DeclaredSpriteService[];
|
|
66
77
|
servicesFile?: string;
|
|
78
|
+
/** Read the declared services from the box block of the member the step runs in (#2880), in place of `services` and `servicesFile`. */
|
|
79
|
+
box?: boolean;
|
|
67
80
|
/** How long to wait for the health URL after the restart, ms. Default 60000. */
|
|
68
81
|
waitMs?: number;
|
|
69
82
|
}
|
|
@@ -77,6 +90,16 @@ export declare function declaredServices(args: {
|
|
|
77
90
|
services?: DeclaredSpriteService[];
|
|
78
91
|
servicesFile?: string;
|
|
79
92
|
}, cwd?: string): DeclaredSpriteService[];
|
|
93
|
+
/**
|
|
94
|
+
* The declared services: with `box: true`, the box block's (#2880), and
|
|
95
|
+
* otherwise those of {@link declaredServices}. `box` in place of the other
|
|
96
|
+
* two, never beside them.
|
|
97
|
+
*/
|
|
98
|
+
export declare function resolveDeclaredServices(args: {
|
|
99
|
+
services?: DeclaredSpriteService[];
|
|
100
|
+
servicesFile?: string;
|
|
101
|
+
box?: boolean;
|
|
102
|
+
}, cwd?: string): Promise<DeclaredSpriteService[]>;
|
|
80
103
|
/** The sprite-env binary, or null when there is none. */
|
|
81
104
|
export declare function findSpriteEnv(explicit?: string, env?: NodeJS.ProcessEnv): string | null;
|
|
82
105
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sprite-service-converge.d.ts","sourceRoot":"","sources":["../../../src/op/activities/sprite-service-converge.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sprite-service-converge.d.ts","sourceRoot":"","sources":["../../../src/op/activities/sprite-service-converge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAQH,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,MAAM,CAAC;IACZ,uFAAuF;IACvF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,yBAA0B,SAAQ,GAAG;IACpD,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,qBAAqB,EAAE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,CAAC,EAAE,OAAO,CAAA;CAAE,EAClF,GAAG,SAAgB,GAClB,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAIlC;AAED,yDAAyD;AACzD,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"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Sprite Services activities (#2711) — imperative create/get/list/start/stop/
|
|
3
|
-
* delete/logs over a Sprite's background services, the surface a box's door
|
|
4
|
-
*
|
|
3
|
+
* delete/logs over a Sprite's background services, the surface a box's door
|
|
4
|
+
* and hud run as long-lived services through (`sprite-env services`
|
|
5
5
|
* inside the sprite, `/v1/sprites/{id}/services/...` outside). Shared by the
|
|
6
6
|
* Sprites API, wisp (arugula-salad/wisp) and spritzer 0.6.0's container mode
|
|
7
7
|
* (INTENTIUS/spritzer#22).
|
|
@@ -261,7 +261,7 @@ export interface SpriteUrlResult {
|
|
|
261
261
|
* nothing until now exposed it on its own (for a later phase that only has
|
|
262
262
|
* the sprite `id`) or waited on it. `GET /v1/sprites/{id}` for the URL; with
|
|
263
263
|
* `path` set, polls `GET {url}{path}` until `status` (default any 2xx) or
|
|
264
|
-
* `timeoutMs` runs out — the box's door/hud
|
|
264
|
+
* `timeoutMs` runs out — the box's door/hud services take a moment to
|
|
265
265
|
* bind their `http_port` after `spriteServiceStart`.
|
|
266
266
|
*/
|
|
267
267
|
export declare function spriteUrl(args: SpriteUrlArgs, signal?: AbortSignal, http?: SpritesHttp): Promise<SpriteUrlResult>;
|
|
@@ -12,12 +12,14 @@
|
|
|
12
12
|
* needs its return schema; without one, every project declaring such a
|
|
13
13
|
* ConvergeOp failed `chant build` and `chant lint`. `spriteServiceRestart` is
|
|
14
14
|
* the step of the Op such a ConvergeOp's rule runs, and its result is what a
|
|
15
|
-
* later step would read.
|
|
15
|
+
* later step would read. `spriteApplyServices` is covered for its box form
|
|
16
|
+
* (#2880): `box`, `only`, `start` and `restart`, and the per-service actions
|
|
17
|
+
* its result names. The other Sprites activities have no contract yet,
|
|
16
18
|
* which OPS012 skips rather than flags.
|
|
17
19
|
*
|
|
18
20
|
* Each `args` schema mirrors the `*Args` interface in
|
|
19
|
-
* `./activities/sprite-service-converge.ts`
|
|
20
|
-
* `*Result`. Authored with `z.strictObject(...)`, so a misspelled key fails
|
|
21
|
+
* `./activities/sprite-service-converge.ts` or `./activities/sprite-config.ts`
|
|
22
|
+
* and each `returns` schema the `*Result`. Authored with `z.strictObject(...)`, so a misspelled key fails
|
|
21
23
|
* the build instead of vanishing.
|
|
22
24
|
*/
|
|
23
25
|
export declare const spriteServicesObserveContract: import("@intentius/chant/op").ActivityContract<{
|
|
@@ -27,6 +29,7 @@ export declare const spriteServicesObserveContract: import("@intentius/chant/op"
|
|
|
27
29
|
optional?: boolean | undefined;
|
|
28
30
|
}[] | undefined;
|
|
29
31
|
servicesFile?: string | undefined;
|
|
32
|
+
box?: boolean | undefined;
|
|
30
33
|
probes?: number | undefined;
|
|
31
34
|
probeIntervalMs?: number | undefined;
|
|
32
35
|
id?: string | undefined;
|
|
@@ -50,6 +53,7 @@ export declare const spriteServiceRestartContract: import("@intentius/chant/op")
|
|
|
50
53
|
optional?: boolean | undefined;
|
|
51
54
|
}[] | undefined;
|
|
52
55
|
servicesFile?: string | undefined;
|
|
56
|
+
box?: boolean | undefined;
|
|
53
57
|
waitMs?: number | undefined;
|
|
54
58
|
id?: string | undefined;
|
|
55
59
|
spriteEnv?: string | undefined;
|
|
@@ -59,4 +63,30 @@ export declare const spriteServiceRestartContract: import("@intentius/chant/op")
|
|
|
59
63
|
name: string;
|
|
60
64
|
healthy: boolean | null;
|
|
61
65
|
}>;
|
|
66
|
+
export declare const spriteApplyServicesContract: import("@intentius/chant/op").ActivityContract<{
|
|
67
|
+
id?: string | undefined;
|
|
68
|
+
services?: {
|
|
69
|
+
name: string;
|
|
70
|
+
cmd: string;
|
|
71
|
+
args?: string[] | undefined;
|
|
72
|
+
env?: Record<string, string> | undefined;
|
|
73
|
+
dir?: string | undefined;
|
|
74
|
+
needs?: string[] | undefined;
|
|
75
|
+
http_port?: number | undefined;
|
|
76
|
+
}[] | undefined;
|
|
77
|
+
box?: boolean | undefined;
|
|
78
|
+
only?: string[] | undefined;
|
|
79
|
+
start?: boolean | undefined;
|
|
80
|
+
restart?: boolean | undefined;
|
|
81
|
+
spriteEnv?: string | undefined;
|
|
82
|
+
endpoint?: string | undefined;
|
|
83
|
+
token?: string | undefined;
|
|
84
|
+
}, {
|
|
85
|
+
applied: string[];
|
|
86
|
+
started: string[];
|
|
87
|
+
services?: {
|
|
88
|
+
name: string;
|
|
89
|
+
action: "replaced" | "created" | "started" | "restarted" | "left";
|
|
90
|
+
}[] | undefined;
|
|
91
|
+
}>;
|
|
62
92
|
//# sourceMappingURL=activity-contracts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity-contracts.d.ts","sourceRoot":"","sources":["../../src/op/activity-contracts.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"activity-contracts.d.ts","sourceRoot":"","sources":["../../src/op/activity-contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAmBH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;EAczC,CAAC;AAEF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;EAYxC,CAAC;AAYF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;EAkBvC,CAAC"}
|
package/dist/op/builders.d.ts
CHANGED
|
@@ -66,7 +66,13 @@ export declare const spriteListDir: (args: WithStepRefs<SpriteListDirArgs> & Ste
|
|
|
66
66
|
export declare const spriteRemove: (args: WithStepRefs<SpriteRemoveArgs> & StepOpts) => NamedActivityStep;
|
|
67
67
|
/** Reconcile a sprite's outbound network policy — the fully typed twin of core's `spriteApplyNetworkPolicy`. Defaults to the `fastIdempotent` profile. */
|
|
68
68
|
export declare const spriteApplyNetworkPolicy: (args: WithStepRefs<SpriteApplyNetworkPolicyArgs> & StepOpts) => NamedActivityStep;
|
|
69
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* Reconcile a sprite's background services — the fully typed twin of core's
|
|
71
|
+
* `spriteApplyServices`. With an `id`, through the Sprites API; without one,
|
|
72
|
+
* inside the sprite through sprite-env, applying the box block's services
|
|
73
|
+
* (`box: true`, with `only`, `start` and `restart`, #2880). Defaults to the
|
|
74
|
+
* `fastIdempotent` profile.
|
|
75
|
+
*/
|
|
70
76
|
export declare const spriteApplyServices: (args: WithStepRefs<SpriteApplyServicesArgs> & StepOpts) => NamedActivityStep;
|
|
71
77
|
/** Create-and-start one background service (#2711) — the single-service primitive underneath `spriteApplyServices`. Defaults to the `longInfra` profile (the create+start NDJSON round trip). */
|
|
72
78
|
export declare const spriteServiceCreate: (args: WithStepRefs<SpriteServiceCreateArgs> & StepOpts) => NamedActivityStep;
|
|
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,eAAO,MAAM,gBAAgB,2DApEmB,iBAoEsD,CAAC;AACvG,yIAAyI;AACzI,eAAO,MAAM,iBAAiB,4DAtEkB,iBAsEyD,CAAC;AAC1G,gIAAgI;AAChI,eAAO,MAAM,iBAAiB,4DAxEkB,iBAwEyD,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,4DAvFkB,iBAuFoD,CAAC;AACrG,2IAA2I;AAC3I,eAAO,MAAM,cAAc,yDAzFqB,iBAyF4C,CAAC;AAC7F,0GAA0G;AAC1G,eAAO,MAAM,iBAAiB,0DA3FkB,iBA2FkD,CAAC;AACnG,yEAAyE;AACzE,eAAO,MAAM,cAAc,0DA7FqB,iBA6F4C,CAAC;AAC7F,uHAAuH;AACvH,eAAO,MAAM,gBAAgB,2DA/FmB,iBA+FiD,CAAC;AAClG,mGAAmG;AACnG,eAAO,MAAM,iBAAiB,4DAjGkB,iBAiGoD,CAAC;AACrG;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,qDAzGyB,iBAyG+B,CAAC;AAChF;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,sDAjHwB,iBAiHkC,CAAC"}
|
|
@@ -104,13 +104,13 @@ The same lexicon ships more Sprite primitives, all imported from `@intentius/cha
|
|
|
104
104
|
| Family | Activities | Use |
|
|
105
105
|
|--------|-----------|-----|
|
|
106
106
|
| Filesystem (#848) | `spriteWriteFile` / `spriteReadFile` / `spriteListDir` / `spriteRemove` | stage an input file and read a result out without shelling `spriteExec` + `cat` |
|
|
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
|
-
| 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
|
|
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 |
|
|
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). Without an `id`, `spriteApplyServices({ box: true })` runs inside the sprite and applies the box block's `services` through `sprite-env services` (#2880): it creates the missing ones and deletes and creates the changed ones, in dependency order, with `only`, `start` and `restart` |
|
|
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 or hud), 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. The services come from `services`, a `servicesFile`, or with `box: true` the box block's `services` in `chant.workspace.json` (#2880) |
|
|
110
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) |
|
|
111
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 |
|
|
112
112
|
|
|
113
|
-
These are still runtime-orchestration primitives, not declarable resources — a Sprite has no desired-state create body to reconcile. Services created directly with `spriteServiceCreate` are what a box's `spritzer` preset provisions door/hud
|
|
113
|
+
These are still runtime-orchestration primitives, not declarable resources — a Sprite has no desired-state create body to reconcile. Services created directly with `spriteServiceCreate` are what a box's `spritzer` preset provisions door/hud on (arugula-salad/studio#27) — the same wire surface as `sprite-env services` inside the sprite, spritzer 0.6.0's container mode, and wisp.
|
|
114
114
|
|
|
115
115
|
## Where it fits
|
|
116
116
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant-lexicon-fly",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.95.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"src/",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"zod": "^4.3.6"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@intentius/chant": "^0.
|
|
72
|
+
"@intentius/chant": "^0.95.0",
|
|
73
73
|
"typescript": "^5.9.3",
|
|
74
74
|
"zod": "^4.3.6"
|
|
75
75
|
},
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A box's declared services (#2880), read for the activities that take
|
|
3
|
+
* `box: true`: `spriteServicesObserve`, `spriteServiceRestart` and
|
|
4
|
+
* `spriteApplyServices`.
|
|
5
|
+
*
|
|
6
|
+
* The list is the `services` of the box block of the workspace member whose
|
|
7
|
+
* directory holds the working directory, read with core's declaration reader
|
|
8
|
+
* (`@intentius/chant/workspace/box-services`), so it is checked the way
|
|
9
|
+
* `chant workspace check` checks it. The module is imported when a step
|
|
10
|
+
* runs, since a core older than the field has no such module.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** One declared service, as the declaration states it (core's `BoxService`, less its pointer). */
|
|
14
|
+
export interface BoxServiceDeclaration {
|
|
15
|
+
name: string;
|
|
16
|
+
/** As written: `${VAR}` references are expanded by {@link expandServiceCommand}. */
|
|
17
|
+
cmd: string;
|
|
18
|
+
needs: string[];
|
|
19
|
+
httpPort: number | null;
|
|
20
|
+
duration: string | null;
|
|
21
|
+
health: string | null;
|
|
22
|
+
optional: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The box block's services for the member whose directory holds `cwd`, in file order. */
|
|
26
|
+
export async function boxServices(cwd = process.cwd()): Promise<BoxServiceDeclaration[]> {
|
|
27
|
+
let mod: typeof import("@intentius/chant/workspace/box-services");
|
|
28
|
+
try {
|
|
29
|
+
mod = await import("@intentius/chant/workspace/box-services");
|
|
30
|
+
} catch (err) {
|
|
31
|
+
const why = err instanceof Error ? err.message.split("\n")[0] : String(err);
|
|
32
|
+
throw new Error(`box: true reads the box block through @intentius/chant 0.95.0 or newer, and the chant installed here has no workspace/box-services module (${why})`);
|
|
33
|
+
}
|
|
34
|
+
return mod.readBoxServices(cwd).services.map((s) => ({
|
|
35
|
+
name: s.name,
|
|
36
|
+
cmd: s.cmd,
|
|
37
|
+
needs: [...s.needs],
|
|
38
|
+
httpPort: s.httpPort,
|
|
39
|
+
duration: s.duration,
|
|
40
|
+
health: s.health,
|
|
41
|
+
optional: s.optional,
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* A service's command with each `${VAR}` replaced from `env`. Throws naming
|
|
47
|
+
* the first variable `env` does not set, so no service is defined with an
|
|
48
|
+
* empty path in it. Pure.
|
|
49
|
+
*/
|
|
50
|
+
export function expandServiceCommand(name: string, cmd: string, env: NodeJS.ProcessEnv = process.env): string {
|
|
51
|
+
return cmd.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_, v: string) => {
|
|
52
|
+
const value = env[v];
|
|
53
|
+
if (value === undefined) throw new Error(`service ${name}'s cmd names \${${v}}, which is not set in this process's environment`);
|
|
54
|
+
return value;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The services in an order each one's `needs` come before it, and in file
|
|
60
|
+
* order otherwise. The list is one the declaration reader accepted, so every
|
|
61
|
+
* `needs` is declared and none forms a cycle. Pure.
|
|
62
|
+
*/
|
|
63
|
+
export function inStartOrder<T extends { name: string; needs: readonly string[] }>(services: readonly T[]): T[] {
|
|
64
|
+
const byName = new Map(services.map((s) => [s.name, s]));
|
|
65
|
+
const done = new Set<string>();
|
|
66
|
+
const out: T[] = [];
|
|
67
|
+
const visit = (s: T) => {
|
|
68
|
+
if (done.has(s.name)) return;
|
|
69
|
+
done.add(s.name);
|
|
70
|
+
for (const n of s.needs) {
|
|
71
|
+
const dep = byName.get(n);
|
|
72
|
+
if (dep) visit(dep);
|
|
73
|
+
}
|
|
74
|
+
out.push(s);
|
|
75
|
+
};
|
|
76
|
+
for (const s of services) visit(s);
|
|
77
|
+
return out;
|
|
78
|
+
}
|
|
@@ -156,6 +156,7 @@ export {
|
|
|
156
156
|
spriteServicesObserve,
|
|
157
157
|
spriteServiceRestart,
|
|
158
158
|
declaredServices,
|
|
159
|
+
resolveDeclaredServices,
|
|
159
160
|
findSpriteEnv,
|
|
160
161
|
parseServicesList,
|
|
161
162
|
probeHealth,
|
|
@@ -199,7 +200,13 @@ export {
|
|
|
199
200
|
networkRulesEqual,
|
|
200
201
|
validateServices,
|
|
201
202
|
serviceConfigEqual,
|
|
203
|
+
parseServiceDefinitions,
|
|
204
|
+
listedServiceDiffers,
|
|
205
|
+
spriteEnvCreateArgs,
|
|
202
206
|
} from "./sprite-config";
|
|
207
|
+
// A box's declared services (#2880), read from its box block with `box: true`.
|
|
208
|
+
export { boxServices, expandServiceCommand, inStartOrder } from "./box-services";
|
|
209
|
+
export type { BoxServiceDeclaration } from "./box-services";
|
|
203
210
|
export type {
|
|
204
211
|
NetworkRule,
|
|
205
212
|
SpriteApplyNetworkPolicyArgs,
|
|
@@ -207,6 +214,8 @@ export type {
|
|
|
207
214
|
ServiceSpec,
|
|
208
215
|
SpriteApplyServicesArgs,
|
|
209
216
|
SpriteApplyServicesResult,
|
|
217
|
+
ServiceApplyAction,
|
|
218
|
+
ListedService,
|
|
210
219
|
} from "./sprite-config";
|
|
211
220
|
|
|
212
221
|
// Sprite keep-alive Tasks activities (#847) — a hold that stops a Sprite pausing
|