@veris-ai/daytona 0.2.1 → 0.3.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.
@@ -1,3 +1,5 @@
1
+ import type { ReceiptBaseline } from './run-receipt';
2
+ import type { ControlOptions, ControlResource } from './service-control';
1
3
  import type { Sandbox } from '@daytona/sdk';
2
4
  import type { ControlPlane, ServiceInfo } from './control-plane';
3
5
  import type { Receipt, ReceiptEntry } from './receipt';
@@ -13,6 +15,13 @@ export interface VerisContext {
13
15
  canaryHost: string;
14
16
  /** Whether this twin is owned (delete removes it) or attached (caller owns it). */
15
17
  ownsTwin: boolean;
18
+ /** Newest request id per service when this run began, so a receipt counts
19
+ * what the run caused rather than what an attached twin already held. Set by
20
+ * create(); a sandbox rehydrated by get() has none and reads the log from
21
+ * the start, as the receipt always did. Not persisted in a label on
22
+ * purpose — the sandbox can rewrite its own labels, and a watermark it
23
+ * chose would let it hide its own traffic from the receipt. */
24
+ watermarks?: Record<string, number>;
16
25
  }
17
26
  /** Narrow assertTouched to specific requests. All fields AND together. */
18
27
  export interface TouchMatcher {
@@ -23,17 +32,32 @@ export interface TouchMatcher {
23
32
  minRequests?: number;
24
33
  }
25
34
  export interface VerisApi {
35
+ /** Whether provider teardown owns this twin. */
36
+ readonly ownsTwin: boolean;
26
37
  /** The Veris twin's sandbox id — NOT the Daytona sandbox id. */
27
38
  readonly sandboxId: string;
39
+ /** The Veris environment the twin was deployed from. Every control-plane
40
+ * route that acts on a twin is scoped to it, so a caller that wants to talk
41
+ * to the twin itself needs it and has nowhere else to read it from. */
42
+ readonly environmentId: string;
28
43
  readonly mode: 'gateway';
29
44
  services(): Promise<ServiceInfo[]>;
30
45
  /** The service's own manual: what it models and how its data is shaped. */
31
46
  manual(service: string): Promise<string>;
47
+ receiptBaseline(): Promise<ReceiptBaseline>;
48
+ receiptSince(baseline: ReceiptBaseline, service?: string): Promise<Receipt>;
49
+ control(service: string, resource: ControlResource, options?: ControlOptions): Promise<unknown>;
32
50
  receipt(): Promise<Receipt>;
33
51
  receipt(service: string): Promise<ReceiptEntry>;
34
52
  assertTouched(service: string, match?: TouchMatcher): Promise<void>;
35
53
  getDataPlaneEnv(): Promise<Record<string, string>>;
36
54
  getTrustEnv(): Record<string, string>;
55
+ /** The same trust variables as a shell `export` prelude, for a caller that
56
+ * can only prefix a command line. */
57
+ trustPrelude(): string;
58
+ /** Append the Veris CA to the CA bundles SDKs ship with them. Run it after
59
+ * installing dependencies; returns the files it changed. */
60
+ patchBundledCas(): Promise<string[]>;
37
61
  deliverTo(port: number, opts?: DeliverToOpts): Promise<string>;
38
62
  deliverTo(url: string | null, opts?: DeliverToOpts): Promise<string | null>;
39
63
  }
@@ -45,7 +69,9 @@ export interface DeliverToOpts {
45
69
  export declare class VerisApiImpl implements VerisApi {
46
70
  private readonly ctx;
47
71
  constructor(ctx: VerisContext);
72
+ get ownsTwin(): boolean;
48
73
  get sandboxId(): string;
74
+ get environmentId(): string;
49
75
  get mode(): 'gateway';
50
76
  services(): Promise<ServiceInfo[]>;
51
77
  /** Resolve a service by name. A typo and a service that exists but saw
@@ -60,10 +86,42 @@ export declare class VerisApiImpl implements VerisApi {
60
86
  * ride around it — named rather than rounded off.
61
87
  */
62
88
  private leaks;
89
+ /** Where this service's log was when the run began. 0 reads all of it. */
90
+ private watermark;
91
+ private verifyIntegrity;
92
+ receiptBaseline(): Promise<ReceiptBaseline>;
93
+ receiptSince(baseline: ReceiptBaseline, service?: string): Promise<Receipt>;
94
+ control(service: string, resource: ControlResource, options?: ControlOptions): Promise<unknown>;
63
95
  assertTouched(service: string, match?: TouchMatcher): Promise<void>;
64
96
  getDataPlaneEnv(): Promise<Record<string, string>>;
65
97
  /** The CA trust vars injected at create, for callers building their own env. */
66
98
  getTrustEnv(): Record<string, string>;
99
+ /**
100
+ * The same variables as a shell prelude, for a caller that has no env map to
101
+ * fill — anything running a command through a session or a shell it did not
102
+ * build the environment for. Daytona resets SSL_CERT_FILE,
103
+ * REQUESTS_CA_BUNDLE, CURL_CA_BUNDLE and NODE_EXTRA_CA_CERTS to its own CA
104
+ * file inside the sandbox, and that file cannot verify the gateway's leaf, so
105
+ * a command that inherits them fails on certificate validation:
106
+ * `uv sync` dies with "invalid peer certificate: UnknownIssuer".
107
+ *
108
+ * sbx.process.executeCommand(`${sbx.veris.trustPrelude()} uv sync`)
109
+ */
110
+ trustPrelude(): string;
111
+ /**
112
+ * Append the Veris CA to the CA bundles the code under test's own SDKs ship.
113
+ *
114
+ * The variables above reach every client that reads one. stripe-python does
115
+ * not: it passes `verify=stripe.ca_bundle_path`, so the first Stripe call
116
+ * fails with "Could not verify Stripe's SSL certificate" in a sandbox where
117
+ * curl, Node and `requests` all succeed. This patches the file itself, which
118
+ * is the Daytona-shaped version of the veris CLI's --patch-bundled-cas.
119
+ *
120
+ * Call it AFTER installing dependencies — the bundles arrive with them, so
121
+ * there is nothing to patch at create time. Safe to call again; it returns
122
+ * only the files it actually changed.
123
+ */
124
+ patchBundledCas(): Promise<string[]>;
67
125
  /**
68
126
  * Point every mocked vendor's callbacks/webhooks at this sandbox.
69
127
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veris-ai/daytona",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Veris twin interception for Daytona: a drop-in @daytona/sdk whose sandboxes come up with a Veris twin already answering their vendor API calls. Unmodified code, real hostnames, receipts.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -13,6 +13,9 @@
13
13
  "require": "./dist/index.cjs"
14
14
  }
15
15
  },
16
+ "bin": {
17
+ "veris-daytona": "./dist/cli.js"
18
+ },
16
19
  "sideEffects": false,
17
20
  "files": [
18
21
  "dist",
@@ -28,6 +31,9 @@
28
31
  "prepublishOnly": "npm run build",
29
32
  "dev": "tsup --watch"
30
33
  },
34
+ "dependencies": {
35
+ "yaml": "^2.9.0"
36
+ },
31
37
  "peerDependencies": {
32
38
  "@daytona/sdk": ">=0.204.1 <1"
33
39
  },