@groundnuty/macf-core 0.2.58 → 0.2.60
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/fleet-driver.d.ts +39 -8
- package/dist/fleet-driver.d.ts.map +1 -1
- package/dist/fleet-driver.js.map +1 -1
- package/dist/fleet-upgrade.d.ts +127 -21
- package/dist/fleet-upgrade.d.ts.map +1 -1
- package/dist/fleet-upgrade.js +124 -14
- package/dist/fleet-upgrade.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/prompt-responses.d.ts +57 -5
- package/dist/prompt-responses.d.ts.map +1 -1
- package/dist/prompt-responses.js +64 -5
- package/dist/prompt-responses.js.map +1 -1
- package/dist/proxy-fetch.d.ts +89 -0
- package/dist/proxy-fetch.d.ts.map +1 -0
- package/dist/proxy-fetch.js +186 -0
- package/dist/proxy-fetch.js.map +1 -0
- package/dist/registry/github-client.d.ts.map +1 -1
- package/dist/registry/github-client.js +26 -3
- package/dist/registry/github-client.js.map +1 -1
- package/dist/registry/local-client.d.ts +1 -0
- package/dist/registry/local-client.d.ts.map +1 -1
- package/dist/registry/types.d.ts +10 -0
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/registry/types.js +29 -0
- package/dist/registry/types.js.map +1 -1
- package/dist/verify-green.d.ts +19 -0
- package/dist/verify-green.d.ts.map +1 -1
- package/dist/verify-green.js +15 -0
- package/dist/verify-green.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MacfError } from '../errors.js';
|
|
2
|
+
import { proxyAwareFetch } from '../proxy-fetch.js';
|
|
2
3
|
export class GitHubApiError extends MacfError {
|
|
3
4
|
status;
|
|
4
5
|
constructor(status, message) {
|
|
@@ -29,14 +30,36 @@ function headers(token) {
|
|
|
29
30
|
* existing status-comparisons (e.g. macf-channel-server's
|
|
30
31
|
* refresh-aware-client checking `err.status === 401`) safely fall through
|
|
31
32
|
* instead of misreading a network outage as an auth failure.
|
|
33
|
+
*
|
|
34
|
+
* WHY proxyAwareFetch, not the bare global fetch (macf#1144): Node's fetch
|
|
35
|
+
* does not honor HTTP_PROXY/HTTPS_PROXY, unlike `gh` — an operator behind
|
|
36
|
+
* a forward proxy saw every `gh` call succeed while this exact function's
|
|
37
|
+
* fetch failed, which made the failure look host-specific rather than
|
|
38
|
+
* proxy-specific. See proxy-fetch.ts's module doc for the full story.
|
|
39
|
+
*
|
|
40
|
+
* WHY `err.cause` rather than `err.message` for the diagnostic text
|
|
41
|
+
* (macf#1144): undici's `TypeError: fetch failed` message is always the
|
|
42
|
+
* literal string "fetch failed" — worthless on its own. The actual reason
|
|
43
|
+
* (DNS failure, connection refused, timeout, proxy auth failure, ...) is
|
|
44
|
+
* nested in `err.cause` as a Node system-error-ish object with `.code`
|
|
45
|
+
* (e.g. `EAI_AGAIN`, `ENETUNREACH`, `ECONNREFUSED`). Surfacing that code
|
|
46
|
+
* verbatim, rather than wrapping it in an asserted diagnosis like "network
|
|
47
|
+
* error", lets the caller (or the human reading the message) tell "no
|
|
48
|
+
* route at all" apart from "route exists but proxy wasn't honored" apart
|
|
49
|
+
* from "a real remote outage" — this function cannot itself distinguish
|
|
50
|
+
* those, so it must not claim to.
|
|
32
51
|
*/
|
|
33
52
|
async function fetchOrThrow(url, init, operation) {
|
|
34
53
|
try {
|
|
35
|
-
return await
|
|
54
|
+
return await proxyAwareFetch(url, init);
|
|
36
55
|
}
|
|
37
56
|
catch (err) {
|
|
38
|
-
const
|
|
39
|
-
|
|
57
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
58
|
+
const cause = error.cause;
|
|
59
|
+
const causeCode = typeof cause?.code === 'string' ? cause.code : undefined;
|
|
60
|
+
const causeMessage = typeof cause?.message === 'string' ? cause.message : undefined;
|
|
61
|
+
const detail = causeCode ?? causeMessage ?? error.message;
|
|
62
|
+
throw new GitHubApiError(0, `unreachable — could not ${operation}: ${detail}`);
|
|
40
63
|
}
|
|
41
64
|
}
|
|
42
65
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-client.js","sourceRoot":"","sources":["../../src/registry/github-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"github-client.js","sourceRoot":"","sources":["../../src/registry/github-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,OAAO,cAAe,SAAQ,SAAS;IAClC,MAAM,CAAS;IAExB,YAAY,MAAc,EAAE,OAAe;QACzC,KAAK,CAAC,kBAAkB,EAAE,cAAc,MAAM,KAAK,OAAO,EAAE,CAAC,CAAC;QAC9D,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED,MAAM,QAAQ,GAAG,wBAAwB,CAAC;AAE1C,SAAS,OAAO,CAAC,KAAa;IAC5B,OAAO;QACL,QAAQ,EAAE,6BAA6B;QACvC,eAAe,EAAE,UAAU,KAAK,EAAE;QAClC,sBAAsB,EAAE,YAAY;KACrC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,KAAK,UAAU,YAAY,CACzB,GAAW,EACX,IAAiB,EACjB,SAAiB;IAEjB,IAAI,CAAC;QACH,OAAO,MAAM,eAAe,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,KAAK,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACl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O,CAAC,KAAK,CAAC;aACxB,EAAE,mBAAmB,IAAI,EAAE,CAAC,CAAC;YAE9B,8CAA8C;YAC9C,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;gBAAE,OAAO;YAErD,MAAM,IAAI,cAAc,CACtB,GAAG,CAAC,MAAM,EACV,6BAA6B,IAAI,KAAK,MAAM,GAAG,CAAC,IAAI,EAAE,EAAE,CACzD,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -36,6 +36,7 @@ export declare const RegistryFileSchema: z.ZodObject<{
|
|
|
36
36
|
instance_id: z.ZodString;
|
|
37
37
|
started: z.ZodString;
|
|
38
38
|
last_heartbeat: z.ZodOptional<z.ZodString>;
|
|
39
|
+
agent_name: z.ZodOptional<z.ZodString>;
|
|
39
40
|
}, z.core.$strip>>;
|
|
40
41
|
}, z.core.$strip>;
|
|
41
42
|
export type RegistryFile = z.infer<typeof RegistryFileSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-client.d.ts","sourceRoot":"","sources":["../../src/registry/local-client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAa,QAAQ,EAAqD,MAAM,YAAY,CAAC;AAEzG;;;;;;;;;;;;;;GAcG;AAEH,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"local-client.d.ts","sourceRoot":"","sources":["../../src/registry/local-client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAa,QAAQ,EAAqD,MAAM,YAAY,CAAC;AAEzG;;;;;;;;;;;;;;GAcG;AAEH,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;iBAI7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,qBAAa,kBAAmB,SAAQ,SAAS;gBACnC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAI1C;AAuLD,MAAM,WAAW,oBAAoB;IACnC,+CAA+C;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AA6CD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,oBAAoB,GAC5B,QAAQ,CAqMV"}
|
package/dist/registry/types.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare const AgentInfoSchema: z.ZodObject<{
|
|
|
9
9
|
instance_id: z.ZodString;
|
|
10
10
|
started: z.ZodString;
|
|
11
11
|
last_heartbeat: z.ZodOptional<z.ZodString>;
|
|
12
|
+
agent_name: z.ZodOptional<z.ZodString>;
|
|
12
13
|
}, z.core.$strip>;
|
|
13
14
|
export type AgentInfo = z.infer<typeof AgentInfoSchema>;
|
|
14
15
|
/**
|
|
@@ -22,6 +23,15 @@ export type AgentInfo = z.infer<typeof AgentInfoSchema>;
|
|
|
22
23
|
* CAS if a heartbeat from the prior instance landed in the collision-check →
|
|
23
24
|
* register-write window (a re-stamp must not block a legitimate #424 version-
|
|
24
25
|
* takeover). The five identity fields below fully determine slot ownership.
|
|
26
|
+
*
|
|
27
|
+
* `agent_name` is ALSO excluded (groundnuty/macf#1393) — it is descriptive
|
|
28
|
+
* metadata (the OTEL wire name), not identity; the registry KEY + these five
|
|
29
|
+
* fields already fully determine slot ownership, and `agent_name` is constant
|
|
30
|
+
* for a given instance's whole lifetime, so excluding it from the CAS is
|
|
31
|
+
* purely a "don't widen the identity surface" choice, not a functional need
|
|
32
|
+
* the way `last_heartbeat`'s exclusion is. It also keeps a pre-existing entry
|
|
33
|
+
* (written before this field existed, so `agent_name` is absent) comparing
|
|
34
|
+
* correctly against a freshly composed one that carries it.
|
|
25
35
|
*/
|
|
26
36
|
export declare function agentInfoEquals(a: AgentInfo | null, b: AgentInfo | null): boolean;
|
|
27
37
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,eAAe;;;;;;;;;;;iBAqC1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,SAAS,GAAG,IAAI,EAAE,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,OAAO,CASjF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,eAAe,CAAC;IAC7C,QAAQ,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,MAAM,E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C/G,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAClD;AAID,eAAO,MAAM,uBAAuB;;;iBAGlC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;iBAGtC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;iBAInC,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB;;;iBAGpC,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;mBAK/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAIlE,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACvE,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAChE,QAAQ,CAAC,aAAa,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;IACxG,QAAQ,CAAC,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1D"}
|
package/dist/registry/types.js
CHANGED
|
@@ -17,6 +17,26 @@ export const AgentInfoSchema = z.object({
|
|
|
17
17
|
* graceful-deregister (#586) shutdown handler never runs for.
|
|
18
18
|
*/
|
|
19
19
|
last_heartbeat: z.string().optional(),
|
|
20
|
+
/**
|
|
21
|
+
* The agent's OTEL wire identity — `MACF_AGENT_NAME`, written at
|
|
22
|
+
* registration (groundnuty/macf#1393, `groundnuty/macf-devops-toolkit#203`).
|
|
23
|
+
* ADDITIVE-OPTIONAL: the registry KEY is (and stays) `routing_label`
|
|
24
|
+
* (`MACF_ROUTING_LABEL`, defaulting to `agent_name` when unset — see
|
|
25
|
+
* `config.ts`), so this field records a SECOND name, not a replacement.
|
|
26
|
+
* The two are allowed to differ by design (`coordination.md` §tmux launch
|
|
27
|
+
* — e.g. science: `agent_name=macf-science-agent`,
|
|
28
|
+
* `routing_label=science-agent`) and OTEL's `gen_ai.agent.name` carries
|
|
29
|
+
* `agent_name`, not the routing label.
|
|
30
|
+
*
|
|
31
|
+
* A reader MUST treat an ABSENT `agent_name` as unknown — NEVER default it
|
|
32
|
+
* to `routing_label`. Doing so would silently reintroduce the exact "I
|
|
33
|
+
* can't tell a real name from a guess" ambiguity this field exists to
|
|
34
|
+
* remove: entries written before this field existed (and any future
|
|
35
|
+
* channel-server predating it) parse fine without it, and defaulting the
|
|
36
|
+
* absence would make every pre-existing entry look like a coincidentally
|
|
37
|
+
* name-matching agent instead of an honestly-unknown one.
|
|
38
|
+
*/
|
|
39
|
+
agent_name: z.string().optional(),
|
|
20
40
|
});
|
|
21
41
|
/**
|
|
22
42
|
* Value equality for two `AgentInfo`s (or absence). `null` represents an
|
|
@@ -29,6 +49,15 @@ export const AgentInfoSchema = z.object({
|
|
|
29
49
|
* CAS if a heartbeat from the prior instance landed in the collision-check →
|
|
30
50
|
* register-write window (a re-stamp must not block a legitimate #424 version-
|
|
31
51
|
* takeover). The five identity fields below fully determine slot ownership.
|
|
52
|
+
*
|
|
53
|
+
* `agent_name` is ALSO excluded (groundnuty/macf#1393) — it is descriptive
|
|
54
|
+
* metadata (the OTEL wire name), not identity; the registry KEY + these five
|
|
55
|
+
* fields already fully determine slot ownership, and `agent_name` is constant
|
|
56
|
+
* for a given instance's whole lifetime, so excluding it from the CAS is
|
|
57
|
+
* purely a "don't widen the identity surface" choice, not a functional need
|
|
58
|
+
* the way `last_heartbeat`'s exclusion is. It also keeps a pre-existing entry
|
|
59
|
+
* (written before this field existed, so `agent_name` is absent) comparing
|
|
60
|
+
* correctly against a freshly composed one that carries it.
|
|
32
61
|
*/
|
|
33
62
|
export function agentInfoEquals(a, b) {
|
|
34
63
|
if (a === null || b === null)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,4DAA4D;AAE5D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACjC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IACrC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB;;;;;;;;;OASG;IACH,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,4DAA4D;AAE5D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACjC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IACrC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB;;;;;;;;;OASG;IACH,cAAc,EAAE,CAAC,C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AAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACxB,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACxB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACxB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC;IAC1C,uBAAuB;IACvB,2BAA2B;IAC3B,wBAAwB;IACxB,yBAAyB;CAC1B,CAAC,CAAC"}
|
package/dist/verify-green.d.ts
CHANGED
|
@@ -40,6 +40,24 @@ export interface VerifyGreenDeps {
|
|
|
40
40
|
* that never converges (bad pin / stuck old process).
|
|
41
41
|
* - `ok: false` + `reason: 'unreachable'` — the agent was NEVER reachable within
|
|
42
42
|
* the budget (every probe returned `null`). The dead / never-relaunched case.
|
|
43
|
+
*
|
|
44
|
+
* `lastInstanceId` (NEW, follow-up to macf#899) DELIBERATELY does NOT mirror
|
|
45
|
+
* `lastVersion`'s "last-ever-seen, latched forever" semantics — it is the
|
|
46
|
+
* instance_id from the MOST RECENT probe ONLY, cleared to `undefined` the
|
|
47
|
+
* moment any later probe comes back unreachable. A caller uses this to prove
|
|
48
|
+
* the SAME pre-restart process is STILL CURRENTLY answering `/health` (DR-037
|
|
49
|
+
* Decision 5 mints a fresh `instance_id` on every relaunch, so an unchanged
|
|
50
|
+
* one is positive proof the relaunch hasn't taken over serving yet) — that
|
|
51
|
+
* claim requires CONTINUOUS reachability, not merely "reachable at some point
|
|
52
|
+
* during the budget." Latching it like `lastVersion` would let a genuinely
|
|
53
|
+
* bad release hide: old process answers once, dies; a FRESH crash-looping
|
|
54
|
+
* process then answers nothing for the rest of the budget; a latched
|
|
55
|
+
* `lastInstanceId` would still equal the pre-restart id and a caller would
|
|
56
|
+
* misread "the old process is still there" when it is actually gone and
|
|
57
|
+
* replaced by something broken. Also `undefined` (never coerced to `null`)
|
|
58
|
+
* when a reachable probe never carried the field at all (older
|
|
59
|
+
* channel-server release), so a caller never mistakes "we don't have this
|
|
60
|
+
* data" for "confirmed unchanged."
|
|
43
61
|
*/
|
|
44
62
|
export type VerifyGreenResult = {
|
|
45
63
|
readonly ok: true;
|
|
@@ -48,6 +66,7 @@ export type VerifyGreenResult = {
|
|
|
48
66
|
readonly ok: false;
|
|
49
67
|
readonly reason: 'wrong-version' | 'unreachable';
|
|
50
68
|
readonly lastVersion: string | null;
|
|
69
|
+
readonly lastInstanceId?: string | null;
|
|
51
70
|
};
|
|
52
71
|
/**
|
|
53
72
|
* Poll `deps.probe(agent)` until the agent self-reports `targetVersion`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-green.d.ts","sourceRoot":"","sources":["../src/verify-green.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,2DAA2D;AAC3D,eAAO,MAAM,gCAAgC,OAAO,CAAC;AAErD,+BAA+B;AAC/B,MAAM,WAAW,kBAAkB;IACjC,wEAAwE;IACxE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,qEAAqE;IACrE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,oDAAoD;IACpD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,uFAAuF;IACvF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAClE,uEAAuE;IACvE,QAAQ,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,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MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC,CAAC;AAEN;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,kBAAkB,EACxB,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,iBAAiB,CAAC,CAuC5B"}
|
package/dist/verify-green.js
CHANGED
|
@@ -31,20 +31,35 @@ export async function verifyGreen(opts, deps) {
|
|
|
31
31
|
const start = deps.now();
|
|
32
32
|
let reachedOnce = false;
|
|
33
33
|
let lastVersion = null;
|
|
34
|
+
// NEW (follow-up to macf#899) — CLEARED on every unreachable probe (the
|
|
35
|
+
// `else` branch below), unlike `lastVersion` above which intentionally
|
|
36
|
+
// latches. See the type doc for why: this field's whole job is proving
|
|
37
|
+
// CONTINUOUS identity, not "reachable at some point."
|
|
38
|
+
let lastInstanceId;
|
|
34
39
|
for (;;) {
|
|
35
40
|
const health = await deps.probe(opts.agent);
|
|
36
41
|
if (health) {
|
|
37
42
|
reachedOnce = true;
|
|
38
43
|
lastVersion = health.version ?? null;
|
|
44
|
+
lastInstanceId = health.instance_id;
|
|
39
45
|
if (lastVersion !== null && compareSemver(lastVersion, opts.targetVersion) === 0) {
|
|
40
46
|
return { ok: true, version: lastVersion };
|
|
41
47
|
}
|
|
42
48
|
}
|
|
49
|
+
else {
|
|
50
|
+
// Unreachable THIS probe — whatever instance answered earlier is no
|
|
51
|
+
// longer provably still there. `lastVersion` deliberately keeps its
|
|
52
|
+
// stale value (documented "last version seen" contract, unchanged);
|
|
53
|
+
// `lastInstanceId` must NOT, or a died-then-replaced process would
|
|
54
|
+
// wrongly read as "the same old process is still live."
|
|
55
|
+
lastInstanceId = undefined;
|
|
56
|
+
}
|
|
43
57
|
if (deps.now() - start >= opts.timeoutMs) {
|
|
44
58
|
return {
|
|
45
59
|
ok: false,
|
|
46
60
|
reason: reachedOnce ? 'wrong-version' : 'unreachable',
|
|
47
61
|
lastVersion,
|
|
62
|
+
lastInstanceId,
|
|
48
63
|
};
|
|
49
64
|
}
|
|
50
65
|
await deps.sleep(intervalMs);
|
package/dist/verify-green.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-green.js","sourceRoot":"","sources":["../src/verify-green.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,2DAA2D;AAC3D,MAAM,CAAC,MAAM,gCAAgC,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"verify-green.js","sourceRoot":"","sources":["../src/verify-green.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,2DAA2D;AAC3D,MAAM,CAAC,MAAM,gCAAgC,GAAG,IAAI,CAAC;AAuErD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,IAAwB,EACxB,IAAqB;IAErB,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,gCAAgC,CAAC;IACvE,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACzB,IAAI,WAAW,GAAG,KAAK,CAAC;IACxB,IAAI,WAAW,GAAkB,IAAI,CAAC;IACtC,wEAAwE;IACxE,uEAAuE;IACvE,uEAAuE;IACvE,sDAAsD;IACtD,IAAI,cAAyC,CAAC;IAE9C,SAAS,CAAC;QACR,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5C,IAAI,MAAM,EAAE,CAAC;YACX,WAAW,GAAG,IAAI,CAAC;YACnB,WAAW,GAAG,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC;YACrC,cAAc,GAAG,MAAM,CAAC,WAAW,CAAC;YACpC,IAAI,WAAW,KAAK,IAAI,IAAI,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;gBACjF,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;YAC5C,CAAC;QACH,CAAC;aAAM,CAAC;YACN,oEAAoE;YACpE,oEAAoE;YACpE,oEAAoE;YACpE,mEAAmE;YACnE,wDAAwD;YACxD,cAAc,GAAG,SAAS,CAAC;QAC7B,CAAC;QAED,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACzC,OAAO;gBACL,EAAE,EAAE,KAAK;gBACT,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,aAAa;gBACrD,WAAW;gBACX,cAAc;aACf,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAC/B,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@groundnuty/macf-core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.60",
|
|
4
4
|
"description": "Shared internals consumed by the MACF CLI and channel-server packages. Not intended for direct external use — will be marked deprecated-internal on first npm publish per DR-022 Amendment A.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"@peculiar/x509": "^2.0.0",
|
|
34
34
|
"proper-lockfile": "^4.1.2",
|
|
35
35
|
"reflect-metadata": "^0.2.2",
|
|
36
|
+
"undici": "^7.29.0",
|
|
36
37
|
"zod": "^4.0.0"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|