@roj-ai/sdk 0.1.26 → 0.1.28
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/bootstrap.d.ts +2 -0
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/plugins/resources/index.d.ts +1 -1
- package/dist/plugins/resources/index.d.ts.map +1 -1
- package/dist/plugins/resources/plugin.d.ts +7 -1
- package/dist/plugins/resources/plugin.d.ts.map +1 -1
- package/dist/plugins/resources/plugin.js +25 -5
- package/dist/plugins/resources/plugin.js.map +1 -1
- package/dist/plugins/resources/resources.integration.test.d.ts +2 -0
- package/dist/plugins/resources/resources.integration.test.d.ts.map +1 -0
- package/dist/plugins/resources/resources.integration.test.js +62 -0
- package/dist/plugins/resources/resources.integration.test.js.map +1 -0
- package/dist/plugins/resources/state.d.ts +2 -0
- package/dist/plugins/resources/state.d.ts.map +1 -1
- package/dist/plugins/resources/state.js +1 -0
- package/dist/plugins/resources/state.js.map +1 -1
- package/dist/plugins/services/plugin.d.ts +4 -0
- package/dist/plugins/services/plugin.d.ts.map +1 -1
- package/dist/plugins/services/plugin.js +34 -9
- package/dist/plugins/services/plugin.js.map +1 -1
- package/dist/plugins/services/prompt.d.ts.map +1 -1
- package/dist/plugins/services/prompt.js +3 -0
- package/dist/plugins/services/prompt.js.map +1 -1
- package/dist/plugins/services/schema.d.ts +38 -4
- package/dist/plugins/services/schema.d.ts.map +1 -1
- package/dist/plugins/services/service.d.ts +11 -1
- package/dist/plugins/services/service.d.ts.map +1 -1
- package/dist/plugins/services/service.js +182 -46
- package/dist/plugins/services/service.js.map +1 -1
- package/dist/plugins/services/services.integration.test.js +128 -3
- package/dist/plugins/services/services.integration.test.js.map +1 -1
- package/dist/testing/preset-helpers.d.ts +1 -0
- package/dist/testing/preset-helpers.d.ts.map +1 -1
- package/dist/testing/preset-helpers.js +1 -0
- package/dist/testing/preset-helpers.js.map +1 -1
- package/dist/testing/test-harness.d.ts +9 -2
- package/dist/testing/test-harness.d.ts.map +1 -1
- package/dist/testing/test-harness.js +31 -3
- package/dist/testing/test-harness.js.map +1 -1
- package/dist/testing/test-harness.test.js +41 -0
- package/dist/testing/test-harness.test.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +10 -2
- package/src/plugins/resources/index.ts +1 -1
- package/src/plugins/resources/plugin.ts +35 -6
- package/src/plugins/resources/resources.integration.test.ts +68 -0
- package/src/plugins/resources/state.ts +2 -0
- package/src/plugins/services/plugin.ts +32 -9
- package/src/plugins/services/prompt.ts +3 -0
- package/src/plugins/services/schema.ts +40 -4
- package/src/plugins/services/service.ts +202 -52
- package/src/plugins/services/services.integration.test.ts +143 -4
- package/src/testing/preset-helpers.ts +2 -0
- package/src/testing/test-harness.test.ts +51 -0
- package/src/testing/test-harness.ts +37 -4
|
@@ -7,8 +7,9 @@ import type { LLMLogger } from '~/core/llm/logger.js'
|
|
|
7
7
|
import { LoggingLLMProvider } from '~/core/llm/logging-provider.js'
|
|
8
8
|
import { MockLLMProvider } from '~/core/llm/mock.js'
|
|
9
9
|
import type { MockInferenceHandler } from '~/core/llm/mock.js'
|
|
10
|
-
import type { PluginDefinition, PluginNotification } from '~/core/plugins/plugin-builder.js'
|
|
10
|
+
import type { CallerContext, PluginDefinition, PluginNotification } from '~/core/plugins/plugin-builder.js'
|
|
11
11
|
import type { Preset } from '~/core/preset/index.js'
|
|
12
|
+
import { selectPluginState } from '~/core/sessions/reducer.js'
|
|
12
13
|
import type { SessionId } from '~/core/sessions/schema.js'
|
|
13
14
|
import { SessionManager } from '~/core/sessions/session-manager.js'
|
|
14
15
|
import type { Session } from '~/core/sessions/session.js'
|
|
@@ -17,12 +18,18 @@ import { ToolExecutor } from '~/core/tools/executor.js'
|
|
|
17
18
|
import { silentLogger } from '~/lib/logger/logger.js'
|
|
18
19
|
import { createNodePlatform } from './node-platform.js'
|
|
19
20
|
import type { Result } from '~/lib/utils/result.js'
|
|
21
|
+
import { agentStatusPlugin } from '~/plugins/agent-status/plugin.js'
|
|
20
22
|
import { agentsPlugin } from '~/plugins/agents/plugin.js'
|
|
21
23
|
import { filesystemPlugin } from '~/plugins/filesystem/index.js'
|
|
24
|
+
import { gitStatusPlugin } from '~/plugins/git-status/index.js'
|
|
22
25
|
import { llmDebugPlugin } from '~/plugins/llm-debug/plugin.js'
|
|
23
26
|
import { logsPlugin } from '~/plugins/logs/index.js'
|
|
24
27
|
import { mailboxPlugin } from '~/plugins/mailbox/plugin.js'
|
|
28
|
+
import { resourcesPlugin } from '~/plugins/resources/plugin.js'
|
|
29
|
+
import { servicePlugin } from '~/plugins/services/plugin.js'
|
|
25
30
|
import { presetsPlugin, sessionLifecyclePlugin } from '~/plugins/session-lifecycle/index.js'
|
|
31
|
+
import { sessionStatsPlugin } from '~/plugins/session-stats/index.js'
|
|
32
|
+
import { sessionStatePlugin } from '~/plugins/session-state/plugin.js'
|
|
26
33
|
import { uploadsPlugin } from '~/plugins/uploads/plugin.js'
|
|
27
34
|
import { userChatPlugin } from '~/plugins/user-chat/plugin.js'
|
|
28
35
|
import { NotificationCollector } from './notification-collector.js'
|
|
@@ -36,13 +43,28 @@ const defaultSystemPlugins: readonly PluginDefinition<string, any, any, any, any
|
|
|
36
43
|
presetsPlugin,
|
|
37
44
|
mailboxPlugin,
|
|
38
45
|
agentsPlugin,
|
|
46
|
+
agentStatusPlugin,
|
|
39
47
|
userChatPlugin,
|
|
40
48
|
uploadsPlugin,
|
|
49
|
+
resourcesPlugin,
|
|
41
50
|
llmDebugPlugin,
|
|
51
|
+
servicePlugin,
|
|
42
52
|
filesystemPlugin,
|
|
43
53
|
logsPlugin,
|
|
54
|
+
sessionStatsPlugin,
|
|
55
|
+
sessionStatePlugin,
|
|
56
|
+
gitStatusPlugin,
|
|
44
57
|
]
|
|
45
58
|
|
|
59
|
+
const mergeSystemPlugins = <TPlugin extends { name: string }>(plugins: readonly TPlugin[]): TPlugin[] => {
|
|
60
|
+
const seen = new Set<string>()
|
|
61
|
+
return plugins.filter(plugin => {
|
|
62
|
+
if (seen.has(plugin.name)) return false
|
|
63
|
+
seen.add(plugin.name)
|
|
64
|
+
return true
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
|
|
46
68
|
/**
|
|
47
69
|
* TestHarness — boots a real SessionManager with MemoryEventStore,
|
|
48
70
|
* MockLLMProvider, and in-memory notification collection.
|
|
@@ -116,7 +138,7 @@ export class TestHarness {
|
|
|
116
138
|
onUserOutput: (n: PluginNotification) => this.notifications.push(n),
|
|
117
139
|
llmLogger: options.llmLogger,
|
|
118
140
|
platform,
|
|
119
|
-
systemPlugins: [...defaultSystemPlugins, ...(options.systemPlugins ?? [])],
|
|
141
|
+
systemPlugins: mergeSystemPlugins([...defaultSystemPlugins, ...(options.systemPlugins ?? [])]),
|
|
120
142
|
})
|
|
121
143
|
}
|
|
122
144
|
|
|
@@ -232,6 +254,13 @@ export class TestSession {
|
|
|
232
254
|
return this.harness.notifications.getAll()
|
|
233
255
|
}
|
|
234
256
|
|
|
257
|
+
/**
|
|
258
|
+
* Read a plugin-owned state slice from the live session state.
|
|
259
|
+
*/
|
|
260
|
+
getPluginState<TState = unknown>(key: string): TState | undefined {
|
|
261
|
+
return selectPluginState<TState>(this.session.state, key)
|
|
262
|
+
}
|
|
263
|
+
|
|
235
264
|
/**
|
|
236
265
|
* Get the current session state.
|
|
237
266
|
*/
|
|
@@ -259,8 +288,12 @@ export class TestSession {
|
|
|
259
288
|
/**
|
|
260
289
|
* Call a plugin method on the underlying session.
|
|
261
290
|
*/
|
|
262
|
-
async callPluginMethod(
|
|
263
|
-
|
|
291
|
+
async callPluginMethod(
|
|
292
|
+
method: string,
|
|
293
|
+
input: unknown,
|
|
294
|
+
options?: { agentId?: AgentId; caller?: CallerContext },
|
|
295
|
+
): Promise<Result<unknown, DomainError>> {
|
|
296
|
+
return this.session.callPluginMethod(method, input, options?.agentId, options?.caller)
|
|
264
297
|
}
|
|
265
298
|
|
|
266
299
|
/**
|