@dev-crowagent/pigeon-server 0.0.0-stage → 1.7.1
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 +146 -2
- package/dist/auth.d.ts +12 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +38 -0
- package/dist/auth.js.map +1 -0
- package/dist/host.d.ts +25 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +82 -0
- package/dist/host.js.map +1 -0
- package/dist/http.d.ts +24 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +278 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/keys.d.ts +32 -0
- package/dist/keys.d.ts.map +1 -0
- package/dist/keys.js +190 -0
- package/dist/keys.js.map +1 -0
- package/dist/model.d.ts +22 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +123 -0
- package/dist/model.js.map +1 -0
- package/dist/permissions.d.ts +43 -0
- package/dist/permissions.d.ts.map +1 -0
- package/dist/permissions.js +81 -0
- package/dist/permissions.js.map +1 -0
- package/dist/sessions.d.ts +81 -0
- package/dist/sessions.d.ts.map +1 -0
- package/dist/sessions.js +320 -0
- package/dist/sessions.js.map +1 -0
- package/dist/tools.d.ts +12 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +383 -0
- package/dist/tools.js.map +1 -0
- package/dist/types.d.ts +108 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/workspace.d.ts +22 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +53 -0
- package/dist/workspace.js.map +1 -0
- package/package.json +50 -5
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { mkdirSync } from "node:fs";
|
|
2
|
+
import { join, resolve, sep } from "node:path";
|
|
3
|
+
const USER_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
|
|
4
|
+
/** User ids are path segments; reject anything that could escape the user directory. */
|
|
5
|
+
export function assertValidUserId(userId) {
|
|
6
|
+
if (!USER_ID_PATTERN.test(userId)) {
|
|
7
|
+
throw new Error(`Invalid user id "${userId}". Use letters, digits, ".", "_" or "-", up to 64 characters.`);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
/** Per-user data root: <dataDir>/users/<userId>. */
|
|
11
|
+
export function userDir(dataDir, userId) {
|
|
12
|
+
assertValidUserId(userId);
|
|
13
|
+
return join(resolve(dataDir), "users", userId);
|
|
14
|
+
}
|
|
15
|
+
/** Per-user workspace: the only directory the user's agent tools may touch. */
|
|
16
|
+
export function userWorkspaceDir(dataDir, userId) {
|
|
17
|
+
return join(userDir(dataDir, userId), "workspace");
|
|
18
|
+
}
|
|
19
|
+
/** Per-user memory root for the kit MemoryStore. */
|
|
20
|
+
export function userMemoryDir(dataDir, userId) {
|
|
21
|
+
return join(userDir(dataDir, userId), "memory");
|
|
22
|
+
}
|
|
23
|
+
/** Per-user session transcripts. */
|
|
24
|
+
export function userSessionsDir(dataDir, userId) {
|
|
25
|
+
return join(userDir(dataDir, userId), "sessions");
|
|
26
|
+
}
|
|
27
|
+
/** Per-user settings file (mode 0600). */
|
|
28
|
+
export function userSettingsPath(dataDir, userId) {
|
|
29
|
+
return join(userDir(dataDir, userId), "settings.json");
|
|
30
|
+
}
|
|
31
|
+
/** Per-user provider keys file (mode 0600). */
|
|
32
|
+
export function userKeysPath(dataDir, userId) {
|
|
33
|
+
return join(userDir(dataDir, userId), "keys.json");
|
|
34
|
+
}
|
|
35
|
+
/** Creates the per-user directories (workspace, memory, sessions). */
|
|
36
|
+
export function ensureUserDirs(dataDir, userId) {
|
|
37
|
+
mkdirSync(userWorkspaceDir(dataDir, userId), { recursive: true });
|
|
38
|
+
mkdirSync(userMemoryDir(dataDir, userId), { recursive: true });
|
|
39
|
+
mkdirSync(userSessionsDir(dataDir, userId), { recursive: true });
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Resolves a tool path inside the workspace. Paths that escape the workspace
|
|
43
|
+
* (absolute paths outside it, `..` segments) are rejected.
|
|
44
|
+
*/
|
|
45
|
+
export function resolveWorkspacePath(workspaceDir, relative) {
|
|
46
|
+
const root = resolve(workspaceDir);
|
|
47
|
+
const target = resolve(root, relative);
|
|
48
|
+
if (target !== root && !target.startsWith(root + sep)) {
|
|
49
|
+
throw new Error(`Path "${relative}" escapes the workspace.`);
|
|
50
|
+
}
|
|
51
|
+
return target;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=workspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../src/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,eAAe,GAAG,mCAAmC,CAAC;AAE5D,wFAAwF;AACxF,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC/C,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,oBAAoB,MAAM,+DAA+D,CAAC,CAAC;IAC5G,CAAC;AACF,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,OAAO,CAAC,OAAe,EAAE,MAAc;IACtD,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAChD,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,gBAAgB,CAAC,OAAe,EAAE,MAAc;IAC/D,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,WAAW,CAAC,C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ACvC,IAAI,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC;QACvD,MAAM,IAAI,KAAK,CAAC,SAAS,QAAQ,0BAA0B,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC","sourcesContent":["import { mkdirSync } from \"node:fs\";\nimport { join, resolve, sep } from \"node:path\";\n\nconst USER_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;\n\n/** User ids are path segments; reject anything that could escape the user directory. */\nexport function assertValidUserId(userId: string): void {\n\tif (!USER_ID_PATTERN.test(userId)) {\n\t\tthrow new Error(`Invalid user id \"${userId}\". Use letters, digits, \".\", \"_\" or \"-\", up to 64 characters.`);\n\t}\n}\n\n/** Per-user data root: <dataDir>/users/<userId>. */\nexport function userDir(dataDir: string, userId: string): string {\n\tassertValidUserId(userId);\n\treturn join(resolve(dataDir), \"users\", userId);\n}\n\n/** Per-user workspace: the only directory the user's agent tools may touch. */\nexport function userWorkspaceDir(dataDir: string, userId: string): string {\n\treturn join(userDir(dataDir, userId), \"workspace\");\n}\n\n/** Per-user memory root for the kit MemoryStore. */\nexport function userMemoryDir(dataDir: string, userId: string): string {\n\treturn join(userDir(dataDir, userId), \"memory\");\n}\n\n/** Per-user session transcripts. */\nexport function userSessionsDir(dataDir: string, userId: string): string {\n\treturn join(userDir(dataDir, userId), \"sessions\");\n}\n\n/** Per-user settings file (mode 0600). */\nexport function userSettingsPath(dataDir: string, userId: string): string {\n\treturn join(userDir(dataDir, userId), \"settings.json\");\n}\n\n/** Per-user provider keys file (mode 0600). */\nexport function userKeysPath(dataDir: string, userId: string): string {\n\treturn join(userDir(dataDir, userId), \"keys.json\");\n}\n\n/** Creates the per-user directories (workspace, memory, sessions). */\nexport function ensureUserDirs(dataDir: string, userId: string): void {\n\tmkdirSync(userWorkspaceDir(dataDir, userId), { recursive: true });\n\tmkdirSync(userMemoryDir(dataDir, userId), { recursive: true });\n\tmkdirSync(userSessionsDir(dataDir, userId), { recursive: true });\n}\n\n/**\n * Resolves a tool path inside the workspace. Paths that escape the workspace\n * (absolute paths outside it, `..` segments) are rejected.\n */\nexport function resolveWorkspacePath(workspaceDir: string, relative: string): string {\n\tconst root = resolve(workspaceDir);\n\tconst target = resolve(root, relative);\n\tif (target !== root && !target.startsWith(root + sep)) {\n\t\tthrow new Error(`Path \"${relative}\" escapes the workspace.`);\n\t}\n\treturn target;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,51 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"author": "Mario Zechner",
|
|
3
|
+
"dependencies": {
|
|
4
|
+
"@dev-crowagent/pigeon-agent-core": "1.7.1",
|
|
5
|
+
"@dev-crowagent/pigeon-agent-kit": "1.7.1",
|
|
6
|
+
"@dev-crowagent/pigeon-ai": "1.7.1",
|
|
7
|
+
"@dev-crowagent/pigeon-schema": "1.7.1"
|
|
8
|
+
},
|
|
9
|
+
"description": "Embeddable multi-user pigeon agent host: one isolated agent per user over HTTP + SSE",
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@types/node": "22.19.19",
|
|
12
|
+
"vitest": "4.1.12"
|
|
13
|
+
},
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=22.19.0"
|
|
16
|
+
},
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"import": "./dist/index.js",
|
|
20
|
+
"types": "./dist/index.d.ts"
|
|
21
|
+
},
|
|
22
|
+
"./package.json": "./package.json"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"README.md"
|
|
27
|
+
],
|
|
28
|
+
"keywords": [
|
|
29
|
+
"ai",
|
|
30
|
+
"agent",
|
|
31
|
+
"server",
|
|
32
|
+
"multi-user"
|
|
33
|
+
],
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"main": "./dist/index.js",
|
|
36
|
+
"name": "@dev-crowagent/pigeon-server",
|
|
37
|
+
"repository": {
|
|
38
|
+
"directory": "packages/server",
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/pooraddyy/pigeon.git"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsc -p tsconfig.build.json",
|
|
44
|
+
"clean": "node ../../scripts/package-files.mjs clean dist",
|
|
45
|
+
"prepublishOnly": "npm run build",
|
|
46
|
+
"test": "vitest --run"
|
|
47
|
+
},
|
|
48
|
+
"type": "module",
|
|
49
|
+
"types": "./dist/index.d.ts",
|
|
50
|
+
"version": "1.7.1"
|
|
51
|
+
}
|