@ai-ecoverse/slicc-agent 7.21.1 → 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.
- package/README.md +30 -15
- package/dist/approvals/aligned.js +10 -2
- package/dist/approvals/aligned.js.map +2 -2
- package/dist/approvals/attributed.js +13 -0
- package/dist/approvals/attributed.js.map +7 -0
- package/dist/approvals/index.js +9 -26
- package/dist/approvals/index.js.map +2 -2
- package/dist/approvals/judge.js +464 -149
- package/dist/approvals/judge.js.map +3 -3
- package/dist/approvals/policy.js +1 -1
- package/dist/approvals/policy.js.map +2 -2
- package/dist/approvals/record.js +17 -8
- package/dist/approvals/record.js.map +2 -2
- package/dist/approvals/sudo-client.js +32 -1
- package/dist/approvals/sudo-client.js.map +3 -3
- package/dist/approvals/sudo.js +2 -0
- package/dist/approvals/sudo.js.map +2 -2
- package/dist/guests/capture.js +167 -0
- package/dist/guests/capture.js.map +7 -0
- package/dist/guests/index.js +18 -5
- package/dist/guests/index.js.map +2 -2
- package/dist/guests/seats.js.map +2 -2
- package/dist/host.js +8 -0
- package/dist/host.js.map +2 -2
- package/dist/index.js.map +2 -2
- package/dist/owner.js +23 -13
- package/dist/owner.js.map +2 -2
- package/dist/services.js +2 -1
- package/dist/services.js.map +2 -2
- package/dist/spectrum/approvals-port.js +2 -2
- package/dist/spectrum/approvals-port.js.map +2 -2
- package/dist/types/approvals/aligned.d.ts +4 -0
- package/dist/types/approvals/attributed.d.ts +3 -0
- package/dist/types/approvals/judge.d.ts +106 -18
- package/dist/types/approvals/record.d.ts +24 -3
- package/dist/types/approvals/sudo-client.d.ts +8 -0
- package/dist/types/approvals/sudo.d.ts +3 -1
- package/dist/types/guests/capture.d.ts +33 -0
- package/dist/types/guests/seats.d.ts +8 -1
- package/dist/types/index.d.ts +4 -2
- package/dist/types/owner.d.ts +3 -1
- package/dist/types/services.d.ts +1 -1
- package/dist/types/spectrum/approvals-port.d.ts +3 -1
- package/package.json +8 -3
|
@@ -2,29 +2,26 @@ import type { Context } from '@earendil-works/chord';
|
|
|
2
2
|
import type { AssistantMessage, ClassifierQuestion, ClassifierResult } from '@earendil-works/pi-ai';
|
|
3
3
|
import type { Models } from '@earendil-works/pi-ai/models';
|
|
4
4
|
import type { Conversation, ModelRef } from '@earendil-works/pi-durable';
|
|
5
|
-
import
|
|
5
|
+
import { JUDGE_EPSILON, JUDGE_LOW } from './aligned.ts';
|
|
6
|
+
import { type Approval, type ApprovalLevel, type ApprovalVerdict, type CaptureDetail } from './record.ts';
|
|
6
7
|
export declare const JUDGE_KIND = "slicc.approval-verdict";
|
|
7
8
|
export declare const JUDGE_MODEL: ModelRef;
|
|
8
9
|
export declare const JUDGE_ALWAYS = 0.8;
|
|
9
10
|
export declare const JUDGE_CUT = 0.5;
|
|
10
11
|
export declare const JUDGE_HARM = 0.4;
|
|
11
|
-
export declare const
|
|
12
|
+
export declare const JUDGE_PLACE = 0.05;
|
|
13
|
+
export { JUDGE_EPSILON, JUDGE_LOW };
|
|
12
14
|
export declare const JUDGE_TIMEOUT = 15000;
|
|
13
15
|
export declare const ASK_MIN_MS = 30000;
|
|
14
16
|
export declare const UNTRUSTED_LIMIT = 4000;
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const
|
|
17
|
+
export declare const JUDGE_TOKENS = 600;
|
|
18
|
+
export declare const INTENTS_KEPT = 16;
|
|
17
19
|
export declare const JUDGE_LATE = "the check didn't answer in time";
|
|
18
20
|
export declare const JUDGE_RESTARTED = "the agent restarted before the check answered";
|
|
19
|
-
export type Reasoned = {
|
|
20
|
-
reason?: string;
|
|
21
|
-
cost?: number | null;
|
|
22
|
-
};
|
|
23
21
|
export interface Judgement {
|
|
24
22
|
verdict?: ApprovalVerdict;
|
|
25
23
|
error?: string;
|
|
26
24
|
cost?: number | null;
|
|
27
|
-
reason?: Promise<Reasoned>;
|
|
28
25
|
}
|
|
29
26
|
export interface ApprovalJudge {
|
|
30
27
|
judge(item: Approval, context: Context): Promise<Judgement>;
|
|
@@ -45,6 +42,7 @@ export interface JudgeOptions {
|
|
|
45
42
|
timeoutMs?: number;
|
|
46
43
|
spend?(item: Approval, result: Spent, context: Context): Promise<void>;
|
|
47
44
|
}
|
|
45
|
+
export declare const VETO_REASON = "The owner's words may rule this out.";
|
|
48
46
|
export declare const VERDICT_REASONS: {
|
|
49
47
|
readonly routine: 'It looks like routine work.';
|
|
50
48
|
readonly permissions: 'The check leaned toward a change in who may do what.';
|
|
@@ -55,10 +53,52 @@ export declare const LEVELS: {
|
|
|
55
53
|
readonly permissions: 'it changes who may do what: sudoers, users and groups, ownership or modes of system files, secret rules (/etc/fnox, /etc/slicc/secrets-policy.toml), the approvals policy, guest seats, credentials and tokens';
|
|
56
54
|
readonly harm: "it would damage the system or the work in a way that is hard to undo: delete or overwrite system files or others' work, lock the owner out, or expose secrets or private work to anyone but the owner";
|
|
57
55
|
};
|
|
56
|
+
export declare const ACTIONS: {
|
|
57
|
+
readonly changes: 'Does it change anything on the system: create, change, move, copy or delete a file, a user, a setting or a running process?';
|
|
58
|
+
readonly others: "Does it create, change, move or delete anything in another user's home directory?";
|
|
59
|
+
readonly system: 'Does it create, change, move or delete system files, such as anything under /etc, /usr, /bin, /var, /root or a directory at the top of /?';
|
|
60
|
+
readonly delete: 'Does it delete or empty any file or directory?';
|
|
61
|
+
readonly permissions: 'Does it change permissions, ownership, users, groups, sudoers, secret rules or credentials?';
|
|
62
|
+
readonly code: "Does it run code or write output in a way the line itself doesn't spell out, such as a script file, a package install, xargs, find -exec or -delete, a pipe into a shell, a redirection (> or >>), a command substitution ($(...) or backticks), an output option such as sort -o or tee, a download with curl or wget, or git, which can run hooks, a pager or aliases; pass a program to an interpreter, such as sh -c, python -c, awk, sed or jq; or open an interactive program that can run other commands, such as an editor, a pager or a shell?";
|
|
63
|
+
readonly services: 'Does it stop, kill or restart processes or services, change system settings, mount or unmount, or reboot or shut down the machine?';
|
|
64
|
+
readonly send: 'Does it send data off this machine, over the network, or publish, push or message anything?';
|
|
65
|
+
readonly secrets: 'Would its output show the value of a secret, token, password or private key, including through a dump of environment variables (env, printenv, /proc/*/environ, ps e), shell history, or a configuration or credentials file that can hold them (git config, .netrc, .npmrc, cloud or kube configs)?';
|
|
66
|
+
readonly plain: 'Is it a standard Unix tool, such as ls, cat, head, grep, find, du, stat, cp, mv, rm, mkdir or chown, whose whole effect you can tell from its options and paths?';
|
|
67
|
+
readonly always: "request.sudo has what the kernel knows that the requester cannot choose: stdin (tty, none, pipe or file), writable (whether the line can be recorded as a rule) and rootOnly (whether only root can change the directory and every path on the line). Could a later run of exactly this line do something different from this one, because it reads piped or file input, runs a script or a file someone other than root can change, takes code on the line, or is interactive?";
|
|
68
|
+
};
|
|
69
|
+
export type Action = keyof typeof ACTIONS;
|
|
70
|
+
export declare const INTENTS: {
|
|
71
|
+
readonly read: 'Does the owner ask the agent to read, look at, list, check, review or find something in files or on the system?';
|
|
72
|
+
readonly write: 'Does the owner want the agent to create, change, copy or move files?';
|
|
73
|
+
readonly delete: 'Does the owner ask the agent to delete, remove or clear out files, directories or users?';
|
|
74
|
+
readonly permissions: 'Does the owner ask the agent to change permissions, ownership, users, groups, sudoers, secret rules or credentials?';
|
|
75
|
+
readonly code: 'Does the owner ask the agent to install software, or to run scripts or programs?';
|
|
76
|
+
readonly send: 'Does the owner ask the agent to send something off this machine: push, publish, post, upload or message someone?';
|
|
77
|
+
readonly secrets: 'Does the owner ask the agent to show or print the value of a secret, token, password or private key?';
|
|
78
|
+
readonly services: 'Does the owner ask the agent to stop, restart or reconfigure services, processes or system settings?';
|
|
79
|
+
};
|
|
80
|
+
export type Intent = keyof typeof INTENTS;
|
|
81
|
+
export declare const WANTS = "wants_";
|
|
58
82
|
export declare const JUDGE_QUESTIONS: Record<string, ClassifierQuestion>;
|
|
83
|
+
export declare const CAPTURE_QUESTIONS: Record<string, ClassifierQuestion>;
|
|
84
|
+
export declare const SUDO_QUESTIONS: Record<string, ClassifierQuestion>;
|
|
85
|
+
export declare const INTENT_QUESTIONS: Record<string, ClassifierQuestion>;
|
|
86
|
+
export declare const FORBID_QUESTIONS: Record<string, ClassifierQuestion>;
|
|
59
87
|
export declare function questionsOf(item: Approval): Record<string, ClassifierQuestion>;
|
|
60
88
|
export declare function fenced(text: string, nonce: string): string;
|
|
89
|
+
export declare function captureAsks(detail: CaptureDetail): string;
|
|
61
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
|
+
};
|
|
62
102
|
export type SudoFacts = {
|
|
63
103
|
stdin: string | null;
|
|
64
104
|
writable: boolean | null;
|
|
@@ -69,8 +109,9 @@ export declare function sudoContext(item: Approval): {
|
|
|
69
109
|
};
|
|
70
110
|
export declare function judgeState(item: Approval, intent: OwnerIntent, nonce: string): {
|
|
71
111
|
request: {
|
|
112
|
+
capture?: CaptureFacts;
|
|
72
113
|
sudo?: SudoFacts;
|
|
73
|
-
kind: "guest-message" | "guest-tool" | "sudo";
|
|
114
|
+
kind: "capture" | "guest-message" | "guest-tool" | "sudo";
|
|
74
115
|
requester: {
|
|
75
116
|
kind: "agent" | "guest" | "user";
|
|
76
117
|
name: string;
|
|
@@ -83,19 +124,63 @@ export declare function judgeState(item: Approval, intent: OwnerIntent, nonce: s
|
|
|
83
124
|
memory: string[];
|
|
84
125
|
};
|
|
85
126
|
};
|
|
127
|
+
export declare function actionState(item: Approval, nonce: string): {
|
|
128
|
+
request: {
|
|
129
|
+
capture?: CaptureFacts;
|
|
130
|
+
sudo?: SudoFacts;
|
|
131
|
+
kind: "capture" | "guest-message" | "guest-tool" | "sudo";
|
|
132
|
+
requester: {
|
|
133
|
+
kind: "agent" | "guest" | "user";
|
|
134
|
+
name: string;
|
|
135
|
+
};
|
|
136
|
+
untrusted: string;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
export declare function intentState(intent: OwnerIntent): {
|
|
140
|
+
owner: {
|
|
141
|
+
policy: string;
|
|
142
|
+
messages: string[];
|
|
143
|
+
memory: string[];
|
|
144
|
+
};
|
|
145
|
+
};
|
|
86
146
|
export declare function levelOf(probabilities: Record<string, number>): ApprovalLevel | undefined;
|
|
87
147
|
export declare function fallbackReason(level: ApprovalLevel): string;
|
|
148
|
+
export type Answers = ClassifierResult['answers'];
|
|
88
149
|
export declare function verdictOf(result: ClassifierResult, model: string): Judgement;
|
|
89
|
-
export
|
|
90
|
-
export declare function judgePrompt(item: Approval, chat: boolean): string;
|
|
91
|
-
export declare function chatAnswer(text: string): {
|
|
150
|
+
export type Match = {
|
|
92
151
|
level: ApprovalLevel;
|
|
93
|
-
|
|
152
|
+
routine: number;
|
|
153
|
+
aligned: number;
|
|
94
154
|
always: boolean;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
155
|
+
needs: Intent[];
|
|
156
|
+
missing: Intent[];
|
|
157
|
+
};
|
|
158
|
+
export declare const barOf: (p: Record<Action, number>, action: Action) => number;
|
|
159
|
+
export declare const flagged: (p: Record<Action, number>, action: Action) => boolean;
|
|
160
|
+
export declare function matchOf(actions: Record<Action, number>, intent: Record<Intent, number>): Match;
|
|
161
|
+
export declare function sudoReason(actions: Record<Action, number>, match: Match): string;
|
|
162
|
+
export declare function sudoVerdict(answers: Answers, model: string, via: 'classifier' | 'chat'): ApprovalVerdict | undefined;
|
|
163
|
+
export declare function judgePrompt(item: Approval): string;
|
|
164
|
+
export declare const FORBID_PROMPT: string;
|
|
165
|
+
export declare const INTENT_PROMPT: string;
|
|
166
|
+
export declare function chatAnswers(text: string, questions: Record<string, ClassifierQuestion>): Answers | undefined;
|
|
167
|
+
export declare const CHAT_QUESTIONS: {
|
|
168
|
+
guest: Record<string, ClassifierQuestion>;
|
|
169
|
+
capture: Record<string, ClassifierQuestion>;
|
|
170
|
+
sudo: Record<string, ClassifierQuestion>;
|
|
171
|
+
intent: Record<string, ClassifierQuestion>;
|
|
172
|
+
forbidden: Record<string, ClassifierQuestion>;
|
|
173
|
+
};
|
|
174
|
+
export declare const VETO_ASKS = 2;
|
|
175
|
+
export declare function vetoOf(verdict: ApprovalVerdict, checks: Classified[], cost: number | null): Judgement;
|
|
98
176
|
export declare function judgeModelOf(text: string | undefined): ModelRef | null;
|
|
177
|
+
type Classified = {
|
|
178
|
+
answers: Answers;
|
|
179
|
+
cost: number | null;
|
|
180
|
+
} | {
|
|
181
|
+
error: string;
|
|
182
|
+
cost?: number | null;
|
|
183
|
+
};
|
|
99
184
|
export declare function approvalJudge(options: JudgeOptions): ApprovalJudge['judge'];
|
|
100
185
|
export declare function verdictEntry(item: Approval, judgement: Judgement, at: number): {
|
|
101
186
|
type: 'write';
|
|
@@ -111,8 +196,11 @@ export declare function verdictEntry(item: Approval, judgement: Judgement, at: n
|
|
|
111
196
|
via?: 'classifier' | 'chat';
|
|
112
197
|
risk?: number;
|
|
113
198
|
model?: string;
|
|
199
|
+
actions?: Record<string, number>;
|
|
200
|
+
intent?: Record<string, number>;
|
|
201
|
+
forbidden?: number | boolean;
|
|
114
202
|
approval: string;
|
|
115
|
-
kind: "guest-message" | "guest-tool" | "sudo";
|
|
203
|
+
kind: "capture" | "guest-message" | "guest-tool" | "sudo";
|
|
116
204
|
outcome: string;
|
|
117
205
|
at: number;
|
|
118
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';
|
|
@@ -23,6 +23,9 @@ export type ApprovalVerdict = {
|
|
|
23
23
|
via?: 'classifier' | 'chat';
|
|
24
24
|
risk?: number;
|
|
25
25
|
model?: string;
|
|
26
|
+
actions?: Record<string, number>;
|
|
27
|
+
intent?: Record<string, number>;
|
|
28
|
+
forbidden?: number | boolean;
|
|
26
29
|
};
|
|
27
30
|
export type ApprovalAttachment = {
|
|
28
31
|
name: string;
|
|
@@ -49,6 +52,17 @@ export type SudoDetail = {
|
|
|
49
52
|
rootOnly?: Record<string, boolean>;
|
|
50
53
|
writable?: boolean;
|
|
51
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
|
+
};
|
|
52
66
|
type Base = {
|
|
53
67
|
id: string;
|
|
54
68
|
seat?: string;
|
|
@@ -81,14 +95,18 @@ export type SudoApproval = Base & {
|
|
|
81
95
|
kind: 'sudo';
|
|
82
96
|
detail: SudoDetail;
|
|
83
97
|
};
|
|
84
|
-
export type
|
|
98
|
+
export type CaptureApproval = Base & {
|
|
99
|
+
kind: 'capture';
|
|
100
|
+
detail: CaptureDetail;
|
|
101
|
+
};
|
|
102
|
+
export type Approval = GuestMessageApproval | GuestToolApproval | SudoApproval | CaptureApproval;
|
|
85
103
|
type DraftOf<T extends Approval> = Pick<T, 'kind' | 'detail' | 'agentId' | 'requester'> & {
|
|
86
104
|
seat?: string;
|
|
87
105
|
tier: string;
|
|
88
106
|
always?: boolean;
|
|
89
107
|
expiresAt?: number;
|
|
90
108
|
};
|
|
91
|
-
export type ApprovalDraft = DraftOf<GuestMessageApproval> | DraftOf<GuestToolApproval> | DraftOf<SudoApproval>;
|
|
109
|
+
export type ApprovalDraft = DraftOf<GuestMessageApproval> | DraftOf<GuestToolApproval> | DraftOf<SudoApproval> | DraftOf<CaptureApproval>;
|
|
92
110
|
export type ApprovalsState = {
|
|
93
111
|
items: Approval[];
|
|
94
112
|
};
|
|
@@ -114,6 +132,7 @@ export declare const REASONS: {
|
|
|
114
132
|
export declare const guestKind: (kind: ApprovalKind) => boolean;
|
|
115
133
|
export declare const scoopTier: (tier: unknown) => tier is `scoop:${string}`;
|
|
116
134
|
export declare function knownTier(tier: unknown): tier is ApprovalTier;
|
|
135
|
+
export declare const heldKind: (kind: ApprovalKind) => boolean;
|
|
117
136
|
export declare function routable(kind: ApprovalKind, tier: ApprovalTier): boolean;
|
|
118
137
|
export declare function answerOf(value: unknown): ApprovalAnswer | null;
|
|
119
138
|
export declare const personal: (by: DecidedBy) => boolean;
|
|
@@ -124,6 +143,8 @@ export declare const tierOf: (kind: ApprovalKind, tier: string, sudo: SudoApprov
|
|
|
124
143
|
export type Gate = 'person' | 'judge';
|
|
125
144
|
export type Routed = 'approve' | 'deny' | 'ask';
|
|
126
145
|
export declare const gateOf: (tier: string) => Gate;
|
|
146
|
+
export declare const vetoed: ({ forbidden }: ApprovalVerdict) => boolean;
|
|
147
|
+
export declare function approvable(verdict: ApprovalVerdict): boolean;
|
|
127
148
|
export declare function route(verdict: ApprovalVerdict | undefined, requester: Pick<ApprovalRequester, 'kind'>, gate: Gate, present: boolean): Routed;
|
|
128
149
|
export declare function alwaysOffered(item: Approval): boolean;
|
|
129
150
|
export declare function gone(state: ApprovalState): string;
|
|
@@ -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>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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';
|
package/dist/types/owner.d.ts
CHANGED
|
@@ -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
|
}
|
package/dist/types/services.d.ts
CHANGED
|
@@ -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
|
|
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.
|
|
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.
|
|
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": "
|
|
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",
|
|
@@ -92,6 +92,11 @@
|
|
|
92
92
|
"slicc-agent-5": "npm:@ai-ecoverse/slicc-agent@5.10.1",
|
|
93
93
|
"typescript": "7.0.2"
|
|
94
94
|
},
|
|
95
|
+
"overrides": {
|
|
96
|
+
"slicc-agent-5": {
|
|
97
|
+
"@ai-ecoverse/slicc-spectrum": "$@ai-ecoverse/slicc-spectrum"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
95
100
|
"dependencies": {
|
|
96
101
|
"@ai-ecoverse/slicc-vault": "1.24.0",
|
|
97
102
|
"@aws-sdk/middleware-websocket": "^3.972.54",
|