@illuma-ai/agents 1.4.0-alpha.0 → 1.4.0-alpha.2
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/cjs/main.cjs +20 -10
- package/dist/cjs/main.cjs.map +1 -1
- package/dist/cjs/tools/fileSearch/formatter.cjs +95 -0
- package/dist/cjs/tools/fileSearch/formatter.cjs.map +1 -0
- package/dist/cjs/tools/fileSearch/ragClient.cjs +104 -0
- package/dist/cjs/tools/fileSearch/ragClient.cjs.map +1 -0
- package/dist/cjs/tools/fileSearch/schema.cjs +18 -0
- package/dist/cjs/tools/fileSearch/schema.cjs.map +1 -0
- package/dist/cjs/tools/fileSearch/tool.cjs +155 -0
- package/dist/cjs/tools/fileSearch/tool.cjs.map +1 -0
- package/dist/esm/main.mjs +4 -1
- package/dist/esm/main.mjs.map +1 -1
- package/dist/esm/tools/fileSearch/formatter.mjs +92 -0
- package/dist/esm/tools/fileSearch/formatter.mjs.map +1 -0
- package/dist/esm/tools/fileSearch/ragClient.mjs +100 -0
- package/dist/esm/tools/fileSearch/ragClient.mjs.map +1 -0
- package/dist/esm/tools/fileSearch/schema.mjs +15 -0
- package/dist/esm/tools/fileSearch/schema.mjs.map +1 -0
- package/dist/esm/tools/fileSearch/tool.mjs +152 -0
- package/dist/esm/tools/fileSearch/tool.mjs.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/providers/index.d.ts +0 -1
- package/dist/types/tools/fileSearch/formatter.d.ts +25 -0
- package/dist/types/tools/fileSearch/index.d.ts +5 -0
- package/dist/types/tools/fileSearch/ragClient.d.ts +32 -0
- package/dist/types/tools/fileSearch/schema.d.ts +13 -0
- package/dist/types/tools/fileSearch/tool.d.ts +18 -0
- package/dist/types/tools/fileSearch/types.d.ts +139 -0
- package/package.json +1 -6
- package/src/index.ts +1 -0
- package/src/providers/index.ts +4 -1
- package/src/tools/fileSearch/__tests__/tool.test.ts +251 -0
- package/src/tools/fileSearch/formatter.ts +131 -0
- package/src/tools/fileSearch/index.ts +23 -0
- package/src/tools/fileSearch/ragClient.ts +141 -0
- package/src/tools/fileSearch/schema.ts +19 -0
- package/src/tools/fileSearch/tool.ts +207 -0
- package/src/tools/fileSearch/types.ts +147 -0
- package/dist/cjs/providers/composite/CompositeCapabilityProvider.cjs +0 -80
- package/dist/cjs/providers/composite/CompositeCapabilityProvider.cjs.map +0 -1
- package/dist/esm/providers/composite/CompositeCapabilityProvider.mjs +0 -78
- package/dist/esm/providers/composite/CompositeCapabilityProvider.mjs.map +0 -1
- package/dist/types/providers/composite/CompositeCapabilityProvider.d.ts +0 -22
- package/dist/types/providers/composite/index.d.ts +0 -1
- package/src/providers/__tests__/CompositeCapabilityProvider.test.ts +0 -93
- package/src/providers/composite/CompositeCapabilityProvider.ts +0 -112
- package/src/providers/composite/index.ts +0 -1
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CompositeCapabilityProvider — fans out to multiple CapabilityProviders
|
|
3
|
-
* and merges their manifests + runnables into one.
|
|
4
|
-
*
|
|
5
|
-
* Use case: an agent that consumes tools from tools-server AND MCP servers
|
|
6
|
-
* AND (future) skills. The composite exposes a single CapabilityProvider
|
|
7
|
-
* interface to the agent runtime so it doesn't know or care how many
|
|
8
|
-
* backing sources exist.
|
|
9
|
-
*
|
|
10
|
-
* Precedence: later providers do NOT override earlier ones on name
|
|
11
|
-
* collision — collisions are logged and the first-registered capability
|
|
12
|
-
* wins. Callers should ensure providers expose disjoint name spaces.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import type { StructuredToolInterface } from '@langchain/core/tools';
|
|
16
|
-
import type {
|
|
17
|
-
Capability,
|
|
18
|
-
CapabilityFilter,
|
|
19
|
-
CapabilityProvider,
|
|
20
|
-
CredentialMap,
|
|
21
|
-
} from '@/providers/types';
|
|
22
|
-
|
|
23
|
-
export class CompositeCapabilityProvider implements CapabilityProvider {
|
|
24
|
-
readonly providerId: string;
|
|
25
|
-
private readonly providers: CapabilityProvider[];
|
|
26
|
-
|
|
27
|
-
constructor(providers: CapabilityProvider[]) {
|
|
28
|
-
if (!providers.length) {
|
|
29
|
-
throw new Error(
|
|
30
|
-
'CompositeCapabilityProvider: at least one provider is required'
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
this.providers = providers;
|
|
34
|
-
this.providerId = `composite:${providers.map((p) => p.providerId).join(',')}`;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
async fetchManifest(filter?: CapabilityFilter): Promise<Capability[]> {
|
|
38
|
-
// Fetch all providers in parallel. One provider failing should not
|
|
39
|
-
// prevent others from contributing — log and continue.
|
|
40
|
-
const results = await Promise.allSettled(
|
|
41
|
-
this.providers.map((p) => p.fetchManifest(filter))
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
const merged: Capability[] = [];
|
|
45
|
-
const seen = new Set<string>();
|
|
46
|
-
|
|
47
|
-
for (let i = 0; i < results.length; i++) {
|
|
48
|
-
const result = results[i];
|
|
49
|
-
const provider = this.providers[i];
|
|
50
|
-
|
|
51
|
-
if (result.status === 'rejected') {
|
|
52
|
-
// DEBUG
|
|
53
|
-
// eslint-disable-next-line no-console
|
|
54
|
-
console.debug(
|
|
55
|
-
`[composite] provider ${provider.providerId} fetchManifest failed — ${String(result.reason)}`
|
|
56
|
-
);
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
for (const cap of result.value) {
|
|
61
|
-
if (seen.has(cap.name)) {
|
|
62
|
-
// DEBUG
|
|
63
|
-
// eslint-disable-next-line no-console
|
|
64
|
-
console.debug(
|
|
65
|
-
`[composite] name collision on "${cap.name}" from ${provider.providerId} — keeping first`
|
|
66
|
-
);
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
seen.add(cap.name);
|
|
70
|
-
merged.push(cap);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// DEBUG
|
|
75
|
-
// eslint-disable-next-line no-console
|
|
76
|
-
console.debug(
|
|
77
|
-
`[composite] merged manifest: ${merged.length} caps from ${this.providers.length} providers`
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
return merged;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
async createRunnables(
|
|
84
|
-
capabilities: Capability[],
|
|
85
|
-
credentials: CredentialMap
|
|
86
|
-
): Promise<StructuredToolInterface[]> {
|
|
87
|
-
// Determine which capabilities belong to which provider by refetching
|
|
88
|
-
// each provider's manifest and intersecting with the requested set.
|
|
89
|
-
// This keeps providers stateless — we don't require Capability to
|
|
90
|
-
// carry a back-reference to its provider.
|
|
91
|
-
const capabilityNames = new Set(capabilities.map((c) => c.name));
|
|
92
|
-
const perProviderCaps = await Promise.all(
|
|
93
|
-
this.providers.map(async (p) => {
|
|
94
|
-
const manifest = await p.fetchManifest();
|
|
95
|
-
return manifest.filter((c) => capabilityNames.has(c.name));
|
|
96
|
-
})
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
const allRunnables: StructuredToolInterface[] = [];
|
|
100
|
-
for (let i = 0; i < this.providers.length; i++) {
|
|
101
|
-
const providerCaps = perProviderCaps[i];
|
|
102
|
-
if (!providerCaps.length) continue;
|
|
103
|
-
const runnables = await this.providers[i].createRunnables(
|
|
104
|
-
providerCaps,
|
|
105
|
-
credentials
|
|
106
|
-
);
|
|
107
|
-
allRunnables.push(...runnables);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return allRunnables;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './CompositeCapabilityProvider';
|