@ziggy-ai/client-sdk 0.7.2 → 0.7.4

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.
Files changed (2) hide show
  1. package/dist/index.js +106 -19
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,8 +1,5 @@
1
- // src/types.js
1
+ // src/types.ts
2
2
  var ZiggyError = class extends Error {
3
- status;
4
- code;
5
- details;
6
3
  constructor(message, status, code, details) {
7
4
  super(message);
8
5
  this.status = status;
@@ -12,7 +9,6 @@ var ZiggyError = class extends Error {
12
9
  }
13
10
  };
14
11
  var ZiggyConnectionError = class extends ZiggyError {
15
- retryable;
16
12
  constructor(message, retryable = true) {
17
13
  super(message, 0, "CONNECTION_ERROR");
18
14
  this.retryable = retryable;
@@ -20,16 +16,23 @@ var ZiggyConnectionError = class extends ZiggyError {
20
16
  }
21
17
  };
22
18
 
23
- // src/auth.js
24
- function buildHeaders(config, extra) {
25
- return {
19
+ // src/auth.ts
20
+ async function buildHeaders(config, extra) {
21
+ const headers = {
26
22
  "Content-Type": "application/json",
27
23
  "X-API-Key": config.apiKey,
28
24
  ...extra
29
25
  };
26
+ if (config.getAuthToken) {
27
+ const token = await config.getAuthToken();
28
+ if (token) {
29
+ headers["Authorization"] = `Bearer ${token}`;
30
+ }
31
+ }
32
+ return headers;
30
33
  }
31
34
 
32
- // src/connection.js
35
+ // src/connection.ts
33
36
  var Connection = class {
34
37
  config;
35
38
  constructor(config) {
@@ -40,7 +43,7 @@ var Connection = class {
40
43
  */
41
44
  async request(method, path, body, extraHeaders) {
42
45
  const url = `${this.config.baseUrl}/v1${path}`;
43
- const headers = buildHeaders(this.config, extraHeaders);
46
+ const headers = await buildHeaders(this.config, extraHeaders);
44
47
  const timeout = this.config.timeout ?? 3e4;
45
48
  const controller = new AbortController();
46
49
  const timer = setTimeout(() => controller.abort(), timeout);
@@ -63,12 +66,14 @@ var Connection = class {
63
66
  }
64
67
  return await response.json();
65
68
  } catch (error) {
66
- if (error instanceof ZiggyError)
67
- throw error;
69
+ if (error instanceof ZiggyError) throw error;
68
70
  if (error instanceof DOMException && error.name === "AbortError") {
69
71
  throw new ZiggyConnectionError("Request timed out", true);
70
72
  }
71
- throw new ZiggyConnectionError(error instanceof Error ? error.message : "Connection failed", true);
73
+ throw new ZiggyConnectionError(
74
+ error instanceof Error ? error.message : "Connection failed",
75
+ true
76
+ );
72
77
  } finally {
73
78
  clearTimeout(timer);
74
79
  }
@@ -78,7 +83,7 @@ var Connection = class {
78
83
  */
79
84
  async streamRequest(method, path, body) {
80
85
  const url = `${this.config.baseUrl}/v1${path}`;
81
- const headers = buildHeaders(this.config);
86
+ const headers = await buildHeaders(this.config);
82
87
  try {
83
88
  const response = await fetch(url, {
84
89
  method,
@@ -97,9 +102,11 @@ var Connection = class {
97
102
  }
98
103
  return response;
99
104
  } catch (error) {
100
- if (error instanceof ZiggyError)
101
- throw error;
102
- throw new ZiggyConnectionError(error instanceof Error ? error.message : "Connection failed", true);
105
+ if (error instanceof ZiggyError) throw error;
106
+ throw new ZiggyConnectionError(
107
+ error instanceof Error ? error.message : "Connection failed",
108
+ true
109
+ );
103
110
  }
104
111
  }
105
112
  };
@@ -762,7 +769,7 @@ var AnalyticsClient = class {
762
769
  }
763
770
  };
764
771
 
765
- // src/app.js
772
+ // src/app.ts
766
773
  var AppClient = class {
767
774
  connection;
768
775
  constructor(connection) {
@@ -839,6 +846,86 @@ var AppClient = class {
839
846
  async deleteCredentials() {
840
847
  return this.connection.request("DELETE", "/apps/credentials");
841
848
  }
849
+ // ─── Status ─────────────────────────────────────────────────────────────────
850
+ /**
851
+ * Get app setup status (brand, triggers, actions, agents, readiness).
852
+ */
853
+ async getStatus() {
854
+ return this.connection.request("GET", "/apps/status");
855
+ }
856
+ // ─── YOLO Mode ──────────────────────────────────────────────────────────────
857
+ /**
858
+ * Get YOLO mode configuration.
859
+ */
860
+ async getYoloConfig() {
861
+ return this.connection.request("GET", "/apps/yolo");
862
+ }
863
+ /**
864
+ * Enable/disable YOLO mode with configuration.
865
+ */
866
+ async setYoloConfig(config) {
867
+ return this.connection.request("PUT", "/apps/yolo", config);
868
+ }
869
+ // ─── Deployment Settings ────────────────────────────────────────────────────
870
+ /**
871
+ * Get deployment settings (policy + mode).
872
+ */
873
+ async getDeploymentSettings() {
874
+ return this.connection.request("GET", "/apps/deployment-settings");
875
+ }
876
+ /**
877
+ * Update deployment settings.
878
+ */
879
+ async updateDeploymentSettings(settings) {
880
+ return this.connection.request("PATCH", "/apps/deployment-settings", settings);
881
+ }
882
+ // ─── Triage Config ──────────────────────────────────────────────────────────
883
+ /**
884
+ * Get auto-triage configuration.
885
+ */
886
+ async getTriageConfig() {
887
+ return this.connection.request("GET", "/apps/triage-config");
888
+ }
889
+ /**
890
+ * Update auto-triage configuration.
891
+ */
892
+ async setTriageConfig(config) {
893
+ return this.connection.request("PUT", "/apps/triage-config", config);
894
+ }
895
+ // ─── Tool Configuration ─────────────────────────────────────────────────────
896
+ /**
897
+ * Get tool configuration (GitHub, Supabase).
898
+ */
899
+ async getToolConfig() {
900
+ return this.connection.request("GET", "/apps/tools");
901
+ }
902
+ /**
903
+ * Update tool configuration.
904
+ */
905
+ async setToolConfig(config) {
906
+ return this.connection.request("PATCH", "/apps/tools", config);
907
+ }
908
+ // ─── Observer Config ────────────────────────────────────────────────────────
909
+ /**
910
+ * Get per-app observer configuration (stored overrides + resolved with defaults).
911
+ */
912
+ async getObserverConfig() {
913
+ return this.connection.request("GET", "/apps/observer-config");
914
+ }
915
+ /**
916
+ * Set per-app observer configuration. Only include fields to override.
917
+ * Pass empty object or null to reset to defaults.
918
+ */
919
+ async setObserverConfig(config) {
920
+ return this.connection.request("PUT", "/apps/observer-config", config);
921
+ }
922
+ // ─── Audit ──────────────────────────────────────────────────────────────────
923
+ /**
924
+ * Trigger a full audit (security + quality + architecture + test gaps).
925
+ */
926
+ async triggerAudit() {
927
+ return this.connection.request("POST", "/audit");
928
+ }
842
929
  };
843
930
 
844
931
  // src/tickets.ts
@@ -1069,7 +1156,7 @@ var StorageClient = class {
1069
1156
  }
1070
1157
  };
1071
1158
 
1072
- // src/callback-handler.js
1159
+ // src/callback-handler.ts
1073
1160
  var CallbackHandler = class {
1074
1161
  handlers = /* @__PURE__ */ new Map();
1075
1162
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ziggy-ai/client-sdk",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "Client SDK for integrating with Ziggy's v1 API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",