stratagate-dsh 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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 diqierjia
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,78 @@
1
+ # StrataGate for DeepSeek Harness
2
+
3
+ Native, local-first long-term memory for DeepSeek Harness. The plugin adapts DSH session events to the existing StrataGate memory engine; it does not implement a second memory system.
4
+
5
+ ## Install
6
+
7
+ From a DSH profile:
8
+
9
+ ```bash
10
+ dsh plugin --profile web add stratagate-dsh
11
+ ```
12
+
13
+ The package includes `cordis.patch.yml`, so DSH can add the Host row automatically. Restart the profile after installation. The default database is:
14
+
15
+ ```text
16
+ DSH_HOME/stratagate/memory.db
17
+ ```
18
+
19
+ Removing the plugin does not delete that database.
20
+
21
+ ## What happens automatically
22
+
23
+ - Completed human turns are folded from `turn/start`, human `user/message`, assistant messages, tool calls/results, and `turn/end`.
24
+ - Plugin-injected context is not mistaken for a human message.
25
+ - StrataGate's own `memory_*` calls/results are omitted from the stored tool trace, preventing recalled memory from being re-ingested as new evidence.
26
+ - Subagent turns are not ingested by default; subagents in the same project can still read project memory.
27
+ - Each DSH turn has a durable ingestion receipt, so replay or retry cannot store it twice.
28
+ - StrataGate performs the existing Block summarization, Event extraction, Element projection, search, Evidence Gate, and use-only reinforcement.
29
+
30
+ The plugin registers these tools:
31
+
32
+ ```text
33
+ memory_search_events memory_expand_event
34
+ memory_search_elements memory_expand_element
35
+ memory_search_raw memory_get_blocks
36
+ memory_expand_block memory_assess
37
+ memory_record_use
38
+ ```
39
+
40
+ The prompt protocol requires assessment after every retrieval. Search does not strengthen a memory. `memory_record_use` records only evidence from the last sufficient assessment and uses the DSH tool call id as an idempotency receipt.
41
+
42
+ ## Configuration
43
+
44
+ ```yaml
45
+ config:
46
+ database: !!js dshHomePath('stratagate', 'memory.db')
47
+ namespaceMode: project # project | session | global
48
+ namespacePrefix: dsh
49
+ globalNamespace: global
50
+ blockTurnSize: 4
51
+ ingestSubagents: false
52
+ maxOutputTokens: 2048
53
+ # Optional: use a dedicated model for memory processing.
54
+ # provider: deepseek
55
+ # model: deepseek-chat
56
+ ```
57
+
58
+ `project` derives a stable namespace from the normalized session working directory. `session` isolates every DSH session. `global` shares one namespace.
59
+
60
+ If `provider` and `model` are omitted, memory processing uses the session's latest request route, then the DSH default model as fallback. They must be configured as a pair.
61
+
62
+ ## Privacy and failure behavior
63
+
64
+ Memory is stored in the configured local SQLite file. Normal DSH model-provider calls are used only when StrataGate seals a block, extracts Events, or projects Elements. Raw source messages remain available at L5 for verification.
65
+
66
+ If a memory-model call fails, the raw turn and the pending job remain durable. A later open resumes the job without appending the turn again. Retrieval waits for queued ingestion so a just-completed turn is not raced by a search.
67
+
68
+ ## Development
69
+
70
+ From the repository root:
71
+
72
+ ```bash
73
+ npm install
74
+ npm run check:dsh
75
+ npm run test:dsh
76
+ npm run build:dsh
77
+ npm pack --workspace stratagate-dsh
78
+ ```
@@ -0,0 +1,12 @@
1
+ # StrataGate adds one Host plugin row. Memory stays under DSH_HOME so profile
2
+ # upgrades and plugin removal do not delete user data.
3
+ - insert:
4
+ - id: stratagate-memory
5
+ name: stratagate-dsh
6
+ inject: [tools, systemPrompt, llm, agentDefaultModel]
7
+ config:
8
+ database: !!js dshHomePath('stratagate', 'memory.db')
9
+ namespaceMode: project
10
+ blockTurnSize: 4
11
+ ingestSubagents: false
12
+ maxOutputTokens: 2048
@@ -0,0 +1,23 @@
1
+ import { Context } from '@deepseek-ai/cordis';
2
+ import z from '@deepseek-ai/schemastery';
3
+
4
+ type NamespaceMode = 'project' | 'session' | 'global';
5
+ interface Config {
6
+ database?: string;
7
+ namespaceMode?: NamespaceMode;
8
+ namespacePrefix?: string;
9
+ globalNamespace?: string;
10
+ blockTurnSize?: number;
11
+ ingestSubagents?: boolean;
12
+ provider?: string;
13
+ model?: string;
14
+ maxOutputTokens?: number;
15
+ }
16
+ declare const Config: z<Config>;
17
+
18
+ declare const name = "stratagate-memory";
19
+ declare const inject: string[];
20
+
21
+ declare function apply(ctx: Context, config: Config): Promise<() => Promise<void>>;
22
+
23
+ export { Config, Config as PluginConfig, apply, inject, name };