@jini-ai/platform 0.7.3-next.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/download-lock.d.ts +1 -1
- package/dist/download-lock.js +0 -2
- package/dist/fetch-with-timeout.js +6 -7
- package/dist/mail/email-template.js +3 -7
- package/dist/mail/purpose-gate-probe.js +2 -2
- package/dist/mail/purpose-scoped-mailer.d.ts +4 -0
- package/dist/mail/purpose-scoped-mailer.js +4 -3
- package/dist/mail/test-send.js +8 -11
- package/dist/process-top-footprint.js +1 -3
- package/dist/retention/preview-store.d.ts +3 -1
- package/dist/retention/preview-store.js +2 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## 0.7.4
|
|
2
|
+
|
|
3
|
+
### Changes
|
|
4
|
+
|
|
5
|
+
- Add shared mailer resolution, sealer failure contracts, credential storage, and tool catalogs behind injected host ports.
|
|
6
|
+
- Always report the effective mail provider, clean up root-key temporary files on failure, and preserve literal dollar text in refusal messages.
|
|
7
|
+
|
|
1
8
|
## 0.7.2
|
|
2
9
|
|
|
3
10
|
### Patch Changes
|
package/dist/download-lock.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type NormalizedTarget, type AcquiredLock } from './download-types.js';
|
|
2
2
|
export declare function acquireLock(target: NormalizedTarget): Promise<AcquiredLock>;
|
|
3
3
|
export declare function releaseLock({ lock }: {
|
|
4
|
-
lock: AcquiredLock
|
|
4
|
+
lock: AcquiredLock;
|
|
5
5
|
}, _optional?: Record<string, never>): Promise<void>;
|
|
6
6
|
//# sourceMappingURL=download-lock.d.ts.map
|
package/dist/download-lock.js
CHANGED
|
@@ -75,8 +75,6 @@ async function clearStaleLock(target) {
|
|
|
75
75
|
return true;
|
|
76
76
|
}
|
|
77
77
|
export async function releaseLock({ lock }, _optional = {}) {
|
|
78
|
-
if (lock == null)
|
|
79
|
-
return;
|
|
80
78
|
await rm(lock.path, { force: true }).catch(() => undefined);
|
|
81
79
|
}
|
|
82
80
|
//# sourceMappingURL=download-lock.js.map
|
|
@@ -204,15 +204,14 @@ async function readResponseChunk({ reader, signal }) {
|
|
|
204
204
|
if (!signal)
|
|
205
205
|
return reader.read();
|
|
206
206
|
signal.throwIfAborted();
|
|
207
|
-
|
|
207
|
+
// The executor initializes rejection synchronously; native abort cannot interleave before registration.
|
|
208
|
+
let rejectAbort;
|
|
209
|
+
const cancelled = new Promise((_resolve, reject) => { rejectAbort = reject; });
|
|
210
|
+
const abort = () => rejectAbort(signal.reason);
|
|
211
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
208
212
|
try {
|
|
209
213
|
return await Promise.race([
|
|
210
|
-
|
|
211
|
-
abort = () => reject(signal.reason);
|
|
212
|
-
signal.addEventListener("abort", abort, { once: true });
|
|
213
|
-
if (signal.aborted)
|
|
214
|
-
abort();
|
|
215
|
-
}),
|
|
214
|
+
cancelled,
|
|
216
215
|
Promise.resolve().then(() => { signal.throwIfAborted(); return reader.read(); }),
|
|
217
216
|
]);
|
|
218
217
|
}
|
|
@@ -33,8 +33,8 @@ export function fillPlaceholders({ text, values, escape: escapeValue }, _optiona
|
|
|
33
33
|
missing.add(name);
|
|
34
34
|
return "";
|
|
35
35
|
}
|
|
36
|
-
// Own keys contain strings by contract
|
|
37
|
-
return escapeValue({ value: values[name]
|
|
36
|
+
// Own keys contain strings by contract.
|
|
37
|
+
return escapeValue({ value: values[name] });
|
|
38
38
|
});
|
|
39
39
|
return { text: filled, missingFields: [...missing] };
|
|
40
40
|
}
|
|
@@ -71,11 +71,7 @@ function attribute({ element, name }, _options = {}) {
|
|
|
71
71
|
/** Every element under `root`, in document order (so "the first `<title>`" means the first one written). */
|
|
72
72
|
function* elementsIn(root, _options = {}) {
|
|
73
73
|
const pending = [root];
|
|
74
|
-
|
|
75
|
-
const node = pending.pop();
|
|
76
|
-
// Array length checks do not narrow pop() or indexed reads under the desktop config.
|
|
77
|
-
if (node === undefined)
|
|
78
|
-
continue;
|
|
74
|
+
for (let node = pending.pop(); node !== undefined; node = pending.pop()) {
|
|
79
75
|
if (isElement(node))
|
|
80
76
|
yield node;
|
|
81
77
|
queueChildParents({ node, pending });
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* It is given the same `mode` and `durableOutboxReady` the composition root hands the live mailer's
|
|
7
7
|
* gate (`server/runtime/composition/deps.ts`); this file never decides readiness itself.
|
|
8
8
|
*/
|
|
9
|
-
import { isPurposeGateOpen } from "./purpose-scoped-mailer.js";
|
|
9
|
+
import { isPurposeGateOpen, validateMode } from "./purpose-scoped-mailer.js";
|
|
10
10
|
/**
|
|
11
11
|
* @returns `true` when the gate would pass a send for that capability and lane, `false` when it refuses.
|
|
12
12
|
* @throws Anything else the gate throws (an unexpected failure is the caller's `unknown`, not a refusal).
|
|
@@ -15,7 +15,7 @@ import { isPurposeGateOpen } from "./purpose-scoped-mailer.js";
|
|
|
15
15
|
*/
|
|
16
16
|
export function createMailPurposeGateProbe(required) {
|
|
17
17
|
// Validate at composition, as the previous gate wrapper did; no readiness read in local mode.
|
|
18
|
-
|
|
18
|
+
validateMode({ mode: required.mode });
|
|
19
19
|
return async ({ capabilityName, lane }) => isPurposeGateOpen({ mode: required.mode,
|
|
20
20
|
readiness: { isReady: ({ capabilityName }) => required.durableOutboxReady({ capabilityName }) }, options: { lane, sourceContext: { module: capabilityName } } });
|
|
21
21
|
}
|
|
@@ -8,6 +8,10 @@ export interface WrapMailerWithPurposeGateOptions {
|
|
|
8
8
|
mode: RuntimeMode;
|
|
9
9
|
readiness: DeliveryReadinessPolicy;
|
|
10
10
|
}
|
|
11
|
+
/** Validate composition mode without evaluating delivery readiness. */
|
|
12
|
+
export declare function validateMode({ mode }: {
|
|
13
|
+
mode: RuntimeMode;
|
|
14
|
+
}, _optional?: Record<string, never>): void;
|
|
11
15
|
export interface PurposeGateRequired {
|
|
12
16
|
mode: RuntimeMode;
|
|
13
17
|
readiness: DeliveryReadinessPolicy;
|
|
@@ -9,7 +9,8 @@ function resolveLane(options) {
|
|
|
9
9
|
function refusalError(capabilityName) {
|
|
10
10
|
return new Error(`MAILER_SEND_REFUSED_NO_DURABLE_PATH: notification-lane mailer send refused for capability "${capabilityName}" — no durable outbox path registered`);
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
/** Validate composition mode without evaluating delivery readiness. */
|
|
13
|
+
export function validateMode({ mode }, _optional = {}) {
|
|
13
14
|
if (mode !== "production" && mode !== "local") {
|
|
14
15
|
throw new TypeError('mailer mode must be "production" or "local"');
|
|
15
16
|
}
|
|
@@ -21,7 +22,7 @@ function validateMode(mode) {
|
|
|
21
22
|
*/
|
|
22
23
|
export function isPurposeGateOpen(required) {
|
|
23
24
|
const { mode, readiness, options } = required;
|
|
24
|
-
validateMode(mode);
|
|
25
|
+
validateMode({ mode });
|
|
25
26
|
if (mode === "local")
|
|
26
27
|
return true;
|
|
27
28
|
if (resolveLane(options) !== "notification")
|
|
@@ -38,7 +39,7 @@ export function isPurposeGateOpen(required) {
|
|
|
38
39
|
export function wrapMailerWithPurposeGate(options) {
|
|
39
40
|
const { inner, mode, readiness } = options;
|
|
40
41
|
// Validate at composition: typos must never silently disable durable delivery.
|
|
41
|
-
validateMode(mode);
|
|
42
|
+
validateMode({ mode });
|
|
42
43
|
function checkGate(sendOptions) {
|
|
43
44
|
if (!isPurposeGateOpen({ mode, readiness, options: sendOptions })) {
|
|
44
45
|
throw refusalError(sendOptions.sourceContext?.module ?? "unknown");
|
package/dist/mail/test-send.js
CHANGED
|
@@ -79,20 +79,19 @@ const REFUSALS = {
|
|
|
79
79
|
/** What the mailer's answer means for this plan, most local explanation first. */
|
|
80
80
|
function outcomeOf({ plan, providerMessageId, mailer }, _options = {}) {
|
|
81
81
|
if (providerMessageId.startsWith("captured:"))
|
|
82
|
-
return "captured";
|
|
82
|
+
return { outcome: "captured" };
|
|
83
83
|
if (!isMailDeliveryAvailable({ mailer: fromPositionalMailer({ mailer }) }))
|
|
84
|
-
return "console";
|
|
85
|
-
|
|
84
|
+
return { outcome: "console" };
|
|
85
|
+
const redirectedTo = plan.redirectTo;
|
|
86
|
+
return redirectedTo === undefined ? { outcome: "accepted" } : { outcome: "redirected", redirectedTo };
|
|
86
87
|
}
|
|
87
88
|
function successResult({ common, plan, providerMessageId, mailer }, _options = {}) {
|
|
88
|
-
const
|
|
89
|
+
const result = outcomeOf({ plan: plan, providerMessageId: providerMessageId, mailer: mailer });
|
|
90
|
+
const { outcome } = result;
|
|
89
91
|
if (outcome === "captured" || outcome === "console")
|
|
90
92
|
return { ...common, outcome: "captured", where: outcome === "console" ? "console" : "capture", providerMessageId };
|
|
91
|
-
if (outcome === "redirected")
|
|
92
|
-
|
|
93
|
-
throw new Error("Redirected test mail has no recipient");
|
|
94
|
-
return { ...common, outcome, redirectedTo: plan.redirectTo, providerMessageId };
|
|
95
|
-
}
|
|
93
|
+
if (result.outcome === "redirected")
|
|
94
|
+
return { ...common, ...result, providerMessageId };
|
|
96
95
|
return { ...common, outcome: "accepted", providerMessageId };
|
|
97
96
|
}
|
|
98
97
|
/**
|
|
@@ -114,8 +113,6 @@ export async function runMailTestSend(required, optional = {}) {
|
|
|
114
113
|
const pending = performMailTestSend(required, optional);
|
|
115
114
|
if (deps.mailTestRequests && deps.mailTestRequests.size >= 4096) {
|
|
116
115
|
const oldest = deps.mailTestRequests.keys().next();
|
|
117
|
-
if (oldest.done)
|
|
118
|
-
throw new Error("Test mail request cache has no oldest entry");
|
|
119
116
|
deps.mailTestRequests.delete(oldest.value);
|
|
120
117
|
}
|
|
121
118
|
deps.mailTestRequests?.set(key, pending);
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/** top uses binary K/M/G and may append a change marker. Invalid/unsafe values stay unknown. O(1). */
|
|
2
2
|
function topBytes({ text }, _options = {}) {
|
|
3
3
|
const match = /^(\d+(?:\.\d+)?)([BKMG])[+-]?$/.exec(text);
|
|
4
|
-
if (!match
|
|
4
|
+
if (!match)
|
|
5
5
|
return null;
|
|
6
6
|
const scale = { B: 1, K: 1024, M: 1024 ** 2, G: 1024 ** 3 };
|
|
7
7
|
const multiplier = scale[match[2]];
|
|
8
|
-
if (multiplier === undefined)
|
|
9
|
-
return null;
|
|
10
8
|
const bytes = Math.round(Number(match[1]) * multiplier);
|
|
11
9
|
return Number.isSafeInteger(bytes) ? bytes : null;
|
|
12
10
|
}
|
|
@@ -6,5 +6,7 @@ export declare function createCleanupPreviewStore({ randomToken, mono }: {
|
|
|
6
6
|
mono: () => number;
|
|
7
7
|
}, { ttlMs }?: {
|
|
8
8
|
ttlMs?: number | undefined;
|
|
9
|
-
}): CleanupPreviewStore
|
|
9
|
+
}): CleanupPreviewStore & {
|
|
10
|
+
size(required: Record<string, never>, optional?: Record<string, never>): number;
|
|
11
|
+
};
|
|
10
12
|
//# sourceMappingURL=preview-store.d.ts.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export function createCleanupPreviewStore({ randomToken, mono }, { ttlMs = 900000 } = {}) {
|
|
2
2
|
const outstanding = new Map();
|
|
3
3
|
return {
|
|
4
|
+
/** Retained previews, including expired entries until the next put/take removes them. */
|
|
5
|
+
size(_required, _optional = {}) { return outstanding.size; },
|
|
4
6
|
put({ principal, kind, scope, payload }, _optional = {}) {
|
|
5
7
|
const at = mono();
|
|
6
8
|
for (const [key, entry] of outstanding)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jini-ai/platform",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"description": "Generic OS/platform primitives: process exec and lifecycle, filesystem containment, HTTP readiness polling, toolchain discovery, blob storage, AWS signing, and an SSRF-safe asset cache.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -373,7 +373,7 @@
|
|
|
373
373
|
],
|
|
374
374
|
"dependencies": {
|
|
375
375
|
"undici": "^7.30.1",
|
|
376
|
-
"@jini-ai/core": "^0.7.
|
|
376
|
+
"@jini-ai/core": "^0.7.4"
|
|
377
377
|
},
|
|
378
378
|
"publishConfig": {
|
|
379
379
|
"access": "public",
|