@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,7 @@
|
|
|
1
|
+
export declare const userIriPrefix: string;
|
|
2
|
+
export declare const teamIriPrefix: string;
|
|
3
|
+
export declare function getUserIri(userId: string): string;
|
|
4
|
+
export declare function parseUserIdFromIri(iri: string): string | null;
|
|
5
|
+
export declare function getTeamIri(path: string): string;
|
|
6
|
+
export declare function parseTeamPathFromIri(iri: string): string | null;
|
|
7
|
+
//# sourceMappingURL=stakeholder-iri.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stakeholder-iri.d.ts","sourceRoot":"","sources":["../../src/shared/stakeholder-iri.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,QAAyB,CAAC;AACpD,eAAO,MAAM,aAAa,QAAyB,CAAC;AAEpD,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG7D;AAGD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG/D"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { decodeIriLocalName, encodeIriLocalName, expandPrefix } from "./rdf-namespaces.js";
|
|
2
|
+
export const userIriPrefix = expandPrefix(":User_");
|
|
3
|
+
export const teamIriPrefix = expandPrefix(":Team_");
|
|
4
|
+
export function getUserIri(userId) {
|
|
5
|
+
return `${userIriPrefix}${encodeIriLocalName(userId)}`;
|
|
6
|
+
}
|
|
7
|
+
export function parseUserIdFromIri(iri) {
|
|
8
|
+
if (!iri.startsWith(userIriPrefix))
|
|
9
|
+
return null;
|
|
10
|
+
return decodeIriLocalName(iri.slice(userIriPrefix.length));
|
|
11
|
+
}
|
|
12
|
+
// Team paths are stored encodeURIComponent'd, so re-encoding them here would orphan existing nodes
|
|
13
|
+
export function getTeamIri(path) {
|
|
14
|
+
return `${teamIriPrefix}${encodeURIComponent(path)}`;
|
|
15
|
+
}
|
|
16
|
+
export function parseTeamPathFromIri(iri) {
|
|
17
|
+
if (!iri.startsWith(teamIriPrefix))
|
|
18
|
+
return null;
|
|
19
|
+
return decodeIriLocalName(iri.slice(teamIriPrefix.length));
|
|
20
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type ActivationAccessArgs = {
|
|
2
|
+
realmAllows: boolean;
|
|
3
|
+
flagEnabled: boolean | undefined;
|
|
4
|
+
wholeOrg: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare function canManageActivation({ realmAllows, flagEnabled, wholeOrg }: ActivationAccessArgs): boolean;
|
|
7
|
+
//# sourceMappingURL=team-activation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"team-activation.d.ts","sourceRoot":"","sources":["../../src/shared/team-activation.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,GAAG,SAAS,CAAC;IACjC,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,oBAAoB,GAAG,OAAO,CAEzG"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
export type TeamRole = string;
|
|
2
|
+
export type TeamMember = {
|
|
3
|
+
id: string;
|
|
4
|
+
email?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
roles: string[];
|
|
7
|
+
pending: boolean;
|
|
8
|
+
inviteUrl?: string;
|
|
9
|
+
teams: string[];
|
|
10
|
+
federated?: boolean;
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type TeamOrganization = {
|
|
14
|
+
alias?: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
managed: boolean;
|
|
17
|
+
mirrored: boolean;
|
|
18
|
+
inviteCarriesGrants?: true;
|
|
19
|
+
};
|
|
20
|
+
export type TeamRoster = {
|
|
21
|
+
members: TeamMember[];
|
|
22
|
+
truncated: boolean;
|
|
23
|
+
organization?: TeamOrganization;
|
|
24
|
+
};
|
|
25
|
+
export type TeamGroup = {
|
|
26
|
+
name: string;
|
|
27
|
+
path: string;
|
|
28
|
+
depth: number;
|
|
29
|
+
selectable?: boolean;
|
|
30
|
+
};
|
|
31
|
+
export type UserLabelSource = {
|
|
32
|
+
id: string;
|
|
33
|
+
name?: string;
|
|
34
|
+
email?: string;
|
|
35
|
+
username?: string;
|
|
36
|
+
};
|
|
37
|
+
export declare function userLabel(user: UserLabelSource): string;
|
|
38
|
+
export type DirectoryMembership = {
|
|
39
|
+
org: string;
|
|
40
|
+
name?: string;
|
|
41
|
+
groups: string[];
|
|
42
|
+
};
|
|
43
|
+
export type DirectoryUser = {
|
|
44
|
+
id: string;
|
|
45
|
+
username?: string;
|
|
46
|
+
email?: string;
|
|
47
|
+
name?: string;
|
|
48
|
+
memberships: DirectoryMembership[];
|
|
49
|
+
pending?: boolean;
|
|
50
|
+
inviteUrl?: string;
|
|
51
|
+
federated?: boolean;
|
|
52
|
+
enabled: boolean;
|
|
53
|
+
};
|
|
54
|
+
export type DirectoryScanCursor = {
|
|
55
|
+
offset: number;
|
|
56
|
+
matched: number;
|
|
57
|
+
};
|
|
58
|
+
export type TeamDirectory = {
|
|
59
|
+
users: DirectoryUser[];
|
|
60
|
+
truncated: boolean;
|
|
61
|
+
/** Rows matching the query across the realm, or undefined when the filter can only be counted by scanning. */
|
|
62
|
+
total?: number;
|
|
63
|
+
hasMore: boolean;
|
|
64
|
+
scanCursor?: DirectoryScanCursor;
|
|
65
|
+
};
|
|
66
|
+
export declare const directoryPageSize = 20;
|
|
67
|
+
export declare const maxDirectoryPageSize = 100;
|
|
68
|
+
export type AssignableGroup = {
|
|
69
|
+
path: string;
|
|
70
|
+
name: string;
|
|
71
|
+
depth: number;
|
|
72
|
+
selectable?: boolean;
|
|
73
|
+
};
|
|
74
|
+
export type AssignableOrganization = {
|
|
75
|
+
alias: string;
|
|
76
|
+
name?: string;
|
|
77
|
+
wholeOrg?: boolean;
|
|
78
|
+
groups?: AssignableGroup[];
|
|
79
|
+
};
|
|
80
|
+
export type AssignTarget = {
|
|
81
|
+
org: string;
|
|
82
|
+
group?: string;
|
|
83
|
+
};
|
|
84
|
+
export type BulkMutationFailure = {
|
|
85
|
+
id: string;
|
|
86
|
+
message: string;
|
|
87
|
+
};
|
|
88
|
+
export type AssignmentOutcome = "assigned" | "already" | "failed";
|
|
89
|
+
export type AssignmentResult = AssignTarget & {
|
|
90
|
+
userId: string;
|
|
91
|
+
outcome: AssignmentOutcome;
|
|
92
|
+
message?: string;
|
|
93
|
+
};
|
|
94
|
+
export type AssignmentSummary = {
|
|
95
|
+
results: AssignmentResult[];
|
|
96
|
+
assigned: number;
|
|
97
|
+
skipped: number;
|
|
98
|
+
failed: number;
|
|
99
|
+
roleFailures: BulkMutationFailure[];
|
|
100
|
+
};
|
|
101
|
+
export type AssignmentRole = {
|
|
102
|
+
userId: string;
|
|
103
|
+
role: string;
|
|
104
|
+
};
|
|
105
|
+
export type BulkMutationResult = {
|
|
106
|
+
attempted: number;
|
|
107
|
+
changed: number;
|
|
108
|
+
failures: BulkMutationFailure[];
|
|
109
|
+
};
|
|
110
|
+
export type BulkUserOrgPair = {
|
|
111
|
+
userId: string;
|
|
112
|
+
org?: string;
|
|
113
|
+
};
|
|
114
|
+
export declare function bulkPairId(pair: BulkUserOrgPair): string;
|
|
115
|
+
export declare function pathSegments(path: string): string[];
|
|
116
|
+
/** Mirrors manta-clj's normalization, so client-side comparisons match its replies. */
|
|
117
|
+
export declare function normalizeGroupPath(path: string): string;
|
|
118
|
+
export declare function namesAGroup(path: string | undefined): boolean;
|
|
119
|
+
export declare function ancestorPaths(path: string): string[];
|
|
120
|
+
export declare function groupNameFromPath(path: string): string;
|
|
121
|
+
export declare function groupDepthFromPath(path: string): number;
|
|
122
|
+
export declare function chunk<T>(items: T[], size: number): T[][];
|
|
123
|
+
export declare const waveSize = 8;
|
|
124
|
+
export declare function mapInWaves<T, R>(items: T[], fn: (item: T) => Promise<R>, size?: number): Promise<R[]>;
|
|
125
|
+
export declare const maxAssignmentPairs = 200;
|
|
126
|
+
export declare const maxBulkMembers = 300;
|
|
127
|
+
export declare function assignTargetKey(target: AssignTarget): string;
|
|
128
|
+
export type InviteOutcome = "invited" | "already" | "failed";
|
|
129
|
+
export type InviteGrantOutcome = "applied" | "recorded" | "dropped";
|
|
130
|
+
export type InviteResult = {
|
|
131
|
+
email: string;
|
|
132
|
+
id?: string;
|
|
133
|
+
outcome: InviteOutcome;
|
|
134
|
+
message?: string;
|
|
135
|
+
grant?: InviteGrantOutcome;
|
|
136
|
+
};
|
|
137
|
+
export type InviteSummary = {
|
|
138
|
+
results: InviteResult[];
|
|
139
|
+
invited: number;
|
|
140
|
+
skipped: number;
|
|
141
|
+
failed: number;
|
|
142
|
+
};
|
|
143
|
+
export declare function isEmailAddress(value: string): boolean;
|
|
144
|
+
export type EmailListParse = {
|
|
145
|
+
emails: string[];
|
|
146
|
+
invalid: string[];
|
|
147
|
+
};
|
|
148
|
+
/** Folds like manta-clj's distinct-emails: case-insensitively, first spelling wins. */
|
|
149
|
+
export declare function parseEmailList(raw: string): EmailListParse;
|
|
150
|
+
//# sourceMappingURL=team.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"team.d.ts","sourceRoot":"","sources":["../../src/shared/team.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,mBAAmB,CAAC,EAAE,IAAI,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,gBAAgB,CAAC;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AM,CAE5D;AAED,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE7D,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;AAEpE,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,aAAa,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,kBAAkB,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAKF,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAErD;AAcD,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,uFAAuF;AACvF,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAsB1D"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { isPresent } from "@manta-eu/lib/present";
|
|
2
|
+
import { splitEvery } from "ramda";
|
|
3
|
+
export function userLabel(user) {
|
|
4
|
+
return user.name ?? user.email ?? user.username ?? user.id;
|
|
5
|
+
}
|
|
6
|
+
export const directoryPageSize = 20;
|
|
7
|
+
export const maxDirectoryPageSize = 100;
|
|
8
|
+
export function bulkPairId(pair) {
|
|
9
|
+
return `${pair.userId}:${pair.org}`;
|
|
10
|
+
}
|
|
11
|
+
export function pathSegments(path) {
|
|
12
|
+
return path.split("/").filter(isPresent);
|
|
13
|
+
}
|
|
14
|
+
/** Mirrors manta-clj's normalization, so client-side comparisons match its replies. */
|
|
15
|
+
export function normalizeGroupPath(path) {
|
|
16
|
+
return `/${pathSegments(path).join("/")}`;
|
|
17
|
+
}
|
|
18
|
+
export function namesAGroup(path) {
|
|
19
|
+
return path !== undefined && isPresent(pathSegments(path));
|
|
20
|
+
}
|
|
21
|
+
export function ancestorPaths(path) {
|
|
22
|
+
const segments = pathSegments(path);
|
|
23
|
+
return segments.slice(0, -1).map((_, index) => normalizeGroupPath(segments.slice(0, index + 1).join("/")));
|
|
24
|
+
}
|
|
25
|
+
// Keycloak forbids "/" in group names, so the last segment is unambiguously the group's own name.
|
|
26
|
+
export function groupNameFromPath(path) {
|
|
27
|
+
return pathSegments(path).at(-1) ?? path;
|
|
28
|
+
}
|
|
29
|
+
export function groupDepthFromPath(path) {
|
|
30
|
+
return pathSegments(path).length;
|
|
31
|
+
}
|
|
32
|
+
export function chunk(items, size) {
|
|
33
|
+
return splitEvery(size, items);
|
|
34
|
+
}
|
|
35
|
+
export const waveSize = 8;
|
|
36
|
+
export async function mapInWaves(items, fn, size = waveSize) {
|
|
37
|
+
const results = [];
|
|
38
|
+
for (const wave of chunk(items, size)) {
|
|
39
|
+
results.push(...(await Promise.all(wave.map(fn))));
|
|
40
|
+
}
|
|
41
|
+
return results;
|
|
42
|
+
}
|
|
43
|
+
export const maxAssignmentPairs = 200;
|
|
44
|
+
export const maxBulkMembers = 300;
|
|
45
|
+
export function assignTargetKey(target) {
|
|
46
|
+
return namesAGroup(target.group) ? `${target.org}${normalizeGroupPath(target.group ?? "")}` : target.org;
|
|
47
|
+
}
|
|
48
|
+
// Same shape as metric.spec.core/email-regex, so client and server reject the same addresses.
|
|
49
|
+
const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,63}$/;
|
|
50
|
+
export function isEmailAddress(value) {
|
|
51
|
+
return emailPattern.test(value);
|
|
52
|
+
}
|
|
53
|
+
const pastedContact = /([^,;<]*)<([^>]*)>/g;
|
|
54
|
+
function extractContacts(raw) {
|
|
55
|
+
const entries = [];
|
|
56
|
+
const rest = raw.replace(pastedContact, (match, _label, address) => {
|
|
57
|
+
const trimmed = address.trim();
|
|
58
|
+
entries.push(isEmailAddress(trimmed) ? trimmed : match.trim());
|
|
59
|
+
return " ";
|
|
60
|
+
});
|
|
61
|
+
return { entries, rest };
|
|
62
|
+
}
|
|
63
|
+
/** Folds like manta-clj's distinct-emails: case-insensitively, first spelling wins. */
|
|
64
|
+
export function parseEmailList(raw) {
|
|
65
|
+
const seen = new Set();
|
|
66
|
+
const emails = [];
|
|
67
|
+
const invalid = [];
|
|
68
|
+
function take(entry) {
|
|
69
|
+
if (!isPresent(entry))
|
|
70
|
+
return;
|
|
71
|
+
if (!isEmailAddress(entry)) {
|
|
72
|
+
if (!invalid.includes(entry))
|
|
73
|
+
invalid.push(entry);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const key = entry.toLowerCase();
|
|
77
|
+
if (seen.has(key))
|
|
78
|
+
return;
|
|
79
|
+
seen.add(key);
|
|
80
|
+
emails.push(entry);
|
|
81
|
+
}
|
|
82
|
+
const { entries, rest } = extractContacts(raw);
|
|
83
|
+
for (const entry of entries)
|
|
84
|
+
take(entry);
|
|
85
|
+
for (const entry of rest.split(/[,;\s]+/))
|
|
86
|
+
take(entry.trim());
|
|
87
|
+
return { emails, invalid };
|
|
88
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ShowEntitiesOutput, SparqlJsonResults, ToolErrorResult, ToolName, ToolOutputType } from "./types.js";
|
|
2
|
+
export declare function isErrorToolResult(data: unknown): data is ToolErrorResult;
|
|
3
|
+
export declare function isSparqlJsonResults(data: unknown): data is SparqlJsonResults;
|
|
4
|
+
export declare function isShowEntitiesResult(data: unknown): data is Exclude<ShowEntitiesOutput, ToolErrorResult>;
|
|
5
|
+
export declare function coerceToolOutput<T extends ToolName>(toolName: T, raw: unknown): ToolOutputType<T>;
|
|
6
|
+
//# sourceMappingURL=coercers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coercers.d.ts","sourceRoot":"","sources":["../../../src/shared/tools/coercers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,QAAQ,EAER,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,eAAe,CAExE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,iBAAiB,CAS5E;AAyBD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,OAAO,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAQxG;AAWD,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,QAAQ,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,GAAG,cAAc,CAAC,CAAC,CAAC,CAajG"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { isJsonLdGraphDocument } from "#types/jsonld";
|
|
2
|
+
export function isErrorToolResult(data) {
|
|
3
|
+
return typeof data === "object" && data !== null && "is_error" in data && data.is_error === true;
|
|
4
|
+
}
|
|
5
|
+
export function isSparqlJsonResults(data) {
|
|
6
|
+
return (typeof data === "object" &&
|
|
7
|
+
data !== null &&
|
|
8
|
+
"head" in data &&
|
|
9
|
+
"results" in data &&
|
|
10
|
+
typeof data.head === "object" &&
|
|
11
|
+
typeof data.results === "object");
|
|
12
|
+
}
|
|
13
|
+
function coerceWith(toolName, raw, guards) {
|
|
14
|
+
if (typeof raw === "string") {
|
|
15
|
+
try {
|
|
16
|
+
raw = JSON.parse(raw);
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return { is_error: true, content: `Failed to parse tool output: ${raw}` };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (isErrorToolResult(raw))
|
|
23
|
+
return raw;
|
|
24
|
+
for (const guard of guards) {
|
|
25
|
+
if (guard(raw))
|
|
26
|
+
return raw;
|
|
27
|
+
}
|
|
28
|
+
return { is_error: true, content: `Unexpected ${toolName} output format` };
|
|
29
|
+
}
|
|
30
|
+
function coerceRDFoxFactsOutput(raw) {
|
|
31
|
+
return coerceWith("getRDFoxFacts", raw, [isSparqlJsonResults, isJsonLdGraphDocument]);
|
|
32
|
+
}
|
|
33
|
+
export function isShowEntitiesResult(data) {
|
|
34
|
+
if (typeof data !== "object" || data === null)
|
|
35
|
+
return false;
|
|
36
|
+
if (!("entityIris" in data) || !("graph" in data))
|
|
37
|
+
return false;
|
|
38
|
+
return (Array.isArray(data.entityIris) &&
|
|
39
|
+
data.entityIris.every((iri) => typeof iri === "string") &&
|
|
40
|
+
isJsonLdGraphDocument(data.graph));
|
|
41
|
+
}
|
|
42
|
+
function coerceShowEntitiesOutput(raw) {
|
|
43
|
+
return coerceWith("showEntities", raw, [isShowEntitiesResult]);
|
|
44
|
+
}
|
|
45
|
+
const coercers = {
|
|
46
|
+
getRDFoxFacts: coerceRDFoxFactsOutput,
|
|
47
|
+
showEntities: coerceShowEntitiesOutput,
|
|
48
|
+
};
|
|
49
|
+
export function coerceToolOutput(toolName, raw) {
|
|
50
|
+
const coercer = coercers[toolName];
|
|
51
|
+
if (coercer) {
|
|
52
|
+
return coercer(raw);
|
|
53
|
+
}
|
|
54
|
+
if (typeof raw === "string") {
|
|
55
|
+
try {
|
|
56
|
+
return JSON.parse(raw);
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
return raw;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return raw;
|
|
63
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { coerceToolOutput, isErrorToolResult, isShowEntitiesResult, isSparqlJsonResults } from "./coercers.js";
|
|
2
|
+
export { allToolNames, assertValidToolName, getHumanToolName, getSkillToolLabel, getToolMetadata, getToolUIPartLabel, isValidToolName, toolMetadata, } from "./metadata.js";
|
|
3
|
+
export type { ActionPlanShowcaseInput, ActionPlanShowcaseOutput, ActionPlanStatus, AddRDFoxFactsInput, AddRDFoxFactsOutput, CancelScheduleInput, CancelScheduleOutput, ExecuteActionPlanInput, ExecuteActionPlanOutput, ExplainRDFoxRulesInput, ExplainRDFoxRulesOutput, GenerateChartInput, GenerateChartOutput, GetRDFoxRulesInput, GetRDFoxRulesOutput, ListScheduledTasksInput, ListScheduledTasksOutput, RDFoxFactsInput, RDFoxFactsOutput, ScheduleTaskInput, ScheduleTaskOutput, ShowEntitiesInput, ShowEntitiesOutput, SparqlJsonBinding, SparqlJsonResults, SparqlValue, ToolCategory, ToolDefinition, ToolDefinitions, ToolErrorResult, ToolInputSchema, ToolMetadata, ToolName, ToolOutput, ToolOutputCoercer, ToolOutputType, } from "./types.js";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAC5G,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,cAAc,GACf,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { coerceToolOutput, isErrorToolResult, isShowEntitiesResult, isSparqlJsonResults } from "./coercers.js";
|
|
2
|
+
export { allToolNames, assertValidToolName, getHumanToolName, getSkillToolLabel, getToolMetadata, getToolUIPartLabel, isValidToolName, toolMetadata, } from "./metadata.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ToolUIPart } from "ai";
|
|
2
|
+
import type { ToolMetadata, ToolName } from "./types.js";
|
|
3
|
+
export declare const toolMetadata: ToolMetadata;
|
|
4
|
+
export declare function getToolMetadata<T extends ToolName>(toolName: T): ToolMetadata[T];
|
|
5
|
+
export type GetHumanToolNameInput<T extends ToolName> = Parameters<ToolMetadata[T]["getHumanName"]>[0];
|
|
6
|
+
export declare function getHumanToolName<T extends ToolName>(toolName: T, input?: Record<string, unknown>): string;
|
|
7
|
+
export declare function isValidToolName(toolName: string): toolName is ToolName;
|
|
8
|
+
export declare function getSkillToolLabel(toolUIPart: ToolUIPart): string | undefined;
|
|
9
|
+
export declare function getToolUIPartLabel(toolUIPart: ToolUIPart): string;
|
|
10
|
+
export declare function assertValidToolName(toolName: string): asserts toolName is ToolName;
|
|
11
|
+
export declare const allToolNames: readonly ToolName[];
|
|
12
|
+
//# sourceMappingURL=metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../src/shared/tools/metadata.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAErC,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEtD,eAAO,MAAM,YAAY,EAAE,YA6KH,CAAC;AAEzB,wBAAgB,eAAe,CAAC,CAAC,SAAS,QAAQ,EAAE,QAAQ,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAEhF;AAED,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,QAAQ,IAAI,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEvG,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,QAAQ,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAGzG;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,IAAI,QAAQ,CAEtE;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,CAU5E;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAQjE;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,IAAI,QAAQ,CAIlF;AAED,eAAO,MAAM,YAAY,EAAE,SAAS,QAAQ,EAA4C,CAAC"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { iriLocalName } from "../rdf-namespaces.js";
|
|
2
|
+
import { humanCount } from "@manta-eu/lib/humanize";
|
|
3
|
+
import { isPresent } from "@manta-eu/lib/present";
|
|
4
|
+
import { match, P } from "ts-pattern";
|
|
5
|
+
export const toolMetadata = {
|
|
6
|
+
getRDFoxFacts: {
|
|
7
|
+
name: "getRDFoxFacts",
|
|
8
|
+
category: "rdfox",
|
|
9
|
+
humanName: "Query knowledge base",
|
|
10
|
+
description: "Retrieve facts from RDFox knowledge base using SPARQL",
|
|
11
|
+
getHumanName: (input) => {
|
|
12
|
+
return input?.humanIntent || "Querying...";
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
addRDFoxFacts: {
|
|
16
|
+
name: "addRDFoxFacts",
|
|
17
|
+
category: "rdfox",
|
|
18
|
+
humanName: "Add facts",
|
|
19
|
+
description: "Add facts to RDFox knowledge base as Turtle",
|
|
20
|
+
getHumanName: (input) => {
|
|
21
|
+
return input?.humanIntent || "Adding facts...";
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
getRDFoxRules: {
|
|
25
|
+
name: "getRDFoxRules",
|
|
26
|
+
category: "rdfox",
|
|
27
|
+
humanName: "Check rules",
|
|
28
|
+
description: "Retrieve Datalog rules from RDFox with optional filters (named graph, rdf:type, limit) to avoid context overflow",
|
|
29
|
+
getHumanName: (input) => {
|
|
30
|
+
const parts = [];
|
|
31
|
+
if (input?.namedGraphIri)
|
|
32
|
+
parts.push(`plan: ${input.namedGraphIri}`);
|
|
33
|
+
if (isPresent(input?.rdfTypes))
|
|
34
|
+
parts.push(`types: ${input.rdfTypes.join(", ")}`);
|
|
35
|
+
if (!isPresent(parts))
|
|
36
|
+
return "Checking rules...";
|
|
37
|
+
return `Checking rules ${parts.join(" + ")}`;
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
explainRDFoxRules: {
|
|
41
|
+
name: "explainRDFoxRules",
|
|
42
|
+
category: "rdfox",
|
|
43
|
+
humanName: "Explain reasoning",
|
|
44
|
+
description: "Explain how facts are derived using rules",
|
|
45
|
+
getHumanName: () => "Explaining reasoning...",
|
|
46
|
+
},
|
|
47
|
+
scheduleTask: {
|
|
48
|
+
name: "scheduleTask",
|
|
49
|
+
category: "scheduler",
|
|
50
|
+
humanName: "Schedule task",
|
|
51
|
+
description: "Schedule a task for future execution",
|
|
52
|
+
getHumanName: (input) => {
|
|
53
|
+
return input?.description ? `Schedule: ${input.description}` : "Scheduling...";
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
listScheduledTasks: {
|
|
57
|
+
name: "listScheduledTasks",
|
|
58
|
+
category: "scheduler",
|
|
59
|
+
humanName: "List scheduled tasks",
|
|
60
|
+
description: "List all scheduled tasks",
|
|
61
|
+
getHumanName: () => "List scheduled tasks",
|
|
62
|
+
},
|
|
63
|
+
cancelSchedule: {
|
|
64
|
+
name: "cancelSchedule",
|
|
65
|
+
category: "scheduler",
|
|
66
|
+
humanName: "Cancel task",
|
|
67
|
+
description: "Cancel a scheduled task",
|
|
68
|
+
getHumanName: (input) => {
|
|
69
|
+
return input?.id ? `Cancel task: ${input.id}` : "Canceling task...";
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
generateChart: {
|
|
73
|
+
name: "generateChart",
|
|
74
|
+
category: "charts",
|
|
75
|
+
humanName: "Generate chart",
|
|
76
|
+
description: "Create interactive charts for data visualization",
|
|
77
|
+
getHumanName: (input) => {
|
|
78
|
+
return input?.title ? `Chart: ${input.title}` : "Charting...";
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
executeActionPlan: {
|
|
82
|
+
name: "executeActionPlan",
|
|
83
|
+
category: "action",
|
|
84
|
+
humanName: "Execute action plan",
|
|
85
|
+
description: "Execute semantic action plans with SHACL validation and multi-platform orchestration",
|
|
86
|
+
getHumanName: (input) => {
|
|
87
|
+
return input?.namedGraphIri ? `Execute plan: ${input.namedGraphIri}` : "Executing action plan...";
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
manageRDFoxRules: {
|
|
91
|
+
name: "manageRDFoxRules",
|
|
92
|
+
category: "rdfox",
|
|
93
|
+
humanName: "Manage rules",
|
|
94
|
+
description: "Add, change, or remove Datalog rules in RDFox knowledge base",
|
|
95
|
+
getHumanName: (input) => {
|
|
96
|
+
return input?.humanIntent || "Managing rules...";
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
manageRDFoxFacts: {
|
|
100
|
+
name: "manageRDFoxFacts",
|
|
101
|
+
category: "rdfox",
|
|
102
|
+
humanName: "Manage facts",
|
|
103
|
+
description: "Add, change facts in RDFox knowledge",
|
|
104
|
+
getHumanName: (input) => {
|
|
105
|
+
return input?.humanIntent || "Managing facts...";
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
actionPlanShowcase: {
|
|
109
|
+
name: "actionPlanShowcase",
|
|
110
|
+
category: "action",
|
|
111
|
+
humanName: "Show action plan",
|
|
112
|
+
description: "Display a summary card for an action plan with steps and navigation CTA",
|
|
113
|
+
getHumanName: (input) => {
|
|
114
|
+
if (input?.actionPlanIRI) {
|
|
115
|
+
const fragment = iriLocalName(input.actionPlanIRI);
|
|
116
|
+
return fragment ? `Showcasing plan: ${fragment}` : "Showing action plan...";
|
|
117
|
+
}
|
|
118
|
+
return "Showing action plan...";
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
showEntities: {
|
|
122
|
+
name: "showEntities",
|
|
123
|
+
category: "action",
|
|
124
|
+
humanName: "Show entities",
|
|
125
|
+
description: "Display one or several knowledge-graph entities inline in one call",
|
|
126
|
+
getHumanName: (input) => {
|
|
127
|
+
if (!isPresent(input?.entityIris))
|
|
128
|
+
return "Showing entities...";
|
|
129
|
+
return `Showing: ${humanCount(input.entityIris.length, "entity")}`;
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
enableAutoPilot: {
|
|
133
|
+
name: "enableAutoPilot",
|
|
134
|
+
category: "auto-pilot",
|
|
135
|
+
humanName: "Enable auto-pilot",
|
|
136
|
+
description: "Enable automatic scheduled execution of an action plan",
|
|
137
|
+
getHumanName: (input) => input?.humanIntent || "Enabling auto-pilot...",
|
|
138
|
+
},
|
|
139
|
+
enableAutoPilotCron: {
|
|
140
|
+
name: "enableAutoPilotCron",
|
|
141
|
+
category: "auto-pilot",
|
|
142
|
+
humanName: "Enable auto-pilot (cron)",
|
|
143
|
+
description: "Enable automatic scheduled execution of an action plan on a cron schedule",
|
|
144
|
+
getHumanName: (input) => input?.humanIntent || "Enabling auto-pilot...",
|
|
145
|
+
},
|
|
146
|
+
disableAutoPilot: {
|
|
147
|
+
name: "disableAutoPilot",
|
|
148
|
+
category: "auto-pilot",
|
|
149
|
+
humanName: "Disable auto-pilot",
|
|
150
|
+
description: "Disable automatic scheduled execution of an action plan",
|
|
151
|
+
getHumanName: (input) => input?.humanIntent || "Disabling auto-pilot...",
|
|
152
|
+
},
|
|
153
|
+
checkAutoPilotStatus: {
|
|
154
|
+
name: "checkAutoPilotStatus",
|
|
155
|
+
category: "auto-pilot",
|
|
156
|
+
humanName: "Check auto-pilot status",
|
|
157
|
+
description: "Check whether auto-pilot is enabled and review cadence and execution history",
|
|
158
|
+
getHumanName: (input) => input?.humanIntent || "Checking auto-pilot status...",
|
|
159
|
+
},
|
|
160
|
+
setAutoPilotCadence: {
|
|
161
|
+
name: "setAutoPilotCadence",
|
|
162
|
+
category: "auto-pilot",
|
|
163
|
+
humanName: "Update auto-pilot cadence",
|
|
164
|
+
description: "Change the recurrence cadence for an already-enabled auto-pilot plan",
|
|
165
|
+
getHumanName: (input) => input?.humanIntent || "Updating auto-pilot cadence...",
|
|
166
|
+
},
|
|
167
|
+
markAsLowRisk: {
|
|
168
|
+
name: "markAsLowRisk",
|
|
169
|
+
category: "auto-pilot",
|
|
170
|
+
humanName: "Mark as low-risk",
|
|
171
|
+
description: "Mark an action plan as low-risk, making it immediately eligible for auto-pilot",
|
|
172
|
+
getHumanName: (input) => input?.humanIntent || "Marking plan as low-risk...",
|
|
173
|
+
},
|
|
174
|
+
readUploadedFile: {
|
|
175
|
+
name: "readUploadedFile",
|
|
176
|
+
category: "action",
|
|
177
|
+
humanName: "Read attachment",
|
|
178
|
+
description: "Read the contents of a file the user uploaded to this conversation",
|
|
179
|
+
getHumanName: () => "Reading attachment...",
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
export function getToolMetadata(toolName) {
|
|
183
|
+
return toolMetadata[toolName];
|
|
184
|
+
}
|
|
185
|
+
export function getHumanToolName(toolName, input) {
|
|
186
|
+
const metadata = getToolMetadata(toolName);
|
|
187
|
+
return metadata.getHumanName(input);
|
|
188
|
+
}
|
|
189
|
+
export function isValidToolName(toolName) {
|
|
190
|
+
return Object.prototype.hasOwnProperty.call(toolMetadata, toolName);
|
|
191
|
+
}
|
|
192
|
+
export function getSkillToolLabel(toolUIPart) {
|
|
193
|
+
return match(toolUIPart)
|
|
194
|
+
.with({ type: "tool-activate_skill", input: { name: P.string } }, ({ input }) => `Reading skill: ${input.name}`)
|
|
195
|
+
.with({ type: "tool-activate_skill" }, () => "Reading skill...")
|
|
196
|
+
.with({ type: "tool-read_skill_resource", input: { path: P.string } }, ({ input }) => `Reading resource: ${input.path}`)
|
|
197
|
+
.with({ type: "tool-read_skill_resource" }, () => "Reading resource...")
|
|
198
|
+
.otherwise(() => undefined);
|
|
199
|
+
}
|
|
200
|
+
export function getToolUIPartLabel(toolUIPart) {
|
|
201
|
+
const skillLabel = getSkillToolLabel(toolUIPart);
|
|
202
|
+
if (skillLabel)
|
|
203
|
+
return skillLabel;
|
|
204
|
+
const toolName = toolUIPart.type.replace("tool-", "");
|
|
205
|
+
if (!isValidToolName(toolName))
|
|
206
|
+
return toolName;
|
|
207
|
+
const input = toolUIPart.input;
|
|
208
|
+
return input ? getHumanToolName(toolName, input) : getToolMetadata(toolName).humanName;
|
|
209
|
+
}
|
|
210
|
+
export function assertValidToolName(toolName) {
|
|
211
|
+
if (!isValidToolName(toolName)) {
|
|
212
|
+
throw new Error(`Unknown tool: ${toolName}. Add it to shared/tools/types.ts and metadata.ts`);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
export const allToolNames = Object.keys(toolMetadata);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from "zod/v4";
|
|
2
|
+
export declare const testTripleInputSchema: z.ZodObject<{
|
|
3
|
+
subject: z.ZodString;
|
|
4
|
+
predicate: z.ZodString;
|
|
5
|
+
object: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
6
|
+
type: z.ZodLiteral<"iri">;
|
|
7
|
+
value: z.ZodString;
|
|
8
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
9
|
+
type: z.ZodLiteral<"literal">;
|
|
10
|
+
value: z.ZodString;
|
|
11
|
+
datatype: z.ZodOptional<z.ZodString>;
|
|
12
|
+
language: z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, z.core.$strip>], "type">;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export type TestTripleInput = z.infer<typeof testTripleInputSchema>;
|
|
16
|
+
//# sourceMappingURL=test-triple.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-triple.d.ts","sourceRoot":"","sources":["../../../src/shared/tools/test-triple.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AA0B3B,eAAO,MAAM,qBAAqB;;;;;;;;;;;;iBAIhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|