@acid-cat/core-ts 0.6.0 → 0.6.1
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/session.d.ts +9 -8
- package/dist/session.js +1 -1
- package/dist/webmcp.d.ts +2 -2
- package/dist/webmcp.js +1 -1
- package/package.json +4 -4
package/dist/session.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export interface Handle<Input = never, Value = unknown, Failure = unknown, State
|
|
|
23
23
|
}
|
|
24
24
|
/** The handle of a capability, with the types of its schemas. `session.handle` gives it. */
|
|
25
25
|
export type HandleOf<C> = C extends Capability<never, infer Input, infer Value, infer Failures, infer State, string> ? Handle<Input, Value, FailureOf<Failures>, State> : never;
|
|
26
|
+
/** A session. Its functions do not use `this`, so code can pass them on alone, for example `onClose(session.dispose)`. */
|
|
26
27
|
export interface Session<Context = unknown> {
|
|
27
28
|
readonly target: string;
|
|
28
29
|
/**
|
|
@@ -37,32 +38,32 @@ export interface Session<Context = unknown> {
|
|
|
37
38
|
* gets a handle that calls it. Any other capability, also one with the same id, gets a handle that is always
|
|
38
39
|
* unavailable, and each call rejects as `unknown-capability`. Each call of `handle` gives a new handle.
|
|
39
40
|
*/
|
|
40
|
-
handle<Input, Value, Failures, State, Id extends string>(capability: Capability<Context, Input, Value, Failures, State, Id>)
|
|
41
|
+
readonly handle: <Input, Value, Failures, State, Id extends string>(capability: Capability<Context, Input, Value, Failures, State, Id>) => Handle<Input, Value, FailureOf<Failures>, State>;
|
|
41
42
|
/**
|
|
42
43
|
* A call of a capability with an input that is not trusted. The input schema of the capability checks the input, so
|
|
43
44
|
* the result has the types of the capability. A call failure rejects with a `CallFailureError`. An input that does not
|
|
44
45
|
* agree with the schema rejects as `invalid-input`.
|
|
45
46
|
*/
|
|
46
|
-
call<Input, Value, Failures, State, Id extends string>(capability: Capability<Context, Input, Value, Failures, State, Id>, input: unknown, options?: {
|
|
47
|
+
readonly call: <Input, Value, Failures, State, Id extends string>(capability: Capability<Context, Input, Value, Failures, State, Id>, input: unknown, options?: {
|
|
47
48
|
readonly signal?: AbortSignal | undefined;
|
|
48
|
-
})
|
|
49
|
+
}) => Promise<Result<Value, FailureOf<Failures>>>;
|
|
49
50
|
/** A call with an input that is not trusted. The outcome is in its JSON form. The promise never rejects. */
|
|
50
|
-
invoke(id: string, input: unknown, options?: {
|
|
51
|
+
readonly invoke: (id: string, input: unknown, options?: {
|
|
51
52
|
readonly signal?: AbortSignal | undefined;
|
|
52
|
-
})
|
|
53
|
+
}) => Promise<Outcome<unknown, unknown>>;
|
|
53
54
|
/**
|
|
54
55
|
* An event each time the availability of a capability changes. The session subscribes to the availabilities when the
|
|
55
56
|
* first listener subscribes, and unsubscribes after the last listener unsubscribes.
|
|
56
57
|
*/
|
|
57
|
-
onChange(listener: () => void)
|
|
58
|
+
readonly onChange: (listener: () => void) => {
|
|
58
59
|
unsubscribe(): void;
|
|
59
60
|
};
|
|
60
61
|
/** The signal of the session. It aborts when the session closes. */
|
|
61
62
|
readonly signal: AbortSignal;
|
|
62
63
|
/** Close the session: accept no new calls, cancel the calls in progress, and wait for them. */
|
|
63
|
-
dispose()
|
|
64
|
+
readonly dispose: () => Promise<void>;
|
|
64
65
|
/** Close the session, as `dispose` does, at the end of the block of `await using session = createSession(…)`. */
|
|
65
|
-
[Symbol.asyncDispose]()
|
|
66
|
+
readonly [Symbol.asyncDispose]: () => Promise<void>;
|
|
66
67
|
}
|
|
67
68
|
export interface SessionOptions<Context> {
|
|
68
69
|
readonly target: string;
|
package/dist/session.js
CHANGED
|
@@ -166,7 +166,7 @@ function createSession(app, options) {
|
|
|
166
166
|
call: (capability, input, callOptions) => call(capability, input, callOptions?.signal),
|
|
167
167
|
signal: lifetime.signal,
|
|
168
168
|
invoke: (id, input, callOptions) => invoke(id, input, callOptions?.signal),
|
|
169
|
-
onChange(listener) {
|
|
169
|
+
onChange: (listener) => {
|
|
170
170
|
if (lifetime.signal.aborted) return { unsubscribe() {} };
|
|
171
171
|
if (listeners.size === 0) {
|
|
172
172
|
const announce = () => listeners.forEach((each) => each());
|
package/dist/webmcp.d.ts
CHANGED
|
@@ -21,9 +21,9 @@ export interface Status {
|
|
|
21
21
|
export interface Installation {
|
|
22
22
|
readonly status: Observable<Status>;
|
|
23
23
|
/** Try the last failed update again. */
|
|
24
|
-
retry()
|
|
24
|
+
readonly retry: () => void;
|
|
25
25
|
/** Remove all tools, and wait for the calls in progress. */
|
|
26
|
-
dispose()
|
|
26
|
+
readonly dispose: () => Promise<void>;
|
|
27
27
|
}
|
|
28
28
|
/** The WebMCP host of the page, if there is one (spec/bindings/webmcp.md#host). */
|
|
29
29
|
export declare function findHost(): ModelContext | undefined;
|
package/dist/webmcp.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acid-cat/core-ts",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Serve AcidCat capabilities in plain TypeScript, with no Effect dependency.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"acidcat",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@acid-cat/catalog": "0.6.
|
|
36
|
-
"@acid-cat/spec-ts": "0.6.
|
|
35
|
+
"@acid-cat/catalog": "0.6.1",
|
|
36
|
+
"@acid-cat/spec-ts": "0.6.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@acid-cat/cli": "0.6.
|
|
39
|
+
"@acid-cat/cli": "0.6.1",
|
|
40
40
|
"@types/node": "26.6.5",
|
|
41
41
|
"esbuild": "0.28.2",
|
|
42
42
|
"playwright": "1.64.0",
|