@vincemakes/kiso-ask-ext 0.44.0 → 0.45.0
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 +6 -0
- package/dist/kiso-ask.mjs +9 -4
- package/index.d.ts +13 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -19,6 +19,12 @@ The same artifact can be installed as a user-level extension (copy
|
|
|
19
19
|
`dist/kiso-ask.mjs` into `~/.kiso/extensions/`), in which case the
|
|
20
20
|
installing code supplies its own bridge.
|
|
21
21
|
|
|
22
|
+
A host supplies the bridge the same way: `createAskExtension(ui)`, where
|
|
23
|
+
`ui.ask(spec, signal, ctx)` answers the questions. `ctx` is
|
|
24
|
+
`{ sessionId, callId }` from the tool context, so a host that serves many
|
|
25
|
+
sessions from one runtime knows which session is asking and which call
|
|
26
|
+
the answer belongs to.
|
|
27
|
+
|
|
22
28
|
## Durability
|
|
23
29
|
|
|
24
30
|
No new mechanisms. The call is durable as its `tool_call_end`, the answers
|
package/dist/kiso-ask.mjs
CHANGED
|
@@ -98,9 +98,11 @@ function resultContent(result) {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
|
-
* The factory. `ui` is the panel bridge: `{ ask(spec, signal) →
|
|
102
|
-
* {answers:[…]} | {declined:[…]} > }
|
|
103
|
-
*
|
|
101
|
+
* The factory. `ui` is the panel bridge: `{ ask(spec, signal, ctx) →
|
|
102
|
+
* Promise< {answers:[…]} | {declined:[…]} > }`, where `ctx` is
|
|
103
|
+
* `{ sessionId, callId }` from the tool context. The CLI builds it over the
|
|
104
|
+
* editor's panel slot and ignores `ctx`; a test can pass any object with
|
|
105
|
+
* that one method.
|
|
104
106
|
*/
|
|
105
107
|
export default async function createAskExtension(ui) {
|
|
106
108
|
// TTY gating by construction: no bridge, no tool. The extension still
|
|
@@ -144,7 +146,10 @@ export default async function createAskExtension(ui) {
|
|
|
144
146
|
// The schema already refused an empty list; this guard is
|
|
145
147
|
// for direct tool use (a test, a bridge under repair).
|
|
146
148
|
if (questions.length === 0) return { content: "ask_user: no questions", isError: true };
|
|
147
|
-
|
|
149
|
+
// The third argument tells a host WHICH session and call is asking: one
|
|
150
|
+
// runtime may serve many sessions, and a bridge built per runtime cannot
|
|
151
|
+
// know otherwise. Both are the tool context's own values, passed through.
|
|
152
|
+
const result = await ui.ask({ questions }, ctx?.signal, { sessionId: ctx?.sessionId, callId: ctx?.callId });
|
|
148
153
|
return { content: resultContent(result), isError: false };
|
|
149
154
|
},
|
|
150
155
|
},
|
package/index.d.ts
CHANGED
|
@@ -10,9 +10,20 @@
|
|
|
10
10
|
import type { KisoExtension } from "@vincemakes/kiso-core";
|
|
11
11
|
import type { AskResult, AskSpec } from "@vincemakes/kiso-tui-cells";
|
|
12
12
|
|
|
13
|
-
/**
|
|
13
|
+
/** Which session and which tool call is asking — the tool context's own
|
|
14
|
+
* values, passed through. Optional because the context declares them
|
|
15
|
+
* optional: a direct call of the tool with a bare context gets
|
|
16
|
+
* `undefined`, never a made-up id. */
|
|
17
|
+
export interface AskCallContext {
|
|
18
|
+
readonly sessionId?: string;
|
|
19
|
+
readonly callId?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The panel bridge. The CLI implements it over its editor's panel slot
|
|
23
|
+
* and ignores `ctx`; a host serving many sessions from one runtime reads
|
|
24
|
+
* `ctx` to route the question to the right session. */
|
|
14
25
|
export interface AskUI {
|
|
15
|
-
ask(spec: AskSpec, signal?: { readonly aborted: boolean }): Promise<AskResult>;
|
|
26
|
+
ask(spec: AskSpec, signal?: { readonly aborted: boolean }, ctx?: AskCallContext): Promise<AskResult>;
|
|
16
27
|
}
|
|
17
28
|
|
|
18
29
|
declare const createAskExtension: (ui?: AskUI) => Promise<KisoExtension>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vincemakes/kiso-ask-ext",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.0",
|
|
4
4
|
"description": "kiso official ask extension \u2014 ask_user option panels: the model asks the human, the answers are durable facts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"test": "vitest run"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@vincemakes/kiso-core": "0.
|
|
26
|
+
"@vincemakes/kiso-core": "0.45.0",
|
|
27
27
|
"@types/node": "^26.1.2",
|
|
28
28
|
"typescript": "^5.7.2",
|
|
29
29
|
"vitest": "^3.0.0"
|