@hasna/mementos 0.14.72 → 0.14.73
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-cmd-crud.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/memory-cmd-crud.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA+BzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"memory-cmd-crud.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/memory-cmd-crud.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA+BzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwf3D"}
|
package/dist/cli/index.js
CHANGED
|
@@ -59827,7 +59827,13 @@ function registerCrudCommands(program2) {
|
|
|
59827
59827
|
let resolvedAgentId;
|
|
59828
59828
|
if (globalOpts.agent) {
|
|
59829
59829
|
const ag = getAgent(globalOpts.agent);
|
|
59830
|
-
|
|
59830
|
+
if (!ag) {
|
|
59831
|
+
throw new Error(`Unknown agent "${globalOpts.agent}": no registered agent matches that name or id.
|
|
59832
|
+
` + `Refusing to save. Dropping the flag would write this memory to the unowned ` + `(no-agent) row for key "${key}", overwriting whatever is there under an owner ` + `you did not name.
|
|
59833
|
+
` + `Register the agent first: mementos register-agent ${globalOpts.agent}
|
|
59834
|
+
` + `Or omit --agent to write to the unowned row deliberately.`);
|
|
59835
|
+
}
|
|
59836
|
+
resolvedAgentId = ag.id;
|
|
59831
59837
|
}
|
|
59832
59838
|
const input = {
|
|
59833
59839
|
key,
|
|
@@ -59843,9 +59849,18 @@ function registerCrudCommands(program2) {
|
|
|
59843
59849
|
session_id: globalOpts.session
|
|
59844
59850
|
};
|
|
59845
59851
|
if (globalOpts.project) {
|
|
59846
|
-
const
|
|
59847
|
-
|
|
59848
|
-
|
|
59852
|
+
const projectPath = resolve3(globalOpts.project);
|
|
59853
|
+
const project = getProject(projectPath);
|
|
59854
|
+
if (!project) {
|
|
59855
|
+
throw new Error(`Unknown project "${projectPath}": no registered project matches that path.
|
|
59856
|
+
` + `Refusing to save. Dropping the flag would write this memory to the no-project ` + `row for key "${key}", overwriting whatever is there in a scope you did not name.
|
|
59857
|
+
` + `Register it first: mementos projects --add --path ${projectPath} --name <name>
|
|
59858
|
+
` + `Or omit --project to write outside any project deliberately.`);
|
|
59859
|
+
}
|
|
59860
|
+
input.project_id = project.id;
|
|
59861
|
+
}
|
|
59862
|
+
if (typeof input.session_id === "string" && MEMORY_SCOPES.includes(input.session_id)) {
|
|
59863
|
+
console.error(chalk2.yellow(`Warning: --session "${input.session_id}" looks like a scope, not a session id. ` + `Note that -s is the global --session, not --scope; this save is writing ` + `session_id="${input.session_id}" and leaving scope at "${input.scope ?? "private"}". ` + `If you meant the scope, pass --scope ${input.session_id} (long form only).`));
|
|
59849
59864
|
}
|
|
59850
59865
|
const bucket = (m) => [m.scope ?? "private", m.agent_id ?? "", m.project_id ?? "", m.session_id ?? ""].join("\x1F");
|
|
59851
59866
|
const targetBucket = bucket({
|
|
@@ -59864,9 +59879,9 @@ function registerCrudCommands(program2) {
|
|
|
59864
59879
|
if (!match && sameKey.length > 0) {
|
|
59865
59880
|
const rows = sameKey.map((m) => ` ${m.id.slice(0, 8)} scope=${m.scope} project=${m.project_id ?? "none"} session=${m.session_id ?? "none"} agent=${m.agent_id ?? "none"}`).join(`
|
|
59866
59881
|
`);
|
|
59867
|
-
throw new Error(`Refusing to fork key "${key}": ${sameKey.length} active memor${sameKey.length === 1 ? "y" : "ies"} ` + `already ${sameKey.length === 1 ? "uses" : "use"} it, ` + `but none matches the scope/project/session this save targets ` + `(scope=${input.scope ?? "private"}, project=${input.project_id ?? "none"}, session=${input.session_id ?? "none"}).
|
|
59882
|
+
throw new Error(`Refusing to fork key "${key}": ${sameKey.length} active memor${sameKey.length === 1 ? "y" : "ies"} ` + `already ${sameKey.length === 1 ? "uses" : "use"} it, ` + `but none matches the scope/project/session/agent this save targets ` + `(scope=${input.scope ?? "private"}, project=${input.project_id ?? "none"}, session=${input.session_id ?? "none"}, agent=${input.agent_id ?? "none"}).
|
|
59868
59883
|
` + `${rows}
|
|
59869
|
-
` + `Saving would create a second active row under the same key. Either target the existing row ` + `(match its scope/project/session flags, or use \`mementos update <id>\`), or pass \`--dedupe create\` ` + `to fork deliberately.`);
|
|
59884
|
+
` + `Saving would create a second active row under the same key. Either target the existing row ` + `(match its scope/project/session/agent flags, or use \`mementos update <id>\`), or pass \`--dedupe create\` ` + `to fork deliberately.`);
|
|
59870
59885
|
}
|
|
59871
59886
|
}
|
|
59872
59887
|
const memory = forkRequested ? createMemory(input, dedupe) : createMemory(input);
|