@ai-ecoverse/slicc-agent 7.22.0 → 7.23.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 (41) hide show
  1. package/README.md +21 -8
  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 +2 -2
  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/dist/types/spectrum/approvals-port.d.ts +3 -1
  41. package/package.json +3 -3
@@ -3,7 +3,7 @@ import type { AssistantMessage, ClassifierQuestion, ClassifierResult } from '@ea
3
3
  import type { Models } from '@earendil-works/pi-ai/models';
4
4
  import type { Conversation, ModelRef } from '@earendil-works/pi-durable';
5
5
  import { JUDGE_EPSILON, JUDGE_LOW } from './aligned.ts';
6
- import { type Approval, type ApprovalLevel, type ApprovalVerdict } from './record.ts';
6
+ import { type Approval, type ApprovalLevel, type ApprovalVerdict, type CaptureDetail } from './record.ts';
7
7
  export declare const JUDGE_KIND = "slicc.approval-verdict";
8
8
  export declare const JUDGE_MODEL: ModelRef;
9
9
  export declare const JUDGE_ALWAYS = 0.8;
@@ -80,12 +80,25 @@ export declare const INTENTS: {
80
80
  export type Intent = keyof typeof INTENTS;
81
81
  export declare const WANTS = "wants_";
82
82
  export declare const JUDGE_QUESTIONS: Record<string, ClassifierQuestion>;
83
+ export declare const CAPTURE_QUESTIONS: Record<string, ClassifierQuestion>;
83
84
  export declare const SUDO_QUESTIONS: Record<string, ClassifierQuestion>;
84
85
  export declare const INTENT_QUESTIONS: Record<string, ClassifierQuestion>;
85
86
  export declare const FORBID_QUESTIONS: Record<string, ClassifierQuestion>;
86
87
  export declare function questionsOf(item: Approval): Record<string, ClassifierQuestion>;
87
88
  export declare function fenced(text: string, nonce: string): string;
89
+ export declare function captureAsks(detail: CaptureDetail): string;
88
90
  export declare function untrustedOf(item: Approval): string;
91
+ export type CaptureFacts = {
92
+ asks: string;
93
+ what: CaptureDetail['what'];
94
+ mode: CaptureDetail['mode'];
95
+ seconds: number | null;
96
+ system: boolean;
97
+ microphone: boolean;
98
+ };
99
+ export declare function captureContext(item: Approval): {
100
+ capture?: CaptureFacts;
101
+ };
89
102
  export type SudoFacts = {
90
103
  stdin: string | null;
91
104
  writable: boolean | null;
@@ -96,8 +109,9 @@ export declare function sudoContext(item: Approval): {
96
109
  };
97
110
  export declare function judgeState(item: Approval, intent: OwnerIntent, nonce: string): {
98
111
  request: {
112
+ capture?: CaptureFacts;
99
113
  sudo?: SudoFacts;
100
- kind: "guest-message" | "guest-tool" | "sudo";
114
+ kind: "capture" | "guest-message" | "guest-tool" | "sudo";
101
115
  requester: {
102
116
  kind: "agent" | "guest" | "user";
103
117
  name: string;
@@ -112,8 +126,9 @@ export declare function judgeState(item: Approval, intent: OwnerIntent, nonce: s
112
126
  };
113
127
  export declare function actionState(item: Approval, nonce: string): {
114
128
  request: {
129
+ capture?: CaptureFacts;
115
130
  sudo?: SudoFacts;
116
- kind: "guest-message" | "guest-tool" | "sudo";
131
+ kind: "capture" | "guest-message" | "guest-tool" | "sudo";
117
132
  requester: {
118
133
  kind: "agent" | "guest" | "user";
119
134
  name: string;
@@ -151,6 +166,7 @@ export declare const INTENT_PROMPT: string;
151
166
  export declare function chatAnswers(text: string, questions: Record<string, ClassifierQuestion>): Answers | undefined;
152
167
  export declare const CHAT_QUESTIONS: {
153
168
  guest: Record<string, ClassifierQuestion>;
169
+ capture: Record<string, ClassifierQuestion>;
154
170
  sudo: Record<string, ClassifierQuestion>;
155
171
  intent: Record<string, ClassifierQuestion>;
156
172
  forbidden: Record<string, ClassifierQuestion>;
@@ -184,7 +200,7 @@ export declare function verdictEntry(item: Approval, judgement: Judgement, at: n
184
200
  intent?: Record<string, number>;
185
201
  forbidden?: number | boolean;
186
202
  approval: string;
187
- kind: "guest-message" | "guest-tool" | "sudo";
203
+ kind: "capture" | "guest-message" | "guest-tool" | "sudo";
188
204
  outcome: string;
189
205
  at: number;
190
206
  error?: string | undefined;
@@ -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;
@@ -1,8 +1,9 @@
1
1
  import type { Approval, ApprovalDecision, ApprovalsEvents, ApprovalsPort } from '@ai-ecoverse/slicc-spectrum/ui';
2
- import type { Approval as Item } from '../approvals/record.ts';
2
+ import type { CaptureApproval, Approval as Recorded } from '../approvals/record.ts';
3
3
  import type { AgentConnection } from '../client.ts';
4
4
  import { Emitter } from './emitter.ts';
5
5
  export declare const ARGS_LENGTH = 65536;
6
+ type Item = Exclude<Recorded, CaptureApproval>;
6
7
  export declare function shown(item: Item, agentName: string | undefined): Approval;
7
8
  export type HostApprovals = ApprovalsPort;
8
9
  export declare const NOT_HERE = "This request can't be answered in this tab.";
@@ -12,3 +13,4 @@ export declare class ApprovalsAdapter extends Emitter<ApprovalsEvents> implement
12
13
  constructor(connection: AgentConnection, host?: HostApprovals);
13
14
  list(): readonly Approval[];
14
15
  }
16
+ export {};
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.23.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.5.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",