@nanocollective/roster 0.1.0-beta.1 → 0.1.0-beta.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/README.md CHANGED
@@ -47,6 +47,7 @@ roster run cto # one run now, followed to the end
47
47
  roster doctor # is any of this actually wired up
48
48
  roster fix # every finding, as one brief for a coding agent
49
49
  roster portal # read every brain, and the docs, locally
50
+ roster portal deploy # the same portal on your own URL, behind Sign in with GitHub
50
51
  roster prompt cto # the exact prompt a run will be sent
51
52
  roster upgrade # take framework changes without losing your edits
52
53
  roster retire cto # let someone go, with their brain kept
package/dist/cli.js CHANGED
@@ -3038,11 +3038,22 @@ function githubClient(token, opts = {}) {
3038
3038
  body2 = JSON.stringify(o.body);
3039
3039
  h["content-type"] = "application/json";
3040
3040
  }
3041
+ const reads = method === "GET" || o.retry === true;
3041
3042
  let res;
3042
- try {
3043
- res = await doFetch(url, { method, headers: h, body: body2 });
3044
- } catch (err) {
3045
- return { ok: false, error: `GitHub could not be reached: ${err.message}` };
3043
+ for (let attempt = 0; ; attempt++) {
3044
+ try {
3045
+ res = await doFetch(url, { method, headers: h, body: body2 });
3046
+ } catch (err) {
3047
+ if (reads && attempt === 0) continue;
3048
+ return { ok: false, error: `GitHub could not be reached: ${err.message}` };
3049
+ }
3050
+ if (reads && attempt === 0 && [502, 503, 504].includes(res.status)) {
3051
+ await res.body?.cancel().catch(() => {
3052
+ });
3053
+ await new Promise((r) => setTimeout(r, 400));
3054
+ continue;
3055
+ }
3056
+ break;
3046
3057
  }
3047
3058
  if (res.status === 304 && kept) {
3048
3059
  seen.delete(key);
@@ -3072,7 +3083,8 @@ function githubClient(token, opts = {}) {
3072
3083
  const res = await request(
3073
3084
  "POST",
3074
3085
  "graphql",
3075
- { body: { query: query2, variables: vars } }
3086
+ // A query reads; a mutation writes, and is never asked twice.
3087
+ { body: { query: query2, variables: vars }, retry: !/^\s*mutation\b/.test(query2) }
3076
3088
  );
3077
3089
  if (!res.ok) return { ok: false, status: res.status, error: res.error };
3078
3090
  const errors = res.data?.errors ?? [];
@@ -35,11 +35,22 @@ function githubClient(token, opts = {}) {
35
35
  body2 = JSON.stringify(o.body);
36
36
  h["content-type"] = "application/json";
37
37
  }
38
+ const reads = method === "GET" || o.retry === true;
38
39
  let res;
39
- try {
40
- res = await doFetch(url, { method, headers: h, body: body2 });
41
- } catch (err) {
42
- return { ok: false, error: `GitHub could not be reached: ${err.message}` };
40
+ for (let attempt = 0; ; attempt++) {
41
+ try {
42
+ res = await doFetch(url, { method, headers: h, body: body2 });
43
+ } catch (err) {
44
+ if (reads && attempt === 0) continue;
45
+ return { ok: false, error: `GitHub could not be reached: ${err.message}` };
46
+ }
47
+ if (reads && attempt === 0 && [502, 503, 504].includes(res.status)) {
48
+ await res.body?.cancel().catch(() => {
49
+ });
50
+ await new Promise((r) => setTimeout(r, 400));
51
+ continue;
52
+ }
53
+ break;
43
54
  }
44
55
  if (res.status === 304 && kept) {
45
56
  seen.delete(key);
@@ -69,7 +80,8 @@ function githubClient(token, opts = {}) {
69
80
  const res = await request(
70
81
  "POST",
71
82
  "graphql",
72
- { body: { query: query2, variables: vars } }
83
+ // A query reads; a mutation writes, and is never asked twice.
84
+ { body: { query: query2, variables: vars }, retry: !/^\s*mutation\b/.test(query2) }
73
85
  );
74
86
  if (!res.ok) return { ok: false, status: res.status, error: res.error };
75
87
  const errors = res.data?.errors ?? [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nanocollective/roster",
3
- "version": "0.1.0-beta.1",
3
+ "version": "0.1.0-beta.2",
4
4
  "description": "An agent-run org, powered by GitHub. Scaffold AI staff members whose brain is a repo.",
5
5
  "type": "module",
6
6
  "bin": {