@cat-factory/kernel 0.170.0 → 0.172.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/domain/bug-hunt-logic.d.ts +36 -0
- package/dist/domain/bug-hunt-logic.d.ts.map +1 -0
- package/dist/domain/bug-hunt-logic.js +120 -0
- package/dist/domain/bug-hunt-logic.js.map +1 -0
- package/dist/domain/errors.d.ts +15 -0
- package/dist/domain/errors.d.ts.map +1 -1
- package/dist/domain/errors.js +18 -0
- package/dist/domain/errors.js.map +1 -1
- package/dist/domain/mount-layout.d.ts +17 -0
- package/dist/domain/mount-layout.d.ts.map +1 -0
- package/dist/domain/mount-layout.js +23 -0
- package/dist/domain/mount-layout.js.map +1 -0
- package/dist/domain/seed.d.ts +6 -0
- package/dist/domain/seed.d.ts.map +1 -1
- package/dist/domain/seed.js +6 -0
- package/dist/domain/seed.js.map +1 -1
- package/dist/domain/types.d.ts +1 -1
- package/dist/domain/types.d.ts.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/ports/binary-artifacts.d.ts +2 -3
- package/dist/ports/binary-artifacts.d.ts.map +1 -1
- package/dist/ports/binary-artifacts.js +1 -1
- package/dist/ports/binary-artifacts.js.map +1 -1
- package/dist/ports/brainstorm-repositories.d.ts +15 -3
- package/dist/ports/brainstorm-repositories.d.ts.map +1 -1
- package/dist/ports/bug-hunt.d.ts +24 -0
- package/dist/ports/bug-hunt.d.ts.map +1 -0
- package/dist/ports/bug-hunt.js +2 -0
- package/dist/ports/bug-hunt.js.map +1 -0
- package/dist/ports/clarity-review-repositories.d.ts +13 -3
- package/dist/ports/clarity-review-repositories.d.ts.map +1 -1
- package/dist/ports/github-client.d.ts +10 -0
- package/dist/ports/github-client.d.ts.map +1 -1
- package/dist/ports/index.d.ts +3 -1
- package/dist/ports/index.d.ts.map +1 -1
- package/dist/ports/index.js +1 -0
- package/dist/ports/index.js.map +1 -1
- package/dist/ports/logging.d.ts +47 -0
- package/dist/ports/logging.d.ts.map +1 -0
- package/dist/ports/logging.js +35 -0
- package/dist/ports/logging.js.map +1 -0
- package/dist/ports/requirement-review-repositories.d.ts +27 -5
- package/dist/ports/requirement-review-repositories.d.ts.map +1 -1
- package/dist/ports/task-source.d.ts +44 -6
- package/dist/ports/task-source.d.ts.map +1 -1
- package/dist/shared/best-effort.d.ts +28 -0
- package/dist/shared/best-effort.d.ts.map +1 -0
- package/dist/shared/best-effort.js +49 -0
- package/dist/shared/best-effort.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { LogFields, Logger } from '../ports/logging.js';
|
|
2
|
+
/**
|
|
3
|
+
* Describe a thrown value as log fields. The message is scrubbed with `redactSecrets`
|
|
4
|
+
* because an error surfaced from `fetch`, a shell spawn or a provider SDK routinely
|
|
5
|
+
* echoes the URL (with its query) or an auth header back in its text.
|
|
6
|
+
*
|
|
7
|
+
* Only the message and the constructor name are kept: a stack is high-volume and rarely
|
|
8
|
+
* the thing that identifies the failure in a structured log. Pass one explicitly when a
|
|
9
|
+
* specific site needs it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function describeError(error: unknown): LogFields;
|
|
12
|
+
/**
|
|
13
|
+
* Run `fn` and swallow any rejection, logging it at `warn` with `label` as the operation
|
|
14
|
+
* name. Returns `undefined` when the work failed, so a caller that wants the value can
|
|
15
|
+
* still branch on it, and never rejects.
|
|
16
|
+
*
|
|
17
|
+
* Use it for work that is genuinely optional. It is the WRONG tool when the failure should
|
|
18
|
+
* change what the caller does — that wants a real `try`/`catch` with a domain decision.
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* void runBestEffort(logger, 'execution.autoStartDependents', () => this.autoStartDependents(id), {
|
|
22
|
+
* workspaceId,
|
|
23
|
+
* executionId,
|
|
24
|
+
* })
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function runBestEffort<T>(logger: Logger, label: string, fn: () => Promise<T> | T, fields?: LogFields): Promise<T | undefined>;
|
|
28
|
+
//# sourceMappingURL=best-effort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"best-effort.d.ts","sourceRoot":"","sources":["../../src/shared/best-effort.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAG5D;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAKvD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,aAAa,CAAC,CAAC,EACnC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EACxB,MAAM,GAAE,SAAc,GACrB,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAOxB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// The convention for a deliberately-swallowed failure. A background write, a tracker
|
|
2
|
+
// echo, a lease release, a notification raise: work whose failure must NOT propagate into
|
|
3
|
+
// the caller, but which was previously dropped by `.catch(() => {})` — leaving no log, no
|
|
4
|
+
// metric and no marker (see `docs/initiatives/observability-logging-gaps.md`, B1).
|
|
5
|
+
//
|
|
6
|
+
// `runBestEffort` keeps the swallow and adds the evidence. Every drop becomes one
|
|
7
|
+
// `warn` line naming the operation, with the cause scrubbed. Patterns and the rules for
|
|
8
|
+
// when to use it: `backend/docs/logging.md`.
|
|
9
|
+
import { redactSecrets } from './redact-secrets.logic.js';
|
|
10
|
+
/**
|
|
11
|
+
* Describe a thrown value as log fields. The message is scrubbed with `redactSecrets`
|
|
12
|
+
* because an error surfaced from `fetch`, a shell spawn or a provider SDK routinely
|
|
13
|
+
* echoes the URL (with its query) or an auth header back in its text.
|
|
14
|
+
*
|
|
15
|
+
* Only the message and the constructor name are kept: a stack is high-volume and rarely
|
|
16
|
+
* the thing that identifies the failure in a structured log. Pass one explicitly when a
|
|
17
|
+
* specific site needs it.
|
|
18
|
+
*/
|
|
19
|
+
export function describeError(error) {
|
|
20
|
+
if (error instanceof Error) {
|
|
21
|
+
return { err: redactSecrets(error.message) ?? '', errKind: error.name };
|
|
22
|
+
}
|
|
23
|
+
return { err: redactSecrets(String(error)) ?? '', errKind: typeof error };
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Run `fn` and swallow any rejection, logging it at `warn` with `label` as the operation
|
|
27
|
+
* name. Returns `undefined` when the work failed, so a caller that wants the value can
|
|
28
|
+
* still branch on it, and never rejects.
|
|
29
|
+
*
|
|
30
|
+
* Use it for work that is genuinely optional. It is the WRONG tool when the failure should
|
|
31
|
+
* change what the caller does — that wants a real `try`/`catch` with a domain decision.
|
|
32
|
+
*
|
|
33
|
+
* ```ts
|
|
34
|
+
* void runBestEffort(logger, 'execution.autoStartDependents', () => this.autoStartDependents(id), {
|
|
35
|
+
* workspaceId,
|
|
36
|
+
* executionId,
|
|
37
|
+
* })
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export async function runBestEffort(logger, label, fn, fields = {}) {
|
|
41
|
+
try {
|
|
42
|
+
return await fn();
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
logger.warn(`best-effort ${label} failed`, { ...fields, ...describeError(error) });
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=best-effort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"best-effort.js","sourceRoot":"","sources":["../../src/shared/best-effort.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,0FAA0F;AAC1F,0FAA0F;AAC1F,mFAAmF;AACnF,EAAE;AACF,kFAAkF;AAClF,wFAAwF;AACxF,6CAA6C;AAG7C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEzD;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,EAAE,GAAG,EAAE,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,CAAA;IACzE,CAAC;IACD,OAAO,EAAE,GAAG,EAAE,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,OAAO,KAAK,EAAE,CAAA;AAC3E,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAAc,EACd,KAAa,EACb,EAAwB,EACxB,MAAM,GAAc,EAAE;IAEtB,IAAI,CAAC;QACH,OAAO,MAAM,EAAE,EAAE,CAAA;IACnB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,IAAI,CAAC,eAAe,KAAK,SAAS,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QAClF,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cat-factory/kernel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.172.0",
|
|
4
4
|
"description": "Shared vocabulary, pure logic, and port interfaces for the Agent Architecture Board.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"ai": "^7.0.37",
|
|
28
28
|
"yaml": "^2.9.0",
|
|
29
|
-
"@cat-factory/contracts": "0.
|
|
29
|
+
"@cat-factory/contracts": "0.179.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@vitest/coverage-v8": "^4.1.10",
|