@ai-ecoverse/slicc-agent 5.0.3 → 5.2.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 (39) hide show
  1. package/README.md +27 -0
  2. package/dist/approvals/index.js +222 -0
  3. package/dist/approvals/index.js.map +7 -0
  4. package/dist/approvals/intent.js +85 -0
  5. package/dist/approvals/intent.js.map +7 -0
  6. package/dist/approvals/judge.js +207 -0
  7. package/dist/approvals/judge.js.map +7 -0
  8. package/dist/approvals/record.js +90 -0
  9. package/dist/approvals/record.js.map +7 -0
  10. package/dist/client.js +2 -0
  11. package/dist/client.js.map +2 -2
  12. package/dist/control.js +14 -3
  13. package/dist/control.js.map +2 -2
  14. package/dist/host.js +23 -3
  15. package/dist/host.js.map +2 -2
  16. package/dist/index.js +42 -0
  17. package/dist/index.js.map +2 -2
  18. package/dist/main.js +23 -2
  19. package/dist/main.js.map +2 -2
  20. package/dist/services.js +4 -2
  21. package/dist/services.js.map +2 -2
  22. package/dist/spectrum/approvals-port.js +135 -0
  23. package/dist/spectrum/approvals-port.js.map +7 -0
  24. package/dist/spectrum/index.js +10 -0
  25. package/dist/spectrum/index.js.map +3 -3
  26. package/dist/titles/labels.js +1 -0
  27. package/dist/titles/labels.js.map +2 -2
  28. package/dist/types/approvals/index.d.ts +32 -0
  29. package/dist/types/approvals/intent.d.ts +32 -0
  30. package/dist/types/approvals/judge.d.ts +86 -0
  31. package/dist/types/approvals/record.d.ts +112 -0
  32. package/dist/types/client.d.ts +3 -0
  33. package/dist/types/host.d.ts +5 -0
  34. package/dist/types/index.d.ts +1 -0
  35. package/dist/types/services.d.ts +5 -2
  36. package/dist/types/spectrum/approvals-port.d.ts +13 -0
  37. package/dist/types/spectrum/index.d.ts +4 -0
  38. package/dist/types/titles/labels.d.ts +3 -1
  39. package/package.json +5 -4
@@ -1,5 +1,6 @@
1
1
  import { type Context, type Host, type ReplicatedState } from '@earendil-works/chord';
2
2
  import type { Agent } from './agent.ts';
3
+ import { type ApprovalJudge, type Approvals, type DecidedBy } from './approvals/index.ts';
3
4
  import type { ChangesRuntime } from './changes/index.ts';
4
5
  import { type HostLicks, type HostScoops } from './control.ts';
5
6
  import type { FreezerRuntime } from './freezer/index.ts';
@@ -27,6 +28,7 @@ export interface AgentHost {
27
28
  readonly agent: Agent;
28
29
  readonly users?: UserClients;
29
30
  readonly pages: Pages;
31
+ readonly approvals: Approvals;
30
32
  connect(endpoint: PortEndpoint, options?: ConnectOptions): void;
31
33
  close(): Promise<void>;
32
34
  }
@@ -54,6 +56,8 @@ export declare function hostAgent(agent: Agent, options?: {
54
56
  uploads?: Uploads;
55
57
  thumbnail?: Thumbnail;
56
58
  labels?: LabelsRuntime;
59
+ approvals?: Approvals;
60
+ judge?: ApprovalJudge;
57
61
  }): Promise<AgentHost>;
58
62
  interface Served {
59
63
  trusted: AgentControl;
@@ -63,6 +67,7 @@ interface Served {
63
67
  settings: AgentSettings;
64
68
  remote: AgentRemote;
65
69
  pages: Pages;
70
+ decide: (by: DecidedBy) => AgentControl['decide'];
66
71
  }
67
72
  export declare function serveAgent(serving: Served): Host;
68
73
  export {};
@@ -1,5 +1,6 @@
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, 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';
3
4
  export { FILE_LIMIT, IMAGE_LIMIT, type SendAttachment, type ShownAttachment, splitUser, TOTAL_LIMIT, userParts, } from './attachments.ts';
4
5
  export { type AgentConnection, connectAgent } from './client.ts';
5
6
  export { createAgentControl } from './control.ts';
@@ -1,5 +1,6 @@
1
1
  import type { Context, JsonValue, RemoteContract, ReplicatedState } from '@earendil-works/chord';
2
2
  import type { ConversationView } from '@earendil-works/pi-durable';
3
+ import type { Approval, ApprovalAnswer, ApprovalDecided } from './approvals/index.ts';
3
4
  import type { SendAttachment, ShownAttachment } from './attachments.ts';
4
5
  import type { ChangesView } from './changes/git.ts';
5
6
  import type { FrozenCone } from './freezer/index.ts';
@@ -87,6 +88,7 @@ export interface AgentControl {
87
88
  image(ref: ImageRef, context: Context): Promise<StoredImage>;
88
89
  agentCommands(agentId: string, context: Context): Promise<Command[]>;
89
90
  toolLabel(agentId: string, callIds: string[], context: Context): Promise<string | null>;
91
+ decide(id: string, decision: ApprovalAnswer, reason: string | null, context: Context): Promise<ApprovalDecided>;
90
92
  }
91
93
  export interface ImageRef {
92
94
  entry: number;
@@ -231,7 +233,7 @@ export interface AgentSettingsChange {
231
233
  thinkingLevel: 'off' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max' | null;
232
234
  agentId?: string | null;
233
235
  }
234
- export declare const CONTROL_METHODS: ("abort" | "agentCommands" | "changeAccept" | "changeRevert" | "changesOpen" | "compact" | "compactAgent" | "configure" | "createCone" | "createScoop" | "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")[];
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")[];
235
237
  export declare const CONTROL_READS: readonly (keyof AgentControl & string)[];
236
238
  export declare const AgentControl: RemoteContract;
237
239
  export type Delivered = 'run' | 'steer' | 'follow-up';
@@ -250,6 +252,7 @@ export interface AgentTranscript {
250
252
  readonly monitor: ReplicatedState<MonitorFeed>;
251
253
  readonly vault: ReplicatedState<VaultState>;
252
254
  readonly labels: ReplicatedState<Record<string, string>>;
255
+ readonly approvals: ReplicatedState<Approval[]>;
253
256
  }
254
257
  export interface PrivateRevision {
255
258
  revision: number;
@@ -259,7 +262,7 @@ export interface Command {
259
262
  description: string;
260
263
  kind: 'prompt' | 'skill' | 'action';
261
264
  }
262
- export declare const TRANSCRIPT_STATES: ("agents" | "changes" | "commands" | "deliveries" | "frozen" | "labels" | "memories" | "memoryScopes" | "monitor" | "privateRevision" | "sprinkles" | "state" | "vault" | "views")[];
265
+ export declare const TRANSCRIPT_STATES: ("agents" | "approvals" | "changes" | "commands" | "deliveries" | "frozen" | "labels" | "memories" | "memoryScopes" | "monitor" | "privateRevision" | "sprinkles" | "state" | "vault" | "views")[];
263
266
  export declare const AgentTranscript: RemoteContract;
264
267
  export declare const REMOTE_METHODS: ("abort" | "close" | "next" | "prompt" | "watch")[];
265
268
  export declare const REMOTE_READS: readonly (keyof AgentRemote & string)[];
@@ -0,0 +1,13 @@
1
+ import type { Approval, ApprovalDecision, ApprovalsEvents, ApprovalsPort } from '@ai-ecoverse/slicc-spectrum/ui';
2
+ import type { Approval as Item } from '../approvals/record.ts';
3
+ import type { AgentConnection } from '../client.ts';
4
+ import { Emitter } from './emitter.ts';
5
+ export declare function shown(item: Item, agentName: string | undefined): Approval;
6
+ export type HostApprovals = ApprovalsPort;
7
+ export declare const NOT_HERE = "This request can't be answered in this tab.";
8
+ export declare class ApprovalsAdapter extends Emitter<ApprovalsEvents> implements ApprovalsPort {
9
+ #private;
10
+ readonly decide?: (id: string, decision: ApprovalDecision, reason?: string) => Promise<void>;
11
+ constructor(connection: AgentConnection, host?: HostApprovals);
12
+ list(): readonly Approval[];
13
+ }
@@ -1,6 +1,7 @@
1
1
  import type { MonitorSection } from '@ai-ecoverse/slicc-spectrum/ui';
2
2
  import type { AgentConnection } from '../client.ts';
3
3
  import { AgentAdapter } from './agent-port.ts';
4
+ import { ApprovalsAdapter, type HostApprovals } from './approvals-port.ts';
4
5
  import { ChangesAdapter } from './changes-port.ts';
5
6
  import { MemoryAdapter } from './memory-port.ts';
6
7
  import { MonitorAdapter } from './monitor-port.ts';
@@ -10,6 +11,7 @@ import { type Login, SettingsAdapter } from './settings-port.ts';
10
11
  import { SprinkleAdapter } from './sprinkle-port.ts';
11
12
  import { TrayAdapter } from './tray-port.ts';
12
13
  export { AgentAdapter, CONE } from './agent-port.ts';
14
+ export { ApprovalsAdapter, type HostApprovals, NOT_HERE, shown as shownApproval, } from './approvals-port.ts';
13
15
  export { ChangesAdapter, type ChangesEvents } from './changes-port.ts';
14
16
  export { MemoryAdapter } from './memory-port.ts';
15
17
  export { assistant, errorAction, errorPart, isBusy, queued, textOf, toMessages, } from './messages.ts';
@@ -26,9 +28,11 @@ export declare function createAgentModel(connection: AgentConnection, options?:
26
28
  extra?: () => readonly MonitorSection[];
27
29
  };
28
30
  page?: PageOptions;
31
+ approvals?: HostApprovals;
29
32
  notices?: HostNotices;
30
33
  }): {
31
34
  agent: AgentAdapter;
35
+ approvals: ApprovalsAdapter;
32
36
  settings: SettingsAdapter;
33
37
  tray: TrayAdapter;
34
38
  sprinkles: SprinkleAdapter;
@@ -1,5 +1,6 @@
1
1
  import { type Context, type ReplicatedState } from '@earendil-works/chord';
2
- import { type ConversationView, type Harness } from '@earendil-works/pi-durable';
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-agent",
3
- "version": "5.0.3",
3
+ "version": "5.2.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 .",
@@ -63,8 +64,8 @@
63
64
  "devDependencies": {
64
65
  "@ai-ecoverse/slicc-kernel": "1.94.0",
65
66
  "@ai-ecoverse/slicc-scrub": "1.0.0",
66
- "@ai-ecoverse/slicc-shared-web": "1.20.0",
67
- "@ai-ecoverse/slicc-spectrum": "1.77.1",
67
+ "@ai-ecoverse/slicc-shared-web": "1.21.0",
68
+ "@ai-ecoverse/slicc-spectrum": "1.79.1",
68
69
  "@ai-ecoverse/wasm-bash": "5.3.0-18",
69
70
  "@ai-ecoverse/wasm-coreutils": "9.12.0-6",
70
71
  "@ai-ecoverse/wasm-git": "2.55.0-15",
@@ -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.75.0"
96
+ "@ai-ecoverse/slicc-spectrum": "^1.78.0"
96
97
  },
97
98
  "peerDependenciesMeta": {
98
99
  "@ai-ecoverse/slicc-spectrum": {