@ai-ecoverse/slicc-agent 5.4.1 → 5.5.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 +26 -8
- package/dist/approvals/index.js +2 -1
- package/dist/approvals/index.js.map +2 -2
- package/dist/approvals/policy.js +110 -0
- package/dist/approvals/policy.js.map +7 -0
- package/dist/client.js +1 -0
- package/dist/client.js.map +2 -2
- package/dist/control.js.map +2 -2
- package/dist/guests/client.js +6 -3
- package/dist/guests/client.js.map +2 -2
- package/dist/guests/index.js +4 -1
- package/dist/guests/index.js.map +2 -2
- package/dist/guests/policy.js +75 -0
- package/dist/guests/policy.js.map +7 -0
- package/dist/guests/seats.js +16 -6
- package/dist/guests/seats.js.map +2 -2
- package/dist/guests/serve.js +8 -2
- package/dist/guests/serve.js.map +2 -2
- package/dist/host.js +35 -28
- package/dist/host.js.map +2 -2
- package/dist/index.js +4 -0
- package/dist/index.js.map +2 -2
- package/dist/services.js +12 -3
- 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/spectrum/guest-port.js +14 -4
- package/dist/spectrum/guest-port.js.map +2 -2
- package/dist/spectrum/index.js +3 -1
- package/dist/spectrum/index.js.map +2 -2
- package/dist/types/approvals/index.d.ts +2 -1
- package/dist/types/approvals/policy.d.ts +38 -0
- package/dist/types/client.d.ts +2 -0
- package/dist/types/control.d.ts +1 -1
- package/dist/types/guests/index.d.ts +4 -0
- package/dist/types/guests/policy.d.ts +23 -0
- package/dist/types/guests/seats.d.ts +2 -1
- package/dist/types/host.d.ts +1 -3
- package/dist/types/index.d.ts +2 -0
- package/dist/types/services.d.ts +11 -3
- package/dist/types/spectrum/guest-port.d.ts +8 -3
- package/dist/types/spectrum/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -2,7 +2,9 @@ import { type Context, type ReplicatedState } from '@earendil-works/chord';
|
|
|
2
2
|
import { type Harness } from '@earendil-works/pi-durable';
|
|
3
3
|
import type { Agents } from '../agents.ts';
|
|
4
4
|
import type { Approvals } from '../approvals/index.ts';
|
|
5
|
+
import type { ApprovalPolicies } from '../approvals/policy.ts';
|
|
5
6
|
import type { GuestPrincipal } from '../serving.ts';
|
|
7
|
+
import { type GuestPolicy } from './policy.ts';
|
|
6
8
|
import { type GuestDraft, type GuestSeat, type SeatRecord } from './seats.ts';
|
|
7
9
|
export type GuestOpened = {
|
|
8
10
|
seat: GuestSeat;
|
|
@@ -41,12 +43,14 @@ export interface Guests {
|
|
|
41
43
|
joined(id: string): () => void;
|
|
42
44
|
onEnd(listener: (id: string) => void): () => void;
|
|
43
45
|
propose(guest: GuestPrincipal, request: ProposeRequest, context: Context): Promise<Proposed>;
|
|
46
|
+
policy(): GuestPolicy;
|
|
44
47
|
dispose(): void;
|
|
45
48
|
}
|
|
46
49
|
export interface GuestsOptions {
|
|
47
50
|
harness: Pick<Harness, 'commit' | 'abortSubmission'>;
|
|
48
51
|
agents: Pick<Agents, 'state' | 'conversation'>;
|
|
49
52
|
approvals?: Pick<Approvals, 'state' | 'request' | 'withdrawSeat'>;
|
|
53
|
+
policy?: Pick<ApprovalPolicies, 'current'>;
|
|
50
54
|
now?: () => number;
|
|
51
55
|
context?: Context;
|
|
52
56
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ApprovalTier } from '../approvals/record.ts';
|
|
2
|
+
export type GateKind = 'user' | 'agent' | 'scoop' | 'cone' | 'off';
|
|
3
|
+
export type GuestPolicy = {
|
|
4
|
+
manageGuests: 'deny' | ApprovalTier;
|
|
5
|
+
allowedToolGates: GateKind[];
|
|
6
|
+
allowedMessageGates: GateKind[];
|
|
7
|
+
maxSeatDays: number;
|
|
8
|
+
always: {
|
|
9
|
+
messages: boolean;
|
|
10
|
+
tools: boolean;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export type GuestPolicyChange = Partial<GuestPolicy>;
|
|
14
|
+
export declare const GATE_KINDS: readonly GateKind[];
|
|
15
|
+
export declare const DEFAULT_GUEST_POLICY: GuestPolicy;
|
|
16
|
+
export declare const MAX_SEAT_DAYS = 365;
|
|
17
|
+
export declare const DAY_MS: number;
|
|
18
|
+
export declare const GUESTS_MANAGE_DENIED = "The owner's guest policy doesn't let guests manage guests.";
|
|
19
|
+
export declare const GUESTS_MANAGE_LATER = "Guests can't manage guests yet, whatever the policy says.";
|
|
20
|
+
export declare const POLICY_MANAGE_DENY_ONLY = "manageGuests can only be deny: guests can't manage guests yet.";
|
|
21
|
+
export declare const gateKind: (gate: string) => GateKind;
|
|
22
|
+
export declare function gateRefusal(what: string, allowed: readonly GateKind[]): string;
|
|
23
|
+
export declare function changedGuests(next: GuestPolicy, change: unknown): string | null;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ApprovalTier } from '../approvals/record.ts';
|
|
2
|
+
import { type GuestPolicy } from './policy.ts';
|
|
2
3
|
export type GuestGate = ApprovalTier | 'off';
|
|
3
4
|
export type GuestGates = {
|
|
4
5
|
messages: GuestGate;
|
|
@@ -35,5 +36,5 @@ export declare const MAX_SEAT_MS: number;
|
|
|
35
36
|
export declare const MAX_LABEL = 64;
|
|
36
37
|
export declare function cleanLabel(raw: unknown): string;
|
|
37
38
|
export declare function isGate(value: unknown): value is GuestGate;
|
|
38
|
-
export declare function checkDraft(draft: GuestDraft, now: number): string | null;
|
|
39
|
+
export declare function checkDraft(draft: GuestDraft, now: number, policy?: GuestPolicy): string | null;
|
|
39
40
|
export declare function liveSeat(seat: SeatRecord | undefined, now: number): boolean;
|
package/dist/types/host.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { type Pages } from './remote/pages.ts';
|
|
|
14
14
|
import type { SecretName } from './secrets/names.ts';
|
|
15
15
|
import type { VaultState } from './secrets/vault.ts';
|
|
16
16
|
import { AgentControl, type AgentGuest, AgentSettings, AgentTranscript } from './services.ts';
|
|
17
|
-
import { type GuestPrincipal
|
|
17
|
+
import { type GuestPrincipal } from './serving.ts';
|
|
18
18
|
import type { SkillsRuntime } from './skills/index.ts';
|
|
19
19
|
import type { SprinklesRuntime } from './sprinkles/index.ts';
|
|
20
20
|
import { type Thumbnail } from './thumbs.ts';
|
|
@@ -84,7 +84,5 @@ export declare const CLOSED_TO_GUESTS = "a guest seat has only its transcript an
|
|
|
84
84
|
export declare const openToGuests: <F extends object>(factory: F) => F;
|
|
85
85
|
export declare function closedToGuests(host: Host): Host;
|
|
86
86
|
export declare function lazily<T>(state: () => ReplicatedState<T>): Readable<T>;
|
|
87
|
-
export declare const GUEST_MANAGERS: ReadonlySet<Seat>;
|
|
88
|
-
export declare const OWNER_GUESTS = "only the owner can invite or revoke guests";
|
|
89
87
|
export declare function serveAgent(serving: Served): Host;
|
|
90
88
|
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
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
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, approvalJudge, attachApprovals, DEFAULT_POLICY, type DecidedBy, JUDGE_ALLOW, JUDGE_DENY, JUDGE_KIND, JUDGE_MODEL, JUDGE_QUESTIONS, type Judgement, judgeModelOf, judgeSpender, judgeState, type OwnerIntent, ownerIntent, POLICY_FILE, REASONS, seedPolicy, VERDICT_REASONS, verdictOf, verdictRecorder, } from './approvals/index.ts';
|
|
4
|
+
export { type ApprovalPolicy, type ApprovalPolicyChange, type ApprovalPolicySet, DEFAULT_APPROVAL_POLICY, type SudoPolicy, } from './approvals/policy.ts';
|
|
4
5
|
export { FILE_LIMIT, IMAGE_LIMIT, type SendAttachment, type ShownAttachment, splitUser, TOTAL_LIMIT, userParts, } from './attachments.ts';
|
|
5
6
|
export { type AgentConnection, connectAgent } from './client.ts';
|
|
6
7
|
export { createAgentControl } from './control.ts';
|
|
7
8
|
export { connectGuest, GUEST_ONLY, type GuestConnection, SEAT_REFUSED, } from './guests/client.ts';
|
|
8
9
|
export type { GuestOpened, Proposed, ProposeRequest } from './guests/index.ts';
|
|
10
|
+
export type { GateKind, GuestPolicy } from './guests/policy.ts';
|
|
9
11
|
export type { GuestDraft, GuestGate, GuestGates, GuestSeat } from './guests/seats.ts';
|
|
10
12
|
export { type AgentHost, type ConnectOptions, hostAgent } from './host.ts';
|
|
11
13
|
export type { KernelClient, KernelFs, KernelProcess, KernelStat, SpawnOptions, } from './kernel/client.ts';
|
package/dist/types/services.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Context, JsonValue, RemoteContract, ReplicatedState } from '@earendil-works/chord';
|
|
2
2
|
import type { ConversationView } from '@earendil-works/pi-durable';
|
|
3
3
|
import type { Approval, ApprovalAnswer, ApprovalDecided } from './approvals/index.ts';
|
|
4
|
+
import type { ApprovalPolicy, ApprovalPolicyChange, ApprovalPolicySet } from './approvals/policy.ts';
|
|
4
5
|
import type { SendAttachment, ShownAttachment } from './attachments.ts';
|
|
5
6
|
import type { ChangesView } from './changes/git.ts';
|
|
6
7
|
import type { FrozenCone } from './freezer/index.ts';
|
|
@@ -94,6 +95,7 @@ export interface AgentControl {
|
|
|
94
95
|
guestRevoke(id: string, context: Context): Promise<{
|
|
95
96
|
revoked: boolean;
|
|
96
97
|
}>;
|
|
98
|
+
approvalPolicySet(change: ApprovalPolicyChange, context: Context): Promise<ApprovalPolicySet>;
|
|
97
99
|
decide(id: string, decision: ApprovalAnswer, reason: string | null, context: Context): Promise<ApprovalDecided>;
|
|
98
100
|
}
|
|
99
101
|
export interface ImageRef {
|
|
@@ -239,7 +241,8 @@ export interface AgentSettingsChange {
|
|
|
239
241
|
thinkingLevel: 'off' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max' | null;
|
|
240
242
|
agentId?: string | null;
|
|
241
243
|
}
|
|
242
|
-
export declare const CONTROL_METHODS: ("abort" | "agentCommands" | "changeAccept" | "changeRevert" | "changesOpen" | "compact" | "compactAgent" | "configure" | "createCone" | "createScoop" | "decide" | "discard" | "drop" | "freeze" | "guestOpen" | "guestRevoke" | "image" | "memoryRemove" | "memorySave" | "monitorClose" | "monitorOpen" | "newChat" | "reset" | "resolveAgentLick" | "resolveLick" | "rewind" | "rewindAgent" | "selectCone" | "send" | "sprinkleCall" | "sprinkleSend" | "stopAgent" | "thaw" | "toolLabel" | "unqueue" | "wait" | "webhook" | "withdraw")[];
|
|
244
|
+
export declare const CONTROL_METHODS: ("abort" | "agentCommands" | "approvalPolicySet" | "changeAccept" | "changeRevert" | "changesOpen" | "compact" | "compactAgent" | "configure" | "createCone" | "createScoop" | "decide" | "discard" | "drop" | "freeze" | "guestOpen" | "guestRevoke" | "image" | "memoryRemove" | "memorySave" | "monitorClose" | "monitorOpen" | "newChat" | "reset" | "resolveAgentLick" | "resolveLick" | "rewind" | "rewindAgent" | "selectCone" | "send" | "sprinkleCall" | "sprinkleSend" | "stopAgent" | "thaw" | "toolLabel" | "unqueue" | "wait" | "webhook" | "withdraw")[];
|
|
245
|
+
export declare const OWNER_DEVICE_METHODS: readonly (keyof AgentControl & string)[];
|
|
243
246
|
export declare const CONTROL_READS: readonly (keyof AgentControl & string)[];
|
|
244
247
|
export declare const AgentControl: RemoteContract;
|
|
245
248
|
export type Delivered = 'run' | 'steer' | 'follow-up';
|
|
@@ -260,6 +263,7 @@ export interface AgentTranscript {
|
|
|
260
263
|
readonly labels: ReplicatedState<Record<string, string>>;
|
|
261
264
|
readonly guests: ReplicatedState<GuestSeat[]>;
|
|
262
265
|
readonly approvals: ReplicatedState<Approval[]>;
|
|
266
|
+
readonly approvalPolicy: ReplicatedState<ApprovalPolicy>;
|
|
263
267
|
}
|
|
264
268
|
export interface PrivateRevision {
|
|
265
269
|
revision: number;
|
|
@@ -269,7 +273,7 @@ export interface Command {
|
|
|
269
273
|
description: string;
|
|
270
274
|
kind: 'prompt' | 'skill' | 'action';
|
|
271
275
|
}
|
|
272
|
-
export declare const TRANSCRIPT_STATES: ("agents" | "approvals" | "changes" | "commands" | "deliveries" | "frozen" | "guests" | "labels" | "memories" | "memoryScopes" | "monitor" | "privateRevision" | "sprinkles" | "state" | "vault" | "views")[];
|
|
276
|
+
export declare const TRANSCRIPT_STATES: ("agents" | "approvalPolicy" | "approvals" | "changes" | "commands" | "deliveries" | "frozen" | "guests" | "labels" | "memories" | "memoryScopes" | "monitor" | "privateRevision" | "sprinkles" | "state" | "vault" | "views")[];
|
|
273
277
|
export declare const AgentTranscript: RemoteContract;
|
|
274
278
|
export declare const REMOTE_METHODS: ("abort" | "close" | "next" | "prompt" | "watch")[];
|
|
275
279
|
export declare const REMOTE_READS: readonly (keyof AgentRemote & string)[];
|
|
@@ -294,9 +298,13 @@ export interface AgentGuest {
|
|
|
294
298
|
readonly seat: ReplicatedState<GuestShown>;
|
|
295
299
|
readonly proposals: ReplicatedState<GuestProposal[]>;
|
|
296
300
|
propose(request: ProposeRequest, context: Context): Promise<Proposed>;
|
|
301
|
+
guestOpen(draft: GuestDraft, context: Context): Promise<GuestOpened>;
|
|
302
|
+
guestRevoke(id: string, context: Context): Promise<{
|
|
303
|
+
revoked: boolean;
|
|
304
|
+
}>;
|
|
297
305
|
}
|
|
298
306
|
export declare const GUEST_STATES: readonly ['transcript', 'seat', 'proposals'];
|
|
299
|
-
export declare const GUEST_METHODS: readonly ['propose'];
|
|
307
|
+
export declare const GUEST_METHODS: readonly ['propose', 'guestOpen', 'guestRevoke'];
|
|
300
308
|
export declare const AgentGuestService: RemoteContract;
|
|
301
309
|
export declare const AgentRemoteService: RemoteContract;
|
|
302
310
|
export declare const PAGE_METHODS: ("answer" | "close" | "next" | "open" | "report")[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GuestDraft, GuestEvents, GuestPort, GuestSeat } from '@ai-ecoverse/slicc-spectrum/ui';
|
|
1
|
+
import type { GuestDraft, GuestEvents, GuestGate, GuestPort, GuestSeat } from '@ai-ecoverse/slicc-spectrum/ui';
|
|
2
2
|
import type { AgentConnection } from '../client.ts';
|
|
3
3
|
import { Emitter } from './emitter.ts';
|
|
4
4
|
export interface GuestHub {
|
|
@@ -11,12 +11,17 @@ export interface GuestHub {
|
|
|
11
11
|
revoke(id: string): Promise<void>;
|
|
12
12
|
}
|
|
13
13
|
export declare const NO_HUB = "Inviting guests needs the tray hub.";
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
14
|
+
export declare const NOT_OWNER_DEVICE = "Only the owner's devices can invite guests.";
|
|
15
|
+
export declare const NO_CONTROL = "Only the owner's devices can invite guests.";
|
|
16
|
+
export declare const NO_OWNER = "Only the owner's devices can invite guests.";
|
|
16
17
|
export declare class GuestAdapter extends Emitter<GuestEvents> implements GuestPort {
|
|
17
18
|
#private;
|
|
18
19
|
constructor(connection: AgentConnection, hub: GuestHub | null);
|
|
19
20
|
list(): readonly GuestSeat[];
|
|
21
|
+
gates(): {
|
|
22
|
+
messages: GuestGate[];
|
|
23
|
+
tools: GuestGate[];
|
|
24
|
+
};
|
|
20
25
|
unavailable(): string | null;
|
|
21
26
|
mint(agentId: string, draft: GuestDraft): Promise<{
|
|
22
27
|
seat: GuestSeat;
|
|
@@ -15,7 +15,7 @@ import { TrayAdapter } from './tray-port.ts';
|
|
|
15
15
|
export { AgentAdapter, CONE } from './agent-port.ts';
|
|
16
16
|
export { ApprovalsAdapter, type HostApprovals, NOT_HERE, shown as shownApproval, } from './approvals-port.ts';
|
|
17
17
|
export { ChangesAdapter, type ChangesEvents } from './changes-port.ts';
|
|
18
|
-
export { GuestAdapter, type GuestHub, NO_CONTROL, NO_HUB, NO_OWNER, } from './guest-port.ts';
|
|
18
|
+
export { GuestAdapter, type GuestHub, NO_CONTROL, NO_HUB, NO_OWNER, NOT_OWNER_DEVICE, } from './guest-port.ts';
|
|
19
19
|
export { MemoryAdapter } from './memory-port.ts';
|
|
20
20
|
export { assistant, errorAction, errorPart, isBusy, queued, textOf, toMessages, } from './messages.ts';
|
|
21
21
|
export { MonitorAdapter, type MonitorAdapterOptions, type MonitorInput, monitorSnapshot, } from './monitor-port.ts';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-agent",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.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",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
94
|
"@ai-ecoverse/slicc-kernel": ">=1.90.0 <2",
|
|
95
|
-
"@ai-ecoverse/slicc-spectrum": "^1.
|
|
95
|
+
"@ai-ecoverse/slicc-spectrum": "^1.80.0"
|
|
96
96
|
},
|
|
97
97
|
"peerDependenciesMeta": {
|
|
98
98
|
"@ai-ecoverse/slicc-spectrum": {
|