agentic-drive 0.7.0 → 0.9.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.
@@ -48,6 +48,8 @@ type Node = {
48
48
  purging: boolean;
49
49
  };
50
50
  type ErrorCode = "NOT_FOUND" | "NAME_TAKEN" | "BLOB_EXISTS" | "INVALID_NAME" | "INVALID_PATH" | "INVALID_REF" | "NOT_A_FOLDER" | "NOT_A_FILE" | "MOVE_INTO_SELF" | "TOO_DEEP" | "PARENT_GONE" | "TRASHED" | "NOT_TRASHED" | "IS_ROOT" | "FORBIDDEN" | "BLOB_MISSING" | "TOO_LARGE" | "INVALID_EXPIRY" | "BUSY" | "CROSS_DRIVE" | "INVALID_SHARE" | "TOO_MANY_ITEMS";
51
+ /** The HTTP status of each error code. A host that serves the drive reuses it. */
52
+ declare const ERROR_STATUS: Readonly<Record<ErrorCode, 400 | 403 | 404 | 409 | 413 | 500>>;
51
53
  declare class DriveError extends Error {
52
54
  readonly code: ErrorCode;
53
55
  constructor(code: ErrorCode, message: string);
@@ -135,6 +137,11 @@ declare function createDrive(deps: DriveDeps): {
135
137
  trash(ctx: Ctx, loc: string): Promise<Node>;
136
138
  /** Items trashed on their own, newest first. */
137
139
  listTrash(ctx: Ctx): Promise<Node[]>;
140
+ /** Everything that is in the trash, newest first, each with the path it had before. It reads the whole drive, so a big drive costs more than `listTrash`. */
141
+ listTrashWithPaths(ctx: Ctx): Promise<{
142
+ node: Node;
143
+ path: string;
144
+ }[]>;
138
145
  /** Puts a trashed item back. It needs a live parent folder. */
139
146
  restore(ctx: Ctx, id: string, opts?: {
140
147
  parentId?: string;
@@ -186,6 +193,24 @@ declare function createDrive(deps: DriveDeps): {
186
193
  name: string;
187
194
  folder?: string;
188
195
  }): Promise<Node>;
196
+ /** The live references to `ref` in the caller's own drive that the caller can read, with their paths, sorted by path. */
197
+ findByRef(ctx: Ctx, ref: string): Promise<{
198
+ node: Node;
199
+ path: string;
200
+ }[]>;
201
+ /**
202
+ * Puts a reference at `path` and gives `claim.subject` the role `claim.role` on it, as one step. If the
203
+ * grant fails (the caller is not an owner of the item, or the subject is invalid), the reference is
204
+ * deleted again and the error is thrown, so no half-made item stays. Needs `sharing`. Folders that
205
+ * `parents` made stay, `onConflict: "replace"` acts as `"fail"` (a rollback could not bring back a replaced item), and an invalid role or subject is refused before anything is written.
206
+ */
207
+ claimRef(ctx: Ctx, path: string, ref: string, claim: {
208
+ subject: Subject;
209
+ role: Role;
210
+ }, opts?: {
211
+ parents?: boolean;
212
+ onConflict?: OnConflict;
213
+ }): Promise<Node>;
189
214
  /** An app deleted a document. Its references in this drive go to the trash. Returns how many. */
190
215
  forgetDocument(ctx: Ctx, ref: string): Promise<{
191
216
  trashed: number;
@@ -331,4 +356,4 @@ declare function createDrive(deps: DriveDeps): {
331
356
  }>;
332
357
  };
333
358
 
334
- export { type Actor as A, type Ctx as C, type Drive as D, type ErrorCode as E, type Node as N, type OnConflict as O, ROOT_ID as R, type SearchQuery as S, ACTOR_KINDS as a, type Action as b, type ActorKind as c, type Can as d, type DriveDeps as e, DriveError as f, createDrive as g, parseSubject as h, parseName as p, subjectKindOf as s };
359
+ export { type Actor as A, type Ctx as C, type Drive as D, type ErrorCode as E, type Node as N, type OnConflict as O, ROOT_ID as R, type SearchQuery as S, ACTOR_KINDS as a, type Action as b, type ActorKind as c, type Can as d, type DriveDeps as e, DriveError as f, ERROR_STATUS as g, createDrive as h, parseSubject as i, parseName as p, subjectKindOf as s };
package/dist/embed.css CHANGED
@@ -3,72 +3,72 @@
3
3
  max-width: 72rem;
4
4
  }
5
5
  .drive-muted {
6
- color: var(--ad-color-text-muted);
6
+ color: var(--agd-color-text-muted);
7
7
  }
8
8
  .drive-status {
9
9
  display: flex;
10
10
  align-items: center;
11
- gap: var(--ad-space-2);
12
- color: var(--ad-color-text-muted);
11
+ gap: var(--agd-space-2);
12
+ color: var(--agd-color-text-muted);
13
13
  }
14
14
  .drive-signin {
15
15
  display: grid;
16
- gap: var(--ad-space-4);
16
+ gap: var(--agd-space-4);
17
17
  max-width: 24rem;
18
18
  }
19
19
  .drive-form {
20
20
  display: grid;
21
- gap: var(--ad-space-4);
21
+ gap: var(--agd-space-4);
22
22
  }
23
23
  .drive-form__actions {
24
24
  display: flex;
25
25
  justify-content: flex-end;
26
- gap: var(--ad-space-2);
26
+ gap: var(--agd-space-2);
27
27
  }
28
28
  .drive-drop {
29
29
  min-height: 60vh;
30
30
  border: 2px dashed transparent;
31
- border-radius: var(--ad-radius-md);
32
- padding: var(--ad-space-2);
31
+ border-radius: var(--agd-radius-md);
32
+ padding: var(--agd-space-2);
33
33
  }
34
34
  .drive-drop--over {
35
- border-color: var(--ad-color-accent);
36
- background: var(--ad-color-accent-subtle);
35
+ border-color: var(--agd-color-accent);
36
+ background: var(--agd-color-accent-subtle);
37
37
  }
38
38
  .drive-bar {
39
39
  display: flex;
40
40
  align-items: center;
41
41
  justify-content: space-between;
42
- gap: var(--ad-space-4);
42
+ gap: var(--agd-space-4);
43
43
  flex-wrap: wrap;
44
- margin-bottom: var(--ad-space-4);
44
+ margin-bottom: var(--agd-space-4);
45
45
  }
46
46
  .drive-bar h1 {
47
47
  margin: 0;
48
- font-size: var(--ad-font-size-xl);
48
+ font-size: var(--agd-font-size-xl);
49
49
  overflow-wrap: anywhere;
50
50
  }
51
51
  .drive-crumbs ol {
52
52
  display: flex;
53
53
  flex-wrap: wrap;
54
- gap: var(--ad-space-2);
54
+ gap: var(--agd-space-2);
55
55
  list-style: none;
56
- margin: 0 0 var(--ad-space-2);
56
+ margin: 0 0 var(--agd-space-2);
57
57
  padding: 0;
58
- color: var(--ad-color-text-muted);
58
+ color: var(--agd-color-text-muted);
59
59
  }
60
60
  .drive-crumbs li + li::before {
61
61
  content: "/";
62
- margin-right: var(--ad-space-2);
62
+ margin-right: var(--agd-space-2);
63
63
  }
64
64
  .drive-crumbs [aria-current=page] {
65
- color: var(--ad-color-text);
66
- font-weight: var(--ad-font-weight-semibold);
65
+ color: var(--agd-color-text);
66
+ font-weight: var(--agd-font-weight-semibold);
67
67
  }
68
68
  .drive-split {
69
69
  display: grid;
70
70
  grid-template-columns: 14rem minmax(0, 1fr);
71
- gap: var(--ad-space-6);
71
+ gap: var(--agd-space-6);
72
72
  }
73
73
  @media (max-width: 48rem) {
74
74
  .drive-split {
@@ -81,24 +81,24 @@
81
81
  padding: 0;
82
82
  }
83
83
  .drive-tree .drive-tree {
84
- padding-left: var(--ad-space-4);
84
+ padding-left: var(--agd-space-4);
85
85
  }
86
86
  .drive-tree a {
87
87
  display: flex;
88
88
  align-items: center;
89
- gap: var(--ad-space-2);
90
- padding: var(--ad-space-1) var(--ad-space-2);
91
- border-radius: var(--ad-radius-sm);
92
- color: var(--ad-color-text);
89
+ gap: var(--agd-space-2);
90
+ padding: var(--agd-space-1) var(--agd-space-2);
91
+ border-radius: var(--agd-radius-sm);
92
+ color: var(--agd-color-text);
93
93
  text-decoration: none;
94
94
  }
95
95
  .drive-tree a:hover {
96
- background: var(--ad-color-surface-hover);
96
+ background: var(--agd-color-surface-hover);
97
97
  }
98
98
  .drive-tree a[aria-current=page] {
99
- background: var(--ad-color-accent-subtle);
100
- color: var(--ad-color-accent-text);
101
- font-weight: var(--ad-font-weight-semibold);
99
+ background: var(--agd-color-accent-subtle);
100
+ color: var(--agd-color-accent-text);
101
+ font-weight: var(--agd-font-weight-semibold);
102
102
  }
103
103
  .drive-tree svg {
104
104
  width: 1rem;
@@ -108,7 +108,7 @@
108
108
  .drive-grid {
109
109
  display: grid;
110
110
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
111
- gap: var(--ad-space-4);
111
+ gap: var(--agd-space-4);
112
112
  list-style: none;
113
113
  margin: 0;
114
114
  padding: 0;
@@ -116,11 +116,11 @@
116
116
  .drive-card {
117
117
  position: relative;
118
118
  display: grid;
119
- gap: var(--ad-space-2);
120
- padding: var(--ad-space-4);
121
- border: 1px solid var(--ad-color-border);
122
- border-radius: var(--ad-radius-md);
123
- background: var(--ad-color-surface);
119
+ gap: var(--agd-space-2);
120
+ padding: var(--agd-space-4);
121
+ border: 1px solid var(--agd-color-border);
122
+ border-radius: var(--agd-radius-md);
123
+ background: var(--agd-color-surface);
124
124
  }
125
125
  .drive-card__icon svg {
126
126
  width: 2rem;
@@ -128,27 +128,164 @@
128
128
  }
129
129
  .drive-card__name {
130
130
  overflow-wrap: anywhere;
131
- font-weight: var(--ad-font-weight-medium);
132
- color: var(--ad-color-text);
131
+ font-weight: var(--agd-font-weight-medium);
132
+ color: var(--agd-color-text);
133
133
  }
134
134
  .drive-card__meta {
135
- font-size: var(--ad-font-size-sm);
136
- color: var(--ad-color-text-muted);
135
+ font-size: var(--agd-font-size-sm);
136
+ color: var(--agd-color-text-muted);
137
137
  }
138
138
  .drive-card__actions {
139
139
  display: flex;
140
140
  align-items: center;
141
141
  justify-content: space-between;
142
- gap: var(--ad-space-2);
142
+ gap: var(--agd-space-2);
143
143
  }
144
144
  .drive-root {
145
145
  display: grid;
146
146
  grid-template-columns: 12rem minmax(0, 1fr);
147
- gap: var(--ad-space-6);
148
- color: var(--ad-color-text);
147
+ gap: var(--agd-space-6);
148
+ color: var(--agd-color-text);
149
149
  }
150
150
  @media (max-width: 48rem) {
151
151
  .drive-root {
152
152
  grid-template-columns: 1fr;
153
153
  }
154
154
  }
155
+ .drive-sr {
156
+ position: absolute;
157
+ width: 1px;
158
+ height: 1px;
159
+ overflow: hidden;
160
+ clip-path: inset(50%);
161
+ white-space: nowrap;
162
+ }
163
+ .drive-tools {
164
+ display: flex;
165
+ justify-content: flex-end;
166
+ margin-bottom: var(--agd-space-2);
167
+ }
168
+ .drive-search {
169
+ display: flex;
170
+ align-items: center;
171
+ gap: var(--agd-space-2);
172
+ }
173
+ .drive-search__input {
174
+ min-width: 14rem;
175
+ min-height: 2.25rem;
176
+ padding: 0 var(--agd-space-3);
177
+ border: 1px solid var(--agd-color-border);
178
+ border-radius: var(--agd-radius-md);
179
+ background: var(--agd-color-surface);
180
+ color: var(--agd-color-text);
181
+ font: inherit;
182
+ }
183
+ .drive-search__input:focus-visible,
184
+ .drive-sort:focus-visible {
185
+ outline: 2px solid var(--agd-color-accent);
186
+ outline-offset: 2px;
187
+ }
188
+ .drive-table {
189
+ width: 100%;
190
+ border-collapse: collapse;
191
+ }
192
+ .drive-table th {
193
+ padding: var(--agd-space-2) var(--agd-space-3);
194
+ text-align: left;
195
+ font-size: var(--agd-font-size-sm);
196
+ font-weight: var(--agd-font-weight-medium);
197
+ color: var(--agd-color-text-muted);
198
+ border-bottom: 1px solid var(--agd-color-border);
199
+ }
200
+ .drive-table td {
201
+ padding: var(--agd-space-2) var(--agd-space-3);
202
+ border-bottom: 1px solid var(--agd-color-border);
203
+ vertical-align: middle;
204
+ }
205
+ .drive-table .drive-table__date {
206
+ color: var(--agd-color-text-muted);
207
+ white-space: nowrap;
208
+ }
209
+ .drive-table__check {
210
+ width: 2.5rem;
211
+ }
212
+ .drive-table__name {
213
+ display: flex;
214
+ align-items: center;
215
+ gap: var(--agd-space-2);
216
+ overflow-wrap: anywhere;
217
+ }
218
+ .drive-table__name a {
219
+ color: var(--agd-color-text);
220
+ font-weight: var(--agd-font-weight-medium);
221
+ text-decoration: none;
222
+ }
223
+ .drive-table__name a:hover {
224
+ text-decoration: underline;
225
+ }
226
+ .drive-table__icon svg {
227
+ width: 1.25rem;
228
+ height: 1.25rem;
229
+ color: var(--agd-color-text-muted);
230
+ }
231
+ .drive-table__actions > * {
232
+ vertical-align: middle;
233
+ }
234
+ .drive-table__actions {
235
+ text-align: right;
236
+ white-space: nowrap;
237
+ }
238
+ .drive-row:hover,
239
+ .drive-row[data-selected] {
240
+ background: var(--agd-color-surface-sunken);
241
+ }
242
+ .drive-sort {
243
+ all: unset;
244
+ cursor: pointer;
245
+ border-radius: var(--agd-radius-sm);
246
+ }
247
+ .drive-bulk {
248
+ position: fixed;
249
+ inset: auto 0 var(--agd-space-4);
250
+ margin-inline: auto;
251
+ width: max-content;
252
+ max-width: calc(100vw - 2rem);
253
+ display: flex;
254
+ align-items: center;
255
+ gap: var(--agd-space-3);
256
+ padding: var(--agd-space-2) var(--agd-space-4);
257
+ border: 1px solid var(--agd-color-border);
258
+ border-radius: var(--agd-radius-md);
259
+ background: var(--agd-color-surface);
260
+ box-shadow: 0 4px 16px rgb(0 0 0 / 0.16);
261
+ z-index: 20;
262
+ }
263
+ @media (max-width: 40rem) {
264
+ .drive-table .drive-table__who {
265
+ display: none;
266
+ }
267
+ }
268
+ .drive-title {
269
+ display: flex;
270
+ align-items: center;
271
+ gap: var(--agd-space-3);
272
+ flex-wrap: wrap;
273
+ min-width: 0;
274
+ }
275
+ .drive-title h1 {
276
+ margin: 0;
277
+ }
278
+ .drive-drop--bulk {
279
+ padding-bottom: 6rem;
280
+ }
281
+ html:has(.drive-bulk) {
282
+ scroll-padding-bottom: 6rem;
283
+ }
284
+ .agd-checkbox:indeterminate {
285
+ background-color: var(--agd-color-accent);
286
+ border-color: var(--agd-color-accent);
287
+ background-image: linear-gradient(var(--agd-color-surface), var(--agd-color-surface));
288
+ background-size: 60% 2px;
289
+ background-repeat: no-repeat;
290
+ background-position: center;
291
+ }