@tencildev/testing 0.4.0 → 0.4.2

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/dist/index.d.mts CHANGED
@@ -224,6 +224,8 @@ export declare class FakeCodexAppServer {
224
224
  crashNextTurn: boolean;
225
225
  /** What the next process prints before dying, instead of starting. */
226
226
  failToStart: string | undefined;
227
+ /** How long every answer takes, like a busy machine. */
228
+ answerDelayMs: number;
227
229
  /** For `CodexProviderOptions.spawn`. */
228
230
  spawn: () => FakeProcess;
229
231
  release(): void;
package/dist/index.mjs CHANGED
@@ -366,6 +366,8 @@ var FakeCodexAppServer = class {
366
366
  crashNextTurn = false;
367
367
  /** What the next process prints before dying, instead of starting. */
368
368
  failToStart;
369
+ /** How long every answer takes, like a busy machine. */
370
+ answerDelayMs = 0;
369
371
  #gates = /* @__PURE__ */ new Set();
370
372
  #processes = /* @__PURE__ */ new Set();
371
373
  /** For `CodexProviderOptions.spawn`. */
@@ -451,21 +453,25 @@ var Connection = class {
451
453
  method,
452
454
  params
453
455
  });
454
- try {
455
- this.#send({
456
- id,
457
- result: this.#handle(method, params)
458
- });
459
- } catch (error) {
460
- const code = error instanceof RpcFailure ? error.code : -32603;
461
- this.#send({
462
- id,
463
- error: {
464
- code,
465
- message: error.message
466
- }
467
- });
468
- }
456
+ const answer = () => {
457
+ try {
458
+ this.#send({
459
+ id,
460
+ result: this.#handle(method, params)
461
+ });
462
+ } catch (error) {
463
+ const code = error instanceof RpcFailure ? error.code : -32603;
464
+ this.#send({
465
+ id,
466
+ error: {
467
+ code,
468
+ message: error.message
469
+ }
470
+ });
471
+ }
472
+ };
473
+ if (this.#server.answerDelayMs > 0) setTimeout(answer, this.#server.answerDelayMs);
474
+ else answer();
469
475
  }
470
476
  #handle(method, params) {
471
477
  const server = this.#server;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tencildev/testing",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Test doubles for Tencil: a fake provider, fake T3 Code, Ensemble and Codex servers and a fake Claude Agent SDK.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Pixel Perfect Agency",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "ws": "^8.22.0",
36
- "@tencildev/protocol": "^0.6.0"
36
+ "@tencildev/protocol": "^0.8.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/ws": "^8.18.2",