@portel/photon-core 2.14.0 → 2.16.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.
package/README.md CHANGED
@@ -131,14 +131,14 @@ if (instance.onShutdown) {
131
131
 
132
132
  ## 📚 API Reference
133
133
 
134
- ### `PhotonMCP`
134
+ ### `Photon` (alias: `PhotonMCP`)
135
135
 
136
136
  Base class for creating Photon classes (optional - you can use plain classes too).
137
137
 
138
138
  ```typescript
139
- import { PhotonMCP } from '@portel/photon-core';
139
+ import { Photon } from '@portel/photon-core';
140
140
 
141
- export default class MyPhoton extends PhotonMCP {
141
+ export default class MyPhoton extends Photon {
142
142
  async myMethod(params: { input: string }) {
143
143
  return `Hello ${params.input}`;
144
144
  }
@@ -159,6 +159,21 @@ export default class MyPhoton extends PhotonMCP {
159
159
 
160
160
  **Instance methods:**
161
161
  - `executeTool(name, params)` - Execute a method by name
162
+ - `emit(data)` - Emit events to local handler or pub/sub channel
163
+ - `render(format, value)` - Send formatted intermediate results to the client
164
+ - `render()` - Clear the render zone
165
+ - `storage(subpath)` - Get path to persistent data directory
166
+ - `assets(subpath)` - Get path to bundled assets directory
167
+
168
+ **Caller identity** (requires `@auth` tag):
169
+ - `this.caller` - Authenticated caller info (`{ id, name, anonymous, scope, claims }`)
170
+
171
+ **Identity-aware locks** (for multiplayer/turn-based):
172
+ - `acquireLock(name, callerId, timeout?)` - Assign a lock to a specific caller
173
+ - `transferLock(name, toCallerId, fromCallerId?)` - Move lock to another caller
174
+ - `releaseLock(name, callerId?)` - Release a lock
175
+ - `getLock(name)` - Query who holds a lock
176
+ - `withLock(name, fn, timeout?)` - Execute function with a binary mutex lock
162
177
 
163
178
  **Lifecycle hooks:**
164
179
  - `onInitialize()` - Called when photon is initialized
@@ -321,6 +336,8 @@ interface ExtractedSchema {
321
336
  * @param email Email address {@format email}
322
337
  * @param username Username {@pattern ^[a-z0-9_]+$}
323
338
  * @param count Count {@default 10}
339
+ * @param env Target environment {@choice-from environments}
340
+ * @param service Service to deploy {@choice-from services.name}
324
341
  */
325
342
  ```
326
343
 
@@ -370,6 +387,62 @@ export default class DeployTool extends PhotonMCP {
370
387
 
371
388
  ---
372
389
 
390
+ ### MCP OAuth & Caller Identity
391
+
392
+ Photons can require authenticated callers using the `@auth` class-level tag. When enabled, `this.caller` provides the authenticated identity in every method.
393
+
394
+ ```typescript
395
+ /**
396
+ * Chess game with authenticated players
397
+ * @stateful
398
+ * @auth required
399
+ */
400
+ export default class Chess extends Photon {
401
+ players: Record<string, string> = {};
402
+
403
+ async join() {
404
+ const slot = !this.players.white ? 'white' : 'black';
405
+ this.players[slot] = this.caller.id;
406
+
407
+ if (slot === 'black') {
408
+ // Both joined — white goes first
409
+ await this.acquireLock('turn', this.players.white);
410
+ }
411
+ return { color: slot, playerId: this.caller.id, name: this.caller.name };
412
+ }
413
+
414
+ /** @locked turn */
415
+ async move(params: { from: string; to: string }) {
416
+ // Only reaches here if this.caller.id holds the 'turn' lock
417
+ const next = this.turn === 'white' ? this.players.black : this.players.white;
418
+ await this.transferLock('turn', next);
419
+ return this.board;
420
+ }
421
+ }
422
+ ```
423
+
424
+ **`@auth` tag values:**
425
+
426
+ | Value | Behavior |
427
+ |-------|----------|
428
+ | `@auth required` | All methods require a valid JWT. Anonymous callers get 401. |
429
+ | `@auth optional` | Caller populated if token present, anonymous allowed. |
430
+ | `@auth https://accounts.google.com` | Specifies the OIDC provider URL (implies required). |
431
+
432
+ **`this.caller` properties:**
433
+
434
+ | Property | Type | Description |
435
+ |----------|------|-------------|
436
+ | `id` | `string` | Stable user ID (JWT `sub` claim) |
437
+ | `name` | `string?` | Display name from OIDC profile |
438
+ | `anonymous` | `boolean` | `true` if no valid JWT was provided |
439
+ | `scope` | `string?` | OAuth scopes |
440
+ | `claims` | `Record<string, unknown>?` | Raw JWT claims |
441
+
442
+ The MCP transport handles the OAuth 2.1 flow per the [MCP authorization spec](https://modelcontextprotocol.io/specification/latest/basic/authorization). The photon author never deals with tokens or OAuth directly.
443
+
444
+ ---
445
+
373
446
  ### Stateful Workflows (Checkpoint Pattern)
374
447
 
375
448
  For long-running workflows that need to survive interruptions, use checkpoint yields:
@@ -508,6 +581,119 @@ sub.unsubscribe();
508
581
 
509
582
  See [CHANNELS.md](./CHANNELS.md) for full architecture documentation.
510
583
 
584
+ **Channel auto-prefixing:** When emitting with a `channel` property, the channel name is automatically prefixed with the photon name unless it already contains a colon:
585
+
586
+ ```typescript
587
+ // In a photon named "whatsapp":
588
+ this.emit({ channel: 'messages', event: 'new', data: msg });
589
+ // → publishes to 'whatsapp:messages'
590
+
591
+ // Explicit namespace (colon present = no auto-prefix)
592
+ this.emit({ channel: 'board:updates', event: 'moved', data });
593
+ // → publishes to 'board:updates' as-is
594
+ ```
595
+
596
+ ---
597
+
598
+ ### Intermediate Rendering (`this.render()`)
599
+
600
+ Send formatted intermediate results to the client during method execution. Each call replaces the previous render in the result panel. Uses the same rendering pipeline as `@format` return values.
601
+
602
+ ```typescript
603
+ export default class Scanner extends Photon {
604
+ async scan(params: { target: string }) {
605
+ // Show a progress table mid-execution
606
+ this.render('table', [{ host: params.target, status: 'scanning...' }]);
607
+
608
+ const results = await this.runScan(params.target);
609
+
610
+ // Update with final results
611
+ this.render('table', results);
612
+
613
+ // Clear the render zone
614
+ this.render();
615
+
616
+ return results;
617
+ }
618
+ }
619
+ ```
620
+
621
+ **Signatures:**
622
+ - `this.render(format: string, value: any)` — render a formatted value
623
+ - `this.render()` — clear the render zone (emits `render:clear`)
624
+
625
+ ---
626
+
627
+ ### Dynamic Enums (`{@choice-from}`)
628
+
629
+ Populate parameter enum values dynamically by calling another tool at schema resolution time:
630
+
631
+ ```typescript
632
+ export default class Deploy extends Photon {
633
+ /** @readOnly */
634
+ async environments() {
635
+ return ['staging', 'production', 'dev'];
636
+ }
637
+
638
+ /**
639
+ * Deploy to an environment
640
+ * @param env Target environment {@choice-from environments}
641
+ * @param service Service name {@choice-from services.name}
642
+ */
643
+ async deploy(params: { env: string; service: string }) { ... }
644
+ }
645
+ ```
646
+
647
+ The `{@choice-from toolName}` tag calls the specified tool and uses the result array as enum values. Use `{@choice-from toolName.field}` to extract a specific field from each result object.
648
+
649
+ ---
650
+
651
+ ### Namespace System & Storage/Assets
652
+
653
+ Every photon gets scoped filesystem APIs for persistent data and bundled assets:
654
+
655
+ ```typescript
656
+ export default class WhatsApp extends Photon {
657
+ async onInitialize() {
658
+ // Persistent data directory (follows symlink path)
659
+ const authDir = this.storage('auth');
660
+ // → ~/.photon/portel-dev/whatsapp/auth/
661
+
662
+ // Bundled assets directory (follows realpath to source)
663
+ const templates = this.assets('templates');
664
+ // → /real/path/to/whatsapp/assets/templates/
665
+ }
666
+ }
667
+ ```
668
+
669
+ Cross-namespace photon resolution uses `namespace:name` syntax:
670
+ ```typescript
671
+ const wa = await this.photon.use('portel-dev:whatsapp', 'work');
672
+ ```
673
+
674
+ ---
675
+
676
+ ### Shared UI Assets (`linkedTools`)
677
+
678
+ Multiple methods can reference the same `@ui` template. The first method becomes the primary link (used for app detection via `main()`), while all methods are tracked in `linkedTools[]`:
679
+
680
+ ```typescript
681
+ export default class Dashboard extends Photon {
682
+ /** @ui dashboard ./ui/dashboard.html */
683
+ async main() { return this.status(); }
684
+
685
+ /** @ui dashboard */
686
+ async status() { return { uptime: process.uptime() }; }
687
+
688
+ /** @ui dashboard */
689
+ async metrics() { return { requests: 1234 }; }
690
+ }
691
+ ```
692
+
693
+ The `UIAsset` type tracks both:
694
+ - `linkedTool` — first method (used for app detection)
695
+ - `linkedTools[]` — all methods sharing this template
696
+
511
697
  ---
512
698
 
513
699
  ### Managed Collections
@@ -1 +1 @@
1
- {"version":3,"file":"asset-discovery.d.ts","sourceRoot":"","sources":["../src/asset-discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAc/C;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAClC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CA8DnC;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,IAAI,CAAC,CAiEf"}
1
+ {"version":3,"file":"asset-discovery.d.ts","sourceRoot":"","sources":["../src/asset-discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAc/C;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAClC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CA8DnC;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,IAAI,CAAC,CAqFf"}
@@ -92,12 +92,33 @@ export async function discoverAssets(photonPath, source) {
92
92
  */
93
93
  export async function autoDiscoverAssets(assetFolder, assets) {
94
94
  // Auto-discover UI files
95
+ // .photon.html files (declarative mode) take priority over .html files with the same base name.
95
96
  const uiDir = path.join(assetFolder, 'ui');
96
97
  if (await fileExists(uiDir)) {
97
98
  try {
98
99
  const files = await fs.readdir(uiDir);
100
+ // Collect .photon.html files first so they take priority
101
+ const photonHtmlFiles = new Set();
99
102
  for (const file of files) {
100
- const id = path.basename(file, path.extname(file));
103
+ if (file.endsWith('.photon.html')) {
104
+ photonHtmlFiles.add(file.replace(/\.photon\.html$/, ''));
105
+ }
106
+ }
107
+ for (const file of files) {
108
+ // Determine the asset ID:
109
+ // - foo.photon.html → id "foo"
110
+ // - foo.html → id "foo" (but skipped if foo.photon.html exists)
111
+ let id;
112
+ if (file.endsWith('.photon.html')) {
113
+ id = file.replace(/\.photon\.html$/, '');
114
+ }
115
+ else {
116
+ id = path.basename(file, path.extname(file));
117
+ // Skip .html files when a .photon.html with the same base name exists
118
+ if (file.endsWith('.html') && photonHtmlFiles.has(id)) {
119
+ continue;
120
+ }
121
+ }
101
122
  if (!assets.ui.find((u) => u.id === id)) {
102
123
  assets.ui.push({
103
124
  id,
@@ -1 +1 @@
1
- {"version":3,"file":"asset-discovery.js","sourceRoot":"","sources":["../src/asset-discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD;;GAEG;AACH,KAAK,UAAU,UAAU,CAAC,QAAgB;IACxC,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,UAAkB,EAClB,MAAc;IAEd,MAAM,SAAS,GAAG,IAAI,eAAe,EAAE,CAAC;IACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IAEzD,uEAAuE;IACvE,6EAA6E;IAC7E,gEAAgE;IAChE,0EAA0E;IAC1E,IAAI,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACzC,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACzC,IAAI,KAAK,CAAC,cAAc,EAAE,EAAE,CAAC;YAC3B,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;YAC/C,S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AI,KAAK,EAAE,CAAC;gBACzB,MAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;gBACnD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;oBAC/C,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC;wBACpB,EAAE;wBACF,IAAI,EAAE,eAAe,IAAI,EAAE;wBAC3B,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC;wBAC3C,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC;qBAC5B,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,gBAAgB;QAClB,CAAC;IACH,CAAC;AACH,CAAC"}
package/dist/base.d.ts CHANGED
@@ -39,6 +39,7 @@
39
39
  * ```
40
40
  */
41
41
  import { MCPClient, MCPClientFactory } from '@portel/mcp';
42
+ import { type CallerInfo } from '@portel/cli';
42
43
  import { MemoryProvider } from './memory.js';
43
44
  import { ScheduleProvider } from './schedule.js';
44
45
  /**
@@ -55,6 +56,18 @@ export declare class Photon {
55
56
  * @internal
56
57
  */
57
58
  _photonName?: string;
59
+ /**
60
+ * Absolute path to the .photon.ts/.photon.js source file - set by runtime loader
61
+ * Used for storage() and assets() path resolution
62
+ * @internal
63
+ */
64
+ _photonFilePath?: string;
65
+ /**
66
+ * Dynamic photon resolver - injected by runtime loader
67
+ * Used by this.photon.use() for runtime photon access
68
+ * @internal
69
+ */
70
+ _photonResolver?: (name: string, instance?: string) => Promise<any>;
58
71
  /**
59
72
  * Scoped memory provider - lazy-initialized on first access
60
73
  * @internal
@@ -70,6 +83,24 @@ export declare class Photon {
70
83
  * @internal
71
84
  */
72
85
  _sessionId?: string;
86
+ /**
87
+ * Authenticated caller identity
88
+ *
89
+ * Populated from MCP OAuth when `@auth` is enabled on the photon.
90
+ * Returns the identity of whoever is calling the current method —
91
+ * human (via social login) or agent (via API key).
92
+ *
93
+ * Returns an anonymous caller if no auth token was provided.
94
+ *
95
+ * @example
96
+ * ```typescript
97
+ * // In a method:
98
+ * const userId = this.caller.id; // stable user ID from JWT
99
+ * const name = this.caller.name; // display name
100
+ * const isAnon = this.caller.anonymous; // true if no auth
101
+ * ```
102
+ */
103
+ get caller(): CallerInfo;
73
104
  /**
74
105
  * Scoped key-value storage for photon data
75
106
  *
@@ -125,6 +156,66 @@ export declare class Photon {
125
156
  * ```
126
157
  */
127
158
  get schedule(): ScheduleProvider;
159
+ /**
160
+ * Get an absolute path to a storage directory for this photon's data.
161
+ *
162
+ * Uses the symlink/installed path (not resolved) so data stays at the
163
+ * installed location. Directories are auto-created.
164
+ *
165
+ * @param subpath Sub-directory within the photon's data folder (e.g., 'auth', 'media')
166
+ * @returns Absolute path to the directory
167
+ *
168
+ * @example
169
+ * ```typescript
170
+ * const authDir = this.storage('auth');
171
+ * // ~/.photon/portel-dev/whatsapp/auth/
172
+ *
173
+ * const mediaDir = this.storage('media/images');
174
+ * // ~/.photon/portel-dev/whatsapp/media/images/
175
+ * ```
176
+ */
177
+ protected storage(subpath: string): string;
178
+ /**
179
+ * Get an absolute path to an assets directory for this photon.
180
+ *
181
+ * Uses realpathSync to follow symlinks — assets travel with source code,
182
+ * not the installed location. Useful for marketplace-distributed resources
183
+ * like HTML templates, images, etc.
184
+ *
185
+ * @param subpath Sub-path within the assets folder (e.g., 'templates', 'icons/logo.png')
186
+ * @returns Absolute path to the asset file or directory
187
+ *
188
+ * @example
189
+ * ```typescript
190
+ * const templateDir = this.assets('templates');
191
+ * // /real/path/to/portel-dev/whatsapp/assets/templates/
192
+ *
193
+ * const logo = this.assets('icons/logo.png');
194
+ * // /real/path/to/portel-dev/whatsapp/assets/icons/logo.png
195
+ * ```
196
+ */
197
+ protected assets(subpath: string): string;
198
+ /**
199
+ * Dynamic photon access
200
+ *
201
+ * Provides runtime access to other photons by name, with optional instance selection.
202
+ * Supports both short names and namespace-qualified names.
203
+ *
204
+ * @example
205
+ * ```typescript
206
+ * // Get default instance
207
+ * const wa = await this.photon.use('whatsapp');
208
+ *
209
+ * // Get named instance
210
+ * const personal = await this.photon.use('whatsapp', 'personal');
211
+ *
212
+ * // Cross-namespace access
213
+ * const wa2 = await this.photon.use('portel-dev:whatsapp', 'work');
214
+ * ```
215
+ */
216
+ get photon(): {
217
+ use: (name: string, instance?: string) => Promise<any>;
218
+ };
128
219
  /**
129
220
  * Emit an event/progress update
130
221
  *
@@ -147,6 +238,35 @@ export declare class Photon {
147
238
  * ```
148
239
  */
149
240
  protected emit(data: any): void;
241
+ /**
242
+ * Render a formatted value as an intermediate result
243
+ *
244
+ * Sends a value to the client (Beam, CLI, MCP) rendered with the specified
245
+ * format — the same formats available via `@format` docblock tags. Each call
246
+ * replaces the previous render in the result panel.
247
+ *
248
+ * For custom formats, place an HTML renderer at `assets/formats/<name>.html`.
249
+ *
250
+ * @param format The format type (table, qr, chart:bar, dashboard, or custom)
251
+ * @param value The data to render — same shape as a return value with that @format
252
+ *
253
+ * @example
254
+ * ```typescript
255
+ * // Show a QR code mid-execution
256
+ * this.render('qr', { value: 'https://wa.link/...' });
257
+ *
258
+ * // Show a status table
259
+ * this.render('table', [['Step', 'Status'], ['Auth', 'Done']]);
260
+ *
261
+ * // Composite dashboard
262
+ * this.render('dashboard', {
263
+ * qr: { format: 'qr', data: 'https://wa.link/...' },
264
+ * status: { format: 'text', data: 'Scan the QR code above' }
265
+ * });
266
+ * ```
267
+ */
268
+ protected render(format: string, value: any): void;
269
+ protected render(): void;
150
270
  /**
151
271
  * Cross-photon call handler - injected by runtime
152
272
  * @internal
@@ -288,5 +408,83 @@ export declare class Photon {
288
408
  * ```
289
409
  */
290
410
  protected withLock<T>(lockName: string, fn: () => Promise<T>, timeout?: number): Promise<T>;
411
+ /**
412
+ * Identity-aware lock handler - injected by runtime
413
+ * @internal
414
+ */
415
+ _lockHandler?: {
416
+ assign(lockName: string, holder: string, timeout?: number): Promise<boolean>;
417
+ transfer(lockName: string, fromHolder: string, toHolder: string, timeout?: number): Promise<boolean>;
418
+ release(lockName: string, holder: string): Promise<boolean>;
419
+ query(lockName: string): Promise<{
420
+ holder: string | null;
421
+ acquiredAt?: number;
422
+ expiresAt?: number;
423
+ }>;
424
+ };
425
+ /**
426
+ * Assign a lock to a specific caller (identity-aware)
427
+ *
428
+ * Unlike `withLock` which auto-acquires/releases around a function,
429
+ * this explicitly assigns a lock to a caller ID. The lock persists
430
+ * until transferred or released.
431
+ *
432
+ * @param lockName Name of the lock
433
+ * @param callerId Caller ID to assign the lock to
434
+ * @param timeout Lock timeout in ms (default 30000, auto-extended on transfer)
435
+ *
436
+ * @example
437
+ * ```typescript
438
+ * // Assign "turn" lock to first player
439
+ * await this.acquireLock('turn', this.caller.id);
440
+ * ```
441
+ */
442
+ protected acquireLock(lockName: string, callerId: string, timeout?: number): Promise<boolean>;
443
+ /**
444
+ * Transfer a lock from the current holder to another caller
445
+ *
446
+ * Only succeeds if `fromCallerId` is the current holder.
447
+ *
448
+ * @param lockName Name of the lock
449
+ * @param toCallerId Caller ID to transfer the lock to
450
+ * @param fromCallerId Current holder (defaults to this.caller.id)
451
+ *
452
+ * @example
453
+ * ```typescript
454
+ * // After a chess move, transfer turn to opponent
455
+ * await this.transferLock('turn', opponentId);
456
+ * ```
457
+ */
458
+ protected transferLock(lockName: string, toCallerId: string, fromCallerId?: string): Promise<boolean>;
459
+ /**
460
+ * Release a lock (make the method open to anyone)
461
+ *
462
+ * @param lockName Name of the lock
463
+ * @param callerId Holder to release from (defaults to this.caller.id)
464
+ *
465
+ * @example
466
+ * ```typescript
467
+ * // Presenter releases navigation control to audience
468
+ * await this.releaseLock('navigation');
469
+ * ```
470
+ */
471
+ protected releaseLock(lockName: string, callerId?: string): Promise<boolean>;
472
+ /**
473
+ * Query who holds a specific lock
474
+ *
475
+ * @param lockName Name of the lock
476
+ * @returns Lock holder info, or null holder if unlocked
477
+ *
478
+ * @example
479
+ * ```typescript
480
+ * const lock = await this.getLock('turn');
481
+ * if (lock.holder === this.caller.id) { ... }
482
+ * ```
483
+ */
484
+ protected getLock(lockName: string): Promise<{
485
+ holder: string | null;
486
+ acquiredAt?: number;
487
+ expiresAt?: number;
488
+ }>;
291
489
  }
292
490
  //# sourceMappingURL=base.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAkB,MAAM,aAAa,CAAC;AAI1E,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;GAMG;AACH,qBAAa,MAAM;IACjB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,OAAO,CAAC,OAAO,CAAC,CAAiB;IAEjC;;;OAGG;IACH,OAAO,CAAC,SAAS,CAAC,CAAmB;IAErC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,IAAI,MAAM,IAAI,cAAc,CAU3B;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,IAAI,QAAQ,IAAI,gBAAgB,CAU/B;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI;IAuC/B;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,cAA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