@agentshouse/kit 0.2.1-alpha.23 → 0.2.1-alpha.24

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/api.js CHANGED
@@ -9,7 +9,7 @@ export class HouseRefusal extends Error {
9
9
  }
10
10
  }
11
11
  export function retryDelay(attempt) {
12
- return Math.min(30_000, 1000 * 2 ** attempt);
12
+ return Math.random() * Math.min(30_000, 1000 * 2 ** attempt);
13
13
  }
14
14
  export async function post(house, path, body, credential, signal) {
15
15
  const answer = await fetch(new URL(path, house), {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "version": "0.2.1-alpha.23",
3
+ "version": "0.2.1-alpha.24",
4
4
  "hosts": {
5
5
  "linux": {
6
- "command": "bash <(curl -fsSL https://github.com/agentshouse/kit/releases/download/v0.2.1-alpha.23/connect-linux.sh)",
6
+ "command": "bash <(curl -fsSL https://github.com/agentshouse/kit/releases/download/v0.2.1-alpha.24/connect-linux.sh)",
7
7
  "asset": {
8
8
  "name": "connect-linux.sh",
9
- "url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-alpha.23/connect-linux.sh"
9
+ "url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-alpha.24/connect-linux.sh"
10
10
  },
11
11
  "workspace": {
12
12
  "argument": "--workspace",
@@ -17,10 +17,10 @@
17
17
  }
18
18
  },
19
19
  "windows": {
20
- "command": "& ([scriptblock]::Create((irm https://github.com/agentshouse/kit/releases/download/v0.2.1-alpha.23/connect-windows.ps1)))",
20
+ "command": "& ([scriptblock]::Create((irm https://github.com/agentshouse/kit/releases/download/v0.2.1-alpha.24/connect-windows.ps1)))",
21
21
  "asset": {
22
22
  "name": "connect-windows.ps1",
23
- "url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-alpha.23/connect-windows.ps1"
23
+ "url": "https://github.com/agentshouse/kit/releases/download/v0.2.1-alpha.24/connect-windows.ps1"
24
24
  },
25
25
  "workspace": {
26
26
  "argument": "--workspace",
@@ -1,15 +1,17 @@
1
+ import { retryDelay } from './api.js';
1
2
  export async function holdSecretInput(house, subject, steps, waiting) {
2
- while (waiting()) {
3
+ for (let failures = 0; waiting();) {
3
4
  try {
4
5
  const held = await house.post(`/kit/secret-input/${subject}`, { steps });
5
6
  if (held.outcome === 'collected')
6
7
  return held.content;
7
8
  if (held.release !== 'held')
8
9
  return null;
10
+ failures = 0;
9
11
  }
10
12
  catch (error) {
11
13
  process.stderr.write(`kit: ${error instanceof Error ? error.message : String(error)}\n`);
12
- await new Promise((resolve) => setTimeout(resolve, 1000));
14
+ await new Promise((resolve) => setTimeout(resolve, retryDelay(failures++)));
13
15
  }
14
16
  }
15
17
  return null;
package/dist/stream.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { retryDelay } from './api.js';
1
2
  import { readEnrolment } from './home.js';
2
3
  const SUBPROTOCOL = 'house.kit.stream.1';
3
4
  function streamUrl(house) {
@@ -29,9 +30,7 @@ export function holdStream(handlers) {
29
30
  if (socket === opening)
30
31
  socket = null;
31
32
  process.stderr.write(`kit: control stream closed ${event.code} ${event.reason}\n`);
32
- const delay = opened
33
- ? 1000 + Math.random() * 2000
34
- : Math.min(30_000, 1000 * 2 ** failures++);
33
+ const delay = opened ? 1000 + Math.random() * 2000 : retryDelay(failures++);
35
34
  setTimeout(() => void connect(), delay);
36
35
  };
37
36
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentshouse/kit",
3
- "version": "0.2.1-alpha.23",
3
+ "version": "0.2.1-alpha.24",
4
4
  "description": "House Kit connects an Environment to agents.house.",
5
5
  "license": "MIT",
6
6
  "repository": {