@hachej/boring-workspace 0.1.62 → 0.1.63

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,12 +1,13 @@
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, 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-B8XJz-k4.js';
5
- export { i as ServerWorkspaceRuntimeProvisioningInput } from './runtimeEnv-B8XJz-k4.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 createInMemoryBridge, g as WorkspaceProvisioningContribution, h as WorkspaceRouteContribution } from './runtimeEnv-HolIkcoB.js';
5
+ export { i as ServerWorkspaceRuntimeProvisioningInput } from './runtimeEnv-HolIkcoB.js';
6
6
  import { W as WorkspaceBridgeOperationDefinition } from './workspace-bridge-rpc-A98RA5o6.js';
7
7
  import './manifest-C2vVgH_e.js';
8
8
  import './agent-tool-CB0RQyx9.js';
9
- import './ui-bridge-BbuUZ5iC.js';
9
+ import './ui-bridge-D2eO3epD.js';
10
+ import './filesystem-vhLA0ERd.js';
10
11
 
11
12
  /**
12
13
  * Directory-source entry: `{ dir, options?, hotReload? }`. Resolved via
@@ -2457,6 +2457,14 @@ function registerWorkspaceUiBridge(bridge) {
2457
2457
  // src/server/ui-control/tools/uiTools.ts
2458
2458
  import { stat } from "fs/promises";
2459
2459
  import { resolve as resolve6, isAbsolute as isAbsolute4, relative as relative3, win32 } from "path";
2460
+
2461
+ // src/shared/types/filesystem.ts
2462
+ var USER_FILESYSTEM_ID = "user";
2463
+ function normalizeUiFilesystem(filesystem) {
2464
+ return filesystem && filesystem.length > 0 ? filesystem : USER_FILESYSTEM_ID;
2465
+ }
2466
+
2467
+ // src/server/ui-control/tools/uiTools.ts
2460
2468
  function makeError(message) {
2461
2469
  return {
2462
2470
  content: [{ type: "text", text: message }],
@@ -2474,9 +2482,9 @@ function isPathAbsolute(filePath) {
2474
2482
  function isOutsideWorkspaceRel(rel) {
2475
2483
  return rel === ".." || rel.startsWith("../") || rel.startsWith("..\\") || isPathAbsolute(rel);
2476
2484
  }
2477
- function validatePathSyntax(relPath, workspaceRoot) {
2485
+ function validatePathSyntax(relPath, workspaceRoot, opts = {}) {
2478
2486
  const rootHint = workspaceRoot ? ` (${workspaceRoot})` : "";
2479
- if (isPathAbsolute(relPath)) {
2487
+ if (!opts.allowAbsolute && isPathAbsolute(relPath)) {
2480
2488
  return {
2481
2489
  ok: false,
2482
2490
  reason: `path "${relPath}" is absolute \u2014 pass a path relative to the workspace root${rootHint}.`
@@ -2558,7 +2566,10 @@ function isVerified(kind, params, state) {
2558
2566
  const tabs = state.openTabs ?? [];
2559
2567
  if (kind === "openFile") {
2560
2568
  const path = typeof params.path === "string" ? params.path : null;
2561
- return path !== null && tabs.some((t) => t.params?.path === path);
2569
+ const filesystem = normalizeUiFilesystem(typeof params.filesystem === "string" ? params.filesystem : void 0);
2570
+ return path !== null && tabs.some(
2571
+ (t) => t.params?.path === path && normalizeUiFilesystem(typeof t.params?.filesystem === "string" ? t.params.filesystem : void 0) === filesystem
2572
+ );
2562
2573
  }
2563
2574
  if (kind === "openPanel") {
2564
2575
  const id = typeof params.id === "string" ? params.id : null;
@@ -2598,7 +2609,7 @@ function createExecUiTool(workspaceBridge, opts = {}) {
2598
2609
  "",
2599
2610
  "Supported `kind` values:",
2600
2611
  "",
2601
- " openFile params: { path: string, mode?: 'view'|'edit'|'diff' }",
2612
+ " openFile params: { path: string, mode?: 'view'|'edit'|'diff', filesystem?: 'user'|'company_context' }",
2602
2613
  " \u2014 Open a file in the workbench. The workbench pane",
2603
2614
  " auto-opens if collapsed. Path must be relative to the",
2604
2615
  " workspace root (e.g. `src/foo.ts`, not `foo.ts` if it",
@@ -2613,6 +2624,8 @@ function createExecUiTool(workspaceBridge, opts = {}) {
2613
2624
  " is found.",
2614
2625
  " If the path is a folder, openFile reveals/selects it in",
2615
2626
  " the file tree instead of opening an editor tab.",
2627
+ " Omit filesystem for normal workspace files (defaults to user). Use filesystem:'company_context' only when a company_context binding is advertised.",
2628
+ " Path prefixes such as company_context:/x do not switch filesystem identity.",
2616
2629
  " Example: {kind:'openFile', params:{path:'README.md'}}",
2617
2630
  "",
2618
2631
  " openPanel params: { id: string, component: string,",
@@ -2627,11 +2640,15 @@ function createExecUiTool(workspaceBridge, opts = {}) {
2627
2640
  " component:'chart-canvas',",
2628
2641
  " params:{seriesId:'GDPC1'}}}",
2629
2642
  "",
2630
- " openSurface params: { kind: string, target: string, meta?: object }",
2643
+ " openSurface params: { kind: string, target: string, filesystem?: 'user'|'company_context', meta?: object }",
2631
2644
  " \u2014 Open an app-owned target through the workspace",
2632
2645
  " surface resolver registry. Use this when the app",
2633
2646
  " defines the mapping from domain target to panel",
2634
2647
  " component, for example a catalog row.",
2648
+ " For kind:'workspace.open.path', filesystem follows the",
2649
+ " same rules as openFile: omit for user files; pass",
2650
+ " filesystem:'company_context' only for advertised company",
2651
+ " context bindings; path prefixes do not switch identity.",
2635
2652
  " Example: {kind:'openSurface', params:{",
2636
2653
  " kind:'catalog.open-row',",
2637
2654
  " target:'orders_daily',",
@@ -2705,29 +2722,32 @@ function createExecUiTool(workspaceBridge, opts = {}) {
2705
2722
  `${kind}: ${kind === "navigateToLine" ? "file" : "path"} param is required`
2706
2723
  );
2707
2724
  }
2708
- const syntax = validatePathSyntax(relPath, workspaceRoot);
2725
+ const filesystem = kind === "openFile" ? normalizeUiFilesystem(typeof cmdParams.filesystem === "string" ? cmdParams.filesystem : void 0) : USER_FILESYSTEM_ID;
2726
+ const syntax = validatePathSyntax(relPath, workspaceRoot, { allowAbsolute: filesystem !== USER_FILESYSTEM_ID });
2709
2727
  if (!syntax.ok) return makeError(syntax.reason);
2710
- if (workspaceRoot) {
2711
- const check = await validateExistingPath(workspaceRoot, relPath);
2712
- if (!check.ok) {
2713
- return makeError(check.reason);
2714
- }
2715
- if (kind === "openFile" && check.kind === "dir") {
2716
- effectiveKind = "expandToFile";
2717
- }
2718
- } else if (resolvePathKind) {
2719
- const pathKind = await resolvePathKind(relPath);
2720
- if (!pathKind) {
2721
- return makeError(`file not found at "${relPath}". Try find or grep to locate the file before retrying openFile.`);
2722
- }
2723
- if (kind === "openFile" && pathKind === "dir") {
2724
- effectiveKind = "expandToFile";
2728
+ if (filesystem === USER_FILESYSTEM_ID) {
2729
+ if (workspaceRoot) {
2730
+ const check = await validateExistingPath(workspaceRoot, relPath);
2731
+ if (!check.ok) {
2732
+ return makeError(check.reason);
2733
+ }
2734
+ if (kind === "openFile" && check.kind === "dir") {
2735
+ effectiveKind = "expandToFile";
2736
+ }
2737
+ } else if (resolvePathKind) {
2738
+ const pathKind = await resolvePathKind(relPath);
2739
+ if (!pathKind) {
2740
+ return makeError(`file not found at "${relPath}". Try find or grep to locate the file before retrying openFile.`);
2741
+ }
2742
+ if (kind === "openFile" && pathKind === "dir") {
2743
+ effectiveKind = "expandToFile";
2744
+ }
2725
2745
  }
2726
2746
  }
2727
2747
  }
2728
2748
  try {
2729
2749
  const command = { kind: effectiveKind, params: cmdParams };
2730
- const result = await workspaceBridge.emitUiEffect(command);
2750
+ const result = await workspaceBridge.postCommand(command);
2731
2751
  if (result.status === "error") {
2732
2752
  return {
2733
2753
  content: [{ type: "text", text: JSON.stringify(result) }],
package/dist/events.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { F as FilesystemId } from './filesystem-vhLA0ERd.js';
2
+
1
3
  /**
2
4
  * Tiny typed event bus. ~30 lines, no runtime deps.
3
5
  *
@@ -58,9 +60,12 @@ type WorkspacePanelMatch = {
58
60
  } | {
59
61
  param: string;
60
62
  value: unknown;
63
+ } | {
64
+ params: Record<string, unknown>;
61
65
  } | {
62
66
  paramPrefix: string;
63
67
  value: string;
68
+ params?: Record<string, unknown>;
64
69
  };
65
70
  /**
66
71
  * Discriminated origin metadata. Encoded as a union (rather than a
@@ -148,17 +153,21 @@ interface WorkspaceHostEventMap {
148
153
  */
149
154
  interface WorkspacePluginEventMap {
150
155
  "filesystem:file.changed": EventMeta & {
156
+ filesystem?: FilesystemId;
151
157
  path: string;
152
158
  };
153
159
  "filesystem:file.created": EventMeta & {
160
+ filesystem?: FilesystemId;
154
161
  path: string;
155
162
  kind: "file" | "dir";
156
163
  };
157
164
  "filesystem:file.moved": EventMeta & {
165
+ filesystem?: FilesystemId;
158
166
  from: string;
159
167
  to: string;
160
168
  };
161
169
  "filesystem:file.deleted": EventMeta & {
170
+ filesystem?: FilesystemId;
162
171
  path: string;
163
172
  };
164
173
  }
@@ -0,0 +1,17 @@
1
+ type FilesystemId = "user" | "company_context" | (string & {});
2
+ declare const USER_FILESYSTEM_ID = "user";
3
+ declare const COMPANY_CONTEXT_FILESYSTEM_ID = "company_context";
4
+ interface UiFileResource {
5
+ readonly filesystem: FilesystemId;
6
+ readonly path: string;
7
+ }
8
+ type UiFileResourceInput = string | {
9
+ readonly filesystem?: FilesystemId | null;
10
+ readonly path: string;
11
+ };
12
+ declare function normalizeUiFilesystem(filesystem: FilesystemId | null | undefined): FilesystemId;
13
+ declare function normalizeUiFileResource(input: UiFileResourceInput): UiFileResource;
14
+ declare function uiFileResourceKey(resource: UiFileResourceInput): string;
15
+ declare function withUiFileResource<T extends Record<string, unknown>>(value: T, fallbackFilesystem?: FilesystemId | null): T & UiFileResource;
16
+
17
+ export { COMPANY_CONTEXT_FILESYSTEM_ID as C, type FilesystemId as F, USER_FILESYSTEM_ID as U, type UiFileResource as a, type UiFileResourceInput as b, normalizeUiFilesystem as c, normalizeUiFileResource as n, uiFileResourceKey as u, withUiFileResource as w };
package/dist/plugin.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import { ComponentType, ReactNode } from 'react';
2
- import { P as PaneProps, a as PanelConfig, g as WorkspaceSourceProps, h as SurfaceResolverExample, S as SurfaceOpenRequest, c as SurfacePanelResolution } from './surface-CDklwi48.js';
3
- export { W as WORKSPACE_OPEN_PATH_SURFACE_KIND, i as WorkspaceSourceOpenPanelConfig } from './surface-CDklwi48.js';
2
+ import { P as PaneProps, a as PanelConfig, g as WorkspaceSourceProps, h as SurfaceResolverExample, S as SurfaceOpenRequest, c as SurfacePanelResolution } from './surface-aLQ_Hryw.js';
3
+ export { W as WORKSPACE_OPEN_PATH_SURFACE_KIND, i as WorkspaceSourceOpenPanelConfig } from './surface-aLQ_Hryw.js';
4
4
  export { B as BoringPackageBoringField, a as BoringPackagePiField, b as BoringPackagePiSource, c as BoringPackagePiSourceObject, d as BoringPluginManifestErrorCode, e as BoringPluginManifestIssue, f as BoringPluginManifestValidationResult, g as BoringPluginPackageJson, i as isSafePluginRelativePath, h as isValidBoringPluginId, v as validateBoringPluginManifest } from './manifest-C2vVgH_e.js';
5
- import { a as UiCommand, C as CommandResult, U as UiBridge } from './ui-bridge-BbuUZ5iC.js';
5
+ import { a as UiCommand, C as CommandResult, U as UiBridge } from './ui-bridge-D2eO3epD.js';
6
6
  import 'dockview-react';
7
+ import './filesystem-vhLA0ERd.js';
7
8
 
8
9
  type CatalogBadge = {
9
10
  /** 1–4 char mono code rendered as a chip. */
@@ -3,7 +3,7 @@ import { PiPackageSource, PluginSkillSource, ProvisionWorkspaceRuntimeOptions, R
3
3
  import { FastifyPluginAsync } from 'fastify';
4
4
  import { A as AgentTool } from './agent-tool-CB0RQyx9.js';
5
5
  import { B as BridgeAuthContext, W as WorkspaceBridgeOperationDefinition, a as WorkspaceBridgeCallRequest, b as WorkspaceBridgeCallResponse, d as BridgeCallerClass } from './workspace-bridge-rpc-A98RA5o6.js';
6
- import { a as UiCommand, C as CommandResult, W as WorkspaceBridge } from './ui-bridge-BbuUZ5iC.js';
6
+ import { a as UiCommand, C as CommandResult, W as WorkspaceBridge } from './ui-bridge-D2eO3epD.js';
7
7
 
8
8
  type BoringPluginNativeFrontTargetTrust$1 = "local-trusted-native";
9
9
  /**
package/dist/server.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { j as WorkspaceServerPluginAsset, a as WorkspaceBridgeRegistry, B as BridgeAuthPolicy, b as WorkspaceBridgeHandler, k as BoringServerPluginManifest, d as BoringPluginSourceInput, e as BoringPluginFrontTargetResolver, l as BoringPluginListEntry, m as BoringPluginFrontTarget, n as BoringPluginSource, o as BoringPluginEvent, P as PluginRestartSurface } from './runtimeEnv-B8XJz-k4.js';
2
- export { p as BoringPluginFrontTargetResolverContext, q as BoringPluginNativeFrontTarget, r as BoringPluginNativeFrontTargetTrust, s as BoringPluginSourceKind, t as BridgeAuthPolicyInput, u as BridgeAuthPolicyRequestLike, v as BridgeAuthResolution, w as BridgePrincipal, x as BridgeWorkspaceGrant, y as BrowserBridgeAuthPolicyOptions, C as CreateWorkspaceBridgeRuntimeEnvContributionOptions, L as LocalCliBridgeAuthPolicyOptions, R as RegisterWorkspaceBridgeHandlerOptions, S as ServerBootstrapOptions, z as ServerBootstrapResult, A as WorkspaceBridgeCallContext, D as WorkspaceBridgeHandlerArgs, E as WorkspaceBridgeHandlerContribution, F as WorkspaceBridgeRegistryCallOptions, G as WorkspaceBridgeRegistryLogger, H as WorkspaceBridgeRegistryOptions, I as WorkspaceBridgeRuntimeEnvDisabledReason, c as WorkspaceBridgeRuntimeEnvOptions, J as WorkspaceBridgeRuntimePlacement, g as WorkspaceProvisioningContribution, h as WorkspaceRouteContribution, W as WorkspaceServerPlugin, K as bootstrapServer, M as createBrowserBridgeAuthPolicy, f as createInMemoryBridge, N as createLocalCliBridgeAuthPolicy, O as createWorkspaceBridgeRegistry, Q as createWorkspaceBridgeRuntimeEnvContribution, T as defineServerPlugin, U as resolveBridgeCallUrl, V as resolveBridgeTokenUrl, X as validateServerPlugin, Y as validateWorkspaceBridgeOperationDefinition } from './runtimeEnv-B8XJz-k4.js';
1
+ import { j as WorkspaceServerPluginAsset, a as WorkspaceBridgeRegistry, B as BridgeAuthPolicy, b as WorkspaceBridgeHandler, k as BoringServerPluginManifest, d as BoringPluginSourceInput, e as BoringPluginFrontTargetResolver, l as BoringPluginListEntry, m as BoringPluginFrontTarget, n as BoringPluginSource, o as BoringPluginEvent, P as PluginRestartSurface } from './runtimeEnv-HolIkcoB.js';
2
+ export { p as BoringPluginFrontTargetResolverContext, q as BoringPluginNativeFrontTarget, r as BoringPluginNativeFrontTargetTrust, s as BoringPluginSourceKind, t as BridgeAuthPolicyInput, u as BridgeAuthPolicyRequestLike, v as BridgeAuthResolution, w as BridgePrincipal, x as BridgeWorkspaceGrant, y as BrowserBridgeAuthPolicyOptions, C as CreateWorkspaceBridgeRuntimeEnvContributionOptions, L as LocalCliBridgeAuthPolicyOptions, R as RegisterWorkspaceBridgeHandlerOptions, S as ServerBootstrapOptions, z as ServerBootstrapResult, A as WorkspaceBridgeCallContext, D as WorkspaceBridgeHandlerArgs, E as WorkspaceBridgeHandlerContribution, F as WorkspaceBridgeRegistryCallOptions, G as WorkspaceBridgeRegistryLogger, H as WorkspaceBridgeRegistryOptions, I as WorkspaceBridgeRuntimeEnvDisabledReason, c as WorkspaceBridgeRuntimeEnvOptions, J as WorkspaceBridgeRuntimePlacement, g as WorkspaceProvisioningContribution, h as WorkspaceRouteContribution, W as WorkspaceServerPlugin, K as bootstrapServer, M as createBrowserBridgeAuthPolicy, f as createInMemoryBridge, N as createLocalCliBridgeAuthPolicy, O as createWorkspaceBridgeRegistry, Q as createWorkspaceBridgeRuntimeEnvContribution, T as defineServerPlugin, U as resolveBridgeCallUrl, V as resolveBridgeTokenUrl, X as validateServerPlugin, Y as validateWorkspaceBridgeOperationDefinition } from './runtimeEnv-HolIkcoB.js';
3
3
  import { FastifyRequest, FastifyInstance } from 'fastify';
4
- import { U as UiBridge, W as WorkspaceBridge } from './ui-bridge-BbuUZ5iC.js';
5
- export { C as CommandResult, a as UiCommand, b as UiState } from './ui-bridge-BbuUZ5iC.js';
4
+ import { U as UiBridge, W as WorkspaceBridge } from './ui-bridge-D2eO3epD.js';
5
+ export { C as CommandResult, a as UiCommand, b as UiState } from './ui-bridge-D2eO3epD.js';
6
6
  import { A as AgentTool } from './agent-tool-CB0RQyx9.js';
7
7
  import { W as WorkspaceBridgeOperationDefinition, a as WorkspaceBridgeCallRequest, B as BridgeAuthContext, b as WorkspaceBridgeCallResponse, c as WorkspaceBridgeError, d as BridgeCallerClass, e as BridgeIdempotencyPolicy } from './workspace-bridge-rpc-A98RA5o6.js';
8
8
  export { f as BridgeActorAttribution, g as BridgeActorKind, h as BridgeRedactedActorRef, i as WorkspaceBridgeCallFailure, j as WorkspaceBridgeCallSuccess, k as WorkspaceBridgeErrorCode, l as WorkspaceBridgeFileAssetPointer, m as WorkspaceBridgeJsonValue, n as createWorkspaceBridgeError } from './workspace-bridge-rpc-A98RA5o6.js';
@@ -12,6 +12,7 @@ import { PluginLogger } from './runtime-server.js';
12
12
  export { RuntimePluginContext, RuntimePluginHandler, RuntimePluginResponse, RuntimePluginRouter, RuntimeServerPlugin, defineRuntimeServerPlugin, validateRuntimeServerPlugin } from './runtime-server.js';
13
13
  import { ErrorCode } from '@hachej/boring-agent/shared';
14
14
  import './manifest-C2vVgH_e.js';
15
+ import './filesystem-vhLA0ERd.js';
15
16
 
16
17
  declare function definePluginAsset(importMetaUrl: string, name: string, relativeSource: string, options?: {
17
18
  target?: string;
package/dist/server.js CHANGED
@@ -344,6 +344,14 @@ data: ${JSON.stringify({ v: UI_BRIDGE_PROTOCOL_VERSION })}
344
344
  // src/server/ui-control/tools/uiTools.ts
345
345
  import { stat } from "fs/promises";
346
346
  import { resolve, isAbsolute, relative, win32 } from "path";
347
+
348
+ // src/shared/types/filesystem.ts
349
+ var USER_FILESYSTEM_ID = "user";
350
+ function normalizeUiFilesystem(filesystem) {
351
+ return filesystem && filesystem.length > 0 ? filesystem : USER_FILESYSTEM_ID;
352
+ }
353
+
354
+ // src/server/ui-control/tools/uiTools.ts
347
355
  function makeError(message) {
348
356
  return {
349
357
  content: [{ type: "text", text: message }],
@@ -361,9 +369,9 @@ function isPathAbsolute(filePath) {
361
369
  function isOutsideWorkspaceRel(rel) {
362
370
  return rel === ".." || rel.startsWith("../") || rel.startsWith("..\\") || isPathAbsolute(rel);
363
371
  }
364
- function validatePathSyntax(relPath, workspaceRoot) {
372
+ function validatePathSyntax(relPath, workspaceRoot, opts = {}) {
365
373
  const rootHint = workspaceRoot ? ` (${workspaceRoot})` : "";
366
- if (isPathAbsolute(relPath)) {
374
+ if (!opts.allowAbsolute && isPathAbsolute(relPath)) {
367
375
  return {
368
376
  ok: false,
369
377
  reason: `path "${relPath}" is absolute \u2014 pass a path relative to the workspace root${rootHint}.`
@@ -445,7 +453,10 @@ function isVerified(kind, params, state) {
445
453
  const tabs = state.openTabs ?? [];
446
454
  if (kind === "openFile") {
447
455
  const path = typeof params.path === "string" ? params.path : null;
448
- return path !== null && tabs.some((t) => t.params?.path === path);
456
+ const filesystem = normalizeUiFilesystem(typeof params.filesystem === "string" ? params.filesystem : void 0);
457
+ return path !== null && tabs.some(
458
+ (t) => t.params?.path === path && normalizeUiFilesystem(typeof t.params?.filesystem === "string" ? t.params.filesystem : void 0) === filesystem
459
+ );
449
460
  }
450
461
  if (kind === "openPanel") {
451
462
  const id = typeof params.id === "string" ? params.id : null;
@@ -485,7 +496,7 @@ function createExecUiTool(workspaceBridge, opts = {}) {
485
496
  "",
486
497
  "Supported `kind` values:",
487
498
  "",
488
- " openFile params: { path: string, mode?: 'view'|'edit'|'diff' }",
499
+ " openFile params: { path: string, mode?: 'view'|'edit'|'diff', filesystem?: 'user'|'company_context' }",
489
500
  " \u2014 Open a file in the workbench. The workbench pane",
490
501
  " auto-opens if collapsed. Path must be relative to the",
491
502
  " workspace root (e.g. `src/foo.ts`, not `foo.ts` if it",
@@ -500,6 +511,8 @@ function createExecUiTool(workspaceBridge, opts = {}) {
500
511
  " is found.",
501
512
  " If the path is a folder, openFile reveals/selects it in",
502
513
  " the file tree instead of opening an editor tab.",
514
+ " Omit filesystem for normal workspace files (defaults to user). Use filesystem:'company_context' only when a company_context binding is advertised.",
515
+ " Path prefixes such as company_context:/x do not switch filesystem identity.",
503
516
  " Example: {kind:'openFile', params:{path:'README.md'}}",
504
517
  "",
505
518
  " openPanel params: { id: string, component: string,",
@@ -514,11 +527,15 @@ function createExecUiTool(workspaceBridge, opts = {}) {
514
527
  " component:'chart-canvas',",
515
528
  " params:{seriesId:'GDPC1'}}}",
516
529
  "",
517
- " openSurface params: { kind: string, target: string, meta?: object }",
530
+ " openSurface params: { kind: string, target: string, filesystem?: 'user'|'company_context', meta?: object }",
518
531
  " \u2014 Open an app-owned target through the workspace",
519
532
  " surface resolver registry. Use this when the app",
520
533
  " defines the mapping from domain target to panel",
521
534
  " component, for example a catalog row.",
535
+ " For kind:'workspace.open.path', filesystem follows the",
536
+ " same rules as openFile: omit for user files; pass",
537
+ " filesystem:'company_context' only for advertised company",
538
+ " context bindings; path prefixes do not switch identity.",
522
539
  " Example: {kind:'openSurface', params:{",
523
540
  " kind:'catalog.open-row',",
524
541
  " target:'orders_daily',",
@@ -592,29 +609,32 @@ function createExecUiTool(workspaceBridge, opts = {}) {
592
609
  `${kind}: ${kind === "navigateToLine" ? "file" : "path"} param is required`
593
610
  );
594
611
  }
595
- const syntax = validatePathSyntax(relPath, workspaceRoot);
612
+ const filesystem = kind === "openFile" ? normalizeUiFilesystem(typeof cmdParams.filesystem === "string" ? cmdParams.filesystem : void 0) : USER_FILESYSTEM_ID;
613
+ const syntax = validatePathSyntax(relPath, workspaceRoot, { allowAbsolute: filesystem !== USER_FILESYSTEM_ID });
596
614
  if (!syntax.ok) return makeError(syntax.reason);
597
- if (workspaceRoot) {
598
- const check = await validateExistingPath(workspaceRoot, relPath);
599
- if (!check.ok) {
600
- return makeError(check.reason);
601
- }
602
- if (kind === "openFile" && check.kind === "dir") {
603
- effectiveKind = "expandToFile";
604
- }
605
- } else if (resolvePathKind) {
606
- const pathKind = await resolvePathKind(relPath);
607
- if (!pathKind) {
608
- return makeError(`file not found at "${relPath}". Try find or grep to locate the file before retrying openFile.`);
609
- }
610
- if (kind === "openFile" && pathKind === "dir") {
611
- effectiveKind = "expandToFile";
615
+ if (filesystem === USER_FILESYSTEM_ID) {
616
+ if (workspaceRoot) {
617
+ const check = await validateExistingPath(workspaceRoot, relPath);
618
+ if (!check.ok) {
619
+ return makeError(check.reason);
620
+ }
621
+ if (kind === "openFile" && check.kind === "dir") {
622
+ effectiveKind = "expandToFile";
623
+ }
624
+ } else if (resolvePathKind) {
625
+ const pathKind = await resolvePathKind(relPath);
626
+ if (!pathKind) {
627
+ return makeError(`file not found at "${relPath}". Try find or grep to locate the file before retrying openFile.`);
628
+ }
629
+ if (kind === "openFile" && pathKind === "dir") {
630
+ effectiveKind = "expandToFile";
631
+ }
612
632
  }
613
633
  }
614
634
  }
615
635
  try {
616
636
  const command = { kind: effectiveKind, params: cmdParams };
617
- const result = await workspaceBridge.emitUiEffect(command);
637
+ const result = await workspaceBridge.postCommand(command);
618
638
  if (result.status === "error") {
619
639
  return {
620
640
  content: [{ type: "text", text: JSON.stringify(result) }],
package/dist/shared.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- export { C as CommandResult, a as UiCommand, b as UiState, W as WorkspaceBridge } from './ui-bridge-BbuUZ5iC.js';
1
+ export { C as CommandResult, a as UiCommand, b as UiState, W as WorkspaceBridge } from './ui-bridge-D2eO3epD.js';
2
2
  export { f as BridgeActorAttribution, g as BridgeActorKind, B as BridgeAuthContext, d as BridgeCallerClass, e as BridgeIdempotencyPolicy, h as BridgeRedactedActorRef, i as WorkspaceBridgeCallFailure, a as WorkspaceBridgeCallRequest, b as WorkspaceBridgeCallResponse, j as WorkspaceBridgeCallSuccess, c as WorkspaceBridgeError, k as WorkspaceBridgeErrorCode, l as WorkspaceBridgeFileAssetPointer, m as WorkspaceBridgeJsonValue, W as WorkspaceBridgeOperationDefinition, n as createWorkspaceBridgeError } from './workspace-bridge-rpc-A98RA5o6.js';
3
- export { C as CommandConfig, P as PaneProps, a as PanelConfig, b as PanelRegistration, S as SurfaceOpenRequest, c as SurfacePanelResolution, d as SurfaceResolverConfig, e as SurfaceResolverRegistration, W as WORKSPACE_OPEN_PATH_SURFACE_KIND, f as definePanel } from './surface-CDklwi48.js';
3
+ export { C as CommandConfig, P as PaneProps, a as PanelConfig, b as PanelRegistration, S as SurfaceOpenRequest, c as SurfacePanelResolution, d as SurfaceResolverConfig, e as SurfaceResolverRegistration, W as WORKSPACE_OPEN_PATH_SURFACE_KIND, f as definePanel } from './surface-aLQ_Hryw.js';
4
+ export { C as COMPANY_CONTEXT_FILESYSTEM_ID, F as FilesystemId, U as USER_FILESYSTEM_ID, a as UiFileResource, b as UiFileResourceInput, n as normalizeUiFileResource, c as normalizeUiFilesystem, u as uiFileResourceKey, w as withUiFileResource } from './filesystem-vhLA0ERd.js';
4
5
  export { A as AgentTool, J as JSONSchema, T as ToolExecContext, a as ToolResult } from './agent-tool-CB0RQyx9.js';
5
6
  import 'react';
6
7
  import 'dockview-react';
package/dist/shared.js CHANGED
@@ -26,6 +26,34 @@ function createWorkspaceBridgeError(code, message, details) {
26
26
  return details === void 0 ? { code, message } : { code, message, details };
27
27
  }
28
28
 
29
+ // src/shared/types/filesystem.ts
30
+ var USER_FILESYSTEM_ID = "user";
31
+ var COMPANY_CONTEXT_FILESYSTEM_ID = "company_context";
32
+ function normalizeUiFilesystem(filesystem) {
33
+ return filesystem && filesystem.length > 0 ? filesystem : USER_FILESYSTEM_ID;
34
+ }
35
+ function normalizeUiFileResource(input) {
36
+ if (typeof input === "string") {
37
+ return { filesystem: USER_FILESYSTEM_ID, path: input };
38
+ }
39
+ return {
40
+ filesystem: normalizeUiFilesystem(input.filesystem),
41
+ path: input.path
42
+ };
43
+ }
44
+ function uiFileResourceKey(resource) {
45
+ const normalized = normalizeUiFileResource(resource);
46
+ return `${normalized.filesystem}:${normalized.path}`;
47
+ }
48
+ function withUiFileResource(value, fallbackFilesystem) {
49
+ const filesystem = typeof value.filesystem === "string" ? value.filesystem : normalizeUiFilesystem(fallbackFilesystem);
50
+ return {
51
+ ...value,
52
+ filesystem,
53
+ path: String(value.path ?? "")
54
+ };
55
+ }
56
+
29
57
  // src/shared/types/surface.ts
30
58
  var WORKSPACE_OPEN_PATH_SURFACE_KIND = "workspace.open.path";
31
59
 
@@ -47,10 +75,16 @@ function safeCapture(telemetry, event) {
47
75
  }
48
76
  }
49
77
  export {
78
+ COMPANY_CONTEXT_FILESYSTEM_ID,
79
+ USER_FILESYSTEM_ID,
50
80
  WORKSPACE_OPEN_PATH_SURFACE_KIND,
51
81
  WorkspaceBridgeErrorCode,
52
82
  createWorkspaceBridgeError,
53
83
  definePanel,
54
84
  noopTelemetry,
55
- safeCapture
85
+ normalizeUiFileResource,
86
+ normalizeUiFilesystem,
87
+ safeCapture,
88
+ uiFileResourceKey,
89
+ withUiFileResource
56
90
  };
@@ -1,5 +1,6 @@
1
1
  import { ComponentType } from 'react';
2
2
  import { DockviewPanelApi, DockviewApi } from 'dockview-react';
3
+ import { F as FilesystemId } from './filesystem-vhLA0ERd.js';
3
4
 
4
5
  /**
5
6
  * Shared panel and command types — no runtime deps beyond React/dockview.
@@ -111,6 +112,7 @@ declare const WORKSPACE_OPEN_PATH_SURFACE_KIND = "workspace.open.path";
111
112
  interface SurfaceOpenRequest {
112
113
  kind: string;
113
114
  target: string;
115
+ filesystem?: FilesystemId;
114
116
  meta?: Record<string, unknown>;
115
117
  }
116
118
  interface SurfacePanelResolution {
package/dist/testing.d.ts CHANGED
@@ -57,6 +57,7 @@ declare interface BridgeEventMap {
57
57
  "file:opened": {
58
58
  path: string;
59
59
  mode: "view" | "edit" | "diff";
60
+ filesystem?: FilesystemId;
60
61
  };
61
62
  "file:saved": {
62
63
  path: string;
@@ -145,6 +146,8 @@ declare interface DynamicPaneConfig {
145
146
  title?: string;
146
147
  }
147
148
 
149
+ declare type FilesystemId = "user" | "company_context" | (string & {});
150
+
148
151
  export declare interface MockBridgeState {
149
152
  openPanels: PanelState[];
150
153
  activeFile: string | null;
@@ -389,6 +392,7 @@ declare interface WorkspaceBridge {
389
392
  getVisibleFiles(): string[];
390
393
  openFile(path: string, opts?: {
391
394
  mode?: "view" | "edit" | "diff";
395
+ filesystem?: FilesystemId;
392
396
  }): Promise<CommandResult>;
393
397
  openPanel(config: DynamicPaneConfig): Promise<CommandResult>;
394
398
  closePanel(id: string): Promise<CommandResult>;
package/dist/testing.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx as Ba } from "react/jsx-runtime";
2
2
  import * as Pa from "react";
3
3
  import { createElement as is, useMemo as wn, useLayoutEffect as us, isValidElement as ss, cloneElement as ds, useSyncExternalStore as Gi } from "react";
4
- import { i as cs, O as fs, x as ps, v as ms } from "./WorkspaceProvider-kf-pjz6V.js";
4
+ import { i as cs, O as fs, x as ps, v as ms } from "./WorkspaceProvider-U4izhS84.js";
5
5
  import * as bs from "react-dom/test-utils";
6
6
  import ka from "react-dom";
7
7
  import * as xn from "react-dom/client";
@@ -1,3 +1,5 @@
1
+ import { F as FilesystemId } from './filesystem-vhLA0ERd.js';
2
+
1
3
  interface UiBridge {
2
4
  getState(): Promise<UiState | null>;
3
5
  setState(state: UiState): Promise<void>;
@@ -20,12 +22,14 @@ type UiCommand = {
20
22
  params: {
21
23
  path: string;
22
24
  mode?: 'view' | 'edit' | 'diff';
25
+ filesystem?: FilesystemId;
23
26
  };
24
27
  } | {
25
28
  kind: 'openSurface';
26
29
  params: {
27
30
  kind: string;
28
31
  target: string;
32
+ filesystem?: FilesystemId;
29
33
  meta?: Record<string, unknown>;
30
34
  };
31
35
  } | {
@@ -3706,6 +3706,8 @@
3706
3706
  @layer theme, utilities;
3707
3707
  @layer theme {
3708
3708
  :root, :host {
3709
+ --font-sans: var(--boring-font-sans);
3710
+ --font-mono: var(--boring-font-mono);
3709
3711
  --color-black: #000;
3710
3712
  --spacing: 0.25rem;
3711
3713
  --container-xs: 20rem;