@fabric-harness/databricks 1.6.0 → 1.8.0
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 +19 -9
- package/dist/agent.d.ts +13 -37
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +71 -128
- package/dist/agent.js.map +1 -1
- package/dist/authoring-certification.d.ts +6 -0
- package/dist/authoring-certification.d.ts.map +1 -1
- package/dist/authoring-certification.js +70 -2
- package/dist/authoring-certification.js.map +1 -1
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js +55 -5
- package/dist/capabilities.js.map +1 -1
- package/dist/certification.d.ts +1 -1
- package/dist/certification.d.ts.map +1 -1
- package/dist/certification.js +1 -0
- package/dist/certification.js.map +1 -1
- package/dist/certify.js +45 -0
- package/dist/certify.js.map +1 -1
- package/dist/client.d.ts +8 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +43 -9
- package/dist/client.js.map +1 -1
- package/dist/genie-agent-mode.d.ts +115 -0
- package/dist/genie-agent-mode.d.ts.map +1 -0
- package/dist/genie-agent-mode.js +374 -0
- package/dist/genie-agent-mode.js.map +1 -0
- package/dist/genie-authoring.d.ts +190 -0
- package/dist/genie-authoring.d.ts.map +1 -0
- package/dist/genie-authoring.js +898 -0
- package/dist/genie-authoring.js.map +1 -0
- package/dist/genie.d.ts +200 -13
- package/dist/genie.d.ts.map +1 -1
- package/dist/genie.js +393 -48
- package/dist/genie.js.map +1 -1
- package/dist/governance.d.ts +2 -0
- package/dist/governance.d.ts.map +1 -1
- package/dist/governance.js +2 -1
- package/dist/governance.js.map +1 -1
- package/dist/index.d.ts +56 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +92 -21
- package/dist/index.js.map +1 -1
- package/dist/managed-resource.d.ts +67 -0
- package/dist/managed-resource.d.ts.map +1 -0
- package/dist/managed-resource.js +197 -0
- package/dist/managed-resource.js.map +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -56,23 +56,24 @@ const token = databricksIdentity({
|
|
|
56
56
|
|
|
57
57
|
- AI Gateway and Model Serving: automatic `system.ai.*` routing, explicit mode/base URL selection, model-service discovery, gateway readiness, request tags, streaming, tools, and custom endpoints.
|
|
58
58
|
- Identity: Databricks CLI OAuth profiles, explicit PAT/pre-fetched bearer, cached OAuth M2M, Databricks Apps service principal, and forwarded user token helpers.
|
|
59
|
-
- Data and AI: SQL Warehouse, Unity Catalog discovery/admin, AI Search query/admin, bounded citation-validated RAG, MLflow 3 evaluation records and a managed-judge release Job, embeddings, `ai_query()`,
|
|
59
|
+
- Data and AI: SQL Warehouse, Unity Catalog discovery/admin, AI Search query/admin, bounded citation-validated RAG, MLflow 3 evaluation records and a managed-judge release Job, embeddings, `ai_query()`, typed Genie Agent conversations, beta normalized lifecycle/ACL authoring, explicit Beta Agent Mode SSE streaming, Feature Serving, typed Jobs 2.2 authoring/run APIs, and workspace read/write APIs.
|
|
60
60
|
- Agent governance: explicit-Beta Unity Catalog Agent Services registration, discovery, metadata updates, `EXECUTE`/`READ_METADATA` grants, and deletion for externally hosted Harness agents.
|
|
61
61
|
- Data engineering: Lakeflow pipeline list/status/start/stop plus separately opt-in create/update/delete/event tools.
|
|
62
62
|
- Operations: System Tables consumption reporting, actual-cost budget source, MLflow tracing, serving usage capture, and Lakebase telemetry tables.
|
|
63
63
|
- Storage: Unity Catalog Volumes attachment store and Databricks Volume filesystem connector.
|
|
64
|
-
-
|
|
64
|
+
- Resource management: opt-in governed Jobs, Lakeflow, AI Search, serving, UC, workspace, secret-reference, and beta Genie Agent lifecycle tools; typed clients remain usable independently of model approval policy.
|
|
65
|
+
- Genie Agent Mode: explicit Beta SSE client with strict event ordering, idle/overall deadlines, cancellation, event callbacks, bounded model-tool projection, and conversation-item pagination. Workspace preview enrollment is required.
|
|
65
66
|
- Build/deploy: `databricks-app` and `databricks-serving` targets plus `fh doctor --target databricks-*`.
|
|
66
67
|
- Sandbox: `databricksSqlSandbox()` at `@fabric-harness/databricks/sql-sandbox`; file operations are in memory and `exec()` is SQL Statement Execution, not a general compute shell.
|
|
67
68
|
|
|
68
69
|
## Deployment boundaries
|
|
69
70
|
|
|
70
|
-
- `databricks-app` runs the Node server inside Databricks Apps and emits `app.yaml` plus bundle assets.
|
|
71
|
+
- `databricks-app` runs the Node server inside Databricks Apps and emits `app.yaml` plus bundle assets. An optional `databricks.app.genie` binding emits a `genie_space` resource with `CAN_RUN` by default and injects `DATABRICKS_GENIE_AGENT_ID` through `valueFrom`; edit/manage requires `authoring: true`.
|
|
71
72
|
- `databricks-app` exposes durable persistent agents at the OpenAI-compatible `/responses` endpoint.
|
|
72
73
|
- `databricks-serving` emits an MLflow `ResponsesAgent` proxy that calls the App's `/responses` URL. It does not run the TypeScript agent inside Model Serving.
|
|
73
74
|
- `--mock` validates the local model loop only. It does not validate Databricks API contracts, OAuth scopes, Unity Catalog grants, SQL behavior, or a deployment.
|
|
74
75
|
|
|
75
|
-
## Governed resource
|
|
76
|
+
## Governed resource management
|
|
76
77
|
|
|
77
78
|
Model-exposed authoring flags fail closed unless `governance.stewardAudience` covers every enabled
|
|
78
79
|
service. `allowUnapprovedAuthoring: true` is an explicit local-development escape hatch. Structured
|
|
@@ -82,20 +83,29 @@ binds approval grants to the exact call, input digest, and executing identity. S
|
|
|
82
83
|
accept only SDK `SecretRef` values resolved by a server-side `SecretProvider`.
|
|
83
84
|
Existing clusters require an explicit `allowedExistingClusterIds` entry, and model-facing serving
|
|
84
85
|
tools reject raw `environmentVars`.
|
|
86
|
+
Genie management is enabled by `genie.manage` and requires a `DatabricksManagedResourceStore`; use
|
|
87
|
+
the Lakebase implementation in production. Model tools accept normalized version-2 configuration
|
|
88
|
+
and expose SQL examples, joins, snippets, and benchmarks only when a server-side
|
|
89
|
+
`genie.manage.sqlPolicy` returns every referenced catalog
|
|
90
|
+
object. Delete is limited to exact Harness-managed resources and treats an already-trashed retry as
|
|
91
|
+
idempotent. Raw Genie exports remain typed-client-only.
|
|
85
92
|
|
|
86
93
|
Run `pnpm test:coverage:authoring` for the focused approval/governance/Jobs/certification gate.
|
|
87
|
-
Protected workspace certification can create and remove reserved-prefix resources for all
|
|
94
|
+
Protected workspace certification can create and remove reserved-prefix resources for all management
|
|
88
95
|
surfaces; crash leftovers are handled by `scripts/sweep-databricks-authoring-certification.mjs`.
|
|
89
96
|
Jobs, Lakeflow, AI Search administration, custom-model serving, managed-only UC administration,
|
|
90
|
-
workspace writes,
|
|
91
|
-
for the exact `1.
|
|
92
|
-
|
|
97
|
+
workspace writes, secret-reference writes, and Genie Agent management are stable for the documented
|
|
98
|
+
scope with retained Azure `eastus2` OBO evidence for the exact `1.8.0` candidate artifact. The run
|
|
99
|
+
passed all ten required checks and left both cleanup sweeps empty. Provisioned throughput and AI
|
|
100
|
+
Gateway administration remain separate partial capabilities. Agent Mode streaming is a separately
|
|
101
|
+
configured Beta contract and requires Databricks preview enrollment; credential-free SSE regression
|
|
102
|
+
tests do not imply protected-workspace support.
|
|
93
103
|
|
|
94
104
|
Capability metadata separates `contractClouds` (typed API targets) from `clouds` (clouds represented
|
|
95
105
|
by linked retained live evidence). Do not use contract portability as proof that an unlisted
|
|
96
106
|
cloud/region passed certification.
|
|
97
107
|
|
|
98
|
-
See [Databricks resource
|
|
108
|
+
See [Databricks resource management](https://harness.fabric.pro/docs/databricks/authoring).
|
|
99
109
|
|
|
100
110
|
## Unity Catalog Agent Services
|
|
101
111
|
|
package/dist/agent.d.ts
CHANGED
|
@@ -1,45 +1,21 @@
|
|
|
1
|
-
import type { AgentProfile,
|
|
2
|
-
import type { ApprovalOptions, CapabilityPolicy, CostLimit } from "@fabric-harness/sdk";
|
|
1
|
+
import type { AgentDefinition, AgentProfile, AgentRunContext, DefinedAgent, JsonObject, ModelProvider, SandboxBackend, ToolDef } from "@fabric-harness/sdk";
|
|
3
2
|
import type { DatabricksBundle, DatabricksBundleConfig } from "./index.js";
|
|
4
|
-
export
|
|
5
|
-
name?: string;
|
|
6
|
-
description?: string;
|
|
7
|
-
instructions?: string;
|
|
8
|
-
input?: Schema<JsonObject>;
|
|
9
|
-
output?: Schema<unknown>;
|
|
10
|
-
model?: string;
|
|
11
|
-
target?: "node" | "temporal-worker";
|
|
12
|
-
skills?: Skill[];
|
|
13
|
-
triggers?: AgentTriggers;
|
|
14
|
-
databricks: DatabricksBundleConfig;
|
|
15
|
-
modelProvider?: ModelProvider;
|
|
16
|
-
tools?: ToolDef[] | string[];
|
|
17
|
-
sandbox?: SandboxBackend;
|
|
18
|
-
profile?: AgentProfile;
|
|
19
|
-
policy?: CapabilityPolicy;
|
|
20
|
-
costBudget?: CostLimit;
|
|
21
|
-
approvals?: ApprovalOptions;
|
|
22
|
-
}
|
|
23
|
-
export interface DefineDatabricksAgentOptions {
|
|
24
|
-
name?: string;
|
|
25
|
-
description?: string;
|
|
26
|
-
instructions?: string;
|
|
27
|
-
input?: Schema<JsonObject>;
|
|
28
|
-
output?: Schema<unknown>;
|
|
29
|
-
model?: string;
|
|
30
|
-
target?: "node" | "temporal-worker";
|
|
31
|
-
skills?: Skill[];
|
|
32
|
-
triggers?: AgentTriggers;
|
|
3
|
+
export type DefineDatabricksAgentOptions<TInput = JsonObject, TOutput = unknown> = Omit<AgentDefinition<TInput, TOutput>, "run" | "tools"> & {
|
|
33
4
|
databricks?: DatabricksBundleConfig;
|
|
34
5
|
modelProvider?: ModelProvider;
|
|
35
|
-
tools?: ToolDef
|
|
6
|
+
tools?: Array<ToolDef | string>;
|
|
36
7
|
sandbox?: SandboxBackend;
|
|
37
8
|
profile?: AgentProfile;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
9
|
+
run?: (context: AgentRunContext<TInput> & {
|
|
10
|
+
databricks: DatabricksBundle;
|
|
11
|
+
}) => Promise<TOutput> | TOutput;
|
|
12
|
+
};
|
|
13
|
+
/** @deprecated Use {@link DefineDatabricksAgentOptions}. */
|
|
14
|
+
export type DatabricksAgentOptions<TInput = JsonObject, TOutput = unknown> = DefineDatabricksAgentOptions<TInput, TOutput> & {
|
|
15
|
+
databricks: DatabricksBundleConfig;
|
|
16
|
+
};
|
|
17
|
+
/** @deprecated Use {@link defineDatabricksAgent}. Removed in Fabric Harness 3.0. */
|
|
42
18
|
export declare function databricksAgent(options: DatabricksAgentOptions): DefinedAgent<JsonObject, unknown>;
|
|
43
|
-
export declare function defineDatabricksAgent(options?: DefineDatabricksAgentOptions): DefinedAgent<
|
|
19
|
+
export declare function defineDatabricksAgent<TInput = JsonObject, TOutput = unknown>(options?: DefineDatabricksAgentOptions<TInput, TOutput>): DefinedAgent<TInput, TOutput>;
|
|
44
20
|
export declare function resolveToolRefs(bundle: DatabricksBundle, refs: string[]): ToolDef[];
|
|
45
21
|
//# sourceMappingURL=agent.d.ts.map
|
package/dist/agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,eAAe,EAEf,YAAY,EAGZ,UAAU,EACV,aAAa,EACb,cAAc,EACd,OAAO,EACR,MAAM,qBAAqB,CAAC;AAG7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAG3E,MAAM,MAAM,4BAA4B,CAAC,MAAM,GAAG,UAAU,EAAE,OAAO,GAAG,OAAO,IAAI,IAAI,CACrF,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,KAAK,GAAG,OAAO,CAChB,GAAG;IACF,UAAU,CAAC,EAAE,sBAAsB,CAAC;IACpC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,KAAK,CAAC,EAAE,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,GAAG,CAAC,EAAE,CACJ,OAAO,EAAE,eAAe,CAAC,MAAM,CAAC,GAAG;QAAE,UAAU,EAAE,gBAAgB,CAAA;KAAE,KAChE,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;CACjC,CAAC;AAEF,4DAA4D;AAC5D,MAAM,MAAM,sBAAsB,CAChC,MAAM,GAAG,UAAU,EACnB,OAAO,GAAG,OAAO,IACf,4BAA4B,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAAE,UAAU,EAAE,sBAAsB,CAAA;CAAE,CAAC;AAkE3F,oFAAoF;AACpF,wBAAgB,eAAe,CAC7B,OAAO,EAAE,sBAAsB,GAC9B,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAEnC;AAED,wBAAgB,qBAAqB,CAAC,MAAM,GAAG,UAAU,EAAE,OAAO,GAAG,OAAO,EAC1E,OAAO,GAAE,4BAA4B,CAAC,MAAM,EAAE,OAAO,CAAM,GAC1D,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CA0C/B;AAuBD,wBAAgB,eAAe,CAAC,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CAgCnF"}
|
package/dist/agent.js
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineAgent, mergeCapabilityPolicies } from "@fabric-harness/sdk/strict";
|
|
2
2
|
import { databricksPrincipalFromEnv } from "./identity.js";
|
|
3
3
|
import { databricks } from "./index.js";
|
|
4
|
-
function resolveTools(bundle, tools) {
|
|
5
|
-
if (!tools)
|
|
6
|
-
return [];
|
|
7
|
-
const stringTools = tools.filter((t) => typeof t === "string");
|
|
8
|
-
const toolDefs = tools.filter((t) => typeof t !== "string");
|
|
9
|
-
if (stringTools.length > 0) {
|
|
10
|
-
const resolved = resolveToolRefs(bundle, stringTools);
|
|
11
|
-
return [...resolved, ...toolDefs];
|
|
12
|
-
}
|
|
13
|
-
return toolDefs;
|
|
14
|
-
}
|
|
15
4
|
function mergeProfile(options) {
|
|
16
5
|
const profile = options?.profile;
|
|
17
6
|
if (!profile)
|
|
@@ -42,133 +31,87 @@ function mergeOptions(options) {
|
|
|
42
31
|
: {}),
|
|
43
32
|
};
|
|
44
33
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
run: (context) => runWithBundle(context, bundle, {
|
|
69
|
-
...(merged.modelProvider ? { modelProvider: merged.modelProvider } : {}),
|
|
70
|
-
...(merged.tools ? { tools: merged.tools } : {}),
|
|
71
|
-
...(merged.skills ? { skills: merged.skills } : {}),
|
|
72
|
-
...(merged.sandbox ? { sandbox: merged.sandbox } : {}),
|
|
73
|
-
}),
|
|
34
|
+
function bindDatabricksContext(context, bundle, init, defaultInit) {
|
|
35
|
+
let agentPromise;
|
|
36
|
+
let sessionPromise;
|
|
37
|
+
const getAgent = () => {
|
|
38
|
+
agentPromise ??= init(defaultInit);
|
|
39
|
+
return agentPromise;
|
|
40
|
+
};
|
|
41
|
+
const session = (id, options) => {
|
|
42
|
+
if (id === undefined && options === undefined) {
|
|
43
|
+
sessionPromise ??= getAgent().then((agent) => agent.session());
|
|
44
|
+
return sessionPromise;
|
|
45
|
+
}
|
|
46
|
+
return getAgent().then((agent) => agent.session(id, options));
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
...context,
|
|
50
|
+
databricks: bundle,
|
|
51
|
+
init,
|
|
52
|
+
session,
|
|
53
|
+
prompt: async (text, options) => (await session()).prompt(text, options),
|
|
54
|
+
skill: async (name, options) => (await session()).skill(name, options),
|
|
55
|
+
task: async (text, options) => (await session()).task(text, options),
|
|
56
|
+
shell: async (command, options) => (await session()).shell(command, options),
|
|
74
57
|
};
|
|
75
|
-
if (merged.name !== undefined)
|
|
76
|
-
def.name = merged.name;
|
|
77
|
-
if (merged.description !== undefined)
|
|
78
|
-
def.description = merged.description;
|
|
79
|
-
if (merged.instructions !== undefined)
|
|
80
|
-
def.instructions = merged.instructions;
|
|
81
|
-
if (merged.input !== undefined)
|
|
82
|
-
def.input = merged.input;
|
|
83
|
-
if (merged.output !== undefined)
|
|
84
|
-
def.output = merged.output;
|
|
85
|
-
if (merged.model !== undefined)
|
|
86
|
-
def.model = merged.model;
|
|
87
|
-
if (merged.target !== undefined)
|
|
88
|
-
def.target = merged.target;
|
|
89
|
-
if (merged.skills !== undefined)
|
|
90
|
-
def.skills = merged.skills;
|
|
91
|
-
if (merged.triggers !== undefined)
|
|
92
|
-
def.triggers = merged.triggers;
|
|
93
|
-
if (merged.policy !== undefined)
|
|
94
|
-
def.policy = merged.policy;
|
|
95
|
-
if (merged.costBudget !== undefined)
|
|
96
|
-
def.costBudget = merged.costBudget;
|
|
97
|
-
if (merged.approvals !== undefined)
|
|
98
|
-
def.approvals = merged.approvals;
|
|
99
|
-
return def;
|
|
100
58
|
}
|
|
59
|
+
/** @deprecated Use {@link defineDatabricksAgent}. Removed in Fabric Harness 3.0. */
|
|
101
60
|
export function databricksAgent(options) {
|
|
102
|
-
return
|
|
61
|
+
return defineDatabricksAgent(options);
|
|
103
62
|
}
|
|
104
|
-
export function defineDatabricksAgent(options) {
|
|
63
|
+
export function defineDatabricksAgent(options = {}) {
|
|
105
64
|
const merged = options ? mergeOptions(options) : {};
|
|
65
|
+
const { databricks: explicitConfig, modelProvider, tools = [], sandbox, profile: _profile, run, ...definition } = merged;
|
|
66
|
+
const directTools = tools.filter((tool) => typeof tool !== "string");
|
|
67
|
+
const toolRefs = tools.filter((tool) => typeof tool === "string");
|
|
106
68
|
const def = {
|
|
69
|
+
...definition,
|
|
70
|
+
...(directTools.length > 0 ? { tools: directTools } : {}),
|
|
107
71
|
run: async (context) => {
|
|
108
|
-
// If explicit databricks config is provided, use it directly
|
|
109
|
-
if (merged.databricks) {
|
|
110
|
-
const bundle = databricks(merged.databricks);
|
|
111
|
-
return runWithBundle(context, bundle, {
|
|
112
|
-
...(merged.modelProvider ? { modelProvider: merged.modelProvider } : {}),
|
|
113
|
-
...(merged.tools ? { tools: merged.tools } : {}),
|
|
114
|
-
...(merged.skills ? { skills: merged.skills } : {}),
|
|
115
|
-
...(merged.sandbox ? { sandbox: merged.sandbox } : {}),
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
// Otherwise, read from env (or use a dummy config in mock mode)
|
|
119
72
|
const env = context.env ?? {};
|
|
120
|
-
const
|
|
121
|
-
const host = rawHost ? (rawHost.includes("://") ? rawHost : `https://${rawHost}`) : undefined;
|
|
122
|
-
if (!host && env.FABRIC_MOCK !== "1") {
|
|
123
|
-
throw new Error("Missing DATABRICKS_HOST environment variable. Set it or pass an explicit databricks config.");
|
|
124
|
-
}
|
|
125
|
-
const principal = env.FABRIC_MOCK === "1"
|
|
126
|
-
? { kind: "pat", token: "mock-token" }
|
|
127
|
-
: databricksPrincipalFromEnv(env);
|
|
128
|
-
const config = {
|
|
129
|
-
host: host ?? "https://mock.databricks.com",
|
|
130
|
-
principal,
|
|
131
|
-
...(env.DATABRICKS_MODEL ? { model: env.DATABRICKS_MODEL } : {}),
|
|
132
|
-
...(env.DATABRICKS_WAREHOUSE_ID ? { warehouseId: env.DATABRICKS_WAREHOUSE_ID } : {}),
|
|
133
|
-
...(env.FABRIC_MOCK === "1" ? { warehouseId: "mock-warehouse-id" } : {}),
|
|
134
|
-
};
|
|
73
|
+
const config = explicitConfig ?? databricksConfigFromEnv(env);
|
|
135
74
|
const bundle = databricks(config);
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
75
|
+
if (toolRefs.length > 0)
|
|
76
|
+
resolveToolRefs(bundle, toolRefs);
|
|
77
|
+
const directNames = new Set(directTools.map((tool) => tool.name));
|
|
78
|
+
const bundleTools = bundle.tools.filter((tool) => !directNames.has(tool.name));
|
|
79
|
+
const providerInit = (initOptions = {}) => {
|
|
80
|
+
const policy = mergeCapabilityPolicies(bundle.policy, initOptions.policy);
|
|
81
|
+
return context.init({
|
|
82
|
+
...initOptions,
|
|
83
|
+
modelProvider: initOptions.modelProvider ?? modelProvider ?? bundle.modelProvider,
|
|
84
|
+
tools: [...bundleTools, ...(initOptions.tools ?? [])],
|
|
85
|
+
...(policy ? { policy } : {}),
|
|
86
|
+
...(bundle.store && initOptions.store === undefined ? { store: bundle.store } : {}),
|
|
87
|
+
...(sandbox && initOptions.sandbox === undefined ? { sandbox } : {}),
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
const providerContext = bindDatabricksContext(context, bundle, providerInit, definition.init);
|
|
91
|
+
if (run)
|
|
92
|
+
return run(providerContext);
|
|
93
|
+
const question = context.input?.question ?? "What would you like to know?";
|
|
94
|
+
return providerContext.prompt(question);
|
|
145
95
|
},
|
|
146
96
|
};
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
if (merged.policy !== undefined)
|
|
166
|
-
def.policy = merged.policy;
|
|
167
|
-
if (merged.costBudget !== undefined)
|
|
168
|
-
def.costBudget = merged.costBudget;
|
|
169
|
-
if (merged.approvals !== undefined)
|
|
170
|
-
def.approvals = merged.approvals;
|
|
171
|
-
return agent(def);
|
|
97
|
+
return defineAgent(def);
|
|
98
|
+
}
|
|
99
|
+
function databricksConfigFromEnv(env) {
|
|
100
|
+
const rawHost = env.DATABRICKS_HOST;
|
|
101
|
+
const host = rawHost ? (rawHost.includes("://") ? rawHost : `https://${rawHost}`) : undefined;
|
|
102
|
+
if (!host && env.FABRIC_MOCK !== "1") {
|
|
103
|
+
throw new Error("Missing DATABRICKS_HOST environment variable. Set it or pass an explicit databricks config.");
|
|
104
|
+
}
|
|
105
|
+
const principal = env.FABRIC_MOCK === "1"
|
|
106
|
+
? { kind: "pat", token: "mock-token" }
|
|
107
|
+
: databricksPrincipalFromEnv(env);
|
|
108
|
+
return {
|
|
109
|
+
host: host ?? "https://mock.databricks.com",
|
|
110
|
+
principal,
|
|
111
|
+
...(env.DATABRICKS_MODEL ? { model: env.DATABRICKS_MODEL } : {}),
|
|
112
|
+
...(env.DATABRICKS_WAREHOUSE_ID ? { warehouseId: env.DATABRICKS_WAREHOUSE_ID } : {}),
|
|
113
|
+
...(env.FABRIC_MOCK === "1" ? { warehouseId: "mock-warehouse-id" } : {}),
|
|
114
|
+
};
|
|
172
115
|
}
|
|
173
116
|
export function resolveToolRefs(bundle, refs) {
|
|
174
117
|
const toolMap = new Map();
|
package/dist/agent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAClF,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAsBxC,SAAS,YAAY,CAAC,OAA+C;IACnE,MAAM,OAAO,GAAG,OAAO,EAAE,OAAO,CAAC;IACjC,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,C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AAiC;QACzC,YAAY,EAAE,uBAAuB;QACrC,MAAM,EAAE,QAAQ;QAChB,UAAU,EAAE,qBAAqB;QACjC,KAAK,EAAE,sBAAsB;QAC7B,eAAe,EAAE,0BAA0B;QAC3C,iBAAiB,EAAE,4BAA4B;QAC/C,gBAAgB,EAAE,2BAA2B;QAC7C,eAAe,EAAE,0BAA0B;QAC3C,WAAW,EAAE,wBAAwB;QACrC,gBAAgB,EAAE,2BAA2B;KAC9C,CAAC;IAEF,MAAM,MAAM,GAAc,EAAE,CAAC;IAC7B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC;QAC1C,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,SAAS,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACjD,MAAM,IAAI,KAAK,CAAC,2BAA2B,GAAG,uBAAuB,SAAS,EAAE,CAAC,CAAC;QACpF,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -5,6 +5,7 @@ import { type DatabricksSearchIndexSpec } from "./ai-search-admin.js";
|
|
|
5
5
|
import { type DatabricksComputePolicy, type DatabricksJobSpec } from "./jobs-authoring.js";
|
|
6
6
|
import { type DatabricksPipelineSpec } from "./lakeflow-authoring.js";
|
|
7
7
|
import { type DatabricksServingEndpointSpec } from "./serving-admin.js";
|
|
8
|
+
import { type DatabricksGenieAgentSpecV2, type DatabricksGenieSqlPolicy } from "./genie-authoring.js";
|
|
8
9
|
export interface DatabricksAuthoringCertificationFixtures {
|
|
9
10
|
enabled: boolean;
|
|
10
11
|
host: string;
|
|
@@ -45,6 +46,11 @@ export interface DatabricksAuthoringCertificationFixtures {
|
|
|
45
46
|
secretName: string;
|
|
46
47
|
provider: SecretProvider;
|
|
47
48
|
};
|
|
49
|
+
genie?: {
|
|
50
|
+
spec: DatabricksGenieAgentSpecV2;
|
|
51
|
+
question: string;
|
|
52
|
+
sqlPolicy?: DatabricksGenieSqlPolicy;
|
|
53
|
+
};
|
|
48
54
|
}
|
|
49
55
|
export declare function createDatabricksAuthoringCertificationChecks(fixtures: DatabricksAuthoringCertificationFixtures): DatabricksCertificationCheck[];
|
|
50
56
|
//# sourceMappingURL=authoring-certification.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authoring-certification.d.ts","sourceRoot":"","sources":["../src/authoring-certification.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,eAAe,EAEpB,KAAK,cAAc,EAEpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,KAAK,4BAA4B,EAElC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAGL,KAAK,yBAAyB,EAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,KAAK,uBAAuB,EAG5B,KAAK,iBAAiB,EACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,KAAK,6BAA6B,EACnC,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"authoring-certification.d.ts","sourceRoot":"","sources":["../src/authoring-certification.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,eAAe,EAEpB,KAAK,cAAc,EAEpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,KAAK,4BAA4B,EAElC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EA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jC,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,cAAc,CAAA;KAAE,CAAC;IACvF,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,0BAA0B,CAAC;QACjC,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,wBAAwB,CAAC;KACtC,CAAC;CACH;AAsED,wBAAgB,4CAA4C,CAC1D,QAAQ,EAAE,wCAAwC,GACjD,4BAA4B,EAAE,CA8BhC"}
|
|
@@ -8,6 +8,9 @@ import { databricksSecretsAuthoringTools } from "./secrets-authoring.js";
|
|
|
8
8
|
import { databricksUnityCatalogAdminTools } from "./unity-catalog-admin.js";
|
|
9
9
|
import { databricksWorkspaceAuthoringTools } from "./workspace-authoring.js";
|
|
10
10
|
import { databricksGovernancePolicy, withGovernance } from "./governance.js";
|
|
11
|
+
import { DatabricksGenieAdmin, databricksGenieAuthoringTools, } from "./genie-authoring.js";
|
|
12
|
+
import { databricksGenie } from "./genie.js";
|
|
13
|
+
import { MemoryDatabricksManagedResourceStore } from "./managed-resource.js";
|
|
11
14
|
class GovernedCertificationRunner {
|
|
12
15
|
fixtures;
|
|
13
16
|
lineage = [];
|
|
@@ -79,6 +82,7 @@ export function createDatabricksAuthoringCertificationChecks(fixtures) {
|
|
|
79
82
|
check("uc-admin-obo-execution", fixtures.enabled && fixtures.authMode === "on-behalf-of" && Boolean(fixtures.unityCatalog), () => unityCatalogLifecycle(fixtures)),
|
|
80
83
|
check("workspace-write", fixtures.enabled && Boolean(fixtures.workspace), () => workspaceLifecycle(fixtures)),
|
|
81
84
|
check("secrets-write", fixtures.enabled && Boolean(fixtures.secrets), () => secretsLifecycle(fixtures)),
|
|
85
|
+
check("genie-authoring", fixtures.enabled && Boolean(fixtures.genie), () => genieLifecycle(fixtures)),
|
|
82
86
|
];
|
|
83
87
|
}
|
|
84
88
|
function check(id, configured, run) {
|
|
@@ -104,7 +108,9 @@ function authoringEvidenceChecks(id) {
|
|
|
104
108
|
? "workspace"
|
|
105
109
|
: id === "secrets-write"
|
|
106
110
|
? "secrets"
|
|
107
|
-
:
|
|
111
|
+
: id === "genie-authoring"
|
|
112
|
+
? "genie-authoring"
|
|
113
|
+
: undefined;
|
|
108
114
|
if (!prefix)
|
|
109
115
|
return ["approval.request", "approval.consume", "lineage.write"];
|
|
110
116
|
return [
|
|
@@ -373,6 +379,68 @@ async function secretsLifecycle(fixtures) {
|
|
|
373
379
|
});
|
|
374
380
|
return runner.evidence(lifecycle);
|
|
375
381
|
}
|
|
382
|
+
async function genieLifecycle(fixtures) {
|
|
383
|
+
const config = requiredFixture(fixtures.genie, "genie");
|
|
384
|
+
const runner = new GovernedCertificationRunner(fixtures);
|
|
385
|
+
const store = new MemoryDatabricksManagedResourceStore();
|
|
386
|
+
const tools = databricksGenieAuthoringTools(fixtures.client, {
|
|
387
|
+
managedResourceStore: store,
|
|
388
|
+
principal: fixtures.executingPrincipal.ucPrincipal ?? fixtures.executingPrincipal.id,
|
|
389
|
+
destructive: true,
|
|
390
|
+
...(config.sqlPolicy ? { sqlPolicy: config.sqlPolicy } : {}),
|
|
391
|
+
});
|
|
392
|
+
const api = new DatabricksGenieAdmin(fixtures.client, { managedResourceStore: store });
|
|
393
|
+
let currentFingerprint = "";
|
|
394
|
+
const lifecycle = await runDatabricksAuthoringLifecycle({
|
|
395
|
+
kind: "genie-agent",
|
|
396
|
+
create: async () => {
|
|
397
|
+
const created = await runner.execute(findTool(tools, "databricks_create_genie_agent"), { spec: config.spec });
|
|
398
|
+
currentFingerprint = created.fingerprint;
|
|
399
|
+
return created;
|
|
400
|
+
},
|
|
401
|
+
identify: (created) => created.agentId,
|
|
402
|
+
verifyCreated: async (created) => {
|
|
403
|
+
const row = await api.get(created.agentId, { includeConfiguration: true });
|
|
404
|
+
if (!row.serializedSpace)
|
|
405
|
+
throw new Error("Created Genie Agent configuration was not readable.");
|
|
406
|
+
const managed = await store.get("genie-agent", created.agentId);
|
|
407
|
+
if (!managed)
|
|
408
|
+
throw new Error("Created Genie Agent had no managed-resource provenance.");
|
|
409
|
+
},
|
|
410
|
+
mutate: async (created) => {
|
|
411
|
+
const nextSpec = {
|
|
412
|
+
...config.spec,
|
|
413
|
+
sampleQuestions: [
|
|
414
|
+
...(config.spec.sampleQuestions ?? []),
|
|
415
|
+
{ question: "Fabric Harness certification mutation" },
|
|
416
|
+
],
|
|
417
|
+
};
|
|
418
|
+
const updated = await runner.execute(findTool(tools, "databricks_update_genie_agent"), {
|
|
419
|
+
agentId: created.agentId,
|
|
420
|
+
expectedFingerprint: currentFingerprint,
|
|
421
|
+
set: { spec: nextSpec },
|
|
422
|
+
});
|
|
423
|
+
currentFingerprint = updated.fingerprint;
|
|
424
|
+
return nextSpec;
|
|
425
|
+
},
|
|
426
|
+
verifyMutated: async (created) => {
|
|
427
|
+
const row = await api.get(created.agentId, { includeConfiguration: true });
|
|
428
|
+
if (!row.serializedSpace?.includes("Fabric Harness certification mutation"))
|
|
429
|
+
throw new Error("Genie Agent mutation was not observable.");
|
|
430
|
+
const answer = await databricksGenie(fixtures.client, { agentId: created.agentId }).ask({
|
|
431
|
+
question: config.question,
|
|
432
|
+
});
|
|
433
|
+
if (!answer.conversationId || !answer.messageId)
|
|
434
|
+
throw new Error("Genie Agent query did not return conversation provenance.");
|
|
435
|
+
},
|
|
436
|
+
delete: (created) => runner.execute(findTool(tools, "databricks_delete_genie_agent"), {
|
|
437
|
+
agentId: created.agentId,
|
|
438
|
+
expectedFingerprint: currentFingerprint,
|
|
439
|
+
}),
|
|
440
|
+
verifyDeleted: (created) => expectNotFound(() => api.get(created.agentId)),
|
|
441
|
+
});
|
|
442
|
+
return { ...runner.evidence(lifecycle), queryVerified: true };
|
|
443
|
+
}
|
|
376
444
|
function findTool(tools, name) {
|
|
377
445
|
const tool = tools.find((candidate) => candidate.name === name);
|
|
378
446
|
if (!tool)
|
|
@@ -389,7 +457,7 @@ async function expectNotFound(operation) {
|
|
|
389
457
|
await operation();
|
|
390
458
|
}
|
|
391
459
|
catch (error) {
|
|
392
|
-
if (/\b404\b|not[ _-]?found|does not exist|RESOURCE_DOES_NOT_EXIST/i.test(error instanceof Error ? error.message : String(error)))
|
|
460
|
+
if (/\b404\b|not[ _-]?found|does not exist|RESOURCE_DOES_NOT_EXIST|has been trashed/i.test(error instanceof Error ? error.message : String(error)))
|
|
393
461
|
return;
|
|
394
462
|
throw error;
|
|
395
463
|
}
|