@ai-ecoverse/slicc-spectrum 2.9.2 → 2.11.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.
- package/README.md +10 -8
- package/dist/slicc-dummy.js +46 -13
- package/dist/slicc-dummy.js.map +2 -2
- package/dist/slicc-ui.js +40 -10
- package/dist/slicc-ui.js.map +3 -3
- package/dist/types/dummy/approvals.d.ts +1 -1
- package/dist/types/dummy/live.d.ts +1 -1
- package/dist/types/model/types.d.ts +3 -1
- package/package.json +1 -1
package/dist/slicc-ui.js
CHANGED
|
@@ -39964,7 +39964,7 @@ function watchTitles(model, update) {
|
|
|
39964
39964
|
seen.set(id, title2);
|
|
39965
39965
|
update();
|
|
39966
39966
|
};
|
|
39967
|
-
const
|
|
39967
|
+
const stops2 = [
|
|
39968
39968
|
model.agent.on("messages", check3),
|
|
39969
39969
|
model.agent.on("message", ({ agentId }) => check3(agentId)),
|
|
39970
39970
|
model.agent.on("agents", (agents) => {
|
|
@@ -39974,7 +39974,7 @@ function watchTitles(model, update) {
|
|
|
39974
39974
|
})
|
|
39975
39975
|
];
|
|
39976
39976
|
return () => {
|
|
39977
|
-
for (const stop of
|
|
39977
|
+
for (const stop of stops2) stop();
|
|
39978
39978
|
};
|
|
39979
39979
|
}
|
|
39980
39980
|
|
|
@@ -51980,8 +51980,11 @@ function extras(approval) {
|
|
|
51980
51980
|
if (approval.kind === "capture") return [approval.detail, approval.requester];
|
|
51981
51981
|
return [];
|
|
51982
51982
|
}
|
|
51983
|
+
var stops = (approval) => approval.kind === "sudo" && approval.stoppable === true && approval.requester.kind === "agent" && !!approval.requester.agentId;
|
|
51984
|
+
var denies = (decision2) => decision2 === "deny" || decision2 === "stop";
|
|
51983
51985
|
function answerable(approval, decision2) {
|
|
51984
51986
|
if (decision2 === "deny") return true;
|
|
51987
|
+
if (decision2 === "stop") return stops(approval);
|
|
51985
51988
|
if (approval.kind === "secret") return false;
|
|
51986
51989
|
return approval.kind !== "click" || approval.here;
|
|
51987
51990
|
}
|
|
@@ -52152,9 +52155,23 @@ var SliccApprovals = class extends ModelElement {
|
|
|
52152
52155
|
.judged p {
|
|
52153
52156
|
margin: 0;
|
|
52154
52157
|
}
|
|
52155
|
-
[slot='button'][data-action='deny']
|
|
52158
|
+
[slot='button'][data-action='deny'],
|
|
52159
|
+
[slot='button'][data-action='stop'] {
|
|
52156
52160
|
margin-inline-end: auto;
|
|
52157
52161
|
}
|
|
52162
|
+
[slot='button'][data-action='deny']:has(+ [data-action='stop']) {
|
|
52163
|
+
margin-inline-end: 0;
|
|
52164
|
+
}
|
|
52165
|
+
sp-alert-dialog {
|
|
52166
|
+
--mod-buttongroup-spacing: var(--swc-spacing-300);
|
|
52167
|
+
}
|
|
52168
|
+
.break {
|
|
52169
|
+
flex-basis: 100%;
|
|
52170
|
+
block-size: 0;
|
|
52171
|
+
}
|
|
52172
|
+
.break ~ [slot='button'] {
|
|
52173
|
+
margin-block-start: calc(-1 * var(--swc-spacing-300));
|
|
52174
|
+
}
|
|
52158
52175
|
.prompt {
|
|
52159
52176
|
margin-block-start: var(--swc-spacing-200);
|
|
52160
52177
|
padding-inline-start: var(--swc-spacing-200);
|
|
@@ -52264,10 +52281,11 @@ var SliccApprovals = class extends ModelElement {
|
|
|
52264
52281
|
async decide(approval, decision2) {
|
|
52265
52282
|
const port = this.model?.approvals;
|
|
52266
52283
|
const { id } = approval;
|
|
52267
|
-
if (!port?.decide || this.busy || this.gone || this.#showing?.id !== id || this.#done.has(id) || this.#closed.has(id) || !answerable(approval, decision2) || decision2
|
|
52284
|
+
if (!port?.decide || this.busy || this.gone || this.#showing?.id !== id || this.#done.has(id) || this.#closed.has(id) || !answerable(approval, decision2) || !denies(decision2) && (!this.#arming.settled() || !this.#whole(approval)))
|
|
52268
52285
|
return;
|
|
52269
52286
|
const live = port.list().find(({ id: id2 }) => id2 === approval.id);
|
|
52270
52287
|
if (decision2 === "always" && !(live && offersAlways(live))) return;
|
|
52288
|
+
if (decision2 === "stop" && !(live && stops(live))) return;
|
|
52271
52289
|
this.busy = decision2;
|
|
52272
52290
|
this.failure = null;
|
|
52273
52291
|
this.#pending.add(approval.id);
|
|
@@ -52407,7 +52425,7 @@ var SliccApprovals = class extends ModelElement {
|
|
|
52407
52425
|
fill-style=${variant === "accent" ? A : "outline"}
|
|
52408
52426
|
data-action=${decision2}
|
|
52409
52427
|
?pending=${this.busy === decision2}
|
|
52410
|
-
?disabled=${!!this.busy && this.busy !== decision2 || decision2
|
|
52428
|
+
?disabled=${!!this.busy && this.busy !== decision2 || !denies(decision2) && !this.#whole(approval)}
|
|
52411
52429
|
@click=${(event2) => this.#click(event2, approval, decision2)}
|
|
52412
52430
|
>${label}</swc-button
|
|
52413
52431
|
>`;
|
|
@@ -52469,6 +52487,7 @@ var SliccApprovals = class extends ModelElement {
|
|
|
52469
52487
|
return b`<swc-button slot="button" variant="secondary" fill-style="outline" data-action="close" @click=${() => this.#dismiss(approval)}>Close</swc-button>`;
|
|
52470
52488
|
const click = approval.kind === "click";
|
|
52471
52489
|
return b`${this.#button(approval, "deny", click ? "Cancel" : "Deny", "secondary")}
|
|
52490
|
+
${stops(approval) ? b`${this.#button(approval, "stop", "Deny and stop", "secondary")}<span slot="button" class="break" aria-hidden="true"></span>` : A}
|
|
52472
52491
|
${always ? this.#button(approval, "always", inCwd(approval) ? "Always allow in this directory" : "Always allow", "secondary") : A}
|
|
52473
52492
|
${answerable(approval, "once") ? this.#button(approval, "once", click ? approval.action : "Allow once", "accent") : A}`;
|
|
52474
52493
|
}
|
|
@@ -54333,7 +54352,8 @@ function elapsed(ms) {
|
|
|
54333
54352
|
return `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")}`;
|
|
54334
54353
|
}
|
|
54335
54354
|
function liveLine(item2, now) {
|
|
54336
|
-
|
|
54355
|
+
const tail2 = item2.endedAt != null ? "Ended" : elapsed(now - item2.since);
|
|
54356
|
+
return [item2.label, item2.what, item2.asker, tail2].filter(Boolean).join(" \xB7 ");
|
|
54337
54357
|
}
|
|
54338
54358
|
var SliccLive = class extends ModelElement {
|
|
54339
54359
|
static properties = {
|
|
@@ -54374,6 +54394,9 @@ var SliccLive = class extends ModelElement {
|
|
|
54374
54394
|
border-radius: 50%;
|
|
54375
54395
|
background: var(--swc-negative-visual-color);
|
|
54376
54396
|
}
|
|
54397
|
+
.chip[data-ended] .dot {
|
|
54398
|
+
background: var(--swc-neutral-visual-color);
|
|
54399
|
+
}
|
|
54377
54400
|
.text {
|
|
54378
54401
|
flex: 0 1 auto;
|
|
54379
54402
|
min-width: 0;
|
|
@@ -54407,6 +54430,9 @@ var SliccLive = class extends ModelElement {
|
|
|
54407
54430
|
#items() {
|
|
54408
54431
|
return this.model?.live?.items() ?? [];
|
|
54409
54432
|
}
|
|
54433
|
+
#live() {
|
|
54434
|
+
return this.#items().some((item2) => item2.endedAt == null);
|
|
54435
|
+
}
|
|
54410
54436
|
#tick(on2) {
|
|
54411
54437
|
if (on2 && !this.#timer) this.#timer = setInterval(() => this.now = Date.now(), 1e3);
|
|
54412
54438
|
if (!on2 && this.#timer) {
|
|
@@ -54416,13 +54442,17 @@ var SliccLive = class extends ModelElement {
|
|
|
54416
54442
|
}
|
|
54417
54443
|
updated(changed2) {
|
|
54418
54444
|
super.updated(changed2);
|
|
54419
|
-
this.#tick(this.isConnected && this.#
|
|
54445
|
+
this.#tick(this.isConnected && this.#live());
|
|
54420
54446
|
}
|
|
54421
54447
|
#chip(item2) {
|
|
54422
|
-
const
|
|
54423
|
-
|
|
54448
|
+
const ended3 = item2.endedAt != null;
|
|
54449
|
+
const rest = [item2.what, item2.asker].filter(Boolean).join(" \xB7 ");
|
|
54450
|
+
const stamp = ended3 ? null : elapsed(this.now - item2.since);
|
|
54451
|
+
return b`<div class="chip" role="listitem" data-id=${item2.id} data-kind=${item2.kind} ?data-ended=${ended3}>
|
|
54424
54452
|
<span class="dot" aria-hidden="true"></span>
|
|
54425
|
-
<span class="text" title=${liveLine(item2, this.now)}
|
|
54453
|
+
<span class="text" title=${liveLine(item2, this.now)}
|
|
54454
|
+
><span class="label">${item2.label}</span>${rest ? b`<span class="detail"> · ${rest}</span>` : A}${ended3 ? b`<span class="ended"> · Ended</span>` : b`<span class="detail"> · ${stamp}</span>`}</span
|
|
54455
|
+
>
|
|
54426
54456
|
<swc-action-button size="s" quiet data-action="live-act" accessible-label=${`${item2.action.label}: ${item2.label}`} @click=${() => this.model?.live?.act(item2.id)}>${item2.action.label}</swc-action-button>
|
|
54427
54457
|
</div>`;
|
|
54428
54458
|
}
|