@ai-ecoverse/slicc-agent 7.22.0 → 7.24.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 (40) hide show
  1. package/README.md +24 -11
  2. package/dist/approvals/attributed.js +13 -0
  3. package/dist/approvals/attributed.js.map +7 -0
  4. package/dist/approvals/index.js +7 -3
  5. package/dist/approvals/index.js.map +2 -2
  6. package/dist/approvals/judge.js +71 -5
  7. package/dist/approvals/judge.js.map +2 -2
  8. package/dist/approvals/policy.js +1 -1
  9. package/dist/approvals/policy.js.map +2 -2
  10. package/dist/approvals/record.js +7 -4
  11. package/dist/approvals/record.js.map +2 -2
  12. package/dist/approvals/sudo-client.js +32 -1
  13. package/dist/approvals/sudo-client.js.map +3 -3
  14. package/dist/approvals/sudo.js +2 -0
  15. package/dist/approvals/sudo.js.map +2 -2
  16. package/dist/guests/capture.js +167 -0
  17. package/dist/guests/capture.js.map +7 -0
  18. package/dist/guests/index.js +18 -5
  19. package/dist/guests/index.js.map +2 -2
  20. package/dist/guests/seats.js.map +2 -2
  21. package/dist/host.js +8 -0
  22. package/dist/host.js.map +2 -2
  23. package/dist/index.js.map +2 -2
  24. package/dist/owner.js +23 -13
  25. package/dist/owner.js.map +2 -2
  26. package/dist/services.js +2 -1
  27. package/dist/services.js.map +2 -2
  28. package/dist/spectrum/approvals-port.js +1 -0
  29. package/dist/spectrum/approvals-port.js.map +2 -2
  30. package/dist/types/approvals/attributed.d.ts +3 -0
  31. package/dist/types/approvals/judge.d.ts +20 -4
  32. package/dist/types/approvals/record.d.ts +19 -3
  33. package/dist/types/approvals/sudo-client.d.ts +8 -0
  34. package/dist/types/approvals/sudo.d.ts +3 -1
  35. package/dist/types/guests/capture.d.ts +33 -0
  36. package/dist/types/guests/seats.d.ts +8 -1
  37. package/dist/types/index.d.ts +4 -2
  38. package/dist/types/owner.d.ts +3 -1
  39. package/dist/types/services.d.ts +1 -1
  40. package/package.json +4 -4
@@ -1,6 +1,6 @@
1
1
  import { fits, JUDGE_ALLOW } from './aligned.ts';
2
2
  export { fits, JUDGE_ALLOW };
3
- export type ApprovalKind = 'guest-message' | 'guest-tool' | 'sudo';
3
+ export type ApprovalKind = 'guest-message' | 'guest-tool' | 'sudo' | 'capture';
4
4
  export type ApprovalState = 'pending' | 'approved' | 'rejected' | 'unanswered' | 'withdrawn';
5
5
  export type ApprovalTier = 'user' | 'agent' | 'cone' | `scoop:${string}`;
6
6
  export type ApprovalAnswer = 'once' | 'always' | 'deny';
@@ -52,6 +52,17 @@ export type SudoDetail = {
52
52
  rootOnly?: Record<string, boolean>;
53
53
  writable?: boolean;
54
54
  };
55
+ export type CaptureWhat = 'screen' | 'camera' | 'microphone';
56
+ export type CaptureMode = 'still' | 'video' | 'audio';
57
+ export type CaptureDetail = {
58
+ what: CaptureWhat;
59
+ mode: CaptureMode;
60
+ seconds?: number;
61
+ system?: boolean;
62
+ microphone?: boolean;
63
+ device?: string;
64
+ program: string;
65
+ };
55
66
  type Base = {
56
67
  id: string;
57
68
  seat?: string;
@@ -84,14 +95,18 @@ export type SudoApproval = Base & {
84
95
  kind: 'sudo';
85
96
  detail: SudoDetail;
86
97
  };
87
- export type Approval = GuestMessageApproval | GuestToolApproval | SudoApproval;
98
+ export type CaptureApproval = Base & {
99
+ kind: 'capture';
100
+ detail: CaptureDetail;
101
+ };
102
+ export type Approval = GuestMessageApproval | GuestToolApproval | SudoApproval | CaptureApproval;
88
103
  type DraftOf<T extends Approval> = Pick<T, 'kind' | 'detail' | 'agentId' | 'requester'> & {
89
104
  seat?: string;
90
105
  tier: string;
91
106
  always?: boolean;
92
107
  expiresAt?: number;
93
108
  };
94
- export type ApprovalDraft = DraftOf<GuestMessageApproval> | DraftOf<GuestToolApproval> | DraftOf<SudoApproval>;
109
+ export type ApprovalDraft = DraftOf<GuestMessageApproval> | DraftOf<GuestToolApproval> | DraftOf<SudoApproval> | DraftOf<CaptureApproval>;
95
110
  export type ApprovalsState = {
96
111
  items: Approval[];
97
112
  };
@@ -117,6 +132,7 @@ export declare const REASONS: {
117
132
  export declare const guestKind: (kind: ApprovalKind) => boolean;
118
133
  export declare const scoopTier: (tier: unknown) => tier is `scoop:${string}`;
119
134
  export declare function knownTier(tier: unknown): tier is ApprovalTier;
135
+ export declare const heldKind: (kind: ApprovalKind) => boolean;
120
136
  export declare function routable(kind: ApprovalKind, tier: ApprovalTier): boolean;
121
137
  export declare function answerOf(value: unknown): ApprovalAnswer | null;
122
138
  export declare const personal: (by: DecidedBy) => boolean;
@@ -1,3 +1,4 @@
1
+ import type { CaptureReply } from '../guests/capture.ts';
1
2
  import { type PortEndpoint } from '../wire.ts';
2
3
  import type { Approval } from './record.ts';
3
4
  import type { SudoAnswer, SudoReply, SudoRequest } from './sudo.ts';
@@ -11,4 +12,11 @@ export declare function answerOf(item: Approval | undefined): SudoAnswer | null;
11
12
  export declare const JUDGE_DENIED = "sudo: denied by the approval judge";
12
13
  export declare function replyOf(item: Approval | undefined): SudoReply | null;
13
14
  export declare const WITHDRAW_MS = 5000;
15
+ export interface CaptureAsk {
16
+ kind: string;
17
+ options?: Record<string, unknown>;
18
+ stamp?: Record<string, unknown>;
19
+ label?: string;
20
+ }
21
+ export declare function askCapture(endpoint: PortEndpoint, request: CaptureAsk, options?: ApproveOptions, stop?: AbortSignal): Promise<CaptureReply>;
14
22
  export declare function askSudo(endpoint: PortEndpoint, request: SudoRequest, options?: ApproveOptions, stop?: AbortSignal): Promise<SudoReply>;
@@ -1,5 +1,6 @@
1
1
  import type { Context, ReplicatedState } from '@earendil-works/chord';
2
2
  import type { AgentsState } from '../agents.ts';
3
+ import type { AgentCapture } from '../guests/capture.ts';
3
4
  import type { Licks } from '../licks/licks.ts';
4
5
  import type { Approvals } from './index.ts';
5
6
  import { type Approval, type ApprovalRequester, type SudoDetail, type SudoStdin } from './record.ts';
@@ -35,7 +36,7 @@ export type SudoAsked = {
35
36
  id: null;
36
37
  error: string;
37
38
  };
38
- export interface AgentSudo {
39
+ export interface AgentSudo extends AgentCapture {
39
40
  readonly approvals: ReplicatedState<Approval[]>;
40
41
  request(request: SudoRequest, where: string | null, context: Context): Promise<SudoAsked>;
41
42
  withdraw(id: string, reason: string | null, context: Context): Promise<void>;
@@ -49,6 +50,7 @@ export declare function sudoRequester(request: SudoRequest, agents: Readonly<Age
49
50
  export declare function sudoDetail(request: SudoRequest): SudoDetail;
50
51
  export interface SudoAttach {
51
52
  approvals: Approvals;
53
+ capture: AgentCapture;
52
54
  agents?: () => Readonly<AgentsState> | undefined;
53
55
  licks?: Pick<Licks, 'deliver'>;
54
56
  }
@@ -0,0 +1,33 @@
1
+ import type { Context } from '@earendil-works/chord';
2
+ import type { Harness } from '@earendil-works/pi-durable';
3
+ import { UNATTRIBUTED } from '../approvals/attributed.ts';
4
+ import type { Approvals } from '../approvals/index.ts';
5
+ import { type ApprovalAnswer, type CaptureDetail } from '../approvals/record.ts';
6
+ import { type GuestPolicy } from './policy.ts';
7
+ export type CaptureAnswer = ApprovalAnswer;
8
+ export type CaptureDenial = {
9
+ answer: 'deny';
10
+ message: string;
11
+ };
12
+ export type CaptureReply = CaptureAnswer | CaptureDenial;
13
+ export type CaptureLineage = (pid: number | null) => Promise<{
14
+ recent: string[];
15
+ } | undefined>;
16
+ export type CaptureWire = CaptureReply | typeof UNATTRIBUTED;
17
+ export interface AgentCapture {
18
+ capture(request: unknown, where: string | null, context: Context): Promise<CaptureWire>;
19
+ }
20
+ export interface CaptureHost {
21
+ harness: Pick<Harness, 'snapshot' | 'commit'>;
22
+ approvals: Pick<Approvals, 'request' | 'settled' | 'withdraw'>;
23
+ policy(): GuestPolicy;
24
+ lineage?: CaptureLineage;
25
+ now?: () => number;
26
+ }
27
+ export declare const NOT_CAPTURE = "capture: not a capture kind";
28
+ export declare const CAPTURE_JUDGED = "capture: denied by the approval judge";
29
+ export declare const CAPTURE_LEFTOVER = "capture: a guest's job or crontab line is still running";
30
+ export declare const PROGRAM = "a program";
31
+ export declare const LABEL_LENGTH = 200;
32
+ export declare function captureDetail(request: unknown): CaptureDetail | null;
33
+ export declare function captureGate(host: CaptureHost): AgentCapture;
@@ -1,4 +1,4 @@
1
- import type { ApprovalTier, DecidedBy } from '../approvals/record.ts';
1
+ import type { ApprovalTier, CaptureDetail, DecidedBy } from '../approvals/record.ts';
2
2
  import { type GuestPolicy } from './policy.ts';
3
3
  export type GuestGate = ApprovalTier | 'off';
4
4
  export type GuestGates = {
@@ -26,6 +26,11 @@ export type AlwaysTool = {
26
26
  at: number;
27
27
  };
28
28
  export type ShownAlwaysTool = Omit<AlwaysTool, 'argumentsHash'>;
29
+ export type AlwaysCapture = Pick<CaptureDetail, 'what' | 'mode'> & {
30
+ approval: string;
31
+ by: DecidedBy | null;
32
+ at: number;
33
+ };
29
34
  export type SeatRecord = GuestDraft & {
30
35
  createdAt: number;
31
36
  epoch: number;
@@ -38,6 +43,7 @@ export type SeatRecord = GuestDraft & {
38
43
  at: number;
39
44
  };
40
45
  alwaysTools?: AlwaysTool[];
46
+ alwaysCaptures?: AlwaysCapture[];
41
47
  };
42
48
  export interface GuestSeat {
43
49
  id: string;
@@ -49,6 +55,7 @@ export interface GuestSeat {
49
55
  connected: boolean;
50
56
  pending: number;
51
57
  alwaysTools: ShownAlwaysTool[];
58
+ alwaysCaptures: AlwaysCapture[];
52
59
  }
53
60
  export type GuestsState = {
54
61
  seats: Record<string, SeatRecord>;
@@ -1,16 +1,18 @@
1
1
  export { ADOBE, ADOBE_PROXY, type AdobeConfig, type AdobeModelInfo, adobeClassifiers, adobeConfig, adobeIdentity, adobeModel, adobeProvider, adobeUsage, type Budget, SESSION_HEADER, VERSION_HEADER, withAdobeIdentity, } from './adobe.ts';
2
2
  export { type Agent, type AgentOptions, answerText, openAgent } from './agent.ts';
3
- export { APPROVAL_MS, type Approval, type ApprovalAnswer, type ApprovalDecided, type ApprovalDraft, type ApprovalJudge, type ApprovalKind, type ApprovalRequester, type ApprovalState, type Approvals, ApprovalsDoc, type ApprovalTier, type ApprovalVerdict, ASK_MIN_MS, approvalJudge, attachApprovals, DEFAULT_POLICY, type DecidedBy, type Decider, JUDGE_ALLOW, JUDGE_KIND, JUDGE_MODEL, JUDGE_QUESTIONS, type Judgement, judgeModelOf, judgeSpender, judgeState, type OwnerIntent, ownerIntent, POLICY_FILE, REASONS, route, seedPolicy, VERDICT_REASONS, verdictOf, verdictRecorder, } from './approvals/index.ts';
3
+ export { APPROVAL_MS, type Approval, type ApprovalAnswer, type ApprovalDecided, type ApprovalDraft, type ApprovalJudge, type ApprovalKind, type ApprovalRequester, type ApprovalState, type Approvals, ApprovalsDoc, type ApprovalTier, type ApprovalVerdict, ASK_MIN_MS, approvalJudge, attachApprovals, type CaptureApproval, type CaptureDetail, DEFAULT_POLICY, type DecidedBy, type Decider, JUDGE_ALLOW, JUDGE_KIND, JUDGE_MODEL, JUDGE_QUESTIONS, type Judgement, judgeModelOf, judgeSpender, judgeState, type OwnerIntent, ownerIntent, POLICY_FILE, REASONS, route, seedPolicy, VERDICT_REASONS, verdictOf, verdictRecorder, } from './approvals/index.ts';
4
4
  export { type ApprovalPolicy, type ApprovalPolicyChange, type ApprovalPolicySet, DEFAULT_APPROVAL_POLICY, type SudoPolicy, } from './approvals/policy.ts';
5
5
  export type { AgentSudo, SudoAnswer, SudoDenial, SudoReply, SudoRequest, } from './approvals/sudo.ts';
6
+ export type { CaptureAsk } from './approvals/sudo-client.ts';
6
7
  export { FILE_LIMIT, IMAGE_LIMIT, type SendAttachment, type ShownAttachment, splitUser, TOTAL_LIMIT, userParts, } from './attachments.ts';
7
8
  export { type AgentConnection, connectAgent } from './client.ts';
8
9
  export type { Clock } from './clock.ts';
9
10
  export { createAgentControl } from './control.ts';
11
+ export type { CaptureAnswer, CaptureDenial, CaptureReply } from './guests/capture.ts';
10
12
  export { connectGuest, GUEST_ONLY, type GuestConnection, SEAT_REFUSED, } from './guests/client.ts';
11
13
  export type { GuestOpened, Proposed, ProposeRequest } from './guests/index.ts';
12
14
  export type { GateKind, GuestPolicy } from './guests/policy.ts';
13
- export type { GuestDraft, GuestGate, GuestGates, GuestSeat } from './guests/seats.ts';
15
+ export type { AlwaysCapture, GuestDraft, GuestGate, GuestGates, GuestSeat, } from './guests/seats.ts';
14
16
  export { type AgentHost, type ConnectOptions, hostAgent } from './host.ts';
15
17
  export type { KernelClient, KernelFs, KernelProcess, KernelStat, SpawnOptions, } from './kernel/client.ts';
16
18
  export { HOME, type KernelEnvOptions, kernelEnvironment, SliccKernelEnv } from './kernel/env.ts';
@@ -1,6 +1,7 @@
1
1
  import type { SudoReply, SudoRequest } from './approvals/sudo.ts';
2
- import { type ApproveOptions } from './approvals/sudo-client.ts';
2
+ import { type ApproveOptions, type CaptureAsk } from './approvals/sudo-client.ts';
3
3
  import { type AgentConnection } from './client.ts';
4
+ import type { CaptureReply } from './guests/capture.ts';
4
5
  import { type KernelSource } from './kernel/users.ts';
5
6
  import type { PortEndpoint } from './wire.ts';
6
7
  export declare const AGENT_LOCK = "slicc-agent";
@@ -21,6 +22,7 @@ export interface AgentOwner {
21
22
  connect(options?: PortOptions): Promise<AgentConnection>;
22
23
  port(options?: PortOptions): Promise<PortEndpoint & Transferable>;
23
24
  approve(request: SudoRequest, options?: ApproveOptions): Promise<SudoReply>;
25
+ approveCapture(request: CaptureAsk, options?: ApproveOptions): Promise<CaptureReply>;
24
26
  restart(): Promise<void>;
25
27
  release(): Promise<void>;
26
28
  }
@@ -349,7 +349,7 @@ export declare const AgentGuestService: RemoteContract;
349
349
  export declare const AgentRemoteService: RemoteContract;
350
350
  export declare const PAGE_METHODS: ("answer" | "close" | "next" | "open" | "report")[];
351
351
  export declare const AgentPagesService: RemoteContract;
352
- export declare const SUDO_METHODS: ("request" | "withdraw")[];
352
+ export declare const SUDO_METHODS: ("capture" | "request" | "withdraw")[];
353
353
  export declare const AgentSudoService: RemoteContract;
354
354
  export interface ModelChoice {
355
355
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-agent",
3
- "version": "7.22.0",
3
+ "version": "7.24.0",
4
4
  "description": "SLICC's agent core on pi durable: an agent worker, session storage, remoting and pi extensions",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -73,10 +73,10 @@
73
73
  },
74
74
  "devDependencies": {
75
75
  "@ai-ecoverse/slicc-jsh": "0.64.0",
76
- "@ai-ecoverse/slicc-kernel": "1.176.0",
76
+ "@ai-ecoverse/slicc-kernel": "1.176.1",
77
77
  "@ai-ecoverse/slicc-scrub": "1.1.0",
78
78
  "@ai-ecoverse/slicc-shared-web": "2.13.10",
79
- "@ai-ecoverse/slicc-spectrum": "2.3.1",
79
+ "@ai-ecoverse/slicc-spectrum": "2.6.0",
80
80
  "@ai-ecoverse/wasi-fnox": "1.45.0-2",
81
81
  "@ai-ecoverse/wasm-bash": "5.3.0-23",
82
82
  "@ai-ecoverse/wasm-coreutils": "9.12.0-15",
@@ -112,7 +112,7 @@
112
112
  },
113
113
  "peerDependencies": {
114
114
  "@ai-ecoverse/slicc-kernel": ">=1.172.2 <2",
115
- "@ai-ecoverse/slicc-spectrum": "^1.112.0 || ^2.0.0"
115
+ "@ai-ecoverse/slicc-spectrum": "^2.4.1"
116
116
  },
117
117
  "peerDependenciesMeta": {
118
118
  "@ai-ecoverse/slicc-spectrum": {