@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.
- package/README.md +134 -103
- package/index.ts +3 -3
- package/lib/index.d.ts +3 -3
- package/lib/index.js +3 -3
- package/lib/src/agents.d.ts +3 -3
- package/lib/src/agents.js +9 -6
- package/lib/src/monty-sandbox.d.ts +4 -7
- package/lib/src/monty-sandbox.js +17 -28
- package/lib/src/openapi-tool.js +3 -12
- package/lib/src/server.js +1 -1
- package/lib/src/skill-paths.d.ts +1 -1
- package/lib/src/skill-paths.js +2 -2
- package/lib/src/workspaces.d.ts +53 -92
- package/lib/src/workspaces.js +303 -144
- package/package.json +14 -14
- package/src/agents.ts +8 -6
- package/src/monty-sandbox.ts +18 -29
- package/src/openapi-tool.ts +2 -11
- package/src/server.ts +22 -20
- package/src/skill-paths.ts +1 -1
- package/src/workspaces.ts +476 -215
package/lib/src/skill-paths.js
CHANGED
|
@@ -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 `
|
|
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,
|
|
24
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2tpbGwtcGF0aHMuanMiLCJzb3Vy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@
|
|
|
1
1
|
/**
|
|
2
2
|
* Mastra workspace factory for Databricks Apps.
|
|
3
3
|
*
|
|
4
|
-
* Builds
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
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
|
|
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
|
|
21
|
+
export interface DatabricksWorkspaceContext {
|
|
26
22
|
requestContext?: RequestContext;
|
|
27
23
|
}
|
|
28
24
|
/**
|
|
29
|
-
*
|
|
30
|
-
* A resolver returning `undefined` skips the folder for that request.
|
|
25
|
+
* One Databricks path mounted into a Mastra workspace.
|
|
31
26
|
*/
|
|
32
|
-
export
|
|
33
|
-
/**
|
|
34
|
-
|
|
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
|
-
/**
|
|
74
|
-
export
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
/**
|
|
80
|
-
export type
|
|
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
|
|
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
|
-
/**
|
|
90
|
-
export interface
|
|
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
|
|
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
|
-
|
|
82
|
+
assistantPaths?: boolean;
|
|
100
83
|
/**
|
|
101
|
-
*
|
|
102
|
-
*
|
|
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
|
-
|
|
106
|
-
/**
|
|
107
|
-
mounts?:
|
|
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
|
-
/**
|
|
111
|
-
|
|
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
|
-
*
|
|
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
|
|
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
|
|
118
|
+
* @example Default Databricks paths
|
|
146
119
|
* ```ts
|
|
147
|
-
*
|
|
120
|
+
* databricksWorkspace()
|
|
148
121
|
* ```
|
|
149
122
|
*
|
|
150
|
-
* @example
|
|
123
|
+
* @example Use only explicit paths
|
|
151
124
|
* ```ts
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
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
|
|
131
|
+
* @example Build a standard Mastra workspace yourself
|
|
166
132
|
* ```ts
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
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
|
|
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
|
-
*
|
|
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
|
|
145
|
+
export declare function resolveDatabricksWorkspacePaths(options?: Pick<DatabricksWorkspaceOptions, "assistantPaths" | "paths">): DatabricksWorkspacePathValue[];
|