@airstore/sdk 0.1.0 → 0.1.3

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 (80) hide show
  1. package/README.md +52 -12
  2. package/dist/cjs/airstore.js +30 -69
  3. package/dist/cjs/airstore.js.map +1 -1
  4. package/dist/cjs/index.js +18 -3
  5. package/dist/cjs/index.js.map +1 -1
  6. package/dist/cjs/resources/access-log.js +101 -0
  7. package/dist/cjs/resources/access-log.js.map +1 -0
  8. package/dist/cjs/resources/filesystem.js +5 -2
  9. package/dist/cjs/resources/filesystem.js.map +1 -1
  10. package/dist/cjs/resources/index.js +3 -3
  11. package/dist/cjs/resources/index.js.map +1 -1
  12. package/dist/cjs/resources/oauth.js +2 -0
  13. package/dist/cjs/resources/oauth.js.map +1 -1
  14. package/dist/cjs/resources/views.js +107 -0
  15. package/dist/cjs/resources/views.js.map +1 -0
  16. package/dist/cjs/resources/workspaces.js +1 -1
  17. package/dist/cjs/types/{smart-folders.js → access-log.js} +1 -1
  18. package/dist/cjs/types/access-log.js.map +1 -0
  19. package/dist/cjs/types/index.js +1 -1
  20. package/dist/cjs/types/index.js.map +1 -1
  21. package/dist/cjs/types/views.js +29 -0
  22. package/dist/cjs/types/views.js.map +1 -0
  23. package/dist/esm/airstore.js +30 -69
  24. package/dist/esm/airstore.js.map +1 -1
  25. package/dist/esm/index.js +3 -1
  26. package/dist/esm/index.js.map +1 -1
  27. package/dist/esm/resources/access-log.js +97 -0
  28. package/dist/esm/resources/access-log.js.map +1 -0
  29. package/dist/esm/resources/filesystem.js +5 -2
  30. package/dist/esm/resources/filesystem.js.map +1 -1
  31. package/dist/esm/resources/index.js +1 -1
  32. package/dist/esm/resources/index.js.map +1 -1
  33. package/dist/esm/resources/oauth.js +2 -0
  34. package/dist/esm/resources/oauth.js.map +1 -1
  35. package/dist/esm/resources/views.js +103 -0
  36. package/dist/esm/resources/views.js.map +1 -0
  37. package/dist/esm/resources/workspaces.js +1 -1
  38. package/dist/esm/types/access-log.js +2 -0
  39. package/dist/esm/types/access-log.js.map +1 -0
  40. package/dist/esm/types/index.js +1 -1
  41. package/dist/esm/types/index.js.map +1 -1
  42. package/dist/esm/types/views.js +26 -0
  43. package/dist/esm/types/views.js.map +1 -0
  44. package/dist/types/airstore.d.ts +28 -68
  45. package/dist/types/airstore.d.ts.map +1 -1
  46. package/dist/types/index.d.ts +5 -2
  47. package/dist/types/index.d.ts.map +1 -1
  48. package/dist/types/resources/access-log.d.ts +72 -0
  49. package/dist/types/resources/access-log.d.ts.map +1 -0
  50. package/dist/types/resources/filesystem.d.ts +4 -2
  51. package/dist/types/resources/filesystem.d.ts.map +1 -1
  52. package/dist/types/resources/index.d.ts +1 -1
  53. package/dist/types/resources/index.d.ts.map +1 -1
  54. package/dist/types/resources/oauth.d.ts.map +1 -1
  55. package/dist/types/resources/views.d.ts +66 -0
  56. package/dist/types/resources/views.d.ts.map +1 -0
  57. package/dist/types/resources/workspaces.d.ts +1 -1
  58. package/dist/types/types/access-log.d.ts +123 -0
  59. package/dist/types/types/access-log.d.ts.map +1 -0
  60. package/dist/types/types/index.d.ts +1 -1
  61. package/dist/types/types/index.d.ts.map +1 -1
  62. package/dist/types/types/oauth.d.ts +2 -0
  63. package/dist/types/types/oauth.d.ts.map +1 -1
  64. package/dist/types/types/shared.d.ts +1 -1
  65. package/dist/types/types/shared.d.ts.map +1 -1
  66. package/dist/types/types/views.d.ts +207 -0
  67. package/dist/types/types/views.d.ts.map +1 -0
  68. package/dist/types/types/workspaces.d.ts +1 -1
  69. package/package.json +1 -1
  70. package/dist/cjs/resources/smart-folders.js +0 -102
  71. package/dist/cjs/resources/smart-folders.js.map +0 -1
  72. package/dist/cjs/types/smart-folders.js.map +0 -1
  73. package/dist/esm/resources/smart-folders.js +0 -98
  74. package/dist/esm/resources/smart-folders.js.map +0 -1
  75. package/dist/esm/types/smart-folders.js +0 -2
  76. package/dist/esm/types/smart-folders.js.map +0 -1
  77. package/dist/types/resources/smart-folders.d.ts +0 -70
  78. package/dist/types/resources/smart-folders.d.ts.map +0 -1
  79. package/dist/types/types/smart-folders.d.ts +0 -45
  80. package/dist/types/types/smart-folders.d.ts.map +0 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @airstore/sdk
2
2
 
3
- Official TypeScript SDK for the [Airstore](https://airstore.ai) API. Provision workspaces, manage connections, configure smart folders, and generate mount tokens — all from your backend.
3
+ Official TypeScript SDK for the [Airstore](https://airstore.ai) API. Provision workspaces, manage connections, configure source views, and generate mount tokens — all from your backend.
4
4
 
5
5
  ## Installation
6
6
 
@@ -51,8 +51,8 @@ async function provisionUser(
51
51
  refreshToken: gmailTokens.refreshToken,
52
52
  });
53
53
 
54
- // 4. Set up smart folders for what the agent should see
55
- await airstore.smartFolders.create(ws.external_id, {
54
+ // 4. Set up source views for what the agent should see
55
+ await airstore.views.create(ws.external_id, {
56
56
  integration: 'gmail',
57
57
  name: 'Recent Emails',
58
58
  guidance: 'Last 7 days of emails from the inbox',
@@ -143,32 +143,72 @@ const connections = await airstore.connections.list('ws_abc123');
143
143
  await airstore.connections.del('ws_abc123', 'conn_abc123');
144
144
  ```
145
145
 
146
- ### Smart Folders
146
+ ### Source Views
147
+
148
+ Source views come in two modes: **smart** (LLM-inferred from natural language) and **query** (structured per-integration filters).
147
149
 
148
150
  ```typescript
149
- // Create
150
- const folder = await airstore.smartFolders.create('ws_abc123', {
151
+ // Smart mode — describe what you want in natural language
152
+ const view = await airstore.views.create('ws_abc123', {
151
153
  integration: 'gmail',
152
154
  name: 'Important Emails',
153
155
  guidance: 'Emails marked as important from the last month',
154
156
  outputFormat: 'folder', // or 'file'
155
157
  });
156
158
 
159
+ // Query mode — auto-detected when filter is provided
160
+ const view2 = await airstore.views.create('ws_abc123', {
161
+ integration: 'gmail',
162
+ name: 'Unread from boss',
163
+ filter: { from: 'boss@company.com', is_unread: true },
164
+ });
165
+
166
+ // Query mode with GitHub content types
167
+ const prView = await airstore.views.create('ws_abc123', {
168
+ integration: 'github',
169
+ name: 'Open PRs',
170
+ filter: {
171
+ repo: 'acme/api',
172
+ type: 'prs',
173
+ state: 'open',
174
+ content_type: 'diff', // 'markdown' | 'diff' | 'json' | 'raw'
175
+ },
176
+ });
177
+
157
178
  // List all
158
- const folders = await airstore.smartFolders.list('ws_abc123');
179
+ const views = await airstore.views.list('ws_abc123');
159
180
 
160
181
  // Retrieve by path
161
- const folder = await airstore.smartFolders.retrieve('ws_abc123', '/Sources/gmail/Important Emails');
182
+ const found = await airstore.views.retrieve('ws_abc123', '/sources/gmail/Important Emails');
162
183
 
163
184
  // Update
164
- const updated = await airstore.smartFolders.update('ws_abc123', 'query_abc', {
185
+ const updated = await airstore.views.update('ws_abc123', 'view_abc', {
165
186
  guidance: 'Updated guidance text',
166
187
  });
167
188
 
189
+ // Sync — re-execute the query and refresh cached files
190
+ const result = await airstore.views.sync('ws_abc123', 'view_abc');
191
+ console.log(`${result.results_count} total, ${result.new_results} new`);
192
+
168
193
  // Delete
169
- await airstore.smartFolders.del('ws_abc123', 'query_abc');
194
+ await airstore.views.del('ws_abc123', 'view_abc');
170
195
  ```
171
196
 
197
+ #### Per-integration filter fields
198
+
199
+ Each integration accepts a typed filter object:
200
+
201
+ | Integration | Key fields |
202
+ |---|---|
203
+ | `gmail` | `from`, `to`, `subject`, `label`, `newer_than`, `older_than`, `has_attachment`, `is_unread`, `is_starred` |
204
+ | `github` | `repo` (required), `type`, `state`, `label`, `author`, `content_type` |
205
+ | `gdrive` | `name_contains`, `mime_type`, `shared_with_me`, `starred`, `modified_after`, `modified_before`, `folder_id` |
206
+ | `notion` | `search` |
207
+ | `slack` | `channel`, `from`, `after`, `before`, `has_link`, `has_reaction` |
208
+ | `linear` | `type`, `team`, `state`, `assignee`, `priority`, `label` |
209
+ | `posthog` | `type`, `query`, `project_id` |
210
+ | `web` | `mode`, `url`, `query`, `include_paths` |
211
+
172
212
  ### Tokens
173
213
 
174
214
  ```typescript
@@ -237,7 +277,7 @@ const entries = await airstore.fs.list('ws_abc123', { path: '/' });
237
277
 
238
278
  // Read file contents
239
279
  const content = await airstore.fs.read('ws_abc123', {
240
- path: '/Sources/gmail/inbox/email.txt',
280
+ path: '/sources/gmail/inbox/email.txt',
241
281
  });
242
282
 
243
283
  // Get directory tree
@@ -247,7 +287,7 @@ const tree = await airstore.fs.tree('ws_abc123', {
247
287
  });
248
288
 
249
289
  // Stat a file
250
- const meta = await airstore.fs.stat('ws_abc123', '/Sources/gmail/inbox/email.txt');
290
+ const meta = await airstore.fs.stat('ws_abc123', '/sources/gmail/inbox/email.txt');
251
291
  ```
252
292
 
253
293
  ## Per-Request Options
@@ -4,122 +4,83 @@ exports.Airstore = void 0;
4
4
  const client_js_1 = require("./client.js");
5
5
  const workspaces_js_1 = require("./resources/workspaces.js");
6
6
  const connections_js_1 = require("./resources/connections.js");
7
- const smart_folders_js_1 = require("./resources/smart-folders.js");
7
+ const views_js_1 = require("./resources/views.js");
8
8
  const tokens_js_1 = require("./resources/tokens.js");
9
9
  const members_js_1 = require("./resources/members.js");
10
10
  const oauth_js_1 = require("./resources/oauth.js");
11
11
  const filesystem_js_1 = require("./resources/filesystem.js");
12
+ const access_log_js_1 = require("./resources/access-log.js");
12
13
  /**
13
14
  * The Airstore SDK client.
14
15
  *
15
- * Create an instance with your API key to interact with workspaces,
16
- * connections, smart folders, tokens, members, the virtual filesystem,
17
- * and OAuth sessions.
18
- *
19
16
  * @example Basic provisioning flow
20
17
  * ```ts
21
18
  * import Airstore from '@airstore/sdk';
22
19
  *
23
20
  * const airstore = new Airstore({ apiKey: 'org_...' });
24
21
  *
25
- * // 1. Create a workspace for a new user
22
+ * // 1. Create a workspace
26
23
  * const ws = await airstore.workspaces.create({ name: 'user-123' });
27
24
  *
28
- * // 2. Connect their Gmail with existing OAuth tokens
25
+ * // 2. Connect Gmail
29
26
  * await airstore.connections.create(ws.external_id, {
30
27
  * integrationType: 'gmail',
31
28
  * accessToken: existingAccessToken,
32
29
  * refreshToken: existingRefreshToken,
33
30
  * });
34
31
  *
35
- * // 3. Set up a smart folder
36
- * await airstore.smartFolders.create(ws.external_id, {
32
+ * // 3. Create a source view (smart mode — LLM-inferred)
33
+ * const view = await airstore.views.create(ws.external_id, {
37
34
  * integration: 'gmail',
38
35
  * name: 'Recent Emails',
39
36
  * guidance: 'Last 7 days of emails from the inbox',
40
37
  * });
41
38
  *
42
- * // 4. Generate a mount token for the user's VM
39
+ * // 4. Or create a source view (query mode structured filter)
40
+ * await airstore.views.create(ws.external_id, {
41
+ * integration: 'gmail',
42
+ * name: 'Unread from boss',
43
+ * filter: { from: 'boss@company.com', is_unread: true },
44
+ * });
45
+ *
46
+ * // 5. Sync a view to refresh its metadata
47
+ * const result = await airstore.views.sync(ws.external_id, view.external_id);
48
+ * console.log(result.results_count, result.new_results);
49
+ *
50
+ * // 6. Generate a mount token
43
51
  * const token = await airstore.tokens.create(ws.external_id, {
44
52
  * email: 'agent@internal',
45
53
  * name: 'vm-mount',
46
54
  * });
47
- * // Pass token.token to: airstore start --token <token>
48
- * ```
49
- *
50
- * @example Per-request options
51
- * ```ts
52
- * const ws = await airstore.workspaces.list({
53
- * timeout: 10_000,
54
- * maxRetries: 5,
55
- * });
56
55
  * ```
57
56
  */
58
57
  class Airstore extends client_js_1.CoreClient {
59
- /**
60
- * Manage workspaces.
61
- *
62
- * Workspaces are the top-level container for connections, smart folders,
63
- * members, and the virtual filesystem.
64
- */
58
+ /** Manage workspaces. */
65
59
  workspaces;
66
- /**
67
- * Manage connections (integrations) within a workspace.
68
- *
69
- * Pass existing OAuth tokens or API keys to connect external services
70
- * like Gmail, GitHub, Notion, etc.
71
- */
60
+ /** Manage connections (integrations) within a workspace. */
72
61
  connections;
73
- /**
74
- * Manage smart folders (filesystem queries).
75
- *
76
- * Smart folders use LLM inference to automatically organize and filter
77
- * data from connected integrations into virtual folders or files.
78
- */
79
- smartFolders;
80
- /**
81
- * Manage workspace-scoped authentication tokens.
82
- *
83
- * Tokens are used for CLI mounting and per-workspace programmatic access.
84
- */
62
+ /** Manage source views — materialized queries over connected data sources. */
63
+ views;
64
+ /** Manage workspace-scoped authentication tokens. */
85
65
  tokens;
86
- /**
87
- * Manage workspace members.
88
- *
89
- * Members are users with roles (admin, member, viewer) in a workspace.
90
- */
66
+ /** Manage workspace members. */
91
67
  members;
92
- /**
93
- * OAuth session management for interactive connection setup.
94
- *
95
- * Use this for browser-redirect flows where users authorize
96
- * integrations themselves.
97
- */
68
+ /** OAuth session management for interactive connection setup. */
98
69
  oauth;
99
- /**
100
- * Read-only access to the workspace virtual filesystem.
101
- *
102
- * Browse directories, read files, and inspect metadata across
103
- * all connected integrations.
104
- */
70
+ /** Read-only access to the workspace virtual filesystem. */
105
71
  fs;
106
- /**
107
- * Create a new Airstore SDK client.
108
- *
109
- * @param opts - Client configuration. At minimum, provide an `apiKey`
110
- * or set the `AIRSTORE_API_KEY` environment variable.
111
- *
112
- * @throws {AirstoreError} If no API key is provided.
113
- */
72
+ /** Query the workspace access log. */
73
+ accessLog;
114
74
  constructor(opts) {
115
75
  super(opts);
116
76
  this.workspaces = new workspaces_js_1.Workspaces(this);
117
77
  this.connections = new connections_js_1.Connections(this);
118
- this.smartFolders = new smart_folders_js_1.SmartFolders(this);
78
+ this.views = new views_js_1.Views(this);
119
79
  this.tokens = new tokens_js_1.Tokens(this);
120
80
  this.members = new members_js_1.Members(this);
121
81
  this.oauth = new oauth_js_1.OAuth(this);
122
82
  this.fs = new filesystem_js_1.Filesystem(this);
83
+ this.accessLog = new access_log_js_1.AccessLog(this);
123
84
  }
124
85
  }
125
86
  exports.Airstore = Airstore;
@@ -1 +1 @@
1
- {"version":3,"file":"airstore.js","sourceRoot":"","sources":["../../src/airstore.ts"],"names":[],"mappings":";;;AAAA,2CAA6D;AAC7D,6DAAuD;AACvD,+DAAyD;AACzD,mEAA4D;AAC5D,qDAA+C;AAC/C,uDAAiD;AACjD,mDAA6C;AAC7C,6DAAuD;AAEvD;;;;;;;;;;;;;;;;;;;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;IAChB,UAAU,CAAa;IAChC,4DAA4D;IACnD,WAAW,CAAc;IAClC,8EAA8E;IACrE,KAAK,CAAQ;IACtB,qDAAqD;IAC5C,MAAM,CAAS;IACxB,gCAAgC;IACvB,OAAO,CAAU;IAC1B,iEAAiE;IACxD,KAAK,CAAQ;IACtB,4DAA4D;IACnD,EAAE,CAAa;IACxB,sCAAsC;IAC7B,SAAS,CAAY;IAE9B,YAAY,IAAoB;QAC9B,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,UAAU,GAAG,IAAI,0BAAU,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,WAAW,GAAG,IAAI,4BAAW,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,KAAK,GAAG,IAAI,gBAAK,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,kBAAM,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,IAAI,oBAAO,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,KAAK,GAAG,IAAI,gBAAK,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,CAAC,EAAE,GAAG,IAAI,0BAAU,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,IAAI,yBAAS,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;CACF;AA7BD,4BA6BC;AAED,kBAAe,QAAQ,CAAC"}
package/dist/cjs/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /** @module @airstore/sdk */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.VERSION = exports.Filesystem = exports.OAuth = exports.Members = exports.Tokens = exports.SmartFolders = exports.Connections = exports.Workspaces = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.InternalServerError = exports.RateLimitError = exports.UnprocessableEntityError = exports.ConflictError = exports.NotFoundError = exports.PermissionDeniedError = exports.AuthenticationError = exports.APIError = exports.AirstoreError = exports.default = exports.Airstore = void 0;
4
+ exports.VERSION = exports.WebModes = exports.PostHogResourceTypes = exports.LinearPriorities = exports.LinearStates = exports.LinearResourceTypes = exports.GDriveMimeTypes = exports.GitHubContentTypes = exports.GitHubStates = exports.GitHubResourceTypes = exports.GmailLabels = exports.Integrations = exports.ViewModes = exports.AccessLog = exports.Filesystem = exports.OAuth = exports.Members = exports.Tokens = exports.Views = exports.Connections = exports.Workspaces = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.InternalServerError = exports.RateLimitError = exports.UnprocessableEntityError = exports.ConflictError = exports.NotFoundError = exports.PermissionDeniedError = exports.AuthenticationError = exports.APIError = exports.AirstoreError = exports.default = exports.Airstore = void 0;
5
5
  // ── Main client ──────────────────────────────────────────────────────────────
6
6
  var airstore_js_1 = require("./airstore.js");
7
7
  Object.defineProperty(exports, "Airstore", { enumerable: true, get: function () { return airstore_js_1.Airstore; } });
@@ -24,8 +24,8 @@ var workspaces_js_1 = require("./resources/workspaces.js");
24
24
  Object.defineProperty(exports, "Workspaces", { enumerable: true, get: function () { return workspaces_js_1.Workspaces; } });
25
25
  var connections_js_1 = require("./resources/connections.js");
26
26
  Object.defineProperty(exports, "Connections", { enumerable: true, get: function () { return connections_js_1.Connections; } });
27
- var smart_folders_js_1 = require("./resources/smart-folders.js");
28
- Object.defineProperty(exports, "SmartFolders", { enumerable: true, get: function () { return smart_folders_js_1.SmartFolders; } });
27
+ var views_js_1 = require("./resources/views.js");
28
+ Object.defineProperty(exports, "Views", { enumerable: true, get: function () { return views_js_1.Views; } });
29
29
  var tokens_js_1 = require("./resources/tokens.js");
30
30
  Object.defineProperty(exports, "Tokens", { enumerable: true, get: function () { return tokens_js_1.Tokens; } });
31
31
  var members_js_1 = require("./resources/members.js");
@@ -34,6 +34,21 @@ var oauth_js_1 = require("./resources/oauth.js");
34
34
  Object.defineProperty(exports, "OAuth", { enumerable: true, get: function () { return oauth_js_1.OAuth; } });
35
35
  var filesystem_js_1 = require("./resources/filesystem.js");
36
36
  Object.defineProperty(exports, "Filesystem", { enumerable: true, get: function () { return filesystem_js_1.Filesystem; } });
37
+ var access_log_js_1 = require("./resources/access-log.js");
38
+ Object.defineProperty(exports, "AccessLog", { enumerable: true, get: function () { return access_log_js_1.AccessLog; } });
39
+ var views_js_2 = require("./types/views.js");
40
+ Object.defineProperty(exports, "ViewModes", { enumerable: true, get: function () { return views_js_2.ViewModes; } });
41
+ Object.defineProperty(exports, "Integrations", { enumerable: true, get: function () { return views_js_2.Integrations; } });
42
+ Object.defineProperty(exports, "GmailLabels", { enumerable: true, get: function () { return views_js_2.GmailLabels; } });
43
+ Object.defineProperty(exports, "GitHubResourceTypes", { enumerable: true, get: function () { return views_js_2.GitHubResourceTypes; } });
44
+ Object.defineProperty(exports, "GitHubStates", { enumerable: true, get: function () { return views_js_2.GitHubStates; } });
45
+ Object.defineProperty(exports, "GitHubContentTypes", { enumerable: true, get: function () { return views_js_2.GitHubContentTypes; } });
46
+ Object.defineProperty(exports, "GDriveMimeTypes", { enumerable: true, get: function () { return views_js_2.GDriveMimeTypes; } });
47
+ Object.defineProperty(exports, "LinearResourceTypes", { enumerable: true, get: function () { return views_js_2.LinearResourceTypes; } });
48
+ Object.defineProperty(exports, "LinearStates", { enumerable: true, get: function () { return views_js_2.LinearStates; } });
49
+ Object.defineProperty(exports, "LinearPriorities", { enumerable: true, get: function () { return views_js_2.LinearPriorities; } });
50
+ Object.defineProperty(exports, "PostHogResourceTypes", { enumerable: true, get: function () { return views_js_2.PostHogResourceTypes; } });
51
+ Object.defineProperty(exports, "WebModes", { enumerable: true, get: function () { return views_js_2.WebModes; } });
37
52
  // ── Version ──────────────────────────────────────────────────────────────────
38
53
  var version_js_1 = require("./version.js");
39
54
  Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_js_1.VERSION; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,4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AA,yBAAyB,OAAA;AAG3B,gFAAgF;AAChF,2DAAuD;AAA9C,2GAAA,UAAU,OAAA;AACnB,6DAAyD;AAAhD,6GAAA,WAAW,OAAA;AACpB,iDAA6C;AAApC,iGAAA,KAAK,OAAA;AACd,mDAA+C;AAAtC,mGAAA,MAAM,OAAA;AACf,qDAAiD;AAAxC,qGAAA,OAAO,OAAA;AAChB,iDAA6C;AAApC,iGAAA,KAAK,OAAA;AACd,2DAAuD;AAA9C,2GAAA,UAAU,OAAA;AACnB,2DAAsD;AAA7C,0GAAA,SAAS,OAAA;AAkClB,6CAa0B;AAZxB,qGAAA,SAAS,OAAA;AACT,wGAAA,YAAY,OAAA;AACZ,uGAAA,WAAW,OAAA;AACX,+GAAA,mBAAmB,OAAA;AACnB,wGAAA,YAAY,OAAA;AACZ,8GAAA,kBAAkB,OAAA;AAClB,2GAAA,eAAe,OAAA;AACf,+GAAA,mBAAmB,OAAA;AACnB,wGAAA,YAAY,OAAA;AACZ,4GAAA,gBAAgB,OAAA;AAChB,gHAAA,oBAAoB,OAAA;AACpB,oGAAA,QAAQ,OAAA;AAgBV,gFAAgF;AAChF,2CAAuC;AAA9B,qGAAA,OAAO,OAAA"}
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AccessLog = void 0;
4
+ /**
5
+ * Query the workspace access log.
6
+ *
7
+ * Every file read through the virtual filesystem is recorded with token
8
+ * counts, compression outcome, timing, and a `source_uri` that pins
9
+ * the content back to its upstream origin.
10
+ *
11
+ * @example List recent reads
12
+ * ```ts
13
+ * const page = await airstore.accessLog.list("ws-abc", {
14
+ * start: Date.now() - 3600_000, // last hour
15
+ * limit: 50,
16
+ * });
17
+ * for (const r of page.reads) {
18
+ * console.log(r.source_uri, r.original_tokens, "->", r.compressed_tokens);
19
+ * }
20
+ * ```
21
+ *
22
+ * @example Get a summary
23
+ * ```ts
24
+ * const s = await airstore.accessLog.summary("ws-abc", {
25
+ * start: Date.now() - 86400_000,
26
+ * });
27
+ * console.log(`${s.total_reads} reads, ${s.compression_ratio} ratio`);
28
+ * ```
29
+ *
30
+ * @example Replay a read by source URI
31
+ * ```ts
32
+ * const content = await airstore.accessLog.read("ws-abc", "github://abc123");
33
+ * ```
34
+ */
35
+ class AccessLog {
36
+ client;
37
+ constructor(client) {
38
+ this.client = client;
39
+ }
40
+ /**
41
+ * List access log reads for a workspace.
42
+ *
43
+ * Supports cursor-based pagination and optional time-window filtering.
44
+ *
45
+ * @param workspaceId - Workspace external ID (UUID).
46
+ * @param params - Filtering and pagination options.
47
+ * @param options - Per-request overrides.
48
+ */
49
+ async list(workspaceId, params, options) {
50
+ const query = {};
51
+ if (params?.start !== undefined)
52
+ query.start = String(params.start);
53
+ if (params?.end !== undefined)
54
+ query.end = String(params.end);
55
+ if (params?.cursor !== undefined)
56
+ query.cursor = params.cursor;
57
+ if (params?.limit !== undefined)
58
+ query.limit = String(params.limit);
59
+ if (params?.session !== undefined)
60
+ query.session = params.session;
61
+ return this.client.request('GET', `/workspaces/${workspaceId}/access-log`, undefined, query, options);
62
+ }
63
+ /**
64
+ * Get an aggregated summary of access log reads.
65
+ *
66
+ * Returns totals, compression ratio, per-integration breakdown,
67
+ * outcome distribution, and top paths by token consumption.
68
+ *
69
+ * @param workspaceId - Workspace external ID (UUID).
70
+ * @param params - Time window and session options.
71
+ * @param options - Per-request overrides.
72
+ */
73
+ async summary(workspaceId, params, options) {
74
+ const query = {};
75
+ if (params?.start !== undefined)
76
+ query.start = String(params.start);
77
+ if (params?.end !== undefined)
78
+ query.end = String(params.end);
79
+ if (params?.session !== undefined)
80
+ query.session = params.session;
81
+ return this.client.request('GET', `/workspaces/${workspaceId}/access-log/summary`, undefined, query, options);
82
+ }
83
+ /**
84
+ * Read content directly from an upstream source using a `source_uri`.
85
+ *
86
+ * This bypasses the source-view/query layer entirely. Even if the
87
+ * materialized view has changed, the source_uri lets you pull the
88
+ * exact content that was originally read.
89
+ *
90
+ * @param workspaceId - Workspace external ID (UUID).
91
+ * @param sourceUri - Source URI from an access log entry (e.g., "github://abc123").
92
+ * @param options - Per-request overrides.
93
+ * @returns The raw content as an ArrayBuffer.
94
+ */
95
+ async read(workspaceId, sourceUri, options) {
96
+ const resp = await this.client.rawRequest('GET', `/workspaces/${workspaceId}/access-log/read`, { params: { uri: sourceUri }, ...options });
97
+ return resp.arrayBuffer();
98
+ }
99
+ }
100
+ exports.AccessLog = AccessLog;
101
+ //# sourceMappingURL=access-log.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access-log.js","sourceRoot":"","sources":["../../../src/resources/access-log.ts"],"names":[],"mappings":";;;AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAa,SAAS;IACS;IAA7B,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAEnD;;;;;;;;OAQG;IACH,KAAK,CAAC,IAAI,CACR,WAAmB,EACnB,MAA4B,EAC5B,OAAwB;QAExB,MAAM,KAAK,GAA2B,EAAE,CAAC;QACzC,IAAI,MAAM,EAAE,KAAK,KAAK,SAAS;YAAE,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACpE,IAAI,MAAM,EAAE,GAAG,KAAK,SAAS;YAAE,KAAK,CAAC,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC9D,IAAI,MAAM,EAAE,MAAM,KAAK,SAAS;YAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC/D,IAAI,MAAM,EAAE,KAAK,KAAK,SAAS;YAAE,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACpE,IAAI,MAAM,EAAE,OAAO,KAAK,SAAS;YAAE,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAElE,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,KAAK,EACL,eAAe,WAAW,aAAa,EACvC,SAAS,EACT,KAAK,EACL,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,OAAO,CACX,WAAmB,EACnB,MAA+B,EAC/B,OAAwB;QAExB,MAAM,KAAK,GAA2B,EAAE,CAAC;QACzC,IAAI,MAAM,EAAE,KAAK,KAAK,SAAS;YAAE,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACpE,IAAI,MAAM,EAAE,GAAG,KAAK,SAAS;YAAE,KAAK,CAAC,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC9D,IAAI,MAAM,EAAE,OAAO,KAAK,SAAS;YAAE,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAElE,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,KAAK,EACL,eAAe,WAAW,qBAAqB,EAC/C,SAAS,EACT,KAAK,EACL,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,IAAI,CACR,WAAmB,EACnB,SAAiB,EACjB,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CACvC,KAAK,EACL,eAAe,WAAW,kBAAkB,EAC5C,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,GAAG,OAAO,EAAE,CAC3C,CAAC;QACF,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;IAC5B,CAAC;CACF;AAtFD,8BAsFC"}
@@ -5,13 +5,13 @@ exports.Filesystem = void 0;
5
5
  * Read-only access to the workspace virtual filesystem.
6
6
  *
7
7
  * The filesystem provides a unified view of all connected integrations,
8
- * smart folders, tools, and user-uploaded files.
8
+ * source views, tools, and user-uploaded files.
9
9
  *
10
10
  * @example
11
11
  * ```ts
12
12
  * const listing = await airstore.fs.list("ws_abc", { path: "/" });
13
13
  * const content = await airstore.fs.read("ws_abc", {
14
- * path: "/Sources/gmail/inbox/email.txt",
14
+ * path: "/sources/gmail/inbox/email.txt",
15
15
  * });
16
16
  * ```
17
17
  */
@@ -44,6 +44,7 @@ class Filesystem {
44
44
  * @param opts.path - File path to read.
45
45
  * @param opts.offset - Byte offset to start reading from.
46
46
  * @param opts.length - Number of bytes to read.
47
+ * @param opts.compression - Compression strategy: 'strip', 'distill', or 'chain'. Omit to disable.
47
48
  * @param options - Per-request overrides.
48
49
  * @returns File contents as a string.
49
50
  *
@@ -55,6 +56,8 @@ class Filesystem {
55
56
  params['offset'] = String(opts.offset);
56
57
  if (opts.length !== undefined)
57
58
  params['length'] = String(opts.length);
59
+ if (opts.compression !== undefined)
60
+ params['compression'] = opts.compression;
58
61
  const resp = await this.client.rawRequest('GET', `/workspaces/${workspaceId}/fs/read`, { params, ...options });
59
62
  return resp.text();
60
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"filesystem.js","sourceRoot":"","sources":["../../../src/resources/filesystem.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;GAaG;AACH,MAAa,UAAU;IACQ;IAA7B,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAEnD;;;;;;;;OAQG;IACH,KAAK,CAAC,IAAI,CACR,WAAmB,EACnB,OAA0B,EAAE,EAC5B,OAAwB;QAExB,MAAM,MAAM,GAA2B,EAAE,CAAC;QAC1C,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS;YAAE,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC;QAExD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CACtC,KAAK,EACL,eAAe,WAAW,UAAU,EACpC,SAAS,EACT,MAAM,EACN,OAAO,CACR,CAAC;QACF,OAAQ,MAA2B,CAAC,OAAO,IAAI,EAAE,CAAC;IACpD,C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 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Filesystem = exports.OAuth = exports.Members = exports.Tokens = exports.SmartFolders = exports.Connections = exports.Workspaces = void 0;
3
+ exports.Filesystem = exports.OAuth = exports.Members = exports.Tokens = exports.Views = exports.Connections = exports.Workspaces = void 0;
4
4
  var workspaces_js_1 = require("./workspaces.js");
5
5
  Object.defineProperty(exports, "Workspaces", { enumerable: true, get: function () { return workspaces_js_1.Workspaces; } });
6
6
  var connections_js_1 = require("./connections.js");
7
7
  Object.defineProperty(exports, "Connections", { enumerable: true, get: function () { return connections_js_1.Connections; } });
8
- var smart_folders_js_1 = require("./smart-folders.js");
9
- Object.defineProperty(exports, "SmartFolders", { enumerable: true, get: function () { return smart_folders_js_1.SmartFolders; } });
8
+ var views_js_1 = require("./views.js");
9
+ Object.defineProperty(exports, "Views", { enumerable: true, get: function () { return views_js_1.Views; } });
10
10
  var tokens_js_1 = require("./tokens.js");
11
11
  Object.defineProperty(exports, "Tokens", { enumerable: true, get: function () { return tokens_js_1.Tokens; } });
12
12
  var members_js_1 = require("./members.js");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resources/index.ts"],"names":[],"mappings":";;;AAAA,iDAA6C;AAApC,2GAAA,UAAU,OAAA;AACnB,mDAA+C;AAAtC,6GAAA,WAAW,OAAA;AACpB,uDAAkD;AAAzC,gHAAA,YAAY,OAAA;AACrB,yCAAqC;AAA5B,mGAAA,MAAM,OAAA;AACf,2CAAuC;AAA9B,qGAAA,OAAO,OAAA;AAChB,uCAAmC;AAA1B,iGAAA,KAAK,OAAA;AACd,iDAA6C;AAApC,2GAAA,UAAU,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resources/index.ts"],"names":[],"mappings":";;;AAAA,iDAA6C;AAApC,2GAAA,UAAU,OAAA;AACnB,mDAA+C;AAAtC,6GAAA,WAAW,OAAA;AACpB,uCAAmC;AAA1B,iGAAA,KAAK,OAAA;AACd,yCAAqC;AAA5B,mGAAA,MAAM,OAAA;AACf,2CAAuC;AAA9B,qGAAA,OAAO,OAAA;AAChB,uCAAmC;AAA1B,iGAAA,KAAK,OAAA;AACd,iDAA6C;AAApC,2GAAA,UAAU,OAAA"}
@@ -38,6 +38,8 @@ class OAuth {
38
38
  const body = {
39
39
  integration_type: params.integrationType,
40
40
  };
41
+ if (params.workspaceId !== undefined)
42
+ body['workspace_id'] = params.workspaceId;
41
43
  if (params.returnTo !== undefined)
42
44
  body['return_to'] = params.returnTo;
43
45
  return this.client.request('POST', '/oauth/sessions', body, undefined, options);
@@ -1 +1 @@
1
- {"version":3,"file":"oauth.js","sourceRoot":"","sources":["../../../src/resources/oauth.ts"],"names":[],"mappings":";;;AAOA,4CAA6C;AAE7C;;;;;;;;;;;;;;;GAeG;AACH,MAAa,KAAK;IACa;IAA7B,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAEnD;;;;;;;;;;OAUG;IACH,KAAK,CAAC,aAAa,CACjB,MAAgC,EAChC,OAAwB;QAExB,MAAM,IAAI,GAA4B;YACpC,gBAAgB,EAAE,MAAM,CAAC,eAAe;SACzC,CAAC;QACF,IAAI,MAAM,CAAC,QAAQ,KAAK,SAAS;YAAE,IAAI,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC;QAEvE,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,MAAM,EACN,iBAAiB,EACjB,IAAI,EACJ,SAAS,EACT,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,UAAU,CACd,SAAiB,EACjB,OAAwB;QAExB,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,KAAK,EACL,mBAAmB,SAAS,EAAE,EAC9B,SAAS,EACT,SAAS,EACT,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC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AQ,CAAC,CAAC,CAAC;QAChE,CAAC;QAED,MAAM,IAAI,yBAAa,CAAC,iCAAiC,OAAO,IAAI,CAAC,CAAC;IACxE,CAAC;CACF;AA1FD,sBA0FC"}
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Views = void 0;
4
+ /**
5
+ * Manage source views within a workspace.
6
+ *
7
+ * Source views are materialized queries over connected data sources.
8
+ * In **smart** mode the query is LLM-inferred from natural language guidance;
9
+ * in **query** mode the query is built from a structured per-integration filter.
10
+ *
11
+ * @example Smart mode (LLM-inferred)
12
+ * ```ts
13
+ * await airstore.views.create("ws_abc", {
14
+ * integration: "gmail",
15
+ * name: "Recent Emails",
16
+ * guidance: "Last 7 days of emails",
17
+ * });
18
+ * ```
19
+ *
20
+ * @example Query mode (structured filter)
21
+ * ```ts
22
+ * await airstore.views.create("ws_abc", {
23
+ * integration: "gmail",
24
+ * name: "Unread from boss",
25
+ * filter: { from: "boss@company.com", is_unread: true },
26
+ * });
27
+ * ```
28
+ */
29
+ class Views {
30
+ client;
31
+ constructor(client) {
32
+ this.client = client;
33
+ }
34
+ /**
35
+ * Create a new source view.
36
+ *
37
+ * If `filter` is provided the view is created in query mode;
38
+ * otherwise it uses smart mode with LLM inference from `guidance`.
39
+ */
40
+ async create(workspaceId, params, options) {
41
+ const body = {
42
+ integration: params.integration,
43
+ name: params.name,
44
+ output_format: params.outputFormat ?? 'folder',
45
+ };
46
+ if (params.guidance !== undefined)
47
+ body['guidance'] = params.guidance;
48
+ if (params.filter !== undefined)
49
+ body['filter'] = params.filter;
50
+ if (params.fileExt !== undefined)
51
+ body['file_ext'] = params.fileExt;
52
+ return this.client.request('POST', `/workspaces/${workspaceId}/fs/views`, body, undefined, options);
53
+ }
54
+ /** List all source views in a workspace. */
55
+ async list(workspaceId, options) {
56
+ const result = await this.client.request('GET', `/workspaces/${workspaceId}/fs/views/list`, undefined, undefined, options);
57
+ return result.views ?? [];
58
+ }
59
+ /** Retrieve a source view by its virtual filesystem path. */
60
+ async retrieve(workspaceId, viewPath, options) {
61
+ return this.client.request('GET', `/workspaces/${workspaceId}/fs/views`, undefined, { path: viewPath }, options);
62
+ }
63
+ /** Update an existing source view. */
64
+ async update(workspaceId, viewId, params, options) {
65
+ const body = {};
66
+ if (params.name !== undefined)
67
+ body['name'] = params.name;
68
+ if (params.guidance !== undefined)
69
+ body['guidance'] = params.guidance;
70
+ if (params.filter !== undefined)
71
+ body['filter'] = params.filter;
72
+ return this.client.request('PUT', `/workspaces/${workspaceId}/fs/views/${viewId}`, body, undefined, options);
73
+ }
74
+ /** Delete a source view. */
75
+ async del(workspaceId, viewId, options) {
76
+ await this.client.request('DELETE', `/workspaces/${workspaceId}/fs/views/${viewId}`, undefined, undefined, options);
77
+ }
78
+ /**
79
+ * Sync a source view — re-execute its query and refresh cached metadata.
80
+ *
81
+ * Idempotent and safe to call repeatedly. Returns the count of total
82
+ * and newly discovered results.
83
+ */
84
+ async sync(workspaceId, viewId, options) {
85
+ return this.client.request('POST', `/workspaces/${workspaceId}/fs/views/${viewId}/sync`, undefined, undefined, options);
86
+ }
87
+ /**
88
+ * List available resources for an integration (repos, channels, etc.).
89
+ *
90
+ * Used to populate filter dropdowns with real data from connected sources.
91
+ *
92
+ * @example
93
+ * ```ts
94
+ * const repos = await airstore.views.listResources("ws_abc", "github");
95
+ * // [{ id: "owner/repo", name: "owner/repo" }, ...]
96
+ * ```
97
+ */
98
+ async listResources(workspaceId, integration, resourceType, options) {
99
+ const params = {};
100
+ if (resourceType)
101
+ params['type'] = resourceType;
102
+ const result = await this.client.request('GET', `/workspaces/${workspaceId}/fs/sources/${integration}/resources`, undefined, params, options);
103
+ return result.resources ?? [];
104
+ }
105
+ }
106
+ exports.Views = Views;
107
+ //# sourceMappingURL=views.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"views.js","sourceRoot":"","sources":["../../../src/resources/views.ts"],"names":[],"mappings":";;;AASA;;;;;;;;;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