@lucern/contracts 0.1.0-alpha.3 → 0.1.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/auth-session.contract.d.ts +50 -5
- package/dist/auth-session.contract.d.ts.map +1 -1
- package/dist/auth-session.contract.js +46 -5
- package/dist/auth-session.contract.js.map +1 -1
- package/dist/context-pack.contract.d.ts.map +1 -1
- package/dist/gateway.contract.d.ts +0 -1
- package/dist/gateway.contract.d.ts.map +1 -1
- package/dist/gateway.contract.js +1 -9
- package/dist/gateway.contract.js.map +1 -1
- package/dist/index.d.ts +0 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -8
- package/dist/index.js.map +1 -1
- package/dist/workflow-runtime.contract.d.ts.map +1 -1
- package/package.json +1 -34
- package/README.md +0 -43
- package/dist/auth-context.contract.d.ts +0 -9
- package/dist/auth-context.contract.d.ts.map +0 -1
- package/dist/auth-context.contract.js +0 -9
- package/dist/auth-context.contract.js.map +0 -1
- package/dist/auth.contract.d.ts +0 -89
- package/dist/auth.contract.d.ts.map +0 -1
- package/dist/auth.contract.js +0 -58
- package/dist/auth.contract.js.map +0 -1
- package/dist/convex-admin.contract.d.ts +0 -6
- package/dist/convex-admin.contract.d.ts.map +0 -1
- package/dist/convex-admin.contract.js +0 -2
- package/dist/convex-admin.contract.js.map +0 -1
- package/dist/events-types.contract.d.ts +0 -9
- package/dist/events-types.contract.d.ts.map +0 -1
- package/dist/events-types.contract.js +0 -9
- package/dist/events-types.contract.js.map +0 -1
- package/dist/events.contract.d.ts +0 -177
- package/dist/events.contract.d.ts.map +0 -1
- package/dist/events.contract.js +0 -160
- package/dist/events.contract.js.map +0 -1
- package/dist/ids.contract.d.ts +0 -8
- package/dist/ids.contract.d.ts.map +0 -1
- package/dist/ids.contract.js +0 -25
- package/dist/ids.contract.js.map +0 -1
- package/dist/ontology-matching.contract.d.ts +0 -9
- package/dist/ontology-matching.contract.d.ts.map +0 -1
- package/dist/ontology-matching.contract.js +0 -9
- package/dist/ontology-matching.contract.js.map +0 -1
- package/dist/text-matching.contract.d.ts +0 -54
- package/dist/text-matching.contract.d.ts.map +0 -1
- package/dist/text-matching.contract.js +0 -278
- package/dist/text-matching.contract.js.map +0 -1
- package/dist/topic-scope.contract.d.ts +0 -9
- package/dist/topic-scope.contract.d.ts.map +0 -1
- package/dist/topic-scope.contract.js +0 -9
- package/dist/topic-scope.contract.js.map +0 -1
- package/dist/v1/agents/v1.d.ts +0 -9
- package/dist/v1/agents/v1.d.ts.map +0 -1
- package/dist/v1/agents/v1.js +0 -2
- package/dist/v1/agents/v1.js.map +0 -1
- package/dist/v1/beliefs/v1.d.ts +0 -9
- package/dist/v1/beliefs/v1.d.ts.map +0 -1
- package/dist/v1/beliefs/v1.js +0 -2
- package/dist/v1/beliefs/v1.js.map +0 -1
- package/dist/v1/evidence/v1.d.ts +0 -9
- package/dist/v1/evidence/v1.d.ts.map +0 -1
- package/dist/v1/evidence/v1.js +0 -2
- package/dist/v1/evidence/v1.js.map +0 -1
- package/dist/v1/graph/v1.d.ts +0 -9
- package/dist/v1/graph/v1.d.ts.map +0 -1
- package/dist/v1/graph/v1.js +0 -2
- package/dist/v1/graph/v1.js.map +0 -1
- package/dist/v1/ontologies/v1.d.ts +0 -77
- package/dist/v1/ontologies/v1.d.ts.map +0 -1
- package/dist/v1/ontologies/v1.js +0 -179
- package/dist/v1/ontologies/v1.js.map +0 -1
- package/dist/v1/questions/v1.d.ts +0 -9
- package/dist/v1/questions/v1.d.ts.map +0 -1
- package/dist/v1/questions/v1.js +0 -2
- package/dist/v1/questions/v1.js.map +0 -1
- package/dist/v1/topics/v1.d.ts +0 -20
- package/dist/v1/topics/v1.d.ts.map +0 -1
- package/dist/v1/topics/v1.js +0 -62
- package/dist/v1/topics/v1.js.map +0 -1
- package/dist/v1/worktrees/v1.d.ts +0 -9
- package/dist/v1/worktrees/v1.d.ts.map +0 -1
- package/dist/v1/worktrees/v1.js +0 -2
- package/dist/v1/worktrees/v1.js.map +0 -1
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @lucern/contracts — events-types compat shim
|
|
3
|
-
*
|
|
4
|
-
* This file consolidated into ./events.contract.ts during EK-16 T1 PR 3b.
|
|
5
|
-
* Retained here until the Lucern 1.0.0 barrel-sunset cut (D12).
|
|
6
|
-
* New code should import from "@lucern/contracts" (barrel) or "./events.contract".
|
|
7
|
-
*/
|
|
8
|
-
export * from "./events.contract";
|
|
9
|
-
//# sourceMappingURL=events-types.contract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events-types.contract.js","sourceRoot":"","sources":["../src/events-types.contract.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,mBAAmB,CAAC"}
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @lucern/contracts — events (canonical support contract)
|
|
3
|
-
*
|
|
4
|
-
* Consolidated flat support surface for Lucern's domain event stream:
|
|
5
|
-
* - Event type definitions, constants, and shared enums
|
|
6
|
-
* - Event construction + cursor helpers
|
|
7
|
-
*
|
|
8
|
-
* Consolidated from the former split type-definition module
|
|
9
|
-
* and the prior src/events.contract.ts (helpers) in EK-16 T1 PR 3b.
|
|
10
|
-
* Compat shim remains at the old events-types path until Lucern 1.0.0 (D12).
|
|
11
|
-
*/
|
|
12
|
-
export declare const DOMAIN_EVENT_VERSION: "1.0";
|
|
13
|
-
export declare const EVENT_RETENTION_DEFAULT_DAYS = 30;
|
|
14
|
-
export declare const WEBHOOK_MAX_ATTEMPTS = 5;
|
|
15
|
-
export declare const WEBHOOK_RETRY_DELAYS_MS: readonly [1000, 5000, 30000, 300000];
|
|
16
|
-
export declare const DOMAIN_EVENT_TYPES: readonly ["belief.created", "belief.forked", "belief.confidence_updated", "belief.archived", "belief.refined", "belief.contract_created", "belief.contract_evaluated", "belief.lineage_queried", "evidence.created", "evidence.linked", "evidence.search_executed", "question.created", "question.answered", "question.refined", "question.status_updated", "question.archived", "edge.created", "contradiction.flagged", "worktree.created", "worktree.activated", "worktree.merged", "worktree.targets_updated", "worktree.metadata_updated", "topic.created", "topic.updated", "topic.archived", "task.created", "task.completed", "task.updated", "ontology.bound", "context.compiled", "identity.key_created", "identity.key_rotated", "identity.key_revoked", "webhook.test"];
|
|
17
|
-
export type DomainEventType = (typeof DOMAIN_EVENT_TYPES)[number];
|
|
18
|
-
export type DomainResourceType = "belief" | "evidence" | "question" | "edge" | "contradiction" | "worktree" | "topic" | "task" | "ontology" | "context" | "identity" | "webhook";
|
|
19
|
-
export type DomainActorType = "human" | "agent" | "service";
|
|
20
|
-
export type DomainEventData = Record<string, unknown>;
|
|
21
|
-
export type DomainEvent = {
|
|
22
|
-
eventId: string;
|
|
23
|
-
type: DomainEventType | string;
|
|
24
|
-
version: typeof DOMAIN_EVENT_VERSION;
|
|
25
|
-
timestamp: number;
|
|
26
|
-
tenantId?: string;
|
|
27
|
-
workspaceId?: string;
|
|
28
|
-
topicId: string;
|
|
29
|
-
resourceId: string;
|
|
30
|
-
resourceType: DomainResourceType | string;
|
|
31
|
-
actorId: string;
|
|
32
|
-
actorType: DomainActorType;
|
|
33
|
-
data: DomainEventData;
|
|
34
|
-
correlationId?: string;
|
|
35
|
-
expiresAt: number;
|
|
36
|
-
};
|
|
37
|
-
export type CreateDomainEventInput = {
|
|
38
|
-
eventId?: string;
|
|
39
|
-
timestamp?: number;
|
|
40
|
-
tenantId?: string;
|
|
41
|
-
workspaceId?: string;
|
|
42
|
-
topicId: string;
|
|
43
|
-
type: DomainEventType | string;
|
|
44
|
-
resourceId: string;
|
|
45
|
-
resourceType: DomainResourceType | string;
|
|
46
|
-
actorId: string;
|
|
47
|
-
actorType: DomainActorType;
|
|
48
|
-
data?: DomainEventData;
|
|
49
|
-
correlationId?: string;
|
|
50
|
-
retentionDays?: number;
|
|
51
|
-
};
|
|
52
|
-
export type EventCursor = {
|
|
53
|
-
timestamp: number;
|
|
54
|
-
eventId: string;
|
|
55
|
-
};
|
|
56
|
-
export type EventListQuery = {
|
|
57
|
-
topicId?: string;
|
|
58
|
-
after?: string;
|
|
59
|
-
types?: string[];
|
|
60
|
-
startTime?: number;
|
|
61
|
-
endTime?: number;
|
|
62
|
-
limit?: number;
|
|
63
|
-
};
|
|
64
|
-
export type EventListResult = {
|
|
65
|
-
events: DomainEvent[];
|
|
66
|
-
nextCursor: string | null;
|
|
67
|
-
};
|
|
68
|
-
export type WebhookSecretMode = "configured";
|
|
69
|
-
export type WebhookRecord = {
|
|
70
|
-
id: string;
|
|
71
|
-
webhookId: string;
|
|
72
|
-
tenantId?: string;
|
|
73
|
-
workspaceId?: string;
|
|
74
|
-
topicId?: string;
|
|
75
|
-
url: string;
|
|
76
|
-
events: string[];
|
|
77
|
-
active: boolean;
|
|
78
|
-
secretConfigured: boolean;
|
|
79
|
-
createdAt: number;
|
|
80
|
-
updatedAt: number;
|
|
81
|
-
createdBy: string;
|
|
82
|
-
updatedBy: string;
|
|
83
|
-
lastDeliveryAt?: number;
|
|
84
|
-
lastSuccessfulDeliveryAt?: number;
|
|
85
|
-
};
|
|
86
|
-
export type WebhookCreateInput = {
|
|
87
|
-
url: string;
|
|
88
|
-
events: string[];
|
|
89
|
-
secret: string;
|
|
90
|
-
topicId?: string;
|
|
91
|
-
active?: boolean;
|
|
92
|
-
};
|
|
93
|
-
export type WebhookUpdateInput = {
|
|
94
|
-
url?: string;
|
|
95
|
-
events?: string[];
|
|
96
|
-
secret?: string;
|
|
97
|
-
topicId?: string | null;
|
|
98
|
-
active?: boolean;
|
|
99
|
-
};
|
|
100
|
-
export type WebhookDeliveryStatus = "pending" | "delivering" | "succeeded" | "failed" | "dead_letter";
|
|
101
|
-
export type WebhookDeliveryRecord = {
|
|
102
|
-
id: string;
|
|
103
|
-
deliveryId: string;
|
|
104
|
-
webhookId: string;
|
|
105
|
-
eventId: string;
|
|
106
|
-
eventType: string;
|
|
107
|
-
topicId: string;
|
|
108
|
-
status: WebhookDeliveryStatus;
|
|
109
|
-
attemptCount: number;
|
|
110
|
-
maxAttempts: number;
|
|
111
|
-
nextAttemptAt?: number;
|
|
112
|
-
lastAttemptAt?: number;
|
|
113
|
-
lastStatusCode?: number;
|
|
114
|
-
lastError?: string;
|
|
115
|
-
deliveredAt?: number;
|
|
116
|
-
createdAt: number;
|
|
117
|
-
updatedAt: number;
|
|
118
|
-
};
|
|
119
|
-
export type WebhookDeliveryAttemptRecord = {
|
|
120
|
-
id: string;
|
|
121
|
-
attemptId: string;
|
|
122
|
-
deliveryId: string;
|
|
123
|
-
webhookId: string;
|
|
124
|
-
eventId: string;
|
|
125
|
-
eventType: string;
|
|
126
|
-
attemptNumber: number;
|
|
127
|
-
status: "succeeded" | "failed";
|
|
128
|
-
statusCode?: number;
|
|
129
|
-
error?: string;
|
|
130
|
-
responseBody?: string;
|
|
131
|
-
durationMs?: number;
|
|
132
|
-
createdAt: number;
|
|
133
|
-
};
|
|
134
|
-
export type WebhookDeliveriesResult = {
|
|
135
|
-
deliveries: Array<WebhookDeliveryRecord & {
|
|
136
|
-
attempts?: WebhookDeliveryAttemptRecord[];
|
|
137
|
-
}>;
|
|
138
|
-
};
|
|
139
|
-
export type WebhookHealthResult = {
|
|
140
|
-
webhookId: string;
|
|
141
|
-
totalAttempts: number;
|
|
142
|
-
successfulAttempts: number;
|
|
143
|
-
failedAttempts: number;
|
|
144
|
-
successRate: number;
|
|
145
|
-
pendingDeliveries: number;
|
|
146
|
-
deadLetterDeliveries: number;
|
|
147
|
-
lastDeliveryAt?: number;
|
|
148
|
-
lastSuccessfulDeliveryAt?: number;
|
|
149
|
-
};
|
|
150
|
-
export type WebhookTestResult = {
|
|
151
|
-
webhookId: string;
|
|
152
|
-
deliveryId: string;
|
|
153
|
-
status: WebhookDeliveryStatus;
|
|
154
|
-
attempts: number;
|
|
155
|
-
};
|
|
156
|
-
export type ReplayEventsInput = EventListQuery & {
|
|
157
|
-
webhookId?: string;
|
|
158
|
-
};
|
|
159
|
-
export type ReplayEventsResult = EventListResult & {
|
|
160
|
-
replayedDeliveries?: number;
|
|
161
|
-
replayedWebhookId?: string;
|
|
162
|
-
};
|
|
163
|
-
export declare function createEventId(): string;
|
|
164
|
-
export declare function normalizeRetentionDays(value: number | undefined): number;
|
|
165
|
-
export declare function buildDomainEvent(input: CreateDomainEventInput): DomainEvent;
|
|
166
|
-
export declare function compareEventCursor(left: EventCursor, right: EventCursor): number;
|
|
167
|
-
export declare function encodeEventCursor(cursor: EventCursor): string;
|
|
168
|
-
export declare function decodeEventCursor(cursor: string | undefined): EventCursor | null;
|
|
169
|
-
export declare function isAfterCursor(event: Pick<DomainEvent, "timestamp" | "eventId">, cursor: EventCursor | null): boolean;
|
|
170
|
-
export declare function sortEventsByCursor<T extends Pick<DomainEvent, "timestamp" | "eventId">>(events: readonly T[]): T[];
|
|
171
|
-
export declare function inferActorType(args: {
|
|
172
|
-
sessionType?: "agent" | "user";
|
|
173
|
-
authMode?: string;
|
|
174
|
-
principalType?: string;
|
|
175
|
-
}): DomainActorType;
|
|
176
|
-
export declare function emitDomainEvent(invokeMutation: (reference: any, args: CreateDomainEventInput) => Promise<unknown>, input: CreateDomainEventInput): Promise<unknown>;
|
|
177
|
-
//# sourceMappingURL=events.contract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.contract.d.ts","sourceRoot":"","sources":["../src/events.contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAOH,eAAO,MAAM,oBAAoB,OAAiB,CAAC;AACnD,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAC/C,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,uBAAuB,sCAA2C,CAAC;AAEhF,eAAO,MAAM,kBAAkB,qvBAoCrB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE,MAAM,MAAM,kBAAkB,GAC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MAAM,GAAG,SAAS,GAAG,MAAM,CAKxE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,sBAAsB,GAAG,WAAW,CAmB3E;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CAKhF;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAE7D;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,IAAI,CAqBhF;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,SAAS,CAAC,EACjD,MAAM,EAAE,WAAW,GAAG,IAAI,GACzB,OAAO,CAKT;AAED,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,SAAS,CAAC,EACrF,MAAM,EAAE,SAAS,CAAC,EAAE,GACnB,CAAC,EAAE,CAEL;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE;IACnC,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,eAAe,CAYlB;AAED,wBAAsB,eAAe,CACnC,cAAc,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,sBAAsB,KAAK,OAAO,CAAC,OAAO,CAAC,EAClF,KAAK,EAAE,sBAAsB,GAC5B,OAAO,CAAC,OAAO,CAAC,CAElB"}
|
package/dist/events.contract.js
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @lucern/contracts — events (canonical support contract)
|
|
3
|
-
*
|
|
4
|
-
* Consolidated flat support surface for Lucern's domain event stream:
|
|
5
|
-
* - Event type definitions, constants, and shared enums
|
|
6
|
-
* - Event construction + cursor helpers
|
|
7
|
-
*
|
|
8
|
-
* Consolidated from the former split type-definition module
|
|
9
|
-
* and the prior src/events.contract.ts (helpers) in EK-16 T1 PR 3b.
|
|
10
|
-
* Compat shim remains at the old events-types path until Lucern 1.0.0 (D12).
|
|
11
|
-
*/
|
|
12
|
-
// =============================================================================
|
|
13
|
-
// EVENT TYPE DEFINITIONS & CONSTANTS
|
|
14
|
-
// (Formerly the split events type-definition module)
|
|
15
|
-
// =============================================================================
|
|
16
|
-
export const DOMAIN_EVENT_VERSION = "1.0";
|
|
17
|
-
export const EVENT_RETENTION_DEFAULT_DAYS = 30;
|
|
18
|
-
export const WEBHOOK_MAX_ATTEMPTS = 5;
|
|
19
|
-
export const WEBHOOK_RETRY_DELAYS_MS = [1_000, 5_000, 30_000, 300_000];
|
|
20
|
-
export const DOMAIN_EVENT_TYPES = [
|
|
21
|
-
"belief.created",
|
|
22
|
-
"belief.forked",
|
|
23
|
-
"belief.confidence_updated",
|
|
24
|
-
"belief.archived",
|
|
25
|
-
"belief.refined",
|
|
26
|
-
"belief.contract_created",
|
|
27
|
-
"belief.contract_evaluated",
|
|
28
|
-
"belief.lineage_queried",
|
|
29
|
-
"evidence.created",
|
|
30
|
-
"evidence.linked",
|
|
31
|
-
"evidence.search_executed",
|
|
32
|
-
"question.created",
|
|
33
|
-
"question.answered",
|
|
34
|
-
"question.refined",
|
|
35
|
-
"question.status_updated",
|
|
36
|
-
"question.archived",
|
|
37
|
-
"edge.created",
|
|
38
|
-
"contradiction.flagged",
|
|
39
|
-
"worktree.created",
|
|
40
|
-
"worktree.activated",
|
|
41
|
-
"worktree.merged",
|
|
42
|
-
"worktree.targets_updated",
|
|
43
|
-
"worktree.metadata_updated",
|
|
44
|
-
"topic.created",
|
|
45
|
-
"topic.updated",
|
|
46
|
-
"topic.archived",
|
|
47
|
-
"task.created",
|
|
48
|
-
"task.completed",
|
|
49
|
-
"task.updated",
|
|
50
|
-
"ontology.bound",
|
|
51
|
-
"context.compiled",
|
|
52
|
-
"identity.key_created",
|
|
53
|
-
"identity.key_rotated",
|
|
54
|
-
"identity.key_revoked",
|
|
55
|
-
"webhook.test",
|
|
56
|
-
];
|
|
57
|
-
// =============================================================================
|
|
58
|
-
// EVENT HELPERS
|
|
59
|
-
// (Formerly the body of src/events.contract.ts)
|
|
60
|
-
// =============================================================================
|
|
61
|
-
function toBase64(value) {
|
|
62
|
-
if (typeof Buffer !== "undefined") {
|
|
63
|
-
return Buffer.from(value, "utf8").toString("base64url");
|
|
64
|
-
}
|
|
65
|
-
return btoa(unescape(encodeURIComponent(value)))
|
|
66
|
-
.replace(/\+/g, "-")
|
|
67
|
-
.replace(/\//g, "_")
|
|
68
|
-
.replace(/=+$/g, "");
|
|
69
|
-
}
|
|
70
|
-
function fromBase64(value) {
|
|
71
|
-
if (typeof Buffer !== "undefined") {
|
|
72
|
-
return Buffer.from(value, "base64url").toString("utf8");
|
|
73
|
-
}
|
|
74
|
-
const normalized = value.replace(/-/g, "+").replace(/_/g, "/");
|
|
75
|
-
return decodeURIComponent(escape(atob(normalized)));
|
|
76
|
-
}
|
|
77
|
-
export function createEventId() {
|
|
78
|
-
const random = crypto.randomUUID().replace(/-/g, "");
|
|
79
|
-
return `evt_${random}`;
|
|
80
|
-
}
|
|
81
|
-
export function normalizeRetentionDays(value) {
|
|
82
|
-
if (!Number.isFinite(value) || typeof value !== "number" || value <= 0) {
|
|
83
|
-
return EVENT_RETENTION_DEFAULT_DAYS;
|
|
84
|
-
}
|
|
85
|
-
return Math.max(1, Math.trunc(value));
|
|
86
|
-
}
|
|
87
|
-
export function buildDomainEvent(input) {
|
|
88
|
-
const timestamp = input.timestamp ?? Date.now();
|
|
89
|
-
const retentionDays = normalizeRetentionDays(input.retentionDays);
|
|
90
|
-
return {
|
|
91
|
-
eventId: input.eventId?.trim() || createEventId(),
|
|
92
|
-
type: input.type.trim(),
|
|
93
|
-
version: DOMAIN_EVENT_VERSION,
|
|
94
|
-
timestamp,
|
|
95
|
-
tenantId: input.tenantId?.trim() || undefined,
|
|
96
|
-
workspaceId: input.workspaceId?.trim() || undefined,
|
|
97
|
-
topicId: input.topicId.trim(),
|
|
98
|
-
resourceId: input.resourceId.trim(),
|
|
99
|
-
resourceType: input.resourceType.trim(),
|
|
100
|
-
actorId: input.actorId.trim(),
|
|
101
|
-
actorType: input.actorType,
|
|
102
|
-
data: input.data ?? {},
|
|
103
|
-
correlationId: input.correlationId?.trim() || undefined,
|
|
104
|
-
expiresAt: timestamp + retentionDays * 24 * 60 * 60 * 1000,
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
export function compareEventCursor(left, right) {
|
|
108
|
-
if (left.timestamp !== right.timestamp) {
|
|
109
|
-
return left.timestamp - right.timestamp;
|
|
110
|
-
}
|
|
111
|
-
return left.eventId.localeCompare(right.eventId);
|
|
112
|
-
}
|
|
113
|
-
export function encodeEventCursor(cursor) {
|
|
114
|
-
return toBase64(JSON.stringify(cursor));
|
|
115
|
-
}
|
|
116
|
-
export function decodeEventCursor(cursor) {
|
|
117
|
-
if (!cursor || cursor.trim().length === 0) {
|
|
118
|
-
return null;
|
|
119
|
-
}
|
|
120
|
-
try {
|
|
121
|
-
const parsed = JSON.parse(fromBase64(cursor.trim()));
|
|
122
|
-
if (typeof parsed.timestamp !== "number" ||
|
|
123
|
-
!Number.isFinite(parsed.timestamp) ||
|
|
124
|
-
typeof parsed.eventId !== "string" ||
|
|
125
|
-
parsed.eventId.trim().length === 0) {
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
return {
|
|
129
|
-
timestamp: parsed.timestamp,
|
|
130
|
-
eventId: parsed.eventId.trim(),
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
catch {
|
|
134
|
-
return null;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
export function isAfterCursor(event, cursor) {
|
|
138
|
-
if (!cursor) {
|
|
139
|
-
return true;
|
|
140
|
-
}
|
|
141
|
-
return compareEventCursor(event, cursor) > 0;
|
|
142
|
-
}
|
|
143
|
-
export function sortEventsByCursor(events) {
|
|
144
|
-
return [...events].sort((left, right) => compareEventCursor(left, right));
|
|
145
|
-
}
|
|
146
|
-
export function inferActorType(args) {
|
|
147
|
-
if (args.sessionType === "agent") {
|
|
148
|
-
return "agent";
|
|
149
|
-
}
|
|
150
|
-
if (args.authMode === "service_principal" ||
|
|
151
|
-
args.authMode === "tenant_api_key" ||
|
|
152
|
-
args.principalType === "service") {
|
|
153
|
-
return "service";
|
|
154
|
-
}
|
|
155
|
-
return "human";
|
|
156
|
-
}
|
|
157
|
-
export async function emitDomainEvent(invokeMutation, input) {
|
|
158
|
-
return await invokeMutation("events:recordEvent", input);
|
|
159
|
-
}
|
|
160
|
-
//# sourceMappingURL=events.contract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.contract.js","sourceRoot":"","sources":["../src/events.contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,gFAAgF;AAChF,qCAAqC;AACrC,qDAAqD;AACrD,gFAAgF;AAEhF,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAc,CAAC;AACnD,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,CAAC;AAC/C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AACtC,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAU,CAAC;AAEhF,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,gBAAgB;IAChB,eAAe;IACf,2BAA2B;IAC3B,iBAAiB;IACjB,gBAAgB;IAChB,yBAAyB;IACzB,2BAA2B;IAC3B,wBAAwB;IACxB,kBAAkB;IAClB,iBAAiB;IACjB,0BAA0B;IAC1B,kBAAkB;IAClB,mBAAmB;IACnB,kBAAkB;IAClB,yBAAyB;IACzB,mBAAmB;IACnB,cAAc;IACd,uBAAuB;IACvB,kBAAkB;IAClB,oBAAoB;IACpB,iBAAiB;IAC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3B,KAAiD,EACjD,MAA0B;IAE1B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,kBAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,MAAoB;IAEpB,OAAO,CAAC,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,kBAAkB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAI9B;IACC,IAAI,IAAI,CAAC,WAAW,KAAK,OAAO,EAAE,CAAC;QACjC,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,IACE,IAAI,CAAC,QAAQ,KAAK,mBAAmB;QACrC,IAAI,CAAC,QAAQ,KAAK,gBAAgB;QAClC,IAAI,CAAC,aAAa,KAAK,SAAS,EAChC,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,cAAkF,EAClF,KAA6B;IAE7B,OAAO,MAAM,cAAc,CAAC,oBAA2B,EAAE,KAAK,CAAC,CAAC;AAClE,CAAC"}
|
package/dist/ids.contract.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export type DecodedPrefixedId = {
|
|
2
|
-
prefix: string;
|
|
3
|
-
value: string;
|
|
4
|
-
};
|
|
5
|
-
export declare function encodePrefixedId(prefix: string, value: string): string;
|
|
6
|
-
export declare function decodePrefixedId(id: string): DecodedPrefixedId;
|
|
7
|
-
export declare function hasPrefixedIdPrefix(id: string, prefix: string): boolean;
|
|
8
|
-
//# sourceMappingURL=ids.contract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ids.contract.d.ts","sourceRoot":"","sources":["../src/ids.contract.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAIF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAStE;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,iBAAiB,CAY9D;AAED,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAGvE"}
|
package/dist/ids.contract.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const PREFIXED_ID_PATTERN = /^([a-z][a-z0-9]*)_(.+)$/;
|
|
2
|
-
export function encodePrefixedId(prefix, value) {
|
|
3
|
-
const normalizedPrefix = prefix.trim();
|
|
4
|
-
const normalizedValue = value.trim();
|
|
5
|
-
if (!normalizedPrefix || !normalizedValue) {
|
|
6
|
-
throw new Error("Both prefix and value are required to encode a prefixed ID.");
|
|
7
|
-
}
|
|
8
|
-
return `${normalizedPrefix}_${normalizedValue}`;
|
|
9
|
-
}
|
|
10
|
-
export function decodePrefixedId(id) {
|
|
11
|
-
const normalized = id.trim();
|
|
12
|
-
const match = PREFIXED_ID_PATTERN.exec(normalized);
|
|
13
|
-
if (!match) {
|
|
14
|
-
throw new Error(`Invalid prefixed ID: ${id}`);
|
|
15
|
-
}
|
|
16
|
-
return {
|
|
17
|
-
prefix: match[1],
|
|
18
|
-
value: match[2],
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export function hasPrefixedIdPrefix(id, prefix) {
|
|
22
|
-
const decoded = decodePrefixedId(id);
|
|
23
|
-
return decoded.prefix === prefix.trim();
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=ids.contract.js.map
|
package/dist/ids.contract.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ids.contract.js","sourceRoot":"","sources":["../src/ids.contract.ts"],"names":[],"mappings":"AAKA,MAAM,mBAAmB,GAAG,yBAAyB,CAAC;AAEtD,MAAM,UAAU,gBAAgB,CAAC,MAAc,EAAE,KAAa;IAC5D,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;IACvC,MAAM,eAAe,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAErC,IAAI,CAAC,gBAAgB,IAAI,CAAC,eAAe,EAAE,CAAC;QAC1C,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACjF,CAAC;IAED,OAAO,GAAG,gBAAgB,IAAI,eAAe,EAAE,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,EAAU;IACzC,MAAM,UAAU,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;IAC7B,MAAM,KAAK,GAAG,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAEnD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,wBAAwB,EAAE,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,OAAO;QACL,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;QAChB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;KAChB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,EAAU,EAAE,MAAc;IAC5D,MAAM,OAAO,GAAG,gBAAgB,CAAC,EAAE,CAAC,CAAC;IACrC,OAAO,OAAO,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @lucern/contracts — ontology-matching compat shim
|
|
3
|
-
*
|
|
4
|
-
* This file moved to ./v1/ontologies/v1.ts during EK-16 T1 PR 2.
|
|
5
|
-
* Retained here until the Lucern 1.0.0 barrel-sunset cut (D12).
|
|
6
|
-
* New code should import from "@lucern/contracts/v1/ontologies" directly.
|
|
7
|
-
*/
|
|
8
|
-
export * from "./v1/ontologies/v1";
|
|
9
|
-
//# sourceMappingURL=ontology-matching.contract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ontology-matching.contract.d.ts","sourceRoot":"","sources":["../src/ontology-matching.contract.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,oBAAoB,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @lucern/contracts — ontology-matching compat shim
|
|
3
|
-
*
|
|
4
|
-
* This file moved to ./v1/ontologies/v1.ts during EK-16 T1 PR 2.
|
|
5
|
-
* Retained here until the Lucern 1.0.0 barrel-sunset cut (D12).
|
|
6
|
-
* New code should import from "@lucern/contracts/v1/ontologies" directly.
|
|
7
|
-
*/
|
|
8
|
-
export * from "./v1/ontologies/v1";
|
|
9
|
-
//# sourceMappingURL=ontology-matching.contract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ontology-matching.contract.js","sourceRoot":"","sources":["../src/ontology-matching.contract.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,oBAAoB,CAAC"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared lexical matching primitives used across MCP handlers and graph utilities.
|
|
3
|
-
*
|
|
4
|
-
* The goal is not to replace downstream LLM scoring. It provides a fast,
|
|
5
|
-
* deterministic substrate for candidate generation, reranking, and light
|
|
6
|
-
* classification across belief/question/evidence/entity surfaces.
|
|
7
|
-
*/
|
|
8
|
-
export type LexicalStrategy = "tokenOverlap" | "bigramJaccard" | "wordOverlap";
|
|
9
|
-
export type PreparedLexicalQuery = {
|
|
10
|
-
raw: string;
|
|
11
|
-
tokens: string[];
|
|
12
|
-
words: string[];
|
|
13
|
-
bigrams: Set<string>;
|
|
14
|
-
};
|
|
15
|
-
export type LexicalSignal = {
|
|
16
|
-
strategy?: LexicalStrategy;
|
|
17
|
-
text: string | null | undefined;
|
|
18
|
-
weight: number;
|
|
19
|
-
};
|
|
20
|
-
export type LexicalRerankOptions = {
|
|
21
|
-
lexicalWeight?: number;
|
|
22
|
-
rankWeight?: number;
|
|
23
|
-
};
|
|
24
|
-
/** Tokenize a string into lowercase words, removing stop words. */
|
|
25
|
-
export declare function tokenizeSearchText(text: string): string[];
|
|
26
|
-
/** Simple stemmer: strip common English suffixes for fuzzy matching. */
|
|
27
|
-
export declare function stemToken(word: string): string;
|
|
28
|
-
/** Compute token overlap score between query tokens and text tokens. */
|
|
29
|
-
export declare function tokenOverlapScore(queryTokens: string[], textTokens: string[]): number;
|
|
30
|
-
/**
|
|
31
|
-
* Extract character bigrams from text. Normalizes to lowercase, removes
|
|
32
|
-
* non-alphanumeric characters, and generates overlapping pairs.
|
|
33
|
-
*/
|
|
34
|
-
export declare function bigramTokenize(text: string): Set<string>;
|
|
35
|
-
/**
|
|
36
|
-
* Extract word-level tokens from text (for coarser matching).
|
|
37
|
-
* Normalizes to lowercase, splits on non-alphanumeric.
|
|
38
|
-
*/
|
|
39
|
-
export declare function wordTokenize(text: string): string[];
|
|
40
|
-
/** Jaccard similarity between two sets: |A ∩ B| / |A ∪ B|. */
|
|
41
|
-
export declare function jaccardSimilarity(setA: Set<string>, setB: Set<string>): number;
|
|
42
|
-
/** Exact word overlap score: fraction of type words found in input text. */
|
|
43
|
-
export declare function wordOverlapScore(inputWords: string[], typeWords: string[]): number;
|
|
44
|
-
/** Pre-compute reusable lexical structures for a query. */
|
|
45
|
-
export declare function prepareLexicalQuery(query: string): PreparedLexicalQuery;
|
|
46
|
-
/** Score a single lexical signal against a prepared query. */
|
|
47
|
-
export declare function scoreLexicalSignal(query: PreparedLexicalQuery, signal: LexicalSignal): number;
|
|
48
|
-
/** Weighted lexical score across multiple textual signals. */
|
|
49
|
-
export declare function scoreLexicalSignals(query: PreparedLexicalQuery, signals: LexicalSignal[]): number;
|
|
50
|
-
/** Map a candidate's original rank position into a 0..1 prior. */
|
|
51
|
-
export declare function rankWindowScore(index: number, total: number): number;
|
|
52
|
-
/** Rerank a candidate window by lexical overlap while preserving original-rank prior. */
|
|
53
|
-
export declare function rerankLexicalWindow<T>(query: string, items: T[], getText: (item: T) => string | null | undefined, options?: LexicalRerankOptions): T[];
|
|
54
|
-
//# sourceMappingURL=text-matching.contract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text-matching.contract.d.ts","sourceRoot":"","sources":["../src/text-matching.contract.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG,eAAe,GAAG,aAAa,CAAC;AAE/E,MAAM,MAAM,oBAAoB,GAAG;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAiEF,mEAAmE;AACnE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAKzD;AAED,wEAAwE;AACxE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA2D9C;AAED,wEAAwE;AACxE,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,EAAE,EACrB,UAAU,EAAE,MAAM,EAAE,GACnB,MAAM,CA4BR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