@cat-factory/integrations 0.94.1 → 0.96.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/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/modules/environments/environments.logic.d.ts +6 -2
- package/dist/modules/environments/environments.logic.d.ts.map +1 -1
- package/dist/modules/environments/environments.logic.js +9 -42
- package/dist/modules/environments/environments.logic.js.map +1 -1
- package/dist/modules/notificationWebhook/NotificationWebhookService.d.ts +25 -0
- package/dist/modules/notificationWebhook/NotificationWebhookService.d.ts.map +1 -0
- package/dist/modules/notificationWebhook/NotificationWebhookService.js +49 -0
- package/dist/modules/notificationWebhook/NotificationWebhookService.js.map +1 -0
- package/dist/modules/notificationWebhook/WebhookNotificationChannel.d.ts +39 -0
- package/dist/modules/notificationWebhook/WebhookNotificationChannel.d.ts.map +1 -0
- package/dist/modules/notificationWebhook/WebhookNotificationChannel.js +154 -0
- package/dist/modules/notificationWebhook/WebhookNotificationChannel.js.map +1 -0
- package/dist/modules/notificationWebhook/support.d.ts +42 -0
- package/dist/modules/notificationWebhook/support.d.ts.map +1 -0
- package/dist/modules/notificationWebhook/support.js +37 -0
- package/dist/modules/notificationWebhook/support.js.map +1 -0
- package/dist/modules/notificationWebhook/webhookSignature.d.ts +17 -0
- package/dist/modules/notificationWebhook/webhookSignature.d.ts.map +1 -0
- package/dist/modules/notificationWebhook/webhookSignature.js +42 -0
- package/dist/modules/notificationWebhook/webhookSignature.js.map +1 -0
- package/dist/modules/notificationWebhook/webhookUrl.d.ts +9 -0
- package/dist/modules/notificationWebhook/webhookUrl.d.ts.map +1 -0
- package/dist/modules/notificationWebhook/webhookUrl.js +26 -0
- package/dist/modules/notificationWebhook/webhookUrl.js.map +1 -0
- package/dist/modules/publicApi/PublicApiKeyService.d.ts +6 -3
- package/dist/modules/publicApi/PublicApiKeyService.d.ts.map +1 -1
- package/dist/modules/publicApi/PublicApiKeyService.js +9 -4
- package/dist/modules/publicApi/PublicApiKeyService.js.map +1 -1
- package/dist/modules/runners/HttpRunnerPoolProvider.d.ts +6 -0
- package/dist/modules/runners/HttpRunnerPoolProvider.d.ts.map +1 -1
- package/dist/modules/runners/HttpRunnerPoolProvider.js +57 -0
- package/dist/modules/runners/HttpRunnerPoolProvider.js.map +1 -1
- package/dist/modules/shared/url-guard.d.ts +24 -0
- package/dist/modules/shared/url-guard.d.ts.map +1 -0
- package/dist/modules/shared/url-guard.js +53 -0
- package/dist/modules/shared/url-guard.js.map +1 -0
- package/dist/modules/validation/ValidationConfigService.d.ts +54 -0
- package/dist/modules/validation/ValidationConfigService.d.ts.map +1 -0
- package/dist/modules/validation/ValidationConfigService.js +103 -0
- package/dist/modules/validation/ValidationConfigService.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { NotFoundError, ValidationError } from '@cat-factory/kernel';
|
|
2
|
+
import { VALIDATION_DEFAULT_MAX_ATTEMPTS } from '@cat-factory/contracts';
|
|
3
|
+
/**
|
|
4
|
+
* Owns a service's PRE-PR VALIDATION CHECKS — the shell commands the executor-harness runs
|
|
5
|
+
* against the checkout after the coding agent settles and BEFORE the PR opens (see
|
|
6
|
+
* `docs/initiatives/pre-pr-validation.md`).
|
|
7
|
+
*
|
|
8
|
+
* The CRUD surface ({@link getView}/{@link set}/{@link deleteFor}) operates on the exact SERVICE
|
|
9
|
+
* FRAME block the inspector edits. The resolution surface ({@link resolveForFrame}) reads the
|
|
10
|
+
* checks for the frame a dispatch resolved, and is the SINGLE seam a dispatch resolves checks
|
|
11
|
+
* through — so adding a second source later (a checked-in repo manifest, see the tracker's D1) is
|
|
12
|
+
* a change inside that method plus a precedence rule, not a new path through the executor.
|
|
13
|
+
*
|
|
14
|
+
* Nothing here is a secret: the commands are operator-authored strings that run inside the run's
|
|
15
|
+
* own sandboxed container, the same trust boundary as the coding agent.
|
|
16
|
+
*/
|
|
17
|
+
export class ValidationConfigService {
|
|
18
|
+
repo;
|
|
19
|
+
blocks;
|
|
20
|
+
clock;
|
|
21
|
+
constructor(deps) {
|
|
22
|
+
this.repo = deps.validationConfigRepository;
|
|
23
|
+
this.blocks = deps.blockRepository;
|
|
24
|
+
this.clock = deps.clock;
|
|
25
|
+
}
|
|
26
|
+
/** The checks configured for a service frame (empty when it has none). */
|
|
27
|
+
async getView(workspaceId, blockId) {
|
|
28
|
+
const record = await this.repo.getByBlock(workspaceId, blockId);
|
|
29
|
+
return toView(blockId, record);
|
|
30
|
+
}
|
|
31
|
+
/** Every configured service's checks in the workspace (the inspector store's hydrate read). */
|
|
32
|
+
async list(workspaceId) {
|
|
33
|
+
const rows = await this.repo.listByWorkspace(workspaceId);
|
|
34
|
+
return rows.map((r) => toView(r.blockId, r));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Set/replace a service frame's validation checks. An empty list deletes the row (a service
|
|
38
|
+
* with no checks carries none), so a cleared inspector restores the exact pre-feature
|
|
39
|
+
* behaviour rather than leaving an empty config that still has to be resolved.
|
|
40
|
+
*/
|
|
41
|
+
async set(workspaceId, blockId, input) {
|
|
42
|
+
// Checks are keyed by (and resolved up to) the SERVICE FRAME, so storing them against a
|
|
43
|
+
// module/task block would leave them silently un-run at dispatch time (resolution walks UP
|
|
44
|
+
// to the frame and never finds them). Reject a non-frame block here so the operator gets a
|
|
45
|
+
// clear error instead of a config that appears to save but never runs.
|
|
46
|
+
const block = await this.blocks.get(workspaceId, blockId);
|
|
47
|
+
if (!block)
|
|
48
|
+
throw new NotFoundError('block', blockId);
|
|
49
|
+
if (block.level !== 'frame') {
|
|
50
|
+
throw new ValidationError('Validation checks can only be set on a service frame');
|
|
51
|
+
}
|
|
52
|
+
if (input.checks.length === 0) {
|
|
53
|
+
await this.repo.delete(workspaceId, blockId);
|
|
54
|
+
return toView(blockId, null);
|
|
55
|
+
}
|
|
56
|
+
const now = this.clock.now();
|
|
57
|
+
const existing = await this.repo.getByBlock(workspaceId, blockId);
|
|
58
|
+
const record = {
|
|
59
|
+
workspaceId,
|
|
60
|
+
blockId,
|
|
61
|
+
checks: input.checks.map((c) => ({ label: c.label, command: c.command })),
|
|
62
|
+
maxAttempts: input.maxAttempts ?? VALIDATION_DEFAULT_MAX_ATTEMPTS,
|
|
63
|
+
createdAt: existing?.createdAt ?? now,
|
|
64
|
+
updatedAt: now,
|
|
65
|
+
};
|
|
66
|
+
await this.repo.upsert(record);
|
|
67
|
+
return toView(blockId, record);
|
|
68
|
+
}
|
|
69
|
+
/** Remove a service frame's validation checks. */
|
|
70
|
+
async deleteFor(workspaceId, blockId) {
|
|
71
|
+
await this.repo.delete(workspaceId, blockId);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The checks that apply to a run dispatched against SERVICE FRAME `frameId`. This is what the
|
|
75
|
+
* engine folds onto the agent run context and the container executor forwards on the coding job
|
|
76
|
+
* body. `null` when the frame configured no checks, which is what keeps an unconfigured
|
|
77
|
+
* deployment byte-for-byte on the old code path.
|
|
78
|
+
*
|
|
79
|
+
* Takes the frame the CALLER already resolved rather than a run block, deliberately: the
|
|
80
|
+
* engine's `AgentContextBuilder` walks the frame→module→task ancestry exactly ONCE per dispatch
|
|
81
|
+
* and threads the result into every frame-scoped resolver (environment, service config,
|
|
82
|
+
* frontend, fragments). Re-deriving it here would put two extra block point-reads on every
|
|
83
|
+
* dispatch to reach a frame the caller is already holding.
|
|
84
|
+
*/
|
|
85
|
+
async resolveForFrame(workspaceId, frameId) {
|
|
86
|
+
const record = await this.repo.getByBlock(workspaceId, frameId);
|
|
87
|
+
if (!record || record.checks.length === 0)
|
|
88
|
+
return null;
|
|
89
|
+
return {
|
|
90
|
+
checks: record.checks.map((c) => ({ label: c.label, command: c.command })),
|
|
91
|
+
maxAttempts: record.maxAttempts,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/** Project a stored record (or its absence) into the wire view. */
|
|
96
|
+
function toView(blockId, record) {
|
|
97
|
+
return {
|
|
98
|
+
blockId,
|
|
99
|
+
checks: record?.checks ?? [],
|
|
100
|
+
maxAttempts: record?.maxAttempts ?? VALIDATION_DEFAULT_MAX_ATTEMPTS,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=ValidationConfigService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidationConfigService.js","sourceRoot":"","sources":["../../../src/modules/validation/ValidationConfigService.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAMpE,OAAO,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAA;AASxE;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,uBAAuB;IACjB,IAAI,CAA4B;IAChC,MAAM,CAAiB;IACvB,KAAK,CAAO;IAE7B,YAAY,IAAyC;QACnD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,0BAA0B,CAAA;QAC3C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,eAAe,CAAA;QAClC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;IACzB,CAAC;IAED,0EAA0E;IAC1E,KAAK,CAAC,OAAO,CAAC,WAAmB,EAAE,OAAe;QAChD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;QAC/D,OAAO,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAChC,CAAC;IAED,+FAA+F;IAC/F,KAAK,CAAC,IAAI,CAAC,WAAmB;QAC5B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAA;QACzD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,E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AAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QAC9B,OAAO,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAChC,CAAC;IAED,kDAAkD;IAClD,KAAK,CAAC,SAAS,CAAC,WAAmB,EAAE,OAAe;QAClD,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;IAC9C,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,eAAe,CACnB,WAAmB,EACnB,OAAe;QAEf,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;QAC/D,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAA;QACtD,OAAO;YACL,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YAC1E,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAA;IACH,CAAC;CACF;AAED,mEAAmE;AACnE,SAAS,MAAM,CAAC,OAAe,EAAE,MAAqC;IACpE,OAAO;QACL,OAAO;QACP,MAAM,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE;QAC5B,WAAW,EAAE,MAAM,EAAE,WAAW,IAAI,+BAA+B;KACpE,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cat-factory/integrations",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.96.0",
|
|
4
4
|
"description": "External-system integration domain logic for the Agent Architecture Board (GitHub, documents, tasks, environments, runners).",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
"ai": "^7.0.35",
|
|
28
28
|
"p-map": "^7.0.6",
|
|
29
29
|
"yaml": "^2.9.0",
|
|
30
|
-
"@cat-factory/contracts": "0.
|
|
31
|
-
"@cat-factory/kernel": "0.
|
|
30
|
+
"@cat-factory/contracts": "0.164.0",
|
|
31
|
+
"@cat-factory/kernel": "0.158.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"typescript": "7.0.2",
|
|
35
35
|
"undici": "^8.8.0",
|
|
36
36
|
"valibot": "^1.4.2",
|
|
37
37
|
"vitest": "^4.1.10",
|
|
38
|
-
"@cat-factory/caching": "0.10.
|
|
38
|
+
"@cat-factory/caching": "0.10.39"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "tsc -b tsconfig.build.json",
|