modjules 0.1.1 → 0.2.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.
Files changed (48) hide show
  1. package/README.md +10 -6
  2. package/dist/activities/client.d.ts +44 -1
  3. package/dist/activities/types.d.ts +7 -0
  4. package/dist/activity/summary.d.ts +7 -0
  5. package/dist/api.d.ts +31 -1
  6. package/dist/artifacts.d.ts +22 -1
  7. package/dist/browser.d.ts +9 -1
  8. package/dist/browser.mjs +304 -0
  9. package/dist/browser.mjs.map +1 -0
  10. package/dist/caching.d.ts +16 -0
  11. package/dist/client.d.ts +53 -1
  12. package/dist/errors.d.ts +7 -0
  13. package/dist/github/adapter.d.ts +2 -0
  14. package/dist/github/api.d.ts +6 -0
  15. package/dist/github/caching.d.ts +2 -0
  16. package/dist/github/errors.d.ts +17 -0
  17. package/dist/github/index.d.ts +3 -0
  18. package/dist/github/pr-client.d.ts +12 -0
  19. package/dist/github/types.d.ts +72 -0
  20. package/dist/index.d.ts +24 -2
  21. package/dist/index.mjs +1438 -0
  22. package/dist/index.mjs.map +1 -0
  23. package/dist/memory-DE2Wujcu.js +2573 -0
  24. package/dist/memory-DE2Wujcu.js.map +1 -0
  25. package/dist/platform/browser.d.ts +13 -1
  26. package/dist/platform/node.d.ts +15 -1
  27. package/dist/platform/types.d.ts +56 -1
  28. package/dist/platform/web.d.ts +29 -0
  29. package/dist/query/computed.d.ts +65 -0
  30. package/dist/query/projection.d.ts +65 -0
  31. package/dist/query/schema.d.ts +109 -0
  32. package/dist/query/select.d.ts +6 -0
  33. package/dist/query/validate.d.ts +59 -0
  34. package/dist/session.d.ts +30 -6
  35. package/dist/sessions.d.ts +65 -0
  36. package/dist/snapshot.d.ts +23 -0
  37. package/dist/storage/cache-info.d.ts +28 -0
  38. package/dist/storage/memory.d.ts +15 -2
  39. package/dist/storage/node-fs.d.ts +19 -3
  40. package/dist/storage/root.d.ts +2 -0
  41. package/dist/storage/types.d.ts +63 -1
  42. package/dist/types.d.ts +422 -11
  43. package/dist/utils/page-token.d.ts +60 -0
  44. package/dist/utils.d.ts +1 -1
  45. package/package.json +14 -44
  46. package/dist/browser.es.js +0 -158
  47. package/dist/client-D2GRjxRE.mjs +0 -927
  48. package/dist/index.es.js +0 -140
package/dist/index.es.js DELETED
@@ -1,140 +0,0 @@
1
- import { J as l } from "./client-D2GRjxRE.mjs";
2
- import { A as P, I as F, c as z, d as I, a as A, b as O, e as b, M as j, S as $ } from "./client-D2GRjxRE.mjs";
3
- import * as r from "fs/promises";
4
- import { createReadStream as c } from "fs";
5
- import * as s from "path";
6
- import * as f from "readline";
7
- import { writeFile as u } from "node:fs/promises";
8
- import { Buffer as d } from "node:buffer";
9
- import { setTimeout as h } from "node:timers/promises";
10
- class m {
11
- filePath;
12
- initialized = !1;
13
- constructor(i, t = process.cwd()) {
14
- this.filePath = s.resolve(
15
- t,
16
- ".jules/cache",
17
- i,
18
- "activities.jsonl"
19
- );
20
- }
21
- /**
22
- * Initializes the storage by ensuring the cache directory exists.
23
- *
24
- * **Side Effects:**
25
- * - Creates the `.jules/cache/<sessionId>` directory if it does not exist.
26
- * - Sets the internal `initialized` flag.
27
- */
28
- async init() {
29
- this.initialized || (await r.mkdir(s.dirname(this.filePath), { recursive: !0 }), this.initialized = !0);
30
- }
31
- /**
32
- * Closes the storage.
33
- */
34
- async close() {
35
- this.initialized = !1;
36
- }
37
- /**
38
- * Appends an activity to the file.
39
- *
40
- * **Side Effects:**
41
- * - Appends a new line containing the JSON representation of the activity to `activities.jsonl`.
42
- * - Implicitly calls `init()` if not already initialized.
43
- */
44
- async append(i) {
45
- this.initialized || await this.init();
46
- const t = JSON.stringify(i) + `
47
- `;
48
- await r.appendFile(this.filePath, t, "utf8");
49
- }
50
- /**
51
- * Retrieves an activity by ID.
52
- * Uses a linear scan of the file.
53
- */
54
- async get(i) {
55
- for await (const t of this.scan())
56
- if (t.id === i)
57
- return t;
58
- }
59
- /**
60
- * Retrieves the latest activity.
61
- * Scans the entire file to find the last entry.
62
- */
63
- async latest() {
64
- let i;
65
- for await (const t of this.scan())
66
- i = t;
67
- return i;
68
- }
69
- /**
70
- * Yields all activities in the file.
71
- *
72
- * **Behavior:**
73
- * - Opens a read stream to `activities.jsonl`.
74
- * - Reads line-by-line using `readline`.
75
- * - Parses each line as JSON.
76
- *
77
- * **Edge Cases:**
78
- * - Logs a warning and skips lines if JSON parsing fails (corrupt data).
79
- * - Returns immediately (yields nothing) if the file does not exist.
80
- */
81
- async *scan() {
82
- this.initialized || await this.init();
83
- try {
84
- await r.access(this.filePath);
85
- } catch (e) {
86
- if (e.code === "ENOENT")
87
- return;
88
- throw e;
89
- }
90
- const i = c(this.filePath, { encoding: "utf8" }), t = f.createInterface({
91
- input: i,
92
- crlfDelay: 1 / 0
93
- });
94
- for await (const e of t)
95
- if (e.trim().length !== 0)
96
- try {
97
- yield JSON.parse(e);
98
- } catch {
99
- console.warn(
100
- `[NodeFileStorage] Corrupt JSON line ignored in ${this.filePath}`
101
- );
102
- }
103
- }
104
- }
105
- class p {
106
- /**
107
- * Saves a file to the local filesystem using `node:fs/promises`.
108
- *
109
- * **Side Effects:**
110
- * - Writes a file to disk.
111
- * - Overwrites the file if it already exists.
112
- */
113
- async saveFile(i, t, e, o) {
114
- const n = d.from(t, e);
115
- await u(i, n);
116
- }
117
- async sleep(i) {
118
- await h(i);
119
- }
120
- createDataUrl(i, t) {
121
- return `data:${t};base64,${i}`;
122
- }
123
- }
124
- const N = new l(
125
- {},
126
- (a) => new m(a),
127
- new p()
128
- );
129
- export {
130
- P as AutomatedSessionFailedError,
131
- F as InvalidStateError,
132
- z as JulesApiError,
133
- I as JulesAuthenticationError,
134
- A as JulesError,
135
- O as JulesNetworkError,
136
- b as JulesRateLimitError,
137
- j as MissingApiKeyError,
138
- $ as SourceNotFoundError,
139
- N as jules
140
- };