dsh-mnemon-provider-honcho 0.5.0-rc.1
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/README.md +9 -0
- package/lib/descriptor-zBlkrGd-.js +76 -0
- package/lib/descriptor.d.ts +6 -0
- package/lib/descriptor.js +2 -0
- package/lib/index.d.ts +22 -0
- package/lib/index.js +169 -0
- package/package.json +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dsh-external contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# dsh-mnemon-provider-honcho
|
|
2
|
+
|
|
3
|
+
Cross-session user modelling, peer profiles, dialectic reasoning, and persistent conclusions.
|
|
4
|
+
|
|
5
|
+
This is a Memory Spaces **child module**, not a top-level Mnemon contribution. Its manifest, descriptor, driver, build and tests live here. It uses only the public dsh-mnemon-source-memory-spaces/provider-sdk entry.
|
|
6
|
+
|
|
7
|
+
Install alongside the Memory Spaces Source, then list { use: 'dsh-mnemon-provider-honcho', instanceId: 'honcho' } in that Source's providers. Multiple Source instances own independent children. Connection settings remain Source-owned; secret fields are never projected to the LLM.
|
|
8
|
+
|
|
9
|
+
Run pnpm install && pnpm verify from this directory. No root test config or private controller is required.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
//#endregion
|
|
2
|
+
//#region src/descriptor.ts
|
|
3
|
+
/** Browser-safe metadata owned by this Provider. */
|
|
4
|
+
const descriptor = {
|
|
5
|
+
"id": "honcho",
|
|
6
|
+
"label": "Honcho",
|
|
7
|
+
"icon": {
|
|
8
|
+
"kind": "data-url",
|
|
9
|
+
"value": "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjUwIiBoZWlnaHQ9IjY1MCIgdmlld0JveD0iMCAwIDY1MCA2NTAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSI2NTAiIGhlaWdodD0iNjUwIiBmaWxsPSIjMTAxNDQ3Ii8+CjxnIGZpbHRlcj0idXJsKCNmaWx0ZXIwX2RkXzExXzgpIj4KPHBhdGggZD0iTTMyNS41NiA4MEMyMzguNTkgODAgMTU3LjU0IDEyNi41OSAxMTMuNjIgMjAxLjY5Qzk0LjE4MDEgMjEzLjUxIDgxLjAwMDEgMjIxLjc4IDgwLjczMDEgMjIxLjkyQzQyLjgyMDEgMjQyLjU4IDIzLjkwMDEgMjYyLjI5IDE0LjYyMDEgMjc3LjlDNy40MTAxMSAyNzguMDMgMS4xNzAxI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JsZW5kIG1vZGU9Im5vcm1hbCIgaW49IlNvdXJjZUdyYXBoaWMiIGluMj0iZWZmZWN0Ml9kcm9wU2hhZG93XzExXzgiIHJlc3VsdD0ic2hhcGUiLz4KPC9maWx0ZXI+CjwvZGVmcz4KPC9zdmc+Cg=="
|
|
10
|
+
},
|
|
11
|
+
"kind": "remote",
|
|
12
|
+
"workspaceBinding": "provider-global",
|
|
13
|
+
"summary": "Cross-session user modelling, peer profiles, dialectic reasoning, and persistent conclusions.",
|
|
14
|
+
"summaryI18nKey": "overview.providerSummary.honcho",
|
|
15
|
+
"origin": "third-party",
|
|
16
|
+
"capabilities": {
|
|
17
|
+
"search": true,
|
|
18
|
+
"browse": true,
|
|
19
|
+
"graph": false,
|
|
20
|
+
"entities": false,
|
|
21
|
+
"related": false,
|
|
22
|
+
"remember": true,
|
|
23
|
+
"link": false,
|
|
24
|
+
"forget": true,
|
|
25
|
+
"writeMode": "exact",
|
|
26
|
+
"deletionMode": "hard"
|
|
27
|
+
},
|
|
28
|
+
"fields": [
|
|
29
|
+
{
|
|
30
|
+
"key": "endpoint",
|
|
31
|
+
"label": "Endpoint",
|
|
32
|
+
"scope": "service",
|
|
33
|
+
"input": "url",
|
|
34
|
+
"required": true,
|
|
35
|
+
"defaultValue": "https://api.honcho.dev",
|
|
36
|
+
"i18nKey": "overview.providerEndpoint"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"key": "apiKey",
|
|
40
|
+
"label": "API key",
|
|
41
|
+
"scope": "service",
|
|
42
|
+
"input": "secret",
|
|
43
|
+
"required": false,
|
|
44
|
+
"i18nKey": "overview.providerApiKey"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"key": "workspace",
|
|
48
|
+
"label": "Workspace",
|
|
49
|
+
"scope": "memory",
|
|
50
|
+
"input": "text",
|
|
51
|
+
"required": true,
|
|
52
|
+
"defaultValue": "dsh",
|
|
53
|
+
"i18nKey": "overview.providerField.workspace"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"key": "userId",
|
|
57
|
+
"label": "User peer",
|
|
58
|
+
"scope": "memory",
|
|
59
|
+
"input": "text",
|
|
60
|
+
"required": true,
|
|
61
|
+
"defaultValue": "dsh-user",
|
|
62
|
+
"i18nKey": "overview.providerField.userId"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"key": "agentId",
|
|
66
|
+
"label": "Agent peer",
|
|
67
|
+
"scope": "memory",
|
|
68
|
+
"input": "text",
|
|
69
|
+
"required": true,
|
|
70
|
+
"defaultValue": "dsh",
|
|
71
|
+
"i18nKey": "overview.providerField.agentId"
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
};
|
|
75
|
+
//#endregion
|
|
76
|
+
export { descriptor as t };
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { descriptor } from "./descriptor.js";
|
|
2
|
+
import { HttpMemoryProvider, HttpProviderOptions, Insight, JsonValue, MemoryBody, MemoryListRequest, MemoryProviderAdapter, MemorySpaceAuthority, ProviderBodyStatus, ProviderMemorySpace, ProviderSearchResult, RememberRequest, SearchRequest } from "dsh-mnemon-source-memory-spaces/provider-sdk";
|
|
3
|
+
//#region src/driver.d.ts
|
|
4
|
+
declare class HonchoProvider extends HttpMemoryProvider implements MemoryProviderAdapter {
|
|
5
|
+
readonly id: "honcho";
|
|
6
|
+
constructor(memoryBodies: MemorySpaceAuthority, options?: HttpProviderOptions);
|
|
7
|
+
discover(connection: Record<string, string | number | boolean>, signal?: AbortSignal): Promise<ProviderMemorySpace[]>;
|
|
8
|
+
status(body: MemoryBody, signal?: AbortSignal): Promise<ProviderBodyStatus>;
|
|
9
|
+
search(body: MemoryBody, request: SearchRequest, signal?: AbortSignal): Promise<ProviderSearchResult>;
|
|
10
|
+
list(body: MemoryBody, request: MemoryListRequest, signal?: AbortSignal): Promise<Insight[]>;
|
|
11
|
+
remember(body: MemoryBody, request: RememberRequest, signal?: AbortSignal): Promise<JsonValue>;
|
|
12
|
+
forget(body: MemoryBody, id: string, signal?: AbortSignal): Promise<JsonValue>;
|
|
13
|
+
private basePath;
|
|
14
|
+
private scope;
|
|
15
|
+
private headers;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/index.d.ts
|
|
19
|
+
declare const definition: import("dsh-mnemon-source-memory-spaces/provider-sdk").MemorySpaceProviderDefinition;
|
|
20
|
+
declare const _default: import("dsh-mnemon-source-memory-spaces/provider-sdk").MemorySpaceProviderModule<undefined>;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { HonchoProvider, _default as default, definition, descriptor };
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { t as descriptor } from "./descriptor-zBlkrGd-.js";
|
|
2
|
+
import { HttpMemoryProvider, MEMORY_SPACE_PROVIDER_API_VERSION, defineMemorySpaceProvider, defineMemorySpaceProviderDefinition, firstArray, jsonObject, jsonString } from "dsh-mnemon-source-memory-spaces/provider-sdk";
|
|
3
|
+
//#region src/driver.ts
|
|
4
|
+
function insight(value) {
|
|
5
|
+
const item = jsonObject(value);
|
|
6
|
+
const id = jsonString(item?.id);
|
|
7
|
+
const content = jsonString(item?.content);
|
|
8
|
+
if (id === void 0 || content === void 0) return void 0;
|
|
9
|
+
const observer = jsonString(item?.observer_id) ?? jsonString(item?.observer);
|
|
10
|
+
const observed = jsonString(item?.observed_id) ?? jsonString(item?.observed);
|
|
11
|
+
const createdAt = jsonString(item?.created_at) ?? jsonString(item?.createdAt);
|
|
12
|
+
const entities = [observer, observed].filter((entry) => entry !== void 0);
|
|
13
|
+
return {
|
|
14
|
+
id,
|
|
15
|
+
content,
|
|
16
|
+
category: jsonString(item?.level) ?? "insight",
|
|
17
|
+
source: "external",
|
|
18
|
+
...createdAt === void 0 ? {} : { createdAt },
|
|
19
|
+
...entities.length === 0 ? {} : { entities }
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
var HonchoProvider = class extends HttpMemoryProvider {
|
|
23
|
+
id = "honcho";
|
|
24
|
+
constructor(memoryBodies, options = {}) {
|
|
25
|
+
super(memoryBodies, {
|
|
26
|
+
label: descriptor.label,
|
|
27
|
+
...options
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
async discover(connection, signal) {
|
|
31
|
+
const payload = await this.requestConnection(connection, "/v3/workspaces/list?page=1&size=100", {
|
|
32
|
+
headers: this.headers(connection),
|
|
33
|
+
json: {},
|
|
34
|
+
signal
|
|
35
|
+
});
|
|
36
|
+
return firstArray(payload, "items", "results").flatMap((value) => {
|
|
37
|
+
const item = jsonObject(value);
|
|
38
|
+
const id = jsonString(item?.id);
|
|
39
|
+
if (id === void 0) return [];
|
|
40
|
+
const metadata = jsonObject(item?.metadata);
|
|
41
|
+
return [{
|
|
42
|
+
externalId: id,
|
|
43
|
+
name: jsonString(metadata?.name) ?? jsonString(metadata?.title) ?? id,
|
|
44
|
+
description: jsonString(metadata?.description) ?? `Honcho workspace ${id}`,
|
|
45
|
+
connection: {
|
|
46
|
+
workspace: id,
|
|
47
|
+
userId: "*",
|
|
48
|
+
agentId: "*"
|
|
49
|
+
}
|
|
50
|
+
}];
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
async status(body, signal) {
|
|
54
|
+
try {
|
|
55
|
+
await this.list(body, { limit: 1 }, signal);
|
|
56
|
+
return { healthy: true };
|
|
57
|
+
} catch (error) {
|
|
58
|
+
return {
|
|
59
|
+
healthy: false,
|
|
60
|
+
error: error instanceof Error ? error.message : String(error)
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async search(body, request, signal) {
|
|
65
|
+
const connection = this.connection(body);
|
|
66
|
+
const payload = await this.request(body, `${this.basePath(connection)}/conclusions/query`, {
|
|
67
|
+
headers: this.headers(connection),
|
|
68
|
+
json: {
|
|
69
|
+
query: request.query,
|
|
70
|
+
top_k: Math.min(request.limit ?? 10, 100),
|
|
71
|
+
filters: this.scope(connection, true)
|
|
72
|
+
},
|
|
73
|
+
signal
|
|
74
|
+
});
|
|
75
|
+
return { results: firstArray(payload, "items", "results").map(insight).filter((item) => item !== void 0) };
|
|
76
|
+
}
|
|
77
|
+
async list(body, request, signal) {
|
|
78
|
+
const connection = this.connection(body);
|
|
79
|
+
const limit = Math.min(Math.max(request.limit ?? 200, 1), 100);
|
|
80
|
+
const payload = await this.request(body, `${this.basePath(connection)}/conclusions/list?page=1&size=${limit}`, {
|
|
81
|
+
headers: this.headers(connection),
|
|
82
|
+
json: { filters: {
|
|
83
|
+
...this.scope(connection),
|
|
84
|
+
...request.category === void 0 ? {} : { level: request.category }
|
|
85
|
+
} },
|
|
86
|
+
signal
|
|
87
|
+
});
|
|
88
|
+
return firstArray(payload, "items", "results").map(insight).filter((item) => item !== void 0);
|
|
89
|
+
}
|
|
90
|
+
async remember(body, request, signal) {
|
|
91
|
+
const connection = this.connection(body);
|
|
92
|
+
const payload = await this.request(body, `${this.basePath(connection)}/conclusions`, {
|
|
93
|
+
headers: this.headers(connection),
|
|
94
|
+
json: { conclusions: [{
|
|
95
|
+
content: request.content,
|
|
96
|
+
observer_id: String(connection.agentId) === "*" ? "dsh" : String(connection.agentId),
|
|
97
|
+
observed_id: String(connection.userId) === "*" ? "dsh-user" : String(connection.userId),
|
|
98
|
+
session_id: null
|
|
99
|
+
}] },
|
|
100
|
+
signal
|
|
101
|
+
});
|
|
102
|
+
const created = firstArray(payload, "items", "results").map(jsonObject).find((item) => item !== void 0);
|
|
103
|
+
return {
|
|
104
|
+
action: "stored",
|
|
105
|
+
provider: this.id,
|
|
106
|
+
summary: "Honcho stored an explicit peer conclusion.",
|
|
107
|
+
...jsonString(created?.id) === void 0 ? {} : { id: jsonString(created?.id) }
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
async forget(body, id, signal) {
|
|
111
|
+
const connection = this.connection(body);
|
|
112
|
+
await this.request(body, `${this.basePath(connection)}/conclusions/${encodeURIComponent(id)}`, {
|
|
113
|
+
method: "DELETE",
|
|
114
|
+
headers: this.headers(connection),
|
|
115
|
+
signal
|
|
116
|
+
});
|
|
117
|
+
return {
|
|
118
|
+
action: "deleted",
|
|
119
|
+
provider: this.id,
|
|
120
|
+
id
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
basePath(connection) {
|
|
124
|
+
return `/v3/workspaces/${encodeURIComponent(String(connection.workspace))}`;
|
|
125
|
+
}
|
|
126
|
+
scope(connection, requirePeers = false) {
|
|
127
|
+
const agentId = String(connection.agentId);
|
|
128
|
+
const userId = String(connection.userId);
|
|
129
|
+
return {
|
|
130
|
+
...agentId === "*" ? requirePeers ? { observer_id: "dsh" } : {} : { observer_id: agentId },
|
|
131
|
+
...userId === "*" ? requirePeers ? { observed_id: "dsh-user" } : {} : { observed_id: userId }
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
headers(connection) {
|
|
135
|
+
const token = String(connection.apiKey ?? "").replace(/^Bearer\s+/iu, "");
|
|
136
|
+
return token === "" ? {} : { Authorization: `Bearer ${token}` };
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/index.ts
|
|
141
|
+
const definition = defineMemorySpaceProviderDefinition({
|
|
142
|
+
manifest: {
|
|
143
|
+
apiVersion: MEMORY_SPACE_PROVIDER_API_VERSION,
|
|
144
|
+
kind: "provider",
|
|
145
|
+
typeId: descriptor.id,
|
|
146
|
+
packageName: "dsh-mnemon-provider-honcho",
|
|
147
|
+
version: "0.5.0-rc.1",
|
|
148
|
+
label: descriptor.label,
|
|
149
|
+
icon: descriptor.icon,
|
|
150
|
+
summary: descriptor.summary,
|
|
151
|
+
...descriptor.summaryI18nKey === void 0 ? {} : { summaryI18nKey: descriptor.summaryI18nKey },
|
|
152
|
+
origin: descriptor.origin,
|
|
153
|
+
locality: descriptor.kind,
|
|
154
|
+
workspaceBinding: descriptor.workspaceBinding,
|
|
155
|
+
capabilities: descriptor.capabilities,
|
|
156
|
+
fields: descriptor.fields,
|
|
157
|
+
secrets: descriptor.fields.filter((field) => field.input === "secret").map((field) => field.key),
|
|
158
|
+
scoreSemantics: "provider-native"
|
|
159
|
+
},
|
|
160
|
+
create: (context) => new HonchoProvider(context.memoryBodies, { requestTimeoutMs: context.config.timeoutMs })
|
|
161
|
+
});
|
|
162
|
+
var src_default = defineMemorySpaceProvider({
|
|
163
|
+
id: descriptor.id,
|
|
164
|
+
apply(ctx, host) {
|
|
165
|
+
host.install(ctx, definition);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
//#endregion
|
|
169
|
+
export { HonchoProvider, src_default as default, definition, descriptor };
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-mnemon-provider-honcho",
|
|
3
|
+
"version": "0.5.0-rc.1",
|
|
4
|
+
"description": "Honcho Provider child for the Memory Spaces Source.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=20"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./lib/index.d.ts",
|
|
13
|
+
"default": "./lib/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./descriptor": {
|
|
16
|
+
"types": "./lib/descriptor.d.ts",
|
|
17
|
+
"default": "./lib/descriptor.js"
|
|
18
|
+
},
|
|
19
|
+
"./package.json": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"lib",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"typecheck": "tsc --noEmit",
|
|
27
|
+
"build": "tsdown",
|
|
28
|
+
"test": "vitest run",
|
|
29
|
+
"verify": "pnpm typecheck && pnpm test && pnpm build"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@deepseek-ai/cordis": "^4.0.1",
|
|
33
|
+
"dsh-mnemon-source-memory-spaces": "0.5.0-rc.1"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/node": "^22.0.0",
|
|
37
|
+
"dsh-mnemon-source-memory-spaces": "0.5.0-rc.1",
|
|
38
|
+
"tsdown": "^0.22.0",
|
|
39
|
+
"typescript": "^5.9.0",
|
|
40
|
+
"vitest": "^3.2.0"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public",
|
|
44
|
+
"tag": "rc"
|
|
45
|
+
},
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "git+https://github.com/omdsh-dev/dsh-mnemon.git",
|
|
49
|
+
"directory": "plugins/dsh-mnemon-provider-honcho"
|
|
50
|
+
},
|
|
51
|
+
"homepage": "https://github.com/omdsh-dev/dsh-mnemon/tree/main/plugins/dsh-mnemon-provider-honcho#readme",
|
|
52
|
+
"bugs": {
|
|
53
|
+
"url": "https://github.com/omdsh-dev/dsh-mnemon/issues"
|
|
54
|
+
}
|
|
55
|
+
}
|