@fabric-harness/databricks 4.0.0 → 4.0.1

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 CHANGED
@@ -8,8 +8,8 @@ First-party Databricks integration helpers for Fabric Harness, with mock-first l
8
8
  npm install @fabric-harness/databricks @fabric-harness/sdk
9
9
  ```
10
10
 
11
- Node 22 or newer is required. The package pins and bundles the reviewed `@databricks/sdk-*`
12
- 0.21.0 modules so generated service clients own stable API serialization and authentication.
11
+ Node 22 or newer is required. The package exact-pins every reviewed `@databricks/sdk-*` module to
12
+ SDK release `0.21.0`, so generated service clients own stable API serialization and authentication.
13
13
 
14
14
  Add `@fabric-harness/node` and `pg` only when using the Node persistence helpers.
15
15
 
@@ -73,14 +73,17 @@ await jobs.runJob({ jobId: 42, idempotencyToken: submission.id });
73
73
  adds governance, approval, lifecycle safety, retries for explicitly idempotent operations, lineage,
74
74
  and durable state; it does not reimplement stable Databricks service APIs. A small private preview
75
75
  transport remains only for APIs absent from the modular SDK: Agent Services, Genie Agent Mode
76
- streaming, Genie ACLs, Workspace object import/export, MLflow 3 tracing, and AI Gateway/model-service
77
- discovery. Callers use typed bundle capabilities rather than constructing that transport.
76
+ streaming, Genie ACLs, Workspace object import/export, MLflow 3 tracing, AI Gateway/model-service
77
+ discovery, and the ResponsesAgent custom request schema. Its exhaustive method-and-path allowlist
78
+ rejects every other route before credential resolution or network I/O. Callers use typed bundle
79
+ capabilities rather than constructing that transport.
78
80
 
79
81
  One compatibility exception is deliberately quarantined: SDK 0.21's generated Genie query-result
80
82
  parser rejects Databricks' real row-array payload. Genie retries that one decoded response through the
81
83
  preview transport only when the generated client raises the exact schema error. Authentication,
82
84
  conversation lifecycle, polling, and unrelated failures continue through or fail from the official
83
- client. A source-boundary test prevents this exception from spreading to stable services.
85
+ client. Source-boundary and runtime-denial tests prevent this exception from spreading to stable
86
+ services.
84
87
 
85
88
  ## Shipped surface
86
89
 
package/dist/agent.js CHANGED
@@ -17142,6 +17142,64 @@ function retryDelayMs(response, attempt, base2) {
17142
17142
  }
17143
17143
  return base2 * 2 ** attempt;
17144
17144
  }
17145
+ var DATABRICKS_RAW_PROTOCOL_RULES = [
17146
+ {
17147
+ id: "workspace-objects",
17148
+ methods: ["GET", "POST"],
17149
+ path: /^\/api\/2\.0\/workspace\/(?:delete|export|get-status|import|list|mkdirs)$/u
17150
+ },
17151
+ {
17152
+ id: "mlflow-traces-v3",
17153
+ methods: ["POST"],
17154
+ path: /^\/api\/3\.0\/mlflow\/traces$/u
17155
+ },
17156
+ {
17157
+ id: "ai-gateway-discovery",
17158
+ methods: ["GET"],
17159
+ path: /^\/api\/(?:ai-gateway\/v2\/endpoints|2\.1\/unity-catalog\/model-services)$/u
17160
+ },
17161
+ {
17162
+ id: "agent-services-beta",
17163
+ methods: ["GET", "POST", "PATCH", "DELETE"],
17164
+ path: /^\/api\/2\.1\/unity-catalog\/(?:agent-services(?:\/[^/?#]+)?|permissions\/agent-service\/[^/?#]+)$/u
17165
+ },
17166
+ {
17167
+ id: "genie-permissions",
17168
+ methods: ["GET", "PATCH"],
17169
+ path: /^\/api\/2\.0\/permissions\/genie\/[^/?#]+$/u
17170
+ },
17171
+ {
17172
+ id: "genie-agent-mode-beta",
17173
+ methods: ["GET", "POST"],
17174
+ path: /^\/api\/2\.0\/genie\/agents\/[^/?#]+\/(?:responses|conversations\/[^/?#]+\/items)$/u
17175
+ },
17176
+ {
17177
+ id: "genie-query-result-sdk-compatibility",
17178
+ methods: ["GET"],
17179
+ path: /^\/api\/2\.0\/genie\/spaces\/[^/?#]+\/conversations\/[^/?#]+\/messages\/[^/?#]+\/attachments\/[^/?#]+\/query-result$/u
17180
+ },
17181
+ {
17182
+ id: "responses-agent-custom-schema",
17183
+ methods: ["POST"],
17184
+ path: /^\/serving-endpoints\/[^/?#]+\/invocations$/u
17185
+ }
17186
+ ];
17187
+ function assertRawProtocolAllowed(method, path) {
17188
+ const normalizedMethod = method.toUpperCase();
17189
+ if (!path.startsWith("/") || path.includes("?") || path.includes("#")) {
17190
+ throw new Error(
17191
+ `databricks raw protocol denied: ${normalizedMethod} ${path}; pass a relative path and structured query parameters.`
17192
+ );
17193
+ }
17194
+ const rule = DATABRICKS_RAW_PROTOCOL_RULES.find(
17195
+ (candidate) => candidate.methods.includes(normalizedMethod) && candidate.path.test(path)
17196
+ );
17197
+ if (!rule) {
17198
+ throw new Error(
17199
+ `databricks raw protocol denied: ${normalizedMethod} ${path}; use an official @databricks/sdk-* service client.`
17200
+ );
17201
+ }
17202
+ }
17145
17203
  var DatabricksPreviewClient = class {
17146
17204
  host;
17147
17205
  token;
@@ -17184,6 +17242,7 @@ var DatabricksPreviewClient = class {
17184
17242
  * intended for bounded binary downloads and streaming APIs such as Genie Agent Mode.
17185
17243
  */
17186
17244
  async requestRaw(method, path, body, query = {}, options = {}) {
17245
+ assertRawProtocolAllowed(method, path);
17187
17246
  const url2 = new URL(`${this.host}${path.startsWith("/") ? path : `/${path}`}`);
17188
17247
  for (const [key, value] of Object.entries(query))
17189
17248
  if (value !== void 0) url2.searchParams.set(key, String(value));
@@ -55461,13 +55520,7 @@ function stableDatabricksSdkClients(clients) {
55461
55520
  return sdk;
55462
55521
  }
55463
55522
  function createDatabricksNativeClients(options) {
55464
- const clientOptions = {
55465
- host: options.host,
55466
- credentials: options.credentials,
55467
- httpClient: fabricHttpClient(options.fetchImpl ?? fetch, options.extraHeaders),
55468
- profileOptions: { noProfile: true, disableEnv: true },
55469
- ...options.timeoutMs !== void 0 ? { timeout: options.timeoutMs } : {}
55470
- };
55523
+ const clientOptions = generatedClientOptions(options);
55471
55524
  return {
55472
55525
  jobs: new JobsClient(clientOptions),
55473
55526
  statements: new StatementExecutionClient(clientOptions),
@@ -55494,6 +55547,15 @@ function createDatabricksNativeClients(options) {
55494
55547
  })
55495
55548
  };
55496
55549
  }
55550
+ function generatedClientOptions(options) {
55551
+ return {
55552
+ host: options.host,
55553
+ credentials: options.credentials,
55554
+ httpClient: fabricHttpClient(options.fetchImpl ?? fetch, options.extraHeaders),
55555
+ profileOptions: { noProfile: true, disableEnv: true },
55556
+ ...options.timeoutMs !== void 0 ? { timeout: options.timeoutMs } : {}
55557
+ };
55558
+ }
55497
55559
  function fabricHttpClient(fetchImpl, extraHeaders) {
55498
55560
  return {
55499
55561
  async send(request) {