@rkat/sdk 0.3.4 → 0.4.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/dist/client.d.ts +101 -84
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +490 -310
- package/dist/client.js.map +1 -1
- package/dist/events.d.ts +239 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +160 -0
- package/dist/events.js.map +1 -0
- package/dist/generated/types.d.ts +1 -1
- package/dist/generated/types.js +2 -2
- package/dist/index.d.ts +25 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -3
- package/dist/index.js.map +1 -1
- package/dist/session.d.ts +86 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +125 -0
- package/dist/session.js.map +1 -0
- package/dist/streaming.d.ts +52 -14
- package/dist/streaming.d.ts.map +1 -1
- package/dist/streaming.js +138 -60
- package/dist/streaming.js.map +1 -1
- package/dist/types.d.ts +96 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +1 -1
- package/dist/capabilities.d.ts +0 -24
- package/dist/capabilities.d.ts.map +0 -1
- package/dist/capabilities.js +0 -36
- package/dist/capabilities.js.map +0 -1
- package/dist/skills.d.ts +0 -41
- package/dist/skills.d.ts.map +0 -1
- package/dist/skills.js +0 -57
- package/dist/skills.js.map +0 -1
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/package.json
CHANGED
package/dist/capabilities.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Capability checking and method gating for the Meerkat SDK.
|
|
3
|
-
*/
|
|
4
|
-
import type { CapabilitiesResponse } from "./generated/types.js";
|
|
5
|
-
/**
|
|
6
|
-
* Gates method calls by checking runtime capabilities.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const checker = new CapabilityChecker(capabilitiesResponse);
|
|
11
|
-
* checker.require("comms"); // throws if comms not available
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
export declare class CapabilityChecker {
|
|
15
|
-
private capabilities;
|
|
16
|
-
constructor(response: CapabilitiesResponse);
|
|
17
|
-
/** Check if a capability is available. */
|
|
18
|
-
has(capabilityId: string): boolean;
|
|
19
|
-
/** Throw CapabilityUnavailableError if capability is not available. */
|
|
20
|
-
require(capabilityId: string): void;
|
|
21
|
-
/** List all available capability IDs. */
|
|
22
|
-
get available(): string[];
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=capabilities.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAGjE;;;;;;;;GAQG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,YAAY,CAAsB;gBAE9B,QAAQ,EAAE,oBAAoB;IAM1C,0CAA0C;IAC1C,GAAG,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IAIlC,uEAAuE;IACvE,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;IASnC,yCAAyC;IACzC,IAAI,SAAS,IAAI,MAAM,EAAE,CAIxB;CACF"}
|
package/dist/capabilities.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Capability checking and method gating for the Meerkat SDK.
|
|
3
|
-
*/
|
|
4
|
-
import { CapabilityUnavailableError } from "./generated/errors.js";
|
|
5
|
-
/**
|
|
6
|
-
* Gates method calls by checking runtime capabilities.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const checker = new CapabilityChecker(capabilitiesResponse);
|
|
11
|
-
* checker.require("comms"); // throws if comms not available
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
export class CapabilityChecker {
|
|
15
|
-
capabilities;
|
|
16
|
-
constructor(response) {
|
|
17
|
-
this.capabilities = new Map(response.capabilities.map((c) => [c.id, c.status]));
|
|
18
|
-
}
|
|
19
|
-
/** Check if a capability is available. */
|
|
20
|
-
has(capabilityId) {
|
|
21
|
-
return this.capabilities.get(capabilityId) === "Available";
|
|
22
|
-
}
|
|
23
|
-
/** Throw CapabilityUnavailableError if capability is not available. */
|
|
24
|
-
require(capabilityId) {
|
|
25
|
-
if (!this.has(capabilityId)) {
|
|
26
|
-
throw new CapabilityUnavailableError("CAPABILITY_UNAVAILABLE", `Capability '${capabilityId}' is not available in this runtime`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
/** List all available capability IDs. */
|
|
30
|
-
get available() {
|
|
31
|
-
return [...this.capabilities.entries()]
|
|
32
|
-
.filter(([, status]) => status === "Available")
|
|
33
|
-
.map(([id]) => id);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=capabilities.js.map
|
package/dist/capabilities.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE;;;;;;;;GAQG;AACH,MAAM,OAAO,iBAAiB;IACpB,YAAY,CAAsB;IAE1C,YAAY,QAA8B;QACxC,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,CACzB,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CACnD,CAAC;IACJ,CAAC;IAED,0CAA0C;IAC1C,GAAG,CAAC,YAAoB;QACtB,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,KAAK,WAAW,CAAC;IAC7D,CAAC;IAED,uEAAuE;IACvE,OAAO,CAAC,YAAoB;QAC1B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;YAC5B,MAAM,IAAI,0BAA0B,CAClC,wBAAwB,EACxB,eAAe,YAAY,oCAAoC,CAChE,CAAC;QACJ,CAAC;IACH,CAAC;IAED,yCAAyC;IACzC,IAAI,SAAS;QACX,OAAO,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;aACpC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,MAAM,KAAK,WAAW,CAAC;aAC9C,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;IACvB,CAAC;CACF"}
|
package/dist/skills.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Skill invocation helpers for the Meerkat SDK.
|
|
3
|
-
*/
|
|
4
|
-
import type { MeerkatClient } from "./client.js";
|
|
5
|
-
import type { WireRunResult } from "./generated/types.js";
|
|
6
|
-
/**
|
|
7
|
-
* Helpers for working with Meerkat skills.
|
|
8
|
-
*
|
|
9
|
-
* Skills are loaded by the agent from filesystem and embedded sources.
|
|
10
|
-
* The agent's system prompt contains an inventory of available skills.
|
|
11
|
-
* To invoke a skill, include its reference (e.g. `/shell-patterns`)
|
|
12
|
-
* in the user prompt.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```ts
|
|
16
|
-
* const helper = new SkillHelper(client);
|
|
17
|
-
* helper.requireSkills();
|
|
18
|
-
* const result = await helper.invoke(sessionId, "/shell-patterns", "How do I run a background job?");
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export declare class SkillHelper {
|
|
22
|
-
private client;
|
|
23
|
-
constructor(client: MeerkatClient);
|
|
24
|
-
/** Check if the skills capability is available in this runtime. */
|
|
25
|
-
isAvailable(): boolean;
|
|
26
|
-
/** Throw if skills capability is not available. */
|
|
27
|
-
requireSkills(): void;
|
|
28
|
-
/**
|
|
29
|
-
* Invoke a skill within an existing session.
|
|
30
|
-
*
|
|
31
|
-
* The skill reference (e.g. `/shell-patterns`) is prepended to the prompt.
|
|
32
|
-
* The agent's system prompt already contains the skill inventory, so it
|
|
33
|
-
* knows how to resolve the reference.
|
|
34
|
-
*/
|
|
35
|
-
invoke(sessionId: string, skillReference: string, prompt: string): Promise<WireRunResult>;
|
|
36
|
-
/**
|
|
37
|
-
* Create a new session and invoke a skill in the first turn.
|
|
38
|
-
*/
|
|
39
|
-
invokeNewSession(skillReference: string, prompt: string, model?: string): Promise<WireRunResult>;
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=skills.d.ts.map
|
package/dist/skills.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D;;;;;;;;;;;;;;GAcG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAgB;gBAElB,MAAM,EAAE,aAAa;IAIjC,mEAAmE;IACnE,WAAW,IAAI,OAAO;IAItB,mDAAmD;IACnD,aAAa,IAAI,IAAI;IAUrB;;;;;;OAMG;IACG,MAAM,CACV,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,aAAa,CAAC;IAMzB;;OAEG;IACG,gBAAgB,CACpB,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,aAAa,CAAC;CAK1B"}
|
package/dist/skills.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Skill invocation helpers for the Meerkat SDK.
|
|
3
|
-
*/
|
|
4
|
-
import { CapabilityUnavailableError } from "./generated/errors.js";
|
|
5
|
-
/**
|
|
6
|
-
* Helpers for working with Meerkat skills.
|
|
7
|
-
*
|
|
8
|
-
* Skills are loaded by the agent from filesystem and embedded sources.
|
|
9
|
-
* The agent's system prompt contains an inventory of available skills.
|
|
10
|
-
* To invoke a skill, include its reference (e.g. `/shell-patterns`)
|
|
11
|
-
* in the user prompt.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* const helper = new SkillHelper(client);
|
|
16
|
-
* helper.requireSkills();
|
|
17
|
-
* const result = await helper.invoke(sessionId, "/shell-patterns", "How do I run a background job?");
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export class SkillHelper {
|
|
21
|
-
client;
|
|
22
|
-
constructor(client) {
|
|
23
|
-
this.client = client;
|
|
24
|
-
}
|
|
25
|
-
/** Check if the skills capability is available in this runtime. */
|
|
26
|
-
isAvailable() {
|
|
27
|
-
return this.client.hasCapability("skills");
|
|
28
|
-
}
|
|
29
|
-
/** Throw if skills capability is not available. */
|
|
30
|
-
requireSkills() {
|
|
31
|
-
if (!this.isAvailable()) {
|
|
32
|
-
throw new CapabilityUnavailableError("CAPABILITY_UNAVAILABLE", "Skills capability is not available in this runtime. " +
|
|
33
|
-
"Build with --features skills to enable.");
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Invoke a skill within an existing session.
|
|
38
|
-
*
|
|
39
|
-
* The skill reference (e.g. `/shell-patterns`) is prepended to the prompt.
|
|
40
|
-
* The agent's system prompt already contains the skill inventory, so it
|
|
41
|
-
* knows how to resolve the reference.
|
|
42
|
-
*/
|
|
43
|
-
async invoke(sessionId, skillReference, prompt) {
|
|
44
|
-
this.requireSkills();
|
|
45
|
-
const fullPrompt = `${skillReference} ${prompt}`;
|
|
46
|
-
return this.client.startTurn(sessionId, fullPrompt);
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Create a new session and invoke a skill in the first turn.
|
|
50
|
-
*/
|
|
51
|
-
async invokeNewSession(skillReference, prompt, model) {
|
|
52
|
-
this.requireSkills();
|
|
53
|
-
const fullPrompt = `${skillReference} ${prompt}`;
|
|
54
|
-
return this.client.createSession({ prompt: fullPrompt, model });
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=skills.js.map
|
package/dist/skills.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skills.js","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,WAAW;IACd,MAAM,CAAgB;IAE9B,YAAY,MAAqB;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,mEAAmE;IACnE,WAAW;QACT,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAED,mDAAmD;IACnD,aAAa;QACX,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,MAAM,IAAI,0BAA0B,CAClC,wBAAwB,EACxB,sDAAsD;gBACpD,yCAAyC,CAC5C,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CACV,SAAiB,EACjB,cAAsB,EACtB,MAAc;QAEd,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,MAAM,UAAU,GAAG,GAAG,cAAc,IAAI,MAAM,EAAE,CAAC;QACjD,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACtD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,gBAAgB,CACpB,cAAsB,EACtB,MAAc,EACd,KAAc;QAEd,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,MAAM,UAAU,GAAG,GAAG,cAAc,IAAI,MAAM,EAAE,CAAC;QACjD,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;IAClE,CAAC;CACF"}
|