@ai-ecoverse/slicc-spectrum 1.50.0 → 1.52.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.
@@ -0,0 +1,51 @@
1
+ import '@adobe/spectrum-wc/components/button/swc-button.js';
2
+ import '@adobe/spectrum-wc-icons/swc-icon-alert-triangle.js';
3
+ import '@spectrum-web-components/alert-dialog/sp-alert-dialog.js';
4
+ import { type PropertyValues } from 'lit';
5
+ import type { Approval, ApprovalDecision, SliccModel } from '../model/types.js';
6
+ import { ModelElement } from './base.js';
7
+ export declare function countdown(ms: number): string;
8
+ export declare function asking(approval: Approval): string;
9
+ export declare function sudo(approval: Approval): string;
10
+ export declare function waiting(model: SliccModel | null, now: number): Approval[];
11
+ export declare class SliccApprovals extends ModelElement {
12
+ #private;
13
+ static properties: {
14
+ model: {
15
+ attribute: boolean;
16
+ };
17
+ now: {
18
+ state: boolean;
19
+ };
20
+ busy: {
21
+ state: boolean;
22
+ };
23
+ failure: {
24
+ state: boolean;
25
+ };
26
+ gone: {
27
+ state: boolean;
28
+ };
29
+ };
30
+ now: number;
31
+ busy: ApprovalDecision | '';
32
+ failure: {
33
+ id: string;
34
+ message: string;
35
+ } | null;
36
+ gone: {
37
+ approval: Approval;
38
+ reason: 'elsewhere' | 'expired';
39
+ } | null;
40
+ arming: number;
41
+ constructor();
42
+ static styles: import("lit").CSSResult[];
43
+ protected subscribe(model: SliccModel): Array<() => void>;
44
+ disconnectedCallback(): void;
45
+ decide(approval: Approval, decision: ApprovalDecision): Promise<void>;
46
+ protected willUpdate(changed: PropertyValues): void;
47
+ protected updated(changed: PropertyValues): void;
48
+ close(): void;
49
+ render(): unknown;
50
+ }
51
+ export declare function deadline(at: number): string;
@@ -21,6 +21,8 @@ export interface PromptOptions {
21
21
  trigger?: HTMLElement | null;
22
22
  submit?: (value: string) => Promise<void>;
23
23
  }
24
+ export declare function focused(): HTMLElement | null;
25
+ export declare const dialogStyles: import("lit").CSSResult;
24
26
  export declare class SliccConfirm extends LitElement {
25
27
  #private;
26
28
  static properties: {
@@ -0,0 +1,60 @@
1
+ import '@adobe/spectrum-wc/components/action-button/swc-action-button.js';
2
+ import '@adobe/spectrum-wc/components/button/swc-button.js';
3
+ import '@adobe/spectrum-wc/components/popover/swc-popover.js';
4
+ import '@adobe/spectrum-wc/components/progress-circle/swc-progress-circle.js';
5
+ import '@adobe/spectrum-wc/components/status-light/swc-status-light.js';
6
+ import '@adobe/spectrum-wc/components/tooltip/swc-tooltip.js';
7
+ import '@adobe/spectrum-wc-icons/swc-icon-alert-triangle.js';
8
+ import '@adobe/spectrum-wc-icons/swc-icon-user-following.js';
9
+ import { nothing, type TemplateResult } from 'lit';
10
+ import type { FollowState, SliccModel } from '../model/types.js';
11
+ import { ModelElement } from './base.js';
12
+ export type FollowVariant = 'info' | 'positive' | 'notice' | 'negative';
13
+ export interface FollowLight {
14
+ variant: FollowVariant;
15
+ text: string;
16
+ }
17
+ export declare function followLight(state: FollowState): FollowLight;
18
+ export type FollowPageKind = 'connecting' | 'waiting' | 'unlinked' | 'failed';
19
+ export interface FollowPage {
20
+ kind: FollowPageKind;
21
+ title: string;
22
+ body: string;
23
+ }
24
+ export declare function followPage(state: FollowState | undefined): FollowPage | null;
25
+ export declare function followCan(state: FollowState): string;
26
+ export declare function following(model: SliccModel | null | undefined): FollowState | null;
27
+ export declare function watchOnly(model: SliccModel | null | undefined): string;
28
+ export declare function terminalsAllowed(model: SliccModel | null | undefined): boolean;
29
+ export declare class SliccFollow extends ModelElement {
30
+ #private;
31
+ static properties: {
32
+ model: {
33
+ attribute: boolean;
34
+ };
35
+ page: {
36
+ type: BooleanConstructor;
37
+ reflect: boolean;
38
+ };
39
+ compact: {
40
+ type: BooleanConstructor;
41
+ reflect: boolean;
42
+ };
43
+ busy: {
44
+ state: boolean;
45
+ };
46
+ error: {
47
+ state: boolean;
48
+ };
49
+ };
50
+ page: boolean;
51
+ compact: boolean;
52
+ busy: '' | 'leave' | 'retry';
53
+ error: string;
54
+ constructor();
55
+ static styles: import("lit").CSSResult[];
56
+ protected subscribe(model: SliccModel): Array<() => void>;
57
+ leave(): Promise<void>;
58
+ retry(): Promise<void>;
59
+ render(): TemplateResult | typeof nothing;
60
+ }
@@ -10,8 +10,9 @@ import '@adobe/spectrum-wc-icons/swc-icon-cloud-state-slow-connection.js';
10
10
  import '@adobe/spectrum-wc-icons/swc-icon-copy.js';
11
11
  import '@adobe/spectrum-wc-icons/swc-icon-info-circle.js';
12
12
  import { type TemplateResult } from 'lit';
13
- import type { BrowserAutomation, LinkedDevice, LinkState, NetworkExit, NetworkLinks, NetworkRoute, NetworkStatus, RemoteControlMode, SliccModel, TailnetState, TailnetStatus } from '../model/types.js';
13
+ import type { AccessKey, BrowserAutomation, DeviceAccess, LinkedDevice, LinkState, NetworkExit, NetworkLinks, NetworkPort, NetworkRoute, NetworkStatus, RemoteControlMode, SliccModel, TailnetState, TailnetStatus } from '../model/types.js';
14
14
  import { ModelElement } from './base.js';
15
+ import { type ConfirmOptions } from './confirm.js';
15
16
  export { command } from './reach.js';
16
17
  export declare const networkHealth: Record<NetworkStatus['health'], readonly ['positive' | 'notice' | 'negative', string]>;
17
18
  export declare const automation: Record<NonNullable<BrowserAutomation['via']> | 'none', string>;
@@ -22,11 +23,18 @@ export declare function tailnetAddress(addresses: readonly string[]): string | u
22
23
  export declare function exitNodeValue(tailnet: TailnetStatus): string;
23
24
  export declare const linkStates: Record<LinkState, readonly ['neutral' | 'info' | 'positive' | 'notice', string]>;
24
25
  export declare const controlBadges: Record<RemoteControlMode, string>;
26
+ export declare const accessLabels: Record<AccessKey, string>;
27
+ export declare function accessShown(access: DeviceAccess): AccessKey[];
28
+ export declare function terminalsText(count: number): string;
29
+ export declare function accessConfirm(device: LinkedDevice, key: AccessKey | 'follow'): ConfirmOptions;
25
30
  export interface RemoteLight {
26
- mode: RemoteControlMode;
31
+ mode: RemoteControlMode | 'terminal' | 'ask';
32
+ variant: 'info' | 'notice';
27
33
  text: string;
28
34
  tooltip: string;
29
35
  }
36
+ export declare function deviceName(name: string): string;
37
+ export declare function networkStatus(port: NetworkPort): NetworkStatus;
30
38
  export declare function remoteLight(status: NetworkStatus | undefined): RemoteLight | null;
31
39
  export type LinksSummary = 'permission' | 'none' | 'reconnecting' | 'connecting' | 'offline' | 'linked';
32
40
  export declare function linksSummary(links: NetworkLinks): LinksSummary;
@@ -0,0 +1,6 @@
1
+ import { type TemplateResult } from 'lit';
2
+ export declare function qrPath(text: string): {
3
+ size: number;
4
+ path: string;
5
+ };
6
+ export declare function qrCode(text: string, label: string): TemplateResult;
@@ -0,0 +1,13 @@
1
+ import { Emitter } from '../model/emitter.js';
2
+ import type { Approval, ApprovalDecision, ApprovalEnd, ApprovalsEvents, ApprovalsPort } from '../model/types.js';
3
+ import type { Clock } from './clock.js';
4
+ export type ApprovalScenario = 'agent' | 'user' | 'many' | 'follower' | 'fail' | 'soon' | 'elsewhere' | 'withdrawn';
5
+ export declare function approvalFixtures(scenario: ApprovalScenario, now?: number): Approval[];
6
+ export declare class DummyApprovals extends Emitter<ApprovalsEvents> implements ApprovalsPort {
7
+ #private;
8
+ decisions: Array<[string, ApprovalDecision]>;
9
+ decide?: (id: string, decision: ApprovalDecision) => Promise<void>;
10
+ constructor(scenario: ApprovalScenario, time: Clock);
11
+ end(id: string, reason: ApprovalEnd): void;
12
+ list(): readonly Approval[];
13
+ }
@@ -0,0 +1,16 @@
1
+ import { Emitter } from '../model/emitter.js';
2
+ import type { FollowPort, FollowState } from '../model/types.js';
3
+ import type { Clock } from './clock.js';
4
+ export type FollowScenario = 'connecting' | 'waiting' | 'watch' | 'control' | 'full' | 'reconnecting' | 'unlinked' | 'failed';
5
+ export declare function followFixtures(scenario: FollowScenario): FollowState;
6
+ export declare class DummyFollow extends Emitter<{
7
+ follow: FollowState;
8
+ }> implements FollowPort {
9
+ #private;
10
+ left: number;
11
+ constructor(scenario: FollowScenario, time: Clock);
12
+ state(): FollowState;
13
+ setScenario(scenario: FollowScenario): void;
14
+ leave(): Promise<void>;
15
+ retry(): Promise<void>;
16
+ }
@@ -1,7 +1,9 @@
1
1
  import type { SliccModel } from '../model/types.js';
2
+ import { type ApprovalScenario, DummyApprovals } from './approvals.js';
2
3
  import { type BrowserScenario, DummyBrowser } from './browser.js';
3
4
  import { type ChangesScenario } from './changes.js';
4
5
  import { type MountScenario } from './files.js';
6
+ import { DummyFollow, type FollowScenario } from './follow.js';
5
7
  import { DummyNetwork, type LinksScenario, type NetworkScenario, type TailnetScenario } from './network.js';
6
8
  import { DummyNotices, type NoticeScenario } from './notices.js';
7
9
  import { DummyTabs, type TabsScenario } from './tabs.js';
@@ -19,6 +21,8 @@ export interface DummyOptions {
19
21
  changes?: ChangesScenario;
20
22
  notices?: NoticeScenario | 'off';
21
23
  tabs?: TabsScenario | 'off';
24
+ approvals?: ApprovalScenario | 'off';
25
+ follow?: FollowScenario | 'off';
22
26
  browser?: BrowserScenario;
23
27
  }
24
28
  export interface DummyModel extends SliccModel {
@@ -27,5 +31,7 @@ export interface DummyModel extends SliccModel {
27
31
  network?: DummyNetwork;
28
32
  notices?: DummyNotices;
29
33
  tabs?: DummyTabs;
34
+ approvals?: DummyApprovals;
35
+ follow?: DummyFollow;
30
36
  }
31
- export declare function createDummyModel({ delay, storage, updates, packages, confirm, mounts, network, tailnet, links, changes, notices, tabs, browser: scenario, }?: DummyOptions): DummyModel;
37
+ export declare function createDummyModel({ delay, storage, updates, packages, confirm, mounts, network, tailnet, links, changes, notices, tabs, approvals, follow, browser: scenario, }?: DummyOptions): DummyModel;
@@ -1,12 +1,14 @@
1
1
  import { Emitter } from '../model/emitter.js';
2
- import type { NetworkExit, NetworkLinks, NetworkPort, NetworkStatus, TailnetStatus } from '../model/types.js';
2
+ import type { AccessKey, LinkedDevice, NetworkExit, NetworkLinks, NetworkPort, NetworkStatus, TailnetStatus } from '../model/types.js';
3
3
  import type { Clock } from './clock.js';
4
4
  export type NetworkScenario = 'ok' | 'limited' | 'failing';
5
5
  export type TailnetScenario = 'off' | 'needs-login' | 'running' | 'failed';
6
- export type LinksScenario = 'none' | 'preparing' | 'linked' | 'reconnecting' | 'exit' | 'prompt' | 'denied' | 'remote';
6
+ export type LinksScenario = 'none' | 'preparing' | 'linked' | 'reconnecting' | 'exit' | 'prompt' | 'denied' | 'remote' | 'followers';
7
7
  export declare function networkFixtures(scenario: NetworkScenario, now?: number): NetworkStatus;
8
8
  export declare function tailnetFixtures(scenario: TailnetScenario): TailnetStatus;
9
9
  export declare function joinUrl(rotation?: number): string;
10
+ export declare function followUrl(rotation?: number): string;
11
+ export declare function grant(device: LinkedDevice, key: AccessKey, allowed: boolean): LinkedDevice;
10
12
  export declare function linksFixtures(scenario: LinksScenario, rotation?: number): {
11
13
  links: NetworkLinks;
12
14
  exit: NetworkExit;
@@ -19,6 +21,7 @@ export declare class DummyNetwork extends Emitter<{
19
21
  setExit?: (exit: NetworkExit) => Promise<void>;
20
22
  unlink?: (id: string) => Promise<void>;
21
23
  setRemoteControl?: (id: string, allowed: boolean) => Promise<void>;
24
+ setAccess?: (id: string, key: AccessKey, allowed: boolean) => Promise<void>;
22
25
  rotateJoinUrl?: () => Promise<void>;
23
26
  retryLinks?: () => Promise<void>;
24
27
  constructor(scenario: NetworkScenario, clock: Clock, tailnet?: TailnetScenario, links?: LinksScenario);
@@ -1,8 +1,12 @@
1
+ export type { ApprovalScenario } from './dummy/approvals.js';
2
+ export { approvalFixtures, DummyApprovals } from './dummy/approvals.js';
1
3
  export type { ActionDraft, BrowserScenario } from './dummy/browser.js';
2
4
  export { browserHistory, DummyBrowser, page } from './dummy/browser.js';
3
5
  export type { ChangesScenario } from './dummy/changes.js';
4
6
  export { DummyChanges } from './dummy/changes.js';
5
7
  export type { DummyMount, MountScenario } from './dummy/files.js';
8
+ export type { FollowScenario } from './dummy/follow.js';
9
+ export { DummyFollow, followFixtures } from './dummy/follow.js';
6
10
  export type { DummyModel, DummyOptions } from './dummy/index.js';
7
11
  export { createDummyModel } from './dummy/index.js';
8
12
  export type { NetworkScenario, TailnetScenario } from './dummy/network.js';
@@ -624,6 +624,14 @@ export interface RemoteControl {
624
624
  fixed?: boolean;
625
625
  }
626
626
  export type RemoteControlMode = 'prompt' | 'watch';
627
+ export type LinkKind = 'cli' | 'seven';
628
+ export type AccessKey = 'view' | 'control' | 'terminal';
629
+ export interface DeviceAccess {
630
+ view?: boolean;
631
+ control?: boolean;
632
+ terminal?: boolean;
633
+ fixed?: boolean;
634
+ }
627
635
  export interface LinkedBrowser {
628
636
  runtime: string;
629
637
  name: string;
@@ -641,10 +649,15 @@ export interface LinkedDevice {
641
649
  browsers?: readonly LinkedBrowser[];
642
650
  control?: RemoteControl;
643
651
  controlling?: RemoteControlMode;
652
+ kind?: LinkKind;
653
+ access?: DeviceAccess;
654
+ asking?: boolean;
655
+ terminals?: number;
644
656
  }
645
657
  export interface NetworkLinks {
646
658
  joinUrl: string | null;
647
659
  joinCommand: string | null;
660
+ followUrl?: string | null;
648
661
  devices: readonly LinkedDevice[];
649
662
  permission?: 'prompt' | 'denied' | null;
650
663
  }
@@ -687,6 +700,7 @@ export interface NetworkPort extends Subscribable<{
687
700
  setExit?(exit: NetworkExit): Promise<void>;
688
701
  unlink?(id: string): Promise<void>;
689
702
  setRemoteControl?(id: string, allowed: boolean): Promise<void>;
703
+ setAccess?(id: string, key: AccessKey, allowed: boolean): Promise<void>;
690
704
  rotateJoinUrl?(): Promise<void>;
691
705
  retryLinks?(): Promise<void>;
692
706
  }
@@ -708,6 +722,37 @@ export interface NoticesPort extends Subscribable<{
708
722
  act(id: string, action: string): Promise<void>;
709
723
  dismiss(id: string): void;
710
724
  }
725
+ export type ApprovalDecision = 'once' | 'always' | 'deny';
726
+ export interface ApprovalRequester {
727
+ kind: 'agent' | 'user';
728
+ name: string;
729
+ agentId?: string;
730
+ where?: string;
731
+ }
732
+ export interface SudoApproval {
733
+ id: string;
734
+ kind: 'sudo';
735
+ requester: ApprovalRequester;
736
+ command: string;
737
+ target?: string;
738
+ cwd?: string;
739
+ createdAt: number;
740
+ expiresAt: number;
741
+ always: boolean;
742
+ }
743
+ export type Approval = SudoApproval;
744
+ export type ApprovalEnd = 'answered' | 'withdrawn' | 'expired';
745
+ export interface ApprovalsEvents {
746
+ approvals: readonly Approval[];
747
+ ended: {
748
+ id: string;
749
+ reason: ApprovalEnd;
750
+ };
751
+ }
752
+ export interface ApprovalsPort extends Subscribable<ApprovalsEvents> {
753
+ list(): readonly Approval[];
754
+ decide?(id: string, decision: ApprovalDecision): Promise<void>;
755
+ }
711
756
  export type TabRole = 'owner' | 'follower' | 'connecting' | 'alone';
712
757
  export type TabSkew = 'newer' | 'older';
713
758
  export interface TabsState {
@@ -721,6 +766,21 @@ export interface TabsPort extends Subscribable<{
721
766
  state(): TabsState;
722
767
  reload(): void;
723
768
  }
769
+ export type FollowLink = 'connecting' | 'connected' | 'reconnecting' | 'unlinked' | 'failed';
770
+ export interface FollowState {
771
+ owner: string;
772
+ link: FollowLink;
773
+ access: DeviceAccess;
774
+ name?: string;
775
+ error?: string;
776
+ }
777
+ export interface FollowPort extends Subscribable<{
778
+ follow: FollowState;
779
+ }> {
780
+ state(): FollowState;
781
+ leave(): Promise<void>;
782
+ retry?(): Promise<void>;
783
+ }
724
784
  export interface SliccModel {
725
785
  agent: AgentPort;
726
786
  files: FilePort;
@@ -736,4 +796,6 @@ export interface SliccModel {
736
796
  changes?: ChangesPort;
737
797
  notices?: NoticesPort;
738
798
  tabs?: TabsPort;
799
+ approvals?: ApprovalsPort;
800
+ follow?: FollowPort;
739
801
  }
@@ -1,12 +1,14 @@
1
1
  import './app/spectrum.ts';
2
2
  import { SliccAgents } from './app/agents.js';
3
3
  import { SliccApp } from './app/app.js';
4
+ import { SliccApprovals } from './app/approvals.js';
4
5
  import { SliccBrowser } from './app/browser.js';
5
6
  import { SliccChanges, SliccDiffPanel } from './app/changes.js';
6
7
  import { SliccChat } from './app/chat.js';
7
8
  import { SliccComposer } from './app/composer.js';
8
9
  import { SliccConfirm, SliccPrompt } from './app/confirm.js';
9
10
  import { SliccFiles, SliccFileView } from './app/files.js';
11
+ import { SliccFollow } from './app/follow.js';
10
12
  import { SliccNetwork } from './app/network.js';
11
13
  import { SliccNotices } from './app/notices.js';
12
14
  import { SliccUpdates } from './app/updates.js';
@@ -27,5 +29,5 @@ export type { GitStatusEntry } from './components/file-tree.js';
27
29
  export type { Listener, Subscribable } from './model/emitter.js';
28
30
  export { Emitter } from './model/emitter.js';
29
31
  export type * from './model/types.js';
30
- export { SliccAgents, SliccApp, SliccBrowser, SliccChanges, SliccChat, SliccCodeView, SliccComposer, SliccConfirm, SliccDiffPanel, SliccDiffView, SliccDock, SliccFiles, SliccFileTree, SliccFileView, SliccNetwork, SliccNotices, SliccPrompt, SliccUpdates, };
32
+ export { SliccAgents, SliccApp, SliccApprovals, SliccBrowser, SliccChanges, SliccChat, SliccCodeView, SliccComposer, SliccConfirm, SliccDiffPanel, SliccDiffView, SliccDock, SliccFiles, SliccFileTree, SliccFileView, SliccFollow, SliccNetwork, SliccNotices, SliccPrompt, SliccUpdates, };
31
33
  export declare function define(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-spectrum",
3
- "version": "1.50.0",
3
+ "version": "1.52.0",
4
4
  "description": "Web components for SLICC on Spectrum Web Components: the terminal, the app shell and its surfaces",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -107,6 +107,7 @@
107
107
  "monocart-coverage-reports": "2.13.0",
108
108
  "playwright-core": "1.63.0",
109
109
  "semantic-release": "25.0.9",
110
- "typescript": "7.0.2"
110
+ "typescript": "7.0.2",
111
+ "uqr": "0.1.3"
111
112
  }
112
113
  }