@vincemakes/kiso-runtime 0.1.7 → 0.1.9

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.
@@ -11,3 +11,10 @@
11
11
  import type { KisoExtension } from "@vincemakes/kiso-core";
12
12
  export type { KisoExtension };
13
13
  export declare function loadExtensions(dir: string): Promise<KisoExtension[]>;
14
+ /**
15
+ * 发现#8 (P1): dispose every extension's external resources — each call
16
+ * guarded (one failure never blocks the rest), each capped at 5s (a
17
+ * timeout is abandoned and recorded — Promise.allSettled semantics).
18
+ * Whoever LOADS extensions is responsible for disposing them.
19
+ */
20
+ export declare function disposeExtensions(extensions: readonly KisoExtension[]): Promise<void>;
@@ -43,6 +43,30 @@ export async function loadExtensions(dir) {
43
43
  }
44
44
  return out;
45
45
  }
46
+ /**
47
+ * 发现#8 (P1): dispose every extension's external resources — each call
48
+ * guarded (one failure never blocks the rest), each capped at 5s (a
49
+ * timeout is abandoned and recorded — Promise.allSettled semantics).
50
+ * Whoever LOADS extensions is responsible for disposing them.
51
+ */
52
+ export async function disposeExtensions(extensions) {
53
+ const DISPOSE_TIMEOUT_MS = 5_000;
54
+ const settled = await Promise.allSettled(extensions.map(async (ext) => {
55
+ if (ext.dispose === undefined)
56
+ return;
57
+ await Promise.race([
58
+ Promise.resolve(ext.dispose()),
59
+ // unref'd: a prompt dispose must not leave the abandoned cap
60
+ // timer holding the host's event loop after the exit path.
61
+ new Promise((resolve) => setTimeout(resolve, DISPOSE_TIMEOUT_MS).unref()),
62
+ ]);
63
+ }));
64
+ for (const r of settled) {
65
+ if (r.status === "rejected") {
66
+ console.error(`[extensions] ${r.reason instanceof Error ? r.reason.message : String(r.reason)}`);
67
+ }
68
+ }
69
+ }
46
70
  function isExtension(v) {
47
71
  if (typeof v !== "object" || v === null)
48
72
  return false;
package/dist/session.js CHANGED
@@ -447,6 +447,7 @@ export class Run {
447
447
  const loopConfig = () => ({
448
448
  adapter: this.#adapter,
449
449
  model: this.#config.model,
450
+ sessionId: this.#session.id, // P3: tools see their session (ToolContext.sessionId)
450
451
  ...(systemPrompt !== undefined ? { systemPrompt } : {}),
451
452
  registry: this.#config.registry,
452
453
  ...(this.#config.hooks !== undefined ? { hooks: this.#config.hooks } : {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vincemakes/kiso-runtime",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "kiso runtime — durable multi-turn agent sessions: AgentDefinition, AgentRuntime, AgentSession, Run, append-only JSONL store.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -21,11 +21,11 @@
21
21
  "test": "vitest run"
22
22
  },
23
23
  "dependencies": {
24
- "@vincemakes/kiso-core": "0.1.7"
24
+ "@vincemakes/kiso-core": "0.1.9"
25
25
  },
26
26
  "peerDependencies": {
27
- "@vincemakes/kiso-provider-anthropic": "0.1.7",
28
- "@vincemakes/kiso-provider-openai": "0.1.7"
27
+ "@vincemakes/kiso-provider-anthropic": "0.1.9",
28
+ "@vincemakes/kiso-provider-openai": "0.1.9"
29
29
  },
30
30
  "peerDependenciesMeta": {
31
31
  "@vincemakes/kiso-provider-anthropic": {
@@ -36,7 +36,7 @@
36
36
  }
37
37
  },
38
38
  "devDependencies": {
39
- "@vincemakes/kiso-evals": "0.1.7",
39
+ "@vincemakes/kiso-evals": "0.1.9",
40
40
  "@types/node": "^26.1.2",
41
41
  "typescript": "^5.7.2",
42
42
  "vitest": "^3.0.0"