aamp-openclaw-plugin 0.1.17 → 0.1.19
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/dist/chunk-ORTVVAMV.js +82 -0
- package/dist/chunk-ORTVVAMV.js.map +7 -0
- package/dist/file-store.js +2 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { createRequire as __aampCreateRequire } from "module"; const require = __aampCreateRequire(import.meta.url);
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
+
}) : x)(function(x) {
|
|
11
|
+
if (typeof require !== "undefined")
|
|
12
|
+
return require.apply(this, arguments);
|
|
13
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
14
|
+
});
|
|
15
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
16
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
27
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
28
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
29
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
30
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
31
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
32
|
+
mod
|
|
33
|
+
));
|
|
34
|
+
|
|
35
|
+
// src/file-store.ts
|
|
36
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
37
|
+
import { dirname, join } from "node:path";
|
|
38
|
+
import { homedir } from "node:os";
|
|
39
|
+
function defaultCredentialsPath() {
|
|
40
|
+
return join(homedir(), ".openclaw", "extensions", "aamp-openclaw-plugin", ".credentials.json");
|
|
41
|
+
}
|
|
42
|
+
function loadCachedIdentity(file) {
|
|
43
|
+
const resolved = file ?? defaultCredentialsPath();
|
|
44
|
+
if (!existsSync(resolved))
|
|
45
|
+
return null;
|
|
46
|
+
try {
|
|
47
|
+
const parsed = JSON.parse(readFileSync(resolved, "utf-8"));
|
|
48
|
+
if (!parsed.email || !parsed.jmapToken || !parsed.smtpPassword)
|
|
49
|
+
return null;
|
|
50
|
+
return parsed;
|
|
51
|
+
} catch {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function saveCachedIdentity(identity, file) {
|
|
56
|
+
const resolved = file ?? defaultCredentialsPath();
|
|
57
|
+
mkdirSync(dirname(resolved), { recursive: true });
|
|
58
|
+
writeFileSync(resolved, JSON.stringify(identity, null, 2), "utf-8");
|
|
59
|
+
}
|
|
60
|
+
function ensureDir(dir) {
|
|
61
|
+
mkdirSync(dir, { recursive: true });
|
|
62
|
+
}
|
|
63
|
+
function readBinaryFile(path) {
|
|
64
|
+
return readFileSync(path);
|
|
65
|
+
}
|
|
66
|
+
function writeBinaryFile(path, content) {
|
|
67
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
68
|
+
writeFileSync(path, content);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export {
|
|
72
|
+
__require,
|
|
73
|
+
__commonJS,
|
|
74
|
+
__toESM,
|
|
75
|
+
defaultCredentialsPath,
|
|
76
|
+
loadCachedIdentity,
|
|
77
|
+
saveCachedIdentity,
|
|
78
|
+
ensureDir,
|
|
79
|
+
readBinaryFile,
|
|
80
|
+
writeBinaryFile
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=chunk-ORTVVAMV.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/file-store.ts"],
|
|
4
|
+
"sourcesContent": ["import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport { homedir } from 'node:os'\n\nexport interface Identity {\n email: string\n jmapToken: string\n smtpPassword: string\n}\n\nexport function defaultCredentialsPath(): string {\n return join(homedir(), '.openclaw', 'extensions', 'aamp-openclaw-plugin', '.credentials.json')\n}\n\nexport function loadCachedIdentity(file?: string): Identity | null {\n const resolved = file ?? defaultCredentialsPath()\n if (!existsSync(resolved)) return null\n try {\n const parsed = JSON.parse(readFileSync(resolved, 'utf-8')) as Partial<Identity>\n if (!parsed.email || !parsed.jmapToken || !parsed.smtpPassword) return null\n return parsed as Identity\n } catch {\n return null\n }\n}\n\nexport function saveCachedIdentity(identity: Identity, file?: string): void {\n const resolved = file ?? defaultCredentialsPath()\n mkdirSync(dirname(resolved), { recursive: true })\n writeFileSync(resolved, JSON.stringify(identity, null, 2), 'utf-8')\n}\n\nexport function ensureDir(dir: string): void {\n mkdirSync(dir, { recursive: true })\n}\n\nexport function readBinaryFile(path: string): Buffer {\n return readFileSync(path)\n}\n\nexport function writeBinaryFile(path: string, content: Uint8Array | Buffer): void {\n mkdirSync(dirname(path), { recursive: true })\n writeFileSync(path, content)\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY,WAAW,cAAc,qBAAqB;AACnE,SAAS,SAAS,YAAY;AAC9B,SAAS,eAAe;AAQjB,SAAS,yBAAiC;AAC/C,SAAO,KAAK,QAAQ,GAAG,aAAa,cAAc,wBAAwB,mBAAmB;AAC/F;AAEO,SAAS,mBAAmB,MAAgC;AACjE,QAAM,WAAW,QAAQ,uBAAuB;AAChD,MAAI,CAAC,WAAW,QAAQ;AAAG,WAAO;AAClC,MAAI;AACF,UAAM,SAAS,KAAK,MAAM,aAAa,UAAU,OAAO,CAAC;AACzD,QAAI,CAAC,OAAO,SAAS,CAAC,OAAO,aAAa,CAAC,OAAO;AAAc,aAAO;AACvE,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,SAAS,mBAAmB,UAAoB,MAAqB;AAC1E,QAAM,WAAW,QAAQ,uBAAuB;AAChD,YAAU,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAK,CAAC;AAChD,gBAAc,UAAU,KAAK,UAAU,UAAU,MAAM,CAAC,GAAG,OAAO;AACpE;AAEO,SAAS,UAAU,KAAmB;AAC3C,YAAU,KAAK,EAAE,WAAW,KAAK,CAAC;AACpC;AAEO,SAAS,eAAe,MAAsB;AACnD,SAAO,aAAa,IAAI;AAC1B;AAEO,SAAS,gBAAgB,MAAc,SAAoC;AAChF,YAAU,QAAQ,IAAI,GAAG,EAAE,WAAW,KAAK,CAAC;AAC5C,gBAAc,MAAM,OAAO;AAC7B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/file-store.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createRequire as __aampCreateRequire } from "module"; const require = __aampCreateRequire(import.meta.url);
|
|
1
2
|
import {
|
|
2
3
|
defaultCredentialsPath,
|
|
3
4
|
ensureDir,
|
|
@@ -5,7 +6,7 @@ import {
|
|
|
5
6
|
readBinaryFile,
|
|
6
7
|
saveCachedIdentity,
|
|
7
8
|
writeBinaryFile
|
|
8
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ORTVVAMV.js";
|
|
9
10
|
export {
|
|
10
11
|
defaultCredentialsPath,
|
|
11
12
|
ensureDir,
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createRequire as __aampCreateRequire } from "module"; const require = __aampCreateRequire(import.meta.url);
|
|
1
2
|
import {
|
|
2
3
|
__commonJS,
|
|
3
4
|
__require,
|
|
@@ -8,7 +9,7 @@ import {
|
|
|
8
9
|
readBinaryFile,
|
|
9
10
|
saveCachedIdentity,
|
|
10
11
|
writeBinaryFile
|
|
11
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ORTVVAMV.js";
|
|
12
13
|
|
|
13
14
|
// ../sdk/node_modules/ws/lib/constants.js
|
|
14
15
|
var require_constants = __commonJS({
|
|
@@ -16657,6 +16658,11 @@ Suggested options: ${help.suggestedOptions.join(", ")}` : ""}`,
|
|
|
16657
16658
|
api.on(
|
|
16658
16659
|
"before_prompt_build",
|
|
16659
16660
|
(_event, ctx) => {
|
|
16661
|
+
if (pendingTasks.size > 0) {
|
|
16662
|
+
api.logger.info(
|
|
16663
|
+
`[AAMP] before_prompt_build \u2014 pending=${pendingTasks.size} session=${ctx?.sessionKey ?? "unknown"} currentSession=${currentSessionKey}`
|
|
16664
|
+
);
|
|
16665
|
+
}
|
|
16660
16666
|
if (ctx?.sessionKey && !String(ctx.sessionKey).startsWith("aamp:")) {
|
|
16661
16667
|
currentSessionKey = ctx.sessionKey;
|
|
16662
16668
|
}
|
|
@@ -16752,6 +16758,9 @@ ${task.contextLinks.map((l) => ` - ${l}`).join("\n")}` : "",
|
|
|
16752
16758
|
pendingTasks.size > 1 ? `
|
|
16753
16759
|
(+${pendingTasks.size - 1} more tasks queued)` : ""
|
|
16754
16760
|
].filter(Boolean).join("\n");
|
|
16761
|
+
api.logger.info(
|
|
16762
|
+
`[AAMP] Injecting pending task into prompt \u2014 taskId=${task.taskId} notification=${isNotification ? "yes" : "no"} remaining=${pendingTasks.size}`
|
|
16763
|
+
);
|
|
16755
16764
|
return { prependContext: lines };
|
|
16756
16765
|
},
|
|
16757
16766
|
{ priority: 5 }
|