@ai-ecoverse/slicc-spectrum 1.111.4 → 1.112.1

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.
Binary file
@@ -148,6 +148,81 @@ function trayFixtures(scenario, now2) {
148
148
  const id = scenario === "tray-expired" ? "tray-url" : scenario;
149
149
  return all.filter((approval) => approval.id === id);
150
150
  }
151
+ function levelFixture(scenario, now2) {
152
+ const base = {
153
+ id: `sudo-${scenario}`,
154
+ kind: "sudo",
155
+ createdAt: now2,
156
+ expiresAt: now2 + 5 * minutes,
157
+ always: false
158
+ };
159
+ const docs = { kind: "agent", name: "docs-pass", agentId: "scoop-docs" };
160
+ const cone = { kind: "user", name: "cone", where: "Terminal 2" };
161
+ if (scenario === "level-1")
162
+ return {
163
+ ...base,
164
+ requester: docs,
165
+ command: "jq .rules /etc/slicc/secrets-policy.toml",
166
+ cwd: "/",
167
+ always: true,
168
+ verdict: {
169
+ level: 1,
170
+ aligned: true,
171
+ decision: "allow",
172
+ reason: "It reads a file and changes nothing."
173
+ }
174
+ };
175
+ if (scenario === "level-2")
176
+ return {
177
+ ...base,
178
+ requester: cone,
179
+ command: "nano /etc/slicc/secrets-policy.toml",
180
+ cwd: "/home/cone/harbor",
181
+ verdict: {
182
+ level: 2,
183
+ aligned: true,
184
+ decision: "unsure",
185
+ reason: "It changes which secrets programs may use and where they may be sent."
186
+ }
187
+ };
188
+ if (scenario === "level-3")
189
+ return {
190
+ ...base,
191
+ requester: { kind: "agent", name: "quiet-otter", agentId: "scoop-otter" },
192
+ command: "rm -rf /",
193
+ cwd: "/home/cone/harbor",
194
+ verdict: {
195
+ level: 3,
196
+ aligned: false,
197
+ decision: "deny",
198
+ reason: "It deletes system files, and that is hard to undo."
199
+ }
200
+ };
201
+ if (scenario === "legacy")
202
+ return {
203
+ ...base,
204
+ requester: docs,
205
+ command: "cp harbor.toml /etc/fnox/config.toml",
206
+ cwd: "/home/cone/harbor",
207
+ always: true,
208
+ verdict: { decision: "unsure", reason: "it isn\u2019t clear it serves what the owner asked for." }
209
+ };
210
+ if (scenario === "checking")
211
+ return {
212
+ ...base,
213
+ requester: cone,
214
+ command: "chown -R cone /home/cone/harbor",
215
+ cwd: "/home/cone",
216
+ judging: true
217
+ };
218
+ return {
219
+ ...base,
220
+ requester: cone,
221
+ command: "xargs -a list.txt sort",
222
+ cwd: "/home/cone/harbor",
223
+ verdictError: "The check didn\u2019t answer in time."
224
+ };
225
+ }
151
226
  function approvalFixtures(scenario, now2 = Date.now()) {
152
227
  const agent = {
153
228
  id: "sudo-jq",
@@ -188,6 +263,8 @@ function approvalFixtures(scenario, now2 = Date.now()) {
188
263
  verdict: { decision: "deny", reason: "it looks high-risk." }
189
264
  }
190
265
  ];
266
+ if (["checking", "no-verdict", "legacy"].includes(scenario) || scenario.startsWith("level-"))
267
+ return [levelFixture(scenario, now2)];
191
268
  if (scenario === "secrets")
192
269
  return [
193
270
  {
@@ -255,7 +332,7 @@ var DummyApprovals = class extends Emitter {
255
332
  void time.sleep(100).then(() => this.end("tray-url", "expired"));
256
333
  }
257
334
  raise(approval) {
258
- this.#approvals = [...this.#approvals, approval];
335
+ this.#approvals = [...this.#approvals.filter(({ id }) => id !== approval.id), approval];
259
336
  this.emit("approvals", this.list());
260
337
  }
261
338
  end(id, reason) {