runwork 0.31.0 → 0.31.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
@@ -57,6 +57,7 @@ runwork dev # Start developing with live preview
57
57
  | `runwork clone` | Clone an existing Runwork app to your machine |
58
58
  | `runwork dev` | Start local development with live preview and auto-sync |
59
59
  | `runwork deploy` | Deploy to production |
60
+ | `runwork git <args>` | Run git in an app folder with Runwork's own git, signed in to the app's Runwork remote |
60
61
  | `runwork spaces` | Spaces: containers for one kind of work |
61
62
  | `runwork logout` | Remove stored credentials |
62
63
 
@@ -193,10 +194,11 @@ my-app/
193
194
 
194
195
  ## Requirements
195
196
 
196
- - Git
197
197
  - A [Runwork](https://www.runwork.ai) account
198
198
  - Node.js 18+ (only required when installing via npm)
199
199
 
200
+ Git is not required: the CLI installs its own under `~/.runwork/git` the first time a command needs it.
201
+
200
202
  ## Links
201
203
 
202
204
  - [Runwork Platform](https://www.runwork.ai)
@@ -231,8 +231,8 @@ export declare const integrationApiSchema: z.ZodObject<{
231
231
  data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
232
232
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
233
233
  }, "strip", z.ZodTypeAny, {
234
- endpoint: string;
235
234
  method: "POST" | "GET" | "PUT" | "PATCH" | "DELETE";
235
+ endpoint: string;
236
236
  data?: Record<string, unknown> | undefined;
237
237
  headers?: Record<string, string> | undefined;
238
238
  }, {
@@ -10,8 +10,12 @@
10
10
  * - Server-side query, search, sort, count via json_extract()
11
11
  * - Security: field name validation, LIKE escaping, input limits
12
12
  * - Auto-migration from legacy KV storage
13
+ * - Replication outbox: when a replication config is enabled, every write
14
+ * also appends a change event to an outbox table in the same transaction;
15
+ * a debounced alarm drains batches to the platform, deleting rows only
16
+ * after the platform acks custody. Fully inert when not configured.
13
17
  *
14
- * NO SCHEDULING - Use SchedulerDO for scheduled jobs
18
+ * The alarm is used ONLY for outbox draining - use SchedulerDO for scheduled jobs
15
19
  */
16
20
  import { DurableObject } from 'cloudflare:workers';
17
21
  import type { Env } from './core-utils';
@@ -71,6 +75,31 @@ export declare class EntityDO extends DurableObject<Env> {
71
75
  constructor(ctx: DurableObjectState, env: Env);
72
76
  private ensureTable;
73
77
  private migrateFromKV;
78
+ /** In-memory cache of the effective config; undefined = not loaded yet */
79
+ private _replConfig;
80
+ private _drainScheduled;
81
+ private _retryAttempts;
82
+ private loadReplicationConfig;
83
+ private persistReplicationConfig;
84
+ private replicationEnabled;
85
+ private appendOutbox;
86
+ private outboxCount;
87
+ private clearOutbox;
88
+ /**
89
+ * Run a write operation. When replication is enabled, the operation and its
90
+ * outbox rows commit in ONE SQLite transaction and a drain is scheduled.
91
+ * When disabled, the operation runs exactly as it did before replication
92
+ * existed (no transaction wrapper, no outbox reads or writes).
93
+ */
94
+ private withCapture;
95
+ private scheduleDrainSoon;
96
+ /**
97
+ * Drain the outbox: deliver batches to the platform ingest endpoint, deleting
98
+ * rows only after an ack. Retries with exponential backoff on failure; a
99
+ * 'disabled' ack disables capture and clears the outbox.
100
+ */
101
+ alarm(): Promise<void>;
102
+ private deliverBatch;
74
103
  getDoc(key: string): {
75
104
  v: number;
76
105
  data: unknown;
@@ -27,6 +27,12 @@ export interface Env {
27
27
  BUCKET?: R2Bucket;
28
28
  WORKSPACE_ID?: string;
29
29
  APP_ID?: string;
30
+ /**
31
+ * Workspace replication config injected at deploy time, JSON:
32
+ * {"enabled": boolean, "revision": number}. Revision-compared against the
33
+ * config stored inside each EntityDO; the higher revision wins.
34
+ */
35
+ RUNWORK_REPLICATION_CONFIG?: string;
30
36
  APP_NAME?: string;
31
37
  WORKSPACE_API_URL?: string;
32
38
  WORKSPACE_API_BASE_URL?: string;