@memorax/memorax-code 0.1.5 → 0.1.7
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 +7 -18
- package/bin/memorax-code-npm-preinstall.mjs +28 -39
- package/bin/memorax-code-plugin-postinstall.mjs +23 -1537
- package/bin/memorax-code-setup.mjs +1615 -0
- package/bin/memorax-code.mjs +289 -5
- package/docs/configuration.md +66 -17
- package/docs/troubleshooting.md +123 -7
- package/lib/memorax-code-adapter-common/src/config-utils.d.mts +5 -1
- package/lib/memorax-code-adapter-common/src/config-utils.mjs +36 -3
- package/lib/memorax-code-adapter-common/src/credentials/linux-secret-service.mjs +110 -0
- package/lib/memorax-code-adapter-common/src/credentials/macos-keychain.mjs +224 -0
- package/lib/memorax-code-adapter-common/src/credentials/secure-command.mjs +340 -0
- package/lib/memorax-code-adapter-common/src/credentials/trial-credential-record.d.mts +82 -0
- package/lib/memorax-code-adapter-common/src/credentials/trial-credential-record.mjs +183 -0
- package/lib/memorax-code-adapter-common/src/credentials/trial-credential-store.d.mts +82 -0
- package/lib/memorax-code-adapter-common/src/credentials/trial-credential-store.mjs +271 -0
- package/lib/memorax-code-adapter-common/src/credentials/windows-dpapi.mjs +440 -0
- package/lib/memorax-code-adapter-common/src/hooks/memory-skill-reminder-hook.mjs +7 -4
- package/lib/memorax-code-adapter-common/src/setup-completion.d.mts +81 -0
- package/lib/memorax-code-adapter-common/src/setup-completion.mjs +154 -0
- package/lib/memorax-code-backend/dist/clients/claude/memory-hook-runtime.js +21 -2
- package/lib/memorax-code-backend/dist/clients/codex/memory-hook-runtime.js +23 -3
- package/lib/memorax-code-backend/dist/clients/opencode/memory-hook-runtime.js +19 -1
- package/lib/memorax-code-backend/dist/entrypoints/backend-cli.js +17 -16
- package/lib/memorax-code-backend/dist/lifecycle/backend/service.js +1 -0
- package/lib/memorax-code-backend/dist/lifecycle/orchestrator.js +81 -22
- package/lib/memorax-code-backend/dist/memorax-cli.js +3 -0
- package/lib/memorax-code-backend/dist/memory/automatic-retrieval.js +8 -2
- package/lib/memorax-code-backend/dist/memory/automatic-writeback.js +13 -1
- package/lib/memorax-code-backend/dist/memory/cli.js +10 -0
- package/lib/memorax-code-backend/dist/memory/quota-notice.js +208 -0
- package/lib/memorax-code-backend/dist/memory/service.js +11 -0
- package/lib/memorax-code-backend/dist/provider/memorax/adapter.js +4 -2
- package/lib/memorax-code-backend/dist/provider/memorax/http.js +10 -3
- package/lib/memorax-code-backend/dist/provider/memorax/quota.js +26 -0
- package/lib/memorax-code-backend/package.json +1 -1
- package/lib/memorax-code-claude-adapter/.claude-plugin/plugin.json +1 -1
- package/lib/memorax-code-claude-adapter/hooks/runtime-shell.json +1 -1
- package/lib/memorax-code-claude-adapter/package.json +1 -1
- package/lib/memorax-code-claude-adapter/runtime-hooks/memory-turn.mjs +5 -3
- package/lib/memorax-code-claude-adapter/skills/memorax-code/references/memorax-add.md +2 -0
- package/lib/memorax-code-claude-adapter/skills/memorax-code/references/memorax-search.md +4 -2
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/.claude-plugin/plugin.json +1 -1
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/hooks/runtime-shell.json +1 -1
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/config-utils.d.mts +5 -1
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/config-utils.mjs +36 -3
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/credentials/linux-secret-service.mjs +110 -0
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/credentials/macos-keychain.mjs +224 -0
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/credentials/secure-command.mjs +340 -0
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/credentials/trial-credential-record.d.mts +82 -0
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/credentials/trial-credential-record.mjs +183 -0
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/credentials/trial-credential-store.d.mts +82 -0
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/credentials/trial-credential-store.mjs +271 -0
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/credentials/windows-dpapi.mjs +440 -0
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/memory-skill-reminder-hook.mjs +7 -4
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/setup-completion.d.mts +81 -0
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/setup-completion.mjs +154 -0
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/package.json +1 -1
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/runtime-hooks/memory-turn.mjs +5 -3
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/memorax-add.md +2 -0
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/memorax-search.md +4 -2
- package/lib/memorax-code-codex-adapter/.codex-plugin/plugin.json +1 -1
- package/lib/memorax-code-codex-adapter/hooks/runtime-shell.json +1 -1
- package/lib/memorax-code-codex-adapter/package.json +1 -1
- package/lib/memorax-code-codex-adapter/runtime-hooks/memory-skill-reminder.mjs +2 -0
- package/lib/memorax-code-codex-adapter/skills/memorax-code/references/memorax-add.md +2 -0
- package/lib/memorax-code-codex-adapter/skills/memorax-code/references/memorax-search.md +4 -2
- package/lib/memorax-code-dsh-adapter/hooks/repo-memory-job.mjs +5 -2
- package/lib/memorax-code-dsh-adapter/package.json +1 -1
- package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/memorax-add.md +2 -0
- package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/memorax-search.md +4 -2
- package/lib/memorax-code-dsh-adapter/src/profile-lifecycle.mjs +158 -7
- package/lib/memorax-code-dsh-adapter/src/runtime-state.mjs +21 -0
- package/lib/memorax-code-opencode-adapter/package.json +1 -1
- package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/memorax-add.md +2 -0
- package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/memorax-search.md +4 -2
- package/lib/memorax-code-opencode-adapter/src/plugin.mjs +20 -0
- package/lib/package-transition.mjs +312 -0
- package/lib/resolve-codex-command.mjs +32 -6
- package/lib/setup-memory-preferences.mjs +113 -0
- package/lib/setup-reconcile.mjs +128 -0
- package/lib/trial-plugin-mark.mjs +171 -0
- package/lib/trial-provision-client.mjs +307 -0
- package/lib/trial-provision-flow.mjs +215 -0
- package/lib/trial-setup.mjs +53 -0
- package/package.json +1 -1
|
@@ -23,10 +23,11 @@ export async function runMemorySkillReminderHook(options, hookInput) {
|
|
|
23
23
|
const result = await evaluateMemorySkillReminder(options, input);
|
|
24
24
|
if (!result) return;
|
|
25
25
|
process.stdout.write(`${JSON.stringify({
|
|
26
|
-
|
|
26
|
+
...(result.systemMessage ? { systemMessage: result.systemMessage } : {}),
|
|
27
|
+
...(result.additionalContext ? { hookSpecificOutput: {
|
|
27
28
|
hookEventName: "UserPromptSubmit",
|
|
28
29
|
additionalContext: result.additionalContext,
|
|
29
|
-
},
|
|
30
|
+
} } : {}),
|
|
30
31
|
})}\n`);
|
|
31
32
|
if (result.reminder) await notifyReminder(options, result.reminder);
|
|
32
33
|
} catch (error) {
|
|
@@ -80,7 +81,8 @@ export async function evaluateMemorySkillReminder(options, input) {
|
|
|
80
81
|
const { memoryReminderDue, supplementalReminderDue } = update;
|
|
81
82
|
|
|
82
83
|
const baseAdditionalContext = stringOption(options.baseAdditionalContext);
|
|
83
|
-
|
|
84
|
+
const systemMessage = stringOption(options.systemMessage);
|
|
85
|
+
if (!baseAdditionalContext && !memoryReminderDue && !supplementalReminderDue && !systemMessage) return undefined;
|
|
84
86
|
const cadenceReminderContext = memoryReminderDue
|
|
85
87
|
? await buildCadenceReminderContext(options, input)
|
|
86
88
|
: undefined;
|
|
@@ -97,7 +99,8 @@ export async function evaluateMemorySkillReminder(options, input) {
|
|
|
97
99
|
...(supplementalReminderDue ? ["post_compaction"] : []),
|
|
98
100
|
];
|
|
99
101
|
return {
|
|
100
|
-
|
|
102
|
+
...(systemMessage ? { systemMessage } : {}),
|
|
103
|
+
...(additionalContext ? { additionalContext } : {}),
|
|
101
104
|
...(reminderContext ? {
|
|
102
105
|
reminder: {
|
|
103
106
|
sessionId,
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { JsonFileLockOptions } from "./config-utils.mjs";
|
|
2
|
+
import {
|
|
3
|
+
RuntimeRecordError,
|
|
4
|
+
type RuntimeRecordWriteResult,
|
|
5
|
+
type RuntimeRecordWriteRuntime,
|
|
6
|
+
} from "./runtime-record.mjs";
|
|
7
|
+
|
|
8
|
+
export type SetupCompletionRecord = Readonly<{
|
|
9
|
+
version: 1;
|
|
10
|
+
state: "complete";
|
|
11
|
+
completedAt: string;
|
|
12
|
+
completedByVersion: string;
|
|
13
|
+
}>;
|
|
14
|
+
|
|
15
|
+
export type SetupCompletionRecordInvalidReason =
|
|
16
|
+
| "unreadable"
|
|
17
|
+
| "malformed_json"
|
|
18
|
+
| "invalid_record"
|
|
19
|
+
| "invalid_version"
|
|
20
|
+
| "unknown_fields"
|
|
21
|
+
| "invalid_state"
|
|
22
|
+
| "invalid_completed_at"
|
|
23
|
+
| "invalid_completed_by_version";
|
|
24
|
+
|
|
25
|
+
export type SetupCompletionRecordState =
|
|
26
|
+
| Readonly<{ status: "absent" }>
|
|
27
|
+
| Readonly<{ status: "valid"; record: SetupCompletionRecord }>
|
|
28
|
+
| Readonly<{ status: "invalid"; reason: SetupCompletionRecordInvalidReason }>
|
|
29
|
+
| Readonly<{ status: "unsupported"; version: number }>;
|
|
30
|
+
|
|
31
|
+
export type WritableSetupCompletionRecordState = Extract<
|
|
32
|
+
SetupCompletionRecordState,
|
|
33
|
+
{ status: "absent" | "valid" }
|
|
34
|
+
>;
|
|
35
|
+
|
|
36
|
+
export type SetupCompletionClearResult = Readonly<{
|
|
37
|
+
path: string;
|
|
38
|
+
removed: boolean;
|
|
39
|
+
}>;
|
|
40
|
+
|
|
41
|
+
export type SetupCompletionLockMutation = Readonly<{
|
|
42
|
+
clear(): SetupCompletionClearResult;
|
|
43
|
+
}>;
|
|
44
|
+
|
|
45
|
+
export const SETUP_COMPLETION_RECORD_VERSION: 1;
|
|
46
|
+
|
|
47
|
+
export class SetupCompletionRecordError extends RuntimeRecordError {
|
|
48
|
+
constructor(
|
|
49
|
+
state: Extract<SetupCompletionRecordState, { status: "invalid" | "unsupported" }>,
|
|
50
|
+
path: string,
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function setupCompletionPath(memoraxCodeHome?: string): string;
|
|
55
|
+
|
|
56
|
+
export function readSetupCompletionRecord(
|
|
57
|
+
memoraxCodeHome?: string,
|
|
58
|
+
): SetupCompletionRecordState;
|
|
59
|
+
|
|
60
|
+
export function writeSetupCompletionRecord(
|
|
61
|
+
options: {
|
|
62
|
+
memoraxCodeHome?: string;
|
|
63
|
+
completedAt: string;
|
|
64
|
+
completedByVersion: string;
|
|
65
|
+
},
|
|
66
|
+
runtime?: RuntimeRecordWriteRuntime,
|
|
67
|
+
): RuntimeRecordWriteResult<SetupCompletionRecord>;
|
|
68
|
+
|
|
69
|
+
export function clearSetupCompletionRecord(
|
|
70
|
+
memoraxCodeHome?: string,
|
|
71
|
+
options?: JsonFileLockOptions,
|
|
72
|
+
): Promise<SetupCompletionClearResult>;
|
|
73
|
+
|
|
74
|
+
export function withSetupCompletionLock<T>(
|
|
75
|
+
memoraxCodeHome: string,
|
|
76
|
+
operation: (
|
|
77
|
+
state: WritableSetupCompletionRecordState,
|
|
78
|
+
mutation: SetupCompletionLockMutation,
|
|
79
|
+
) => T | Promise<T>,
|
|
80
|
+
options?: JsonFileLockOptions,
|
|
81
|
+
): Promise<T>;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { unlinkSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { withJsonFileLockAsync } from "./config-utils.mjs";
|
|
5
|
+
import {
|
|
6
|
+
readJsonRuntimeRecord,
|
|
7
|
+
RuntimeRecordError,
|
|
8
|
+
writePrivateJsonRecord,
|
|
9
|
+
} from "./runtime-record.mjs";
|
|
10
|
+
|
|
11
|
+
export const SETUP_COMPLETION_RECORD_VERSION = 1;
|
|
12
|
+
|
|
13
|
+
const SETUP_COMPLETION_RECORD_KEYS = new Set([
|
|
14
|
+
"version",
|
|
15
|
+
"state",
|
|
16
|
+
"completedAt",
|
|
17
|
+
"completedByVersion",
|
|
18
|
+
]);
|
|
19
|
+
const ISO_TIMESTAMP_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$/;
|
|
20
|
+
|
|
21
|
+
export class SetupCompletionRecordError extends RuntimeRecordError {
|
|
22
|
+
constructor(state, path) {
|
|
23
|
+
super({
|
|
24
|
+
name: "Setup completion record",
|
|
25
|
+
path,
|
|
26
|
+
state,
|
|
27
|
+
codePrefix: "SETUP_COMPLETION_RECORD",
|
|
28
|
+
recovery: state.status === "unsupported"
|
|
29
|
+
? "upgrade MemoraX Code or restore a supported setup completion record"
|
|
30
|
+
: "inspect the setup completion record before replacing it",
|
|
31
|
+
});
|
|
32
|
+
this.name = "SetupCompletionRecordError";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function setupCompletionPath(memoraxCodeHome = defaultMemoraxCodeHome()) {
|
|
37
|
+
return join(memoraxCodeHome, "runtime", "setup", "setup-completion.json");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function readSetupCompletionRecord(memoraxCodeHome = defaultMemoraxCodeHome()) {
|
|
41
|
+
const path = setupCompletionPath(memoraxCodeHome);
|
|
42
|
+
const state = readJsonRuntimeRecord(path);
|
|
43
|
+
if (state.status !== "present") return state;
|
|
44
|
+
const value = state.value;
|
|
45
|
+
if (value.version !== SETUP_COMPLETION_RECORD_VERSION) {
|
|
46
|
+
if (Number.isSafeInteger(value.version) && value.version > 0) {
|
|
47
|
+
return { status: "unsupported", version: value.version };
|
|
48
|
+
}
|
|
49
|
+
return { status: "invalid", reason: "invalid_version" };
|
|
50
|
+
}
|
|
51
|
+
if (Object.keys(value).some((key) => !SETUP_COMPLETION_RECORD_KEYS.has(key))) {
|
|
52
|
+
return { status: "invalid", reason: "unknown_fields" };
|
|
53
|
+
}
|
|
54
|
+
if (value.state !== "complete") {
|
|
55
|
+
return { status: "invalid", reason: "invalid_state" };
|
|
56
|
+
}
|
|
57
|
+
const completedAt = isoTimestamp(value.completedAt);
|
|
58
|
+
if (!completedAt) return { status: "invalid", reason: "invalid_completed_at" };
|
|
59
|
+
const completedByVersion = nonEmptyString(value.completedByVersion);
|
|
60
|
+
if (!completedByVersion) {
|
|
61
|
+
return { status: "invalid", reason: "invalid_completed_by_version" };
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
status: "valid",
|
|
65
|
+
record: {
|
|
66
|
+
version: SETUP_COMPLETION_RECORD_VERSION,
|
|
67
|
+
state: "complete",
|
|
68
|
+
completedAt,
|
|
69
|
+
completedByVersion,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function writeSetupCompletionRecord(options, runtime) {
|
|
75
|
+
const memoraxCodeHome = nonEmptyString(options?.memoraxCodeHome) ?? defaultMemoraxCodeHome();
|
|
76
|
+
const completedAt = isoTimestamp(options?.completedAt);
|
|
77
|
+
if (!completedAt) {
|
|
78
|
+
throw new TypeError("Setup completion record requires a valid ISO completedAt timestamp");
|
|
79
|
+
}
|
|
80
|
+
const completedByVersion = nonEmptyString(options?.completedByVersion);
|
|
81
|
+
if (!completedByVersion) {
|
|
82
|
+
throw new TypeError("Setup completion record requires a non-empty completedByVersion");
|
|
83
|
+
}
|
|
84
|
+
const path = setupCompletionPath(memoraxCodeHome);
|
|
85
|
+
const existing = readSetupCompletionRecord(memoraxCodeHome);
|
|
86
|
+
if (existing.status === "invalid" || existing.status === "unsupported") {
|
|
87
|
+
throw new SetupCompletionRecordError(existing, path);
|
|
88
|
+
}
|
|
89
|
+
return writePrivateJsonRecord(path, {
|
|
90
|
+
version: SETUP_COMPLETION_RECORD_VERSION,
|
|
91
|
+
state: "complete",
|
|
92
|
+
completedAt,
|
|
93
|
+
completedByVersion,
|
|
94
|
+
}, {
|
|
95
|
+
...runtime,
|
|
96
|
+
durableBoundary: memoraxCodeHome,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export async function clearSetupCompletionRecord(
|
|
101
|
+
memoraxCodeHome = defaultMemoraxCodeHome(),
|
|
102
|
+
options,
|
|
103
|
+
) {
|
|
104
|
+
const home = nonEmptyString(memoraxCodeHome) ?? defaultMemoraxCodeHome();
|
|
105
|
+
return await withSetupCompletionLock(
|
|
106
|
+
home,
|
|
107
|
+
(_state, mutation) => mutation.clear(),
|
|
108
|
+
options,
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export async function withSetupCompletionLock(
|
|
113
|
+
memoraxCodeHome,
|
|
114
|
+
operation,
|
|
115
|
+
options,
|
|
116
|
+
) {
|
|
117
|
+
const home = nonEmptyString(memoraxCodeHome);
|
|
118
|
+
if (!home) throw new TypeError("Setup completion lock requires a MemoraX Code home");
|
|
119
|
+
if (typeof operation !== "function") {
|
|
120
|
+
throw new TypeError("Setup completion lock requires an operation");
|
|
121
|
+
}
|
|
122
|
+
const path = setupCompletionPath(home);
|
|
123
|
+
return await withJsonFileLockAsync(path, async () => {
|
|
124
|
+
let state = readSetupCompletionRecord(home);
|
|
125
|
+
if (state.status === "invalid" || state.status === "unsupported") {
|
|
126
|
+
throw new SetupCompletionRecordError(state, path);
|
|
127
|
+
}
|
|
128
|
+
return await operation(state, {
|
|
129
|
+
clear() {
|
|
130
|
+
if (state.status === "absent") return { path, removed: false };
|
|
131
|
+
unlinkSync(path);
|
|
132
|
+
state = { status: "absent" };
|
|
133
|
+
return { path, removed: true };
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
}, options);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function defaultMemoraxCodeHome() {
|
|
140
|
+
return join(homedir(), ".memorax-code");
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function nonEmptyString(value) {
|
|
144
|
+
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function isoTimestamp(value) {
|
|
148
|
+
const candidate = nonEmptyString(value);
|
|
149
|
+
return candidate
|
|
150
|
+
&& ISO_TIMESTAMP_PATTERN.test(candidate)
|
|
151
|
+
&& Number.isFinite(Date.parse(candidate))
|
|
152
|
+
? candidate
|
|
153
|
+
: undefined;
|
|
154
|
+
}
|
|
@@ -35,12 +35,14 @@ try {
|
|
|
35
35
|
pluginRoot: process.env.CLAUDE_PLUGIN_ROOT,
|
|
36
36
|
});
|
|
37
37
|
const additionalContext = stringValue(response?.additionalContext);
|
|
38
|
-
|
|
38
|
+
const systemMessage = stringValue(response?.userNotice);
|
|
39
|
+
if (additionalContext || systemMessage) {
|
|
39
40
|
process.stdout.write(`${JSON.stringify({
|
|
40
|
-
|
|
41
|
+
...(systemMessage ? { systemMessage } : {}),
|
|
42
|
+
...(additionalContext ? { hookSpecificOutput: {
|
|
41
43
|
hookEventName: "UserPromptSubmit",
|
|
42
44
|
additionalContext,
|
|
43
|
-
},
|
|
45
|
+
} } : {}),
|
|
44
46
|
})}\n`);
|
|
45
47
|
}
|
|
46
48
|
} else if (event === "Stop") {
|
|
@@ -83,4 +83,6 @@ Do not add speculation, assistant-only praise, or a current instruction merely b
|
|
|
83
83
|
|
|
84
84
|
## Output
|
|
85
85
|
|
|
86
|
+
If a successful Add returns `quotaNotice`, or prints it as a quota-reminder line in the default CLI output, present the complete reminder once and prominently before the normal result summary. Do not reduce it to only a percentage or omit its account URL or conditional local Mark ID retrieval instructions. Never run `memorax-code account --show-mark-id` for the user, ask for its output, or reproduce a Mark ID in chat. Treat the reminder as user-facing operational output, not coding memory content, and continue the current task.
|
|
87
|
+
|
|
86
88
|
After an add request is accepted, confirm briefly that it was submitted for processing and identify the reusable coding lesson at a high level. If add is disabled or fails, report the issue and continue without bypassing the CLI.
|
|
@@ -6,11 +6,11 @@ Use these instructions only to search reusable coding memory through `memorax-cl
|
|
|
6
6
|
|
|
7
7
|
Run the CLI from the active task workspace. The installed Hook and session binding supply the authoritative workspace root; do not run `git rev-parse`, infer the root from Git metadata, or substitute an unrelated working directory. Do not make `memorax-cli status` a mandatory preflight; use it only to diagnose a configuration or scope failure.
|
|
8
8
|
|
|
9
|
-
Coding memory uses `<MemoraX base
|
|
9
|
+
Coding memory uses `<MemoraX base username>@<normalized repository name>` for Git workspaces and the normalized folder name for genuine non-Git directories. MemoraX Code resolves `.git`, `gitdir`, and `commondir` without executing Git. Linked worktrees share one repository scope; another clone, repository, or non-Git directory retains a different local session key even when its readable name matches.
|
|
10
10
|
|
|
11
11
|
If a successful Search result reports `workspaceScopeFallbackReason: git_metadata_invalid`, malformed or incomplete metadata inside a direct `.git` directory was downgraded to the normalized local folder scope. Search has already run with the reported `effectiveUserId`. Present its `userNotice` once without pausing the current task or asking the user to repair Git first, then continue with the returned memory and live evidence. After the repository or `.git` metadata is repaired, later Search, Add, and automatic writeback in the same client session automatically use the restored Git repository scope.
|
|
12
12
|
|
|
13
|
-
Require a readable active workspace binding. A CLI command from a linked worktree of the bound repository is valid. If `memorax-cli search` reports `workspace_scope_mismatch` or `workspace_scope_unavailable`, do not bypass the scope or fall back to an unscoped
|
|
13
|
+
Require a readable active workspace binding. A CLI command from a linked worktree of the bound repository is valid. If `memorax-cli search` reports `workspace_scope_mismatch` or `workspace_scope_unavailable`, do not bypass the scope or fall back to an unscoped username. Do not change the CLI working directory and retry. Tell the user that memory search was not executed and no request was sent to MemoraX, then present the CLI's `userAction` in natural language. Continue the current task using only live code and documentation.
|
|
14
14
|
|
|
15
15
|
If `memorax-cli` is not on `PATH`, or memory is disabled, unconfigured, or unavailable, report that briefly and continue with live code or documentation. Authenticate through MemoraX Code configuration; never recover credentials from shell history or place tokens in prompts. Treat injected memory as a hypothesis and verify it against the current checkout.
|
|
16
16
|
|
|
@@ -88,4 +88,6 @@ Do not apply this retry to `memorax-cli add`, authentication or configuration fa
|
|
|
88
88
|
|
|
89
89
|
## Output
|
|
90
90
|
|
|
91
|
+
If a successful Search returns `quotaNotice`, or prints it as a quota-reminder line in the default CLI output, present the complete reminder once and prominently before the normal result summary. Do not reduce it to only a percentage or omit its account URL or conditional local Mark ID retrieval instructions. Never run `memorax-code account --show-mark-id` for the user, ask for its output, or reproduce a Mark ID in chat. Treat the reminder as user-facing operational output, not recalled memory, and continue the current task.
|
|
92
|
+
|
|
91
93
|
Mention only an invariant, pitfall, convention, or validation idea that materially affects the answer. Ground claims about current implementation behavior in live code and checks.
|
|
@@ -53,6 +53,7 @@ try {
|
|
|
53
53
|
requireTranscriptPath: true,
|
|
54
54
|
runtime: "codex",
|
|
55
55
|
supplementalReminderAfterCompact: true,
|
|
56
|
+
systemMessage: turnStartResult.userNotice,
|
|
56
57
|
}, normalizedInput);
|
|
57
58
|
}
|
|
58
59
|
} catch (error) {
|
|
@@ -83,6 +84,7 @@ async function recordTurnStart(body) {
|
|
|
83
84
|
recorded: true,
|
|
84
85
|
additionalContext: stringValue(response?.additionalContext),
|
|
85
86
|
repoMemoryWorktree: stringValue(response?.repoMemoryWorktree),
|
|
87
|
+
userNotice: stringValue(response?.userNotice),
|
|
86
88
|
};
|
|
87
89
|
} catch (error) {
|
|
88
90
|
debugHookError(error);
|
|
@@ -83,4 +83,6 @@ Do not add speculation, assistant-only praise, or a current instruction merely b
|
|
|
83
83
|
|
|
84
84
|
## Output
|
|
85
85
|
|
|
86
|
+
If a successful Add returns `quotaNotice`, or prints it as a quota-reminder line in the default CLI output, present the complete reminder once and prominently before the normal result summary. Do not reduce it to only a percentage or omit its account URL or conditional local Mark ID retrieval instructions. Never run `memorax-code account --show-mark-id` for the user, ask for its output, or reproduce a Mark ID in chat. Treat the reminder as user-facing operational output, not coding memory content, and continue the current task.
|
|
87
|
+
|
|
86
88
|
After an add request is accepted, confirm briefly that it was submitted for processing and identify the reusable coding lesson at a high level. If add is disabled or fails, report the issue and continue without bypassing the CLI.
|
|
@@ -6,11 +6,11 @@ Use these instructions only to search reusable coding memory through `memorax-cl
|
|
|
6
6
|
|
|
7
7
|
Run the CLI from the active task workspace. The installed Hook and session binding supply the authoritative workspace root; do not run `git rev-parse`, infer the root from Git metadata, or substitute an unrelated working directory. Do not make `memorax-cli status` a mandatory preflight; use it only to diagnose a configuration or scope failure.
|
|
8
8
|
|
|
9
|
-
Coding memory uses `<MemoraX base
|
|
9
|
+
Coding memory uses `<MemoraX base username>@<normalized repository name>` for Git workspaces and the normalized folder name for genuine non-Git directories. MemoraX Code resolves `.git`, `gitdir`, and `commondir` without executing Git. Linked worktrees share one repository scope; another clone, repository, or non-Git directory retains a different local session key even when its readable name matches.
|
|
10
10
|
|
|
11
11
|
If a successful Search result reports `workspaceScopeFallbackReason: git_metadata_invalid`, malformed or incomplete metadata inside a direct `.git` directory was downgraded to the normalized local folder scope. Search has already run with the reported `effectiveUserId`. Present its `userNotice` once without pausing the current task or asking the user to repair Git first, then continue with the returned memory and live evidence. After the repository or `.git` metadata is repaired, later Search, Add, and automatic writeback in the same client session automatically use the restored Git repository scope.
|
|
12
12
|
|
|
13
|
-
Require a readable active workspace binding. A CLI command from a linked worktree of the bound repository is valid. If `memorax-cli search` reports `workspace_scope_mismatch` or `workspace_scope_unavailable`, do not bypass the scope or fall back to an unscoped
|
|
13
|
+
Require a readable active workspace binding. A CLI command from a linked worktree of the bound repository is valid. If `memorax-cli search` reports `workspace_scope_mismatch` or `workspace_scope_unavailable`, do not bypass the scope or fall back to an unscoped username. Do not change the CLI working directory and retry. Tell the user that memory search was not executed and no request was sent to MemoraX, then present the CLI's `userAction` in natural language. Continue the current task using only live code and documentation.
|
|
14
14
|
|
|
15
15
|
If `memorax-cli` is not on `PATH`, or memory is disabled, unconfigured, or unavailable, report that briefly and continue with live code or documentation. Authenticate through MemoraX Code configuration; never recover credentials from shell history or place tokens in prompts. Treat injected memory as a hypothesis and verify it against the current checkout.
|
|
16
16
|
|
|
@@ -88,4 +88,6 @@ Do not apply this retry to `memorax-cli add`, authentication or configuration fa
|
|
|
88
88
|
|
|
89
89
|
## Output
|
|
90
90
|
|
|
91
|
+
If a successful Search returns `quotaNotice`, or prints it as a quota-reminder line in the default CLI output, present the complete reminder once and prominently before the normal result summary. Do not reduce it to only a percentage or omit its account URL or conditional local Mark ID retrieval instructions. Never run `memorax-code account --show-mark-id` for the user, ask for its output, or reproduce a Mark ID in chat. Treat the reminder as user-facing operational output, not recalled memory, and continue the current task.
|
|
92
|
+
|
|
91
93
|
Mention only an invariant, pitfall, convention, or validation idea that materially affects the answer. Ground claims about current implementation behavior in live code and checks.
|
|
@@ -4,7 +4,10 @@ import { dirname, join, resolve } from "node:path";
|
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { runRepoMemoryJob } from "../memorax-code-adapter-common/src/repo-memory/repo-memory-job-supervisor.mjs";
|
|
6
6
|
import { evaluateRepository } from "../memorax-code-adapter-common/src/repo-memory/repo-memory-update-policy-evaluator.mjs";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
buildDshCommand,
|
|
9
|
+
requireEnabledDshRuntime,
|
|
10
|
+
} from "../src/runtime-state.mjs";
|
|
8
11
|
|
|
9
12
|
const ADAPTER_PACKAGE_NAME = "@memorax-code/dsh-memorax-code";
|
|
10
13
|
const HEADLESS_BUNDLE_NAME = "@deepseek-ai/dsh-headless";
|
|
@@ -23,7 +26,7 @@ try {
|
|
|
23
26
|
validatorPath: resolve(pluginRoot, "skills/memorax-code/scripts/validate_memory.py"),
|
|
24
27
|
evaluateRepository,
|
|
25
28
|
createCommand({ prompt }) {
|
|
26
|
-
return
|
|
29
|
+
return buildDshCommand(runtime.dshCommand, ["--profile", profile, prompt]);
|
|
27
30
|
},
|
|
28
31
|
});
|
|
29
32
|
process.stdout.write(`${JSON.stringify(payload)}\n`);
|
|
@@ -83,4 +83,6 @@ Do not add speculation, assistant-only praise, or a current instruction merely b
|
|
|
83
83
|
|
|
84
84
|
## Output
|
|
85
85
|
|
|
86
|
+
If a successful Add returns `quotaNotice`, or prints it as a quota-reminder line in the default CLI output, present the complete reminder once and prominently before the normal result summary. Do not reduce it to only a percentage or omit its account URL or conditional local Mark ID retrieval instructions. Never run `memorax-code account --show-mark-id` for the user, ask for its output, or reproduce a Mark ID in chat. Treat the reminder as user-facing operational output, not coding memory content, and continue the current task.
|
|
87
|
+
|
|
86
88
|
After an add request is accepted, confirm briefly that it was submitted for processing and identify the reusable coding lesson at a high level. If add is disabled or fails, report the issue and continue without bypassing the CLI.
|
|
@@ -6,11 +6,11 @@ Use these instructions only to search reusable coding memory through `memorax-cl
|
|
|
6
6
|
|
|
7
7
|
Run the CLI from the active task workspace. The installed Hook and session binding supply the authoritative workspace root; do not run `git rev-parse`, infer the root from Git metadata, or substitute an unrelated working directory. Do not make `memorax-cli status` a mandatory preflight; use it only to diagnose a configuration or scope failure.
|
|
8
8
|
|
|
9
|
-
Coding memory uses `<MemoraX base
|
|
9
|
+
Coding memory uses `<MemoraX base username>@<normalized repository name>` for Git workspaces and the normalized folder name for genuine non-Git directories. MemoraX Code resolves `.git`, `gitdir`, and `commondir` without executing Git. Linked worktrees share one repository scope; another clone, repository, or non-Git directory retains a different local session key even when its readable name matches.
|
|
10
10
|
|
|
11
11
|
If a successful Search result reports `workspaceScopeFallbackReason: git_metadata_invalid`, malformed or incomplete metadata inside a direct `.git` directory was downgraded to the normalized local folder scope. Search has already run with the reported `effectiveUserId`. Present its `userNotice` once without pausing the current task or asking the user to repair Git first, then continue with the returned memory and live evidence. After the repository or `.git` metadata is repaired, later Search, Add, and automatic writeback in the same client session automatically use the restored Git repository scope.
|
|
12
12
|
|
|
13
|
-
Require a readable active workspace binding. A CLI command from a linked worktree of the bound repository is valid. If `memorax-cli search` reports `workspace_scope_mismatch` or `workspace_scope_unavailable`, do not bypass the scope or fall back to an unscoped
|
|
13
|
+
Require a readable active workspace binding. A CLI command from a linked worktree of the bound repository is valid. If `memorax-cli search` reports `workspace_scope_mismatch` or `workspace_scope_unavailable`, do not bypass the scope or fall back to an unscoped username. Do not change the CLI working directory and retry. Tell the user that memory search was not executed and no request was sent to MemoraX, then present the CLI's `userAction` in natural language. Continue the current task using only live code and documentation.
|
|
14
14
|
|
|
15
15
|
If `memorax-cli` is not on `PATH`, or memory is disabled, unconfigured, or unavailable, report that briefly and continue with live code or documentation. Authenticate through MemoraX Code configuration; never recover credentials from shell history or place tokens in prompts. Treat injected memory as a hypothesis and verify it against the current checkout.
|
|
16
16
|
|
|
@@ -88,4 +88,6 @@ Do not apply this retry to `memorax-cli add`, authentication or configuration fa
|
|
|
88
88
|
|
|
89
89
|
## Output
|
|
90
90
|
|
|
91
|
+
If a successful Search returns `quotaNotice`, or prints it as a quota-reminder line in the default CLI output, present the complete reminder once and prominently before the normal result summary. Do not reduce it to only a percentage or omit its account URL or conditional local Mark ID retrieval instructions. Never run `memorax-code account --show-mark-id` for the user, ask for its output, or reproduce a Mark ID in chat. Treat the reminder as user-facing operational output, not recalled memory, and continue the current task.
|
|
92
|
+
|
|
91
93
|
Mention only an invariant, pitfall, convention, or validation idea that materially affects the answer. Ground claims about current implementation behavior in live code and checks.
|