@manta-eu/client 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/LICENSE +21 -0
- package/dist/generated/graphql.d.ts +4719 -0
- package/dist/generated/graphql.d.ts.map +1 -0
- package/dist/generated/graphql.js +2452 -0
- package/dist/graphql-clients.d.ts +9 -0
- package/dist/graphql-clients.d.ts.map +1 -0
- package/dist/graphql-clients.js +27 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/shared/action-plan.d.ts +2 -0
- package/dist/shared/action-plan.d.ts.map +1 -0
- package/dist/shared/action-plan.js +1 -0
- package/dist/shared/agent-mode.d.ts +9 -0
- package/dist/shared/agent-mode.d.ts.map +1 -0
- package/dist/shared/agent-mode.js +38 -0
- package/dist/shared/agent-types.d.ts +41 -0
- package/dist/shared/agent-types.d.ts.map +1 -0
- package/dist/shared/agent-types.js +12 -0
- package/dist/shared/chat-context.d.ts +7 -0
- package/dist/shared/chat-context.d.ts.map +1 -0
- package/dist/shared/chat-context.js +38 -0
- package/dist/shared/chat-manager.d.ts +183 -0
- package/dist/shared/chat-manager.d.ts.map +1 -0
- package/dist/shared/chat-manager.js +75 -0
- package/dist/shared/chat-turn-errors.d.ts +16 -0
- package/dist/shared/chat-turn-errors.d.ts.map +1 -0
- package/dist/shared/chat-turn-errors.js +18 -0
- package/dist/shared/constants.d.ts +11 -0
- package/dist/shared/constants.d.ts.map +1 -0
- package/dist/shared/constants.js +10 -0
- package/dist/shared/conversation-starter-defaults.d.ts +8 -0
- package/dist/shared/conversation-starter-defaults.d.ts.map +1 -0
- package/dist/shared/conversation-starter-defaults.js +20 -0
- package/dist/shared/datastore-id.d.ts +4 -0
- package/dist/shared/datastore-id.d.ts.map +1 -0
- package/dist/shared/datastore-id.js +17 -0
- package/dist/shared/datastore-path.d.ts +19 -0
- package/dist/shared/datastore-path.d.ts.map +1 -0
- package/dist/shared/datastore-path.js +62 -0
- package/dist/shared/datastore-route-table.d.ts +36 -0
- package/dist/shared/datastore-route-table.d.ts.map +1 -0
- package/dist/shared/datastore-route-table.js +43 -0
- package/dist/shared/duration.d.ts +6 -0
- package/dist/shared/duration.d.ts.map +1 -0
- package/dist/shared/duration.js +55 -0
- package/dist/shared/entity-set.d.ts +14 -0
- package/dist/shared/entity-set.d.ts.map +1 -0
- package/dist/shared/entity-set.js +25 -0
- package/dist/shared/error-utils.d.ts +23 -0
- package/dist/shared/error-utils.d.ts.map +1 -0
- package/dist/shared/error-utils.js +56 -0
- package/dist/shared/explorer-paths.d.ts +4 -0
- package/dist/shared/explorer-paths.d.ts.map +1 -0
- package/dist/shared/explorer-paths.js +7 -0
- package/dist/shared/fileIri.d.ts +12 -0
- package/dist/shared/fileIri.d.ts.map +1 -0
- package/dist/shared/fileIri.js +18 -0
- package/dist/shared/index.d.ts +22 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +8 -0
- package/dist/shared/live-context.d.ts +2 -0
- package/dist/shared/live-context.d.ts.map +1 -0
- package/dist/shared/live-context.js +15 -0
- package/dist/shared/maintenance-schedule.d.ts +11 -0
- package/dist/shared/maintenance-schedule.d.ts.map +1 -0
- package/dist/shared/maintenance-schedule.js +38 -0
- package/dist/shared/memory-citation-sampling.d.ts +16 -0
- package/dist/shared/memory-citation-sampling.d.ts.map +1 -0
- package/dist/shared/memory-citation-sampling.js +14 -0
- package/dist/shared/memory-confidence.d.ts +3 -0
- package/dist/shared/memory-confidence.d.ts.map +1 -0
- package/dist/shared/memory-confidence.js +7 -0
- package/dist/shared/memory-consolidation-limits.d.ts +6 -0
- package/dist/shared/memory-consolidation-limits.d.ts.map +1 -0
- package/dist/shared/memory-consolidation-limits.js +5 -0
- package/dist/shared/memory-dates.d.ts +3 -0
- package/dist/shared/memory-dates.d.ts.map +1 -0
- package/dist/shared/memory-dates.js +7 -0
- package/dist/shared/memory-decay.d.ts +22 -0
- package/dist/shared/memory-decay.d.ts.map +1 -0
- package/dist/shared/memory-decay.js +43 -0
- package/dist/shared/memory-diversity.d.ts +10 -0
- package/dist/shared/memory-diversity.d.ts.map +1 -0
- package/dist/shared/memory-diversity.js +44 -0
- package/dist/shared/memory-entity-recall.d.ts +8 -0
- package/dist/shared/memory-entity-recall.d.ts.map +1 -0
- package/dist/shared/memory-entity-recall.js +17 -0
- package/dist/shared/memory-importance.d.ts +4 -0
- package/dist/shared/memory-importance.d.ts.map +1 -0
- package/dist/shared/memory-importance.js +9 -0
- package/dist/shared/memory-keyword-recall.d.ts +13 -0
- package/dist/shared/memory-keyword-recall.d.ts.map +1 -0
- package/dist/shared/memory-keyword-recall.js +141 -0
- package/dist/shared/memory-kind-iris.d.ts +9 -0
- package/dist/shared/memory-kind-iris.d.ts.map +1 -0
- package/dist/shared/memory-kind-iris.js +22 -0
- package/dist/shared/memory-preload-gate.d.ts +37 -0
- package/dist/shared/memory-preload-gate.d.ts.map +1 -0
- package/dist/shared/memory-preload-gate.js +95 -0
- package/dist/shared/memory-sources.d.ts +3 -0
- package/dist/shared/memory-sources.d.ts.map +1 -0
- package/dist/shared/memory-sources.js +3 -0
- package/dist/shared/memory-teams.d.ts +2 -0
- package/dist/shared/memory-teams.d.ts.map +1 -0
- package/dist/shared/memory-teams.js +3 -0
- package/dist/shared/memory-token-budget.d.ts +8 -0
- package/dist/shared/memory-token-budget.d.ts.map +1 -0
- package/dist/shared/memory-token-budget.js +23 -0
- package/dist/shared/memory-volatility.d.ts +24 -0
- package/dist/shared/memory-volatility.d.ts.map +1 -0
- package/dist/shared/memory-volatility.js +55 -0
- package/dist/shared/message-utils.d.ts +12 -0
- package/dist/shared/message-utils.d.ts.map +1 -0
- package/dist/shared/message-utils.js +22 -0
- package/dist/shared/model.d.ts +165 -0
- package/dist/shared/model.d.ts.map +1 -0
- package/dist/shared/model.js +93 -0
- package/dist/shared/org-roles.d.ts +11 -0
- package/dist/shared/org-roles.d.ts.map +1 -0
- package/dist/shared/org-roles.js +10 -0
- package/dist/shared/page-context.d.ts +7 -0
- package/dist/shared/page-context.d.ts.map +1 -0
- package/dist/shared/page-context.js +1 -0
- package/dist/shared/permissions.d.ts +9 -0
- package/dist/shared/permissions.d.ts.map +1 -0
- package/dist/shared/permissions.js +10 -0
- package/dist/shared/questionnaire.d.ts +32 -0
- package/dist/shared/questionnaire.d.ts.map +1 -0
- package/dist/shared/questionnaire.js +68 -0
- package/dist/shared/rdf-namespaces.d.ts +11 -0
- package/dist/shared/rdf-namespaces.d.ts.map +1 -0
- package/dist/shared/rdf-namespaces.js +15 -0
- package/dist/shared/rule-iri.d.ts +4 -0
- package/dist/shared/rule-iri.d.ts.map +1 -0
- package/dist/shared/rule-iri.js +13 -0
- package/dist/shared/rule-search.d.ts +2 -0
- package/dist/shared/rule-search.d.ts.map +1 -0
- package/dist/shared/rule-search.js +1 -0
- package/dist/shared/session-types.d.ts +14 -0
- package/dist/shared/session-types.d.ts.map +1 -0
- package/dist/shared/session-types.js +1 -0
- package/dist/shared/spa-routes.d.ts +3 -0
- package/dist/shared/spa-routes.d.ts.map +1 -0
- package/dist/shared/spa-routes.js +5 -0
- package/dist/shared/stakeholder-iri.d.ts +7 -0
- package/dist/shared/stakeholder-iri.d.ts.map +1 -0
- package/dist/shared/stakeholder-iri.js +20 -0
- package/dist/shared/team-activation.d.ts +7 -0
- package/dist/shared/team-activation.d.ts.map +1 -0
- package/dist/shared/team-activation.js +3 -0
- package/dist/shared/team.d.ts +150 -0
- package/dist/shared/team.d.ts.map +1 -0
- package/dist/shared/team.js +88 -0
- package/dist/shared/tools/coercers.d.ts +6 -0
- package/dist/shared/tools/coercers.d.ts.map +1 -0
- package/dist/shared/tools/coercers.js +63 -0
- package/dist/shared/tools/index.d.ts +4 -0
- package/dist/shared/tools/index.d.ts.map +1 -0
- package/dist/shared/tools/index.js +2 -0
- package/dist/shared/tools/metadata.d.ts +12 -0
- package/dist/shared/tools/metadata.d.ts.map +1 -0
- package/dist/shared/tools/metadata.js +215 -0
- package/dist/shared/tools/test-triple.d.ts +16 -0
- package/dist/shared/tools/test-triple.d.ts.map +1 -0
- package/dist/shared/tools/test-triple.js +26 -0
- package/dist/shared/tools/types.d.ts +236 -0
- package/dist/shared/tools/types.d.ts.map +1 -0
- package/dist/shared/tools/types.js +1 -0
- package/dist/shared/upload.d.ts +26 -0
- package/dist/shared/upload.d.ts.map +1 -0
- package/dist/shared/upload.js +26 -0
- package/dist/shared/website-url.d.ts +5 -0
- package/dist/shared/website-url.d.ts.map +1 -0
- package/dist/shared/website-url.js +31 -0
- package/dist/shared/workspace-artifacts.d.ts +21 -0
- package/dist/shared/workspace-artifacts.d.ts.map +1 -0
- package/dist/shared/workspace-artifacts.js +59 -0
- package/dist/shared/writable-shape-query.d.ts +2 -0
- package/dist/shared/writable-shape-query.d.ts.map +1 -0
- package/dist/shared/writable-shape-query.js +21 -0
- package/dist/types/jsonld.d.ts +2 -0
- package/dist/types/jsonld.d.ts.map +1 -0
- package/dist/types/jsonld.js +1 -0
- package/dist/types/sparql-types.d.ts +3 -0
- package/dist/types/sparql-types.d.ts.map +1 -0
- package/dist/types/sparql-types.js +1 -0
- package/package.json +93 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const datastoreRoutePrefix = "/d";
|
|
2
|
+
export declare const datastoreHeaderName = "x-manta-datastore";
|
|
3
|
+
export declare const datastoreQueryParam = "datastore";
|
|
4
|
+
export declare const redirectRoutePath = "/redirect";
|
|
5
|
+
export type DatastoreLocation = {
|
|
6
|
+
datastoreId: string | undefined;
|
|
7
|
+
path: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function isRootRelativePath(url: string): boolean;
|
|
10
|
+
export declare function datastoreBasename(datastoreId: string): string;
|
|
11
|
+
export declare function parseDatastorePath(pathname: string): DatastoreLocation;
|
|
12
|
+
export declare function datastoreRelativePath(pathname: string): string;
|
|
13
|
+
export declare function datastoreHeader(datastoreId: string | undefined): Record<string, string>;
|
|
14
|
+
export declare function datastoreSocketQuery(datastoreId: string | undefined): Record<string, string>;
|
|
15
|
+
export declare function withDatastoreQueryParam(href: string, datastoreId: string | undefined): string;
|
|
16
|
+
export declare function withDatastorePrefix(datastoreId: string, path: string): string;
|
|
17
|
+
export declare function datastoreScopedRoutePattern(path: string): string;
|
|
18
|
+
export declare function datastoreScopedDenylist(pathWithoutSlash: string): RegExp;
|
|
19
|
+
//# sourceMappingURL=datastore-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datastore-path.d.ts","sourceRoot":"","sources":["../../src/shared/datastore-path.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAEzC,eAAO,MAAM,mBAAmB,sBAAsB,CAAC;AAEvD,eAAO,MAAM,mBAAmB,cAAc,CAAC;AAE/C,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAE7C,MAAM,MAAM,iBAAiB,GAAG;IAAE,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAKlF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAQtE;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEvF;AAED,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAE5F;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAM7F;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE7E;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhE;AAGD,wBAAgB,uBAAuB,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAExE"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { isValidDatastoreId } from "./datastore-id.js";
|
|
2
|
+
export const datastoreRoutePrefix = "/d";
|
|
3
|
+
export const datastoreHeaderName = "x-manta-datastore";
|
|
4
|
+
export const datastoreQueryParam = "datastore";
|
|
5
|
+
export const redirectRoutePath = "/redirect";
|
|
6
|
+
const datastorePathPattern = new RegExp(`^${datastoreRoutePrefix}/([^/]+)(/.*)?$`);
|
|
7
|
+
// "//evil.com" and "/\evil.com" both resolve off-origin - browsers treat "\" as "/" for special schemes.
|
|
8
|
+
export function isRootRelativePath(url) {
|
|
9
|
+
return url.startsWith("/") && !url.startsWith("//") && !url.startsWith("/\\");
|
|
10
|
+
}
|
|
11
|
+
export function datastoreBasename(datastoreId) {
|
|
12
|
+
return `${datastoreRoutePrefix}/${encodeURIComponent(datastoreId)}`;
|
|
13
|
+
}
|
|
14
|
+
export function parseDatastorePath(pathname) {
|
|
15
|
+
const split = splitDatastorePath(pathname);
|
|
16
|
+
if (!split)
|
|
17
|
+
return { datastoreId: undefined, path: pathname };
|
|
18
|
+
const datastoreId = safeDecode(split.segment);
|
|
19
|
+
if (!datastoreId || !isValidDatastoreId(datastoreId))
|
|
20
|
+
return { datastoreId: undefined, path: pathname };
|
|
21
|
+
return { datastoreId, path: split.rest };
|
|
22
|
+
}
|
|
23
|
+
export function datastoreRelativePath(pathname) {
|
|
24
|
+
return splitDatastorePath(pathname)?.rest ?? pathname;
|
|
25
|
+
}
|
|
26
|
+
export function datastoreHeader(datastoreId) {
|
|
27
|
+
return datastoreId ? { [datastoreHeaderName]: datastoreId } : {};
|
|
28
|
+
}
|
|
29
|
+
export function datastoreSocketQuery(datastoreId) {
|
|
30
|
+
return datastoreId ? { [datastoreQueryParam]: datastoreId } : {};
|
|
31
|
+
}
|
|
32
|
+
export function withDatastoreQueryParam(href, datastoreId) {
|
|
33
|
+
if (!datastoreId)
|
|
34
|
+
return href;
|
|
35
|
+
const url = new URL(href, "http://placeholder");
|
|
36
|
+
url.searchParams.set(datastoreQueryParam, datastoreId);
|
|
37
|
+
return `${url.pathname}${url.search}${url.hash}`;
|
|
38
|
+
}
|
|
39
|
+
export function withDatastorePrefix(datastoreId, path) {
|
|
40
|
+
return `${datastoreBasename(datastoreId)}${path}`;
|
|
41
|
+
}
|
|
42
|
+
export function datastoreScopedRoutePattern(path) {
|
|
43
|
+
return `${datastoreRoutePrefix}/:datastoreId${path}`;
|
|
44
|
+
}
|
|
45
|
+
// Matches a path with or without its "/d/<id>/" prefix, for a Workbox denylist entry.
|
|
46
|
+
export function datastoreScopedDenylist(pathWithoutSlash) {
|
|
47
|
+
return new RegExp(`^/(${datastoreRoutePrefix.slice(1)}/[^/]+/)?${pathWithoutSlash}\\b`);
|
|
48
|
+
}
|
|
49
|
+
function splitDatastorePath(pathname) {
|
|
50
|
+
const match = datastorePathPattern.exec(pathname);
|
|
51
|
+
if (!match?.[1])
|
|
52
|
+
return undefined;
|
|
53
|
+
return { segment: match[1], rest: match[2] || "/" };
|
|
54
|
+
}
|
|
55
|
+
function safeDecode(segment) {
|
|
56
|
+
try {
|
|
57
|
+
return decodeURIComponent(segment);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export type RouteElements = {
|
|
3
|
+
Chat: ReactNode;
|
|
4
|
+
EnterDatastore?: ReactNode;
|
|
5
|
+
Plans?: ReactNode;
|
|
6
|
+
Rules?: ReactNode;
|
|
7
|
+
Explain?: ReactNode;
|
|
8
|
+
Streams?: ReactNode;
|
|
9
|
+
Datastores?: ReactNode;
|
|
10
|
+
Memories?: ReactNode;
|
|
11
|
+
Activity?: ReactNode;
|
|
12
|
+
ActivityDetail?: ReactNode;
|
|
13
|
+
Integrations?: ReactNode;
|
|
14
|
+
Team?: ReactNode;
|
|
15
|
+
DataExplorerLayout?: ReactNode;
|
|
16
|
+
DataExplorerIndex?: ReactNode;
|
|
17
|
+
DataExplorerRecent?: ReactNode;
|
|
18
|
+
DataExplorerCoverage?: ReactNode;
|
|
19
|
+
DataExplorerPrefix?: ReactNode;
|
|
20
|
+
DataExplorerType?: ReactNode;
|
|
21
|
+
DataEntity?: ReactNode;
|
|
22
|
+
DataDetail?: ReactNode;
|
|
23
|
+
NotFound?: ReactNode;
|
|
24
|
+
};
|
|
25
|
+
export declare function notFoundElement(elements: RouteElements): ReactNode;
|
|
26
|
+
export type RouteDefinition = {
|
|
27
|
+
path: string;
|
|
28
|
+
render: (elements: RouteElements) => ReactNode;
|
|
29
|
+
children?: RouteDefinition[];
|
|
30
|
+
};
|
|
31
|
+
export declare const notFoundRoutePath = "*";
|
|
32
|
+
export declare const globalRoutes: RouteDefinition[];
|
|
33
|
+
export declare const datastoreRoutes: RouteDefinition[];
|
|
34
|
+
export declare const datastoreRoutePaths: string[];
|
|
35
|
+
export declare const globalRoutePaths: string[];
|
|
36
|
+
//# sourceMappingURL=datastore-route-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datastore-route-table.d.ts","sourceRoot":"","sources":["../../src/shared/datastore-route-table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAC/B,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAC/B,oBAAoB,CAAC,EAAE,SAAS,CAAC;IACjC,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAC/B,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,wBAAgB,eAAe,CAAC,QAAQ,EAAE,aAAa,aAEtD;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,SAAS,CAAC;IAC/C,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC,eAAO,MAAM,YAAY,EAAE,eAAe,EAEzC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,eAAe,EA4B5C,CAAC;AAMF,eAAO,MAAM,mBAAmB,EAAE,MAAM,EAEvC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,MAAM,EAA+B,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export function notFoundElement(elements) {
|
|
2
|
+
return elements.NotFound || elements.Chat;
|
|
3
|
+
}
|
|
4
|
+
export const notFoundRoutePath = "*";
|
|
5
|
+
export const globalRoutes = [
|
|
6
|
+
{ path: "/datastores", render: (e) => e.Datastores || notFoundElement(e) },
|
|
7
|
+
];
|
|
8
|
+
export const datastoreRoutes = [
|
|
9
|
+
{ path: "/", render: (e) => e.Chat },
|
|
10
|
+
{ path: "/plans", render: (e) => e.Plans || e.Chat },
|
|
11
|
+
{ path: "/plans/:planName", render: (e) => e.Plans || e.Chat },
|
|
12
|
+
{ path: "/rules", render: (e) => e.Rules || e.Chat },
|
|
13
|
+
{ path: "/rules/:ruleName", render: (e) => e.Rules || e.Chat },
|
|
14
|
+
{ path: "/explain", render: (e) => e.Explain || e.Chat },
|
|
15
|
+
{ path: "/streams", render: (e) => e.Streams || notFoundElement(e) },
|
|
16
|
+
{ path: "/memories", render: (e) => e.Memories || e.Chat },
|
|
17
|
+
{ path: "/activity", render: (e) => e.Activity || notFoundElement(e) },
|
|
18
|
+
{ path: "/activity/:id", render: (e) => e.ActivityDetail || notFoundElement(e) },
|
|
19
|
+
{ path: "/integrations", render: (e) => e.Integrations || e.Chat },
|
|
20
|
+
{ path: "/team", render: (e) => e.Team || notFoundElement(e) },
|
|
21
|
+
{
|
|
22
|
+
path: "/data",
|
|
23
|
+
render: (e) => e.DataExplorerLayout || e.Chat,
|
|
24
|
+
children: [
|
|
25
|
+
{ path: "/data", render: (e) => e.DataExplorerIndex || notFoundElement(e) },
|
|
26
|
+
{ path: "/data/recent", render: (e) => e.DataExplorerRecent || notFoundElement(e) },
|
|
27
|
+
{ path: "/data/coverage", render: (e) => e.DataExplorerCoverage || notFoundElement(e) },
|
|
28
|
+
{ path: "/data/entity/:iri", render: (e) => e.DataEntity || notFoundElement(e) },
|
|
29
|
+
{ path: "/data/:prefix", render: (e) => e.DataExplorerPrefix || notFoundElement(e) },
|
|
30
|
+
{ path: "/data/:prefix/:type", render: (e) => e.DataExplorerType || notFoundElement(e) },
|
|
31
|
+
{ path: "/data/:prefix/:type/:id", render: (e) => e.DataDetail || notFoundElement(e) },
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
{ path: "/chat/:chatId", render: (e) => e.Chat },
|
|
35
|
+
{ path: notFoundRoutePath, render: notFoundElement },
|
|
36
|
+
];
|
|
37
|
+
function flattenPaths(routes) {
|
|
38
|
+
return routes.flatMap((route) => [route.path, ...(route.children ? flattenPaths(route.children) : [])]);
|
|
39
|
+
}
|
|
40
|
+
export const datastoreRoutePaths = [
|
|
41
|
+
...new Set(flattenPaths(datastoreRoutes).filter((path) => path !== "/" && path !== notFoundRoutePath)),
|
|
42
|
+
];
|
|
43
|
+
export const globalRoutePaths = flattenPaths(globalRoutes);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Duration } from "iso8601-duration";
|
|
2
|
+
export declare function parseDuration(isoDuration: string): Duration | null;
|
|
3
|
+
export declare function formatDuration(isoDuration: string): string;
|
|
4
|
+
export declare function durationToSeconds(isoDuration: string): number | null;
|
|
5
|
+
export declare function formatDurationSmart(isoDuration: string): string;
|
|
6
|
+
//# sourceMappingURL=duration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../src/shared/duration.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjD,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAMlE;AAED,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAY1D;AAED,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKpE;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA2B/D"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { isPresent } from "@manta-eu/lib/present";
|
|
2
|
+
import { parse, toSeconds } from "iso8601-duration";
|
|
3
|
+
export function parseDuration(isoDuration) {
|
|
4
|
+
try {
|
|
5
|
+
return parse(isoDuration);
|
|
6
|
+
}
|
|
7
|
+
catch {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export function formatDuration(isoDuration) {
|
|
12
|
+
const duration = parseDuration(isoDuration);
|
|
13
|
+
if (!duration)
|
|
14
|
+
return isoDuration;
|
|
15
|
+
const parts = [];
|
|
16
|
+
if (duration.days)
|
|
17
|
+
parts.push(`${duration.days}d`);
|
|
18
|
+
if (duration.hours)
|
|
19
|
+
parts.push(`${duration.hours}h`);
|
|
20
|
+
if (duration.minutes)
|
|
21
|
+
parts.push(`${duration.minutes}m`);
|
|
22
|
+
if (duration.seconds)
|
|
23
|
+
parts.push(`${duration.seconds}s`);
|
|
24
|
+
return isPresent(parts) ? parts.join(" ") : "0m";
|
|
25
|
+
}
|
|
26
|
+
export function durationToSeconds(isoDuration) {
|
|
27
|
+
const duration = parseDuration(isoDuration);
|
|
28
|
+
if (!duration)
|
|
29
|
+
return null;
|
|
30
|
+
return toSeconds(duration);
|
|
31
|
+
}
|
|
32
|
+
export function formatDurationSmart(isoDuration) {
|
|
33
|
+
const duration = parseDuration(isoDuration);
|
|
34
|
+
if (!duration)
|
|
35
|
+
return isoDuration;
|
|
36
|
+
const totalSeconds = toSeconds(duration);
|
|
37
|
+
if (totalSeconds < 60) {
|
|
38
|
+
return `${Math.round(totalSeconds)}s`;
|
|
39
|
+
}
|
|
40
|
+
if (totalSeconds < 3600) {
|
|
41
|
+
const minutes = Math.round(totalSeconds / 60);
|
|
42
|
+
return `${minutes}m`;
|
|
43
|
+
}
|
|
44
|
+
if (totalSeconds < 86400) {
|
|
45
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
46
|
+
const remainingMinutes = Math.round((totalSeconds % 3600) / 60);
|
|
47
|
+
return remainingMinutes > 0 ? `${hours}h ${remainingMinutes}m` : `${hours}h`;
|
|
48
|
+
}
|
|
49
|
+
const days = Math.floor(totalSeconds / 86400);
|
|
50
|
+
const remainingHours = Math.floor((totalSeconds % 86400) / 3600);
|
|
51
|
+
if (remainingHours > 0) {
|
|
52
|
+
return `${days}d ${remainingHours}h`;
|
|
53
|
+
}
|
|
54
|
+
return `${days}d`;
|
|
55
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type JsonLdGraphDocument } from "../types/jsonld.js";
|
|
2
|
+
export declare const selfFetchingTypes: string[];
|
|
3
|
+
export declare const displayFactTypes: string[];
|
|
4
|
+
export declare function entityTypesByIri(graph: JsonLdGraphDocument): Map<string, string[]>;
|
|
5
|
+
export type EntityTypeGroup = {
|
|
6
|
+
typeIris: string[];
|
|
7
|
+
iris: string[];
|
|
8
|
+
};
|
|
9
|
+
export declare function groupEntitiesByType(entityIris: readonly string[], typesByIri: Map<string, string[]>): {
|
|
10
|
+
key: string;
|
|
11
|
+
typeIris: string[];
|
|
12
|
+
iris: string[];
|
|
13
|
+
}[];
|
|
14
|
+
//# sourceMappingURL=entity-set.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-set.d.ts","sourceRoot":"","sources":["../../src/shared/entity-set.ts"],"names":[],"mappings":"AACA,OAAO,EAA2C,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAKpG,eAAO,MAAM,iBAAiB,UAAoC,CAAC;AAEnE,eAAO,MAAM,gBAAgB,UAAkC,CAAC;AAEhE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,mBAAmB,yBAU1D;AAED,MAAM,MAAM,eAAe,GAAG;IAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAErE,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,EAAE,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;;;;IAQnG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { expandPrefix } from "./rdf-namespaces.js";
|
|
2
|
+
import { getJsonLdGraph, getNodeId, getNodeTypes } from "../types/jsonld.js";
|
|
3
|
+
import { isPresent } from "@manta-eu/lib/present";
|
|
4
|
+
import { detailViewTypes, lensViewTypes } from "@manta-eu/rdf-lib/detail-view-types";
|
|
5
|
+
import { groupBy, toPairs } from "ramda";
|
|
6
|
+
export const selfFetchingTypes = detailViewTypes.map(expandPrefix);
|
|
7
|
+
export const displayFactTypes = lensViewTypes.map(expandPrefix);
|
|
8
|
+
export function entityTypesByIri(graph) {
|
|
9
|
+
const typesByIri = new Map();
|
|
10
|
+
for (const node of getJsonLdGraph(graph)) {
|
|
11
|
+
const id = getNodeId(node);
|
|
12
|
+
if (id === undefined)
|
|
13
|
+
continue;
|
|
14
|
+
typesByIri.set(expandPrefix(id), getNodeTypes(node).map(expandPrefix));
|
|
15
|
+
}
|
|
16
|
+
return typesByIri;
|
|
17
|
+
}
|
|
18
|
+
export function groupEntitiesByType(entityIris, typesByIri) {
|
|
19
|
+
const typeKey = (iri) => [...(typesByIri.get(expandPrefix(iri)) ?? [])].sort().join("|");
|
|
20
|
+
return toPairs(groupBy(typeKey, entityIris)).map(([key, iris = []]) => ({
|
|
21
|
+
key,
|
|
22
|
+
typeIris: isPresent(key) ? key.split("|") : [],
|
|
23
|
+
iris,
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ContentfulStatusCode } from "hono/utils/http-status";
|
|
2
|
+
export type ErrorInfo = {
|
|
3
|
+
message: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
};
|
|
6
|
+
export type HttpError = Error & {
|
|
7
|
+
status: ContentfulStatusCode;
|
|
8
|
+
};
|
|
9
|
+
export declare function createHttpError(message: string, status: ContentfulStatusCode): HttpError;
|
|
10
|
+
export declare function isHttpError(e: unknown): e is HttpError;
|
|
11
|
+
export declare function serializeError(error: unknown): {
|
|
12
|
+
name: string;
|
|
13
|
+
message: string;
|
|
14
|
+
stack: string | undefined;
|
|
15
|
+
value?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
value: string;
|
|
18
|
+
name?: undefined;
|
|
19
|
+
message?: undefined;
|
|
20
|
+
stack?: undefined;
|
|
21
|
+
};
|
|
22
|
+
export declare function parseError(error: unknown, defaultMessage: string): ErrorInfo;
|
|
23
|
+
//# sourceMappingURL=error-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-utils.d.ts","sourceRoot":"","sources":["../../src/shared/error-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnE,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG;IAAE,MAAM,EAAE,oBAAoB,CAAA;CAAE,CAAC;AAEjE,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,GAAG,SAAS,CAIxF;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,SAAS,CAEtD;AAkBD,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO;;;;;;;;;;EAI5C;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,SAAS,CAoC5E"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export function createHttpError(message, status) {
|
|
2
|
+
const err = new Error(message);
|
|
3
|
+
err.status = status;
|
|
4
|
+
return err;
|
|
5
|
+
}
|
|
6
|
+
export function isHttpError(e) {
|
|
7
|
+
return e instanceof Error && typeof e.status === "number";
|
|
8
|
+
}
|
|
9
|
+
function isNetworkError(error) {
|
|
10
|
+
return (error instanceof TypeError &&
|
|
11
|
+
(error.message.includes("fetch") || error.message.includes("network") || error.message.includes("Failed to fetch")));
|
|
12
|
+
}
|
|
13
|
+
function isGraphQLError(error) {
|
|
14
|
+
return (typeof error === "object" &&
|
|
15
|
+
error !== null &&
|
|
16
|
+
"message" in error &&
|
|
17
|
+
(("graphQLErrors" in error && Array.isArray(error.graphQLErrors)) || "networkError" in error));
|
|
18
|
+
}
|
|
19
|
+
export function serializeError(error) {
|
|
20
|
+
if (error instanceof Error)
|
|
21
|
+
return { name: error.name, message: error.message, stack: error.stack };
|
|
22
|
+
return { value: String(error) };
|
|
23
|
+
}
|
|
24
|
+
export function parseError(error, defaultMessage) {
|
|
25
|
+
if (error instanceof Error) {
|
|
26
|
+
if (isNetworkError(error)) {
|
|
27
|
+
return {
|
|
28
|
+
message: defaultMessage,
|
|
29
|
+
description: "Network error. Please check your connection and try again.",
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
message: defaultMessage,
|
|
34
|
+
description: error.message,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
if (isGraphQLError(error) && error.graphQLErrors && Array.isArray(error.graphQLErrors)) {
|
|
38
|
+
const firstError = error.graphQLErrors[0];
|
|
39
|
+
if (typeof firstError === "object" && firstError && "message" in firstError) {
|
|
40
|
+
return {
|
|
41
|
+
message: defaultMessage,
|
|
42
|
+
description: String(firstError.message),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (typeof error === "string") {
|
|
47
|
+
return {
|
|
48
|
+
message: defaultMessage,
|
|
49
|
+
description: error,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
message: defaultMessage,
|
|
54
|
+
description: "An unexpected error occurred",
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explorer-paths.d.ts","sourceRoot":"","sources":["../../src/shared/explorer-paths.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,UAAU,CAAC;AAEpC,eAAO,MAAM,aAAa,WAAW,CAAC;AAEtC,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9C"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// The URL shape of the data explorer. The server redirects into these paths and the app routes
|
|
2
|
+
// them, so both sides must read one definition.
|
|
3
|
+
export const explorerPath = "/data";
|
|
4
|
+
export const entitySegment = "entity";
|
|
5
|
+
export function entityPath(iri) {
|
|
6
|
+
return `${explorerPath}/${entitySegment}/${encodeURIComponent(iri)}`;
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const fileIriScheme = "s3";
|
|
2
|
+
export declare function buildFileIri(input: {
|
|
3
|
+
bucket: string;
|
|
4
|
+
key: string;
|
|
5
|
+
}): string;
|
|
6
|
+
export declare function isFileIri(iri: string): boolean;
|
|
7
|
+
export declare function validateFileIri(iri: string): void;
|
|
8
|
+
export declare function parseFileIri(iri: string): {
|
|
9
|
+
bucket: string;
|
|
10
|
+
storageKey: string;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=fileIri.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileIri.d.ts","sourceRoot":"","sources":["../../src/shared/fileIri.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,OAAO,CAAC;AAIlC,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,UAElE;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,WAEpC;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,QAI1C;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM;;;EAMvC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const fileIriScheme = "s3";
|
|
2
|
+
const fileIriPattern = /^s3:\/\/([^/]+)\/(.+)$/;
|
|
3
|
+
export function buildFileIri(input) {
|
|
4
|
+
return `${fileIriScheme}://${input.bucket}/${input.key}`;
|
|
5
|
+
}
|
|
6
|
+
export function isFileIri(iri) {
|
|
7
|
+
return fileIriPattern.test(iri);
|
|
8
|
+
}
|
|
9
|
+
export function validateFileIri(iri) {
|
|
10
|
+
if (!isFileIri(iri)) {
|
|
11
|
+
throw new Error(`Invalid file IRI: expected ${fileIriScheme}://<bucket>/<key> - got "${iri}"`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export function parseFileIri(iri) {
|
|
15
|
+
validateFileIri(iri);
|
|
16
|
+
const [, bucket = "", storageKey = ""] = fileIriPattern.exec(iri) ?? [];
|
|
17
|
+
return { bucket, storageKey };
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { PageContext } from "./page-context.js";
|
|
2
|
+
import type { UIMessage } from "ai";
|
|
3
|
+
import type { OperatorAllowedModel } from "./model.js";
|
|
4
|
+
export declare const APPROVAL: {
|
|
5
|
+
readonly YES: "Yes, confirmed.";
|
|
6
|
+
readonly NO: "No, denied.";
|
|
7
|
+
};
|
|
8
|
+
export type AssistantResponseState = "in-progress" | "finished" | "failed" | "aborted";
|
|
9
|
+
export type ChatUIMessage = UIMessage<{
|
|
10
|
+
createdAt: string;
|
|
11
|
+
userId?: string;
|
|
12
|
+
datastoreId?: string;
|
|
13
|
+
totalTokens?: number;
|
|
14
|
+
finishReason?: string;
|
|
15
|
+
responseState?: AssistantResponseState;
|
|
16
|
+
isTask?: boolean;
|
|
17
|
+
traceId?: string;
|
|
18
|
+
pageContext?: PageContext;
|
|
19
|
+
model?: OperatorAllowedModel;
|
|
20
|
+
}>;
|
|
21
|
+
export declare function chatIdToPath(id: string): string;
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAGpD,eAAO,MAAM,QAAQ;;;CAGX,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAAG,aAAa,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEvF,MAAM,MAAM,aAAa,GAAG,SAAS,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,KAAK,CAAC,EAAE,oBAAoB,CAAC;CAC9B,CAAC,CAAC;AAEH,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,UAEtC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const liveContextMemoryDateFilter = "FILTER NOT EXISTS {\n ?entity a :Memory .\n {\n ?entity :memoryTrustedUntil ?horizon .\n FILTER(?horizon <= NOW())\n } UNION {\n ?entity :memoryValidUntil ?expiry .\n FILTER(?expiry <= NOW())\n } UNION {\n ?entity :memoryValidFrom ?validFrom .\n FILTER(?validFrom > NOW())\n }\n }";
|
|
2
|
+
//# sourceMappingURL=live-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live-context.d.ts","sourceRoot":"","sources":["../../src/shared/live-context.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,2BAA2B,2XAYhC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// :now[:Clock] is MAX(schema:dateModified) over ingested platform data, not real time, and is unbound on an
|
|
2
|
+
// empty datastore - every reader of :LiveContext_Chat has to apply memory dates itself, against NOW().
|
|
3
|
+
export const liveContextMemoryDateFilter = `FILTER NOT EXISTS {
|
|
4
|
+
?entity a :Memory .
|
|
5
|
+
{
|
|
6
|
+
?entity :memoryTrustedUntil ?horizon .
|
|
7
|
+
FILTER(?horizon <= NOW())
|
|
8
|
+
} UNION {
|
|
9
|
+
?entity :memoryValidUntil ?expiry .
|
|
10
|
+
FILTER(?expiry <= NOW())
|
|
11
|
+
} UNION {
|
|
12
|
+
?entity :memoryValidFrom ?validFrom .
|
|
13
|
+
FILTER(?validFrom > NOW())
|
|
14
|
+
}
|
|
15
|
+
}`;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const maintenanceTickMinutes = 30;
|
|
2
|
+
export declare const compactionPeriodHours = 24;
|
|
3
|
+
export declare function ticksInPeriod(periodHours: number): number;
|
|
4
|
+
export declare function stableSlot(key: string, slots: number): number;
|
|
5
|
+
export declare function sampledByKey(key: string, rate: number): boolean;
|
|
6
|
+
export declare function currentTick(now: Date, periodHours: number): number;
|
|
7
|
+
export declare function isDueThisTick(key: string, now: Date, periodHours: number): boolean;
|
|
8
|
+
export declare function dueThisTick(keys: readonly string[], now: Date, periodHours: number): string[];
|
|
9
|
+
export declare const redundancySweepDayBuckets = 7;
|
|
10
|
+
export declare function isDueOnDay(key: string, now: Date, buckets?: number): boolean;
|
|
11
|
+
//# sourceMappingURL=maintenance-schedule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maintenance-schedule.d.ts","sourceRoot":"","sources":["../../src/shared/maintenance-schedule.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEzD;AAGD,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAO7D;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAM/D;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAElE;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAGlF;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAE7F;AAED,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,GAAE,MAAkC,GAAG,OAAO,CAGvG"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { msPerDay } from "./memory-dates.js";
|
|
2
|
+
export const maintenanceTickMinutes = 30;
|
|
3
|
+
export const compactionPeriodHours = 24;
|
|
4
|
+
export function ticksInPeriod(periodHours) {
|
|
5
|
+
return Math.max(1, Math.round((periodHours * 60) / maintenanceTickMinutes));
|
|
6
|
+
}
|
|
7
|
+
// This is FNV-1a, kept synchronous because this file ships to the browser without node:crypto.
|
|
8
|
+
export function stableSlot(key, slots) {
|
|
9
|
+
let hash = 0x811c9dc5;
|
|
10
|
+
for (let i = 0; i < key.length; i++) {
|
|
11
|
+
hash ^= key.charCodeAt(i);
|
|
12
|
+
hash = Math.imul(hash, 0x01000193) >>> 0;
|
|
13
|
+
}
|
|
14
|
+
return hash % slots;
|
|
15
|
+
}
|
|
16
|
+
export function sampledByKey(key, rate) {
|
|
17
|
+
if (rate <= 0)
|
|
18
|
+
return false;
|
|
19
|
+
if (rate >= 1)
|
|
20
|
+
return true;
|
|
21
|
+
// 0x100000000 is 2^32, the hash's full range, so dividing by it maps the hash to a fraction in [0, 1).
|
|
22
|
+
return stableSlot(key, 0x100000000) / 0x100000000 < rate;
|
|
23
|
+
}
|
|
24
|
+
export function currentTick(now, periodHours) {
|
|
25
|
+
return Math.floor(now.getTime() / (maintenanceTickMinutes * 60_000)) % ticksInPeriod(periodHours);
|
|
26
|
+
}
|
|
27
|
+
export function isDueThisTick(key, now, periodHours) {
|
|
28
|
+
const slots = ticksInPeriod(periodHours);
|
|
29
|
+
return stableSlot(key, slots) === currentTick(now, periodHours);
|
|
30
|
+
}
|
|
31
|
+
export function dueThisTick(keys, now, periodHours) {
|
|
32
|
+
return keys.filter((key) => isDueThisTick(key, now, periodHours));
|
|
33
|
+
}
|
|
34
|
+
export const redundancySweepDayBuckets = 7;
|
|
35
|
+
export function isDueOnDay(key, now, buckets = redundancySweepDayBuckets) {
|
|
36
|
+
const day = Math.floor(now.getTime() / msPerDay) % buckets;
|
|
37
|
+
return stableSlot(key, buckets) === day;
|
|
38
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const memoryCitationSampleRate = 0.1;
|
|
2
|
+
export declare function shouldRequestCitations(seed: string, rate?: number): boolean;
|
|
3
|
+
export type CitationRequestTurn = {
|
|
4
|
+
hasPersonalPreload: boolean;
|
|
5
|
+
hasSharedSections: boolean;
|
|
6
|
+
seed: string;
|
|
7
|
+
};
|
|
8
|
+
export type CitationDecision = {
|
|
9
|
+
requested: false;
|
|
10
|
+
reason: "none";
|
|
11
|
+
} | {
|
|
12
|
+
requested: true;
|
|
13
|
+
reason: "personal" | "sampled";
|
|
14
|
+
};
|
|
15
|
+
export declare function citationDecisionForTurn(turn: CitationRequestTurn, rate?: number): CitationDecision;
|
|
16
|
+
//# sourceMappingURL=memory-citation-sampling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-citation-sampling.d.ts","sourceRoot":"","sources":["../../src/shared/memory-citation-sampling.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAiC,GAAG,OAAO,CAErG;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,gBAAgB,GACxB;IAAE,SAAS,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,SAAS,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAA;CAAE,CAAC;AAExD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,mBAAmB,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAMlG"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { sampledByKey } from "./maintenance-schedule.js";
|
|
2
|
+
// citeMemories under-counts memories that work by suppressing an answer; treat as diagnostic, not a score.
|
|
3
|
+
export const memoryCitationSampleRate = 0.1;
|
|
4
|
+
export function shouldRequestCitations(seed, rate = memoryCitationSampleRate) {
|
|
5
|
+
return sampledByKey(seed, rate);
|
|
6
|
+
}
|
|
7
|
+
export function citationDecisionForTurn(turn, rate) {
|
|
8
|
+
if (turn.hasPersonalPreload)
|
|
9
|
+
return { requested: true, reason: "personal" };
|
|
10
|
+
if (turn.hasSharedSections && shouldRequestCitations(turn.seed, rate)) {
|
|
11
|
+
return { requested: true, reason: "sampled" };
|
|
12
|
+
}
|
|
13
|
+
return { requested: false, reason: "none" };
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-confidence.d.ts","sourceRoot":"","sources":["../../src/shared/memory-confidence.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAE9C,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGzD"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const consolidationChunkSize = 12;
|
|
2
|
+
export declare const consolidationMaxChunks = 12;
|
|
3
|
+
export declare const consolidationCandidateLimit: number;
|
|
4
|
+
export declare const consolidationSeedBatchSize = 8;
|
|
5
|
+
export declare const consolidationJudgeBatchSize = 4;
|
|
6
|
+
//# sourceMappingURL=memory-consolidation-limits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-consolidation-limits.d.ts","sourceRoot":"","sources":["../../src/shared/memory-consolidation-limits.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,eAAO,MAAM,2BAA2B,QAAkD,CAAC;AAE3F,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAE5C,eAAO,MAAM,2BAA2B,IAAI,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const consolidationChunkSize = 12;
|
|
2
|
+
export const consolidationMaxChunks = 12;
|
|
3
|
+
export const consolidationCandidateLimit = consolidationChunkSize * consolidationMaxChunks;
|
|
4
|
+
export const consolidationSeedBatchSize = 8;
|
|
5
|
+
export const consolidationJudgeBatchSize = 4;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-dates.d.ts","sourceRoot":"","sources":["../../src/shared/memory-dates.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,QAAsB,CAAC;AAE5C,wBAAgB,eAAe,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,CAIpF"}
|