@ai-ecoverse/slicc-agent 5.1.0 → 5.3.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 -3
- package/dist/agent.js +6 -1
- package/dist/agent.js.map +2 -2
- package/dist/approvals/index.js +63 -13
- package/dist/approvals/index.js.map +2 -2
- package/dist/approvals/intent.js +85 -0
- package/dist/approvals/intent.js.map +7 -0
- package/dist/approvals/judge.js +207 -0
- package/dist/approvals/judge.js.map +7 -0
- package/dist/approvals/record.js +2 -1
- package/dist/approvals/record.js.map +2 -2
- package/dist/client.js +3 -0
- package/dist/client.js.map +2 -2
- package/dist/control.js +10 -4
- package/dist/control.js.map +2 -2
- package/dist/guests/attribution.js +22 -0
- package/dist/guests/attribution.js.map +7 -0
- package/dist/guests/client.js +150 -0
- package/dist/guests/client.js.map +7 -0
- package/dist/guests/guard.js +38 -0
- package/dist/guests/guard.js.map +7 -0
- package/dist/guests/index.js +282 -0
- package/dist/guests/index.js.map +7 -0
- package/dist/guests/seats.js +49 -0
- package/dist/guests/seats.js.map +7 -0
- package/dist/guests/serve.js +72 -0
- package/dist/guests/serve.js.map +7 -0
- package/dist/guests/view.js +40 -0
- package/dist/guests/view.js.map +7 -0
- package/dist/host.js +98 -5
- package/dist/host.js.map +2 -2
- package/dist/index.js +41 -1
- package/dist/index.js.map +2 -2
- package/dist/main.js +23 -2
- package/dist/main.js.map +2 -2
- package/dist/owner.js +2 -1
- package/dist/owner.js.map +2 -2
- package/dist/page.js +8 -0
- package/dist/page.js.map +2 -2
- package/dist/secrets/extension.js +4 -1
- package/dist/secrets/extension.js.map +2 -2
- package/dist/services.js +12 -0
- package/dist/services.js.map +2 -2
- package/dist/serving.js +7 -0
- package/dist/serving.js.map +2 -2
- package/dist/spectrum/agent-port.js +14 -1
- package/dist/spectrum/agent-port.js.map +2 -2
- package/dist/spectrum/approvals-port.js +1 -1
- package/dist/spectrum/approvals-port.js.map +2 -2
- package/dist/spectrum/guest-port.js +57 -0
- package/dist/spectrum/guest-port.js.map +7 -0
- package/dist/spectrum/index.js +19 -0
- package/dist/spectrum/index.js.map +3 -3
- package/dist/spectrum/messages.js +30 -8
- package/dist/spectrum/messages.js.map +2 -2
- package/dist/spectrum/proposals.js +56 -0
- package/dist/spectrum/proposals.js.map +7 -0
- package/dist/titles/labels.js +1 -0
- package/dist/titles/labels.js.map +2 -2
- package/dist/types/approvals/index.d.ts +4 -0
- package/dist/types/approvals/intent.d.ts +32 -0
- package/dist/types/approvals/judge.d.ts +86 -0
- package/dist/types/approvals/record.d.ts +5 -1
- package/dist/types/client.d.ts +7 -1
- package/dist/types/control.d.ts +2 -1
- package/dist/types/guests/attribution.d.ts +9 -0
- package/dist/types/guests/client.d.ts +12 -0
- package/dist/types/guests/guard.d.ts +5 -0
- package/dist/types/guests/index.d.ts +54 -0
- package/dist/types/guests/seats.d.ts +39 -0
- package/dist/types/guests/serve.d.ts +17 -0
- package/dist/types/guests/view.d.ts +3 -0
- package/dist/types/host.d.ts +21 -3
- package/dist/types/index.d.ts +4 -1
- package/dist/types/owner.d.ts +4 -0
- package/dist/types/page.d.ts +1 -0
- package/dist/types/services.d.ts +34 -2
- package/dist/types/serving.d.ts +8 -1
- package/dist/types/spectrum/guest-port.d.ts +26 -0
- package/dist/types/spectrum/index.d.ts +13 -0
- package/dist/types/spectrum/proposals.d.ts +8 -0
- package/dist/types/titles/labels.d.ts +3 -1
- package/dist/worker.js +2 -1
- package/dist/worker.js.map +2 -2
- package/package.json +7 -6
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type Context, type ReplicatedState } from '@earendil-works/chord';
|
|
2
|
+
import { type Harness } from '@earendil-works/pi-durable';
|
|
3
|
+
import type { Agents } from '../agents.ts';
|
|
4
|
+
import type { Approvals } from '../approvals/index.ts';
|
|
5
|
+
import type { GuestPrincipal } from '../serving.ts';
|
|
6
|
+
import { type GuestDraft, type GuestSeat, type SeatRecord } from './seats.ts';
|
|
7
|
+
export type GuestOpened = {
|
|
8
|
+
seat: GuestSeat;
|
|
9
|
+
error: null;
|
|
10
|
+
} | {
|
|
11
|
+
seat: null;
|
|
12
|
+
error: string;
|
|
13
|
+
};
|
|
14
|
+
export type Proposed = {
|
|
15
|
+
state: 'submitted';
|
|
16
|
+
submissionId: string;
|
|
17
|
+
reason: null;
|
|
18
|
+
} | {
|
|
19
|
+
state: 'pending';
|
|
20
|
+
submissionId: null;
|
|
21
|
+
approval: string;
|
|
22
|
+
reason: null;
|
|
23
|
+
} | {
|
|
24
|
+
state: 'unanswered';
|
|
25
|
+
submissionId: null;
|
|
26
|
+
reason: string;
|
|
27
|
+
};
|
|
28
|
+
export interface ProposeRequest {
|
|
29
|
+
text: string;
|
|
30
|
+
requestId: string | null;
|
|
31
|
+
}
|
|
32
|
+
export interface Guests {
|
|
33
|
+
readonly seats: ReplicatedState<GuestSeat[]>;
|
|
34
|
+
open(draft: GuestDraft, context: Context): Promise<GuestOpened>;
|
|
35
|
+
revoke(id: string, context: Context): Promise<{
|
|
36
|
+
revoked: boolean;
|
|
37
|
+
}>;
|
|
38
|
+
admit(id: string, label: string): GuestPrincipal | null;
|
|
39
|
+
record(id: string): SeatRecord | undefined;
|
|
40
|
+
current(guest: GuestPrincipal): SeatRecord | undefined;
|
|
41
|
+
joined(id: string): () => void;
|
|
42
|
+
onEnd(listener: (id: string) => void): () => void;
|
|
43
|
+
propose(guest: GuestPrincipal, request: ProposeRequest, context: Context): Promise<Proposed>;
|
|
44
|
+
dispose(): void;
|
|
45
|
+
}
|
|
46
|
+
export interface GuestsOptions {
|
|
47
|
+
harness: Pick<Harness, 'commit' | 'abortSubmission'>;
|
|
48
|
+
agents: Pick<Agents, 'state' | 'conversation'>;
|
|
49
|
+
approvals?: Pick<Approvals, 'state' | 'request' | 'withdrawSeat'>;
|
|
50
|
+
now?: () => number;
|
|
51
|
+
context?: Context;
|
|
52
|
+
}
|
|
53
|
+
export declare const MAX_PROPOSAL = 32000;
|
|
54
|
+
export declare function createGuests(options: GuestsOptions): Promise<Guests>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ApprovalTier } from '../approvals/record.ts';
|
|
2
|
+
export type GuestGate = ApprovalTier | 'off';
|
|
3
|
+
export type GuestGates = {
|
|
4
|
+
messages: GuestGate;
|
|
5
|
+
tools: GuestGate;
|
|
6
|
+
};
|
|
7
|
+
export type GuestDraft = {
|
|
8
|
+
id: string;
|
|
9
|
+
label: string;
|
|
10
|
+
agentId: string;
|
|
11
|
+
expiresAt: number | null;
|
|
12
|
+
gates: GuestGates;
|
|
13
|
+
};
|
|
14
|
+
export type SeatRecord = GuestDraft & {
|
|
15
|
+
createdAt: number;
|
|
16
|
+
epoch: number;
|
|
17
|
+
revoked: number | null;
|
|
18
|
+
delivered?: string[];
|
|
19
|
+
};
|
|
20
|
+
export interface GuestSeat {
|
|
21
|
+
id: string;
|
|
22
|
+
label: string;
|
|
23
|
+
agentId: string;
|
|
24
|
+
createdAt: number;
|
|
25
|
+
expiresAt: number | null;
|
|
26
|
+
gates: GuestGates;
|
|
27
|
+
connected: boolean;
|
|
28
|
+
pending: number;
|
|
29
|
+
}
|
|
30
|
+
export type GuestsState = {
|
|
31
|
+
seats: Record<string, SeatRecord>;
|
|
32
|
+
};
|
|
33
|
+
export declare const GuestsDoc: import("@earendil-works/pi-durable").SessionDocToken<GuestsState>;
|
|
34
|
+
export declare const MAX_SEAT_MS: number;
|
|
35
|
+
export declare const MAX_LABEL = 64;
|
|
36
|
+
export declare function cleanLabel(raw: unknown): string;
|
|
37
|
+
export declare function isGate(value: unknown): value is GuestGate;
|
|
38
|
+
export declare function checkDraft(draft: GuestDraft, now: number): string | null;
|
|
39
|
+
export declare function liveSeat(seat: SeatRecord | undefined, now: number): boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Context, Host, ReplicatedState } from '@earendil-works/chord';
|
|
2
|
+
import type { ConversationView } from '@earendil-works/pi-durable';
|
|
3
|
+
import type { Agents } from '../agents.ts';
|
|
4
|
+
import type { Approval } from '../approvals/index.ts';
|
|
5
|
+
import type { AgentGuest, GuestProposal } from '../services.ts';
|
|
6
|
+
import type { GuestPrincipal } from '../serving.ts';
|
|
7
|
+
import { type PortEndpoint } from '../wire.ts';
|
|
8
|
+
import type { Guests } from './index.ts';
|
|
9
|
+
export declare function proposalsOf(items: readonly Approval[] | undefined, seat: string): GuestProposal[];
|
|
10
|
+
export declare function guestOpener(guests: Guests, agents: Pick<Agents, 'state'>, views: ReplicatedState<Record<string, ConversationView>>, context: Context, approvals?: ReplicatedState<Approval[]>): (principal: GuestPrincipal) => {
|
|
11
|
+
value: AgentGuest;
|
|
12
|
+
dispose(): void;
|
|
13
|
+
} | undefined;
|
|
14
|
+
export declare function admitGuest(guests: Guests, endpoint: PortEndpoint, asked: {
|
|
15
|
+
id: string;
|
|
16
|
+
label: string;
|
|
17
|
+
}, serverId: string, link: number, host: Pick<Host, 'accept'>): void;
|
package/dist/types/host.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { type Context, type Host, type ReplicatedState } from '@earendil-works/chord';
|
|
1
|
+
import { type Context, type Host, type Readable, type ReplicatedState } from '@earendil-works/chord';
|
|
2
2
|
import type { Agent } from './agent.ts';
|
|
3
|
-
import { type Approvals, type DecidedBy } from './approvals/index.ts';
|
|
3
|
+
import { type ApprovalJudge, type Approvals, type DecidedBy } from './approvals/index.ts';
|
|
4
4
|
import type { ChangesRuntime } from './changes/index.ts';
|
|
5
5
|
import { type HostLicks, type HostScoops } from './control.ts';
|
|
6
6
|
import type { FreezerRuntime } from './freezer/index.ts';
|
|
7
|
+
import { type Guests } from './guests/index.ts';
|
|
7
8
|
import type { UserClients } from './kernel/users.ts';
|
|
8
9
|
import type { McpRuntime } from './mcp/index.ts';
|
|
9
10
|
import type { MemoryRuntime } from './memory/index.ts';
|
|
@@ -12,7 +13,8 @@ import { type AgentRemote } from './remote/host.ts';
|
|
|
12
13
|
import { type Pages } from './remote/pages.ts';
|
|
13
14
|
import type { SecretName } from './secrets/names.ts';
|
|
14
15
|
import type { VaultState } from './secrets/vault.ts';
|
|
15
|
-
import { AgentControl, AgentSettings, AgentTranscript } from './services.ts';
|
|
16
|
+
import { AgentControl, type AgentGuest, AgentSettings, AgentTranscript } from './services.ts';
|
|
17
|
+
import { type GuestPrincipal, type Seat } from './serving.ts';
|
|
16
18
|
import type { SkillsRuntime } from './skills/index.ts';
|
|
17
19
|
import type { SprinklesRuntime } from './sprinkles/index.ts';
|
|
18
20
|
import { type Thumbnail } from './thumbs.ts';
|
|
@@ -22,12 +24,17 @@ import { type PortEndpoint } from './wire.ts';
|
|
|
22
24
|
export interface ConnectOptions {
|
|
23
25
|
readOnly?: boolean;
|
|
24
26
|
pages?: boolean;
|
|
27
|
+
guest?: {
|
|
28
|
+
id: string;
|
|
29
|
+
label: string;
|
|
30
|
+
};
|
|
25
31
|
}
|
|
26
32
|
export interface AgentHost {
|
|
27
33
|
readonly serverId: string;
|
|
28
34
|
readonly agent: Agent;
|
|
29
35
|
readonly users?: UserClients;
|
|
30
36
|
readonly pages: Pages;
|
|
37
|
+
readonly guests: Guests;
|
|
31
38
|
readonly approvals: Approvals;
|
|
32
39
|
connect(endpoint: PortEndpoint, options?: ConnectOptions): void;
|
|
33
40
|
close(): Promise<void>;
|
|
@@ -57,6 +64,7 @@ export declare function hostAgent(agent: Agent, options?: {
|
|
|
57
64
|
thumbnail?: Thumbnail;
|
|
58
65
|
labels?: LabelsRuntime;
|
|
59
66
|
approvals?: Approvals;
|
|
67
|
+
judge?: ApprovalJudge;
|
|
60
68
|
}): Promise<AgentHost>;
|
|
61
69
|
interface Served {
|
|
62
70
|
trusted: AgentControl;
|
|
@@ -66,7 +74,17 @@ interface Served {
|
|
|
66
74
|
settings: AgentSettings;
|
|
67
75
|
remote: AgentRemote;
|
|
68
76
|
pages: Pages;
|
|
77
|
+
guest?: (principal: GuestPrincipal) => {
|
|
78
|
+
value: AgentGuest;
|
|
79
|
+
dispose(): void;
|
|
80
|
+
} | undefined;
|
|
69
81
|
decide: (by: DecidedBy) => AgentControl['decide'];
|
|
70
82
|
}
|
|
83
|
+
export declare const CLOSED_TO_GUESTS = "a guest seat has only its transcript and propose";
|
|
84
|
+
export declare const openToGuests: <F extends object>(factory: F) => F;
|
|
85
|
+
export declare function closedToGuests(host: Host): Host;
|
|
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";
|
|
71
89
|
export declare function serveAgent(serving: Served): Host;
|
|
72
90
|
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
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 ApprovalKind, type ApprovalRequester, type ApprovalState, type Approvals, ApprovalsDoc, type ApprovalTier, type ApprovalVerdict, attachApprovals, type DecidedBy, REASONS, } 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, 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
4
|
export { FILE_LIMIT, IMAGE_LIMIT, type SendAttachment, type ShownAttachment, splitUser, TOTAL_LIMIT, userParts, } from './attachments.ts';
|
|
5
5
|
export { type AgentConnection, connectAgent } from './client.ts';
|
|
6
6
|
export { createAgentControl } from './control.ts';
|
|
7
|
+
export { connectGuest, GUEST_ONLY, type GuestConnection, SEAT_REFUSED, } from './guests/client.ts';
|
|
8
|
+
export type { GuestOpened, Proposed, ProposeRequest } from './guests/index.ts';
|
|
9
|
+
export type { GuestDraft, GuestGate, GuestGates, GuestSeat } from './guests/seats.ts';
|
|
7
10
|
export { type AgentHost, type ConnectOptions, hostAgent } from './host.ts';
|
|
8
11
|
export type { KernelClient, KernelFs, KernelProcess, KernelStat, SpawnOptions, } from './kernel/client.ts';
|
|
9
12
|
export { HOME, type KernelEnvOptions, kernelEnvironment, SliccKernelEnv } from './kernel/env.ts';
|
package/dist/types/owner.d.ts
CHANGED
package/dist/types/page.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { type AgentConnection, connectAgent } from './client.ts';
|
|
2
|
+
export { connectGuest, GUEST_ONLY, type GuestConnection, SEAT_REFUSED, } from './guests/client.ts';
|
|
2
3
|
export { type ByteSink, bridgePort, encodeFrame, FrameReader, type LinkEnd, linkEndpoint, MAX_FRAME, } from './link.ts';
|
|
3
4
|
export { AGENT_LOCK, type AgentOwner, type AgentWorker, type KernelSource, type OwnerOptions, type PortOptions, startAgent, } from './owner.ts';
|
|
4
5
|
export { type RemoteControl, type RemoteEvent, type RemoteOptions, remoteControl, } from './remote/client.ts';
|
package/dist/types/services.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import type { Approval, ApprovalAnswer, ApprovalDecided } from './approvals/inde
|
|
|
4
4
|
import type { SendAttachment, ShownAttachment } from './attachments.ts';
|
|
5
5
|
import type { ChangesView } from './changes/git.ts';
|
|
6
6
|
import type { FrozenCone } from './freezer/index.ts';
|
|
7
|
+
import type { GuestOpened, Proposed, ProposeRequest } from './guests/index.ts';
|
|
8
|
+
import type { GuestDraft, GuestGates, GuestSeat } from './guests/seats.ts';
|
|
7
9
|
import type { MemoryEntry, MemoryScope, MemoryTag } from './memory/format.ts';
|
|
8
10
|
import type { AgentRemote } from './remote/host.ts';
|
|
9
11
|
import type { VaultState } from './secrets/vault.ts';
|
|
@@ -88,6 +90,10 @@ export interface AgentControl {
|
|
|
88
90
|
image(ref: ImageRef, context: Context): Promise<StoredImage>;
|
|
89
91
|
agentCommands(agentId: string, context: Context): Promise<Command[]>;
|
|
90
92
|
toolLabel(agentId: string, callIds: string[], context: Context): Promise<string | null>;
|
|
93
|
+
guestOpen(draft: GuestDraft, context: Context): Promise<GuestOpened>;
|
|
94
|
+
guestRevoke(id: string, context: Context): Promise<{
|
|
95
|
+
revoked: boolean;
|
|
96
|
+
}>;
|
|
91
97
|
decide(id: string, decision: ApprovalAnswer, reason: string | null, context: Context): Promise<ApprovalDecided>;
|
|
92
98
|
}
|
|
93
99
|
export interface ImageRef {
|
|
@@ -233,7 +239,7 @@ export interface AgentSettingsChange {
|
|
|
233
239
|
thinkingLevel: 'off' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max' | null;
|
|
234
240
|
agentId?: string | null;
|
|
235
241
|
}
|
|
236
|
-
export declare const CONTROL_METHODS: ("abort" | "agentCommands" | "changeAccept" | "changeRevert" | "changesOpen" | "compact" | "compactAgent" | "configure" | "createCone" | "createScoop" | "decide" | "discard" | "drop" | "freeze" | "image" | "memoryRemove" | "memorySave" | "monitorClose" | "monitorOpen" | "newChat" | "reset" | "resolveAgentLick" | "resolveLick" | "rewind" | "rewindAgent" | "selectCone" | "send" | "sprinkleCall" | "sprinkleSend" | "stopAgent" | "thaw" | "toolLabel" | "unqueue" | "wait" | "webhook" | "withdraw")[];
|
|
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")[];
|
|
237
243
|
export declare const CONTROL_READS: readonly (keyof AgentControl & string)[];
|
|
238
244
|
export declare const AgentControl: RemoteContract;
|
|
239
245
|
export type Delivered = 'run' | 'steer' | 'follow-up';
|
|
@@ -252,6 +258,7 @@ export interface AgentTranscript {
|
|
|
252
258
|
readonly monitor: ReplicatedState<MonitorFeed>;
|
|
253
259
|
readonly vault: ReplicatedState<VaultState>;
|
|
254
260
|
readonly labels: ReplicatedState<Record<string, string>>;
|
|
261
|
+
readonly guests: ReplicatedState<GuestSeat[]>;
|
|
255
262
|
readonly approvals: ReplicatedState<Approval[]>;
|
|
256
263
|
}
|
|
257
264
|
export interface PrivateRevision {
|
|
@@ -262,10 +269,35 @@ export interface Command {
|
|
|
262
269
|
description: string;
|
|
263
270
|
kind: 'prompt' | 'skill' | 'action';
|
|
264
271
|
}
|
|
265
|
-
export declare const TRANSCRIPT_STATES: ("agents" | "approvals" | "changes" | "commands" | "deliveries" | "frozen" | "labels" | "memories" | "memoryScopes" | "monitor" | "privateRevision" | "sprinkles" | "state" | "vault" | "views")[];
|
|
272
|
+
export declare const TRANSCRIPT_STATES: ("agents" | "approvals" | "changes" | "commands" | "deliveries" | "frozen" | "guests" | "labels" | "memories" | "memoryScopes" | "monitor" | "privateRevision" | "sprinkles" | "state" | "vault" | "views")[];
|
|
266
273
|
export declare const AgentTranscript: RemoteContract;
|
|
267
274
|
export declare const REMOTE_METHODS: ("abort" | "close" | "next" | "prompt" | "watch")[];
|
|
268
275
|
export declare const REMOTE_READS: readonly (keyof AgentRemote & string)[];
|
|
276
|
+
export interface GuestShown {
|
|
277
|
+
id: string;
|
|
278
|
+
label: string;
|
|
279
|
+
agentId: string;
|
|
280
|
+
name: string;
|
|
281
|
+
expiresAt: number | null;
|
|
282
|
+
gates: GuestGates;
|
|
283
|
+
}
|
|
284
|
+
export interface GuestProposal {
|
|
285
|
+
id: string;
|
|
286
|
+
text: string;
|
|
287
|
+
state: 'pending' | 'approved' | 'rejected' | 'unanswered' | 'withdrawn';
|
|
288
|
+
reason: string | null;
|
|
289
|
+
createdAt: number;
|
|
290
|
+
decidedAt: number | null;
|
|
291
|
+
}
|
|
292
|
+
export interface AgentGuest {
|
|
293
|
+
readonly transcript: ReplicatedState<ConversationView>;
|
|
294
|
+
readonly seat: ReplicatedState<GuestShown>;
|
|
295
|
+
readonly proposals: ReplicatedState<GuestProposal[]>;
|
|
296
|
+
propose(request: ProposeRequest, context: Context): Promise<Proposed>;
|
|
297
|
+
}
|
|
298
|
+
export declare const GUEST_STATES: readonly ['transcript', 'seat', 'proposals'];
|
|
299
|
+
export declare const GUEST_METHODS: readonly ['propose'];
|
|
300
|
+
export declare const AgentGuestService: RemoteContract;
|
|
269
301
|
export declare const AgentRemoteService: RemoteContract;
|
|
270
302
|
export declare const PAGE_METHODS: ("answer" | "close" | "next" | "open" | "report")[];
|
|
271
303
|
export declare const AgentPagesService: RemoteContract;
|
package/dist/types/serving.d.ts
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { type Ctx, type Principal, type Readable, type RemoteContract, type ReplicatedState } from '@earendil-works/chord';
|
|
2
2
|
import { type Context } from '@earendil-works/chord/context';
|
|
3
3
|
export declare const AGENT_HOST = "agent";
|
|
4
|
-
export type Seat = 'owner' | 'control' | 'view';
|
|
4
|
+
export type Seat = 'owner' | 'control' | 'view' | 'guest';
|
|
5
|
+
export interface GuestPrincipal {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
epoch: number;
|
|
9
|
+
}
|
|
5
10
|
export interface AgentPrincipal {
|
|
6
11
|
seat: Seat;
|
|
7
12
|
link: number;
|
|
13
|
+
guest?: GuestPrincipal;
|
|
8
14
|
}
|
|
9
15
|
export declare const seatOf: (principal: Principal) => Seat;
|
|
16
|
+
export declare const guestOf: (principal: Principal) => GuestPrincipal | undefined;
|
|
10
17
|
export declare const principalKey: (principal: Principal) => string;
|
|
11
18
|
export interface Members {
|
|
12
19
|
methods?: readonly string[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { GuestDraft, GuestEvents, GuestPort, GuestSeat } from '@ai-ecoverse/slicc-spectrum/ui';
|
|
2
|
+
import type { AgentConnection } from '../client.ts';
|
|
3
|
+
import { Emitter } from './emitter.ts';
|
|
4
|
+
export interface GuestHub {
|
|
5
|
+
mint(request: GuestDraft & {
|
|
6
|
+
agentId: string;
|
|
7
|
+
}): Promise<{
|
|
8
|
+
id: string;
|
|
9
|
+
url: string;
|
|
10
|
+
}>;
|
|
11
|
+
revoke(id: string): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export declare const NO_HUB = "Inviting guests needs the tray hub.";
|
|
14
|
+
export declare const NO_CONTROL = "Only a tab with Control can invite guests.";
|
|
15
|
+
export declare const NO_OWNER = "Only the owner's tab can invite guests.";
|
|
16
|
+
export declare class GuestAdapter extends Emitter<GuestEvents> implements GuestPort {
|
|
17
|
+
#private;
|
|
18
|
+
constructor(connection: AgentConnection, hub: GuestHub | null);
|
|
19
|
+
list(): readonly GuestSeat[];
|
|
20
|
+
unavailable(): string | null;
|
|
21
|
+
mint(agentId: string, draft: GuestDraft): Promise<{
|
|
22
|
+
seat: GuestSeat;
|
|
23
|
+
url: string;
|
|
24
|
+
}>;
|
|
25
|
+
revoke(id: string): Promise<void>;
|
|
26
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { MonitorSection } from '@ai-ecoverse/slicc-spectrum/ui';
|
|
2
2
|
import type { AgentConnection } from '../client.ts';
|
|
3
|
+
import type { GuestGates } from '../guests/seats.ts';
|
|
3
4
|
import { AgentAdapter } from './agent-port.ts';
|
|
4
5
|
import { ApprovalsAdapter, type HostApprovals } from './approvals-port.ts';
|
|
5
6
|
import { ChangesAdapter } from './changes-port.ts';
|
|
7
|
+
import { GuestAdapter, type GuestHub } from './guest-port.ts';
|
|
6
8
|
import { MemoryAdapter } from './memory-port.ts';
|
|
7
9
|
import { MonitorAdapter } from './monitor-port.ts';
|
|
8
10
|
import { type HostNotices, NoticesAdapter } from './notices-port.ts';
|
|
@@ -13,6 +15,7 @@ import { TrayAdapter } from './tray-port.ts';
|
|
|
13
15
|
export { AgentAdapter, CONE } from './agent-port.ts';
|
|
14
16
|
export { ApprovalsAdapter, type HostApprovals, NOT_HERE, shown as shownApproval, } from './approvals-port.ts';
|
|
15
17
|
export { ChangesAdapter, type ChangesEvents } from './changes-port.ts';
|
|
18
|
+
export { GuestAdapter, type GuestHub, NO_CONTROL, NO_HUB, NO_OWNER, } from './guest-port.ts';
|
|
16
19
|
export { MemoryAdapter } from './memory-port.ts';
|
|
17
20
|
export { assistant, errorAction, errorPart, isBusy, queued, textOf, toMessages, } from './messages.ts';
|
|
18
21
|
export { MonitorAdapter, type MonitorAdapterOptions, type MonitorInput, monitorSnapshot, } from './monitor-port.ts';
|
|
@@ -21,6 +24,13 @@ export { PageAdapter, type PageDocument, type PageOptions, type PageRun, type Pa
|
|
|
21
24
|
export { type Login, SETTINGS_KEY, SettingsAdapter } from './settings-port.ts';
|
|
22
25
|
export { SprinkleAdapter } from './sprinkle-port.ts';
|
|
23
26
|
export { TrayAdapter } from './tray-port.ts';
|
|
27
|
+
export interface GuestSeatShown {
|
|
28
|
+
id: string;
|
|
29
|
+
label: string;
|
|
30
|
+
agentId: string;
|
|
31
|
+
expiresAt: number | null;
|
|
32
|
+
gates: GuestGates;
|
|
33
|
+
}
|
|
24
34
|
export declare function createAgentModel(connection: AgentConnection, options?: {
|
|
25
35
|
storage?: Pick<Storage, 'getItem' | 'setItem'> | null;
|
|
26
36
|
login?: Login;
|
|
@@ -28,6 +38,7 @@ export declare function createAgentModel(connection: AgentConnection, options?:
|
|
|
28
38
|
extra?: () => readonly MonitorSection[];
|
|
29
39
|
};
|
|
30
40
|
page?: PageOptions;
|
|
41
|
+
guests?: GuestHub;
|
|
31
42
|
approvals?: HostApprovals;
|
|
32
43
|
notices?: HostNotices;
|
|
33
44
|
}): {
|
|
@@ -41,4 +52,6 @@ export declare function createAgentModel(connection: AgentConnection, options?:
|
|
|
41
52
|
monitor: MonitorAdapter;
|
|
42
53
|
notices: NoticesAdapter;
|
|
43
54
|
page: PageAdapter | null;
|
|
55
|
+
guests: GuestAdapter;
|
|
56
|
+
seat?: GuestSeatShown;
|
|
44
57
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Message, SystemMessage, UserMessage } from '@ai-ecoverse/slicc-spectrum/ui';
|
|
2
|
+
import type { GuestProposal } from '../services.ts';
|
|
3
|
+
export declare const UNANSWERED = "Nobody approved this in time.";
|
|
4
|
+
export declare const DECLINED = "It was declined.";
|
|
5
|
+
export declare const WITHDRAWN = "It was withdrawn.";
|
|
6
|
+
export declare function proposalQueue(proposals: readonly GuestProposal[] | undefined, label: string): UserMessage[];
|
|
7
|
+
export declare function proposalNotices(proposals: readonly GuestProposal[] | undefined): SystemMessage[];
|
|
8
|
+
export declare function merged(messages: readonly Message[], notices: readonly SystemMessage[]): Message[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Context, type ReplicatedState } from '@earendil-works/chord';
|
|
2
|
-
import
|
|
2
|
+
import type { AssistantMessage } from '@earendil-works/pi-ai';
|
|
3
|
+
import { type ConversationId, type ConversationView, type Harness, type Tx } from '@earendil-works/pi-durable';
|
|
3
4
|
import type { Agents } from '../agents.ts';
|
|
4
5
|
import type { VaultState } from '../secrets/vault.ts';
|
|
5
6
|
import { type Labeler } from './generate.ts';
|
|
@@ -16,6 +17,7 @@ export declare function visibleLabels(labels: ReplicatedState<Record<string, str
|
|
|
16
17
|
};
|
|
17
18
|
export declare function watchLabel(labels: ReplicatedState<Record<string, string>>, waitMs?: number): (_agentId: string, callIds: readonly string[]) => Promise<string | null>;
|
|
18
19
|
export declare function cleanLabel(text: string): string;
|
|
20
|
+
export declare function spend(tx: Tx, conversation: ConversationId, answer: Pick<AssistantMessage, 'provider' | 'model' | 'usage'>): Promise<void>;
|
|
19
21
|
export interface LabelsAttach {
|
|
20
22
|
harness: Pick<Harness, 'commit'>;
|
|
21
23
|
agents: Pick<Agents, 'conversation'>;
|
package/dist/worker.js
CHANGED
|
@@ -4,8 +4,9 @@ function serveConnections(scope, host) {
|
|
|
4
4
|
const port = message?.connect;
|
|
5
5
|
if (!port) return;
|
|
6
6
|
const pages = message?.pages === false ? { pages: false } : {};
|
|
7
|
+
const guest = message?.guest ? { guest: message.guest } : {};
|
|
7
8
|
host.then(
|
|
8
|
-
(ready) => ready.connect(port, { readOnly: message?.readOnly === true, ...pages }),
|
|
9
|
+
(ready) => ready.connect(port, { readOnly: message?.readOnly === true, ...pages, ...guest }),
|
|
9
10
|
() => port.close?.()
|
|
10
11
|
);
|
|
11
12
|
});
|
package/dist/worker.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/worker.ts"],
|
|
4
|
-
"sourcesContent": ["import type { AgentHost } from './host.ts';\nimport type { PortEndpoint } from './wire.ts';\n\nexport interface WorkerScope {\n addEventListener(type: 'message', listener: (event: MessageEvent) => void): void;\n}\n\nexport function serveConnections(scope: WorkerScope, host: Promise<AgentHost>): void {\n scope.addEventListener('message', ({ data }) => {\n const message = data as {
|
|
5
|
-
"mappings": "AAOO,SAAS,iBAAiB,OAAoB,MAAgC;AACnF,QAAM,iBAAiB,WAAW,CAAC,EAAE,KAAK,MAAM;AAC9C,UAAM,UAAU;
|
|
4
|
+
"sourcesContent": ["import type { AgentHost } from './host.ts';\nimport type { PortEndpoint } from './wire.ts';\n\nexport interface WorkerScope {\n addEventListener(type: 'message', listener: (event: MessageEvent) => void): void;\n}\n\nexport function serveConnections(scope: WorkerScope, host: Promise<AgentHost>): void {\n scope.addEventListener('message', ({ data }) => {\n const message = data as {\n connect?: PortEndpoint;\n readOnly?: boolean;\n pages?: boolean;\n guest?: { id: string; label: string };\n } | null;\n const port = message?.connect;\n if (!port) return;\n const pages = message?.pages === false ? { pages: false } : {};\n const guest = message?.guest ? { guest: message.guest } : {};\n host.then(\n (ready) => ready.connect(port, { readOnly: message?.readOnly === true, ...pages, ...guest }),\n () => port.close?.()\n );\n });\n}\n\nexport interface KernelPorts {\n kernel: MessagePort;\n admin?: MessagePort;\n}\n\nexport function kernelPorts(scope: WorkerScope): Promise<KernelPorts> {\n return new Promise((resolve) => {\n scope.addEventListener('message', ({ data }) => {\n const message = data as { kernel?: MessagePort; admin?: MessagePort } | null;\n const kernel = message?.kernel;\n if (!kernel) return;\n resolve(message.admin ? { kernel, admin: message.admin } : { kernel });\n });\n });\n}\n\nexport function kernelPort(scope: WorkerScope): Promise<MessagePort> {\n return kernelPorts(scope).then((ports) => ports.kernel);\n}\n"],
|
|
5
|
+
"mappings": "AAOO,SAAS,iBAAiB,OAAoB,MAAgC;AACnF,QAAM,iBAAiB,WAAW,CAAC,EAAE,KAAK,MAAM;AAC9C,UAAM,UAAU;AAMhB,UAAM,OAAO,SAAS;AACtB,QAAI,CAAC,KAAM;AACX,UAAM,QAAQ,SAAS,UAAU,QAAQ,EAAE,OAAO,MAAM,IAAI,CAAC;AAC7D,UAAM,QAAQ,SAAS,QAAQ,EAAE,OAAO,QAAQ,MAAM,IAAI,CAAC;AAC3D,SAAK;AAAA,MACH,CAAC,UAAU,MAAM,QAAQ,MAAM,EAAE,UAAU,SAAS,aAAa,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAAA,MAC3F,MAAM,KAAK,QAAQ;AAAA,IACrB;AAAA,EACF,CAAC;AACH;AAOO,SAAS,YAAY,OAA0C;AACpE,SAAO,IAAI,QAAQ,CAAC,YAAY;AAC9B,UAAM,iBAAiB,WAAW,CAAC,EAAE,KAAK,MAAM;AAC9C,YAAM,UAAU;AAChB,YAAM,SAAS,SAAS;AACxB,UAAI,CAAC,OAAQ;AACb,cAAQ,QAAQ,QAAQ,EAAE,QAAQ,OAAO,QAAQ,MAAM,IAAI,EAAE,OAAO,CAAC;AAAA,IACvE,CAAC;AAAA,EACH,CAAC;AACH;AAEO,SAAS,WAAW,OAA0C;AACnE,SAAO,YAAY,KAAK,EAAE,KAAK,CAAC,UAAU,MAAM,MAAM;AACxD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-agent",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.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",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"test": "node --test ${TEST_CONCURRENCY:+--test-concurrency=$TEST_CONCURRENCY} --test-timeout=120000 --test-global-setup=node_modules/@ai-ecoverse/slicc-shared-web/harness/global.mjs 'test/integration/*.test.mjs'",
|
|
54
54
|
"test:unit": "NODE_NO_WARNINGS=1 mcr -c node_modules/@ai-ecoverse/slicc-shared-web/mcr.config.mjs node --test 'test/unit/**/*.test.mjs'",
|
|
55
55
|
"typecheck": "tsc",
|
|
56
|
+
"eval:judge": "node evals/judge.mjs",
|
|
56
57
|
"lint": "slicc-lint && npm run lint:patches",
|
|
57
58
|
"lint:patches": "node scripts/check-patches.mjs",
|
|
58
59
|
"format": "biome check --write .",
|
|
@@ -61,12 +62,12 @@
|
|
|
61
62
|
"release": "semantic-release"
|
|
62
63
|
},
|
|
63
64
|
"devDependencies": {
|
|
64
|
-
"@ai-ecoverse/slicc-kernel": "1.
|
|
65
|
+
"@ai-ecoverse/slicc-kernel": "1.100.3",
|
|
65
66
|
"@ai-ecoverse/slicc-scrub": "1.0.0",
|
|
66
|
-
"@ai-ecoverse/slicc-shared-web": "1.
|
|
67
|
-
"@ai-ecoverse/slicc-spectrum": "1.79.
|
|
67
|
+
"@ai-ecoverse/slicc-shared-web": "1.21.0",
|
|
68
|
+
"@ai-ecoverse/slicc-spectrum": "1.79.2",
|
|
68
69
|
"@ai-ecoverse/wasm-bash": "5.3.0-18",
|
|
69
|
-
"@ai-ecoverse/wasm-coreutils": "9.12.0-
|
|
70
|
+
"@ai-ecoverse/wasm-coreutils": "9.12.0-7",
|
|
70
71
|
"@ai-ecoverse/wasm-git": "2.55.0-15",
|
|
71
72
|
"@biomejs/biome": "2.5.15",
|
|
72
73
|
"@types/node": "24.19.1",
|
|
@@ -92,7 +93,7 @@
|
|
|
92
93
|
},
|
|
93
94
|
"peerDependencies": {
|
|
94
95
|
"@ai-ecoverse/slicc-kernel": ">=1.90.0 <2",
|
|
95
|
-
"@ai-ecoverse/slicc-spectrum": "^1.
|
|
96
|
+
"@ai-ecoverse/slicc-spectrum": "^1.79.0"
|
|
96
97
|
},
|
|
97
98
|
"peerDependenciesMeta": {
|
|
98
99
|
"@ai-ecoverse/slicc-spectrum": {
|