@hachej/boring-workspace 0.1.53 → 0.1.55

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.
@@ -1,11 +1,12 @@
1
1
  import { PiPackageSource, PiExtensionFactory, CreateAgentAppOptions, ProvisionWorkspaceRuntimeOptions } from '@hachej/boring-agent/server';
2
2
  export { PiPackageSource as WorkspacePiPackageSource } from '@hachej/boring-agent/server';
3
3
  import { FastifyInstance } from 'fastify';
4
- import { W as WorkspaceServerPlugin, S as ServerBootstrapOptions, B as BoringPluginSourceInput, a as BoringPluginFrontTargetResolver, b as WorkspaceProvisioningContribution, c as WorkspaceRouteContribution, d as createInMemoryBridge } from './createInMemoryBridge-siFWq_R_.js';
5
- export { e as ServerWorkspaceRuntimeProvisioningInput } from './createInMemoryBridge-siFWq_R_.js';
4
+ import { W as WorkspaceServerPlugin, S as ServerBootstrapOptions, a as WorkspaceBridgeRegistry, B as BridgeAuthPolicy, b as WorkspaceBridgeHandler, c as WorkspaceBridgeRuntimeEnvOptions, d as BoringPluginSourceInput, e as BoringPluginFrontTargetResolver, f as WorkspaceProvisioningContribution, g as WorkspaceRouteContribution, h as createInMemoryBridge } from './runtimeEnv-XVFZ1OkV.js';
5
+ export { i as ServerWorkspaceRuntimeProvisioningInput } from './runtimeEnv-XVFZ1OkV.js';
6
+ import { W as WorkspaceBridgeOperationDefinition } from './workspace-bridge-rpc-A98RA5o6.js';
6
7
  import './manifest-C2vVgH_e.js';
7
8
  import './agent-tool-CB0RQyx9.js';
8
- import './ui-bridge-LeBuZqfA.js';
9
+ import './ui-bridge-BbuUZ5iC.js';
9
10
 
10
11
  /**
11
12
  * Directory-source entry: `{ dir, options?, hotReload? }`. Resolved via
@@ -15,6 +16,12 @@ interface DirPluginEntry {
15
16
  dir: string;
16
17
  options?: unknown;
17
18
  hotReload?: boolean;
19
+ /**
20
+ * Directory-source plugins are untrusted for host bridge handler registration
21
+ * unless the app explicitly marks the entry as internal at boot. This keeps
22
+ * user/workspace plugin packages from self-registering privileged host RPCs.
23
+ */
24
+ trust?: "internal";
18
25
  }
19
26
  /**
20
27
  * Directory-source server entries are manifest-only: missing declarations mean
@@ -37,6 +44,8 @@ interface PluginResolveContext {
37
44
  * (no manifest server) returns false.
38
45
  */
39
46
  declare function hasDirServerPlugin(entry: DirPluginEntry): boolean;
47
+ declare function isTrustedWorkspaceBridgeHandlerEntry(entry: unknown): boolean;
48
+ declare function assertWorkspaceBridgeHandlersTrusted(plugin: WorkspaceServerPlugin, entry: unknown): void;
40
49
  /**
41
50
  * Single dispatch point for any entry shape:
42
51
  * - WorkspaceServerPlugin object → pass through
@@ -73,16 +82,19 @@ interface WorkspaceAgentServerPluginContext {
73
82
  /**
74
83
  * Single install entry type. Accepts:
75
84
  * - `WorkspaceServerPlugin` — pre-built plugin object.
76
- * - `{ dir, options?, hotReload? }` — directory-source plugin resolved
85
+ * - `{ dir, options?, hotReload?, trust? }` — directory-source plugin resolved
77
86
  * via explicit package.json#boring.server. Declared-but-missing throws.
78
87
  * hotReload uses jiti for diagnostic re-imports, while route/tool
79
- * registration is still boot-time.
88
+ * registration is still boot-time. Directory entries may contribute
89
+ * `workspaceBridgeHandlers` only when marked `trust: "internal"`.
80
90
  */
81
91
  type WorkspacePluginEntry = WorkspaceServerPlugin | DirPluginEntry;
82
92
  interface CreateWorkspaceAgentServerOptions extends WorkspaceAgentCreateOptions, Pick<ServerBootstrapOptions, "defaults" | "excludeDefaults"> {
83
93
  /**
84
- * Plugins to install. Accepts pre-built `WorkspaceServerPlugin` objects
85
- * or `{ dir, options?, hotReload? }` directory-source entries.
94
+ * Host-installed server plugins. Accepts pre-built `WorkspaceServerPlugin`
95
+ * objects or `{ dir, options?, hotReload?, trust? }` directory-source entries.
96
+ * Directory entries may contribute privileged `workspaceBridgeHandlers` only
97
+ * when explicitly marked `trust: "internal"`.
86
98
  */
87
99
  plugins?: WorkspacePluginEntry[];
88
100
  provisionWorkspace?: boolean;
@@ -111,6 +123,24 @@ interface CreateWorkspaceAgentServerOptions extends WorkspaceAgentCreateOptions,
111
123
  * live under the app directory.
112
124
  */
113
125
  appRoot?: string;
126
+ workspaceBridge?: {
127
+ registry?: WorkspaceBridgeRegistry;
128
+ runtimeTokenSecret?: string;
129
+ runtimeRefreshTokenSecret?: string;
130
+ browserAuthPolicy?: BridgeAuthPolicy;
131
+ /**
132
+ * Dev-only escape hatch for standalone/local CLI usage. This is never
133
+ * enabled implicitly: exposed hosts must provide browserAuthPolicy, and
134
+ * local tools that intentionally rely on the unauthenticated local-cli
135
+ * policy must opt in explicitly.
136
+ */
137
+ allowInsecureLocalCliBrowserAuth?: boolean;
138
+ handlers?: Array<{
139
+ definition: WorkspaceBridgeOperationDefinition;
140
+ handler: WorkspaceBridgeHandler;
141
+ }>;
142
+ runtimeEnv?: WorkspaceBridgeRuntimeEnvOptions;
143
+ };
114
144
  /** Additional plugin collection roots to scan alongside workspace .pi/extensions and package/plugin-derived roots. */
115
145
  additionalBoringPluginDirs?: BoringPluginSourceInput[];
116
146
  /**
@@ -144,6 +174,7 @@ interface WorkspaceAgentServerPluginCollection {
144
174
  provisioningContributions: WorkspaceProvisioningContribution[];
145
175
  runtimePlugins: WorkspaceRuntimeProvisioningInput[];
146
176
  routeContributions: WorkspaceRouteContribution[];
177
+ workspaceBridgeHandlers: WorkspaceServerPlugin["workspaceBridgeHandlers"];
147
178
  preservedUiStateKeys: string[];
148
179
  agentOptions: Pick<WorkspaceAgentCreateOptions, "extraTools" | "systemPromptAppend" | "pi">;
149
180
  }
@@ -199,4 +230,4 @@ interface ResolveDefaultWorkspacePluginPackagePathsOptions {
199
230
  */
200
231
  declare function resolveDefaultWorkspacePluginPackagePaths({ workspaceRoot, defaultPluginPackages, anchorDir, }?: ResolveDefaultWorkspacePluginPackagePathsOptions): string[];
201
232
 
202
- export { type CollectWorkspaceAgentServerPluginsOptions, type CreateWorkspaceAgentServerOptions, type DirPluginEntry, PLUGIN_AUTHORING_PROVISIONING_IDS, type PluginResolveContext, type ResolveDefaultWorkspacePluginPackagePathsOptions, type WorkspaceAgentPiOptions, type WorkspaceAgentServerPluginCollection, type WorkspaceAgentServerPluginContext, type WorkspacePluginEntry, type WorkspacePluginPackagePiSnapshot, WorkspaceProvisioningContribution, WorkspaceRouteContribution, type WorkspaceRuntimeProvisioningInput, buildWorkspaceContextPrompt, collectWorkspaceAgentServerPlugins, createWorkspaceAgentServer, hasDirServerPlugin, omitPluginAuthoringProvisioning, provisionWorkspaceAgentServer, readWorkspacePluginPackagePiSnapshot, readWorkspacePluginPackageRuntimePlugins, resolveDefaultWorkspacePluginPackagePaths, resolveOnePluginEntry };
233
+ export { type CollectWorkspaceAgentServerPluginsOptions, type CreateWorkspaceAgentServerOptions, type DirPluginEntry, PLUGIN_AUTHORING_PROVISIONING_IDS, type PluginResolveContext, type ResolveDefaultWorkspacePluginPackagePathsOptions, type WorkspaceAgentPiOptions, type WorkspaceAgentServerPluginCollection, type WorkspaceAgentServerPluginContext, type WorkspacePluginEntry, type WorkspacePluginPackagePiSnapshot, WorkspaceProvisioningContribution, WorkspaceRouteContribution, type WorkspaceRuntimeProvisioningInput, assertWorkspaceBridgeHandlersTrusted, buildWorkspaceContextPrompt, collectWorkspaceAgentServerPlugins, createWorkspaceAgentServer, hasDirServerPlugin, isTrustedWorkspaceBridgeHandlerEntry, omitPluginAuthoringProvisioning, provisionWorkspaceAgentServer, readWorkspacePluginPackagePiSnapshot, readWorkspacePluginPackageRuntimePlugins, resolveDefaultWorkspacePluginPackagePaths, resolveOnePluginEntry };