@elizaos/agent 2.0.0-alpha.421 → 2.0.0-alpha.425
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/package.json +4 -4
- package/packages/agent/src/api/accounts-routes.d.ts +11 -3
- package/packages/agent/src/api/accounts-routes.d.ts.map +1 -1
- package/packages/agent/src/api/accounts-routes.js +70 -123
- package/packages/agent/src/api/subscription-routes.js +27 -23
- package/packages/agent/src/runtime/plugin-role-gating.js +4 -3
- package/packages/app-core/src/api/client-agent.d.ts +63 -1
- package/packages/app-core/src/api/client-agent.d.ts.map +1 -1
- package/packages/app-core/src/api/client-agent.js +51 -0
- package/packages/app-core/src/components/accounts/AccountCard.d.ts +30 -0
- package/packages/app-core/src/components/accounts/AccountCard.d.ts.map +1 -0
- package/packages/app-core/src/components/accounts/AccountCard.js +183 -0
- package/packages/app-core/src/components/accounts/AccountList.d.ts +15 -0
- package/packages/app-core/src/components/accounts/AccountList.d.ts.map +1 -0
- package/packages/app-core/src/components/accounts/AccountList.js +80 -0
- package/packages/app-core/src/components/accounts/AddAccountDialog.d.ts +33 -0
- package/packages/app-core/src/components/accounts/AddAccountDialog.d.ts.map +1 -0
- package/packages/app-core/src/components/accounts/AddAccountDialog.js +277 -0
- package/packages/app-core/src/components/accounts/RotationStrategyPicker.d.ts +16 -0
- package/packages/app-core/src/components/accounts/RotationStrategyPicker.d.ts.map +1 -0
- package/packages/app-core/src/components/accounts/RotationStrategyPicker.js +50 -0
- package/packages/app-core/src/components/pages/PluginsView.d.ts.map +1 -1
- package/packages/app-core/src/components/pages/PluginsView.js +3 -34
- package/packages/app-core/src/components/settings/ProviderSwitcher.d.ts.map +1 -1
- package/packages/app-core/src/components/settings/ProviderSwitcher.js +2 -1
- package/packages/app-core/src/hooks/useAccounts.d.ts +41 -0
- package/packages/app-core/src/hooks/useAccounts.d.ts.map +1 -0
- package/packages/app-core/src/hooks/useAccounts.js +250 -0
- package/packages/app-core/src/i18n/locales/en.json +31 -31
- package/packages/app-core/src/i18n/locales/es.json +31 -31
- package/packages/app-core/src/i18n/locales/ko.json +31 -31
- package/packages/app-core/src/i18n/locales/pt.json +31 -31
- package/packages/app-core/src/i18n/locales/tl.json +31 -31
- package/packages/app-core/src/i18n/locales/vi.json +31 -31
- package/packages/app-core/src/i18n/locales/zh-CN.json +31 -31
- package/packages/typescript/src/features/basic-capabilities/index.d.ts +1 -0
- package/packages/typescript/src/features/basic-capabilities/index.d.ts.map +1 -1
- package/packages/typescript/src/features/basic-capabilities/index.js +4 -0
- package/packages/typescript/src/features/index.d.ts.map +1 -1
- package/packages/typescript/src/features/index.js +2 -7
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/core-status.d.ts +14 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/core-status.d.ts.map +1 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/core-status.js +48 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/create.d.ts +32 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/create.d.ts.map +1 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/create.js +502 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/eject.d.ts +16 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/eject.d.ts.map +1 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/eject.js +47 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/install.d.ts +18 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/install.d.ts.map +1 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/install.js +59 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/list-ejected.d.ts +14 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/list-ejected.d.ts.map +1 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/list-ejected.js +31 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/list.d.ts +14 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/list.d.ts.map +1 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/list.js +51 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/reinject.d.ts +15 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/reinject.d.ts.map +1 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/reinject.js +43 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/search.d.ts +15 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/search.d.ts.map +1 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/search.js +52 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/sync.d.ts +15 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/sync.d.ts.map +1 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/sync.js +48 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin.d.ts +25 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin.d.ts.map +1 -0
- package/packages/typescript/src/features/plugin-manager/actions/plugin.js +439 -0
- package/packages/typescript/src/features/plugin-manager/index.d.ts +2 -0
- package/packages/typescript/src/features/plugin-manager/index.d.ts.map +1 -1
- package/packages/typescript/src/features/plugin-manager/index.js +7 -10
- package/packages/typescript/src/features/plugin-manager/security.d.ts +33 -0
- package/packages/typescript/src/features/plugin-manager/security.d.ts.map +1 -0
- package/packages/typescript/src/features/plugin-manager/security.js +80 -0
- package/packages/app-core/src/runtime/plugin-manager-guard.d.ts +0 -12
- package/packages/app-core/src/runtime/plugin-manager-guard.d.ts.map +0 -1
- package/packages/app-core/src/runtime/plugin-manager-guard.js +0 -82
package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/list-ejected.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module features/plugin-manager/actions/plugin-handlers/list-ejected
|
|
3
|
+
*
|
|
4
|
+
* `list_ejected` sub-mode of the unified PLUGIN action. Lists plugins
|
|
5
|
+
* currently ejected to the local managed directory.
|
|
6
|
+
*/
|
|
7
|
+
export async function runListEjected({ runtime, callback, }) {
|
|
8
|
+
const service = runtime.getService("plugin_manager");
|
|
9
|
+
if (!service) {
|
|
10
|
+
const text = "Plugin manager service not available";
|
|
11
|
+
await callback?.({ text });
|
|
12
|
+
return { success: false, text };
|
|
13
|
+
}
|
|
14
|
+
const plugins = await service.listEjectedPlugins();
|
|
15
|
+
if (plugins.length === 0) {
|
|
16
|
+
const text = "No ejected plugins found.";
|
|
17
|
+
await callback?.({ text });
|
|
18
|
+
return { success: true, text, values: { mode: "list_ejected", count: 0 } };
|
|
19
|
+
}
|
|
20
|
+
const list = plugins
|
|
21
|
+
.map((p) => ` - ${p.name} (v${p.version}) at ${p.path}`)
|
|
22
|
+
.join("\n");
|
|
23
|
+
const text = `Ejected plugins (${plugins.length}):\n${list}`;
|
|
24
|
+
await callback?.({ text });
|
|
25
|
+
return {
|
|
26
|
+
success: true,
|
|
27
|
+
text,
|
|
28
|
+
values: { mode: "list_ejected", count: plugins.length },
|
|
29
|
+
data: { plugins },
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module features/plugin-manager/actions/plugin-handlers/list
|
|
3
|
+
*
|
|
4
|
+
* `list` sub-mode of the unified PLUGIN action. Reports the loaded
|
|
5
|
+
* plugins in the runtime as tracked by PluginManagerService.
|
|
6
|
+
*/
|
|
7
|
+
import type { ActionResult, HandlerCallback } from "../../../../types/components.ts";
|
|
8
|
+
import type { IAgentRuntime } from "../../../../types/runtime.ts";
|
|
9
|
+
export interface ListInput {
|
|
10
|
+
runtime: IAgentRuntime;
|
|
11
|
+
callback?: HandlerCallback;
|
|
12
|
+
}
|
|
13
|
+
export declare function runList({ runtime, callback, }: ListInput): Promise<ActionResult>;
|
|
14
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../../../../../../typescript/src/features/plugin-manager/actions/plugin-handlers/list.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACX,YAAY,EACZ,eAAe,EACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGlE,MAAM,WAAW,SAAS;IACzB,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC3B;AAED,wBAAsB,OAAO,CAAC,EAC7B,OAAO,EACP,QAAQ,GACR,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAkDnC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module features/plugin-manager/actions/plugin-handlers/list
|
|
3
|
+
*
|
|
4
|
+
* `list` sub-mode of the unified PLUGIN action. Reports the loaded
|
|
5
|
+
* plugins in the runtime as tracked by PluginManagerService.
|
|
6
|
+
*/
|
|
7
|
+
export async function runList({ runtime, callback, }) {
|
|
8
|
+
const service = runtime.getService("plugin_manager");
|
|
9
|
+
if (!service) {
|
|
10
|
+
const text = "Plugin manager service not available";
|
|
11
|
+
await callback?.({ text });
|
|
12
|
+
return { success: false, text };
|
|
13
|
+
}
|
|
14
|
+
const all = service.getAllPlugins();
|
|
15
|
+
const installed = await service.listInstalledPlugins();
|
|
16
|
+
const lines = [];
|
|
17
|
+
if (all.length === 0 && installed.length === 0) {
|
|
18
|
+
const text = "No plugins are loaded or installed.";
|
|
19
|
+
await callback?.({ text });
|
|
20
|
+
return { success: true, text, values: { mode: "list", count: 0 } };
|
|
21
|
+
}
|
|
22
|
+
if (all.length > 0) {
|
|
23
|
+
lines.push(`Loaded plugins (${all.length}):`);
|
|
24
|
+
for (const p of all) {
|
|
25
|
+
lines.push(` - ${p.name} [${p.status}]`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (installed.length > 0) {
|
|
29
|
+
if (lines.length > 0)
|
|
30
|
+
lines.push("");
|
|
31
|
+
lines.push(`Installed via registry (${installed.length}):`);
|
|
32
|
+
for (const p of installed) {
|
|
33
|
+
lines.push(` - ${p.name} (v${p.version}) at ${p.path}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const text = lines.join("\n");
|
|
37
|
+
await callback?.({ text });
|
|
38
|
+
return {
|
|
39
|
+
success: true,
|
|
40
|
+
text,
|
|
41
|
+
values: {
|
|
42
|
+
mode: "list",
|
|
43
|
+
loadedCount: all.length,
|
|
44
|
+
installedCount: installed.length,
|
|
45
|
+
},
|
|
46
|
+
data: {
|
|
47
|
+
loaded: all.map((p) => ({ name: p.name, status: p.status })),
|
|
48
|
+
installed,
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module features/plugin-manager/actions/plugin-handlers/reinject
|
|
3
|
+
*
|
|
4
|
+
* `reinject` sub-mode of the unified PLUGIN action. Removes an ejected
|
|
5
|
+
* plugin's local copy so the agent falls back to the npm-installed version.
|
|
6
|
+
*/
|
|
7
|
+
import type { ActionResult, HandlerCallback } from "../../../../types/components.ts";
|
|
8
|
+
import type { IAgentRuntime } from "../../../../types/runtime.ts";
|
|
9
|
+
export interface ReinjectInput {
|
|
10
|
+
runtime: IAgentRuntime;
|
|
11
|
+
name: string;
|
|
12
|
+
callback?: HandlerCallback;
|
|
13
|
+
}
|
|
14
|
+
export declare function runReinject({ runtime, name, callback, }: ReinjectInput): Promise<ActionResult>;
|
|
15
|
+
//# sourceMappingURL=reinject.d.ts.map
|
package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/reinject.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reinject.d.ts","sourceRoot":"","sources":["../../../../../../../../../typescript/src/features/plugin-manager/actions/plugin-handlers/reinject.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACX,YAAY,EACZ,eAAe,EACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGlE,MAAM,WAAW,aAAa;IAC7B,OAAO,EAAE,aAAa,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC3B;AAED,wBAAsB,WAAW,CAAC,EACjC,OAAO,EACP,IAAI,EACJ,QAAQ,GACR,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CA2CvC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module features/plugin-manager/actions/plugin-handlers/reinject
|
|
3
|
+
*
|
|
4
|
+
* `reinject` sub-mode of the unified PLUGIN action. Removes an ejected
|
|
5
|
+
* plugin's local copy so the agent falls back to the npm-installed version.
|
|
6
|
+
*/
|
|
7
|
+
export async function runReinject({ runtime, name, callback, }) {
|
|
8
|
+
const service = runtime.getService("plugin_manager");
|
|
9
|
+
if (!service) {
|
|
10
|
+
const text = "Plugin manager service not available";
|
|
11
|
+
await callback?.({ text });
|
|
12
|
+
return { success: false, text };
|
|
13
|
+
}
|
|
14
|
+
if (!name) {
|
|
15
|
+
const text = "Specify an ejected plugin name to reinject.";
|
|
16
|
+
await callback?.({ text });
|
|
17
|
+
return { success: false, text };
|
|
18
|
+
}
|
|
19
|
+
const result = await service.reinjectPlugin(name);
|
|
20
|
+
if (!result.success) {
|
|
21
|
+
const text = `Failed to reinject ${name}: ${result.error ?? "unknown error"}`;
|
|
22
|
+
await callback?.({ text });
|
|
23
|
+
return { success: false, text };
|
|
24
|
+
}
|
|
25
|
+
const text = `Reinjected ${result.pluginName} (removed ${result.removedPath})` +
|
|
26
|
+
(result.requiresRestart ? "\nRestart required." : "");
|
|
27
|
+
await callback?.({ text });
|
|
28
|
+
return {
|
|
29
|
+
success: true,
|
|
30
|
+
text,
|
|
31
|
+
values: {
|
|
32
|
+
mode: "reinject",
|
|
33
|
+
name: result.pluginName,
|
|
34
|
+
removedPath: result.removedPath,
|
|
35
|
+
},
|
|
36
|
+
data: {
|
|
37
|
+
success: result.success,
|
|
38
|
+
pluginName: result.pluginName,
|
|
39
|
+
removedPath: result.removedPath,
|
|
40
|
+
requiresRestart: result.requiresRestart,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module features/plugin-manager/actions/plugin-handlers/search
|
|
3
|
+
*
|
|
4
|
+
* `search` sub-mode of the unified PLUGIN action. Searches the elizaOS
|
|
5
|
+
* plugin registry by free-form query.
|
|
6
|
+
*/
|
|
7
|
+
import type { ActionResult, HandlerCallback } from "../../../../types/components.ts";
|
|
8
|
+
import type { IAgentRuntime } from "../../../../types/runtime.ts";
|
|
9
|
+
export interface SearchInput {
|
|
10
|
+
runtime: IAgentRuntime;
|
|
11
|
+
query: string;
|
|
12
|
+
callback?: HandlerCallback;
|
|
13
|
+
}
|
|
14
|
+
export declare function runSearch({ runtime, query, callback, }: SearchInput): Promise<ActionResult>;
|
|
15
|
+
//# sourceMappingURL=search.d.ts.map
|
package/packages/typescript/src/features/plugin-manager/actions/plugin-handlers/search.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../../../../../../../typescript/src/features/plugin-manager/actions/plugin-handlers/search.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EACX,YAAY,EACZ,eAAe,EACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGlE,MAAM,WAAW,WAAW;IAC3B,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC3B;AAED,wBAAsB,SAAS,CAAC,EAC/B,OAAO,EACP,KAAK,EACL,QAAQ,GACR,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CAkDrC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module features/plugin-manager/actions/plugin-handlers/search
|
|
3
|
+
*
|
|
4
|
+
* `search` sub-mode of the unified PLUGIN action. Searches the elizaOS
|
|
5
|
+
* plugin registry by free-form query.
|
|
6
|
+
*/
|
|
7
|
+
import { logger } from "../../../../logger.js";
|
|
8
|
+
export async function runSearch({ runtime, query, callback, }) {
|
|
9
|
+
const service = runtime.getService("plugin_manager");
|
|
10
|
+
if (!service) {
|
|
11
|
+
const text = "Plugin manager service not available";
|
|
12
|
+
await callback?.({ text });
|
|
13
|
+
return { success: false, text };
|
|
14
|
+
}
|
|
15
|
+
if (!query) {
|
|
16
|
+
const text = 'Specify a search query (e.g. "plugins for blockchain transactions").';
|
|
17
|
+
await callback?.({ text });
|
|
18
|
+
return { success: false, text };
|
|
19
|
+
}
|
|
20
|
+
logger.info(`[plugin-manager] search query="${query}"`);
|
|
21
|
+
const results = await service.searchRegistry(query);
|
|
22
|
+
if (results.length === 0) {
|
|
23
|
+
const text = `No plugins found matching "${query}". Try keywords like database, twitter, solana, voice.`;
|
|
24
|
+
await callback?.({ text });
|
|
25
|
+
return { success: true, text, values: { mode: "search", count: 0 } };
|
|
26
|
+
}
|
|
27
|
+
const lines = [
|
|
28
|
+
`Found ${results.length} plugin(s) matching "${query}":`,
|
|
29
|
+
"",
|
|
30
|
+
];
|
|
31
|
+
results.forEach((plugin, idx) => {
|
|
32
|
+
const score = plugin.score
|
|
33
|
+
? ` (match: ${(plugin.score * 100).toFixed(0)}%)`
|
|
34
|
+
: "";
|
|
35
|
+
lines.push(`${idx + 1}. ${plugin.name}${score}`);
|
|
36
|
+
if (plugin.description)
|
|
37
|
+
lines.push(` ${plugin.description}`);
|
|
38
|
+
if (plugin.tags && plugin.tags.length > 0) {
|
|
39
|
+
lines.push(` tags: ${plugin.tags.slice(0, 5).join(", ")}`);
|
|
40
|
+
}
|
|
41
|
+
if (plugin.version)
|
|
42
|
+
lines.push(` version: ${plugin.version}`);
|
|
43
|
+
});
|
|
44
|
+
const text = lines.join("\n");
|
|
45
|
+
await callback?.({ text });
|
|
46
|
+
return {
|
|
47
|
+
success: true,
|
|
48
|
+
text,
|
|
49
|
+
values: { mode: "search", count: results.length, query },
|
|
50
|
+
data: { results },
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module features/plugin-manager/actions/plugin-handlers/sync
|
|
3
|
+
*
|
|
4
|
+
* `sync` sub-mode of the unified PLUGIN action. Pulls upstream changes
|
|
5
|
+
* for an ejected plugin.
|
|
6
|
+
*/
|
|
7
|
+
import type { ActionResult, HandlerCallback } from "../../../../types/components.ts";
|
|
8
|
+
import type { IAgentRuntime } from "../../../../types/runtime.ts";
|
|
9
|
+
export interface SyncInput {
|
|
10
|
+
runtime: IAgentRuntime;
|
|
11
|
+
name: string;
|
|
12
|
+
callback?: HandlerCallback;
|
|
13
|
+
}
|
|
14
|
+
export declare function runSync({ runtime, name, callback, }: SyncInput): Promise<ActionResult>;
|
|
15
|
+
//# sourceMappingURL=sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../../../../../../../typescript/src/features/plugin-manager/actions/plugin-handlers/sync.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACX,YAAY,EACZ,eAAe,EACf,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAGlE,MAAM,WAAW,SAAS;IACzB,OAAO,EAAE,aAAa,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC3B;AAED,wBAAsB,OAAO,CAAC,EAC7B,OAAO,EACP,IAAI,EACJ,QAAQ,GACR,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAgDnC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module features/plugin-manager/actions/plugin-handlers/sync
|
|
3
|
+
*
|
|
4
|
+
* `sync` sub-mode of the unified PLUGIN action. Pulls upstream changes
|
|
5
|
+
* for an ejected plugin.
|
|
6
|
+
*/
|
|
7
|
+
export async function runSync({ runtime, name, callback, }) {
|
|
8
|
+
const service = runtime.getService("plugin_manager");
|
|
9
|
+
if (!service) {
|
|
10
|
+
const text = "Plugin manager service not available";
|
|
11
|
+
await callback?.({ text });
|
|
12
|
+
return { success: false, text };
|
|
13
|
+
}
|
|
14
|
+
if (!name) {
|
|
15
|
+
const text = "Specify an ejected plugin name to sync.";
|
|
16
|
+
await callback?.({ text });
|
|
17
|
+
return { success: false, text };
|
|
18
|
+
}
|
|
19
|
+
const result = await service.syncPlugin(name);
|
|
20
|
+
if (!result.success) {
|
|
21
|
+
const text = `Failed to sync ${name}: ${result.error ?? "unknown error"}`;
|
|
22
|
+
await callback?.({ text });
|
|
23
|
+
return { success: false, text };
|
|
24
|
+
}
|
|
25
|
+
const text = `Synced ${result.pluginName}: ${result.upstreamCommits} new upstream commit(s) at ${result.commitHash.slice(0, 8)}` +
|
|
26
|
+
(result.requiresRestart ? "\nRestart required." : "");
|
|
27
|
+
await callback?.({ text });
|
|
28
|
+
return {
|
|
29
|
+
success: true,
|
|
30
|
+
text,
|
|
31
|
+
values: {
|
|
32
|
+
mode: "sync",
|
|
33
|
+
name: result.pluginName,
|
|
34
|
+
upstreamCommits: result.upstreamCommits,
|
|
35
|
+
commitHash: result.commitHash,
|
|
36
|
+
},
|
|
37
|
+
data: {
|
|
38
|
+
success: result.success,
|
|
39
|
+
pluginName: result.pluginName,
|
|
40
|
+
ejectedPath: result.ejectedPath,
|
|
41
|
+
upstreamCommits: result.upstreamCommits,
|
|
42
|
+
localChanges: result.localChanges,
|
|
43
|
+
conflicts: result.conflicts,
|
|
44
|
+
commitHash: result.commitHash,
|
|
45
|
+
requiresRestart: result.requiresRestart,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module features/plugin-manager/actions/plugin
|
|
3
|
+
*
|
|
4
|
+
* Unified PLUGIN action with sub-modes (`install`, `eject`, `sync`,
|
|
5
|
+
* `reinject`, `list`, `list_ejected`, `search`, `core_status`, `create`).
|
|
6
|
+
*
|
|
7
|
+
* Validate gates on owner role + a keyword heuristic + a lookup against
|
|
8
|
+
* any pending PLUGIN_CREATE intent task in the same room (so the
|
|
9
|
+
* multi-turn choice reply still resolves).
|
|
10
|
+
*
|
|
11
|
+
* Handler is pure dispatch — sub-handlers live under ./plugin-handlers/.
|
|
12
|
+
*/
|
|
13
|
+
import type { Action } from "../../../types/components.ts";
|
|
14
|
+
import type { Memory } from "../../../types/memory.ts";
|
|
15
|
+
import type { IAgentRuntime } from "../../../types/runtime.ts";
|
|
16
|
+
export type PluginMode = "install" | "eject" | "sync" | "reinject" | "list" | "list_ejected" | "search" | "core_status" | "create";
|
|
17
|
+
type OwnerAccessFn = (runtime: IAgentRuntime, message: Memory) => Promise<boolean>;
|
|
18
|
+
interface PluginActionDeps {
|
|
19
|
+
hasOwnerAccess?: OwnerAccessFn;
|
|
20
|
+
repoRoot?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function createPluginAction(deps?: PluginActionDeps): Action;
|
|
23
|
+
export declare const pluginAction: Action;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../../../../typescript/src/features/plugin-manager/actions/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,EACX,MAAM,EAGN,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAiB/D,MAAM,MAAM,UAAU,GACnB,SAAS,GACT,OAAO,GACP,MAAM,GACN,UAAU,GACV,MAAM,GACN,cAAc,GACd,QAAQ,GACR,aAAa,GACb,QAAQ,CAAC;AA8BZ,KAAK,aAAa,GAAG,CACpB,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,MAAM,KACX,OAAO,CAAC,OAAO,CAAC,CAAC;AAEtB,UAAU,gBAAgB;IACzB,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAwHD,wBAAgB,kBAAkB,CAAC,IAAI,GAAE,gBAAqB,GAAG,MAAM,CAkUtE;AAED,eAAO,MAAM,YAAY,EAAE,MAA6B,CAAC"}
|