kfc-code-cli 0.0.1-alpha.2 → 0.0.1-alpha.21

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.
@@ -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-BNWSEQzV.mjs";
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,120 @@
1
+ #!/usr/bin/env node
2
+ import { r as __exportAll$1 } from "./chunk-pPjepVcp.mjs";
3
+ //#region ../../packages/kimi-core/dist/session-event-bus-DNeVy6cB.mjs
4
+ var session_event_bus_DNeVy6cB_exports = /* @__PURE__ */ __exportAll$1({
5
+ n: () => session_event_bus_exports,
6
+ t: () => SessionEventBus
7
+ });
8
+ var __defProp = Object.defineProperty;
9
+ var __exportAll = (all, no_symbols) => {
10
+ let target = {};
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
16
+ return target;
17
+ };
18
+ var session_event_bus_exports = /* @__PURE__ */ __exportAll({ SessionEventBus: () => SessionEventBus });
19
+ var SessionEventBus = class {
20
+ listeners = [];
21
+ notificationListeners = [];
22
+ /**
23
+ * Fire-and-forget publish. There is NO pre-subscribe buffer — events emitted
24
+ * before a listener calls `on()` are permanently lost. Callers that need
25
+ * replay (e.g. MCPManager.loadAll firing before any session is created) must
26
+ * emit a catch-up snapshot after the listener is installed.
27
+ */
28
+ emit(event) {
29
+ const snapshot = this.listeners.slice();
30
+ for (const listener of snapshot) safeDispatch(listener, event);
31
+ }
32
+ /**
33
+ * Source-tagged fan-out (Phase 6 / 决策 #88 / §4.8.2). The wrapper that
34
+ * sits between a subagent / teammate Soul and this bus calls
35
+ * `emitWithSource` so listeners (UI / wire bridge / telemetry) can
36
+ * attribute every event back to its originating agent.
37
+ *
38
+ * Contract:
39
+ * - Returns `void` (铁律 4 — no back-pressure on Soul).
40
+ * - Does NOT mutate the caller's `event` argument; the envelope is
41
+ * attached on a shallow copy.
42
+ * - `source` is transport-only — never written to wire.jsonl
43
+ * (铁律 5; the sink wrapper persists the bare event through the
44
+ * child JournalWriter, see `createSubagentSinkWrapper`).
45
+ * - Listener errors are isolated by the same `safeDispatch` used by
46
+ * `emit`.
47
+ */
48
+ emitWithSource(event, source) {
49
+ const tagged = {
50
+ ...event,
51
+ source
52
+ };
53
+ const snapshot = this.listeners.slice();
54
+ for (const listener of snapshot) safeDispatch(listener, tagged);
55
+ }
56
+ /**
57
+ * Fan out a notification to all notification subscribers (Slice 2.4).
58
+ * Kept as a dedicated channel rather than folded into `SoulEvent` so
59
+ * the Soul layer stays ignorant of SoulPlus-level concepts
60
+ * (notification is an §5.2.4 SoulPlus concern, not a §5.2.1 Soul one).
61
+ * Listener errors are swallowed with the same safeEmit discipline as
62
+ * `emit` — a misbehaving wire subscriber cannot block other sinks.
63
+ *
64
+ * Phase 20 §C.3 (R-5) — optional `onError` callback lets callers
65
+ * observe swallowed listener exceptions without breaking the bus-
66
+ * accepted delivery semantic (`delivered_at.wire` still fires). The
67
+ * callback runs in the bus frame; its own errors are ignored.
68
+ */
69
+ emitNotification(notif, onError) {
70
+ const snapshot = this.notificationListeners.slice();
71
+ for (const listener of snapshot) safeDispatch(listener, notif, onError);
72
+ }
73
+ on(listener) {
74
+ this.listeners.push(listener);
75
+ }
76
+ off(listener) {
77
+ const idx = this.listeners.indexOf(listener);
78
+ if (idx !== -1) this.listeners.splice(idx, 1);
79
+ }
80
+ /** Subscribe to notification fan-out (Slice 2.4). */
81
+ subscribeNotifications(listener) {
82
+ this.notificationListeners.push(listener);
83
+ }
84
+ unsubscribeNotifications(listener) {
85
+ const idx = this.notificationListeners.indexOf(listener);
86
+ if (idx !== -1) this.notificationListeners.splice(idx, 1);
87
+ }
88
+ listenerCount() {
89
+ return this.listeners.length;
90
+ }
91
+ notificationListenerCount() {
92
+ return this.notificationListeners.length;
93
+ }
94
+ };
95
+ /**
96
+ * Shared sync+async safe-dispatch helper for both channels. Mirrors the
97
+ * pattern in `src/soul/run-turn.ts::safeEmit`. A sync throw is caught
98
+ * and swallowed; an async rejection is caught via a terminal `.catch`
99
+ * so nothing reaches Node's unhandled-rejection handler.
100
+ */
101
+ function safeDispatch(fn, arg, onError) {
102
+ const reportError = (error) => {
103
+ if (onError === void 0) return;
104
+ try {
105
+ onError(error);
106
+ } catch {}
107
+ };
108
+ let maybePromise;
109
+ try {
110
+ maybePromise = fn(arg);
111
+ } catch (error) {
112
+ reportError(error);
113
+ return;
114
+ }
115
+ if (maybePromise !== void 0 && maybePromise !== null && typeof maybePromise.then === "function" && typeof maybePromise.catch === "function") maybePromise.catch((error) => {
116
+ reportError(error);
117
+ });
118
+ }
119
+ //#endregion
120
+ export { session_event_bus_DNeVy6cB_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-BNWSEQzV.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-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-CetGDzPt.mjs");
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.2",
3
+ "version": "0.0.1-alpha.21",
4
4
  "description": "KFC crazy ",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -16,29 +16,34 @@
16
16
  "access": "public",
17
17
  "provenance": true
18
18
  },
19
- "scripts": {
20
- "build": "tsdown && rm -rf agents && cp -R ../../packages/kimi-core/agents agents",
21
- "dev": "node ./dist/main.mjs",
22
- "clean": "rm -rf dist",
23
- "test": "vitest run"
24
- },
25
19
  "dependencies": {
26
20
  "@mariozechner/clipboard": "^0.3.2",
27
- "@mariozechner/pi-tui": "^0.67.6",
21
+ "@mariozechner/pi-tui": "^0.73.0",
28
22
  "chalk": "^5.4.1",
29
23
  "cli-highlight": "^2.1.11",
30
- "clipboardy": "^4.0.0",
31
24
  "commander": "^13.1.0",
32
- "marked": "^18.0.0",
33
25
  "pino": "^9.6.0",
34
- "smol-toml": "^1.3.1",
26
+ "semver": "^7.7.4",
27
+ "smol-toml": "^1.6.1",
28
+ "ssh2": "^1.17.0",
35
29
  "yazl": "^3.3.1",
36
- "zod": "^4.3.6",
37
- "ssh2": "^1.17.0"
30
+ "zod": "^4.3.6"
38
31
  },
39
32
  "devDependencies": {
40
- "@types/marked": "^6.0.0",
33
+ "@types/semver": "^7.7.0",
41
34
  "@types/yazl": "^2.4.6",
42
- "tsx": "^4.19.4"
35
+ "tsx": "^4.21.0",
36
+ "@moonshot-ai/sdk": "^0.1.0",
37
+ "@moonshot-ai/core": "^0.1.0"
38
+ },
39
+ "scripts": {
40
+ "build": "tsdown && rm -rf agents && cp -R ../../packages/kimi-core/agents agents",
41
+ "dev": "pnpm -w run build:packages && pnpm run build && node ./dist/main.mjs",
42
+ "clean": "rm -rf dist",
43
+ "typecheck": "tsc -p tsconfig.json --noEmit",
44
+ "test": "pnpm -w run build:packages && vitest run",
45
+ "e2e": "pnpm -w run build:packages && vitest run test/e2e",
46
+ "e2e:real": "pnpm -w run build:packages && KIMI_E2E_REAL=1 vitest run test/e2e/real-llm-smoke.e2e.test.ts",
47
+ "release": "bash scripts/release.sh"
43
48
  }
44
- }
49
+ }