kfc-code-cli 0.0.1-alpha.2 → 0.0.1-alpha.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 +1 -1
- package/dist/main.mjs +2451 -3276
- package/dist/{multipart-parser-CetGDzPt.mjs → multipart-parser-OI2tZKyS.mjs} +1 -1
- package/dist/session-event-bus-Baiz630d.mjs +106 -0
- package/dist/{src-CzEfkVXq.mjs → src-CL9dVeBV.mjs} +2 -2
- package/package.json +3 -1
- package/dist/client-CdbQcqne.mjs +0 -2007
- package/dist/open-KsP3qi4-.mjs +0 -466
- package/dist/stdio-S3GL8wYq.mjs +0 -584
- package/dist/streamableHttp-D_Fc3kFI.mjs +0 -1530
- package/dist/types-CdOcSyeC.mjs +0 -1244
- /package/dist/{dist-CKY8wJId.mjs → dist-CsQLzhCC.mjs} +0 -0
- /package/dist/{from-BNWSEQzV.mjs → from-BG79vaL9.mjs} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { n as __esmMin } from "./chunk-pPjepVcp.mjs";
|
|
3
|
-
import { a as File, i as init_esm_min, n as FormData, t as init_from } from "./from-
|
|
3
|
+
import { a as File, i as init_esm_min, n as FormData, t as init_from } from "./from-BG79vaL9.mjs";
|
|
4
4
|
//#region ../../node_modules/.pnpm/node-fetch@3.3.2/node_modules/node-fetch/src/utils/multipart-parser.js
|
|
5
5
|
function _fileName(headerValue) {
|
|
6
6
|
const m = headerValue.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { r as __exportAll } from "./chunk-pPjepVcp.mjs";
|
|
3
|
+
//#region ../../packages/kimi-core/src/soul-plus/session/session-event-bus.ts
|
|
4
|
+
var session_event_bus_exports = /* @__PURE__ */ __exportAll({ SessionEventBus: () => SessionEventBus });
|
|
5
|
+
var SessionEventBus = class {
|
|
6
|
+
listeners = [];
|
|
7
|
+
notificationListeners = [];
|
|
8
|
+
/**
|
|
9
|
+
* Fire-and-forget publish. There is NO pre-subscribe buffer — events emitted
|
|
10
|
+
* before a listener calls `on()` are permanently lost. Callers that need
|
|
11
|
+
* replay (e.g. MCPManager.loadAll firing before any session is created) must
|
|
12
|
+
* emit a catch-up snapshot after the listener is installed.
|
|
13
|
+
*/
|
|
14
|
+
emit(event) {
|
|
15
|
+
const snapshot = this.listeners.slice();
|
|
16
|
+
for (const listener of snapshot) safeDispatch(listener, event);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Source-tagged fan-out (Phase 6 / 决策 #88 / §4.8.2). The wrapper that
|
|
20
|
+
* sits between a subagent / teammate Soul and this bus calls
|
|
21
|
+
* `emitWithSource` so listeners (UI / wire bridge / telemetry) can
|
|
22
|
+
* attribute every event back to its originating agent.
|
|
23
|
+
*
|
|
24
|
+
* Contract:
|
|
25
|
+
* - Returns `void` (铁律 4 — no back-pressure on Soul).
|
|
26
|
+
* - Does NOT mutate the caller's `event` argument; the envelope is
|
|
27
|
+
* attached on a shallow copy.
|
|
28
|
+
* - `source` is transport-only — never written to wire.jsonl
|
|
29
|
+
* (铁律 5; the sink wrapper persists the bare event through the
|
|
30
|
+
* child JournalWriter, see `createSubagentSinkWrapper`).
|
|
31
|
+
* - Listener errors are isolated by the same `safeDispatch` used by
|
|
32
|
+
* `emit`.
|
|
33
|
+
*/
|
|
34
|
+
emitWithSource(event, source) {
|
|
35
|
+
const tagged = {
|
|
36
|
+
...event,
|
|
37
|
+
source
|
|
38
|
+
};
|
|
39
|
+
const snapshot = this.listeners.slice();
|
|
40
|
+
for (const listener of snapshot) safeDispatch(listener, tagged);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Fan out a notification to all notification subscribers (Slice 2.4).
|
|
44
|
+
* Kept as a dedicated channel rather than folded into `SoulEvent` so
|
|
45
|
+
* the Soul layer stays ignorant of SoulPlus-level concepts
|
|
46
|
+
* (notification is an §5.2.4 SoulPlus concern, not a §5.2.1 Soul one).
|
|
47
|
+
* Listener errors are swallowed with the same safeEmit discipline as
|
|
48
|
+
* `emit` — a misbehaving wire subscriber cannot block other sinks.
|
|
49
|
+
*
|
|
50
|
+
* Phase 20 §C.3 (R-5) — optional `onError` callback lets callers
|
|
51
|
+
* observe swallowed listener exceptions without breaking the bus-
|
|
52
|
+
* accepted delivery semantic (`delivered_at.wire` still fires). The
|
|
53
|
+
* callback runs in the bus frame; its own errors are ignored.
|
|
54
|
+
*/
|
|
55
|
+
emitNotification(notif, onError) {
|
|
56
|
+
const snapshot = this.notificationListeners.slice();
|
|
57
|
+
for (const listener of snapshot) safeDispatch(listener, notif, onError);
|
|
58
|
+
}
|
|
59
|
+
on(listener) {
|
|
60
|
+
this.listeners.push(listener);
|
|
61
|
+
}
|
|
62
|
+
off(listener) {
|
|
63
|
+
const idx = this.listeners.indexOf(listener);
|
|
64
|
+
if (idx !== -1) this.listeners.splice(idx, 1);
|
|
65
|
+
}
|
|
66
|
+
/** Subscribe to notification fan-out (Slice 2.4). */
|
|
67
|
+
subscribeNotifications(listener) {
|
|
68
|
+
this.notificationListeners.push(listener);
|
|
69
|
+
}
|
|
70
|
+
unsubscribeNotifications(listener) {
|
|
71
|
+
const idx = this.notificationListeners.indexOf(listener);
|
|
72
|
+
if (idx !== -1) this.notificationListeners.splice(idx, 1);
|
|
73
|
+
}
|
|
74
|
+
listenerCount() {
|
|
75
|
+
return this.listeners.length;
|
|
76
|
+
}
|
|
77
|
+
notificationListenerCount() {
|
|
78
|
+
return this.notificationListeners.length;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Shared sync+async safe-dispatch helper for both channels. Mirrors the
|
|
83
|
+
* pattern in `src/soul/run-turn.ts::safeEmit`. A sync throw is caught
|
|
84
|
+
* and swallowed; an async rejection is caught via a terminal `.catch`
|
|
85
|
+
* so nothing reaches Node's unhandled-rejection handler.
|
|
86
|
+
*/
|
|
87
|
+
function safeDispatch(fn, arg, onError) {
|
|
88
|
+
const reportError = (error) => {
|
|
89
|
+
if (onError === void 0) return;
|
|
90
|
+
try {
|
|
91
|
+
onError(error);
|
|
92
|
+
} catch {}
|
|
93
|
+
};
|
|
94
|
+
let maybePromise;
|
|
95
|
+
try {
|
|
96
|
+
maybePromise = fn(arg);
|
|
97
|
+
} catch (error) {
|
|
98
|
+
reportError(error);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (maybePromise !== void 0 && maybePromise !== null && typeof maybePromise.then === "function" && typeof maybePromise.catch === "function") maybePromise.catch((error) => {
|
|
102
|
+
reportError(error);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
106
|
+
export { session_event_bus_exports as n, SessionEventBus as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { n as __esmMin } from "./chunk-pPjepVcp.mjs";
|
|
3
|
-
import { i as init_esm_min, n as FormData, o as Blob, r as formDataToBlob, s as init_fetch_blob, t as init_from } from "./from-
|
|
3
|
+
import { i as init_esm_min, n as FormData, o as Blob, r as formDataToBlob, s as init_fetch_blob, t as init_from } from "./from-BG79vaL9.mjs";
|
|
4
4
|
import { format } from "node:url";
|
|
5
5
|
import Ns, { PassThrough, pipeline } from "node:stream";
|
|
6
6
|
import http from "node:http";
|
|
@@ -210,7 +210,7 @@ var init_body = __esmMin((() => {
|
|
|
210
210
|
for (const [name, value] of parameters) formData.append(name, value);
|
|
211
211
|
return formData;
|
|
212
212
|
}
|
|
213
|
-
const { toFormData } = await import("./multipart-parser-
|
|
213
|
+
const { toFormData } = await import("./multipart-parser-OI2tZKyS.mjs");
|
|
214
214
|
return toFormData(this.body, ct);
|
|
215
215
|
}
|
|
216
216
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kfc-code-cli",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.3",
|
|
4
4
|
"description": "KFC crazy ",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"commander": "^13.1.0",
|
|
32
32
|
"marked": "^18.0.0",
|
|
33
33
|
"pino": "^9.6.0",
|
|
34
|
+
"semver": "^7.7.4",
|
|
34
35
|
"smol-toml": "^1.3.1",
|
|
35
36
|
"yazl": "^3.3.1",
|
|
36
37
|
"zod": "^4.3.6",
|
|
@@ -38,6 +39,7 @@
|
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"@types/marked": "^6.0.0",
|
|
42
|
+
"@types/semver": "^7.7.0",
|
|
41
43
|
"@types/yazl": "^2.4.6",
|
|
42
44
|
"tsx": "^4.19.4"
|
|
43
45
|
}
|