@yushaw/sanqian-chat 0.2.3 → 0.2.4
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/main/index.d.mts +54 -1
- package/dist/main/index.d.ts +54 -1
- package/dist/main/index.js +12 -2
- package/dist/main/index.mjs +12 -2
- package/package.json +1 -1
package/dist/main/index.d.mts
CHANGED
|
@@ -8,6 +8,51 @@ import { BrowserWindow } from 'electron';
|
|
|
8
8
|
* Application-facing types that hide SDK implementation details.
|
|
9
9
|
* These provide a stable API even as the underlying SDK evolves.
|
|
10
10
|
*/
|
|
11
|
+
/**
|
|
12
|
+
* Context data returned by a provider
|
|
13
|
+
*/
|
|
14
|
+
interface AppContextData {
|
|
15
|
+
/** Resource ID (for getById scenarios) */
|
|
16
|
+
id?: string;
|
|
17
|
+
/** Content to inject into conversation */
|
|
18
|
+
content: string;
|
|
19
|
+
/** Display title */
|
|
20
|
+
title?: string;
|
|
21
|
+
/** Summary for preview */
|
|
22
|
+
summary?: string;
|
|
23
|
+
/** Version for change detection (optional, Sanqian uses content hash if not provided) */
|
|
24
|
+
version?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* List item for context provider's getList method
|
|
28
|
+
*/
|
|
29
|
+
interface AppContextListItem {
|
|
30
|
+
/** Resource ID */
|
|
31
|
+
id: string;
|
|
32
|
+
/** Display title */
|
|
33
|
+
title: string;
|
|
34
|
+
/** Optional summary */
|
|
35
|
+
summary?: string;
|
|
36
|
+
/** Optional icon */
|
|
37
|
+
icon?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Context provider definition
|
|
41
|
+
*/
|
|
42
|
+
interface AppContextProvider {
|
|
43
|
+
/** Provider ID (unique within app) */
|
|
44
|
+
id: string;
|
|
45
|
+
/** Display name */
|
|
46
|
+
name: string;
|
|
47
|
+
/** Description */
|
|
48
|
+
description: string;
|
|
49
|
+
/** Get current state (for dynamic context) */
|
|
50
|
+
getCurrent?: () => Promise<AppContextData | null>;
|
|
51
|
+
/** Get list of available contexts */
|
|
52
|
+
getList?: () => Promise<AppContextListItem[]>;
|
|
53
|
+
/** Get full content by ID */
|
|
54
|
+
getById?: (id: string) => Promise<AppContextData | null>;
|
|
55
|
+
}
|
|
11
56
|
/**
|
|
12
57
|
* Application configuration for connecting to Sanqian
|
|
13
58
|
*/
|
|
@@ -22,6 +67,8 @@ interface AppConfig {
|
|
|
22
67
|
launchCommand?: string;
|
|
23
68
|
/** Tools provided by this application */
|
|
24
69
|
tools?: AppToolDefinition[];
|
|
70
|
+
/** Context providers for injecting app state */
|
|
71
|
+
contexts?: AppContextProvider[];
|
|
25
72
|
/** Enable debug logging */
|
|
26
73
|
debug?: boolean;
|
|
27
74
|
}
|
|
@@ -79,6 +126,12 @@ interface AppAgentConfig {
|
|
|
79
126
|
* @example ["pdf", "web-research", "xlsx"]
|
|
80
127
|
*/
|
|
81
128
|
skills?: string[];
|
|
129
|
+
/**
|
|
130
|
+
* Context providers to attach by default.
|
|
131
|
+
* Uses provider ID without app prefix (auto-prefixed with appName).
|
|
132
|
+
* @example ["editor-state"] -> "sanqian-notes:editor-state"
|
|
133
|
+
*/
|
|
134
|
+
attachedContexts?: string[];
|
|
82
135
|
}
|
|
83
136
|
/**
|
|
84
137
|
* Embedding configuration from Sanqian
|
|
@@ -415,4 +468,4 @@ declare class FloatingWindow {
|
|
|
415
468
|
getWindow(): BrowserWindow | null;
|
|
416
469
|
}
|
|
417
470
|
|
|
418
|
-
export { type AppAgentConfig, type AppClientEvent, type AppClientEventHandlers, type AppConfig, type AppEmbeddingConfig, type AppJsonSchemaProperty, type AppToolDefinition, type ChatUiConfigSerializable, FloatingWindow, type FloatingWindowConfig, type FloatingWindowOptions, SanqianAppClient, type WindowPosition };
|
|
471
|
+
export { type AppAgentConfig, type AppClientEvent, type AppClientEventHandlers, type AppConfig, type AppContextData, type AppContextListItem, type AppContextProvider, type AppEmbeddingConfig, type AppJsonSchemaProperty, type AppToolDefinition, type ChatUiConfigSerializable, FloatingWindow, type FloatingWindowConfig, type FloatingWindowOptions, SanqianAppClient, type WindowPosition };
|
package/dist/main/index.d.ts
CHANGED
|
@@ -8,6 +8,51 @@ import { BrowserWindow } from 'electron';
|
|
|
8
8
|
* Application-facing types that hide SDK implementation details.
|
|
9
9
|
* These provide a stable API even as the underlying SDK evolves.
|
|
10
10
|
*/
|
|
11
|
+
/**
|
|
12
|
+
* Context data returned by a provider
|
|
13
|
+
*/
|
|
14
|
+
interface AppContextData {
|
|
15
|
+
/** Resource ID (for getById scenarios) */
|
|
16
|
+
id?: string;
|
|
17
|
+
/** Content to inject into conversation */
|
|
18
|
+
content: string;
|
|
19
|
+
/** Display title */
|
|
20
|
+
title?: string;
|
|
21
|
+
/** Summary for preview */
|
|
22
|
+
summary?: string;
|
|
23
|
+
/** Version for change detection (optional, Sanqian uses content hash if not provided) */
|
|
24
|
+
version?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* List item for context provider's getList method
|
|
28
|
+
*/
|
|
29
|
+
interface AppContextListItem {
|
|
30
|
+
/** Resource ID */
|
|
31
|
+
id: string;
|
|
32
|
+
/** Display title */
|
|
33
|
+
title: string;
|
|
34
|
+
/** Optional summary */
|
|
35
|
+
summary?: string;
|
|
36
|
+
/** Optional icon */
|
|
37
|
+
icon?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Context provider definition
|
|
41
|
+
*/
|
|
42
|
+
interface AppContextProvider {
|
|
43
|
+
/** Provider ID (unique within app) */
|
|
44
|
+
id: string;
|
|
45
|
+
/** Display name */
|
|
46
|
+
name: string;
|
|
47
|
+
/** Description */
|
|
48
|
+
description: string;
|
|
49
|
+
/** Get current state (for dynamic context) */
|
|
50
|
+
getCurrent?: () => Promise<AppContextData | null>;
|
|
51
|
+
/** Get list of available contexts */
|
|
52
|
+
getList?: () => Promise<AppContextListItem[]>;
|
|
53
|
+
/** Get full content by ID */
|
|
54
|
+
getById?: (id: string) => Promise<AppContextData | null>;
|
|
55
|
+
}
|
|
11
56
|
/**
|
|
12
57
|
* Application configuration for connecting to Sanqian
|
|
13
58
|
*/
|
|
@@ -22,6 +67,8 @@ interface AppConfig {
|
|
|
22
67
|
launchCommand?: string;
|
|
23
68
|
/** Tools provided by this application */
|
|
24
69
|
tools?: AppToolDefinition[];
|
|
70
|
+
/** Context providers for injecting app state */
|
|
71
|
+
contexts?: AppContextProvider[];
|
|
25
72
|
/** Enable debug logging */
|
|
26
73
|
debug?: boolean;
|
|
27
74
|
}
|
|
@@ -79,6 +126,12 @@ interface AppAgentConfig {
|
|
|
79
126
|
* @example ["pdf", "web-research", "xlsx"]
|
|
80
127
|
*/
|
|
81
128
|
skills?: string[];
|
|
129
|
+
/**
|
|
130
|
+
* Context providers to attach by default.
|
|
131
|
+
* Uses provider ID without app prefix (auto-prefixed with appName).
|
|
132
|
+
* @example ["editor-state"] -> "sanqian-notes:editor-state"
|
|
133
|
+
*/
|
|
134
|
+
attachedContexts?: string[];
|
|
82
135
|
}
|
|
83
136
|
/**
|
|
84
137
|
* Embedding configuration from Sanqian
|
|
@@ -415,4 +468,4 @@ declare class FloatingWindow {
|
|
|
415
468
|
getWindow(): BrowserWindow | null;
|
|
416
469
|
}
|
|
417
470
|
|
|
418
|
-
export { type AppAgentConfig, type AppClientEvent, type AppClientEventHandlers, type AppConfig, type AppEmbeddingConfig, type AppJsonSchemaProperty, type AppToolDefinition, type ChatUiConfigSerializable, FloatingWindow, type FloatingWindowConfig, type FloatingWindowOptions, SanqianAppClient, type WindowPosition };
|
|
471
|
+
export { type AppAgentConfig, type AppClientEvent, type AppClientEventHandlers, type AppConfig, type AppContextData, type AppContextListItem, type AppContextProvider, type AppEmbeddingConfig, type AppJsonSchemaProperty, type AppToolDefinition, type ChatUiConfigSerializable, FloatingWindow, type FloatingWindowConfig, type FloatingWindowOptions, SanqianAppClient, type WindowPosition };
|
package/dist/main/index.js
CHANGED
|
@@ -45,13 +45,22 @@ var SanqianAppClient = class {
|
|
|
45
45
|
parameters: t.parameters,
|
|
46
46
|
handler: t.handler
|
|
47
47
|
}));
|
|
48
|
+
const contexts = config.contexts?.map((c) => ({
|
|
49
|
+
id: c.id,
|
|
50
|
+
name: c.name,
|
|
51
|
+
description: c.description,
|
|
52
|
+
getCurrent: c.getCurrent,
|
|
53
|
+
getList: c.getList,
|
|
54
|
+
getById: c.getById
|
|
55
|
+
}));
|
|
48
56
|
const sdkConfig = {
|
|
49
57
|
appName: config.appName,
|
|
50
58
|
appVersion: config.appVersion,
|
|
51
59
|
displayName: config.displayName,
|
|
52
60
|
launchCommand: config.launchCommand,
|
|
53
61
|
debug: config.debug,
|
|
54
|
-
tools
|
|
62
|
+
tools,
|
|
63
|
+
contexts
|
|
55
64
|
};
|
|
56
65
|
this.sdk = new import_sanqian_sdk.SanqianSDK(sdkConfig);
|
|
57
66
|
}
|
|
@@ -113,7 +122,8 @@ var SanqianAppClient = class {
|
|
|
113
122
|
description: config.description,
|
|
114
123
|
system_prompt: config.systemPrompt,
|
|
115
124
|
tools: config.tools,
|
|
116
|
-
skills: config.skills
|
|
125
|
+
skills: config.skills,
|
|
126
|
+
attached_contexts: config.attachedContexts
|
|
117
127
|
};
|
|
118
128
|
const result = await this.sdk.createAgent(sdkConfig);
|
|
119
129
|
return { agentId: result.agent_id };
|
package/dist/main/index.mjs
CHANGED
|
@@ -8,13 +8,22 @@ var SanqianAppClient = class {
|
|
|
8
8
|
parameters: t.parameters,
|
|
9
9
|
handler: t.handler
|
|
10
10
|
}));
|
|
11
|
+
const contexts = config.contexts?.map((c) => ({
|
|
12
|
+
id: c.id,
|
|
13
|
+
name: c.name,
|
|
14
|
+
description: c.description,
|
|
15
|
+
getCurrent: c.getCurrent,
|
|
16
|
+
getList: c.getList,
|
|
17
|
+
getById: c.getById
|
|
18
|
+
}));
|
|
11
19
|
const sdkConfig = {
|
|
12
20
|
appName: config.appName,
|
|
13
21
|
appVersion: config.appVersion,
|
|
14
22
|
displayName: config.displayName,
|
|
15
23
|
launchCommand: config.launchCommand,
|
|
16
24
|
debug: config.debug,
|
|
17
|
-
tools
|
|
25
|
+
tools,
|
|
26
|
+
contexts
|
|
18
27
|
};
|
|
19
28
|
this.sdk = new SanqianSDK(sdkConfig);
|
|
20
29
|
}
|
|
@@ -76,7 +85,8 @@ var SanqianAppClient = class {
|
|
|
76
85
|
description: config.description,
|
|
77
86
|
system_prompt: config.systemPrompt,
|
|
78
87
|
tools: config.tools,
|
|
79
|
-
skills: config.skills
|
|
88
|
+
skills: config.skills,
|
|
89
|
+
attached_contexts: config.attachedContexts
|
|
80
90
|
};
|
|
81
91
|
const result = await this.sdk.createAgent(sdkConfig);
|
|
82
92
|
return { agentId: result.agent_id };
|