@dbx-tools/appkit-mastra 0.9.118 → 0.9.119

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.
@@ -5,7 +5,7 @@
5
5
  * {@link AITOOLS_SOURCE} constant, a GitHub `owner/repo`, any git / GitLab URL,
6
6
  * or a direct download URL - and optional per-source policy.
7
7
  * {@link provisionRemoteSkills} materializes every source into a local
8
- * `SKILL.md` tree at app boot and returns read-only backing directories plus
8
+ * `SKILL.md` tree at app boot and returns read-only filesystem backings plus
9
9
  * their stable virtual workspace mounts.
10
10
  *
11
11
  * Resolution per source, in order:
@@ -26,35 +26,29 @@
26
26
  * source (or the top-level call) sets `failOnError: false`, in which case it is
27
27
  * logged and skipped so one bad source never takes the app down.
28
28
  *
29
- * Every provisioned tree carries a {@link METADATA_FILE} recording when each
30
- * source was last downloaded, and a source is only re-downloaded once that
31
- * record is older than {@link DEFAULT_REFRESH_TTL_MS} (seven days). This runs at app
32
- * BOOT, so without it a container that restarts a dozen times an hour re-pulls
33
- * the whole AI Tools set a dozen times for content that changes rarely. The
34
- * record travels WITH the tree rather than in process memory, so the reuse
35
- * survives a restart - which is the only way it helps a Databricks App at all.
36
- * Pass `refreshTtlMs: 0` to download on every boot.
29
+ * AI Tools uses the shared `@dbx-tools/cache` project cache with a one-day TTL,
30
+ * then hydrates one process-memory filesystem mounted at
31
+ * {@link AITOOLS_SKILLS_MOUNT} for every default workspace. Other sources keep
32
+ * a {@link METADATA_FILE} beside their provisioned tree and default to a
33
+ * seven-day refresh window. Pass `refreshTtlMs: 0` to download on every boot.
37
34
  *
38
- * The default destination is the Databricks workspace Assistant skills tree
39
- * (`/Workspace/.assistant/skills`), so provisioned skills persist across restarts and are
40
- * discovered by the built-in Assistant-skills mount. Pass `userEmail` (or an
41
- * explicit `databricksBasePath`) to target `/Workspace/Users/<email>/.assistant/skills`
42
- * instead. When no Databricks client is resolvable at startup - or the resolved
43
- * identity cannot WRITE the destination, which is the normal case for a
44
- * Databricks App service principal against the admin-owned shared tree (see
45
- * {@link openWritableWorkspace}) - the tree is written under
46
- * {@link localFS.tmpFS} and exposed through a stable read-only virtual mount
47
- * for the current process. Storage location degrades; the skills themselves do not.
35
+ * For non-AI-Tools sources, the default destination is the Databricks workspace
36
+ * Assistant skills tree (`/Workspace/.assistant/skills`). Pass `userEmail` or
37
+ * `databricksBasePath` to select another destination. When it is unavailable,
38
+ * the tree is exposed through a stable read-only local mount instead.
48
39
  *
49
40
  * @module
50
41
  */
51
42
  import type { WorkspaceClientLike } from "@dbx-tools/appkit";
52
43
  import { net } from "@dbx-tools/shared-core";
53
44
  import type { OneOrMany } from "@dbx-tools/shared-core";
45
+ import { type FileSystem } from "@dbx-tools/shared-fs";
54
46
  /** Virtual workspace path reserved for locally provisioned Databricks AI Tools. */
55
47
  export declare const AITOOLS_SKILLS_MOUNT = "/.databricks/skills";
56
48
  /** Virtual workspace root for every other locally provisioned remote source. */
57
49
  export declare const REMOTE_SKILLS_MOUNT = "/.skills";
50
+ /** How long the shared Databricks AI Tools snapshot is reused. */
51
+ export declare const AITOOLS_REFRESH_TTL_MS: number;
58
52
  /**
59
53
  * Source constant selecting Databricks' own AI Tools skill set.
60
54
  *
@@ -108,13 +102,22 @@ export type RemoteSkillSource = net.UrlLike | AiToolsSource | RemoteSkillSourceO
108
102
  * a {@link ProvisionRemoteSkillsOptions} bag when top-level policy is needed.
109
103
  */
110
104
  export type RemoteSkillsOption = RemoteSkillSource | OneOrMany<RemoteSkillSource> | ProvisionRemoteSkillsOptions;
111
- /** Read-only local backing storage exposed at a stable virtual workspace path. */
112
- export interface LocalSkillMount {
105
+ /** Read-only local directory exposed at a stable virtual workspace path. */
106
+ export interface LocalSkillDirectoryMount {
113
107
  /** Physical local directory containing the provisioned `SKILL.md` tree. */
114
108
  root: string;
115
109
  /** Virtual path agents see inside the composed Mastra workspace. */
116
110
  mountPath: string;
117
111
  }
112
+ /** Read-only process-local filesystem exposed at a stable virtual workspace path. */
113
+ export interface MemorySkillMount {
114
+ /** Process-shared filesystem containing the provisioned `SKILL.md` tree. */
115
+ filesystem: FileSystem;
116
+ /** Virtual path agents see inside the composed Mastra workspace. */
117
+ mountPath: string;
118
+ }
119
+ /** Local skill backing accepted by every auto-created workspace. */
120
+ export type LocalSkillMount = LocalSkillDirectoryMount | MemorySkillMount;
118
121
  /** Top-level remote-skills provisioning options. */
119
122
  export interface ProvisionRemoteSkillsOptions {
120
123
  /** Sources to materialize at startup. */
@@ -137,17 +140,18 @@ export interface ProvisionRemoteSkillsOptions {
137
140
  maxDownloadBytes?: number;
138
141
  /**
139
142
  * How long a provisioned tree is reused before its source is downloaded
140
- * again, in milliseconds. Defaults to seven days; `0` re-downloads on every
141
- * boot. A per-source `refreshTtlMs` wins over this.
143
+ * again, in milliseconds. AI Tools defaults to one day and other sources to
144
+ * seven days; `0` re-downloads on every boot. A per-source `refreshTtlMs` wins.
142
145
  */
143
146
  refreshTtlMs?: number;
144
147
  }
145
148
  /** What {@link provisionRemoteSkills} resolved. */
146
149
  export interface ProvisionedRemoteSkills {
147
150
  /**
148
- * Extra read-only LOCAL skill mounts to hand Mastra when a source couldn't
149
- * be written to Databricks. Physical temp/cache paths remain hidden behind
150
- * stable virtual workspace paths.
151
+ * Extra read-only local or process-memory skill mounts to hand Mastra. AI
152
+ * Tools always uses process memory; other sources use this fallback when
153
+ * they could not be written to Databricks. Physical paths remain hidden
154
+ * behind stable virtual workspace paths.
151
155
  */
152
156
  localSkillMounts: LocalSkillMount[];
153
157
  /** Absolute Databricks destination each source was written to, if any. */
@@ -159,8 +163,8 @@ export interface ProvisionedRemoteSkills {
159
163
  skillNames: string[];
160
164
  }
161
165
  /**
162
- * What one source's last download left behind, as recorded in
163
- * {@link METADATA_FILE}.
166
+ * Metadata for one resolved source snapshot. General remote sources store it
167
+ * in {@link METADATA_FILE}; AI Tools stores it with the cache-package value.
164
168
  */
165
169
  export interface RemoteSkillCacheEntry {
166
170
  /** The source string this entry was downloaded from, for readability. */