@anhlp/alp-paseo 0.0.0-beta.2 → 0.0.1-beta.3
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 +16 -4
- package/client/library.tsx +22 -6
- package/package.json +14 -14
- package/paseo-plugin.json +1 -1
- package/server/dist/THIRD-PARTY-NOTICES.txt +2 -2
- package/server/dist/alpd.js +705 -326
- package/server/dist/index.js +686 -273
- package/server/dist/library.js +65 -9
- package/server/dist/main.js +284 -102
- package/server/dist/mapping.js +4 -2
- package/server/dist/panel/library.js +65 -9
- package/server/dist/panel/mapping.js +4 -2
- package/server/dist/panel/tasks.js +1 -1
- package/server/dist/panel/usage.js +3 -3
- package/server/dist/paseo/agents.js +62 -18
- package/server/dist/paseo/index.js +166 -68
- package/server/dist/paseo/plugins.js +84 -28
- package/server/dist/paseo/providers.js +44 -3
- package/server/dist/provider-core.js +14 -0
- package/server/dist/provider.js +574 -209
- package/server/dist/remote/index.js +34 -5
- package/server/dist/remote/link.js +1 -1
- package/server/dist/remote/panels.js +20 -5
- package/server/dist/remote/provider.js +15 -1
- package/server/dist/session-usage.js +15 -0
- package/server/dist/tasks.js +1 -1
- package/server/dist/usage.js +3 -3
- package/server/dist/web.js +1 -1
- package/shared/library.ts +2 -0
package/server/dist/mapping.js
CHANGED
|
@@ -7927,7 +7927,7 @@ var TAIL_BYTES = 256 * 1024;
|
|
|
7927
7927
|
var MAX_FRAME = 16 * 1024 * 1024;
|
|
7928
7928
|
var ERROR = Object.freeze({ failed: 1e3, notFound: 1001, forbidden: 1003, conflict: 1004, unavailable: 1005, protocol: 1006 });
|
|
7929
7929
|
var RPC_ERROR = Object.freeze({ parseError: -32700, invalidRequest: -32600, methodNotFound: -32601, invalidParams: -32602 });
|
|
7930
|
-
var CAPABILITY = Object.freeze({ attachAfter: "attach.after", promptReceipts: "prompt.receipts", extensionMethods: "extension.methods", team: "team", task: "task", library: "library", settingsLanguage: "settings.language", sessionListPage: "session.list.page", questionWatch: "question.watch", questionWatchTurns: "question.watch.turns", workspaceFiles: "workspace.files", workspaceFilesRead: "workspace.files.read", promptImages: "prompt.images" });
|
|
7930
|
+
var CAPABILITY = Object.freeze({ attachAfter: "attach.after", promptReceipts: "prompt.receipts", extensionMethods: "extension.methods", team: "team", task: "task", library: "library", libraryProjectWrite: "library.project.write", settingsLanguage: "settings.language", sessionListPage: "session.list.page", questionWatch: "question.watch", questionWatchTurns: "question.watch.turns", workspaceFiles: "workspace.files", workspaceFilesRead: "workspace.files.read", promptImages: "prompt.images" });
|
|
7931
7931
|
var PROMPT_IMAGES = Object.freeze({ mimeTypes: Object.freeze(["image/png", "image/jpeg", "image/gif", "image/webp"]), maxCount: 8, maxBytes: 5 * 1024 * 1024, maxTotalBytes: 11 * 1024 * 1024 });
|
|
7932
7932
|
var RPC_METHODS = Object.freeze(["assignment.recall", "board.list", "catalog.get", "daemon.hello", "daemon.pause", "daemon.pauses", "daemon.resume", "daemon.shutdown", "daemon.status", "daemon.usage", "extension.register", "extension.unregister", "library.delete", "library.duplicate", "library.get", "library.list", "library.models", "library.rename", "library.save", "library.skills.set", "question.answer", "question.list", "question.watch", "session.archive", "session.attach", "session.close", "session.configure", "session.create", "session.get", "session.interrupt", "session.list", "session.log", "session.message", "session.preview", "session.prompt", "session.release", "session.rename", "session.status", "settings.language.get", "settings.language.set", "task.create", "task.gate.resolve", "task.list", "task.update", "team.list", "workspace.files.list", "workspace.files.read", "workspace.files.search"]);
|
|
7933
7933
|
var WORKSPACE_FILES = Object.freeze({ maxReadBytes: 1024 * 1024, maxListEntries: 1e3, maxPathLength: 4096 });
|
|
@@ -22721,12 +22721,14 @@ var toolShapes = {
|
|
|
22721
22721
|
body: external_exports.string().min(1).max(2e4),
|
|
22722
22722
|
roles: external_exports.array(external_exports.string().min(1)).min(1).max(10),
|
|
22723
22723
|
lessons: external_exports.array(external_exports.string().min(1).max(600)).max(50).optional(),
|
|
22724
|
-
replace: external_exports.boolean().optional()
|
|
22724
|
+
replace: external_exports.boolean().optional(),
|
|
22725
|
+
requestId: external_exports.string().min(1).max(100).optional()
|
|
22725
22726
|
},
|
|
22726
22727
|
alp_issue: {
|
|
22727
22728
|
action: external_exports.enum(["search", "create", "comment"]),
|
|
22728
22729
|
target: external_exports.enum(["project", "alp"]),
|
|
22729
22730
|
query: external_exports.string().min(1).max(200).optional(),
|
|
22731
|
+
requestId: external_exports.string().min(1).max(100).optional(),
|
|
22730
22732
|
title: external_exports.string().min(1).max(200).optional(),
|
|
22731
22733
|
body: external_exports.string().min(1).max(2e4).optional(),
|
|
22732
22734
|
issue: external_exports.number().int().positive().optional(),
|
|
@@ -8680,7 +8680,7 @@ function launchCommand(command, args = [], env = process.env) {
|
|
|
8680
8680
|
}
|
|
8681
8681
|
|
|
8682
8682
|
// packages/core/src/library-edit.js
|
|
8683
|
-
import { mkdir as mkdir2, rename as rename3, rm as rm3, stat as stat2, writeFile as writeFile3 } from "node:fs/promises";
|
|
8683
|
+
import { lstat as lstat3, mkdir as mkdir2, readdir as readdir4, rename as rename3, rm as rm3, stat as stat2, writeFile as writeFile3 } from "node:fs/promises";
|
|
8684
8684
|
import { createHash as createHash2, randomUUID as randomUUID2 } from "node:crypto";
|
|
8685
8685
|
import path8 from "node:path";
|
|
8686
8686
|
|
|
@@ -8736,6 +8736,42 @@ function base(scope, { root, library }, kind) {
|
|
|
8736
8736
|
return fail3("INVALID_SCOPE", `Scope must be library or project, not '${scope}'`);
|
|
8737
8737
|
}
|
|
8738
8738
|
var revisionOf = (content) => content === void 0 ? null : createHash2("sha256").update(JSON.stringify(content)).digest("hex").slice(0, 16);
|
|
8739
|
+
function assertProjectDataContent(kind, content) {
|
|
8740
|
+
const deny = () => fail3("UNSAFE_LIBRARY_WRITE", "Project-data writes allow only instruction entries and non-executable agent configuration");
|
|
8741
|
+
if (!object6(content) || !["agents", "skills"].includes(kind)) deny();
|
|
8742
|
+
const keys2 = kind === "skills" ? ["body"] : ["instructions", "config"];
|
|
8743
|
+
if (Object.keys(content).some((key) => !keys2.includes(key))) deny();
|
|
8744
|
+
const text = kind === "skills" ? content.body : content.instructions;
|
|
8745
|
+
if (typeof text !== "string" || !text.trim()) deny();
|
|
8746
|
+
if (content.config !== void 0) {
|
|
8747
|
+
const config2 = content.config;
|
|
8748
|
+
if (!object6(config2)) deny();
|
|
8749
|
+
const allowed = ["description", "model", "thinking", "context", "autocompact"];
|
|
8750
|
+
if (Object.keys(config2).some((key) => !allowed.includes(key))) deny();
|
|
8751
|
+
for (const key of ["description", "thinking"]) if (config2[key] !== void 0 && typeof config2[key] !== "string") deny();
|
|
8752
|
+
if (config2.model !== void 0 && (typeof config2.model !== "string" || !/^(codex|claude):[^\s/\\:]{1,240}$/.test(config2.model))) deny();
|
|
8753
|
+
for (const key of ["context", "autocompact"]) if (config2[key] !== void 0 && !(typeof config2[key] === "string" || typeof config2[key] === "number" && Number.isFinite(config2[key]))) deny();
|
|
8754
|
+
}
|
|
8755
|
+
}
|
|
8756
|
+
async function projectDataEntry(kind, name, { scope, root, library, templates: templates2 }) {
|
|
8757
|
+
if (scope !== "project" || !root || !["agents", "skills"].includes(kind)) fail3("UNSAFE_LIBRARY_WRITE", "Project-data writes require project scope and agents or skills");
|
|
8758
|
+
nameOf(name);
|
|
8759
|
+
const directory = base(scope, { root, library }, kind);
|
|
8760
|
+
await safeEntryPaths(directory, kind, name);
|
|
8761
|
+
const found = await layers(kind, name, { root, library, templates: templates2 });
|
|
8762
|
+
if (found.library !== void 0 || found.builtin !== void 0) fail3("UNSAFE_LIBRARY_WRITE", "Project-data writes cannot shadow or reveal a library or built-in entry");
|
|
8763
|
+
if (found.project !== void 0) assertProjectDataContent(kind, found.project);
|
|
8764
|
+
const owned = path8.join(directory, kind, name);
|
|
8765
|
+
const files = await readdir4(owned).catch((error51) => {
|
|
8766
|
+
if (error51.code === "ENOENT") return [];
|
|
8767
|
+
throw error51;
|
|
8768
|
+
});
|
|
8769
|
+
const allowed = new Set(FILES[kind](name).map(([file2]) => path8.basename(file2)));
|
|
8770
|
+
for (const file2 of files) {
|
|
8771
|
+
const info = await lstat3(path8.join(owned, file2));
|
|
8772
|
+
if (!allowed.has(file2) || !info.isFile() || info.isSymbolicLink() || info.nlink !== 1) fail3("UNSAFE_LIBRARY_WRITE", "Project-data entries cannot contain sidecars, links or executable assets");
|
|
8773
|
+
}
|
|
8774
|
+
}
|
|
8739
8775
|
async function safeEntryPaths(directory, kind, name) {
|
|
8740
8776
|
for (const [file2] of FILES[kind](name)) {
|
|
8741
8777
|
await assertNoSymlinks(directory, path8.join(kind, file2));
|
|
@@ -8933,9 +8969,13 @@ async function writeAtomic(file2, text) {
|
|
|
8933
8969
|
await moveFile(temporary, file2);
|
|
8934
8970
|
}
|
|
8935
8971
|
var exists = (target) => stat2(target).then(() => true, () => false);
|
|
8936
|
-
async function saveEntry(kind, name, content, { scope, root, library, templates: templates2, revision } = {}) {
|
|
8972
|
+
async function saveEntry(kind, name, content, { scope, root, library, templates: templates2, revision, policy } = {}) {
|
|
8937
8973
|
kindOf(kind);
|
|
8938
8974
|
nameOf(name);
|
|
8975
|
+
if (policy === "project-data") {
|
|
8976
|
+
assertProjectDataContent(kind, content);
|
|
8977
|
+
await projectDataEntry(kind, name, { scope, root, library, templates: templates2 });
|
|
8978
|
+
}
|
|
8939
8979
|
const directory = base(scope, { root, library }, kind);
|
|
8940
8980
|
await safeEntryPaths(directory, kind, name);
|
|
8941
8981
|
await check(kind, name, content, { scope, root, library, templates: templates2 });
|
|
@@ -8957,9 +8997,10 @@ async function saveEntry(kind, name, content, { scope, root, library, templates:
|
|
|
8957
8997
|
}
|
|
8958
8998
|
return { revision: revisionOf(await readLayer(kind, name, directory)) };
|
|
8959
8999
|
}
|
|
8960
|
-
async function deleteEntry(kind, name, { scope, root, library, templates: templates2, revision } = {}) {
|
|
9000
|
+
async function deleteEntry(kind, name, { scope, root, library, templates: templates2, revision, policy } = {}) {
|
|
8961
9001
|
kindOf(kind);
|
|
8962
9002
|
nameOf(name);
|
|
9003
|
+
if (policy === "project-data") await projectDataEntry(kind, name, { scope, root, library, templates: templates2 });
|
|
8963
9004
|
const directory = base(scope, { root, library }, kind);
|
|
8964
9005
|
const current = await readLayer(kind, name, directory);
|
|
8965
9006
|
if (current === void 0) fail3("NOT_FOUND", `No ${kind} entry '${name}' in the ${scope}`);
|
|
@@ -8975,14 +9016,25 @@ async function deleteEntry(kind, name, { scope, root, library, templates: templa
|
|
|
8975
9016
|
const now = scope === "project" && found.library !== void 0 ? "library" : "builtin";
|
|
8976
9017
|
return { removed: true, ...fallback !== void 0 ? { now } : {} };
|
|
8977
9018
|
}
|
|
8978
|
-
async function duplicateEntry(kind, from, to, { scope, root, library, templates: templates2 } = {}) {
|
|
9019
|
+
async function duplicateEntry(kind, from, to, { scope, root, library, templates: templates2, policy } = {}) {
|
|
9020
|
+
kindOf(kind);
|
|
9021
|
+
nameOf(from);
|
|
9022
|
+
nameOf(to);
|
|
9023
|
+
if (policy === "project-data") {
|
|
9024
|
+
await projectDataEntry(kind, from, { scope, root, library, templates: templates2 });
|
|
9025
|
+
await projectDataEntry(kind, to, { scope, root, library, templates: templates2 });
|
|
9026
|
+
}
|
|
8979
9027
|
const { content } = await getEntry(kind, from, { root, library, templates: templates2 });
|
|
8980
|
-
return saveEntry(kind, to, structuredClone(content), { scope, root, library, templates: templates2, revision: null });
|
|
9028
|
+
return saveEntry(kind, to, structuredClone(content), { scope, root, library, templates: templates2, revision: null, policy });
|
|
8981
9029
|
}
|
|
8982
|
-
async function renameEntry(kind, from, to, { scope, root, library, templates: templates2 } = {}) {
|
|
9030
|
+
async function renameEntry(kind, from, to, { scope, root, library, templates: templates2, policy } = {}) {
|
|
8983
9031
|
kindOf(kind);
|
|
8984
9032
|
nameOf(from);
|
|
8985
9033
|
nameOf(to);
|
|
9034
|
+
if (policy === "project-data") {
|
|
9035
|
+
await projectDataEntry(kind, from, { scope, root, library, templates: templates2 });
|
|
9036
|
+
await projectDataEntry(kind, to, { scope, root, library, templates: templates2 });
|
|
9037
|
+
}
|
|
8986
9038
|
const directory = base(scope, { root, library }, kind);
|
|
8987
9039
|
const content = await readLayer(kind, from, directory);
|
|
8988
9040
|
if (content === void 0) fail3("NOT_FOUND", `No ${kind} entry '${from}' in the ${scope}`);
|
|
@@ -9477,7 +9529,7 @@ var TAIL_BYTES = 256 * 1024;
|
|
|
9477
9529
|
var MAX_FRAME = 16 * 1024 * 1024;
|
|
9478
9530
|
var ERROR = Object.freeze({ failed: 1e3, notFound: 1001, forbidden: 1003, conflict: 1004, unavailable: 1005, protocol: 1006 });
|
|
9479
9531
|
var RPC_ERROR = Object.freeze({ parseError: -32700, invalidRequest: -32600, methodNotFound: -32601, invalidParams: -32602 });
|
|
9480
|
-
var CAPABILITY = Object.freeze({ attachAfter: "attach.after", promptReceipts: "prompt.receipts", extensionMethods: "extension.methods", team: "team", task: "task", library: "library", settingsLanguage: "settings.language", sessionListPage: "session.list.page", questionWatch: "question.watch", questionWatchTurns: "question.watch.turns", workspaceFiles: "workspace.files", workspaceFilesRead: "workspace.files.read", promptImages: "prompt.images" });
|
|
9532
|
+
var CAPABILITY = Object.freeze({ attachAfter: "attach.after", promptReceipts: "prompt.receipts", extensionMethods: "extension.methods", team: "team", task: "task", library: "library", libraryProjectWrite: "library.project.write", settingsLanguage: "settings.language", sessionListPage: "session.list.page", questionWatch: "question.watch", questionWatchTurns: "question.watch.turns", workspaceFiles: "workspace.files", workspaceFilesRead: "workspace.files.read", promptImages: "prompt.images" });
|
|
9481
9533
|
var PROMPT_IMAGES = Object.freeze({ mimeTypes: Object.freeze(["image/png", "image/jpeg", "image/gif", "image/webp"]), maxCount: 8, maxBytes: 5 * 1024 * 1024, maxTotalBytes: 11 * 1024 * 1024 });
|
|
9482
9534
|
var RPC_METHODS = Object.freeze(["assignment.recall", "board.list", "catalog.get", "daemon.hello", "daemon.pause", "daemon.pauses", "daemon.resume", "daemon.shutdown", "daemon.status", "daemon.usage", "extension.register", "extension.unregister", "library.delete", "library.duplicate", "library.get", "library.list", "library.models", "library.rename", "library.save", "library.skills.set", "question.answer", "question.list", "question.watch", "session.archive", "session.attach", "session.close", "session.configure", "session.create", "session.get", "session.interrupt", "session.list", "session.log", "session.message", "session.preview", "session.prompt", "session.release", "session.rename", "session.status", "settings.language.get", "settings.language.set", "task.create", "task.gate.resolve", "task.list", "task.update", "team.list", "workspace.files.list", "workspace.files.read", "workspace.files.search"]);
|
|
9483
9535
|
var WORKSPACE_FILES = Object.freeze({ maxReadBytes: 1024 * 1024, maxListEntries: 1e3, maxPathLength: 4096 });
|
|
@@ -24132,12 +24184,14 @@ var toolShapes = {
|
|
|
24132
24184
|
body: external_exports.string().min(1).max(2e4),
|
|
24133
24185
|
roles: external_exports.array(external_exports.string().min(1)).min(1).max(10),
|
|
24134
24186
|
lessons: external_exports.array(external_exports.string().min(1).max(600)).max(50).optional(),
|
|
24135
|
-
replace: external_exports.boolean().optional()
|
|
24187
|
+
replace: external_exports.boolean().optional(),
|
|
24188
|
+
requestId: external_exports.string().min(1).max(100).optional()
|
|
24136
24189
|
},
|
|
24137
24190
|
alp_issue: {
|
|
24138
24191
|
action: external_exports.enum(["search", "create", "comment"]),
|
|
24139
24192
|
target: external_exports.enum(["project", "alp"]),
|
|
24140
24193
|
query: external_exports.string().min(1).max(200).optional(),
|
|
24194
|
+
requestId: external_exports.string().min(1).max(100).optional(),
|
|
24141
24195
|
title: external_exports.string().min(1).max(200).optional(),
|
|
24142
24196
|
body: external_exports.string().min(1).max(2e4).optional(),
|
|
24143
24197
|
issue: external_exports.number().int().positive().optional(),
|
|
@@ -26275,7 +26329,9 @@ var libraryGet = defineRpc2({
|
|
|
26275
26329
|
revision: external_exports.string().nullable(),
|
|
26276
26330
|
usedBy: external_exports.array(external_exports.string()),
|
|
26277
26331
|
/** Agents: the skills the library gives it by name (role-skills.json). */
|
|
26278
|
-
librarySkills: external_exports.array(external_exports.string()).optional()
|
|
26332
|
+
librarySkills: external_exports.array(external_exports.string()).optional(),
|
|
26333
|
+
/** ALP remote mode: JSON Pointers of the values `content` holds as a secret marker, not as the value. */
|
|
26334
|
+
secrets: external_exports.array(external_exports.string()).optional()
|
|
26279
26335
|
})
|
|
26280
26336
|
});
|
|
26281
26337
|
var librarySkills2 = defineRpc2({
|
|
@@ -7927,7 +7927,7 @@ var TAIL_BYTES = 256 * 1024;
|
|
|
7927
7927
|
var MAX_FRAME = 16 * 1024 * 1024;
|
|
7928
7928
|
var ERROR = Object.freeze({ failed: 1e3, notFound: 1001, forbidden: 1003, conflict: 1004, unavailable: 1005, protocol: 1006 });
|
|
7929
7929
|
var RPC_ERROR = Object.freeze({ parseError: -32700, invalidRequest: -32600, methodNotFound: -32601, invalidParams: -32602 });
|
|
7930
|
-
var CAPABILITY = Object.freeze({ attachAfter: "attach.after", promptReceipts: "prompt.receipts", extensionMethods: "extension.methods", team: "team", task: "task", library: "library", settingsLanguage: "settings.language", sessionListPage: "session.list.page", questionWatch: "question.watch", questionWatchTurns: "question.watch.turns", workspaceFiles: "workspace.files", workspaceFilesRead: "workspace.files.read", promptImages: "prompt.images" });
|
|
7930
|
+
var CAPABILITY = Object.freeze({ attachAfter: "attach.after", promptReceipts: "prompt.receipts", extensionMethods: "extension.methods", team: "team", task: "task", library: "library", libraryProjectWrite: "library.project.write", settingsLanguage: "settings.language", sessionListPage: "session.list.page", questionWatch: "question.watch", questionWatchTurns: "question.watch.turns", workspaceFiles: "workspace.files", workspaceFilesRead: "workspace.files.read", promptImages: "prompt.images" });
|
|
7931
7931
|
var PROMPT_IMAGES = Object.freeze({ mimeTypes: Object.freeze(["image/png", "image/jpeg", "image/gif", "image/webp"]), maxCount: 8, maxBytes: 5 * 1024 * 1024, maxTotalBytes: 11 * 1024 * 1024 });
|
|
7932
7932
|
var RPC_METHODS = Object.freeze(["assignment.recall", "board.list", "catalog.get", "daemon.hello", "daemon.pause", "daemon.pauses", "daemon.resume", "daemon.shutdown", "daemon.status", "daemon.usage", "extension.register", "extension.unregister", "library.delete", "library.duplicate", "library.get", "library.list", "library.models", "library.rename", "library.save", "library.skills.set", "question.answer", "question.list", "question.watch", "session.archive", "session.attach", "session.close", "session.configure", "session.create", "session.get", "session.interrupt", "session.list", "session.log", "session.message", "session.preview", "session.prompt", "session.release", "session.rename", "session.status", "settings.language.get", "settings.language.set", "task.create", "task.gate.resolve", "task.list", "task.update", "team.list", "workspace.files.list", "workspace.files.read", "workspace.files.search"]);
|
|
7933
7933
|
var WORKSPACE_FILES = Object.freeze({ maxReadBytes: 1024 * 1024, maxListEntries: 1e3, maxPathLength: 4096 });
|
|
@@ -22721,12 +22721,14 @@ var toolShapes = {
|
|
|
22721
22721
|
body: external_exports.string().min(1).max(2e4),
|
|
22722
22722
|
roles: external_exports.array(external_exports.string().min(1)).min(1).max(10),
|
|
22723
22723
|
lessons: external_exports.array(external_exports.string().min(1).max(600)).max(50).optional(),
|
|
22724
|
-
replace: external_exports.boolean().optional()
|
|
22724
|
+
replace: external_exports.boolean().optional(),
|
|
22725
|
+
requestId: external_exports.string().min(1).max(100).optional()
|
|
22725
22726
|
},
|
|
22726
22727
|
alp_issue: {
|
|
22727
22728
|
action: external_exports.enum(["search", "create", "comment"]),
|
|
22728
22729
|
target: external_exports.enum(["project", "alp"]),
|
|
22729
22730
|
query: external_exports.string().min(1).max(200).optional(),
|
|
22731
|
+
requestId: external_exports.string().min(1).max(100).optional(),
|
|
22730
22732
|
title: external_exports.string().min(1).max(200).optional(),
|
|
22731
22733
|
body: external_exports.string().min(1).max(2e4).optional(),
|
|
22732
22734
|
issue: external_exports.number().int().positive().optional(),
|
|
@@ -529,7 +529,7 @@ var TAIL_BYTES = 256 * 1024;
|
|
|
529
529
|
var MAX_FRAME = 16 * 1024 * 1024;
|
|
530
530
|
var ERROR = Object.freeze({ failed: 1e3, notFound: 1001, forbidden: 1003, conflict: 1004, unavailable: 1005, protocol: 1006 });
|
|
531
531
|
var RPC_ERROR = Object.freeze({ parseError: -32700, invalidRequest: -32600, methodNotFound: -32601, invalidParams: -32602 });
|
|
532
|
-
var CAPABILITY = Object.freeze({ attachAfter: "attach.after", promptReceipts: "prompt.receipts", extensionMethods: "extension.methods", team: "team", task: "task", library: "library", settingsLanguage: "settings.language", sessionListPage: "session.list.page", questionWatch: "question.watch", questionWatchTurns: "question.watch.turns", workspaceFiles: "workspace.files", workspaceFilesRead: "workspace.files.read", promptImages: "prompt.images" });
|
|
532
|
+
var CAPABILITY = Object.freeze({ attachAfter: "attach.after", promptReceipts: "prompt.receipts", extensionMethods: "extension.methods", team: "team", task: "task", library: "library", libraryProjectWrite: "library.project.write", settingsLanguage: "settings.language", sessionListPage: "session.list.page", questionWatch: "question.watch", questionWatchTurns: "question.watch.turns", workspaceFiles: "workspace.files", workspaceFilesRead: "workspace.files.read", promptImages: "prompt.images" });
|
|
533
533
|
var PROMPT_IMAGES = Object.freeze({ mimeTypes: Object.freeze(["image/png", "image/jpeg", "image/gif", "image/webp"]), maxCount: 8, maxBytes: 5 * 1024 * 1024, maxTotalBytes: 11 * 1024 * 1024 });
|
|
534
534
|
var RPC_METHODS = Object.freeze(["assignment.recall", "board.list", "catalog.get", "daemon.hello", "daemon.pause", "daemon.pauses", "daemon.resume", "daemon.shutdown", "daemon.status", "daemon.usage", "extension.register", "extension.unregister", "library.delete", "library.duplicate", "library.get", "library.list", "library.models", "library.rename", "library.save", "library.skills.set", "question.answer", "question.list", "question.watch", "session.archive", "session.attach", "session.close", "session.configure", "session.create", "session.get", "session.interrupt", "session.list", "session.log", "session.message", "session.preview", "session.prompt", "session.release", "session.rename", "session.status", "settings.language.get", "settings.language.set", "task.create", "task.gate.resolve", "task.list", "task.update", "team.list", "workspace.files.list", "workspace.files.read", "workspace.files.search"]);
|
|
535
535
|
var WORKSPACE_FILES = Object.freeze({ maxReadBytes: 1024 * 1024, maxListEntries: 1e3, maxPathLength: 4096 });
|
|
@@ -6,8 +6,8 @@ var __export = (target, all) => {
|
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
// packages/client/src/index.js
|
|
9
|
-
import { createHash } from "node:crypto";
|
|
10
|
-
import { open, readFile, realpath, stat, lstat, mkdir, readlink, unlink } from "node:fs/promises";
|
|
9
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
10
|
+
import { open, readFile, writeFile, realpath, stat, lstat, mkdir, readlink, unlink, readdir, rename, rmdir, link } from "node:fs/promises";
|
|
11
11
|
import net from "node:net";
|
|
12
12
|
import os from "node:os";
|
|
13
13
|
import path from "node:path";
|
|
@@ -45,7 +45,7 @@ var AlpRpcError = class extends Error {
|
|
|
45
45
|
};
|
|
46
46
|
var ERROR = Object.freeze({ failed: 1e3, notFound: 1001, forbidden: 1003, conflict: 1004, unavailable: 1005, protocol: 1006 });
|
|
47
47
|
var RPC_ERROR = Object.freeze({ parseError: -32700, invalidRequest: -32600, methodNotFound: -32601, invalidParams: -32602 });
|
|
48
|
-
var CAPABILITY = Object.freeze({ attachAfter: "attach.after", promptReceipts: "prompt.receipts", extensionMethods: "extension.methods", team: "team", task: "task", library: "library", settingsLanguage: "settings.language", sessionListPage: "session.list.page", questionWatch: "question.watch", questionWatchTurns: "question.watch.turns", workspaceFiles: "workspace.files", workspaceFilesRead: "workspace.files.read", promptImages: "prompt.images" });
|
|
48
|
+
var CAPABILITY = Object.freeze({ attachAfter: "attach.after", promptReceipts: "prompt.receipts", extensionMethods: "extension.methods", team: "team", task: "task", library: "library", libraryProjectWrite: "library.project.write", settingsLanguage: "settings.language", sessionListPage: "session.list.page", questionWatch: "question.watch", questionWatchTurns: "question.watch.turns", workspaceFiles: "workspace.files", workspaceFilesRead: "workspace.files.read", promptImages: "prompt.images" });
|
|
49
49
|
var PROMPT_IMAGES = Object.freeze({ mimeTypes: Object.freeze(["image/png", "image/jpeg", "image/gif", "image/webp"]), maxCount: 8, maxBytes: 5 * 1024 * 1024, maxTotalBytes: 11 * 1024 * 1024 });
|
|
50
50
|
var RPC_METHODS = Object.freeze(["assignment.recall", "board.list", "catalog.get", "daemon.hello", "daemon.pause", "daemon.pauses", "daemon.resume", "daemon.shutdown", "daemon.status", "daemon.usage", "extension.register", "extension.unregister", "library.delete", "library.duplicate", "library.get", "library.list", "library.models", "library.rename", "library.save", "library.skills.set", "question.answer", "question.list", "question.watch", "session.archive", "session.attach", "session.close", "session.configure", "session.create", "session.get", "session.interrupt", "session.list", "session.log", "session.message", "session.preview", "session.prompt", "session.release", "session.rename", "session.status", "settings.language.get", "settings.language.set", "task.create", "task.gate.resolve", "task.list", "task.update", "team.list", "workspace.files.list", "workspace.files.read", "workspace.files.search"]);
|
|
51
51
|
var WORKSPACE_FILES = Object.freeze({ maxReadBytes: 1024 * 1024, maxListEntries: 1e3, maxPathLength: 4096 });
|
|
@@ -7803,7 +7803,7 @@ var require_content_type = __commonJS({
|
|
|
7803
7803
|
});
|
|
7804
7804
|
|
|
7805
7805
|
// integrations/paseo/server/paseo/agents.ts
|
|
7806
|
-
import { randomUUID as
|
|
7806
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
7807
7807
|
import path4 from "node:path";
|
|
7808
7808
|
|
|
7809
7809
|
// packages/core/src/teams.js
|
|
@@ -8212,7 +8212,7 @@ var AlpRpcError = class extends Error {
|
|
|
8212
8212
|
};
|
|
8213
8213
|
var ERROR = Object.freeze({ failed: 1e3, notFound: 1001, forbidden: 1003, conflict: 1004, unavailable: 1005, protocol: 1006 });
|
|
8214
8214
|
var RPC_ERROR = Object.freeze({ parseError: -32700, invalidRequest: -32600, methodNotFound: -32601, invalidParams: -32602 });
|
|
8215
|
-
var CAPABILITY = Object.freeze({ attachAfter: "attach.after", promptReceipts: "prompt.receipts", extensionMethods: "extension.methods", team: "team", task: "task", library: "library", settingsLanguage: "settings.language", sessionListPage: "session.list.page", questionWatch: "question.watch", questionWatchTurns: "question.watch.turns", workspaceFiles: "workspace.files", workspaceFilesRead: "workspace.files.read", promptImages: "prompt.images" });
|
|
8215
|
+
var CAPABILITY = Object.freeze({ attachAfter: "attach.after", promptReceipts: "prompt.receipts", extensionMethods: "extension.methods", team: "team", task: "task", library: "library", libraryProjectWrite: "library.project.write", settingsLanguage: "settings.language", sessionListPage: "session.list.page", questionWatch: "question.watch", questionWatchTurns: "question.watch.turns", workspaceFiles: "workspace.files", workspaceFilesRead: "workspace.files.read", promptImages: "prompt.images" });
|
|
8216
8216
|
var PROMPT_IMAGES = Object.freeze({ mimeTypes: Object.freeze(["image/png", "image/jpeg", "image/gif", "image/webp"]), maxCount: 8, maxBytes: 5 * 1024 * 1024, maxTotalBytes: 11 * 1024 * 1024 });
|
|
8217
8217
|
var RPC_METHODS = Object.freeze(["assignment.recall", "board.list", "catalog.get", "daemon.hello", "daemon.pause", "daemon.pauses", "daemon.resume", "daemon.shutdown", "daemon.status", "daemon.usage", "extension.register", "extension.unregister", "library.delete", "library.duplicate", "library.get", "library.list", "library.models", "library.rename", "library.save", "library.skills.set", "question.answer", "question.list", "question.watch", "session.archive", "session.attach", "session.close", "session.configure", "session.create", "session.get", "session.interrupt", "session.list", "session.log", "session.message", "session.preview", "session.prompt", "session.release", "session.rename", "session.status", "settings.language.get", "settings.language.set", "task.create", "task.gate.resolve", "task.list", "task.update", "team.list", "workspace.files.list", "workspace.files.read", "workspace.files.search"]);
|
|
8218
8218
|
var WORKSPACE_FILES = Object.freeze({ maxReadBytes: 1024 * 1024, maxListEntries: 1e3, maxPathLength: 4096 });
|
|
@@ -22800,12 +22800,14 @@ var toolShapes = {
|
|
|
22800
22800
|
body: external_exports.string().min(1).max(2e4),
|
|
22801
22801
|
roles: external_exports.array(external_exports.string().min(1)).min(1).max(10),
|
|
22802
22802
|
lessons: external_exports.array(external_exports.string().min(1).max(600)).max(50).optional(),
|
|
22803
|
-
replace: external_exports.boolean().optional()
|
|
22803
|
+
replace: external_exports.boolean().optional(),
|
|
22804
|
+
requestId: external_exports.string().min(1).max(100).optional()
|
|
22804
22805
|
},
|
|
22805
22806
|
alp_issue: {
|
|
22806
22807
|
action: external_exports.enum(["search", "create", "comment"]),
|
|
22807
22808
|
target: external_exports.enum(["project", "alp"]),
|
|
22808
22809
|
query: external_exports.string().min(1).max(200).optional(),
|
|
22810
|
+
requestId: external_exports.string().min(1).max(100).optional(),
|
|
22809
22811
|
title: external_exports.string().min(1).max(200).optional(),
|
|
22810
22812
|
body: external_exports.string().min(1).max(2e4).optional(),
|
|
22811
22813
|
issue: external_exports.number().int().positive().optional(),
|
|
@@ -24827,8 +24829,8 @@ var RESTART_WINDOW_MS = 10 * 6e4;
|
|
|
24827
24829
|
var log = createLogger({ component: "runtime" });
|
|
24828
24830
|
|
|
24829
24831
|
// packages/client/src/index.js
|
|
24830
|
-
import { createHash } from "node:crypto";
|
|
24831
|
-
import { open, readFile as readFile2, realpath, stat as stat2, lstat, mkdir, readlink, unlink } from "node:fs/promises";
|
|
24832
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
24833
|
+
import { open, readFile as readFile2, writeFile, realpath, stat as stat2, lstat, mkdir, readlink, unlink, readdir as readdir3, rename, rmdir, link } from "node:fs/promises";
|
|
24832
24834
|
import net from "node:net";
|
|
24833
24835
|
import os from "node:os";
|
|
24834
24836
|
import path3 from "node:path";
|
|
@@ -25465,7 +25467,7 @@ var TimelineDeltas = class {
|
|
|
25465
25467
|
};
|
|
25466
25468
|
|
|
25467
25469
|
// integrations/paseo/server/paseo/timeline-store.ts
|
|
25468
|
-
import { randomUUID } from "node:crypto";
|
|
25470
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
25469
25471
|
|
|
25470
25472
|
// node_modules/@getpaseo/protocol/dist/timeline-identity.js
|
|
25471
25473
|
function timelineItemIdentity(item) {
|
|
@@ -25870,7 +25872,7 @@ var InMemoryAgentTimelineStore = class {
|
|
|
25870
25872
|
const projection = new TimelineProjection();
|
|
25871
25873
|
for (const row of rows) projection.append(row);
|
|
25872
25874
|
this.states.set(agentId, {
|
|
25873
|
-
epoch: options2?.epoch ??
|
|
25875
|
+
epoch: options2?.epoch ?? randomUUID2(),
|
|
25874
25876
|
projection,
|
|
25875
25877
|
minSeq: projection.getRows()[0]?.seqStart ?? 0,
|
|
25876
25878
|
nextSeq
|
|
@@ -25973,6 +25975,17 @@ var InMemoryAgentTimelineStore = class {
|
|
|
25973
25975
|
}
|
|
25974
25976
|
};
|
|
25975
25977
|
|
|
25978
|
+
// integrations/paseo/server/session-usage.ts
|
|
25979
|
+
var USAGE_FIELDS = ["inputTokens", "cachedInputTokens", "outputTokens", "totalCostUsd", "contextWindowMaxTokens", "contextWindowUsedTokens"];
|
|
25980
|
+
function agentUsage(usage) {
|
|
25981
|
+
const out = {};
|
|
25982
|
+
for (const key of USAGE_FIELDS) {
|
|
25983
|
+
const value = usage?.[key];
|
|
25984
|
+
if (typeof value === "number" && Number.isFinite(value)) out[key] = value;
|
|
25985
|
+
}
|
|
25986
|
+
return out;
|
|
25987
|
+
}
|
|
25988
|
+
|
|
25976
25989
|
// integrations/paseo/server/paseo/agents.ts
|
|
25977
25990
|
var PROVIDER = "alp";
|
|
25978
25991
|
var POLL_MS = 2e3;
|
|
@@ -26098,6 +26111,8 @@ function createAgents({ clientFactory, home, broadcast, directory, log: log2 = (
|
|
|
26098
26111
|
pendingPermissions: [...questions.values()].filter((question) => question.rootId === session.id).map(permissionOf),
|
|
26099
26112
|
persistence: session.persistent ? { provider: PROVIDER, sessionId: session.id } : null,
|
|
26100
26113
|
runtimeInfo: { provider: PROVIDER, sessionId: session.id, model: `${session.runtime}:${session.model}`, modeId: session.mode },
|
|
26114
|
+
// Paseo's context meter reads the agent's last usage.
|
|
26115
|
+
...session.usage ? { lastUsage: agentUsage(session.usage) } : {},
|
|
26101
26116
|
...session.lastError ? { lastError: session.lastError.message } : {},
|
|
26102
26117
|
title: session.title ?? null,
|
|
26103
26118
|
labels: {},
|
|
@@ -26160,8 +26175,7 @@ function createAgents({ clientFactory, home, broadcast, directory, log: log2 = (
|
|
|
26160
26175
|
});
|
|
26161
26176
|
}
|
|
26162
26177
|
for (const id of [...roots.keys()]) if (!seen.has(id)) {
|
|
26163
|
-
|
|
26164
|
-
epochs.delete(id);
|
|
26178
|
+
forget(id);
|
|
26165
26179
|
broadcast({ type: "agent_update", payload: { kind: "remove", agentId: id } });
|
|
26166
26180
|
directory.changed();
|
|
26167
26181
|
}
|
|
@@ -26276,8 +26290,10 @@ function createAgents({ clientFactory, home, broadcast, directory, log: log2 = (
|
|
|
26276
26290
|
break;
|
|
26277
26291
|
case "turn.ended": {
|
|
26278
26292
|
turns.delete(root);
|
|
26279
|
-
if (event.state === "completed")
|
|
26280
|
-
|
|
26293
|
+
if (event.state === "completed") {
|
|
26294
|
+
const usage = roots.get(root)?.usage;
|
|
26295
|
+
stream(root, { type: "turn_completed", provider: PROVIDER, turnId: event.turnId, ...usage ? { usage: agentUsage(usage) } : {} }, envelope.ts);
|
|
26296
|
+
} else if (event.state === "canceled") stream(root, { type: "turn_canceled", provider: PROVIDER, turnId: event.turnId, reason: event.error?.message ?? "Stopped" }, envelope.ts);
|
|
26281
26297
|
else stream(root, { type: "turn_failed", provider: PROVIDER, turnId: event.turnId, error: event.error?.message ?? "The turn failed" }, envelope.ts);
|
|
26282
26298
|
if (!replaying.has(root) && event.state !== "canceled") {
|
|
26283
26299
|
const reason = event.state === "completed" ? "finished" : "error";
|
|
@@ -26286,6 +26302,13 @@ function createAgents({ clientFactory, home, broadcast, directory, log: log2 = (
|
|
|
26286
26302
|
}
|
|
26287
26303
|
break;
|
|
26288
26304
|
}
|
|
26305
|
+
case "usage": {
|
|
26306
|
+
if (replaying.has(root) || !session) return;
|
|
26307
|
+
const next = { ...session, usage: event.usage };
|
|
26308
|
+
roots.set(root, next);
|
|
26309
|
+
upsert(next);
|
|
26310
|
+
return;
|
|
26311
|
+
}
|
|
26289
26312
|
case "session.opened":
|
|
26290
26313
|
case "session.updated":
|
|
26291
26314
|
case "session.closed":
|
|
@@ -26301,19 +26324,24 @@ function createAgents({ clientFactory, home, broadcast, directory, log: log2 = (
|
|
|
26301
26324
|
if (timelines.has(root)) return Promise.resolve();
|
|
26302
26325
|
let pending = attaching.get(root);
|
|
26303
26326
|
if (!pending) {
|
|
26327
|
+
const connection = alp;
|
|
26328
|
+
if (!connection) return Promise.reject(new Error("ALP daemon is not connected"));
|
|
26304
26329
|
pending = (async () => {
|
|
26305
26330
|
timelines.initialize(root);
|
|
26306
26331
|
deltas.set(root, new TimelineDeltas());
|
|
26307
26332
|
epochs.delete(root);
|
|
26308
26333
|
replaying.add(root);
|
|
26334
|
+
const current = () => attaching.get(root) === pending;
|
|
26309
26335
|
try {
|
|
26310
|
-
await
|
|
26336
|
+
await connection.request("session.attach", { sessionId: root, replay: true });
|
|
26311
26337
|
} catch (error51) {
|
|
26312
|
-
timelines.delete(root);
|
|
26338
|
+
if (current()) timelines.delete(root);
|
|
26313
26339
|
throw error51;
|
|
26314
26340
|
} finally {
|
|
26315
|
-
|
|
26316
|
-
|
|
26341
|
+
if (current()) {
|
|
26342
|
+
replaying.delete(root);
|
|
26343
|
+
attaching.delete(root);
|
|
26344
|
+
}
|
|
26317
26345
|
}
|
|
26318
26346
|
})();
|
|
26319
26347
|
attaching.set(root, pending);
|
|
@@ -26334,6 +26362,22 @@ function createAgents({ clientFactory, home, broadcast, directory, log: log2 = (
|
|
|
26334
26362
|
}
|
|
26335
26363
|
void ensureTimeline(root).catch((error51) => log2(`agents reattach failed: ${error51?.message ?? error51}`));
|
|
26336
26364
|
}
|
|
26365
|
+
function forget(root) {
|
|
26366
|
+
roots.delete(root);
|
|
26367
|
+
timelines.delete(root);
|
|
26368
|
+
deltas.delete(root);
|
|
26369
|
+
attaching.delete(root);
|
|
26370
|
+
replaying.delete(root);
|
|
26371
|
+
epochs.delete(root);
|
|
26372
|
+
turns.delete(root);
|
|
26373
|
+
attention.delete(root);
|
|
26374
|
+
for (const child of [...children.values()]) {
|
|
26375
|
+
if (child.root !== root) continue;
|
|
26376
|
+
children.delete(child.id);
|
|
26377
|
+
childTimelines.delete(child.id);
|
|
26378
|
+
childDeltas.delete(child.id);
|
|
26379
|
+
}
|
|
26380
|
+
}
|
|
26337
26381
|
function known(agentId) {
|
|
26338
26382
|
const session = roots.get(agentId);
|
|
26339
26383
|
if (!session) throw Object.assign(new Error(`No agent ${agentId}`), { code: "agent_not_found" });
|
|
@@ -26351,14 +26395,14 @@ function createAgents({ clientFactory, home, broadcast, directory, log: log2 = (
|
|
|
26351
26395
|
async function create(input) {
|
|
26352
26396
|
const { config: config2 } = input;
|
|
26353
26397
|
if (config2.provider !== PROVIDER) throw new Error(`ALP runs its own teams; ${config2.provider} is not one of them`);
|
|
26354
|
-
const sessionId = `web-${
|
|
26398
|
+
const sessionId = `web-${randomUUID3()}`;
|
|
26355
26399
|
if (input.workspaceId) directory.assign(sessionId, input.workspaceId);
|
|
26356
26400
|
await alp.request("session.create", { sessionId, spec: { cwd: config2.cwd, persist: true, ...config2.model ? { workflow: config2.model } : {}, ...config2.modeId ? { mode: config2.modeId } : {} } });
|
|
26357
26401
|
if (config2.title) await alp.request("session.rename", { sessionId, title: config2.title });
|
|
26358
26402
|
await refresh();
|
|
26359
26403
|
await ensureTimeline(sessionId);
|
|
26360
26404
|
const prompt = input.initialPrompt?.trim();
|
|
26361
|
-
if (prompt) await alp.request("session.prompt", { sessionId, clientMessageId: input.clientMessageId ??
|
|
26405
|
+
if (prompt) await alp.request("session.prompt", { sessionId, clientMessageId: input.clientMessageId ?? randomUUID3(), content: [{ type: "text", text: prompt }] });
|
|
26362
26406
|
return agentOf(known(sessionId));
|
|
26363
26407
|
}
|
|
26364
26408
|
const view = {
|
|
@@ -26540,7 +26584,7 @@ function createAgents({ clientFactory, home, broadcast, directory, log: log2 = (
|
|
|
26540
26584
|
if (running && message.activeTurnBehavior === "interrupt") await alp.request("session.interrupt", { sessionId: session.id });
|
|
26541
26585
|
await alp.request("session.prompt", {
|
|
26542
26586
|
sessionId: session.id,
|
|
26543
|
-
clientMessageId: message.messageId ??
|
|
26587
|
+
clientMessageId: message.messageId ?? randomUUID3(),
|
|
26544
26588
|
delivery: running && message.activeTurnBehavior !== "interrupt" ? "steer" : "auto",
|
|
26545
26589
|
content: [{ type: "text", text: message.text }]
|
|
26546
26590
|
});
|