@clawpify/skills 1.0.4 → 1.0.5
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 +139 -9
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +341 -49
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +358 -50
- package/dist/mcp-server.js +1 -1
- package/dist/memory.d.ts +26 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/memory.js +17 -0
- package/dist/shopify.d.ts +1 -1
- package/dist/shopify.js +1 -1
- package/package.json +8 -2
- package/src/agent.test.ts +927 -0
- package/src/agent.ts +608 -68
- package/src/index.ts +15 -1
- package/src/memory.ts +38 -0
- package/src/shopify.ts +2 -2
package/src/index.ts
CHANGED
|
@@ -46,7 +46,21 @@ export {
|
|
|
46
46
|
} from "./auth";
|
|
47
47
|
|
|
48
48
|
// AI Agent (requires @anthropic-ai/sdk peer dependency)
|
|
49
|
-
export { ShopifyAgent } from "./agent";
|
|
49
|
+
export { ShopifyAgent, DEFAULT_SYSTEM_INSTRUCTION } from "./agent";
|
|
50
|
+
export type {
|
|
51
|
+
AgentConfig,
|
|
52
|
+
AgentHooks,
|
|
53
|
+
AgentPlugin,
|
|
54
|
+
ChatResult,
|
|
55
|
+
ModelPricing,
|
|
56
|
+
StreamEvent,
|
|
57
|
+
ThinkingConfig,
|
|
58
|
+
TokenUsage,
|
|
59
|
+
} from "./agent";
|
|
60
|
+
|
|
61
|
+
// Memory
|
|
62
|
+
export { InMemoryStore } from "./memory";
|
|
63
|
+
export type { MemoryStore } from "./memory";
|
|
50
64
|
|
|
51
65
|
// Skills loader
|
|
52
66
|
export { loadSkills } from "./skills";
|
package/src/memory.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for persisting conversation history across sessions.
|
|
3
|
+
* Implement this interface to plug in any storage backend (Redis, SQLite, etc.).
|
|
4
|
+
*
|
|
5
|
+
* History is stored as raw MessageParam arrays — the same type the agent
|
|
6
|
+
* accepts and returns — so round-tripping is lossless.
|
|
7
|
+
*/
|
|
8
|
+
export interface MemoryStore {
|
|
9
|
+
/** Save conversation history for a session. */
|
|
10
|
+
save(sessionId: string, history: any[]): Promise<void>;
|
|
11
|
+
|
|
12
|
+
/** Load conversation history for a session. Returns empty array if not found. */
|
|
13
|
+
load(sessionId: string): Promise<any[]>;
|
|
14
|
+
|
|
15
|
+
/** Clear conversation history for a session. */
|
|
16
|
+
clear(sessionId: string): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Simple in-memory implementation of MemoryStore.
|
|
21
|
+
* Data is lost when the process restarts — use for dev/testing only.
|
|
22
|
+
*/
|
|
23
|
+
export class InMemoryStore implements MemoryStore {
|
|
24
|
+
private store = new Map<string, any[]>();
|
|
25
|
+
|
|
26
|
+
async save(sessionId: string, history: any[]): Promise<void> {
|
|
27
|
+
this.store.set(sessionId, structuredClone(history));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async load(sessionId: string): Promise<any[]> {
|
|
31
|
+
const data = this.store.get(sessionId);
|
|
32
|
+
return data ? structuredClone(data) : [];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async clear(sessionId: string): Promise<void> {
|
|
36
|
+
this.store.delete(sessionId);
|
|
37
|
+
}
|
|
38
|
+
}
|
package/src/shopify.ts
CHANGED
|
@@ -3,7 +3,7 @@ export interface ShopifyClientConfig {
|
|
|
3
3
|
storeUrl: string;
|
|
4
4
|
/** Admin API access token */
|
|
5
5
|
accessToken: string;
|
|
6
|
-
/** API version (defaults to "2026-
|
|
6
|
+
/** API version (defaults to "2026-04") */
|
|
7
7
|
apiVersion?: string;
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -21,7 +21,7 @@ export class ShopifyClient {
|
|
|
21
21
|
constructor(config: ShopifyClientConfig) {
|
|
22
22
|
this.storeUrl = config.storeUrl.replace(/^https?:\/\//, "").replace(/\/$/, "");
|
|
23
23
|
this.accessToken = config.accessToken;
|
|
24
|
-
this.apiVersion = config.apiVersion ?? "2026-
|
|
24
|
+
this.apiVersion = config.apiVersion ?? "2026-04";
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/** Execute a GraphQL query or mutation against the Shopify Admin API */
|