@vincemakes/kiso-runtime 0.1.21 → 0.1.23
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/dist/agent.d.ts +11 -0
- package/dist/agent.js +12 -0
- package/dist/session.d.ts +8 -0
- package/dist/session.js +12 -0
- package/dist/trust.d.ts +5 -3
- package/dist/trust.js +16 -2
- package/package.json +6 -6
package/dist/agent.d.ts
CHANGED
|
@@ -77,3 +77,14 @@ export declare class AgentRuntime {
|
|
|
77
77
|
}
|
|
78
78
|
/** The one-liner the README promises. */
|
|
79
79
|
export declare function createAgent(definition: AgentDefinition): AgentRuntime;
|
|
80
|
+
/**
|
|
81
|
+
* 合并轮 B: the adapter factory the CLI uses for /model switches — the
|
|
82
|
+
* same lazy provider resolution as createAgent's (the CLI never imports
|
|
83
|
+
* provider SDKs directly; the runtime owns them here). Returns a NEW
|
|
84
|
+
* adapter each call; the caller (session.setAdapter) decides when it
|
|
85
|
+
* takes effect.
|
|
86
|
+
*/
|
|
87
|
+
export declare function buildAdapter(provider: "anthropic" | "openai-compat", opts?: {
|
|
88
|
+
readonly apiKey?: string;
|
|
89
|
+
readonly baseUrl?: string;
|
|
90
|
+
}): Promise<Adapter>;
|
package/dist/agent.js
CHANGED
|
@@ -98,6 +98,18 @@ function policyHooks(policy) {
|
|
|
98
98
|
},
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* 合并轮 B: the adapter factory the CLI uses for /model switches — the
|
|
103
|
+
* same lazy provider resolution as createAgent's (the CLI never imports
|
|
104
|
+
* provider SDKs directly; the runtime owns them here). Returns a NEW
|
|
105
|
+
* adapter each call; the caller (session.setAdapter) decides when it
|
|
106
|
+
* takes effect.
|
|
107
|
+
*/
|
|
108
|
+
export async function buildAdapter(provider, opts = {}) {
|
|
109
|
+
// resolveAdapter consumes only provider/apiKey/baseUrl from the
|
|
110
|
+
// definition — the rest is irrelevant for a bare adapter build.
|
|
111
|
+
return resolveAdapter({ provider, ...opts });
|
|
112
|
+
}
|
|
101
113
|
async function resolveAdapter(definition) {
|
|
102
114
|
if (definition.adapter)
|
|
103
115
|
return definition.adapter;
|
package/dist/session.d.ts
CHANGED
|
@@ -79,6 +79,14 @@ export declare class AgentSession {
|
|
|
79
79
|
endRun(run: Run): void;
|
|
80
80
|
/** The conversation so far, as the model sees it. */
|
|
81
81
|
projected(): readonly Message[];
|
|
82
|
+
/**
|
|
83
|
+
* 合并轮 B (/model): replace the adapter for SUBSEQUENT runs. The
|
|
84
|
+
* kernel reads the adapter through the loop-config closure at each
|
|
85
|
+
* turn, so the swap takes effect at the next turn — a run already in
|
|
86
|
+
* flight keeps the adapter it started with. The CLI calls this between
|
|
87
|
+
* turns (dispatch's /model), never mid-run.
|
|
88
|
+
*/
|
|
89
|
+
setAdapter(adapter: Adapter): void;
|
|
82
90
|
/** Run one user turn. Iterate to consume; `run.abort()` cancels. */
|
|
83
91
|
run(input: string, options?: {
|
|
84
92
|
signal?: AbortSignalLike;
|
package/dist/session.js
CHANGED
|
@@ -56,6 +56,8 @@ export class AgentSession {
|
|
|
56
56
|
id;
|
|
57
57
|
log;
|
|
58
58
|
#store;
|
|
59
|
+
// NOT readonly since 0.1.23: /model replaces it between runs (the
|
|
60
|
+
// constructor and setAdapter are the only writers).
|
|
59
61
|
#adapter;
|
|
60
62
|
#config;
|
|
61
63
|
#pendingResolvers = new Map();
|
|
@@ -140,6 +142,16 @@ export class AgentSession {
|
|
|
140
142
|
projected() {
|
|
141
143
|
return projectMessages(this.log.all);
|
|
142
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* 合并轮 B (/model): replace the adapter for SUBSEQUENT runs. The
|
|
147
|
+
* kernel reads the adapter through the loop-config closure at each
|
|
148
|
+
* turn, so the swap takes effect at the next turn — a run already in
|
|
149
|
+
* flight keeps the adapter it started with. The CLI calls this between
|
|
150
|
+
* turns (dispatch's /model), never mid-run.
|
|
151
|
+
*/
|
|
152
|
+
setAdapter(adapter) {
|
|
153
|
+
this.#adapter = adapter;
|
|
154
|
+
}
|
|
143
155
|
/** Run one user turn. Iterate to consume; `run.abort()` cancels. */
|
|
144
156
|
run(input, options) {
|
|
145
157
|
this.ensureHealthy();
|
package/dist/trust.d.ts
CHANGED
|
@@ -6,8 +6,10 @@
|
|
|
6
6
|
* dies the moment the files change.
|
|
7
7
|
*
|
|
8
8
|
* projectArtifacts(cwd) discovers <cwd>/.kiso/{extensions/*.mjs, mcp.json,
|
|
9
|
-
* skills/<name>/SKILL.md} — the
|
|
10
|
-
*
|
|
9
|
+
* skills/<name>/SKILL.md, config.json} — the four artifact kinds (config
|
|
10
|
+
* since 0.1.23, ADR-0045: the project config rides the trust package) —
|
|
11
|
+
* and returns a manifest (one sha256 per file) plus a BUNDLE digest:
|
|
12
|
+
* sha256 over the
|
|
11
13
|
* sorted relative paths and their contents. Any file change changes the
|
|
12
14
|
* bundle digest, which invalidates every prior trust record.
|
|
13
15
|
*
|
|
@@ -32,7 +34,7 @@ export interface TrustRecord {
|
|
|
32
34
|
export interface ProjectArtifact {
|
|
33
35
|
/** path relative to the .kiso dir, e.g. "extensions/lint-rules.mjs". */
|
|
34
36
|
readonly path: string;
|
|
35
|
-
readonly kind: "extension" | "mcp" | "skill";
|
|
37
|
+
readonly kind: "extension" | "mcp" | "skill" | "config";
|
|
36
38
|
/** sha256 (hex) of this file's content — the listing shows a short prefix. */
|
|
37
39
|
readonly digest: string;
|
|
38
40
|
}
|
package/dist/trust.js
CHANGED
|
@@ -6,8 +6,10 @@
|
|
|
6
6
|
* dies the moment the files change.
|
|
7
7
|
*
|
|
8
8
|
* projectArtifacts(cwd) discovers <cwd>/.kiso/{extensions/*.mjs, mcp.json,
|
|
9
|
-
* skills/<name>/SKILL.md} — the
|
|
10
|
-
*
|
|
9
|
+
* skills/<name>/SKILL.md, config.json} — the four artifact kinds (config
|
|
10
|
+
* since 0.1.23, ADR-0045: the project config rides the trust package) —
|
|
11
|
+
* and returns a manifest (one sha256 per file) plus a BUNDLE digest:
|
|
12
|
+
* sha256 over the
|
|
11
13
|
* sorted relative paths and their contents. Any file change changes the
|
|
12
14
|
* bundle digest, which invalidates every prior trust record.
|
|
13
15
|
*
|
|
@@ -81,6 +83,16 @@ export async function projectArtifacts(cwd) {
|
|
|
81
83
|
throw err; // a file named like a dir → ENOTDIR: inert, skip
|
|
82
84
|
}
|
|
83
85
|
}
|
|
86
|
+
// 合并轮 B: the project's config.json is an artifact of the trust
|
|
87
|
+
// package — trusting the package trusts its config, and a CHANGED
|
|
88
|
+
// config is a changed digest (the trust decision re-evaluates).
|
|
89
|
+
try {
|
|
90
|
+
entries.push({ path: "config.json", buf: await readFile(join(root, "config.json")) });
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
if (!isMissing(err))
|
|
94
|
+
throw err;
|
|
95
|
+
}
|
|
84
96
|
if (entries.length === 0)
|
|
85
97
|
return null;
|
|
86
98
|
entries.sort((a, b) => (a.path < b.path ? -1 : a.path > b.path ? 1 : 0));
|
|
@@ -105,6 +117,8 @@ function kindOf(path) {
|
|
|
105
117
|
return "extension";
|
|
106
118
|
if (path === "mcp.json")
|
|
107
119
|
return "mcp";
|
|
120
|
+
if (path === "config.json")
|
|
121
|
+
return "config";
|
|
108
122
|
return "skill";
|
|
109
123
|
}
|
|
110
124
|
async function readdirOrEmpty(dir) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vincemakes/kiso-runtime",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "kiso runtime
|
|
3
|
+
"version": "0.1.23",
|
|
4
|
+
"description": "kiso runtime \u2014 durable multi-turn agent sessions: AgentDefinition, AgentRuntime, AgentSession, Run, append-only JSONL store.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"exports": {
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
"test": "vitest run"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@vincemakes/kiso-core": "0.1.
|
|
24
|
+
"@vincemakes/kiso-core": "0.1.23"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@vincemakes/kiso-provider-anthropic": "0.1.
|
|
28
|
-
"@vincemakes/kiso-provider-openai": "0.1.
|
|
27
|
+
"@vincemakes/kiso-provider-anthropic": "0.1.23",
|
|
28
|
+
"@vincemakes/kiso-provider-openai": "0.1.23"
|
|
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.
|
|
39
|
+
"@vincemakes/kiso-evals": "0.1.23",
|
|
40
40
|
"@types/node": "^26.1.2",
|
|
41
41
|
"typescript": "^5.7.2",
|
|
42
42
|
"vitest": "^3.0.0"
|