@lore-co/adapter-generic 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 +110 -0
- package/README.md +35 -0
- package/dist/index.d.ts +127 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +241 -0
- package/dist/index.js.map +1 -0
- package/package.json +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-MIT
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2026 Treadie, Inc
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the MIT license that is effective on the second anniversary of the date we make
|
|
91
|
+
the Software available. On or after that date, you may use the Software under
|
|
92
|
+
the MIT license, in which case the following will apply:
|
|
93
|
+
|
|
94
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
95
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
96
|
+
the Software without restriction, including without limitation the rights to
|
|
97
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
98
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
99
|
+
so, subject to the following conditions:
|
|
100
|
+
|
|
101
|
+
The above copyright notice and this permission notice shall be included in all
|
|
102
|
+
copies or substantial portions of the Software.
|
|
103
|
+
|
|
104
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
105
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
106
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
107
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
108
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
109
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
110
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# `@lore-co/adapter-generic`
|
|
2
|
+
|
|
3
|
+
Host-controlled bridge for services that own their agent runtime.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
pnpm add @lore-co/adapter-generic
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { GenericAgentAdapter } from "@lore-co/adapter-generic";
|
|
11
|
+
|
|
12
|
+
const lore = new GenericAgentAdapter({
|
|
13
|
+
id: "incident-bot",
|
|
14
|
+
baseUrl: process.env.LORE_API_URL!,
|
|
15
|
+
headers: {
|
|
16
|
+
authorization: `Bearer ${process.env.LORE_WORKSPACE_TOKEN!}`,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const prepared = await lore.prepareDelivery({
|
|
21
|
+
connector: "pager-webhook",
|
|
22
|
+
eventId: incident.id,
|
|
23
|
+
sessionId: incident.id,
|
|
24
|
+
task: incident.summary,
|
|
25
|
+
repo: "acme/service",
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The adapter forces the configured agent ID and requires the host to supply
|
|
30
|
+
stable connector, event, and session identities. `observeEvent`,
|
|
31
|
+
`prepareDelivery`, and `processTurn` expose audited events, receipts, and
|
|
32
|
+
delivered memories. `prepareTask` remains as a legacy compatibility path.
|
|
33
|
+
Model and MCP policy stays with the host application.
|
|
34
|
+
|
|
35
|
+
Node.js 22 or newer is required.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { type AgentAdapter, type AgentInteraction, type AgentMessage, type AgentTask, type ContextDeliveryRequest, type ContextDeliveryResponse, type Memory, type MemoryScope, type ObservationRequest, type ObservationResponse, type ObserveResponse, type PairedTurnMessage, type PairedTurnRequest, type PairedTurnResponse, type TurnScope } from "@lore-co/core";
|
|
2
|
+
import { SharedMemoryClient, type SharedMemoryClientOptions } from "@lore-co/sdk";
|
|
3
|
+
export interface AdapterScopeInput {
|
|
4
|
+
scope?: MemoryScope;
|
|
5
|
+
organization?: string;
|
|
6
|
+
project?: string;
|
|
7
|
+
repo?: string;
|
|
8
|
+
path?: string;
|
|
9
|
+
component?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface AdapterInteractionInput extends AdapterScopeInput {
|
|
12
|
+
agent?: string;
|
|
13
|
+
sessionId?: string;
|
|
14
|
+
messages: readonly AgentMessage[];
|
|
15
|
+
}
|
|
16
|
+
export interface AdapterTaskInput extends AdapterScopeInput {
|
|
17
|
+
agent?: string;
|
|
18
|
+
task?: string;
|
|
19
|
+
prompt?: string;
|
|
20
|
+
instruction?: string;
|
|
21
|
+
diff?: string;
|
|
22
|
+
files?: readonly string[];
|
|
23
|
+
components?: readonly string[];
|
|
24
|
+
symbols?: readonly string[];
|
|
25
|
+
limit?: number;
|
|
26
|
+
}
|
|
27
|
+
export interface SharedMemoryAdapterOptions {
|
|
28
|
+
client?: SharedMemoryClient;
|
|
29
|
+
baseUrl?: string;
|
|
30
|
+
fetch?: SharedMemoryClientOptions["fetch"];
|
|
31
|
+
headers?: SharedMemoryClientOptions["headers"];
|
|
32
|
+
}
|
|
33
|
+
export interface GenericAgentAdapterOptions extends SharedMemoryAdapterOptions {
|
|
34
|
+
id: string;
|
|
35
|
+
}
|
|
36
|
+
export type GenericInteractionInput = AdapterInteractionInput;
|
|
37
|
+
export type GenericTaskInput = AdapterTaskInput;
|
|
38
|
+
export interface GenericHostIdentity {
|
|
39
|
+
connector: string;
|
|
40
|
+
eventId: string;
|
|
41
|
+
sessionId: string;
|
|
42
|
+
conversationId?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface GenericHostScopeInput {
|
|
45
|
+
scope?: TurnScope;
|
|
46
|
+
project?: string;
|
|
47
|
+
repo?: string;
|
|
48
|
+
path?: string;
|
|
49
|
+
component?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface GenericHostTaskInput extends GenericHostScopeInput {
|
|
52
|
+
task?: string;
|
|
53
|
+
prompt?: string;
|
|
54
|
+
instruction?: string;
|
|
55
|
+
diff?: string;
|
|
56
|
+
files?: readonly string[];
|
|
57
|
+
components?: readonly string[];
|
|
58
|
+
symbols?: readonly string[];
|
|
59
|
+
limit?: number;
|
|
60
|
+
}
|
|
61
|
+
export interface GenericObservationInput extends GenericHostIdentity, GenericHostScopeInput {
|
|
62
|
+
task?: string;
|
|
63
|
+
prompt?: string;
|
|
64
|
+
instruction?: string;
|
|
65
|
+
messages: readonly AgentMessage[];
|
|
66
|
+
occurredAt: string;
|
|
67
|
+
metadata?: Record<string, unknown>;
|
|
68
|
+
}
|
|
69
|
+
export interface GenericDeliveryInput extends GenericHostTaskInput {
|
|
70
|
+
connector: string;
|
|
71
|
+
eventId: string;
|
|
72
|
+
sessionId: string;
|
|
73
|
+
}
|
|
74
|
+
export interface GenericTurnInput extends GenericHostIdentity, GenericHostTaskInput {
|
|
75
|
+
previousAssistant: PairedTurnMessage | string;
|
|
76
|
+
currentUser?: PairedTurnMessage | string;
|
|
77
|
+
currentUserPrompt?: string;
|
|
78
|
+
learningScope?: TurnScope;
|
|
79
|
+
occurredAt?: string;
|
|
80
|
+
metadata?: Record<string, unknown>;
|
|
81
|
+
}
|
|
82
|
+
export interface GenericPromptPayload {
|
|
83
|
+
prompt: string;
|
|
84
|
+
task: AgentTask;
|
|
85
|
+
memories: Memory[];
|
|
86
|
+
}
|
|
87
|
+
export type GenericPreparedDelivery = ContextDeliveryResponse & {
|
|
88
|
+
prompt: string;
|
|
89
|
+
task: AgentTask;
|
|
90
|
+
};
|
|
91
|
+
export type GenericProcessedTurn = PairedTurnResponse & {
|
|
92
|
+
prompt: string;
|
|
93
|
+
turn: PairedTurnRequest;
|
|
94
|
+
memories: Memory[];
|
|
95
|
+
};
|
|
96
|
+
export interface SharedMemoryDelimiters {
|
|
97
|
+
start: string;
|
|
98
|
+
end: string;
|
|
99
|
+
}
|
|
100
|
+
export declare const GENERIC_SHARED_MEMORY_DELIMITERS: SharedMemoryDelimiters;
|
|
101
|
+
export declare function createAdapterClient(options: SharedMemoryAdapterOptions): SharedMemoryClient;
|
|
102
|
+
export declare function toSharedInteraction(input: AdapterInteractionInput, agent: string): AgentInteraction;
|
|
103
|
+
export declare function taskText(input: AdapterTaskInput): string;
|
|
104
|
+
export declare function normalizeHostScope(input: GenericHostScopeInput): TurnScope;
|
|
105
|
+
export declare function toHostTask(input: GenericHostTaskInput, agent: string): AgentTask;
|
|
106
|
+
export declare function toSharedTask(input: AdapterTaskInput, agent: string): AgentTask;
|
|
107
|
+
export declare function formatMemoryList(memories: readonly Memory[], formatMemory?: (memory: Memory) => string): string;
|
|
108
|
+
export declare function injectSharedMemory(originalTask: string, context: string, delimiters?: SharedMemoryDelimiters): string;
|
|
109
|
+
export declare class GenericAgentAdapter implements AgentAdapter<GenericInteractionInput, GenericTaskInput, GenericPromptPayload> {
|
|
110
|
+
readonly id: string;
|
|
111
|
+
protected readonly client: SharedMemoryClient;
|
|
112
|
+
constructor(options: GenericAgentAdapterOptions);
|
|
113
|
+
toInteraction(input: GenericInteractionInput): AgentInteraction;
|
|
114
|
+
toTask(input: GenericTaskInput): AgentTask;
|
|
115
|
+
toObservation(input: GenericObservationInput): ObservationRequest;
|
|
116
|
+
toDelivery(input: GenericDeliveryInput): ContextDeliveryRequest;
|
|
117
|
+
toTurn(input: GenericTurnInput): PairedTurnRequest;
|
|
118
|
+
observe(input: GenericInteractionInput): Promise<ObserveResponse>;
|
|
119
|
+
observeEvent(input: GenericObservationInput): Promise<ObservationResponse>;
|
|
120
|
+
getContext(input: GenericTaskInput): Promise<Memory[]>;
|
|
121
|
+
formatContext(memories: readonly Memory[]): string;
|
|
122
|
+
/** @deprecated Use prepareDelivery for an audited host integration. */
|
|
123
|
+
prepareTask(input: GenericTaskInput): Promise<GenericPromptPayload>;
|
|
124
|
+
prepareDelivery(input: GenericDeliveryInput): Promise<GenericPreparedDelivery>;
|
|
125
|
+
processTurn(input: GenericTurnInput, idempotencyKey?: string): Promise<GenericProcessedTurn>;
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","source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AAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,eAAe,CAAC;IAIjE,YAAY,CAChB,KAAK,EAAE,uBAAuB,GAC7B,OAAO,CAAC,mBAAmB,CAAC;IAIzB,UAAU,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAK5D,aAAa,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM;IAIlD,uEAAuE;IACjE,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAanE,eAAe,CACnB,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAAC,uBAAuB,CAAC;IAU7B,WAAW,CACf,KAAK,EAAE,gBAAgB,EACvB,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,oBAAoB,CAAC;CAajC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { AgentInteractionSchema, AgentTaskSchema, ContextDeliveryRequestSchema, GENERIC_LORE_CONTEXT_DELIMITERS, MemorySchema, ObservationRequestSchema, PairedTurnRequestSchema, TurnScopeSchema, } from "@lore-co/core";
|
|
2
|
+
import { SharedMemoryClient, } from "@lore-co/sdk";
|
|
3
|
+
export const GENERIC_SHARED_MEMORY_DELIMITERS = {
|
|
4
|
+
...GENERIC_LORE_CONTEXT_DELIMITERS,
|
|
5
|
+
};
|
|
6
|
+
function present(value) {
|
|
7
|
+
return value !== undefined;
|
|
8
|
+
}
|
|
9
|
+
export function createAdapterClient(options) {
|
|
10
|
+
if (options.client !== undefined) {
|
|
11
|
+
if (options.baseUrl !== undefined) {
|
|
12
|
+
throw new Error("Provide either client or baseUrl, not both");
|
|
13
|
+
}
|
|
14
|
+
return options.client;
|
|
15
|
+
}
|
|
16
|
+
if (options.baseUrl === undefined) {
|
|
17
|
+
throw new Error("An injected SharedMemoryClient or baseUrl is required");
|
|
18
|
+
}
|
|
19
|
+
return new SharedMemoryClient({
|
|
20
|
+
baseUrl: options.baseUrl,
|
|
21
|
+
...(options.fetch === undefined ? {} : { fetch: options.fetch }),
|
|
22
|
+
...(options.headers === undefined ? {} : { headers: options.headers }),
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export function toSharedInteraction(input, agent) {
|
|
26
|
+
return AgentInteractionSchema.parse({
|
|
27
|
+
agent,
|
|
28
|
+
...(input.scope === undefined ? {} : { scope: input.scope }),
|
|
29
|
+
...(input.organization === undefined
|
|
30
|
+
? {}
|
|
31
|
+
: { organization: input.organization }),
|
|
32
|
+
...(input.project === undefined ? {} : { project: input.project }),
|
|
33
|
+
...(input.repo === undefined ? {} : { repo: input.repo }),
|
|
34
|
+
...(input.path === undefined ? {} : { path: input.path }),
|
|
35
|
+
...(input.component === undefined ? {} : { component: input.component }),
|
|
36
|
+
...(input.sessionId === undefined ? {} : { sessionId: input.sessionId }),
|
|
37
|
+
messages: input.messages.map((message) => ({
|
|
38
|
+
role: message.role,
|
|
39
|
+
content: message.content,
|
|
40
|
+
...(message.id === undefined ? {} : { id: message.id }),
|
|
41
|
+
...(message.timestamp === undefined
|
|
42
|
+
? {}
|
|
43
|
+
: { timestamp: message.timestamp }),
|
|
44
|
+
})),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
export function taskText(input) {
|
|
48
|
+
const value = input.task ?? input.prompt ?? input.instruction;
|
|
49
|
+
if (value === undefined) {
|
|
50
|
+
throw new Error("Task text is required in task, prompt, or instruction");
|
|
51
|
+
}
|
|
52
|
+
return value;
|
|
53
|
+
}
|
|
54
|
+
function optionalTaskText(input) {
|
|
55
|
+
return input.task ?? input.prompt ?? input.instruction;
|
|
56
|
+
}
|
|
57
|
+
export function normalizeHostScope(input) {
|
|
58
|
+
for (const field of ["project", "repo", "path", "component"]) {
|
|
59
|
+
const nested = input.scope?.[field];
|
|
60
|
+
const flat = input[field];
|
|
61
|
+
if (nested !== undefined && flat !== undefined && nested !== flat) {
|
|
62
|
+
throw new Error(`Conflicting ${field} values were provided`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return TurnScopeSchema.parse({
|
|
66
|
+
...input.scope,
|
|
67
|
+
...(input.project === undefined ? {} : { project: input.project }),
|
|
68
|
+
...(input.repo === undefined ? {} : { repo: input.repo }),
|
|
69
|
+
...(input.path === undefined ? {} : { path: input.path }),
|
|
70
|
+
...(input.component === undefined ? {} : { component: input.component }),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
export function toHostTask(input, agent) {
|
|
74
|
+
return AgentTaskSchema.parse({
|
|
75
|
+
agent,
|
|
76
|
+
scope: normalizeHostScope(input),
|
|
77
|
+
task: taskText(input),
|
|
78
|
+
...(input.diff === undefined ? {} : { diff: input.diff }),
|
|
79
|
+
...(input.files === undefined ? {} : { files: [...input.files] }),
|
|
80
|
+
...(input.components === undefined
|
|
81
|
+
? {}
|
|
82
|
+
: { components: [...input.components] }),
|
|
83
|
+
...(input.symbols === undefined ? {} : { symbols: [...input.symbols] }),
|
|
84
|
+
...(input.limit === undefined ? {} : { limit: input.limit }),
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
export function toSharedTask(input, agent) {
|
|
88
|
+
return AgentTaskSchema.parse({
|
|
89
|
+
agent,
|
|
90
|
+
...(input.scope === undefined ? {} : { scope: input.scope }),
|
|
91
|
+
...(input.organization === undefined
|
|
92
|
+
? {}
|
|
93
|
+
: { organization: input.organization }),
|
|
94
|
+
...(input.project === undefined ? {} : { project: input.project }),
|
|
95
|
+
...(input.repo === undefined ? {} : { repo: input.repo }),
|
|
96
|
+
...(input.path === undefined ? {} : { path: input.path }),
|
|
97
|
+
...(input.component === undefined ? {} : { component: input.component }),
|
|
98
|
+
task: taskText(input),
|
|
99
|
+
...(input.diff === undefined ? {} : { diff: input.diff }),
|
|
100
|
+
...(input.files === undefined ? {} : { files: [...input.files] }),
|
|
101
|
+
...(input.components === undefined
|
|
102
|
+
? {}
|
|
103
|
+
: { components: [...input.components] }),
|
|
104
|
+
...(input.symbols === undefined ? {} : { symbols: [...input.symbols] }),
|
|
105
|
+
...(input.limit === undefined ? {} : { limit: input.limit }),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
export function formatMemoryList(memories, formatMemory = (memory) => `- [${memory.category}] ${memory.content}`) {
|
|
109
|
+
return memories
|
|
110
|
+
.map((memory) => MemorySchema.parse(memory))
|
|
111
|
+
.map(formatMemory)
|
|
112
|
+
.filter(present)
|
|
113
|
+
.join("\n");
|
|
114
|
+
}
|
|
115
|
+
export function injectSharedMemory(originalTask, context, delimiters = GENERIC_SHARED_MEMORY_DELIMITERS) {
|
|
116
|
+
const formatted = context.trim();
|
|
117
|
+
if (formatted === "") {
|
|
118
|
+
return originalTask;
|
|
119
|
+
}
|
|
120
|
+
return `${delimiters.start}\n${formatted}\n${delimiters.end}\n\n${originalTask}`;
|
|
121
|
+
}
|
|
122
|
+
export class GenericAgentAdapter {
|
|
123
|
+
id;
|
|
124
|
+
client;
|
|
125
|
+
constructor(options) {
|
|
126
|
+
const id = options.id.trim();
|
|
127
|
+
if (id === "") {
|
|
128
|
+
throw new Error("GenericAgentAdapter id is required");
|
|
129
|
+
}
|
|
130
|
+
this.id = id;
|
|
131
|
+
this.client = createAdapterClient(options);
|
|
132
|
+
}
|
|
133
|
+
toInteraction(input) {
|
|
134
|
+
return toSharedInteraction(input, this.id);
|
|
135
|
+
}
|
|
136
|
+
toTask(input) {
|
|
137
|
+
return toSharedTask(input, this.id);
|
|
138
|
+
}
|
|
139
|
+
toObservation(input) {
|
|
140
|
+
const normalizedTask = optionalTaskText(input);
|
|
141
|
+
return ObservationRequestSchema.parse({
|
|
142
|
+
connector: input.connector,
|
|
143
|
+
eventId: input.eventId,
|
|
144
|
+
agent: this.id,
|
|
145
|
+
sessionId: input.sessionId,
|
|
146
|
+
...(input.conversationId === undefined
|
|
147
|
+
? {}
|
|
148
|
+
: { conversationId: input.conversationId }),
|
|
149
|
+
scope: normalizeHostScope(input),
|
|
150
|
+
...(normalizedTask === undefined ? {} : { task: normalizedTask }),
|
|
151
|
+
messages: input.messages.map((message) => ({ ...message })),
|
|
152
|
+
occurredAt: input.occurredAt,
|
|
153
|
+
...(input.metadata === undefined ? {} : { metadata: input.metadata }),
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
toDelivery(input) {
|
|
157
|
+
return ContextDeliveryRequestSchema.parse({
|
|
158
|
+
connector: input.connector,
|
|
159
|
+
eventId: input.eventId,
|
|
160
|
+
sessionId: input.sessionId,
|
|
161
|
+
task: toHostTask(input, this.id),
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
toTurn(input) {
|
|
165
|
+
const normalizedTask = optionalTaskText(input);
|
|
166
|
+
return PairedTurnRequestSchema.parse({
|
|
167
|
+
connector: input.connector,
|
|
168
|
+
eventId: input.eventId,
|
|
169
|
+
agent: this.id,
|
|
170
|
+
sessionId: input.sessionId,
|
|
171
|
+
...(input.conversationId === undefined
|
|
172
|
+
? {}
|
|
173
|
+
: { conversationId: input.conversationId }),
|
|
174
|
+
previousAssistant: input.previousAssistant,
|
|
175
|
+
...(input.currentUser === undefined
|
|
176
|
+
? {}
|
|
177
|
+
: { currentUser: input.currentUser }),
|
|
178
|
+
...(input.currentUserPrompt === undefined
|
|
179
|
+
? {}
|
|
180
|
+
: { currentUserPrompt: input.currentUserPrompt }),
|
|
181
|
+
scope: normalizeHostScope(input),
|
|
182
|
+
...(input.learningScope === undefined
|
|
183
|
+
? {}
|
|
184
|
+
: { learningScope: TurnScopeSchema.parse(input.learningScope) }),
|
|
185
|
+
...(normalizedTask === undefined ? {} : { task: normalizedTask }),
|
|
186
|
+
...(input.files === undefined ? {} : { files: [...input.files] }),
|
|
187
|
+
...(input.components === undefined
|
|
188
|
+
? {}
|
|
189
|
+
: { components: [...input.components] }),
|
|
190
|
+
...(input.symbols === undefined ? {} : { symbols: [...input.symbols] }),
|
|
191
|
+
...(input.occurredAt === undefined
|
|
192
|
+
? {}
|
|
193
|
+
: { occurredAt: input.occurredAt }),
|
|
194
|
+
...(input.metadata === undefined ? {} : { metadata: input.metadata }),
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
async observe(input) {
|
|
198
|
+
return this.client.observe(this.toInteraction(input));
|
|
199
|
+
}
|
|
200
|
+
async observeEvent(input) {
|
|
201
|
+
return this.client.observeEvent(this.toObservation(input));
|
|
202
|
+
}
|
|
203
|
+
async getContext(input) {
|
|
204
|
+
const response = await this.client.getContext(this.toTask(input));
|
|
205
|
+
return response.memories.map((memory) => MemorySchema.parse(memory));
|
|
206
|
+
}
|
|
207
|
+
formatContext(memories) {
|
|
208
|
+
return formatMemoryList(memories);
|
|
209
|
+
}
|
|
210
|
+
/** @deprecated Use prepareDelivery for an audited host integration. */
|
|
211
|
+
async prepareTask(input) {
|
|
212
|
+
const task = this.toTask(input);
|
|
213
|
+
const response = await this.client.getContext(task);
|
|
214
|
+
const memories = response.memories.map((memory) => MemorySchema.parse(memory));
|
|
215
|
+
return {
|
|
216
|
+
prompt: injectSharedMemory(task.task, response.context),
|
|
217
|
+
task,
|
|
218
|
+
memories,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
async prepareDelivery(input) {
|
|
222
|
+
const delivery = this.toDelivery(input);
|
|
223
|
+
const response = await this.client.deliverContext(delivery);
|
|
224
|
+
return {
|
|
225
|
+
...response,
|
|
226
|
+
prompt: injectSharedMemory(delivery.task.task, response.context),
|
|
227
|
+
task: delivery.task,
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
async processTurn(input, idempotencyKey) {
|
|
231
|
+
const turn = this.toTurn(input);
|
|
232
|
+
const response = await this.client.processTurn(turn, idempotencyKey);
|
|
233
|
+
return {
|
|
234
|
+
...response,
|
|
235
|
+
prompt: injectSharedMemory(turn.currentUser.content, response.context.text),
|
|
236
|
+
turn,
|
|
237
|
+
memories: response.context.memories,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=index.js.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Q,CAAC,OAAO,CAAC;YACvD,IAAI;YACJ,QAAQ;SACT,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,KAA2B;QAE3B,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACxC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC5D,OAAO;YACL,GAAG,QAAQ;YACX,MAAM,EAAE,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC;YAChE,IAAI,EAAE,QAAQ,CAAC,IAAI;SACpB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,WAAW,CACf,KAAuB,EACvB,cAAuB;QAEvB,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAChC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QACrE,OAAO;YACL,GAAG,QAAQ;YACX,MAAM,EAAE,kBAAkB,CACxB,IAAI,CAAC,WAAW,CAAC,OAAO,EACxB,QAAQ,CAAC,OAAO,CAAC,IAAI,CACtB;YACD,IAAI;YACJ,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,QAAQ;SACpC,CAAC;IACJ,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lore-co/adapter-generic",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Host-controlled adapter for auditable Lore agent integrations",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=22.0.0"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"lore",
|
|
26
|
+
"ai",
|
|
27
|
+
"memory",
|
|
28
|
+
"adapter"
|
|
29
|
+
],
|
|
30
|
+
"license": "FSL-1.1-MIT",
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@lore-co/core": "0.1.0",
|
|
33
|
+
"@lore-co/sdk": "0.1.0"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"dev": "tsc -p tsconfig.json --watch --preserveWatchOutput",
|
|
37
|
+
"build": "tsc -p tsconfig.json",
|
|
38
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
39
|
+
"test": "vitest run --passWithNoTests"
|
|
40
|
+
}
|
|
41
|
+
}
|