ycodium-acp-executor 0.2.3130 → 0.2.3168
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 +3 -4
- package/dist/connection.d.ts +10 -2
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +11 -3
- package/dist/connection.js.map +1 -1
- package/dist/executor/lifecycle.d.ts +4 -1
- package/dist/executor/lifecycle.d.ts.map +1 -1
- package/dist/executor/lifecycle.js +37 -23
- package/dist/executor/lifecycle.js.map +1 -1
- package/dist/executor/prompt-results.d.ts +30 -0
- package/dist/executor/prompt-results.d.ts.map +1 -0
- package/dist/executor/prompt-results.js +96 -0
- package/dist/executor/prompt-results.js.map +1 -0
- package/dist/executor/prompt.d.ts +5 -2
- package/dist/executor/prompt.d.ts.map +1 -1
- package/dist/executor/prompt.js +76 -51
- package/dist/executor/prompt.js.map +1 -1
- package/dist/executor/runtime.d.ts.map +1 -1
- package/dist/executor/runtime.js +2 -3
- package/dist/executor/runtime.js.map +1 -1
- package/dist/executor/settlement.d.ts.map +1 -1
- package/dist/executor/settlement.js +6 -1
- package/dist/executor/settlement.js.map +1 -1
- package/dist/executor/support.d.ts +5 -1
- package/dist/executor/support.d.ts.map +1 -1
- package/dist/executor/support.js.map +1 -1
- package/dist/executor.d.ts +3 -1
- package/dist/executor.d.ts.map +1 -1
- package/dist/executor.js +12 -1
- package/dist/executor.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/session-registry.d.ts +9 -0
- package/dist/session-registry.d.ts.map +1 -0
- package/dist/session-registry.js +26 -0
- package/dist/session-registry.js.map +1 -0
- package/dist/sessionProcess.d.ts +11 -0
- package/dist/sessionProcess.d.ts.map +1 -0
- package/dist/sessionProcess.js +24 -0
- package/dist/sessionProcess.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** 关闭期间保留归属;所有关闭入口必须复用同一任务,成功后才能删记录。 */
|
|
2
|
+
export function createAcpSessionRegistry(threads, stopBooked) {
|
|
3
|
+
const requireThread = (threadId) => {
|
|
4
|
+
const booked = threads.get(threadId);
|
|
5
|
+
if (!booked)
|
|
6
|
+
throw new Error(`unknown thread ${threadId}`);
|
|
7
|
+
if (booked.closing)
|
|
8
|
+
throw new Error(`thread ${threadId} is closing`);
|
|
9
|
+
return booked;
|
|
10
|
+
};
|
|
11
|
+
const stopSession = (threadId, booked = threads.get(threadId)) => {
|
|
12
|
+
if (!booked)
|
|
13
|
+
return Promise.resolve();
|
|
14
|
+
// 先认领再执行,关闭回调即使重入也只能拿到这一次任务。
|
|
15
|
+
booked.closing ??= Promise.resolve()
|
|
16
|
+
.then(() => stopBooked(booked))
|
|
17
|
+
.then(() => {
|
|
18
|
+
if (threads.get(threadId) === booked)
|
|
19
|
+
threads.delete(threadId);
|
|
20
|
+
});
|
|
21
|
+
return booked.closing;
|
|
22
|
+
};
|
|
23
|
+
const stopAll = () => Promise.all([...threads].map(([threadId, booked]) => stopSession(threadId, booked))).then(() => undefined);
|
|
24
|
+
return { requireThread, stopSession, stopAll };
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=session-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-registry.js","sourceRoot":"","sources":["../src/session-registry.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,MAAM,UAAU,wBAAwB,CACtC,OAAuB,EACvB,UAAwC;IAExC,MAAM,aAAa,GAAG,CAAC,QAAgB,EAAK,EAAE;QAC5C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACrC,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,QAAQ,EAAE,CAAC,CAAC;QAC3D,IAAI,MAAM,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,UAAU,QAAQ,aAAa,CAAC,CAAC;QACrE,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,CAAC,QAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAiB,EAAE;QACtF,IAAI,CAAC,MAAM;YAAE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;QACtC,6BAA6B;QAC7B,MAAM,CAAC,OAAO,KAAK,OAAO,CAAC,OAAO,EAAE;aACjC,IAAI,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;aAC9B,IAAI,CAAC,GAAG,EAAE;YACT,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,MAAM;gBAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;QACL,OAAO,MAAM,CAAC,OAAO,CAAC;IACxB,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,GAAkB,EAAE,CAClC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CACvF,GAAG,EAAE,CAAC,SAAS,CAChB,CAAC;IAEJ,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 用户停下一轮时(D184),宿主要在插件起的根进程和它的后代里认出「说 ACP 的那个进程」。原生程序装的
|
|
3
|
+
* ACP 手(kimi、grok)没有启动器,会话进程就是宿主起的那个:程序与启动参数逐项相同才认。
|
|
4
|
+
* 这里只给这条判定;哪条工具调用算命令、命令的 shell 长什么样,各家形状不同,由插件自己判。
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* 进程表里的 argv 是不是宿主按 `program` 与 `args` 起的那个进程。`program` 填的是路径就比整条路径,
|
|
8
|
+
* 只是名字就比文件名;Windows 上不分大小写、忽略 `.exe`。
|
|
9
|
+
*/
|
|
10
|
+
export declare function acpNativeSessionProcessMatcher(program: string, args: ReadonlyArray<string>): (argv: ReadonlyArray<string>, platform: string) => boolean;
|
|
11
|
+
//# sourceMappingURL=sessionProcess.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionProcess.d.ts","sourceRoot":"","sources":["../src/sessionProcess.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,GAC1B,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAY5D"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 用户停下一轮时(D184),宿主要在插件起的根进程和它的后代里认出「说 ACP 的那个进程」。原生程序装的
|
|
3
|
+
* ACP 手(kimi、grok)没有启动器,会话进程就是宿主起的那个:程序与启动参数逐项相同才认。
|
|
4
|
+
* 这里只给这条判定;哪条工具调用算命令、命令的 shell 长什么样,各家形状不同,由插件自己判。
|
|
5
|
+
*/
|
|
6
|
+
const fileName = (path) => path.slice(path.lastIndexOf("/") + 1);
|
|
7
|
+
const withoutExe = (name) => name.replace(/\.exe$/, "");
|
|
8
|
+
/**
|
|
9
|
+
* 进程表里的 argv 是不是宿主按 `program` 与 `args` 起的那个进程。`program` 填的是路径就比整条路径,
|
|
10
|
+
* 只是名字就比文件名;Windows 上不分大小写、忽略 `.exe`。
|
|
11
|
+
*/
|
|
12
|
+
export function acpNativeSessionProcessMatcher(program, args) {
|
|
13
|
+
return (argv, platform) => {
|
|
14
|
+
const normalize = (value) => platform === "win32" ? withoutExe(value.replaceAll("\\", "/").toLowerCase()) : value;
|
|
15
|
+
const expected = normalize(program);
|
|
16
|
+
const actual = normalize(argv[0] ?? "");
|
|
17
|
+
const sameProgram = expected.includes("/")
|
|
18
|
+
? actual === expected
|
|
19
|
+
: fileName(actual) === fileName(expected);
|
|
20
|
+
const rest = argv.slice(1);
|
|
21
|
+
return sameProgram && rest.length === args.length && rest.every((arg, i) => arg === args[i]);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=sessionProcess.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionProcess.js","sourceRoot":"","sources":["../src/sessionProcess.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AACzE,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAEhE;;;GAGG;AACH,MAAM,UAAU,8BAA8B,CAC5C,OAAe,EACf,IAA2B;IAE3B,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE;QACxB,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,EAAE,CAClC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QACvF,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;QACpC,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QACxC,MAAM,WAAW,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC;YACxC,CAAC,CAAC,MAAM,KAAK,QAAQ;YACrB,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC5C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC3B,OAAO,WAAW,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/F,CAAC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ycodium-acp-executor",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3168",
|
|
4
4
|
"description": "Agent Client Protocol client and executor state machine for Ycodium agent plugins. Speaks ACP over stdio and emits Ycodium executor events.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"acp",
|