@ericsanchezok/synergy-plugin 2.4.3 → 2.4.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/README.md +117 -20
- package/dist/artifact.d.ts +15 -0
- package/dist/artifact.js +52 -0
- package/dist/display.d.ts +2 -4
- package/dist/example.d.ts +1 -1
- package/dist/example.js +1 -1
- package/dist/hooks.js +3 -3
- package/dist/ids.d.ts +13 -0
- package/dist/ids.js +33 -0
- package/dist/index.d.ts +52 -14
- package/dist/index.js +6 -2
- package/dist/manifest.d.ts +92 -73
- package/dist/manifest.js +59 -47
- package/dist/market.d.ts +34 -0
- package/dist/market.js +65 -0
- package/dist/paths.d.ts +5 -0
- package/dist/paths.js +14 -0
- package/dist/permissions.d.ts +185 -0
- package/dist/permissions.js +51 -0
- package/dist/policy.d.ts +1 -0
- package/dist/policy.js +1 -0
- package/dist/spec.d.ts +3 -0
- package/dist/spec.js +31 -0
- package/dist/tool.d.ts +25 -4
- package/dist/ui.d.ts +17 -6
- package/dist/version.d.ts +2 -0
- package/dist/version.js +2 -0
- package/package.json +50 -15
package/dist/market.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export const OFFICIAL_GITHUB_PLUGIN_MARKETPLACE = {
|
|
2
|
+
registryRepo: "https://github.com/SII-Holos/synergy-plugins.git",
|
|
3
|
+
registryGithubRepo: "SII-Holos/synergy-plugins",
|
|
4
|
+
registryBaseBranch: "main",
|
|
5
|
+
registryBranchPrefix: "publish",
|
|
6
|
+
};
|
|
7
|
+
function encodeGitHubPath(value) {
|
|
8
|
+
return value
|
|
9
|
+
.split("/")
|
|
10
|
+
.filter((segment) => segment.length > 0)
|
|
11
|
+
.map(encodeURIComponent)
|
|
12
|
+
.join("/");
|
|
13
|
+
}
|
|
14
|
+
export function githubReleaseAssetUrl(input) {
|
|
15
|
+
const normalized = normalizeGitHubRepoUrl(input.repo);
|
|
16
|
+
if (!normalized)
|
|
17
|
+
return undefined;
|
|
18
|
+
return `${normalized}/releases/download/${encodeURIComponent(githubReleaseTag(input.version, input.tagTemplate))}/${encodeURIComponent(input.filename)}`;
|
|
19
|
+
}
|
|
20
|
+
export function githubReleaseTag(version, template = "v{version}") {
|
|
21
|
+
return template.replaceAll("{version}", version).replaceAll("{tag}", `v${version}`);
|
|
22
|
+
}
|
|
23
|
+
export function normalizeGitHubRepoUrl(input) {
|
|
24
|
+
if (!input)
|
|
25
|
+
return undefined;
|
|
26
|
+
const trimmed = input.trim();
|
|
27
|
+
const ssh = trimmed.match(/^git@github\.com:([^/]+\/[^/]+?)(?:\.git)?$/);
|
|
28
|
+
if (ssh)
|
|
29
|
+
return `https://github.com/${ssh[1]}`;
|
|
30
|
+
if (/^https:\/\/github\.com\/[^/]+\/[^/]+/.test(trimmed))
|
|
31
|
+
return trimmed.replace(/\.git$/, "");
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
export function githubRepoSlug(input) {
|
|
35
|
+
const normalized = normalizeGitHubRepoUrl(input);
|
|
36
|
+
const match = normalized?.match(/^https:\/\/github\.com\/([^/]+\/[^/]+?)(?:\/.*)?$/);
|
|
37
|
+
return match?.[1]?.replace(/\.git$/, "");
|
|
38
|
+
}
|
|
39
|
+
export function githubRawFileUrl(input) {
|
|
40
|
+
const slug = githubRepoSlug(input.repo);
|
|
41
|
+
if (!slug)
|
|
42
|
+
return undefined;
|
|
43
|
+
return `https://raw.githubusercontent.com/${slug}/${encodeGitHubPath(input.branch)}/${encodeGitHubPath(input.filepath)}`;
|
|
44
|
+
}
|
|
45
|
+
export function githubMarketplaceRegistryUrl(input = OFFICIAL_GITHUB_PLUGIN_MARKETPLACE) {
|
|
46
|
+
const url = githubRawFileUrl({
|
|
47
|
+
repo: input.registryRepo,
|
|
48
|
+
branch: input.registryBaseBranch,
|
|
49
|
+
filepath: "registry.json",
|
|
50
|
+
});
|
|
51
|
+
if (!url)
|
|
52
|
+
throw new Error(`Invalid GitHub plugin marketplace repo: ${input.registryRepo}`);
|
|
53
|
+
return url;
|
|
54
|
+
}
|
|
55
|
+
export const OFFICIAL_PLUGIN_REGISTRY_URL = githubMarketplaceRegistryUrl();
|
|
56
|
+
export const DEFAULT_PLUGIN_MARKETPLACE_CONFIG = {
|
|
57
|
+
enabled: true,
|
|
58
|
+
registryUrl: OFFICIAL_PLUGIN_REGISTRY_URL,
|
|
59
|
+
includeLocalRegistry: true,
|
|
60
|
+
cacheTtlMs: 3_600_000,
|
|
61
|
+
offlineCache: true,
|
|
62
|
+
requestTimeoutMs: 10_000,
|
|
63
|
+
artifactDownloadTimeoutMs: 60_000,
|
|
64
|
+
cliRequestTimeoutMs: 120_000,
|
|
65
|
+
};
|
package/dist/paths.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type SynergyPathEnv = Readonly<Record<string, string | undefined>>;
|
|
2
|
+
export declare function synergyHome(env?: SynergyPathEnv): string;
|
|
3
|
+
export declare function synergyRoot(env?: SynergyPathEnv): string;
|
|
4
|
+
export declare function synergySigningKeysDir(env?: SynergyPathEnv): string;
|
|
5
|
+
export declare function synergySigningKeyFile(env?: SynergyPathEnv): string;
|
package/dist/paths.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import os from "os";
|
|
2
|
+
import path from "path";
|
|
3
|
+
export function synergyHome(env = process.env) {
|
|
4
|
+
return env.SYNERGY_HOME || env.SYNERGY_TEST_HOME || os.homedir();
|
|
5
|
+
}
|
|
6
|
+
export function synergyRoot(env = process.env) {
|
|
7
|
+
return path.join(synergyHome(env), ".synergy");
|
|
8
|
+
}
|
|
9
|
+
export function synergySigningKeysDir(env = process.env) {
|
|
10
|
+
return path.join(synergyRoot(env), "keys");
|
|
11
|
+
}
|
|
12
|
+
export function synergySigningKeyFile(env = process.env) {
|
|
13
|
+
return path.join(synergySigningKeysDir(env), "signing-key.json");
|
|
14
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import type { PluginManifest } from "./manifest.js";
|
|
2
|
+
import type { BridgeMethodPolicy, RegistryPermissionItem, SynergyCapabilityCategory, SynergyCapabilityDefinition, SynergyCapabilityPermissionItem, SynergyCapabilityRisk, SynergyCapabilityRiskScope, SynergyCapabilitySeverity } from "@ericsanchezok/synergy-util/capability";
|
|
3
|
+
import { bridgeMethodPolicy as sharedBridgeMethodPolicy, capabilityNonBypassable, hasPublicTools, permissionCategoryForKey, permissionCapability, publicToolNames, stablePluginJson } from "@ericsanchezok/synergy-util/capability";
|
|
4
|
+
export type PluginRisk = SynergyCapabilityRisk;
|
|
5
|
+
export type PluginRiskScope = SynergyCapabilityRiskScope;
|
|
6
|
+
export declare const PLUGIN_PERMISSION_CATEGORIES: readonly ["tools", "files", "network", "data", "ui", "runtime", "hooks", "session", "browser", "identity", "communication", "platform"];
|
|
7
|
+
export type PluginPermissionCategory = SynergyCapabilityCategory;
|
|
8
|
+
export type PluginPermissionSeverity = SynergyCapabilitySeverity;
|
|
9
|
+
export type PluginPermissionItem = SynergyCapabilityPermissionItem;
|
|
10
|
+
export type PluginBridgeMethodPolicy = BridgeMethodPolicy;
|
|
11
|
+
export type { RegistryPermissionItem, SynergyCapabilityDefinition };
|
|
12
|
+
export type ManifestTool = NonNullable<NonNullable<PluginManifest["contributes"]>["tools"]>[number];
|
|
13
|
+
export declare const CAPABILITY_DETAILS: Record<string, SynergyCapabilityDefinition>;
|
|
14
|
+
export declare const PROFILE_CAPABILITIES: readonly ["file_read", "file_write", "shell_read", "shell", "shell_remote_write", "shell_remote_publish", "shell_destructive", "shell_hardline", "file_external_read", "file_external_write", "network_read", "network_request", "mcp_invoke", "mcp_spawn", "session_data", "workspace_data", "config:read", "config:write", "secrets", "task", "prompt_transform", "compaction_transform", "tool_execution_hook", "permission_hook", "event_hook", "config_hook", "identity_act", "communication_email", "channel_outbound", "platform_control", "protected_op", "session_state", "browser_interact", "browser_inspect", "browser_eval_readonly", "browser_eval_trusted", "browser_clipboard", "browser_download", "browser_viewport"];
|
|
15
|
+
export declare const PERMISSION_CAPABILITY: Record<string, string>;
|
|
16
|
+
export declare const PLUGIN_BRIDGE_METHOD_POLICY: {
|
|
17
|
+
readonly "config.get": {
|
|
18
|
+
readonly type: "capability";
|
|
19
|
+
readonly capability: "config:read";
|
|
20
|
+
};
|
|
21
|
+
readonly "config.set": {
|
|
22
|
+
readonly type: "capability";
|
|
23
|
+
readonly capability: "config:write";
|
|
24
|
+
};
|
|
25
|
+
readonly "config.replace": {
|
|
26
|
+
readonly type: "capability";
|
|
27
|
+
readonly capability: "config:write";
|
|
28
|
+
};
|
|
29
|
+
readonly "secret.get": {
|
|
30
|
+
readonly type: "capability";
|
|
31
|
+
readonly capability: "secrets";
|
|
32
|
+
};
|
|
33
|
+
readonly "secret.set": {
|
|
34
|
+
readonly type: "capability";
|
|
35
|
+
readonly capability: "secrets";
|
|
36
|
+
};
|
|
37
|
+
readonly "secret.delete": {
|
|
38
|
+
readonly type: "capability";
|
|
39
|
+
readonly capability: "secrets";
|
|
40
|
+
};
|
|
41
|
+
readonly "cache.get": {
|
|
42
|
+
readonly type: "unprivileged";
|
|
43
|
+
};
|
|
44
|
+
readonly "cache.set": {
|
|
45
|
+
readonly type: "unprivileged";
|
|
46
|
+
};
|
|
47
|
+
readonly "cache.delete": {
|
|
48
|
+
readonly type: "unprivileged";
|
|
49
|
+
};
|
|
50
|
+
readonly "file.read": {
|
|
51
|
+
readonly type: "capability";
|
|
52
|
+
readonly capability: "file_read";
|
|
53
|
+
};
|
|
54
|
+
readonly "file.write": {
|
|
55
|
+
readonly type: "capability";
|
|
56
|
+
readonly capability: "file_write";
|
|
57
|
+
};
|
|
58
|
+
readonly "network.fetch": {
|
|
59
|
+
readonly type: "capability";
|
|
60
|
+
readonly capability: "network_request";
|
|
61
|
+
};
|
|
62
|
+
readonly "shell.run": {
|
|
63
|
+
readonly type: "capability";
|
|
64
|
+
readonly capability: "shell";
|
|
65
|
+
};
|
|
66
|
+
readonly "session.getMetadata": {
|
|
67
|
+
readonly type: "capability";
|
|
68
|
+
readonly capability: "session_data";
|
|
69
|
+
};
|
|
70
|
+
readonly "workspace.getMetadata": {
|
|
71
|
+
readonly type: "capability";
|
|
72
|
+
readonly capability: "workspace_data";
|
|
73
|
+
};
|
|
74
|
+
readonly "task.run": {
|
|
75
|
+
readonly type: "capability";
|
|
76
|
+
readonly capability: "task";
|
|
77
|
+
};
|
|
78
|
+
readonly "tool.invoke": {
|
|
79
|
+
readonly type: "unprivileged";
|
|
80
|
+
};
|
|
81
|
+
readonly "permission.request": {
|
|
82
|
+
readonly type: "unprivileged";
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
export { capabilityNonBypassable, hasPublicTools, permissionCapability, permissionCategoryForKey, publicToolNames, stablePluginJson, };
|
|
86
|
+
export declare const pluginBridgeMethodPolicy: typeof sharedBridgeMethodPolicy;
|
|
87
|
+
export declare function capabilityRisk(capability: string, manifest?: PluginManifest): PluginRisk;
|
|
88
|
+
export declare function baseCapabilities(manifest: PluginManifest): string[];
|
|
89
|
+
export declare function toolCapabilities(manifest: PluginManifest, tool: ManifestTool): string[];
|
|
90
|
+
export declare function publicToolCapabilities(manifest: PluginManifest): string[];
|
|
91
|
+
export declare function computeRisk(capabilities: string[], manifest?: PluginManifest): PluginRisk;
|
|
92
|
+
export declare function capabilitiesForRiskScope(manifest: PluginManifest, scope: PluginRiskScope): string[];
|
|
93
|
+
export declare function pluginRisk(manifest: PluginManifest, input: {
|
|
94
|
+
scope: PluginRiskScope;
|
|
95
|
+
}): PluginRisk;
|
|
96
|
+
export declare function toolRisk(manifest: PluginManifest, tool: ManifestTool): PluginRisk;
|
|
97
|
+
export declare function permissionItems(manifest: PluginManifest, capabilities: string[]): PluginPermissionItem[];
|
|
98
|
+
export declare function registryPermissionSummary(manifest: PluginManifest, capabilities: string[]): RegistryPermissionItem[];
|
|
99
|
+
export declare function permissionsHashPayload(manifest: PluginManifest, capabilities: string[]): {
|
|
100
|
+
capabilities: string[];
|
|
101
|
+
permissions: {
|
|
102
|
+
tools?: {
|
|
103
|
+
filesystem?: "none" | "read" | "write";
|
|
104
|
+
shell?: boolean;
|
|
105
|
+
network?: boolean;
|
|
106
|
+
mcp?: "none" | "invoke" | "spawn";
|
|
107
|
+
task?: unknown;
|
|
108
|
+
};
|
|
109
|
+
data?: {
|
|
110
|
+
session?: "none" | "metadata" | "read";
|
|
111
|
+
workspace?: "none" | "metadata" | "read";
|
|
112
|
+
config?: "none" | "plugin" | "global";
|
|
113
|
+
secrets?: "none" | "own";
|
|
114
|
+
};
|
|
115
|
+
ui?: {
|
|
116
|
+
toolRenderers?: boolean;
|
|
117
|
+
partRenderers?: boolean;
|
|
118
|
+
workbenchPanels?: boolean;
|
|
119
|
+
appPanels?: boolean;
|
|
120
|
+
settings?: boolean;
|
|
121
|
+
messageSlots?: boolean;
|
|
122
|
+
themes?: boolean;
|
|
123
|
+
icons?: boolean;
|
|
124
|
+
appRoutes?: boolean;
|
|
125
|
+
commands?: boolean;
|
|
126
|
+
trustedImport?: boolean;
|
|
127
|
+
sandboxIframe?: boolean;
|
|
128
|
+
};
|
|
129
|
+
hooks?: {
|
|
130
|
+
promptTransform?: boolean;
|
|
131
|
+
compactionTransform?: boolean;
|
|
132
|
+
toolExecute?: "none" | "own" | "declared" | "all";
|
|
133
|
+
permissionAsk?: "none" | "own" | "all";
|
|
134
|
+
events?: "none" | "selected" | "all";
|
|
135
|
+
eventNames?: string[];
|
|
136
|
+
config?: boolean;
|
|
137
|
+
};
|
|
138
|
+
network?: {
|
|
139
|
+
connectDomains?: string[];
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
contributes: {
|
|
143
|
+
ui?: {
|
|
144
|
+
toolRenderers: boolean;
|
|
145
|
+
partRenderers: boolean;
|
|
146
|
+
workbenchPanels: boolean;
|
|
147
|
+
appPanels: boolean;
|
|
148
|
+
settings: boolean;
|
|
149
|
+
messageSlots: boolean;
|
|
150
|
+
themes: boolean;
|
|
151
|
+
icons: boolean;
|
|
152
|
+
appRoutes: boolean;
|
|
153
|
+
commands: boolean;
|
|
154
|
+
} | undefined;
|
|
155
|
+
mcp?: {} | undefined;
|
|
156
|
+
agents?: {
|
|
157
|
+
name: string | undefined;
|
|
158
|
+
mode: string | undefined;
|
|
159
|
+
hidden: boolean | undefined;
|
|
160
|
+
model: unknown;
|
|
161
|
+
modelRole: unknown;
|
|
162
|
+
permission: unknown;
|
|
163
|
+
}[] | undefined;
|
|
164
|
+
tools?: {
|
|
165
|
+
id: string | undefined;
|
|
166
|
+
name: string;
|
|
167
|
+
exposure: {
|
|
168
|
+
mode?: string;
|
|
169
|
+
} | undefined;
|
|
170
|
+
capabilities: {
|
|
171
|
+
filesystem?: "none" | "read" | "write";
|
|
172
|
+
shell?: boolean;
|
|
173
|
+
network?: boolean;
|
|
174
|
+
session?: "none" | "metadata" | "read";
|
|
175
|
+
workspace?: "none" | "metadata" | "read";
|
|
176
|
+
config?: "none" | "plugin" | "global";
|
|
177
|
+
} | undefined;
|
|
178
|
+
}[] | undefined;
|
|
179
|
+
permissions?: {} | undefined;
|
|
180
|
+
} | undefined;
|
|
181
|
+
lifecycle: {};
|
|
182
|
+
};
|
|
183
|
+
export declare function manifestHashPayload(manifest: PluginManifest): PluginManifest;
|
|
184
|
+
export declare function bridgeCapability(method: string): string | undefined;
|
|
185
|
+
export declare const pluginBridgeMethodCapability: typeof bridgeCapability;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { SYNERGY_CAPABILITY_CATEGORIES, SYNERGY_CAPABILITY_DETAILS, SYNERGY_PERMISSION_CAPABILITY, SYNERGY_PROFILE_CAPABILITIES, baseCapabilities as sharedBaseCapabilities, bridgeCapability as sharedBridgeCapability, bridgeMethodPolicy as sharedBridgeMethodPolicy, capabilitiesForRiskScope as sharedCapabilitiesForRiskScope, capabilityNonBypassable, capabilityRisk as sharedCapabilityRisk, computeRisk as sharedComputeRisk, hasPublicTools, manifestHashPayload as sharedManifestHashPayload, permissionCategoryForKey, permissionCapability, permissionItems as sharedPermissionItems, permissionsHashPayload as sharedPermissionsHashPayload, pluginRisk as sharedPluginRisk, publicToolCapabilities as sharedPublicToolCapabilities, publicToolNames, registryPermissionSummary as sharedRegistryPermissionSummary, stablePluginJson, toolCapabilities as sharedToolCapabilities, toolRisk as sharedToolRisk, SYNERGY_BRIDGE_METHOD_POLICY, } from "@ericsanchezok/synergy-util/capability";
|
|
2
|
+
export const PLUGIN_PERMISSION_CATEGORIES = SYNERGY_CAPABILITY_CATEGORIES;
|
|
3
|
+
export const CAPABILITY_DETAILS = SYNERGY_CAPABILITY_DETAILS;
|
|
4
|
+
export const PROFILE_CAPABILITIES = SYNERGY_PROFILE_CAPABILITIES;
|
|
5
|
+
export const PERMISSION_CAPABILITY = SYNERGY_PERMISSION_CAPABILITY;
|
|
6
|
+
export const PLUGIN_BRIDGE_METHOD_POLICY = SYNERGY_BRIDGE_METHOD_POLICY;
|
|
7
|
+
export { capabilityNonBypassable, hasPublicTools, permissionCapability, permissionCategoryForKey, publicToolNames, stablePluginJson, };
|
|
8
|
+
export const pluginBridgeMethodPolicy = sharedBridgeMethodPolicy;
|
|
9
|
+
function asCapabilityManifest(manifest) {
|
|
10
|
+
return manifest;
|
|
11
|
+
}
|
|
12
|
+
export function capabilityRisk(capability, manifest) {
|
|
13
|
+
return sharedCapabilityRisk(capability, manifest ? asCapabilityManifest(manifest) : undefined);
|
|
14
|
+
}
|
|
15
|
+
export function baseCapabilities(manifest) {
|
|
16
|
+
return sharedBaseCapabilities(asCapabilityManifest(manifest));
|
|
17
|
+
}
|
|
18
|
+
export function toolCapabilities(manifest, tool) {
|
|
19
|
+
return sharedToolCapabilities(asCapabilityManifest(manifest), tool);
|
|
20
|
+
}
|
|
21
|
+
export function publicToolCapabilities(manifest) {
|
|
22
|
+
return sharedPublicToolCapabilities(asCapabilityManifest(manifest));
|
|
23
|
+
}
|
|
24
|
+
export function computeRisk(capabilities, manifest) {
|
|
25
|
+
return sharedComputeRisk(capabilities, manifest ? asCapabilityManifest(manifest) : undefined);
|
|
26
|
+
}
|
|
27
|
+
export function capabilitiesForRiskScope(manifest, scope) {
|
|
28
|
+
return sharedCapabilitiesForRiskScope(asCapabilityManifest(manifest), scope);
|
|
29
|
+
}
|
|
30
|
+
export function pluginRisk(manifest, input) {
|
|
31
|
+
return sharedPluginRisk(asCapabilityManifest(manifest), input);
|
|
32
|
+
}
|
|
33
|
+
export function toolRisk(manifest, tool) {
|
|
34
|
+
return sharedToolRisk(asCapabilityManifest(manifest), tool);
|
|
35
|
+
}
|
|
36
|
+
export function permissionItems(manifest, capabilities) {
|
|
37
|
+
return sharedPermissionItems(asCapabilityManifest(manifest), capabilities);
|
|
38
|
+
}
|
|
39
|
+
export function registryPermissionSummary(manifest, capabilities) {
|
|
40
|
+
return sharedRegistryPermissionSummary(asCapabilityManifest(manifest), capabilities);
|
|
41
|
+
}
|
|
42
|
+
export function permissionsHashPayload(manifest, capabilities) {
|
|
43
|
+
return sharedPermissionsHashPayload(asCapabilityManifest(manifest), capabilities);
|
|
44
|
+
}
|
|
45
|
+
export function manifestHashPayload(manifest) {
|
|
46
|
+
return sharedManifestHashPayload(asCapabilityManifest(manifest));
|
|
47
|
+
}
|
|
48
|
+
export function bridgeCapability(method) {
|
|
49
|
+
return sharedBridgeCapability(method);
|
|
50
|
+
}
|
|
51
|
+
export const pluginBridgeMethodCapability = bridgeCapability;
|
package/dist/policy.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@ericsanchezok/synergy-util/plugin-policy";
|
package/dist/policy.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@ericsanchezok/synergy-util/plugin-policy";
|
package/dist/spec.d.ts
ADDED
package/dist/spec.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
function resolvePackageEntry(pluginDir) {
|
|
4
|
+
const pkgPath = path.join(pluginDir, "package.json");
|
|
5
|
+
if (!fs.existsSync(pkgPath))
|
|
6
|
+
return path.join(pluginDir, "index.ts");
|
|
7
|
+
try {
|
|
8
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
9
|
+
const exported = typeof pkg.exports === "string" ? pkg.exports : (pkg.exports?.["."]?.bun ?? pkg.exports?.["."]?.import);
|
|
10
|
+
const entry = exported ?? pkg.main ?? "index.ts";
|
|
11
|
+
return path.resolve(pluginDir, entry);
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return path.join(pluginDir, "index.ts");
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export function entryCandidatesFromPluginDir(pluginDir, manifest) {
|
|
18
|
+
return [
|
|
19
|
+
manifest.main ? path.resolve(pluginDir, manifest.main) : undefined,
|
|
20
|
+
path.join(pluginDir, "dist", "runtime", "index.js"),
|
|
21
|
+
path.join(pluginDir, "runtime", "index.js"),
|
|
22
|
+
resolvePackageEntry(pluginDir),
|
|
23
|
+
path.join(pluginDir, "src", "index.ts"),
|
|
24
|
+
path.join(pluginDir, "index.ts"),
|
|
25
|
+
path.join(pluginDir, "index.js"),
|
|
26
|
+
].filter(Boolean);
|
|
27
|
+
}
|
|
28
|
+
export function resolveEntryFromPluginDir(pluginDir, manifest) {
|
|
29
|
+
const candidates = entryCandidatesFromPluginDir(pluginDir, manifest);
|
|
30
|
+
return candidates.find((candidate) => fs.existsSync(candidate)) ?? candidates[0];
|
|
31
|
+
}
|
package/dist/tool.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import type { ToolDisplay } from "./display";
|
|
3
|
-
|
|
2
|
+
import type { ToolDisplay } from "./display.js";
|
|
3
|
+
import type { BunShell } from "./shell.js";
|
|
4
|
+
export type { ToolDisplay, ToolMediaDisplay } from "./display.js";
|
|
4
5
|
export type ToolContext = {
|
|
5
6
|
sessionID: string;
|
|
6
7
|
messageID: string;
|
|
@@ -13,6 +14,8 @@ export type ToolContext = {
|
|
|
13
14
|
patterns: string[];
|
|
14
15
|
metadata?: Record<string, any>;
|
|
15
16
|
}): Promise<void>;
|
|
17
|
+
/** Run shell commands through Synergy's current workspace shell boundary. */
|
|
18
|
+
$?: BunShell;
|
|
16
19
|
/** Run a Synergy delegated subagent task from inside this tool. */
|
|
17
20
|
task?: ToolTaskService;
|
|
18
21
|
/** Invoke another visible/explicitly-allowed Synergy tool from inside this tool. */
|
|
@@ -76,14 +79,13 @@ export interface ToolInvokeService {
|
|
|
76
79
|
}
|
|
77
80
|
export type ToolResultMetadata = Record<string, any> & {
|
|
78
81
|
display?: ToolDisplay;
|
|
79
|
-
primaryAttachmentIds?: string[];
|
|
80
82
|
};
|
|
81
83
|
export interface ToolResult {
|
|
82
84
|
title?: string;
|
|
83
85
|
output: string;
|
|
84
86
|
metadata?: ToolResultMetadata;
|
|
85
87
|
attachments?: Array<{
|
|
86
|
-
type: "
|
|
88
|
+
type: "attachment";
|
|
87
89
|
id: string;
|
|
88
90
|
sessionID: string;
|
|
89
91
|
messageID: string;
|
|
@@ -91,6 +93,25 @@ export interface ToolResult {
|
|
|
91
93
|
filename?: string;
|
|
92
94
|
url: string;
|
|
93
95
|
localPath?: string;
|
|
96
|
+
presentation?: {
|
|
97
|
+
hidden?: boolean;
|
|
98
|
+
renderer?: "image" | "video" | "audio" | "thumbnail" | "file";
|
|
99
|
+
size?: "original" | "small" | "medium" | "large";
|
|
100
|
+
crop?: boolean;
|
|
101
|
+
};
|
|
102
|
+
model?: {
|
|
103
|
+
mode: "summary";
|
|
104
|
+
summary?: string;
|
|
105
|
+
} | {
|
|
106
|
+
mode: "content";
|
|
107
|
+
text?: string;
|
|
108
|
+
} | {
|
|
109
|
+
mode: "provider-file";
|
|
110
|
+
summary?: string;
|
|
111
|
+
} | {
|
|
112
|
+
mode: "none";
|
|
113
|
+
};
|
|
114
|
+
metadata?: Record<string, any>;
|
|
94
115
|
}>;
|
|
95
116
|
}
|
|
96
117
|
export type ToolExposure = {
|
package/dist/ui.d.ts
CHANGED
|
@@ -23,21 +23,32 @@ export interface PluginPanelProps {
|
|
|
23
23
|
panelId: string;
|
|
24
24
|
scopeId?: string;
|
|
25
25
|
}
|
|
26
|
-
export
|
|
27
|
-
|
|
26
|
+
export interface PluginWorkbenchPanelTab {
|
|
27
|
+
id: string;
|
|
28
|
+
panelId: string;
|
|
29
|
+
resourceId?: string;
|
|
30
|
+
title?: string;
|
|
31
|
+
source?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface PluginWorkbenchPanelProps extends PluginPanelProps {
|
|
34
|
+
tab: PluginWorkbenchPanelTab;
|
|
35
|
+
onRequestClose?: () => void;
|
|
36
|
+
}
|
|
37
|
+
export type PluginWorkbenchPanel = Component<PluginWorkbenchPanelProps>;
|
|
38
|
+
export type PluginAppPanel = Component<PluginPanelProps>;
|
|
28
39
|
export interface PluginSettingsProps {
|
|
29
40
|
pluginId: string;
|
|
30
41
|
values: Record<string, unknown>;
|
|
31
42
|
onChange(values: Record<string, unknown>): void;
|
|
32
43
|
}
|
|
33
44
|
export type PluginSettingsSection = Component<PluginSettingsProps>;
|
|
34
|
-
export type
|
|
35
|
-
export interface
|
|
36
|
-
slot:
|
|
45
|
+
export type PluginMessageSlotName = "before-tools" | "after-tools" | "before-reasoning" | "after-reasoning";
|
|
46
|
+
export interface PluginMessageSlotProps {
|
|
47
|
+
slot: PluginMessageSlotName;
|
|
37
48
|
sessionId?: string;
|
|
38
49
|
messageId?: string;
|
|
39
50
|
}
|
|
40
|
-
export type
|
|
51
|
+
export type PluginMessageSlot = Component<PluginMessageSlotProps>;
|
|
41
52
|
export interface PluginCommandContext {
|
|
42
53
|
pluginId: string;
|
|
43
54
|
serverUrl: string;
|
package/dist/version.js
ADDED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@ericsanchezok/synergy-plugin",
|
|
4
|
-
"version": "2.4.
|
|
4
|
+
"version": "2.4.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -14,38 +14,73 @@
|
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
16
|
"typecheck": "tsgo --noEmit",
|
|
17
|
-
"build": "tsc"
|
|
17
|
+
"build": "bun run --cwd ../util build && rm -rf dist && tsc -p tsconfig.build.json"
|
|
18
18
|
},
|
|
19
19
|
"exports": {
|
|
20
20
|
".": {
|
|
21
|
-
"
|
|
22
|
-
"
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"import": "./dist/index.js"
|
|
23
23
|
},
|
|
24
24
|
"./tool": {
|
|
25
|
-
"
|
|
26
|
-
"
|
|
25
|
+
"types": "./dist/tool.d.ts",
|
|
26
|
+
"import": "./dist/tool.js"
|
|
27
27
|
},
|
|
28
28
|
"./display": {
|
|
29
|
-
"
|
|
30
|
-
"
|
|
29
|
+
"types": "./dist/display.d.ts",
|
|
30
|
+
"import": "./dist/display.js"
|
|
31
31
|
},
|
|
32
32
|
"./hooks": {
|
|
33
|
-
"
|
|
34
|
-
"
|
|
33
|
+
"types": "./dist/hooks.d.ts",
|
|
34
|
+
"import": "./dist/hooks.js"
|
|
35
|
+
},
|
|
36
|
+
"./permissions": {
|
|
37
|
+
"types": "./dist/permissions.d.ts",
|
|
38
|
+
"import": "./dist/permissions.js"
|
|
39
|
+
},
|
|
40
|
+
"./ids": {
|
|
41
|
+
"types": "./dist/ids.d.ts",
|
|
42
|
+
"import": "./dist/ids.js"
|
|
43
|
+
},
|
|
44
|
+
"./policy": {
|
|
45
|
+
"types": "./dist/policy.d.ts",
|
|
46
|
+
"import": "./dist/policy.js"
|
|
47
|
+
},
|
|
48
|
+
"./paths": {
|
|
49
|
+
"types": "./dist/paths.d.ts",
|
|
50
|
+
"import": "./dist/paths.js"
|
|
51
|
+
},
|
|
52
|
+
"./artifact": {
|
|
53
|
+
"types": "./dist/artifact.d.ts",
|
|
54
|
+
"import": "./dist/artifact.js"
|
|
55
|
+
},
|
|
56
|
+
"./market": {
|
|
57
|
+
"types": "./dist/market.d.ts",
|
|
58
|
+
"import": "./dist/market.js"
|
|
59
|
+
},
|
|
60
|
+
"./spec": {
|
|
61
|
+
"types": "./dist/spec.d.ts",
|
|
62
|
+
"import": "./dist/spec.js"
|
|
63
|
+
},
|
|
64
|
+
"./version": {
|
|
65
|
+
"types": "./dist/version.d.ts",
|
|
66
|
+
"import": "./dist/version.js"
|
|
35
67
|
},
|
|
36
68
|
"./shell": {
|
|
37
|
-
"
|
|
38
|
-
"
|
|
69
|
+
"types": "./dist/shell.d.ts",
|
|
70
|
+
"import": "./dist/shell.js"
|
|
39
71
|
},
|
|
40
72
|
"./ui": {
|
|
41
|
-
"
|
|
42
|
-
"
|
|
73
|
+
"types": "./dist/ui.d.ts",
|
|
74
|
+
"import": "./dist/ui.js"
|
|
43
75
|
}
|
|
44
76
|
},
|
|
45
77
|
"files": [
|
|
46
78
|
"dist"
|
|
47
79
|
],
|
|
48
|
-
"dependencies": {
|
|
80
|
+
"dependencies": {
|
|
81
|
+
"@ericsanchezok/synergy-sdk": "2.4.5",
|
|
82
|
+
"@ericsanchezok/synergy-util": "2.4.5"
|
|
83
|
+
},
|
|
49
84
|
"peerDependencies": {
|
|
50
85
|
"zod": ">=4.0.0"
|
|
51
86
|
}
|