@chipschat/conformance 0.0.0-stage → 1.0.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 (59) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +34 -2
  3. package/dist/checks.d.ts +29 -0
  4. package/dist/checks.d.ts.map +1 -0
  5. package/dist/checks.js +133 -0
  6. package/dist/checks.js.map +1 -0
  7. package/dist/exchange.d.ts +30 -0
  8. package/dist/exchange.d.ts.map +1 -0
  9. package/dist/exchange.js +102 -0
  10. package/dist/exchange.js.map +1 -0
  11. package/dist/fake-chips.d.ts +130 -0
  12. package/dist/fake-chips.d.ts.map +1 -0
  13. package/dist/fake-chips.js +1642 -0
  14. package/dist/fake-chips.js.map +1 -0
  15. package/dist/fake-join.d.ts +56 -0
  16. package/dist/fake-join.d.ts.map +1 -0
  17. package/dist/fake-join.js +181 -0
  18. package/dist/fake-join.js.map +1 -0
  19. package/dist/index.d.ts +20 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +14 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/project.d.ts +39 -0
  24. package/dist/project.d.ts.map +1 -0
  25. package/dist/project.js +254 -0
  26. package/dist/project.js.map +1 -0
  27. package/dist/report.d.ts +65 -0
  28. package/dist/report.d.ts.map +1 -0
  29. package/dist/report.js +142 -0
  30. package/dist/report.js.map +1 -0
  31. package/dist/room-files.d.ts +54 -0
  32. package/dist/room-files.d.ts.map +1 -0
  33. package/dist/room-files.js +144 -0
  34. package/dist/room-files.js.map +1 -0
  35. package/dist/scenario.d.ts +41 -0
  36. package/dist/scenario.d.ts.map +1 -0
  37. package/dist/scenario.js +414 -0
  38. package/dist/scenario.js.map +1 -0
  39. package/dist/settings.d.ts +60 -0
  40. package/dist/settings.d.ts.map +1 -0
  41. package/dist/settings.js +142 -0
  42. package/dist/settings.js.map +1 -0
  43. package/dist/spend.d.ts +20 -0
  44. package/dist/spend.d.ts.map +1 -0
  45. package/dist/spend.js +50 -0
  46. package/dist/spend.js.map +1 -0
  47. package/dist/subject.d.ts +55 -0
  48. package/dist/subject.d.ts.map +1 -0
  49. package/dist/subject.js +22 -0
  50. package/dist/subject.js.map +1 -0
  51. package/dist/waiting.d.ts +12 -0
  52. package/dist/waiting.d.ts.map +1 -0
  53. package/dist/waiting.js +30 -0
  54. package/dist/waiting.js.map +1 -0
  55. package/dist/workspace.d.ts +893 -0
  56. package/dist/workspace.d.ts.map +1 -0
  57. package/dist/workspace.js +3160 -0
  58. package/dist/workspace.js.map +1 -0
  59. package/package.json +38 -3
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 The Chips Authors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,35 @@
1
- # Temporary Holding Version
1
+ # @chipschat/conformance
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The adapter conformance kit for Chips. It starts a fake Chips that speaks the wire (the routes,
4
+ the socket, the handshake, the replay), plays the person through the golden scenario against your
5
+ harness, checks every event it sends with the protocol's own schemas, and reports the same
6
+ checklist a harness's page under Agents shows.
7
+
8
+ ```sh
9
+ npm install --save-dev @chipschat/conformance
10
+ ```
11
+
12
+ A harness whose adapter lives in its own repository runs the scenario from its own tests:
13
+
14
+ ```ts
15
+ import { formatReport, runConformance } from "@chipschat/conformance";
16
+ import { connect } from "@chipschat/harness";
17
+
18
+ const report = await runConformance({
19
+ subject: {
20
+ name: "my-harness",
21
+ start: async (address) => {
22
+ const chips = await connect({ url: address.url, token: address.token });
23
+ // Start your harness on `chips` here.
24
+ },
25
+ stop: async () => {
26
+ // Stop it again.
27
+ },
28
+ },
29
+ });
30
+ if (!report.passed) throw new Error(formatReport(report).join("\n"));
31
+ ```
32
+
33
+ `chips conformance custom` runs the same scenario from the command line, for a harness you start
34
+ yourself. The docs page, [Conformance](https://chipschat.ai/connect/conformance/), says what the
35
+ scenario plays and what each row of the checklist asks.
@@ -0,0 +1,29 @@
1
+ /**
2
+ * A check for each capability a harness declares beyond the golden scenario (open-source
3
+ * harnesses plan, Phase 7), played from the person's chair as the others are: what the capability
4
+ * promises a person, asked for, and what the harness must do within a beat. A harness that does
5
+ * not declare a capability is not asked. Three capabilities can't be seen from outside the
6
+ * harness: whether it reads the dial (`autonomy`), carries an archive to its own side
7
+ * (`follows_rooms`), or reads `for` rather than answering as itself (`agents`). These are reported as
8
+ * declared and not checked.
9
+ */
10
+ import type { FakeChips } from "./fake-chips.js";
11
+ import type { Finding } from "./report.js";
12
+ type Log = (line: string) => void;
13
+ /** A person asks for a new agent in a room of theirs (ADR 0108): one registered for it joins. */
14
+ export declare function askForANewAgent(chips: FakeChips, beatMs: number, findings: Finding[], log: Log): Promise<void>;
15
+ export declare const SETTINGS_CAPABILITIES: readonly string[];
16
+ /**
17
+ * A setting a person changes from an agent's page (ADRs 0134, 0140, 0143, 0146), or a harness's own
18
+ * job from the harness's (ADR 0252). The harness must
19
+ * have sent its copy, and must answer a change asked of it, made or refused, within a beat. The
20
+ * change asked is to what the copy already says, so answering it changes nothing.
21
+ */
22
+ export declare function askForAChange(capability: string, chips: FakeChips, beatMs: number, findings: Finding[], log: Log): Promise<void>;
23
+ /**
24
+ * A person asks the harness to restart (ADR 0094). It must come back within three beats: a new
25
+ * connection, or saying it is fine. Saying it is in trouble instead is a restart that failed.
26
+ */
27
+ export declare function askForARestart(chips: FakeChips, beatMs: number, findings: Finding[], log: Log): Promise<void>;
28
+ export {};
29
+ //# sourceMappingURL=checks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../src/checks.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAI3C,KAAK,GAAG,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;AAIlC,iGAAiG;AACjG,wBAAsB,eAAe,CACnC,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,OAAO,EAAE,EACnB,GAAG,EAAE,GAAG,GACP,OAAO,CAAC,IAAI,CAAC,CAiBf;AAwBD,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAA0B,CAAC;AAE9E;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,OAAO,EAAE,EACnB,GAAG,EAAE,GAAG,GACP,OAAO,CAAC,IAAI,CAAC,CAmDf;AAKD;;;GAGG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,OAAO,EAAE,EACnB,GAAG,EAAE,GAAG,GACP,OAAO,CAAC,IAAI,CAAC,CA+Bf"}
package/dist/checks.js ADDED
@@ -0,0 +1,133 @@
1
+ /**
2
+ * A check for each capability a harness declares beyond the golden scenario (open-source
3
+ * harnesses plan, Phase 7), played from the person's chair as the others are: what the capability
4
+ * promises a person, asked for, and what the harness must do within a beat. A harness that does
5
+ * not declare a capability is not asked. Three capabilities can't be seen from outside the
6
+ * harness: whether it reads the dial (`autonomy`), carries an archive to its own side
7
+ * (`follows_rooms`), or reads `for` rather than answering as itself (`agents`). These are reported as
8
+ * declared and not checked.
9
+ */
10
+ import { HARNESS_CAPABILITIES } from "@chipschat/protocol";
11
+ import { ACCEPTS } from "./settings.js";
12
+ import { until, within } from "./waiting.js";
13
+ const seconds = (ms) => Math.round(ms / 1000);
14
+ /** A person asks for a new agent in a room of theirs (ADR 0108): one registered for it joins. */
15
+ export async function askForANewAgent(chips, beatMs, findings, log) {
16
+ const spaceId = await chips.openRoom("Fresh eyes");
17
+ const { askId, name } = await chips.askForAgent(spaceId, "Nova");
18
+ log(`You asked for a new agent, ${name}, in another space.`);
19
+ const joined = await within(chips, (event) => event.type === "membership.added" && event.payload["made_for"] === askId, beatMs);
20
+ if (joined === undefined) {
21
+ findings.push({
22
+ severity: "error",
23
+ message: `the harness declares new_agents but no new agent joined the space it was asked for within ${seconds(beatMs)} s`,
24
+ });
25
+ return;
26
+ }
27
+ log("The new agent joined the space.");
28
+ }
29
+ /** What each settings capability is, in the report's words, and the copies that carry it. */
30
+ const SETTINGS = {
31
+ [HARNESS_CAPABILITIES.contextFiles]: {
32
+ words: "context files",
33
+ kinds: ["context", "harness-context"],
34
+ },
35
+ [HARNESS_CAPABILITIES.models]: { words: "model", kinds: ["model"] },
36
+ [HARNESS_CAPABILITIES.heartbeats]: { words: "heartbeat", kinds: ["heartbeat"] },
37
+ [HARNESS_CAPABILITIES.contextWindows]: { words: "context window", kinds: ["context-window"] },
38
+ [HARNESS_CAPABILITIES.jobs]: { words: "jobs", kinds: ["jobs"], whose: "its own" },
39
+ };
40
+ export const SETTINGS_CAPABILITIES = Object.keys(SETTINGS);
41
+ /**
42
+ * A setting a person changes from an agent's page (ADRs 0134, 0140, 0143, 0146), or a harness's own
43
+ * job from the harness's (ADR 0252). The harness must
44
+ * have sent its copy, and must answer a change asked of it, made or refused, within a beat. The
45
+ * change asked is to what the copy already says, so answering it changes nothing.
46
+ */
47
+ export async function askForAChange(capability, chips, beatMs, findings, log) {
48
+ const setting = SETTINGS[capability];
49
+ if (setting === undefined)
50
+ return;
51
+ const error = (message) => findings.push({ severity: "error", message });
52
+ const whose = setting.whose ?? "an agent's";
53
+ const copies = await until(() => {
54
+ const found = setting.kinds.flatMap((kind) => chips.settings.copiesOf(kind).map(([id]) => [kind, id]));
55
+ return found.length > 0 ? found : undefined;
56
+ }, beatMs);
57
+ if (copies === undefined) {
58
+ error(`the harness declares ${capability} but sent no copy of ${whose} ${setting.words} within ${seconds(beatMs)} s`);
59
+ return;
60
+ }
61
+ const asked = copies
62
+ .map(([kind, id]) => ({ kind, id, ask: chips.askToChange(kind, id) }))
63
+ .find((each) => each.ask !== undefined);
64
+ if (asked?.ask === undefined) {
65
+ findings.push({
66
+ severity: "note",
67
+ message: `every copy of the ${setting.words} it sent is read-only, so no change was asked of it`,
68
+ });
69
+ return;
70
+ }
71
+ const word = ACCEPTS[asked.kind];
72
+ if (asked.ask.heard === 0) {
73
+ error(`the harness declares ${capability} but no socket of it said \`${word}\` in its hello, so a person's change can't reach it`);
74
+ return;
75
+ }
76
+ const changeId = String(asked.ask.frame["change_id"] ?? asked.ask.frame["edit_id"]);
77
+ log(`You changed ${whose} ${setting.words} from its page.`);
78
+ const answer = await until(() => chips.settings.answerTo(changeId), beatMs);
79
+ if (answer === undefined) {
80
+ error(`the harness did not answer a person's change of ${whose} ${setting.words} within ${seconds(beatMs)} s`);
81
+ return;
82
+ }
83
+ if (answer.made)
84
+ log(`It saved the ${setting.words}.`);
85
+ else {
86
+ log(`It refused the change of ${setting.words}.`);
87
+ findings.push({
88
+ severity: "note",
89
+ message: `the harness refused a change of ${setting.words} to what it already was${answer.message === undefined ? "" : `: ${answer.message}`}`,
90
+ });
91
+ }
92
+ }
93
+ /** How many beats a restart is given: a harness starting what is behind it again takes a while. */
94
+ const RESTART_BEATS = 3;
95
+ /**
96
+ * A person asks the harness to restart (ADR 0094). It must come back within three beats: a new
97
+ * connection, or saying it is fine. Saying it is in trouble instead is a restart that failed.
98
+ */
99
+ export async function askForARestart(chips, beatMs, findings, log) {
100
+ const hellos = chips.hellos();
101
+ const said = chips.statuses().length;
102
+ const heard = chips.askToRestart();
103
+ if (heard === 0) {
104
+ findings.push({
105
+ severity: "error",
106
+ message: "the harness declares restarts but no socket of it said `restart` in its hello, so a person's Restart can't reach it",
107
+ });
108
+ return;
109
+ }
110
+ log("You asked the harness to restart.");
111
+ const waitMs = beatMs * RESTART_BEATS;
112
+ const back = await until(() => {
113
+ const status = chips.statuses().slice(said).at(-1);
114
+ if (status !== undefined)
115
+ return status.state === "ok" ? "ok" : `trouble: ${status.reason}`;
116
+ return chips.hellos() > hellos && chips.connections() > 0 ? "reconnected" : undefined;
117
+ }, waitMs);
118
+ if (back === undefined) {
119
+ findings.push({
120
+ severity: "error",
121
+ message: `the harness did not come back within ${seconds(waitMs)} s of a person's Restart: no new connection, and nothing said of how it is`,
122
+ });
123
+ }
124
+ else if (back.startsWith("trouble")) {
125
+ findings.push({
126
+ severity: "error",
127
+ message: `the harness says its restart did not work: ${back.slice("trouble: ".length)}`,
128
+ });
129
+ }
130
+ else
131
+ log(back === "ok" ? "It restarted and said it is fine." : "It restarted and connected again.");
132
+ }
133
+ //# sourceMappingURL=checks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checks.js","sourceRoot":"","sources":["../src/checks.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAG3D,OAAO,EAAE,OAAO,EAAoB,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAI7C,MAAM,OAAO,GAAG,CAAC,EAAU,EAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;AAE9D,iGAAiG;AACjG,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,KAAgB,EAChB,MAAc,EACd,QAAmB,EACnB,GAAQ;IAER,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IACnD,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACjE,GAAG,CAAC,8BAA8B,IAAI,qBAAqB,CAAC,CAAC;IAC7D,MAAM,MAAM,GAAG,MAAM,MAAM,CACzB,KAAK,EACL,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,kBAAkB,IAAI,KAAK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AAE,OAAO;YACjB,OAAO,EAAE,wCAAwC,OAAO,CAAC,MAAM,CAAC,4EAA4E;SAC7I,CAAC,CAAC;IACL,CAAC;SAAM,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QACtC,QAAQ,CAAC,IAAI,CAAC;YACZ,QAAQ,EAAE,OAAO;YACjB,OAAO,EAAE,8CAA8C,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE;SACxF,CAAC,CAAC;IACL,CAAC;;QACC,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,mCAAmC,CAAC,CAAC,CAAC,mCAAmC,CAAC,CAAC;AACnG,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The referee's reads (ADR 0097), as the fake plays them: the real server's `exchangeOf` and
3
+ * `heldIn`, over the fake's log rather than its projections. Where the count starts — the newest
4
+ * thing a person did in the room, or the newest thing an agent made — what agents sent agents
5
+ * since, and a pause. As of a seq, so a replay is handed the same facts.
6
+ */
7
+ import { type ExchangeStretch } from "@chipschat/protocol";
8
+ /** An event as the fake's log holds it, as far as these reads need it (the workspace's own). */
9
+ interface StoredEvent {
10
+ readonly seq: number;
11
+ readonly id: string;
12
+ readonly type: string;
13
+ readonly ts: string;
14
+ readonly space_id: string | null;
15
+ readonly actor: {
16
+ readonly kind: string;
17
+ readonly id: string;
18
+ };
19
+ readonly payload: Readonly<Record<string, unknown>>;
20
+ }
21
+ /** The stretch, and the newest act of a person that started the count, if any. */
22
+ export interface FakeExchange extends ExchangeStretch {
23
+ readonly personSeq: number | undefined;
24
+ }
25
+ /** How the agents' talk in a room stands as of `uptoSeq`, from the log. */
26
+ export declare function exchangeInLog(log: readonly StoredEvent[], spaceId: string, uptoSeq?: number): FakeExchange;
27
+ /** The messages held in a room after `afterSeq` and before `beforeSeq`, newest first. */
28
+ export declare function heldInLog<E extends StoredEvent>(log: readonly E[], spaceId: string, afterSeq: number, beforeSeq: number): E[];
29
+ export {};
30
+ //# sourceMappingURL=exchange.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exchange.d.ts","sourceRoot":"","sources":["../src/exchange.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAIL,KAAK,eAAe,EAKrB,MAAM,qBAAqB,CAAC;AAE7B,gGAAgG;AAChG,UAAU,WAAW;IACnB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACrD;AAKD,kFAAkF;AAClF,MAAM,WAAW,YAAa,SAAQ,eAAe;IACnD,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;CACxC;AA4DD,2EAA2E;AAC3E,wBAAgB,aAAa,CAC3B,GAAG,EAAE,SAAS,WAAW,EAAE,EAC3B,OAAO,EAAE,MAAM,EACf,OAAO,SAA0B,GAChC,YAAY,CAqCd;AAED,yFAAyF;AACzF,wBAAgB,SAAS,CAAC,CAAC,SAAS,WAAW,EAC7C,GAAG,EAAE,SAAS,CAAC,EAAE,EACjB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAChB,CAAC,EAAE,CAWL"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * The referee's reads (ADR 0097), as the fake plays them: the real server's `exchangeOf` and
3
+ * `heldIn`, over the fake's log rather than its projections. Where the count starts — the newest
4
+ * thing a person did in the room, or the newest thing an agent made — what agents sent agents
5
+ * since, and a pause. As of a seq, so a replay is handed the same facts.
6
+ */
7
+ import { DEFAULT_EXCHANGE_LIMITS, exchangeLimitsOf, messageIdOf, resetsTheCount, WORK_ACTS, } from "@chipschat/protocol";
8
+ /** How many of the newest messages the circle and the repeats are read from, as the server. */
9
+ const RECENT = 60;
10
+ const isAgent = (event) => event.actor.kind === "harness" || event.actor.kind === "agent";
11
+ function filesOf(event) {
12
+ const files = event.payload["attachments"];
13
+ return (Array.isArray(files) ? files : []).flatMap((each) => typeof each["sha256"] === "string" && typeof each["filename"] === "string"
14
+ ? [{ filename: each["filename"], sha256: each["sha256"] }]
15
+ : []);
16
+ }
17
+ /** What agents sent agents: a post of theirs for an agent, or held. */
18
+ function isTalk(event) {
19
+ if (event.type !== "message.post" || !isAgent(event))
20
+ return false;
21
+ const addressed = event.payload["addressed_to"];
22
+ return (Array.isArray(addressed) && addressed.length > 0) || event.payload["held"] === true;
23
+ }
24
+ /** Whether this file's digest was in the room before `seq`. */
25
+ function seenBefore(room, seq, sha256) {
26
+ return room.some((event) => event.seq < seq &&
27
+ event.type === "message.post" &&
28
+ filesOf(event).some((file) => file.sha256 === sha256));
29
+ }
30
+ /** What an agent made with this event, if anything: a file new to the room, a question, an ask. */
31
+ function workOf(room, event) {
32
+ const at = { seq: event.seq, at: event.ts, by: event.actor.id };
33
+ if (WORK_ACTS.has(event.type)) {
34
+ return { kind: "work", ...at, made: event.type === "question.ask" ? "question" : "approval" };
35
+ }
36
+ if (event.type !== "message.post" || !isAgent(event))
37
+ return undefined;
38
+ const fresh = filesOf(event).find((file) => !seenBefore(room, event.seq, file.sha256));
39
+ return fresh === undefined
40
+ ? undefined
41
+ : { kind: "work", ...at, made: "file", file: fresh.filename };
42
+ }
43
+ /** The newest thing an agent made after `after`. */
44
+ function lastWork(room, after) {
45
+ for (const event of [...room].reverse()) {
46
+ if (event.seq <= after)
47
+ break;
48
+ const work = event.actor.kind === "person" ? undefined : workOf(room, event);
49
+ if (work !== undefined)
50
+ return work;
51
+ }
52
+ return undefined;
53
+ }
54
+ /** The workspace's limits as of `uptoSeq` (ADR 0187): the newest it set, or the defaults. */
55
+ function limitsInLog(log, uptoSeq) {
56
+ const set = log.findLast((event) => event.type === "exchange.limits_set" && event.seq <= uptoSeq);
57
+ return set === undefined ? DEFAULT_EXCHANGE_LIMITS : exchangeLimitsOf(set.payload);
58
+ }
59
+ /** How the agents' talk in a room stands as of `uptoSeq`, from the log. */
60
+ export function exchangeInLog(log, spaceId, uptoSeq = Number.MAX_SAFE_INTEGER) {
61
+ const room = log.filter((event) => event.space_id === spaceId && event.seq <= uptoSeq);
62
+ const person = room.findLast((event) => event.actor.kind === "person" && resetsTheCount(event.type, event.payload));
63
+ const work = lastWork(room, person?.seq ?? 0);
64
+ const since = work ??
65
+ (person === undefined
66
+ ? { kind: "start", seq: 0 }
67
+ : { kind: "person", seq: person.seq, at: person.ts, by: person.actor.id });
68
+ const talk = room.filter((event) => event.seq > since.seq && isTalk(event));
69
+ const messages = talk.slice(-RECENT).map((event) => ({
70
+ message_id: messageIdOf(event.id),
71
+ by: event.actor.id,
72
+ text: typeof event.payload["text"] === "string" ? event.payload["text"] : "",
73
+ filesSeen: filesOf(event)
74
+ .filter((file) => seenBefore(room, event.seq, file.sha256))
75
+ .map((file) => file.filename),
76
+ }));
77
+ const paused = room.some((event) => event.type === "exchange.set" &&
78
+ event.seq > (person?.seq ?? 0) &&
79
+ event.payload["state"] === "paused");
80
+ return {
81
+ count: talk.length,
82
+ since,
83
+ messages,
84
+ paused,
85
+ // Nobody's reading is known here either: the fake keeps no read state.
86
+ personLooking: null,
87
+ ...(person === undefined ? {} : { person: person.actor.id }),
88
+ personSeq: person?.seq,
89
+ limits: limitsInLog(log, uptoSeq),
90
+ };
91
+ }
92
+ /** The messages held in a room after `afterSeq` and before `beforeSeq`, newest first. */
93
+ export function heldInLog(log, spaceId, afterSeq, beforeSeq) {
94
+ return log
95
+ .filter((event) => event.space_id === spaceId &&
96
+ event.type === "message.post" &&
97
+ event.seq > afterSeq &&
98
+ event.seq < beforeSeq &&
99
+ event.payload["held"] === true)
100
+ .reverse();
101
+ }
102
+ //# sourceMappingURL=exchange.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exchange.js","sourceRoot":"","sources":["../src/exchange.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,uBAAuB,EAIvB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,SAAS,GACV,MAAM,qBAAqB,CAAC;AAa7B,+FAA+F;AAC/F,MAAM,MAAM,GAAG,EAAE,CAAC;AAOlB,MAAM,OAAO,GAAG,CAAC,KAAkB,EAAW,EAAE,CAC9C,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC;AAEjE,SAAS,OAAO,CAAC,KAAkB;IACjC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAC3C,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAE,KAAmC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CACzF,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,QAAQ,IAAI,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,QAAQ;QACxE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1D,CAAC,CAAC,EAAE,CACP,CAAC;AACJ,CAAC;AAED,uEAAuE;AACvE,SAAS,MAAM,CAAC,KAAkB;IAChC,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QA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