@agentcomms/events-daemon 0.16.0 → 0.17.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/README.md +129 -8
- package/dist/{b3-contract-03AO67VB.mjs → b3-contract-DFxcHY0I.mjs} +304 -53
- package/dist/cli.mjs +6615 -3175
- package/dist/index.d.mts +73 -23
- package/dist/index.mjs +1 -1
- package/dist/records-DjE5a4_H.mjs +2 -0
- package/dist/{records-3rGS8spn.mjs → records-DsUxYBwb.mjs} +2 -2
- package/dist/{webhook-target-BkA_wHIu.mjs → webhook-target-DyDTwWhV.mjs} +38 -27
- package/package.json +8 -8
- package/dist/records-DojbuTaG.mjs +0 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "@agentcomms/core";
|
|
2
|
-
import { CanonicalCondition, JsonValue } from "@agentcomms/events";
|
|
2
|
+
import { AgenticConditionV1, CanonicalCondition, JsonValue } from "@agentcomms/events";
|
|
3
3
|
//#endregion
|
|
4
4
|
//#region ../../node_modules/.pnpm/@modelcontextprotocol+server@2.0.0/node_modules/@modelcontextprotocol/server/dist/types-DUs7mGBv.d.mts
|
|
5
5
|
//#region ../../node_modules/.pnpm/json-schema-typed@8.0.2/node_modules/json-schema-typed/draft_2020_12.d.ts
|
|
@@ -11461,9 +11461,69 @@ type RegisteredPrompt = {
|
|
|
11461
11461
|
};
|
|
11462
11462
|
//#endregion
|
|
11463
11463
|
//#region src/domain/lifecycle.d.ts
|
|
11464
|
-
declare const
|
|
11464
|
+
declare const JUDGE_KIND_TYPESAFE: "typesafe";
|
|
11465
|
+
declare const JUDGE_KIND_LAYA: "laya";
|
|
11466
|
+
declare const JUDGE_KIND_LOCAL_ENDPOINT: "local-endpoint";
|
|
11467
|
+
declare const JUDGE_KINDS: readonly [typeof JUDGE_KIND_TYPESAFE, typeof JUDGE_KIND_LAYA, typeof JUDGE_KIND_LOCAL_ENDPOINT];
|
|
11465
11468
|
type JudgeKind = (typeof JUDGE_KINDS)[number];
|
|
11466
11469
|
//#endregion
|
|
11470
|
+
//#region src/domain/judges.d.ts
|
|
11471
|
+
declare const TYPESAFE_SYSTEM_ONE_ENDPOINT = "https://api.typesafe.ai/v1/systemone";
|
|
11472
|
+
declare const JUDGE_BUDGET_ID = "judge-budget";
|
|
11473
|
+
/** Provider record: docs/superpowers/plans/2026-10-10-events-phase-e-provider-record.md, read 2026-10-10. */
|
|
11474
|
+
declare const APPROVED_TYPESAFE_MODELS: readonly ["jev-1.13.0"];
|
|
11475
|
+
type ApprovedTypeSafeModel = (typeof APPROVED_TYPESAFE_MODELS)[number];
|
|
11476
|
+
interface TypeSafeJudgeDocument {
|
|
11477
|
+
readonly judgeId: string;
|
|
11478
|
+
readonly version: number;
|
|
11479
|
+
readonly kind: typeof JUDGE_KIND_TYPESAFE;
|
|
11480
|
+
readonly provider: typeof JUDGE_KIND_TYPESAFE;
|
|
11481
|
+
readonly model: ApprovedTypeSafeModel;
|
|
11482
|
+
readonly endpoint: typeof TYPESAFE_SYSTEM_ONE_ENDPOINT;
|
|
11483
|
+
readonly promptTemplate: string;
|
|
11484
|
+
readonly protocol: "noul";
|
|
11485
|
+
}
|
|
11486
|
+
interface LocalEndpointJudgeBase {
|
|
11487
|
+
readonly judgeId: string;
|
|
11488
|
+
readonly version: number;
|
|
11489
|
+
readonly kind: typeof JUDGE_KIND_LOCAL_ENDPOINT;
|
|
11490
|
+
readonly provider: string;
|
|
11491
|
+
readonly model: string;
|
|
11492
|
+
readonly endpoint: string;
|
|
11493
|
+
readonly approvedAddressSet: readonly [string];
|
|
11494
|
+
readonly promptTemplate: string;
|
|
11495
|
+
}
|
|
11496
|
+
type LocalEndpointJudgeDocument = (LocalEndpointJudgeBase & {
|
|
11497
|
+
readonly protocol: "noul";
|
|
11498
|
+
}) | (LocalEndpointJudgeBase & {
|
|
11499
|
+
readonly protocol: "json-score";
|
|
11500
|
+
readonly scorePointer: string;
|
|
11501
|
+
});
|
|
11502
|
+
type CanonicalJudgeDocument = TypeSafeJudgeDocument | LocalEndpointJudgeDocument;
|
|
11503
|
+
interface JudgeBudgetLimits {
|
|
11504
|
+
readonly callsPerRollingHour: number;
|
|
11505
|
+
readonly inputTokensPerRolling30Days: number;
|
|
11506
|
+
readonly concurrency: number;
|
|
11507
|
+
}
|
|
11508
|
+
interface CanonicalJudgeBudgetDocument {
|
|
11509
|
+
readonly budgetId: typeof JUDGE_BUDGET_ID;
|
|
11510
|
+
readonly version: number;
|
|
11511
|
+
readonly global: JudgeBudgetLimits;
|
|
11512
|
+
readonly providers: readonly (JudgeBudgetLimits & {
|
|
11513
|
+
readonly provider: string;
|
|
11514
|
+
})[];
|
|
11515
|
+
}
|
|
11516
|
+
type CanonicalJudgeKindEnablementDocument = {
|
|
11517
|
+
readonly id: "judge-kind:typesafe";
|
|
11518
|
+
readonly kind: typeof JUDGE_KIND_TYPESAFE;
|
|
11519
|
+
readonly version: number;
|
|
11520
|
+
readonly endpoint: typeof TYPESAFE_SYSTEM_ONE_ENDPOINT;
|
|
11521
|
+
} | {
|
|
11522
|
+
readonly id: "judge-kind:local-endpoint";
|
|
11523
|
+
readonly kind: typeof JUDGE_KIND_LOCAL_ENDPOINT;
|
|
11524
|
+
readonly version: number;
|
|
11525
|
+
};
|
|
11526
|
+
//#endregion
|
|
11467
11527
|
//#region src/domain/source-options.d.ts
|
|
11468
11528
|
interface GmailSourceOptions {
|
|
11469
11529
|
readonly channel: "gmail";
|
|
@@ -11537,14 +11597,10 @@ interface DryRunTargetDocument {
|
|
|
11537
11597
|
readonly retentionMs: number;
|
|
11538
11598
|
}
|
|
11539
11599
|
type TargetDocument = DryRunTargetDocument | WebhookTargetDocument | SseTargetDocument;
|
|
11540
|
-
|
|
11541
|
-
|
|
11542
|
-
readonly
|
|
11543
|
-
|
|
11544
|
-
readonly provider: string;
|
|
11545
|
-
readonly model: string;
|
|
11546
|
-
readonly [field: string]: unknown;
|
|
11547
|
-
}
|
|
11600
|
+
type JudgeDocument = CanonicalJudgeDocument;
|
|
11601
|
+
type CanonicalAgenticCondition = Omit<AgenticConditionV1, "judge"> & {
|
|
11602
|
+
readonly judge: CanonicalJudgeDocument;
|
|
11603
|
+
};
|
|
11548
11604
|
type SubscriberDocument = SseSubscriberDocument;
|
|
11549
11605
|
interface RuleRetentionDocument {
|
|
11550
11606
|
readonly ingestMs: number;
|
|
@@ -11589,6 +11645,8 @@ interface CanonicalFullRuleDocument {
|
|
|
11589
11645
|
readonly version: number;
|
|
11590
11646
|
};
|
|
11591
11647
|
readonly condition: CanonicalCondition;
|
|
11648
|
+
/** An optional exact judge authority; deterministic matching remains mandatory without it. */
|
|
11649
|
+
readonly agentic?: CanonicalAgenticCondition;
|
|
11592
11650
|
readonly mapping: JsonValue;
|
|
11593
11651
|
/** D2/D6: the optional exact CloudEvent `type` override, part of the approval when present; absent means the default. */
|
|
11594
11652
|
readonly cloudEventType?: string;
|
|
@@ -11598,16 +11656,8 @@ interface CanonicalFullRuleDocument {
|
|
|
11598
11656
|
readonly deliveryRateCap: number;
|
|
11599
11657
|
readonly retention: RuleRetentionDocument;
|
|
11600
11658
|
}
|
|
11601
|
-
|
|
11602
|
-
|
|
11603
|
-
readonly version: number;
|
|
11604
|
-
readonly [field: string]: unknown;
|
|
11605
|
-
}
|
|
11606
|
-
interface JudgeKindEnablementDocument {
|
|
11607
|
-
readonly kind: JudgeKind;
|
|
11608
|
-
readonly version: number;
|
|
11609
|
-
readonly [field: string]: unknown;
|
|
11610
|
-
}
|
|
11659
|
+
type JudgeBudgetDocument = CanonicalJudgeBudgetDocument;
|
|
11660
|
+
type JudgeKindEnablementDocument = CanonicalJudgeKindEnablementDocument;
|
|
11611
11661
|
type ActivationDocumentV1 = {
|
|
11612
11662
|
readonly documentVersion: 1;
|
|
11613
11663
|
readonly kind: "rule";
|
|
@@ -12083,7 +12133,7 @@ interface DoctorReportV1 {
|
|
|
12083
12133
|
}[];
|
|
12084
12134
|
};
|
|
12085
12135
|
readonly judgeBoundary: readonly {
|
|
12086
|
-
readonly kind:
|
|
12136
|
+
readonly kind: JudgeKind;
|
|
12087
12137
|
readonly code: "E_REQUIRED" | "E2_REQUIRED";
|
|
12088
12138
|
readonly phase: "E" | "E2";
|
|
12089
12139
|
}[];
|
|
@@ -12458,10 +12508,10 @@ interface B3ControlRequestArgumentsV1 {
|
|
|
12458
12508
|
};
|
|
12459
12509
|
readonly judgesList: Record<string, never>;
|
|
12460
12510
|
readonly addJudge: {
|
|
12461
|
-
readonly document:
|
|
12511
|
+
readonly document: CanonicalJudgeDocument;
|
|
12462
12512
|
};
|
|
12463
12513
|
readonly updateJudge: {
|
|
12464
|
-
readonly document:
|
|
12514
|
+
readonly document: CanonicalJudgeDocument;
|
|
12465
12515
|
};
|
|
12466
12516
|
readonly removeJudge: {
|
|
12467
12517
|
readonly judgeId: string;
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { R as createEventsMcpServer, Y as status, a as B3_CONTROL_V1_OPERATION_SPECS, c as B3_CONTROL_V1_SUCCESSOR_REQUIREMENT, d as B3_SECRET_TERMINAL_ORIGIN, i as B3_CONTROL_ERROR_CODES, l as B3_DESKTOP_CONTROL_OPERATIONS, m as renderB3ApprovalPreviewV1, n as B3_CAPABILITIES, o as B3_CONTROL_V1_RESULT_OPERATIONS, r as B3_CONTROL_CONTRACT, s as B3_CONTROL_V1_SCHEMA_VERSION, t as B3_APPROVAL_VIEW_VARIANTS, u as B3_JUDGE_UNAVAILABLE_VARIANTS } from "./b3-contract-DFxcHY0I.mjs";
|
|
2
2
|
export { B3_APPROVAL_VIEW_VARIANTS, B3_CAPABILITIES, B3_CONTROL_CONTRACT, B3_CONTROL_ERROR_CODES, B3_CONTROL_V1_OPERATION_SPECS, B3_CONTROL_V1_RESULT_OPERATIONS, B3_CONTROL_V1_SCHEMA_VERSION, B3_CONTROL_V1_SUCCESSOR_REQUIREMENT, B3_DESKTOP_CONTROL_OPERATIONS, B3_JUDGE_UNAVAILABLE_VARIANTS, B3_SECRET_TERMINAL_ORIGIN, createEventsMcpServer, renderB3ApprovalPreviewV1, status };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as canonicalSecretWebhookUrl } from "./webhook-target-
|
|
1
|
+
import { t as canonicalSecretWebhookUrl } from "./webhook-target-DyDTwWhV.mjs";
|
|
2
2
|
import { createCipheriv, createDecipheriv, hkdfSync, randomBytes } from "node:crypto";
|
|
3
3
|
import "node:fs/promises";
|
|
4
4
|
import { FileSecretStore, KeychainSecretStore, canonicalJson, keychainNamespace, loadKeyringModule, sha256Hex, withFileLock } from "@agentcomms/core";
|
|
@@ -354,7 +354,7 @@ var EventSecretStore = class {
|
|
|
354
354
|
this.assertSelectedBackend();
|
|
355
355
|
const row = this.#database.prepare("SELECT secret_ref, retired_at FROM event_secret_masters WHERE key_id = ?").get(input.keyId);
|
|
356
356
|
if (row === void 0 || row.retired_at === null) throw new EventSecretError("EVENT_MASTER_UNKNOWN", "only a known retired event master may be destroyed");
|
|
357
|
-
const { RECORD_LAYOUTS } = await import("./records-
|
|
357
|
+
const { RECORD_LAYOUTS } = await import("./records-DjE5a4_H.mjs");
|
|
358
358
|
for (const layout of RECORD_LAYOUTS) {
|
|
359
359
|
const records = this.#database.prepare(`SELECT ${layout.sqlColumn} AS record FROM ${layout.table} WHERE ${layout.sqlColumn} IS NOT NULL`).all();
|
|
360
360
|
for (const record of records) {
|
|
@@ -1,25 +1,4 @@
|
|
|
1
1
|
import { canonicalJson, sha256Hex } from "@agentcomms/core";
|
|
2
|
-
//#region src/domain/lifecycle.ts
|
|
3
|
-
/** A content-free domain refusal. No caller should substitute an arbitrary Error message at a control boundary. */
|
|
4
|
-
var EventDomainError = class extends Error {
|
|
5
|
-
code;
|
|
6
|
-
constructor(code, message) {
|
|
7
|
-
super(message);
|
|
8
|
-
this.name = "EventDomainError";
|
|
9
|
-
this.code = code;
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
const JUDGE_KINDS = [
|
|
13
|
-
"typesafe",
|
|
14
|
-
"laya",
|
|
15
|
-
"local-endpoint"
|
|
16
|
-
];
|
|
17
|
-
function isJudgeKind(value) {
|
|
18
|
-
return typeof value === "string" && JUDGE_KINDS.includes(value);
|
|
19
|
-
}
|
|
20
|
-
function assertJudgeKindEnabled(kind, enabled) {
|
|
21
|
-
if (!enabled) throw new EventDomainError("JUDGE_KIND_DISABLED", `the ${kind} judge kind is disabled`);
|
|
22
|
-
}
|
|
23
2
|
//#endregion
|
|
24
3
|
//#region src/network/iana-special-purpose.ts
|
|
25
4
|
/** Checked-in IANA policy; network code must never refresh or consult it at runtime. */
|
|
@@ -464,23 +443,30 @@ function embeddedAddresses(address, options) {
|
|
|
464
443
|
embedded.push(ipv4From(address.value >> 64n));
|
|
465
444
|
embedded.push(ipv4From((address.value ^ IPV4_MAX) & IPV4_MAX));
|
|
466
445
|
}
|
|
446
|
+
const isatapInterface = address.value >> 32n & IPV4_MAX;
|
|
447
|
+
if (isatapInterface === 24318n || isatapInterface === 33578750n) embedded.push(ipv4From(address.value));
|
|
467
448
|
return embedded;
|
|
468
449
|
}
|
|
469
450
|
function assertOne(address, approved, options, seen) {
|
|
470
451
|
if (seen.has(`${address.family}:${address.value}`)) return [];
|
|
471
452
|
seen.add(`${address.family}:${address.value}`);
|
|
472
453
|
if (isUnconditionallyDenied(address)) throw new AddressPolicyError(`address ${address.address} is metadata or link-local and is always refused`);
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
454
|
+
if (options.addressMode === "global-only") {
|
|
455
|
+
if (!globallyReachable(address)) throw new AddressPolicyError(`non-global address ${address.address} is refused by global-only policy`);
|
|
456
|
+
} else {
|
|
457
|
+
if (approved === void 0) throw new AddressPolicyError("approvedAddressSet was unavailable");
|
|
458
|
+
const explicitlyApproved = approved.some((entry) => inCidr(address, entry));
|
|
459
|
+
if (!globallyReachable(address) && !explicitlyApproved) throw new AddressPolicyError(`non-global address ${address.address} needs an exact approvedAddressSet entry`);
|
|
460
|
+
if (!explicitlyApproved) throw new AddressPolicyError(`address ${address.address} is not in the approvedAddressSet`);
|
|
461
|
+
}
|
|
476
462
|
const nested = embeddedAddresses(address, options);
|
|
477
463
|
for (const child of nested) assertOne(child, approved, options, seen);
|
|
478
464
|
return nested;
|
|
479
465
|
}
|
|
480
|
-
/** Validates the literal itself and every embedded transition address
|
|
466
|
+
/** Validates the literal itself and every embedded transition address under the selected exact-set or global-only policy. */
|
|
481
467
|
function assertAddressAllowed(input, options) {
|
|
482
468
|
const address = parseIpLiteral(input);
|
|
483
|
-
const embedded = assertOne(address, parseApprovedAddressSet(options.approvedAddressSet), options, /* @__PURE__ */ new Set());
|
|
469
|
+
const embedded = assertOne(address, options.addressMode === "global-only" ? void 0 : parseApprovedAddressSet(options.approvedAddressSet), options, /* @__PURE__ */ new Set());
|
|
484
470
|
return {
|
|
485
471
|
address: address.address,
|
|
486
472
|
family: address.family,
|
|
@@ -518,6 +504,31 @@ function validateLocalEndpoint(input, approvedAddressSet) {
|
|
|
518
504
|
};
|
|
519
505
|
}
|
|
520
506
|
//#endregion
|
|
507
|
+
//#region src/domain/lifecycle.ts
|
|
508
|
+
/** A content-free domain refusal. No caller should substitute an arbitrary Error message at a control boundary. */
|
|
509
|
+
var EventDomainError = class extends Error {
|
|
510
|
+
code;
|
|
511
|
+
constructor(code, message) {
|
|
512
|
+
super(message);
|
|
513
|
+
this.name = "EventDomainError";
|
|
514
|
+
this.code = code;
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
const JUDGE_KIND_TYPESAFE = "typesafe";
|
|
518
|
+
const JUDGE_KIND_LAYA = "laya";
|
|
519
|
+
const JUDGE_KIND_LOCAL_ENDPOINT = "local-endpoint";
|
|
520
|
+
const JUDGE_KINDS = [
|
|
521
|
+
JUDGE_KIND_TYPESAFE,
|
|
522
|
+
JUDGE_KIND_LAYA,
|
|
523
|
+
JUDGE_KIND_LOCAL_ENDPOINT
|
|
524
|
+
];
|
|
525
|
+
function isJudgeKind(value) {
|
|
526
|
+
return typeof value === "string" && JUDGE_KINDS.includes(value);
|
|
527
|
+
}
|
|
528
|
+
function assertJudgeKindEnabled(kind, enabled) {
|
|
529
|
+
if (!enabled) throw new EventDomainError("JUDGE_KIND_DISABLED", `the ${kind} judge kind is disabled`);
|
|
530
|
+
}
|
|
531
|
+
//#endregion
|
|
521
532
|
//#region src/domain/webhook-target.ts
|
|
522
533
|
function fail(message) {
|
|
523
534
|
throw new EventDomainError("VERSION_DOCUMENT_INVALID", message);
|
|
@@ -659,4 +670,4 @@ function webhookDeliveryTarget(document) {
|
|
|
659
670
|
};
|
|
660
671
|
}
|
|
661
672
|
//#endregion
|
|
662
|
-
export {
|
|
673
|
+
export { EventDomainError as a, JUDGE_KIND_LOCAL_ENDPOINT as c, isJudgeKind as d, validateLocalEndpoint as f, parseIpLiteral as g, assertApprovedAddressSet as h, webhookDeliveryTarget as i, JUDGE_KIND_TYPESAFE as l, assertAddressAllowed as m, canonicalWebhookTarget as n, JUDGE_KINDS as o, AddressPolicyError as p, secretWebhookUrlDescriptor as r, JUDGE_KIND_LAYA as s, canonicalSecretWebhookUrl as t, assertJudgeKindEnabled as u };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentcomms/events-daemon",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "The local event service for agent-communications: rules you approve deliver Gmail, Slack, Resend and WhatsApp events to a signed webhook, a local live stream or a dry-run log.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@agentcomms/gmail": "0.
|
|
38
|
-
"@agentcomms/events": "0.
|
|
39
|
-
"@agentcomms/slack": "0.
|
|
40
|
-
"@agentcomms/
|
|
41
|
-
"@agentcomms/
|
|
42
|
-
"@agentcomms/
|
|
37
|
+
"@agentcomms/gmail": "0.17.0",
|
|
38
|
+
"@agentcomms/events": "0.17.0",
|
|
39
|
+
"@agentcomms/slack": "0.17.0",
|
|
40
|
+
"@agentcomms/resend": "0.17.0",
|
|
41
|
+
"@agentcomms/whatsapp": "0.17.0",
|
|
42
|
+
"@agentcomms/core": "0.17.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@modelcontextprotocol/client": "2.0.0",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"typecheck": "tsc -p tsconfig.json",
|
|
71
71
|
"test": "node --import ../../test/helpers/loopback-seal-preload.mjs --experimental-strip-types --disable-warning=ExperimentalWarning --test \"test/**/*.test.ts\""
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "15bf25acc4a5a1b75953c75873870a49f4fa1472"
|
|
74
74
|
}
|