@ahpd/server 0.1.0 → 0.2.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.
Files changed (170) hide show
  1. package/README.md +87 -81
  2. package/dist/config.d.ts +65 -0
  3. package/dist/config.js +75 -0
  4. package/dist/daemon.d.ts +26 -0
  5. package/dist/daemon.js +160 -0
  6. package/dist/main.d.ts +2 -0
  7. package/dist/main.js +297 -0
  8. package/dist/pty.d.ts +12 -0
  9. package/dist/pty.js +56 -0
  10. package/package.json +15 -25
  11. package/dist/automations.d.ts +0 -4
  12. package/dist/automations.d.ts.map +0 -1
  13. package/dist/automations.js +0 -191
  14. package/dist/automations.js.map +0 -1
  15. package/dist/catalog.d.ts +0 -48
  16. package/dist/catalog.d.ts.map +0 -1
  17. package/dist/catalog.js +0 -51
  18. package/dist/catalog.js.map +0 -1
  19. package/dist/changes.d.ts +0 -4
  20. package/dist/changes.d.ts.map +0 -1
  21. package/dist/changes.js +0 -601
  22. package/dist/changes.js.map +0 -1
  23. package/dist/cron.d.ts +0 -43
  24. package/dist/cron.d.ts.map +0 -1
  25. package/dist/cron.js +0 -211
  26. package/dist/cron.js.map +0 -1
  27. package/dist/git.d.ts +0 -16
  28. package/dist/git.d.ts.map +0 -1
  29. package/dist/git.js +0 -126
  30. package/dist/git.js.map +0 -1
  31. package/dist/host.d.ts +0 -24
  32. package/dist/host.d.ts.map +0 -1
  33. package/dist/host.js +0 -5850
  34. package/dist/host.js.map +0 -1
  35. package/dist/index.d.ts +0 -36
  36. package/dist/index.d.ts.map +0 -1
  37. package/dist/index.js +0 -34
  38. package/dist/index.js.map +0 -1
  39. package/dist/listen.d.ts +0 -3
  40. package/dist/listen.d.ts.map +0 -1
  41. package/dist/listen.js +0 -183
  42. package/dist/listen.js.map +0 -1
  43. package/dist/paging.d.ts +0 -38
  44. package/dist/paging.d.ts.map +0 -1
  45. package/dist/paging.js +0 -53
  46. package/dist/paging.js.map +0 -1
  47. package/dist/paths.d.ts +0 -15
  48. package/dist/paths.d.ts.map +0 -1
  49. package/dist/paths.js +0 -19
  50. package/dist/paths.js.map +0 -1
  51. package/dist/resources.d.ts +0 -122
  52. package/dist/resources.d.ts.map +0 -1
  53. package/dist/resources.js +0 -494
  54. package/dist/resources.js.map +0 -1
  55. package/dist/rpc.d.ts +0 -63
  56. package/dist/rpc.d.ts.map +0 -1
  57. package/dist/rpc.js +0 -208
  58. package/dist/rpc.js.map +0 -1
  59. package/dist/scheduled.d.ts +0 -48
  60. package/dist/scheduled.d.ts.map +0 -1
  61. package/dist/scheduled.js +0 -325
  62. package/dist/scheduled.js.map +0 -1
  63. package/dist/terminals.d.ts +0 -29
  64. package/dist/terminals.d.ts.map +0 -1
  65. package/dist/terminals.js +0 -346
  66. package/dist/terminals.js.map +0 -1
  67. package/dist/tools.d.ts +0 -18
  68. package/dist/tools.d.ts.map +0 -1
  69. package/dist/tools.js +0 -65
  70. package/dist/tools.js.map +0 -1
  71. package/dist/types/agent.d.ts +0 -245
  72. package/dist/types/agent.d.ts.map +0 -1
  73. package/dist/types/agent.js +0 -3
  74. package/dist/types/agent.js.map +0 -1
  75. package/dist/types/automations.d.ts +0 -164
  76. package/dist/types/automations.d.ts.map +0 -1
  77. package/dist/types/automations.js +0 -3
  78. package/dist/types/automations.js.map +0 -1
  79. package/dist/types/catalog.d.ts +0 -30
  80. package/dist/types/catalog.d.ts.map +0 -1
  81. package/dist/types/catalog.js +0 -3
  82. package/dist/types/catalog.js.map +0 -1
  83. package/dist/types/changes.d.ts +0 -272
  84. package/dist/types/changes.d.ts.map +0 -1
  85. package/dist/types/changes.js +0 -3
  86. package/dist/types/changes.js.map +0 -1
  87. package/dist/types/common.d.ts +0 -9
  88. package/dist/types/common.d.ts.map +0 -1
  89. package/dist/types/common.js +0 -3
  90. package/dist/types/common.js.map +0 -1
  91. package/dist/types/host.d.ts +0 -372
  92. package/dist/types/host.d.ts.map +0 -1
  93. package/dist/types/host.js +0 -3
  94. package/dist/types/host.js.map +0 -1
  95. package/dist/types/index.d.ts +0 -20
  96. package/dist/types/index.d.ts.map +0 -1
  97. package/dist/types/index.js +0 -8
  98. package/dist/types/index.js.map +0 -1
  99. package/dist/types/listen.d.ts +0 -48
  100. package/dist/types/listen.d.ts.map +0 -1
  101. package/dist/types/listen.js +0 -3
  102. package/dist/types/listen.js.map +0 -1
  103. package/dist/types/paging.d.ts +0 -10
  104. package/dist/types/paging.d.ts.map +0 -1
  105. package/dist/types/paging.js +0 -3
  106. package/dist/types/paging.js.map +0 -1
  107. package/dist/types/probe.d.ts +0 -46
  108. package/dist/types/probe.d.ts.map +0 -1
  109. package/dist/types/probe.js +0 -3
  110. package/dist/types/probe.js.map +0 -1
  111. package/dist/types/resources.d.ts +0 -83
  112. package/dist/types/resources.d.ts.map +0 -1
  113. package/dist/types/resources.js +0 -3
  114. package/dist/types/resources.js.map +0 -1
  115. package/dist/types/rpc.d.ts +0 -65
  116. package/dist/types/rpc.d.ts.map +0 -1
  117. package/dist/types/rpc.js +0 -3
  118. package/dist/types/rpc.js.map +0 -1
  119. package/dist/types/session.d.ts +0 -395
  120. package/dist/types/session.d.ts.map +0 -1
  121. package/dist/types/session.js +0 -3
  122. package/dist/types/session.js.map +0 -1
  123. package/dist/types/terminals.d.ts +0 -131
  124. package/dist/types/terminals.d.ts.map +0 -1
  125. package/dist/types/terminals.js +0 -3
  126. package/dist/types/terminals.js.map +0 -1
  127. package/dist/types/wire.d.ts +0 -62
  128. package/dist/types/wire.d.ts.map +0 -1
  129. package/dist/types/wire.js +0 -13
  130. package/dist/types/wire.js.map +0 -1
  131. package/dist/types/worktrees.d.ts +0 -86
  132. package/dist/types/worktrees.d.ts.map +0 -1
  133. package/dist/types/worktrees.js +0 -3
  134. package/dist/types/worktrees.js.map +0 -1
  135. package/dist/worktrees.d.ts +0 -27
  136. package/dist/worktrees.d.ts.map +0 -1
  137. package/dist/worktrees.js +0 -152
  138. package/dist/worktrees.js.map +0 -1
  139. package/src/automations.ts +0 -204
  140. package/src/catalog.ts +0 -53
  141. package/src/changes.ts +0 -629
  142. package/src/cron.ts +0 -251
  143. package/src/git.ts +0 -132
  144. package/src/host.ts +0 -5947
  145. package/src/index.ts +0 -40
  146. package/src/listen.ts +0 -240
  147. package/src/paging.ts +0 -56
  148. package/src/paths.ts +0 -19
  149. package/src/resources.ts +0 -513
  150. package/src/rpc.ts +0 -222
  151. package/src/scheduled.ts +0 -369
  152. package/src/terminals.ts +0 -353
  153. package/src/tools.ts +0 -64
  154. package/src/types/agent.ts +0 -255
  155. package/src/types/automations.ts +0 -164
  156. package/src/types/catalog.ts +0 -26
  157. package/src/types/changes.ts +0 -266
  158. package/src/types/common.ts +0 -9
  159. package/src/types/host.ts +0 -386
  160. package/src/types/index.ts +0 -27
  161. package/src/types/listen.ts +0 -53
  162. package/src/types/paging.ts +0 -11
  163. package/src/types/probe.ts +0 -42
  164. package/src/types/resources.ts +0 -107
  165. package/src/types/rpc.ts +0 -68
  166. package/src/types/session.ts +0 -415
  167. package/src/types/terminals.ts +0 -133
  168. package/src/types/wire.ts +0 -69
  169. package/src/types/worktrees.ts +0 -91
  170. package/src/worktrees.ts +0 -162
package/dist/cron.d.ts DELETED
@@ -1,43 +0,0 @@
1
- /** Five-field AHP cron: what an expression means, and when it next comes round. */
2
- /**
3
- * A parsed expression, as the sets each field allows.
4
- *
5
- * Sets rather than the source text, because the question asked of this a
6
- * thousand times a day is "does this minute match" and not "what did somebody
7
- * type" - and because parsing once is what makes a bad expression a refusal at
8
- * the moment it is written rather than a schedule that silently never fires.
9
- */
10
- export interface Cron {
11
- minutes: ReadonlySet<number>;
12
- hours: ReadonlySet<number>;
13
- doms: ReadonlySet<number>;
14
- months: ReadonlySet<number>;
15
- dows: ReadonlySet<number>;
16
- /**
17
- * Whether the day fields were narrowed, which decides how they combine.
18
- *
19
- * Unix cron's one genuine oddity: when both day-of-month and day-of-week are
20
- * restricted, an occurrence matches when *either* does - `0 0 1 * 1` is the
21
- * first of the month **and** every Monday. When one is `*` the other simply
22
- * applies. Getting this backwards turns a weekly job into a yearly one.
23
- */
24
- domRestricted: boolean;
25
- dowRestricted: boolean;
26
- }
27
- /**
28
- * Read an expression, or say what is wrong with it.
29
- *
30
- * Throws rather than returning undefined: an unparseable schedule is a thing
31
- * somebody typed and must be told about, and the one place it is read is the
32
- * moment they write it.
33
- */
34
- export declare function parseCron(expression: string): Cron;
35
- /**
36
- * The first occurrence strictly after that instant, or undefined.
37
- *
38
- * Walked a day at a time rather than a minute at a time: a minute-by-minute
39
- * search over the horizon is half a million time-zone conversions to answer a
40
- * question about February.
41
- */
42
- export declare function nextOccurrence(cron: Cron, after: Date, timeZone: string): Date | undefined;
43
- //# sourceMappingURL=cron.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cron.d.ts","sourceRoot":"","sources":["../src/cron.ts"],"names":[],"mappings":"AAAA,mFAAmF;AAEnF;;;;;;;GAOG;AACH,MAAM,WAAW,IAAI;IACnB,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1B,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC5B,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1B;;;;;;;OAOG;IACH,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;CACxB;AAwED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAkBlD;AA8FD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CA0B1F"}
package/dist/cron.js DELETED
@@ -1,211 +0,0 @@
1
- /** Five-field AHP cron: what an expression means, and when it next comes round. */
2
- const MONTHS = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
3
- const DAYS = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
4
- const FIELDS = [
5
- { name: 'minute', min: 0, max: 59 },
6
- { name: 'hour', min: 0, max: 23 },
7
- { name: 'day of month', min: 1, max: 31 },
8
- { name: 'month', min: 1, max: 12, names: MONTHS },
9
- // 7 as well as 0, both meaning Sunday, which is what every crontab accepts.
10
- { name: 'day of week', min: 0, max: 7, names: DAYS },
11
- ];
12
- /** A single value, by number or by name. */
13
- function valueOf(text, field) {
14
- const named = field.names?.indexOf(text.toLowerCase());
15
- if (named !== undefined && named >= 0)
16
- return named + (field.names === MONTHS ? 1 : 0);
17
- if (!/^\d+$/.test(text))
18
- throw new Error(`${text} is not a ${field.name}`);
19
- const value = Number(text);
20
- if (value < field.min || value > field.max) {
21
- throw new Error(`${value} is out of range for ${field.name} (${field.min}-${field.max})`);
22
- }
23
- return value;
24
- }
25
- /** One field: a comma-separated list of values, ranges and steps. */
26
- function parseField(text, field) {
27
- const out = new Set();
28
- for (const term of text.split(',')) {
29
- if (term === '')
30
- throw new Error(`Empty ${field.name}`);
31
- const [range, step] = term.split('/');
32
- if (term.split('/').length > 2)
33
- throw new Error(`${term} has more than one step`);
34
- let by = 1;
35
- if (step !== undefined) {
36
- if (!/^\d+$/.test(step) || Number(step) === 0) {
37
- throw new Error(`${step} is not a step for ${field.name}; a step must be a positive integer`);
38
- }
39
- by = Number(step);
40
- }
41
- let from;
42
- let to;
43
- if (range === '*') {
44
- from = field.min;
45
- to = field.max;
46
- }
47
- else if (range.includes('-')) {
48
- const [a, b] = range.split('-');
49
- if (range.split('-').length > 2)
50
- throw new Error(`${range} is not a range`);
51
- from = valueOf(a, field);
52
- to = valueOf(b, field);
53
- if (to < from)
54
- throw new Error(`${range} runs backwards`);
55
- }
56
- else {
57
- from = valueOf(range, field);
58
- // A step on a single value means from there to the end of the field,
59
- // which is what crontab does with `5/10`.
60
- to = step === undefined ? from : field.max;
61
- }
62
- for (let at = from; at <= to; at += by)
63
- out.add(at);
64
- }
65
- return out;
66
- }
67
- /**
68
- * Read an expression, or say what is wrong with it.
69
- *
70
- * Throws rather than returning undefined: an unparseable schedule is a thing
71
- * somebody typed and must be told about, and the one place it is read is the
72
- * moment they write it.
73
- */
74
- export function parseCron(expression) {
75
- const fields = expression.trim().split(/\s+/);
76
- if (fields.length !== 5) {
77
- throw new Error(`A schedule has five fields; ${expression.trim() === '' ? 'this one has none' : `this one has ${fields.length}`}`);
78
- }
79
- const [minute, hour, dom, month, dow] = fields;
80
- const dows = parseField(dow, FIELDS[4]);
81
- // Both spellings of Sunday collapse to one, so a weekday test is a lookup.
82
- if (dows.has(7)) {
83
- dows.delete(7);
84
- dows.add(0);
85
- }
86
- return {
87
- minutes: parseField(minute, FIELDS[0]),
88
- hours: parseField(hour, FIELDS[1]),
89
- doms: parseField(dom, FIELDS[2]),
90
- months: parseField(month, FIELDS[3]),
91
- dows,
92
- domRestricted: dom !== '*',
93
- dowRestricted: dow !== '*',
94
- };
95
- }
96
- const readers = new Map();
97
- /** Cached, because this is called once per candidate day and building one is not free. */
98
- function readerFor(timeZone) {
99
- let held = readers.get(timeZone);
100
- if (!held) {
101
- held = new Intl.DateTimeFormat('en-US', {
102
- timeZone,
103
- hourCycle: 'h23',
104
- year: 'numeric',
105
- month: '2-digit',
106
- day: '2-digit',
107
- hour: '2-digit',
108
- minute: '2-digit',
109
- });
110
- readers.set(timeZone, held);
111
- }
112
- return held;
113
- }
114
- /** What the clock in that zone said at that instant. */
115
- function wallAt(instant, timeZone) {
116
- const parts = readerFor(timeZone).formatToParts(new Date(instant));
117
- const found = {};
118
- for (const part of parts) {
119
- if (part.type !== 'literal')
120
- found[part.type] = Number(part.value);
121
- }
122
- return {
123
- year: found.year,
124
- month: found.month,
125
- day: found.day,
126
- hour: found.hour,
127
- minute: found.minute,
128
- };
129
- }
130
- /** That zone's offset from UTC, in minutes, at that instant. */
131
- function offsetAt(instant, timeZone) {
132
- const wall = wallAt(instant, timeZone);
133
- const asUtc = Date.UTC(wall.year, wall.month - 1, wall.day, wall.hour, wall.minute);
134
- // To the minute: the reading has no seconds, so the instant must not either.
135
- return (asUtc - Math.floor(instant / 60000) * 60000) / 60000;
136
- }
137
- /**
138
- * The instant at which that zone's clock reads that.
139
- *
140
- * Two passes, because the offset depends on the answer: the first guess uses
141
- * the offset in force at roughly the right time and the second uses the one in
142
- * force at the instant the first produced, which is what gets the hour after a
143
- * DST change right. Returns undefined for a wall time that does not exist -
144
- * the hour a spring-forward skips - because a schedule pointing into the gap
145
- * has no occurrence that day rather than an occurrence at some other time.
146
- */
147
- function instantOf(wall, timeZone) {
148
- const guess = Date.UTC(wall.year, wall.month - 1, wall.day, wall.hour, wall.minute);
149
- let instant = guess - offsetAt(guess, timeZone) * 60000;
150
- const again = guess - offsetAt(instant, timeZone) * 60000;
151
- if (again !== instant)
152
- instant = again;
153
- const back = wallAt(instant, timeZone);
154
- if (back.hour !== wall.hour || back.minute !== wall.minute || back.day !== wall.day)
155
- return undefined;
156
- return instant;
157
- }
158
- // ------------------------------------------------------------- the next time
159
- /** How far ahead to look before calling an expression unreachable. `0 0 30 2 *` is. */
160
- const HORIZON_DAYS = 1500;
161
- /** Whether that calendar day is one this expression fires on. */
162
- function dayMatches(cron, year, month, day) {
163
- if (!cron.months.has(month))
164
- return false;
165
- const dow = new Date(Date.UTC(year, month - 1, day)).getUTCDay();
166
- const byDom = cron.doms.has(day);
167
- const byDow = cron.dows.has(dow);
168
- if (cron.domRestricted && cron.dowRestricted)
169
- return byDom || byDow;
170
- if (cron.domRestricted)
171
- return byDom;
172
- if (cron.dowRestricted)
173
- return byDow;
174
- return true;
175
- }
176
- /**
177
- * The first occurrence strictly after that instant, or undefined.
178
- *
179
- * Walked a day at a time rather than a minute at a time: a minute-by-minute
180
- * search over the horizon is half a million time-zone conversions to answer a
181
- * question about February.
182
- */
183
- export function nextOccurrence(cron, after, timeZone) {
184
- const from = after.getTime();
185
- const start = wallAt(from, timeZone);
186
- const minutes = [...cron.minutes].sort((a, b) => a - b);
187
- const hours = [...cron.hours].sort((a, b) => a - b);
188
- for (let ahead = 0; ahead <= HORIZON_DAYS; ahead++) {
189
- // Calendar arithmetic in UTC on the *wall* date, which is date arithmetic
190
- // and not instant arithmetic - adding 24 hours to an instant lands on the
191
- // same date twice a year.
192
- const at = new Date(Date.UTC(start.year, start.month - 1, start.day + ahead));
193
- const year = at.getUTCFullYear();
194
- const month = at.getUTCMonth() + 1;
195
- const day = at.getUTCDate();
196
- if (!dayMatches(cron, year, month, day))
197
- continue;
198
- for (const hour of hours) {
199
- for (const minute of minutes) {
200
- const instant = instantOf({ year, month, day, hour, minute }, timeZone);
201
- // Undefined is the spring-forward gap; earlier than `after` is the
202
- // hour a fall-back repeats, where the first pass is already behind us.
203
- if (instant === undefined || instant <= from)
204
- continue;
205
- return new Date(instant);
206
- }
207
- }
208
- }
209
- return undefined;
210
- }
211
- //# sourceMappingURL=cron.js.map
package/dist/cron.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"cron.js","sourceRoot":"","sources":["../src/cron.ts"],"names":[],"mappings":"AAAA,mFAAmF;AA4BnF,MAAM,MAAM,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AACpG,MAAM,IAAI,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAU/D,MAAM,MAAM,GAAY;IACtB,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;IACnC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,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,GAAG,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,QAAQ,CAAC,CAAC;gBACxE,mEAAmE;gBACnE,uEAAuE;gBACvE,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,IAAI,IAAI;oBAAE,SAAS;gBACvD,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
package/dist/git.d.ts DELETED
@@ -1,16 +0,0 @@
1
- /** What git can say about a directory the host serves. */
2
- import type { DirectoryFacts } from './types/host.js';
3
- /**
4
- * The branch each served directory is on, as a host's `DirectoryFacts`.
5
- *
6
- * Deliberately not part of `createHost`: it spawns `git`, which is a binary
7
- * rather than a runtime API and may not be installed at all. The daemon wires
8
- * it in, a library caller opts in, and a host without it still names its
9
- * projects - so nothing here is load-bearing for the protocol.
10
- *
11
- * ```ts
12
- * createHost({ path, agents: [claude({ paths })], directories: gitBranches() });
13
- * ```
14
- */
15
- export declare function gitBranches(): DirectoryFacts;
16
- //# sourceMappingURL=git.d.ts.map
package/dist/git.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAG1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,IAAI,cAAc,CAkH5C"}
package/dist/git.js DELETED
@@ -1,126 +0,0 @@
1
- /** What git can say about a directory the host serves. */
2
- import { execFile } from 'node:child_process';
3
- /**
4
- * The branch each served directory is on, as a host's `DirectoryFacts`.
5
- *
6
- * Deliberately not part of `createHost`: it spawns `git`, which is a binary
7
- * rather than a runtime API and may not be installed at all. The daemon wires
8
- * it in, a library caller opts in, and a host without it still names its
9
- * projects - so nothing here is load-bearing for the protocol.
10
- *
11
- * ```ts
12
- * createHost({ path, agents: [claude({ paths })], directories: gitBranches() });
13
- * ```
14
- */
15
- export function gitBranches() {
16
- /*
17
- * The branch, per *directory* rather than per session.
18
- *
19
- * A host serving one repository with ninety-eight sessions in it would
20
- * otherwise ask git ninety-eight times for one answer.
21
- */
22
- const facts = new Map();
23
- /** Run git in a directory and answer what it said, or nothing at all. */
24
- const git = (dir, args) => new Promise((answer) => {
25
- execFile('git', ['-C', dir, ...args], { timeout: 2000 }, (error, out) => {
26
- answer(error ? undefined : out.toString().trim());
27
- });
28
- });
29
- /**
30
- * The owner and repository of a GitHub remote, if the remote is one.
31
- *
32
- * Both URL forms git writes: `git@github.com:owner/repo.git` and
33
- * `https://github.com/owner/repo`. Anything else is a remote this says
34
- * nothing about rather than one it guesses at.
35
- */
36
- const github = (url) => {
37
- const found = /github\.com[:/]([^/]+)\/(.+?)(?:\.git)?$/.exec(url ?? '');
38
- return found ? { owner: found[1], repo: found[2] } : undefined;
39
- };
40
- /**
41
- * Ask git, and answer whether what it said differs from what was held.
42
- *
43
- * A directory that is not a repository, or one whose HEAD is detached, has
44
- * no branch and is remembered as having none: `rev-parse --abbrev-ref` says
45
- * `HEAD` for a detached head, and reporting that would draw a branch called
46
- * HEAD.
47
- */
48
- const refresh = async (dir) => {
49
- const said = await git(dir, ['rev-parse', '--abbrev-ref', 'HEAD']);
50
- const branchName = said === undefined || said === '' || said === 'HEAD' ? undefined : said;
51
- if (branchName === undefined) {
52
- const had = facts.has(dir);
53
- facts.delete(dir);
54
- return had;
55
- }
56
- /*
57
- * The rest in two more calls, both cheap and both answering a question a
58
- * client draws something from.
59
- *
60
- * `status -sb --porcelain` names the upstream and the ahead/behind counts
61
- * on its first line and one file per line after it, so the count of
62
- * uncommitted changes comes out of the same call. `remote get-url` is the
63
- * only way to know whether this is a GitHub repository, which is what
64
- * turns a client's pull-request affordances on.
65
- */
66
- const [status, origin] = await Promise.all([
67
- git(dir, ['status', '-sb', '--porcelain']),
68
- git(dir, ['remote', 'get-url', 'origin']),
69
- ]);
70
- const lines = (status ?? '').split('\n');
71
- const head = lines[0] ?? '';
72
- const upstream = /^## [^.]*\.\.\.(\S+)/.exec(head)?.[1];
73
- const ahead = Number(/\[.*?ahead (\d+)/.exec(head)?.[1] ?? 0);
74
- const behind = Number(/\[.*?behind (\d+)/.exec(head)?.[1] ?? 0);
75
- const owner = github(origin);
76
- const now = {
77
- branchName,
78
- /*
79
- * The drift, and only where there is something to drift from.
80
- *
81
- * A branch with no upstream is not zero ahead and zero behind, it is
82
- * neither - and a client draws these as arrows beside the branch, so a
83
- * pair of zeroes is two arrows saying nothing. The reference host omits
84
- * them the same way.
85
- */
86
- ...(upstream === undefined ? {} : {
87
- upstreamBranchName: upstream,
88
- incomingChanges: behind,
89
- outgoingChanges: ahead,
90
- }),
91
- uncommittedChanges: lines.slice(1).filter((one) => one.trim() !== '').length,
92
- hasGitHubRemote: owner !== undefined,
93
- ...(owner ? { githubOwner: owner.owner, githubRepo: owner.repo } : {}),
94
- };
95
- const before = facts.get(dir);
96
- if (before !== undefined && JSON.stringify(before) === JSON.stringify(now))
97
- return false;
98
- facts.set(dir, now);
99
- return true;
100
- };
101
- return {
102
- /*
103
- * `git` is the well-known key, and the field names are the reference host's.
104
- *
105
- * Not the protocol's: it declares no `_meta` keys at all. The names come
106
- * from a capture of the other implementation - `branchName`,
107
- * `upstreamBranchName`, `incomingChanges`, `outgoingChanges`,
108
- * `uncommittedChanges`, `hasGitHubRemote`, `githubOwner`, `githubRepo` -
109
- * because a client reads one spelling, and this host used to write `branch`
110
- * where that client looks for `branchName` and so said nothing at all.
111
- *
112
- * Written whole, and correct only because this is the only producer of
113
- * `_meta` here.
114
- *
115
- * Correct only because this is the only producer of `_meta` here:
116
- * `session/metaChanged` replaces the map entirely, so a host with two of
117
- * them would have to merge before dispatching rather than after.
118
- */
119
- meta: (dir) => {
120
- const held = facts.get(dir);
121
- return held === undefined ? undefined : { git: { ...held } };
122
- },
123
- refresh,
124
- };
125
- }
126
- //# sourceMappingURL=git.js.map
package/dist/git.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"git.js","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAE1D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,WAAW;IACzB;;;;;OAKG;IACH,MAAM,KAAK,GAAG,IAAI,GAAG,EAAmC,CAAC;IAEzD,yEAAyE;IACzE,MAAM,GAAG,GAAG,CAAC,GAAW,EAAE,IAAc,EAA+B,EAAE,CACvE,IAAI,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QACrB,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YACtE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEL;;;;;;OAMG;IACH,MAAM,MAAM,GAAG,CAAC,GAAuB,EAA+C,EAAE;QACtF,MAAM,KAAK,GAAG,0CAA0C,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;QACzE,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAW,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAW,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IACrF,CAAC,CAAC;IAEF;;;;;;;OAOG;IACH,MAAM,OAAO,GAAG,KAAK,EAAE,GAAW,EAAoB,EAAE;QACtD,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,GAAG,EAAE,CAAC,WAAW,EAA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/**
2
- * The protocol server: channels, subscriptions, requests and state actions.
3
- *
4
- * One host serves many connections. It owns the session catalogue, the live
5
- * sessions and the sequence number that orders everything it emits.
6
- *
7
- * Rules that govern anything answering AHP:
8
- *
9
- * - `serverSeq` advances when state changes, not per message. A snapshot is
10
- * taken at a sequence number and every action after it carries a greater
11
- * one, which is how a client knows it missed nothing.
12
- * - Notifications carry no id and get no reply. `unsubscribe` and
13
- * `dispatchAction` are notifications.
14
- * - Subscriptions are per connection. Dropping one client's subscription must
15
- * not affect another's.
16
- * - Only client-dispatchable actions are accepted from clients; the rest are
17
- * the host reporting what it did.
18
- */
19
- import type { Host, HostOptions } from './types/host.js';
20
- import type { Summary } from './types/catalog.js';
21
- declare const ROOT = "ahp-root://";
22
- export declare function createHost(options: HostOptions): Host;
23
- export { ROOT, type Summary };
24
- //# sourceMappingURL=host.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAeH,OAAO,KAAK,EAAuB,IAAI,EAAE,WAAW,EAAY,MAAM,iBAAiB,CAAC;AACxF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAwBlD,QAAA,MAAM,IAAI,gBAAgB,CAAC;AAgI3B,wBAAgB,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAgoLrD;AACD,OAAO,EAAE,IAAI,EAAE,KAAK,OAAO,EAAE,CAAC"}