@hachej/boring-workspace 0.1.77 → 0.1.79

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,6 +1,6 @@
1
- import { PiPackageSource, PiExtensionFactory, CreateAgentAppOptions, ProvisionWorkspaceRuntimeOptions } from '@hachej/boring-agent/server';
1
+ import { PiPackageSource, PiExtensionFactory, CreateAgentAppOptions, WorkspaceAgentDispatcherResolver, ProvisionWorkspaceRuntimeOptions } from '@hachej/boring-agent/server';
2
2
  export { PiPackageSource as WorkspacePiPackageSource } from '@hachej/boring-agent/server';
3
- import { FastifyInstance } from 'fastify';
3
+ import { FastifyRequest, FastifyInstance } from 'fastify';
4
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 createInMemoryBridge, g as WorkspaceProvisioningContribution, h as WorkspaceRouteContribution } from './runtimeEnv-DKtVLBXo.js';
5
5
  export { i as ServerWorkspaceRuntimeProvisioningInput } from './runtimeEnv-DKtVLBXo.js';
6
6
  import { W as WorkspaceBridgeOperationDefinition } from './workspace-bridge-rpc-BHsOJMlW.js';
@@ -79,6 +79,17 @@ type WorkspaceAgentCreateOptions = Omit<CreateAgentAppOptions, "pi"> & {
79
79
  interface WorkspaceAgentServerPluginContext {
80
80
  workspaceRoot: string;
81
81
  bridge: ReturnType<typeof createInMemoryBridge>;
82
+ /** Available only to boot-time internal package plugins in standalone/local composition. */
83
+ trusted?: {
84
+ workspaceAgentDispatcherResolver: WorkspaceAgentDispatcherResolver;
85
+ actorResolver: (request: FastifyRequest) => Promise<{
86
+ workspaceId: string;
87
+ userId: string;
88
+ }> | {
89
+ workspaceId: string;
90
+ userId: string;
91
+ };
92
+ };
82
93
  }
83
94
  /**
84
95
  * Single install entry type. Accepts:
@@ -193,6 +204,7 @@ interface ResolveWorkspaceAgentServerPluginCollectionOptions extends Omit<Collec
193
204
  defaultPluginPackages?: string[];
194
205
  appRoot?: string;
195
206
  plugins?: WorkspacePluginEntry[];
207
+ trustedPluginContext?: WorkspaceAgentServerPluginContext["trusted"];
196
208
  }
197
209
  declare function buildWorkspaceContextPrompt(options?: {
198
210
  pluginAuthoringEnabled?: boolean;
@@ -3968,7 +3968,8 @@ function collectWorkspaceAgentServerPlugins(opts = {}) {
3968
3968
  };
3969
3969
  }
3970
3970
  async function resolveWorkspaceAgentServerPluginCollection(opts) {
3971
- const ctx = { workspaceRoot: opts.workspaceRoot, bridge: opts.bridge };
3971
+ const baseCtx = { workspaceRoot: opts.workspaceRoot, bridge: opts.bridge };
3972
+ const trustedCtx = { ...baseCtx, trusted: opts.trustedPluginContext };
3972
3973
  const defaultPluginPackagePaths = resolveDefaultWorkspacePluginPackagePaths({
3973
3974
  workspaceRoot: opts.workspaceRoot,
3974
3975
  defaultPluginPackages: opts.defaultPluginPackages,
@@ -3981,7 +3982,10 @@ async function resolveWorkspaceAgentServerPluginCollection(opts) {
3981
3982
  ];
3982
3983
  const resolvedPlugins = await Promise.all(
3983
3984
  allPluginEntries.map(async (entry) => {
3984
- const plugin = await resolveOnePluginEntry(entry, ctx);
3985
+ const plugin = await resolveOnePluginEntry(
3986
+ entry,
3987
+ "dir" in entry && entry.trust === "internal" ? trustedCtx : baseCtx
3988
+ );
3985
3989
  assertWorkspaceBridgeHandlersTrusted(plugin, entry);
3986
3990
  return plugin;
3987
3991
  })
@@ -4167,7 +4171,18 @@ async function createWorkspaceAgentServer(opts = {}) {
4167
4171
  workspaceRoot: validateUiPaths ? workspaceRoot : void 0
4168
4172
  });
4169
4173
  const pluginAuthoringEnabled = externalPluginsEnabled && (opts.installPluginAuthoring ?? workspaceFsCapability === "strong") && !(opts.excludeDefaults ?? []).includes("boring-ui-plugin-cli-package");
4174
+ let workspaceAgentDispatcherResolver;
4175
+ const trustedDispatcherProxy = {
4176
+ async resolve(actor, options) {
4177
+ if (!workspaceAgentDispatcherResolver) throw new Error("workspace agent dispatcher is not ready");
4178
+ return await workspaceAgentDispatcherResolver.resolve(actor, options);
4179
+ }
4180
+ };
4170
4181
  const pluginCollection = await resolveWorkspaceAgentServerPluginCollection({
4182
+ trustedPluginContext: {
4183
+ workspaceAgentDispatcherResolver: trustedDispatcherProxy,
4184
+ actorResolver: () => ({ workspaceId: opts.sessionId ?? "default", userId: "local" })
4185
+ },
4171
4186
  ...opts,
4172
4187
  workspaceRoot,
4173
4188
  bridge,
@@ -4278,6 +4293,10 @@ async function createWorkspaceAgentServer(opts = {}) {
4278
4293
  });
4279
4294
  const app = await createAgentApp({
4280
4295
  ...opts,
4296
+ onWorkspaceAgentDispatcher: (resolver) => {
4297
+ workspaceAgentDispatcherResolver = resolver;
4298
+ opts.onWorkspaceAgentDispatcher?.(resolver);
4299
+ },
4281
4300
  mode: resolvedMode,
4282
4301
  workspaceRoot,
4283
4302
  externalPlugins: externalPluginsEnabled,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hachej/boring-workspace",
3
- "version": "0.1.77",
3
+ "version": "0.1.79",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Workspace UI, plugin, and bridge package for composing chat, files, catalogs, editors, and app-specific panes.",
@@ -139,9 +139,9 @@
139
139
  "tailwind-merge": "^2.0.0",
140
140
  "zod": "^3.23.0",
141
141
  "zustand": "^5.0.14",
142
- "@hachej/boring-agent": "0.1.77",
143
- "@hachej/boring-ui-kit": "0.1.77",
144
- "@hachej/boring-ui-plugin-cli": "0.1.77"
142
+ "@hachej/boring-agent": "0.1.79",
143
+ "@hachej/boring-ui-kit": "0.1.79",
144
+ "@hachej/boring-ui-plugin-cli": "0.1.79"
145
145
  },
146
146
  "devDependencies": {
147
147
  "@tailwindcss/postcss": "^4.3.1",