@y0shua1ee/dsh-auto-memory 0.3.3 → 0.4.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/README.md +26 -14
- package/lib/config.d.ts +47 -0
- package/lib/config.js +89 -97
- package/lib/guidance.d.ts +9 -0
- package/lib/guidance.js +5 -9
- package/lib/index.d.ts +13 -0
- package/lib/index.js +68 -89
- package/lib/inject.d.ts +36 -0
- package/lib/inject.js +80 -82
- package/lib/memory-frontmatter.d.ts +60 -0
- package/lib/memory-frontmatter.js +169 -102
- package/lib/paths.d.ts +38 -0
- package/lib/paths.js +117 -66
- package/lib/render.d.ts +24 -0
- package/lib/render.js +44 -61
- package/lib/rule-frontmatter.d.ts +15 -0
- package/lib/rule-frontmatter.js +141 -74
- package/lib/rule-glob.d.ts +21 -0
- package/lib/rule-glob.js +149 -124
- package/lib/rules-inject.d.ts +14 -0
- package/lib/rules-inject.js +119 -111
- package/lib/rules.d.ts +62 -0
- package/lib/rules.js +235 -227
- package/lib/store.d.ts +169 -0
- package/lib/store.js +766 -761
- package/lib/tool.d.ts +63 -0
- package/lib/tool.js +224 -224
- package/lib/types.d.ts +122 -0
- package/lib/types.js +1 -0
- package/package.json +14 -7
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/** One text block in a user-role message. */
|
|
2
|
+
export interface TextContent {
|
|
3
|
+
type: "text";
|
|
4
|
+
text: string;
|
|
5
|
+
}
|
|
6
|
+
/** Rule identity carried by an injected rules message. */
|
|
7
|
+
export interface RuleRef {
|
|
8
|
+
key: string;
|
|
9
|
+
path: string;
|
|
10
|
+
scope: RuleScope;
|
|
11
|
+
digest: string;
|
|
12
|
+
}
|
|
13
|
+
/** Message metadata used to recognize and deduplicate injected snapshots. */
|
|
14
|
+
export interface MessageSource {
|
|
15
|
+
kind: string;
|
|
16
|
+
form?: string;
|
|
17
|
+
projectKey?: string;
|
|
18
|
+
digest?: string;
|
|
19
|
+
baseline?: boolean;
|
|
20
|
+
rules?: RuleRef[];
|
|
21
|
+
[field: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
/** The message shape the memory and rules features inject. */
|
|
24
|
+
export interface Message {
|
|
25
|
+
id: string;
|
|
26
|
+
role?: string;
|
|
27
|
+
content: TextContent[];
|
|
28
|
+
source?: MessageSource;
|
|
29
|
+
}
|
|
30
|
+
/** Session surface nodes, newest last. */
|
|
31
|
+
export interface Surface {
|
|
32
|
+
nodes: number[];
|
|
33
|
+
}
|
|
34
|
+
/** One recorded session event. */
|
|
35
|
+
export interface SessionEvent {
|
|
36
|
+
type?: string;
|
|
37
|
+
data?: Message;
|
|
38
|
+
}
|
|
39
|
+
/** Session header fields the plugin reads. */
|
|
40
|
+
export interface SessionHeader {
|
|
41
|
+
cwd?: string;
|
|
42
|
+
origin?: string;
|
|
43
|
+
delegationDepth?: number;
|
|
44
|
+
[field: string]: unknown;
|
|
45
|
+
}
|
|
46
|
+
/** The session slice the plugin uses. */
|
|
47
|
+
export interface Session {
|
|
48
|
+
header?: SessionHeader;
|
|
49
|
+
surface: Surface;
|
|
50
|
+
eventAt(seq: number): SessionEvent | undefined;
|
|
51
|
+
}
|
|
52
|
+
/** The inbox queue used to hold a message for the next step. */
|
|
53
|
+
export interface Inbox {
|
|
54
|
+
nextStep: Message[];
|
|
55
|
+
prepend(queue: string, message: Message): void;
|
|
56
|
+
replace(id: string, message: Message): void;
|
|
57
|
+
remove(id: string): void;
|
|
58
|
+
}
|
|
59
|
+
/** The calling agent. */
|
|
60
|
+
export interface Agent {
|
|
61
|
+
session: Session;
|
|
62
|
+
inbox: Inbox;
|
|
63
|
+
}
|
|
64
|
+
export interface EnterDecision {
|
|
65
|
+
kind: "enter";
|
|
66
|
+
messages: Message[];
|
|
67
|
+
}
|
|
68
|
+
export interface RejectDecision {
|
|
69
|
+
kind: "reject";
|
|
70
|
+
}
|
|
71
|
+
export type PreStepDecision = EnterDecision | RejectDecision;
|
|
72
|
+
export type PreStepNext = () => Promise<PreStepDecision>;
|
|
73
|
+
export interface PreStepPayload {
|
|
74
|
+
agent: Agent;
|
|
75
|
+
messages: Message[];
|
|
76
|
+
step: number;
|
|
77
|
+
signal: AbortSignal;
|
|
78
|
+
}
|
|
79
|
+
export type PreStepHandler = (payload: PreStepPayload, next: PreStepNext) => Promise<PreStepDecision>;
|
|
80
|
+
/** The execution context passed to a tool body. */
|
|
81
|
+
export interface ToolExec {
|
|
82
|
+
agent?: Agent;
|
|
83
|
+
signal?: AbortSignal;
|
|
84
|
+
}
|
|
85
|
+
/** The normalized result observed by a `tools/result` listener. */
|
|
86
|
+
export interface ToolResultEvent {
|
|
87
|
+
isError?: boolean;
|
|
88
|
+
}
|
|
89
|
+
/** The execution record observed by a `tools/result` listener. */
|
|
90
|
+
export interface ToolExecEvent {
|
|
91
|
+
name?: string;
|
|
92
|
+
arguments?: {
|
|
93
|
+
file_path?: unknown;
|
|
94
|
+
};
|
|
95
|
+
agent?: Agent;
|
|
96
|
+
signal?: AbortSignal;
|
|
97
|
+
}
|
|
98
|
+
export type RuleScope = "user" | "project";
|
|
99
|
+
export interface SystemPromptSection {
|
|
100
|
+
name: string;
|
|
101
|
+
order: number;
|
|
102
|
+
text: string;
|
|
103
|
+
}
|
|
104
|
+
export interface Logger {
|
|
105
|
+
warn(message: string, ...args: unknown[]): void;
|
|
106
|
+
}
|
|
107
|
+
/** The Cordis services this plugin consumes. */
|
|
108
|
+
export interface PluginContext {
|
|
109
|
+
tools: {
|
|
110
|
+
register(tool: unknown): void;
|
|
111
|
+
};
|
|
112
|
+
systemPrompt: {
|
|
113
|
+
section(section: SystemPromptSection): void;
|
|
114
|
+
getSectionOrder(key: string): number;
|
|
115
|
+
};
|
|
116
|
+
workingDirectory: {
|
|
117
|
+
ensure(agent: Agent, signal?: AbortSignal): Promise<string>;
|
|
118
|
+
};
|
|
119
|
+
on(event: "agent/pre-step", handler: PreStepHandler): void;
|
|
120
|
+
on(event: "tools/result", handler: (exec: ToolExecEvent, result: ToolResultEvent) => void): void;
|
|
121
|
+
logger?: Logger;
|
|
122
|
+
}
|
package/lib/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@y0shua1ee/dsh-auto-memory",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Persistent project memory and Claude Code-compatible rules for DeepSeek Harness.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
|
+
"types": "lib/index.d.ts",
|
|
7
8
|
"exports": {
|
|
8
9
|
".": "./lib/index.js",
|
|
9
10
|
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
@@ -48,11 +49,6 @@
|
|
|
48
49
|
"optional": true
|
|
49
50
|
}
|
|
50
51
|
},
|
|
51
|
-
"scripts": {
|
|
52
|
-
"test": "node --test test/*.test.mjs",
|
|
53
|
-
"test:integration": "node --import ./test/register.mjs --test test/*.test.mjs",
|
|
54
|
-
"extract-runtime": "node scripts/extract-runtime.mjs"
|
|
55
|
-
},
|
|
56
52
|
"author": "Ares Lee",
|
|
57
53
|
"homepage": "https://github.com/y0shua1ee/dsh-auto-memory#readme",
|
|
58
54
|
"repository": {
|
|
@@ -73,5 +69,16 @@
|
|
|
73
69
|
},
|
|
74
70
|
"publishConfig": {
|
|
75
71
|
"access": "public"
|
|
72
|
+
},
|
|
73
|
+
"devDependencies": {
|
|
74
|
+
"@types/node": "^22.20.5",
|
|
75
|
+
"typescript": "5.9.3"
|
|
76
|
+
},
|
|
77
|
+
"scripts": {
|
|
78
|
+
"build": "tsc -p tsconfig.json",
|
|
79
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
80
|
+
"test": "tsc -p tsconfig.json && node --test test/*.test.mjs",
|
|
81
|
+
"test:integration": "tsc -p tsconfig.json && node --import ./test/register.mjs --test test/*.test.mjs",
|
|
82
|
+
"extract-runtime": "node scripts/extract-runtime.mjs"
|
|
76
83
|
}
|
|
77
|
-
}
|
|
84
|
+
}
|