@dbx-tools/appkit-mastra 0.9.95 → 0.9.99

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.
@@ -2,7 +2,7 @@
2
2
  * Where Databricks Assistant `SKILL.md` trees live.
3
3
  *
4
4
  * Two modules need these paths and must agree on them: `workspaces.ts` MOUNTS
5
- * them per request (see `DEFAULT_SKILL_FOLDERS`), and `remote-skills.ts`
5
+ * them per request (see `DEFAULT_DATABRICKS_WORKSPACE_PATHS`), and `remote-skills.ts`
6
6
  * WRITES provisioned skills into them at startup. They live here rather than being
7
7
  * spelled out in both, where a change to one would silently provision skills into a
8
8
  * tree the other never scanned.
@@ -21,4 +21,4 @@ export function personalWorkspacePath(userEmail) {
21
21
  export function personalSkillsPath(userEmail) {
22
22
  return `${personalWorkspacePath(userEmail)}/.assistant/skills`;
23
23
  }
24
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2tpbGwtcGF0aHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc2tpbGwtcGF0aHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7R0FVRztBQUVILHlFQUF5RTtBQUN6RSxNQUFNLENBQUMsTUFBTSwyQkFBMkIsR0FBRyx1QkFBdUIsQ0FBQztBQUVuRSx1RUFBdUU7QUFDdkUsTUFBTSxDQUFDLE1BQU0sd0JBQXdCLEdBQUcsR0FBRywyQkFBMkIsU0FBUyxDQUFDO0FBRWhGLHdDQUF3QztBQUN4QyxNQUFNLFVBQVUscUJBQXFCLENBQUMsU0FBaUI7SUFDckQsT0FBTyxvQkFBb0IsU0FBUyxDQUFDLElBQUksRUFBRSxFQUFFLENBQUM7QUFDaEQsQ0FBQztBQUVELDhDQUE4QztBQUM5QyxNQUFNLFVBQVUsa0JBQWtCLENBQUMsU0FBaUI7SUFDbEQsT0FBTyxHQ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T1JHQU5JWkFUSU9OX0FTU0lTVEFOVF9QQVRIfS9za2lsbHNgO1xuXG4vKiogV29ya3NwYWNlIGhvbWUgcm9vdCBmb3Igb25lIHVzZXIuICovXG5leHBvcnQgZnVuY3Rpb24gcGVyc29uYWxXb3Jrc3BhY2VQYXRoKHVzZXJFbWFpbDogc3RyaW5nKTogc3RyaW5nIHtcbiAgcmV0dXJuIGAvV29ya3NwYWNlL1VzZXJzLyR7dXNlckVtYWlsLnRyaW0oKX1gO1xufVxuXG4vKiogUGVyc29uYWwgc2tpbGxzIHRyZWUgb3duZWQgYnkgb25lIHVzZXIuICovXG5leHBvcnQgZnVuY3Rpb24gcGVyc29uYWxTa2lsbHNQYXRoKHVzZXJFbWFpbDogc3RyaW5nKTogc3RyaW5nIHtcbiAgcmV0dXJuIGAke3BlcnNvbmFsV29ya3NwYWNlUGF0aCh1c2VyRW1haWwpfS8uYXNzaXN0YW50L3NraWxsc2A7XG59XG4iXX0=
@@ -1,16 +1,10 @@
1
1
  /**
2
2
  * Mastra workspace factory for Databricks Apps.
3
3
  *
4
- * Builds a {@link Workspace} with Databricks Sandbox command execution, an
5
- * isolated `/tmp` scratch mount, and a {@link CompositeFilesystem} over the
6
- * named skill folders
7
- * resolved for that request. A skill folder maps a name to a location plus its
8
- * readable / writable policy: a Databricks path mounted through the OBO client
9
- * on {@link MASTRA_USER_KEY}, or any {@link WorkspaceFilesystem} a consuming
10
- * library already owns. {@link DEFAULT_SKILL_FOLDERS} supplies the Assistant
11
- * trees, and `skillFolders` merges over it - same name overrides, `false`
12
- * disables, a new name adds. Optional mount resolvers contribute further
13
- * filesystems and skill scan roots on top.
4
+ * Builds native Mastra workspace configuration from Databricks paths. Paths
5
+ * mount at the same path by default, `~` resolves to the current user's
6
+ * Databricks workspace home, and `/tmp[/subpath]` resolves to stable
7
+ * user-scoped storage under the host's ephemeral temp directory.
14
8
  *
15
9
  * Databricks mounts use `@dbx-tools/databricks` {@link DatabricksFileSystem}
16
10
  * wrapped by {@link filesystems}; inaccessible roots are skipped independently.
@@ -18,30 +12,21 @@
18
12
  * @module
19
13
  */
20
14
  import { pluginRegistry } from "@dbx-tools/appkit";
15
+ import { type PathMatchInput } from "@dbx-tools/path";
16
+ import { type CacheableFileSystemOperation } from "@dbx-tools/shared-fs";
21
17
  import type { RequestContext } from "@mastra/core/request-context";
22
- import { Workspace, type SkillsResolver, type WorkspaceFilesystem, type WorkspaceSandbox, type WorkspaceSandboxResolver, type WorkspaceToolsConfig } from "@mastra/core/workspace";
18
+ import { Workspace, type SkillsResolver, type WorkspaceConfig, type WorkspaceFilesystem, type WorkspaceSandbox, type WorkspaceSandboxResolver } from "@mastra/core/workspace";
23
19
  import { type DatabricksWorkspaceSandboxOptions } from "./sandbox.ts";
24
20
  /** Per-request context for mount and skill-folder resolvers. */
25
- export interface WorkspaceMountContext {
21
+ export interface DatabricksWorkspaceContext {
26
22
  requestContext?: RequestContext;
27
23
  }
28
24
  /**
29
- * A skill-folder field given either directly or as a per-request resolver.
30
- * A resolver returning `undefined` skips the folder for that request.
25
+ * One Databricks path mounted into a Mastra workspace.
31
26
  */
32
- export type SkillFolderValue<T> = T | ((context: WorkspaceMountContext) => T | undefined | Promise<T | undefined>);
33
- /**
34
- * One named skill-folder location and its read / write policy.
35
- *
36
- * Give {@link path} for a Databricks workspace tree (mounted through the
37
- * request's OBO client), or {@link filesystem} for a mount the consumer builds
38
- * itself. {@link filesystem} wins when both are set.
39
- */
40
- export interface SkillFolderOptions {
41
- /** Absolute Databricks workspace root mounted at its actual path. */
42
- path?: SkillFolderValue<string>;
43
- /** Ready-made mount, for locations the OBO client cannot reach. */
44
- filesystem?: SkillFolderValue<WorkspaceFilesystem>;
27
+ export interface DatabricksWorkspacePathOptions {
28
+ /** Absolute Databricks path or `~` shortcut for the current user's workspace home. */
29
+ path: string;
45
30
  /** Human-friendly mount name shown in filesystem listings. */
46
31
  displayName?: string;
47
32
  /** Mount description shown in filesystem listings and workspace instructions. */
@@ -70,51 +55,44 @@ export interface SkillFolderOptions {
70
55
  /** Mount point in the composite namespace. Databricks paths default to their actual root. */
71
56
  mount?: string;
72
57
  }
73
- /** Mount map plus optional Mastra skill scan roots for one resolver. */
74
- export interface WorkspaceMountContribution {
75
- mounts: Record<string, WorkspaceFilesystem>;
76
- /** Paths within the composite namespace where `SKILL.md` files are scanned. */
77
- skillPaths?: string[];
58
+ /** String shorthand or full options for one Databricks workspace path. */
59
+ export type DatabricksWorkspacePath = string | DatabricksWorkspacePathOptions;
60
+ /** Fixed or request-dependent Databricks path entry. */
61
+ export type DatabricksWorkspacePathValue = DatabricksWorkspacePath | false | ((context: DatabricksWorkspaceContext) => DatabricksWorkspacePath | false | undefined | Promise<DatabricksWorkspacePath | false | undefined>);
62
+ /** Operations and path globs cached by the Databricks filesystem shortcut. */
63
+ export interface DatabricksWorkspaceCacheFilter {
64
+ /** Cached filesystem operations. Omit for `exists`, `readFile`, `readdir`, and `stat`. */
65
+ operations?: CacheableFileSystemOperation | readonly CacheableFileSystemOperation[];
66
+ /** Absolute or root-relative globs and predicates. `~` expands per request. */
67
+ paths?: PathMatchInput | readonly PathMatchInput[];
78
68
  }
79
- /** Contributes filesystem mounts (and optional skill paths) for one request. */
80
- export type WorkspaceMountResolver = (context: WorkspaceMountContext) => WorkspaceMountContribution | Promise<WorkspaceMountContribution>;
81
- /** Names carried by {@link DEFAULT_SKILL_FOLDERS}. */
82
- export type DefaultSkillFolderName = "organization-skills" | "personal-skills";
69
+ /** Fixed or request-dependent filesystem cache selection. */
70
+ export type DatabricksWorkspaceCache = boolean | DatabricksWorkspaceCacheFilter | readonly DatabricksWorkspaceCacheFilter[] | ((context: DatabricksWorkspaceContext) => boolean | DatabricksWorkspaceCacheFilter | readonly DatabricksWorkspaceCacheFilter[] | undefined | Promise<boolean | DatabricksWorkspaceCacheFilter | readonly DatabricksWorkspaceCacheFilter[] | undefined>);
83
71
  /**
84
- * Sandbox selection for {@link createWorkspace}. Databricks is the default;
72
+ * Sandbox selection for {@link databricksWorkspace}. Monty is the default;
85
73
  * `false` disables command execution, and a Mastra provider or resolver is an
86
74
  * explicit replacement.
87
75
  */
88
76
  export type WorkspaceSandboxSelection = false | "databricks" | "monty" | DatabricksWorkspaceSandboxOptions | WorkspaceSandbox | WorkspaceSandboxResolver;
89
- /** Options for {@link createWorkspace}. */
90
- export interface CreateWorkspaceOptions {
91
- /** Workspace id; derived from `name` or `"workspace"` when omitted. */
92
- id?: string;
93
- /** Display name; derived from `id` when omitted. */
94
- name?: string;
77
+ /** Native Mastra workspace options plus Databricks path shortcuts. */
78
+ export interface DatabricksWorkspaceOptions extends Omit<WorkspaceConfig, "filesystem" | "mounts" | "sandbox" | "skills"> {
95
79
  /**
96
- * Start from {@link DEFAULT_SKILL_FOLDERS}. Defaults to `true`; `false`
97
- * starts from an empty map, leaving only the {@link skillFolders} given here.
80
+ * Start from {@link DEFAULT_DATABRICKS_WORKSPACE_PATHS}. Defaults to `true`.
98
81
  */
99
- assistantSkills?: boolean;
82
+ assistantPaths?: boolean;
100
83
  /**
101
- * Named skill folders merged over {@link DEFAULT_SKILL_FOLDERS}: a matching
102
- * name overrides that default, `false` disables it, and any other name adds
103
- * a folder.
84
+ * Databricks paths appended after the defaults. A string is shorthand for
85
+ * `{ path }`; a resolver may return either form per request.
104
86
  */
105
- skillFolders?: Record<string, SkillFolderOptions | false>;
106
- /** Extra per-request mount resolvers (run after the skill-folder mounts). */
107
- mounts?: WorkspaceMountResolver[];
87
+ paths?: readonly DatabricksWorkspacePathValue[];
88
+ /** Native Mastra filesystems composed beside the Databricks paths. */
89
+ mounts?: Record<string, WorkspaceFilesystem>;
108
90
  /** Replace the auto-built dynamic skills resolver. */
109
91
  skills?: SkillsResolver;
110
- /** Forwarded to Mastra when skill discovery is enabled. */
111
- checkSkillFileMtime?: boolean;
112
- /** Additional native Mastra workspace tool configuration and overrides. */
113
- tools?: WorkspaceToolsConfig;
92
+ /** Filesystem cache filters. Ignored when the AppKit files-cache plugin is absent. */
93
+ cache?: DatabricksWorkspaceCache;
114
94
  /** AppKit plugin context used to discover optional sibling capabilities. */
115
95
  pluginContext?: pluginRegistry.PluginContextLike;
116
- /** Enable BM25 keyword search over indexed workspace content. */
117
- bm25?: boolean;
118
96
  /**
119
97
  * Command sandbox. Defaults to Monty. Pass `"databricks"` or an options
120
98
  * object for Databricks Sandbox, `false` to disable command execution, or an
@@ -131,54 +109,37 @@ export interface CreateWorkspaceOptions {
131
109
  extraSkillPaths?: string[];
132
110
  }
133
111
  /**
134
- * The skill folders every workspace starts with.
135
- *
136
- * - `organization-skills` - `/Workspace/.assistant` with `skills`; write
137
- * attempts require approval and remain subject to Databricks permissions.
138
- * - `personal-skills` - the requesting user's `/Workspace/Users/<email>` root
139
- * with `.assistant/skills`, writable and skipped without an email.
112
+ * Default Databricks paths for shared and current-user Agent Skills.
140
113
  */
141
- export declare const DEFAULT_SKILL_FOLDERS: Readonly<Record<DefaultSkillFolderName, SkillFolderOptions>>;
114
+ export declare const DEFAULT_DATABRICKS_WORKSPACE_PATHS: readonly DatabricksWorkspacePathOptions[];
142
115
  /**
143
116
  * Create a Mastra {@link Workspace} with per-request Databricks mounts.
144
117
  *
145
- * @example Default skill folders only
118
+ * @example Default Databricks paths
146
119
  * ```ts
147
- * createWorkspace()
120
+ * databricksWorkspace()
148
121
  * ```
149
122
  *
150
- * @example Override a default, drop another, and add a location of your own
123
+ * @example Use only explicit paths
151
124
  * ```ts
152
- * createWorkspace({
153
- * skillFolders: {
154
- * "organization-skills": {
155
- * path: "/Workspace/Shared/.assistant",
156
- * skills: ["skills"],
157
- * },
158
- * "personal-skills": false,
159
- * runbooks: { path: "/Workspace/Shared/runbooks/skills", writable: true },
160
- * volume: { filesystem: myVolumeFilesystem },
161
- * },
125
+ * databricksWorkspace({
126
+ * assistantPaths: false,
127
+ * paths: ["~/project", "/tmp/project", "/Volumes/main/default/data"],
162
128
  * })
163
129
  * ```
164
130
  *
165
- * @example Skill folders plus a custom mount resolver
131
+ * @example Build a standard Mastra workspace yourself
166
132
  * ```ts
167
- * createWorkspace({
168
- * mounts: [
169
- * async ({ requestContext }) => ({
170
- * mounts: { "/data": myFilesystem },
171
- * skillPaths: [],
172
- * }),
173
- * ],
133
+ * new Workspace({
134
+ * ...databricksWorkspaceConfig({ paths: ["~/project"] }),
135
+ * sandbox: mySandbox,
174
136
  * })
175
137
  * ```
176
138
  */
177
- export declare function createWorkspace(options?: CreateWorkspaceOptions): Workspace;
139
+ export declare function databricksWorkspaceConfig(options?: DatabricksWorkspaceOptions): WorkspaceConfig;
140
+ /** Create a native Mastra {@link Workspace} from {@link databricksWorkspaceConfig}. */
141
+ export declare function databricksWorkspace(options?: DatabricksWorkspaceOptions): Workspace;
178
142
  /**
179
- * Merge the configured skill folders over {@link DEFAULT_SKILL_FOLDERS}.
180
- *
181
- * `assistantSkills: false` drops the defaults, and a `false` value removes one
182
- * entry by name.
143
+ * Resolve default and caller-provided Databricks paths in priority order.
183
144
  */
184
- export declare function resolveSkillFolders(options?: Pick<CreateWorkspaceOptions, "assistantSkills" | "skillFolders">): Record<string, SkillFolderOptions>;
145
+ export declare function resolveDatabricksWorkspacePaths(options?: Pick<DatabricksWorkspaceOptions, "assistantPaths" | "paths">): DatabricksWorkspacePathValue[];