@danypops/vehicle-core 0.14.0 → 0.15.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.
@@ -178,9 +178,24 @@ export interface VehiclePrincipal {
178
178
  readonly id: string;
179
179
  readonly claims?: Readonly<Record<string, JsonValue>>;
180
180
  }
181
+ /**
182
+ * callerSessionId/callerProjectRoot identify the real host session (e.g. one Pi TUI process) that
183
+ * originated this call, and its working directory at call time -- a generic ownership/attribution
184
+ * hook any operation handler can read (e.g. scoping a background subscription to the session or
185
+ * project that created it), distinct from both:
186
+ * - correlationId: a caller-CHOSEN id deliberately meant to span several separate invoke() calls
187
+ * (a batch/business-transaction id), not an automatically-derived caller identity.
188
+ * - principal: broader identity/claims used for permission and approval decisions, usually a
189
+ * fixed per-extension value (e.g. {id: "pi-pipes"}), not a distinguishing per-session id.
190
+ * A Pi projection layer (see vehicle-client-pi's invokeVehicleOperation) auto-derives both from
191
+ * context.sessionManager.getSessionId()/context.cwd on every call, the same way it already
192
+ * auto-derives correlationId -- a handler that never reads them pays nothing extra.
193
+ */
181
194
  export interface VehicleInvocationOptions {
182
195
  readonly operationId?: string;
183
196
  readonly correlationId?: string;
197
+ readonly callerSessionId?: string;
198
+ readonly callerProjectRoot?: string;
184
199
  readonly signal?: AbortSignal;
185
200
  readonly deadline?: number;
186
201
  readonly permissions?: readonly string[];
@@ -194,6 +209,10 @@ export interface VehicleOperationContext<Input> {
194
209
  readonly input: Input;
195
210
  readonly operationId: string;
196
211
  readonly correlationId?: string;
212
+ /** See VehicleInvocationOptions's own doc comment. */
213
+ readonly callerSessionId?: string;
214
+ /** See VehicleInvocationOptions's own doc comment. */
215
+ readonly callerProjectRoot?: string;
197
216
  readonly signal: AbortSignal;
198
217
  readonly deadline: number;
199
218
  readonly permissions: readonly string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danypops/vehicle-core",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "Vehicle's runtime-neutral wire contract: operation descriptors, schema codecs, failure shapes. Zero runtime dependencies, zero Bun-specific code -- the one thing every Vehicle client and server package depends on.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -254,9 +254,24 @@ export interface VehiclePrincipal {
254
254
  readonly claims?: Readonly<Record<string, JsonValue>>;
255
255
  }
256
256
 
257
+ /**
258
+ * callerSessionId/callerProjectRoot identify the real host session (e.g. one Pi TUI process) that
259
+ * originated this call, and its working directory at call time -- a generic ownership/attribution
260
+ * hook any operation handler can read (e.g. scoping a background subscription to the session or
261
+ * project that created it), distinct from both:
262
+ * - correlationId: a caller-CHOSEN id deliberately meant to span several separate invoke() calls
263
+ * (a batch/business-transaction id), not an automatically-derived caller identity.
264
+ * - principal: broader identity/claims used for permission and approval decisions, usually a
265
+ * fixed per-extension value (e.g. {id: "pi-pipes"}), not a distinguishing per-session id.
266
+ * A Pi projection layer (see vehicle-client-pi's invokeVehicleOperation) auto-derives both from
267
+ * context.sessionManager.getSessionId()/context.cwd on every call, the same way it already
268
+ * auto-derives correlationId -- a handler that never reads them pays nothing extra.
269
+ */
257
270
  export interface VehicleInvocationOptions {
258
271
  readonly operationId?: string;
259
272
  readonly correlationId?: string;
273
+ readonly callerSessionId?: string;
274
+ readonly callerProjectRoot?: string;
260
275
  readonly signal?: AbortSignal;
261
276
  readonly deadline?: number;
262
277
  readonly permissions?: readonly string[];
@@ -271,6 +286,10 @@ export interface VehicleOperationContext<Input> {
271
286
  readonly input: Input;
272
287
  readonly operationId: string;
273
288
  readonly correlationId?: string;
289
+ /** See VehicleInvocationOptions's own doc comment. */
290
+ readonly callerSessionId?: string;
291
+ /** See VehicleInvocationOptions's own doc comment. */
292
+ readonly callerProjectRoot?: string;
274
293
  readonly signal: AbortSignal;
275
294
  readonly deadline: number;
276
295
  readonly permissions: readonly string[];