@ai-ecoverse/slicc-agent 3.52.1 → 4.1.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 +17 -13
- package/dist/client.js +3 -1
- package/dist/client.js.map +2 -2
- package/dist/control.js +4 -1
- package/dist/control.js.map +2 -2
- package/dist/freezer/index.js +27 -68
- package/dist/freezer/index.js.map +2 -2
- package/dist/host.js +2 -0
- package/dist/host.js.map +2 -2
- package/dist/index.js +0 -3
- package/dist/index.js.map +2 -2
- package/dist/kernel/agent-users.js +3 -0
- package/dist/kernel/agent-users.js.map +2 -2
- package/dist/main.js +111 -26
- package/dist/main.js.map +2 -2
- package/dist/mcp/accounts.js +18 -14
- package/dist/mcp/accounts.js.map +2 -2
- package/dist/mcp/connection.js +0 -2
- package/dist/mcp/connection.js.map +2 -2
- package/dist/mcp/credentials.js +6 -15
- package/dist/mcp/credentials.js.map +2 -2
- package/dist/mcp/index.js +0 -1
- package/dist/mcp/index.js.map +2 -2
- package/dist/mcp/oauth.js +15 -20
- package/dist/mcp/oauth.js.map +2 -2
- package/dist/mcp/runtime.js +36 -14
- package/dist/mcp/runtime.js.map +2 -2
- package/dist/mcp/tools.js +4 -6
- package/dist/mcp/tools.js.map +2 -2
- package/dist/models/index.js +7 -4
- package/dist/models/index.js.map +2 -2
- package/dist/monitor/index.js +5 -10
- package/dist/monitor/index.js.map +2 -2
- package/dist/monitor/redact.js +4 -5
- package/dist/monitor/redact.js.map +2 -2
- package/dist/secrets/credentials.js +32 -0
- package/dist/secrets/credentials.js.map +7 -0
- package/dist/secrets/endpoints.js +111 -0
- package/dist/secrets/endpoints.js.map +7 -0
- package/dist/secrets/extension.js +6 -3
- package/dist/secrets/extension.js.map +2 -2
- package/dist/secrets/fetch.js +160 -0
- package/dist/secrets/fetch.js.map +7 -0
- package/dist/secrets/records.js +35 -0
- package/dist/secrets/records.js.map +7 -0
- package/dist/secrets/store.js +50 -0
- package/dist/secrets/store.js.map +7 -0
- package/dist/secrets/vault.js +58 -13
- package/dist/secrets/vault.js.map +2 -2
- package/dist/services.js.map +2 -2
- package/dist/settings.js +85 -23
- package/dist/settings.js.map +2 -2
- package/dist/skills/index.js +20 -3
- package/dist/skills/index.js.map +3 -3
- package/dist/spectrum/agent-port.js +29 -1
- package/dist/spectrum/agent-port.js.map +2 -2
- package/dist/spectrum/settings-port.js +24 -6
- package/dist/spectrum/settings-port.js.map +2 -2
- package/dist/titles/extension.js +110 -0
- package/dist/titles/extension.js.map +7 -0
- package/dist/{freezer/title.js → titles/generate.js} +21 -2
- package/dist/titles/generate.js.map +7 -0
- package/dist/types/client.d.ts +2 -1
- package/dist/types/control.d.ts +1 -1
- package/dist/types/freezer/index.d.ts +2 -5
- package/dist/types/host.d.ts +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/main.d.ts +7 -2
- package/dist/types/mcp/accounts.d.ts +10 -4
- package/dist/types/mcp/connection.d.ts +0 -2
- package/dist/types/mcp/credentials.d.ts +6 -4
- package/dist/types/mcp/oauth.d.ts +3 -2
- package/dist/types/mcp/runtime.d.ts +18 -4
- package/dist/types/models/index.d.ts +2 -0
- package/dist/types/monitor/index.d.ts +0 -1
- package/dist/types/monitor/redact.d.ts +2 -2
- package/dist/types/secrets/credentials.d.ts +5 -0
- package/dist/types/secrets/endpoints.d.ts +27 -0
- package/dist/types/secrets/fetch.d.ts +13 -0
- package/dist/types/secrets/records.d.ts +13 -0
- package/dist/types/secrets/store.d.ts +7 -0
- package/dist/types/secrets/vault.d.ts +31 -1
- package/dist/types/services.d.ts +13 -1
- package/dist/types/settings.d.ts +17 -2
- package/dist/types/skills/index.d.ts +4 -1
- package/dist/types/spectrum/agent-port.d.ts +1 -1
- package/dist/types/spectrum/settings-port.d.ts +6 -4
- package/dist/types/titles/extension.d.ts +19 -0
- package/dist/types/{freezer/title.d.ts → titles/generate.d.ts} +4 -0
- package/package.json +6 -4
- package/dist/credentials.js +0 -100
- package/dist/credentials.js.map +0 -7
- package/dist/freezer/title.js.map +0 -7
- package/dist/types/credentials.d.ts +0 -12
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/titles/generate.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Context } from '@earendil-works/chord';\nimport type { Message } from '@earendil-works/pi-ai';\nimport type { Models } from '@earendil-works/pi-ai/models';\nimport type { EntryRecord } from '@earendil-works/pi-durable';\nimport type { ExecutionEnv } from '@earendil-works/pi-durable/env';\nimport { answerText } from '../agent.ts';\nimport { extractSettings } from '../memory/extract.ts';\nimport { redactSecrets } from '../memory/format.ts';\nimport { scrubText } from '../secrets/scrub.ts';\n\nexport const TITLE_PROMPT =\n 'Give this chat a title of three to six words that says what it is about, in the language the user writes in. Answer with the title only, without quotes.';\n\nexport const TRANSCRIPT_LENGTH = 4000;\n\nexport function titlesOn(text: string | undefined): boolean {\n try {\n return (JSON.parse(text ?? '{}') as { titles?: unknown }).titles !== false;\n } catch {\n return true;\n }\n}\n\nexport function settingsText(\n env: Pick<ExecutionEnv, 'readTextFile'>,\n home: string,\n dir = `${home}/.pi/agent`\n): (context: Context) => Promise<string | undefined> {\n return async (context) => {\n const read = await env.readTextFile(`${dir}/settings.json`, context);\n return read.ok ? read.value : undefined;\n };\n}\n\nfunction textOf(entry: EntryRecord): string {\n return answerText(entry.model?.[0]?.content).trim();\n}\n\nexport function transcriptOf(entries: readonly EntryRecord[]): string {\n return entries\n .filter((entry) => entry.kind === 'pi.user' || entry.kind === 'pi.assistant')\n .map((entry) => `${entry.kind === 'pi.user' ? 'User' : 'Agent'}: ${textOf(entry)}`)\n .join('\\n');\n}\n\nexport async function scrubTranscript(entries: readonly EntryRecord[]): Promise<string> {\n const raw = transcriptOf(entries);\n const redacted = redactSecrets(raw).text;\n const scrubbed = await scrubText(redacted);\n return scrubbed.slice(0, TRANSCRIPT_LENGTH);\n}\n\nexport function titler(\n models: Models,\n settings: (context: Context) => Promise<string | undefined>\n) {\n return async (\n transcript: string,\n model: string,\n context: Context\n ): Promise<string | undefined> => {\n const text = await settings(context);\n if (!titlesOn(text)) return undefined;\n const chosen = extractSettings(text).model;\n const [provider, ...rest] = model.split('/');\n const ref = chosen ?? (provider && rest.length ? { provider, modelId: rest.join('/') } : null);\n const found = ref ? models.getModel(ref.provider, ref.modelId) : undefined;\n if (!found || !transcript) return undefined;\n const message = await models.completeSimple(\n found,\n {\n messages: [\n {\n role: 'user',\n content: [{ type: 'text', text: `${TITLE_PROMPT}\\n\\n${transcript}` }],\n timestamp: Date.now(),\n } as Message,\n ],\n },\n { maxTokens: 40 }\n );\n if (message.stopReason === 'error') return undefined;\n return message.content\n .map((part) => (part.type === 'text' ? part.text : ''))\n .join('')\n .trim();\n };\n}\n"],
|
|
5
|
+
"mappings": "AAKA,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAEnB,MAAM,eACX;AAEK,MAAM,oBAAoB;AAE1B,SAAS,SAAS,MAAmC;AAC1D,MAAI;AACF,WAAQ,KAAK,MAAM,QAAQ,IAAI,EAA2B,WAAW;AAAA,EACvE,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,SAAS,aACd,KACA,MACA,MAAM,GAAG,IAAI,cACsC;AACnD,SAAO,OAAO,YAAY;AACxB,UAAM,OAAO,MAAM,IAAI,aAAa,GAAG,GAAG,kBAAkB,OAAO;AACnE,WAAO,KAAK,KAAK,KAAK,QAAQ;AAAA,EAChC;AACF;AAEA,SAAS,OAAO,OAA4B;AAC1C,SAAO,WAAW,MAAM,QAAQ,CAAC,GAAG,OAAO,EAAE,KAAK;AACpD;AAEO,SAAS,aAAa,SAAyC;AACpE,SAAO,QACJ,OAAO,CAAC,UAAU,MAAM,SAAS,aAAa,MAAM,SAAS,cAAc,EAC3E,IAAI,CAAC,UAAU,GAAG,MAAM,SAAS,YAAY,SAAS,OAAO,KAAK,OAAO,KAAK,CAAC,EAAE,EACjF,KAAK,IAAI;AACd;AAEA,eAAsB,gBAAgB,SAAkD;AACtF,QAAM,MAAM,aAAa,OAAO;AAChC,QAAM,WAAW,cAAc,GAAG,EAAE;AACpC,QAAM,WAAW,MAAM,UAAU,QAAQ;AACzC,SAAO,SAAS,MAAM,GAAG,iBAAiB;AAC5C;AAEO,SAAS,OACd,QACA,UACA;AACA,SAAO,OACL,YACA,OACA,YACgC;AAChC,UAAM,OAAO,MAAM,SAAS,OAAO;AACnC,QAAI,CAAC,SAAS,IAAI,EAAG,QAAO;AAC5B,UAAM,SAAS,gBAAgB,IAAI,EAAE;AACrC,UAAM,CAAC,UAAU,GAAG,IAAI,IAAI,MAAM,MAAM,GAAG;AAC3C,UAAM,MAAM,WAAW,YAAY,KAAK,SAAS,EAAE,UAAU,SAAS,KAAK,KAAK,GAAG,EAAE,IAAI;AACzF,UAAM,QAAQ,MAAM,OAAO,SAAS,IAAI,UAAU,IAAI,OAAO,IAAI;AACjE,QAAI,CAAC,SAAS,CAAC,WAAY,QAAO;AAClC,UAAM,UAAU,MAAM,OAAO;AAAA,MAC3B;AAAA,MACA;AAAA,QACE,UAAU;AAAA,UACR;AAAA,YACE,MAAM;AAAA,YACN,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAM,GAAG,YAAY;AAAA;AAAA,EAAO,UAAU,GAAG,CAAC;AAAA,YACpE,WAAW,KAAK,IAAI;AAAA,UACtB;AAAA,QACF;AAAA,MACF;AAAA,MACA,EAAE,WAAW,GAAG;AAAA,IAClB;AACA,QAAI,QAAQ,eAAe,QAAS,QAAO;AAC3C,WAAO,QAAQ,QACZ,IAAI,CAAC,SAAU,KAAK,SAAS,SAAS,KAAK,OAAO,EAAG,EACrD,KAAK,EAAE,EACP,KAAK;AAAA,EACV;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/types/client.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { MemoryEntry, MemoryScope } from './memory/format.ts';
|
|
|
6
6
|
import type { AgentRemote } from './remote/host.ts';
|
|
7
7
|
import type { AgentPages } from './remote/pages.ts';
|
|
8
8
|
import type { VaultState } from './secrets/vault.ts';
|
|
9
|
-
import { AgentControl, AgentSettings, type AgentsSummary, type Command, type Delivered, type MonitorFeed, type SendMode } from './services.ts';
|
|
9
|
+
import { AgentControl, AgentSettings, type AgentsSummary, type Command, type Delivered, type MonitorFeed, type PrivateRevision, type SendMode } from './services.ts';
|
|
10
10
|
import type { Sprinkle } from './sprinkles/kind.ts';
|
|
11
11
|
import { type PortEndpoint } from './wire.ts';
|
|
12
12
|
export interface AgentConnection {
|
|
@@ -17,6 +17,7 @@ export interface AgentConnection {
|
|
|
17
17
|
readonly agents?: ReplicatedState<AgentsSummary>;
|
|
18
18
|
readonly views?: ReplicatedState<Record<string, ConversationView>>;
|
|
19
19
|
readonly commands?: ReplicatedState<Command[]>;
|
|
20
|
+
readonly privateRevision?: ReplicatedState<PrivateRevision>;
|
|
20
21
|
readonly sprinkles?: ReplicatedState<Sprinkle[]>;
|
|
21
22
|
readonly memories?: ReplicatedState<MemoryEntry[]>;
|
|
22
23
|
readonly memoryScopes?: ReplicatedState<MemoryScope[]>;
|
package/dist/types/control.d.ts
CHANGED
|
@@ -22,4 +22,4 @@ export interface HostScoops {
|
|
|
22
22
|
}
|
|
23
23
|
export declare function readable(out: string): string;
|
|
24
24
|
export declare function submissionId(value: string): SubmissionId | undefined;
|
|
25
|
-
export declare function createAgentControl(harness: Harness, target: Conversation | Cones, deliveries?: Deliveries, licks?: HostLicks, scoops?: HostScoops, skills?: Pick<SkillsRuntime, 'expand'>, sprinkles?: Pick<SprinklesRuntime, 'send' | 'call'>, memory?: Pick<MemoryRuntime, 'save' | 'remove'>, freezer?: Pick<FreezerRuntime, 'freeze' | 'newChat' | 'thaw' | 'discard'>, changes?: Pick<ChangesRuntime, 'open' | 'accept' | 'revert'>, monitor?: Pick<Monitor, 'open' | 'close'>, secrets?: () => readonly SecretName[], uploads?: Uploads): AgentControl;
|
|
25
|
+
export declare function createAgentControl(harness: Harness, target: Conversation | Cones, deliveries?: Deliveries, licks?: HostLicks, scoops?: HostScoops, skills?: Pick<SkillsRuntime, 'expand' | 'commandsFor'>, sprinkles?: Pick<SprinklesRuntime, 'send' | 'call'>, memory?: Pick<MemoryRuntime, 'save' | 'remove'>, freezer?: Pick<FreezerRuntime, 'freeze' | 'newChat' | 'thaw' | 'discard'>, changes?: Pick<ChangesRuntime, 'open' | 'accept' | 'revert'>, monitor?: Pick<Monitor, 'open' | 'close'>, secrets?: () => readonly SecretName[], uploads?: Uploads): AgentControl;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Context, type ReplicatedState } from '@earendil-works/chord';
|
|
2
2
|
import type { EntryRecord, Harness } from '@earendil-works/pi-durable';
|
|
3
3
|
import type { ExecutionEnv } from '@earendil-works/pi-durable/env';
|
|
4
|
-
import { type Agents, type AgentsState, type
|
|
4
|
+
import { type Agents, type AgentsState, type FrozenRecord } from '../agents.ts';
|
|
5
5
|
import { type Layout } from '../layout.ts';
|
|
6
6
|
import type { LickTarget } from '../licks/lick.ts';
|
|
7
7
|
export type Answer = {
|
|
@@ -32,6 +32,7 @@ export interface FreezerAttach {
|
|
|
32
32
|
env: Pick<ExecutionEnv, 'remove' | 'exists'>;
|
|
33
33
|
title?: (transcript: string, model: string, context: Context) => Promise<string | undefined>;
|
|
34
34
|
extract?: (conversation: number, tail: number, context: Context, cone: string) => Promise<unknown>;
|
|
35
|
+
cancelTitle?: (agentId: string) => void;
|
|
35
36
|
now?: () => number;
|
|
36
37
|
layout?: Layout;
|
|
37
38
|
}
|
|
@@ -48,7 +49,6 @@ export interface FreezerRuntime {
|
|
|
48
49
|
close(): void;
|
|
49
50
|
}
|
|
50
51
|
export declare const USAGE = "usage:\n freezer list every conversation: id, kind, name, title, messages, when\n freezer show <id> a conversation as Markdown\n freezer thaw <id> continue a stopped conversation as a cone\n\nDelete a cone, or start a new conversation, from the chat toolbar or the command palette.\n";
|
|
51
|
-
export declare const TITLE_TURNS: number[];
|
|
52
52
|
export declare const TOUCH_MS = 500;
|
|
53
53
|
export declare function modelName(model: {
|
|
54
54
|
provider: string;
|
|
@@ -56,9 +56,6 @@ export declare function modelName(model: {
|
|
|
56
56
|
} | undefined): string;
|
|
57
57
|
export declare function firstLine(entries: readonly EntryRecord[]): string;
|
|
58
58
|
export declare function markdown(record: Pick<FrozenRecord, 'title' | 'name' | 'model' | 'frozenAt'>, entries: readonly EntryRecord[]): string;
|
|
59
|
-
export declare function trivial(text: string): boolean;
|
|
60
|
-
export declare function titleDue(record: Pick<ConeRecord, 'titled'>, entries: readonly EntryRecord[], final?: boolean): number | undefined;
|
|
61
|
-
export declare function cleanTitle(title: string | undefined): string | undefined;
|
|
62
59
|
export declare function thawedNote(kind: ConversationKind, name: string, folder: string, kept: boolean, home?: string): string;
|
|
63
60
|
export declare function frozenTarget(state: Readonly<AgentsState>, target: LickTarget): Frozen | undefined;
|
|
64
61
|
export declare function attachFreezer(options: FreezerAttach): FreezerRuntime;
|
package/dist/types/host.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export declare function hostAgent(agent: Agent, options?: {
|
|
|
46
46
|
changes?: ChangesRuntime;
|
|
47
47
|
mcp?: Pick<McpRuntime, 'close'>;
|
|
48
48
|
users?: UserClients;
|
|
49
|
-
monitor?: Pick<MonitorOptions, 'kernel' | 'groups' | 'users'
|
|
49
|
+
monitor?: Pick<MonitorOptions, 'kernel' | 'groups' | 'users'>;
|
|
50
50
|
pages?: Pages;
|
|
51
51
|
secrets?: HostSecrets;
|
|
52
52
|
uploads?: Uploads;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export { type Agent, type AgentOptions, answerText, openAgent } from './agent.ts
|
|
|
3
3
|
export { FILE_LIMIT, IMAGE_LIMIT, type SendAttachment, type ShownAttachment, splitUser, TOTAL_LIMIT, userParts, } from './attachments.ts';
|
|
4
4
|
export { type AgentConnection, connectAgent } from './client.ts';
|
|
5
5
|
export { createAgentControl } from './control.ts';
|
|
6
|
-
export { CREDENTIALS_DATABASE, EncryptedCredentialStore } from './credentials.ts';
|
|
7
6
|
export { type AgentHost, type ConnectOptions, hostAgent } from './host.ts';
|
|
8
7
|
export type { KernelClient, KernelFs, KernelProcess, KernelStat, SpawnOptions, } from './kernel/client.ts';
|
|
9
8
|
export { HOME, type KernelEnvOptions, kernelEnvironment, SliccKernelEnv } from './kernel/env.ts';
|
package/dist/types/main.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Provider } from '@earendil-works/pi-ai';
|
|
2
2
|
import type { Models } from '@earendil-works/pi-ai/models';
|
|
3
3
|
import { type ModelRef, type Storage } from '@earendil-works/pi-durable';
|
|
4
4
|
import { type AgentHost } from './host.ts';
|
|
@@ -6,6 +6,9 @@ import type { KernelClient } from './kernel/client.ts';
|
|
|
6
6
|
import { type UserClients } from './kernel/users.ts';
|
|
7
7
|
import { type Transport } from './net.ts';
|
|
8
8
|
import { type Assets } from './scoops/index.ts';
|
|
9
|
+
import { type ModelBases } from './secrets/endpoints.ts';
|
|
10
|
+
import { type PlainStore } from './secrets/store.ts';
|
|
11
|
+
import { createSliccModels } from './settings.ts';
|
|
9
12
|
import { type WorkerScope } from './worker.ts';
|
|
10
13
|
export interface AgentWorkerScope extends WorkerScope {
|
|
11
14
|
fetch: typeof fetch;
|
|
@@ -20,7 +23,7 @@ export interface AgentWorkerOptions {
|
|
|
20
23
|
model?: ModelRef;
|
|
21
24
|
providers?: Provider[];
|
|
22
25
|
attach?: KernelAttach;
|
|
23
|
-
|
|
26
|
+
store?: () => Promise<PlainStore>;
|
|
24
27
|
storage?: () => Promise<Storage>;
|
|
25
28
|
assets?: Assets;
|
|
26
29
|
codemodeWasm?: () => Promise<WebAssembly.Module | undefined>;
|
|
@@ -31,7 +34,9 @@ export interface AgentWorkerOptions {
|
|
|
31
34
|
}
|
|
32
35
|
export declare function usersOf(admin: MessagePort | undefined, wanted: boolean | undefined, attach: KernelAttach): UserClients | undefined;
|
|
33
36
|
export declare const STORE_DIR = "/.slicc";
|
|
37
|
+
export declare const ACCOUNTS_FILE = "/.slicc/accounts.json";
|
|
34
38
|
export declare function seesImages(models: Pick<Models, 'getModel'>, ref: ModelRef | undefined): boolean;
|
|
35
39
|
export declare const MCP_CALLBACK = "/oauth/mcp-callback";
|
|
40
|
+
export declare function modelBases(providers: readonly Provider[], models: Pick<ReturnType<typeof createSliccModels>, 'getModels'>): ModelBases[];
|
|
36
41
|
export declare function alive(client: KernelClient): (pid: number) => Promise<boolean>;
|
|
37
42
|
export declare function runAgentWorker(scope: AgentWorkerScope, options?: AgentWorkerOptions): Promise<AgentHost>;
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Context } from '@earendil-works/chord';
|
|
2
2
|
import type { McpFetch } from '@earendil-works/pi-mcp';
|
|
3
3
|
import type { AccountState } from '../services.ts';
|
|
4
4
|
import type { McpCatalog } from './catalog.ts';
|
|
5
5
|
import type { McpServerEntry } from './config.ts';
|
|
6
6
|
import type { McpServerConnection } from './connection.ts';
|
|
7
|
+
import { type McpRecords } from './credentials.ts';
|
|
7
8
|
import { type McpSignIn, type StoredOAuth } from './oauth.ts';
|
|
9
|
+
export declare const TOKENS_IN_VAULT = "MCP tokens are kept in seven's vault: update seven";
|
|
8
10
|
export interface McpAccounts {
|
|
9
11
|
accounts(): Promise<AccountState[]>;
|
|
10
12
|
signIn(id: string): Promise<McpSignIn>;
|
|
11
|
-
connect(id: string, secret: string): Promise<void>;
|
|
13
|
+
connect(id: string, secret: string | null): Promise<void>;
|
|
12
14
|
disconnect(id: string): Promise<void>;
|
|
13
15
|
onChange(listener: () => void): () => void;
|
|
14
16
|
}
|
|
15
17
|
export interface AccountSources {
|
|
16
|
-
|
|
18
|
+
records: McpRecords & {
|
|
19
|
+
refresh(context: Context): Promise<void>;
|
|
20
|
+
};
|
|
17
21
|
oauth: (entry: McpServerEntry) => StoredOAuth;
|
|
18
|
-
fetch: McpFetch;
|
|
22
|
+
fetch: (server: string) => McpFetch;
|
|
23
|
+
grant: (server: string) => McpFetch;
|
|
24
|
+
register: (server: string, tokenUrl: string) => Promise<void>;
|
|
19
25
|
}
|
|
20
26
|
export declare function mcpAccounts(catalog: McpCatalog, sources: AccountSources, restart: (connection: McpServerConnection) => void, listeners: Set<() => void>): McpAccounts;
|
|
@@ -3,7 +3,6 @@ import { type McpServerEntry } from './config.ts';
|
|
|
3
3
|
export type ServerState = 'connecting' | 'connected' | 'needs-auth' | 'needs-secret' | 'failed' | 'closed';
|
|
4
4
|
export type TransportFactory = (entry: McpServerEntry) => Promise<{
|
|
5
5
|
transport: McpTransport;
|
|
6
|
-
secrets: string[];
|
|
7
6
|
} | {
|
|
8
7
|
missing: string[];
|
|
9
8
|
}>;
|
|
@@ -36,7 +35,6 @@ export declare class McpServerConnection {
|
|
|
36
35
|
resources: Resource[];
|
|
37
36
|
resourceTemplates: ResourceTemplate[];
|
|
38
37
|
instructions: string | undefined;
|
|
39
|
-
secrets: string[];
|
|
40
38
|
constructor(options: ConnectionOptions);
|
|
41
39
|
get name(): string;
|
|
42
40
|
get timeoutMs(): number;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import type { CredentialStore } from '@earendil-works/pi-ai';
|
|
2
1
|
import { type McpServerConfig } from './config.ts';
|
|
3
2
|
export declare const MCP_CREDENTIAL_PREFIX = "mcp:";
|
|
3
|
+
export interface McpRecords {
|
|
4
|
+
mcp(server: string, name?: string): {
|
|
5
|
+
placeholder: string;
|
|
6
|
+
} | undefined;
|
|
7
|
+
}
|
|
4
8
|
export declare function credentialKey(server: string, url: string): Promise<string>;
|
|
5
9
|
export declare function secretNames(config: McpServerConfig): string[];
|
|
6
10
|
export type Resolved = {
|
|
7
11
|
ok: true;
|
|
8
12
|
headers: Record<string, string>;
|
|
9
|
-
secrets: string[];
|
|
10
13
|
} | {
|
|
11
14
|
ok: false;
|
|
12
15
|
missing: string[];
|
|
13
16
|
};
|
|
14
|
-
export declare function resolveHeaders(server: string, config: McpServerConfig,
|
|
15
|
-
export declare function scrub(text: string, secrets: readonly string[]): string;
|
|
17
|
+
export declare function resolveHeaders(server: string, config: McpServerConfig, records: McpRecords): Resolved;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { CredentialStore } from '@earendil-works/pi-ai';
|
|
2
1
|
import type { AuthProvider, McpFetch } from '@earendil-works/pi-mcp';
|
|
3
2
|
import { authorizeMcp, McpOAuthAuthorizationRequiredError, type McpOAuthState } from '@earendil-works/pi-mcp/oauth';
|
|
3
|
+
import type { PlainStore } from '../secrets/store.ts';
|
|
4
4
|
import type { McpSignIn } from '../services.ts';
|
|
5
5
|
import type { McpServerConfig } from './config.ts';
|
|
6
6
|
type Provider = Parameters<typeof authorizeMcp>[0];
|
|
@@ -25,7 +25,7 @@ export declare class StoredOAuth implements Provider {
|
|
|
25
25
|
#private;
|
|
26
26
|
readonly redirectUrl: string;
|
|
27
27
|
readonly clientMetadata: Provider['clientMetadata'];
|
|
28
|
-
constructor(server: OAuthServer,
|
|
28
|
+
constructor(server: OAuthServer, store: PlainStore, redirectUrl: string);
|
|
29
29
|
get serverUrl(): string;
|
|
30
30
|
load(): Promise<McpOAuthState>;
|
|
31
31
|
update(change: (state: McpOAuthState) => McpOAuthState): Promise<void>;
|
|
@@ -47,6 +47,7 @@ export type { McpSignIn } from '../services.ts';
|
|
|
47
47
|
export declare function beginSignIn(provider: StoredOAuth, server: OAuthServer, options: {
|
|
48
48
|
fetch: McpFetch;
|
|
49
49
|
resourceMetadataUrl?: URL;
|
|
50
|
+
register(tokenUrl: string): Promise<void>;
|
|
50
51
|
}): Promise<McpSignIn>;
|
|
51
52
|
export interface Callback {
|
|
52
53
|
code?: string;
|
|
@@ -1,20 +1,35 @@
|
|
|
1
1
|
import type { Context } from '@earendil-works/chord';
|
|
2
|
-
import type { CredentialStore } from '@earendil-works/pi-ai';
|
|
3
2
|
import type { Registry } from '@earendil-works/pi-durable';
|
|
4
3
|
import type { ExecutionEnv } from '@earendil-works/pi-durable/env';
|
|
5
4
|
import type { LickEvent, Licks } from '../licks/licks.ts';
|
|
5
|
+
import type { McpServerSource } from '../secrets/endpoints.ts';
|
|
6
|
+
import type { PlainStore } from '../secrets/store.ts';
|
|
6
7
|
import { type McpAccounts } from './accounts.ts';
|
|
7
8
|
import { McpCatalog } from './catalog.ts';
|
|
8
9
|
import { type McpConfigProblem } from './config.ts';
|
|
9
10
|
import { McpServerConnection } from './connection.ts';
|
|
11
|
+
import { type McpRecords } from './credentials.ts';
|
|
10
12
|
export declare const MCP_LOG_MAX_BYTES: number;
|
|
11
13
|
export { configPath, logPath, shown } from './paths.ts';
|
|
14
|
+
export interface McpVault {
|
|
15
|
+
records: McpRecords & {
|
|
16
|
+
refresh(context: Context): Promise<void>;
|
|
17
|
+
state: {
|
|
18
|
+
subscribe(listener: () => void): () => void;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
fetch(server: string, base: typeof fetch): typeof fetch;
|
|
22
|
+
grant(server: string, base: typeof fetch): typeof fetch;
|
|
23
|
+
servers(list: readonly McpServerSource[]): Promise<void>;
|
|
24
|
+
token(server: string, url: string): Promise<void>;
|
|
25
|
+
}
|
|
12
26
|
export interface McpAttach {
|
|
13
27
|
licks: Licks;
|
|
14
28
|
env: ExecutionEnv;
|
|
15
29
|
home: string;
|
|
16
30
|
agentDir?: string;
|
|
17
|
-
|
|
31
|
+
store: PlainStore;
|
|
32
|
+
vault: McpVault;
|
|
18
33
|
fetch: typeof fetch;
|
|
19
34
|
version: string;
|
|
20
35
|
reloadMs: number;
|
|
@@ -31,14 +46,13 @@ export interface ServerStatus {
|
|
|
31
46
|
export type { McpAccounts } from './accounts.ts';
|
|
32
47
|
export interface McpRuntime extends McpAccounts {
|
|
33
48
|
status(): ServerStatus[];
|
|
34
|
-
secrets(): string[];
|
|
35
49
|
reload(context: Context): Promise<void>;
|
|
36
50
|
close(context: Context): Promise<void>;
|
|
37
51
|
}
|
|
38
52
|
export declare function problemLick(problem: McpConfigProblem, home: string, dir?: string): LickEvent;
|
|
39
53
|
export declare function stateLick(connection: McpServerConnection, cors: boolean): LickEvent | undefined;
|
|
40
54
|
export declare function connectedLick(connection: McpServerConnection): LickEvent;
|
|
41
|
-
export declare function logLine(server: string, params: unknown,
|
|
55
|
+
export declare function logLine(server: string, params: unknown, at: Date): string;
|
|
42
56
|
export declare function attachMcp(catalog: McpCatalog, options: McpAttach, context: Context): Promise<McpRuntime>;
|
|
43
57
|
export declare function startMcp(registry: Registry, options: McpAttach, context: Context): Promise<{
|
|
44
58
|
catalog: McpCatalog;
|
|
@@ -11,6 +11,8 @@ export interface ModelsOptions {
|
|
|
11
11
|
agents: Agents;
|
|
12
12
|
settings: Pick<AgentSettings, 'state'>;
|
|
13
13
|
catalog: Pick<Models, 'getProviders' | 'getModels'>;
|
|
14
|
+
locked?: () => boolean;
|
|
14
15
|
}
|
|
16
|
+
export declare const LOCKED_NOTE = "the vault is locked: unlock it to use these accounts";
|
|
15
17
|
export declare function closest(wanted: string, ids: readonly string[], count?: number): string[];
|
|
16
18
|
export declare function modelsCommand(options: ModelsOptions): (argv: readonly string[], caller: string | null, context: Context) => Promise<Answer>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const TEXT_MAX = 160;
|
|
2
2
|
export declare function cut(text: string, max?: number): string;
|
|
3
|
-
export declare function redacted(text: string
|
|
4
|
-
export declare function commandLine(argv: readonly string[]
|
|
3
|
+
export declare function redacted(text: string): string;
|
|
4
|
+
export declare function commandLine(argv: readonly string[]): string;
|
|
5
5
|
export declare function program(argv: readonly string[]): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CredentialStore } from '@earendil-works/pi-ai';
|
|
2
|
+
import type { VaultRecords } from './records.ts';
|
|
3
|
+
export declare const KEYS_IN_VAULT = "model keys are kept in seven's vault: enter them in Settings \u203A Accounts";
|
|
4
|
+
export type FieldsOf = (providerId: string) => Readonly<Record<string, string>> | undefined;
|
|
5
|
+
export declare function vaultCredentials(records: Pick<VaultRecords, 'model' | 'state'>, env?: FieldsOf): CredentialStore;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { McpServerEntry, ModelEndpoint } from '@ai-ecoverse/slicc-vault';
|
|
2
|
+
import type { ModelRoute } from './fetch.ts';
|
|
3
|
+
import type { AgentRecord } from './records.ts';
|
|
4
|
+
import type { Vault } from './vault.ts';
|
|
5
|
+
export declare const BEDROCK_ENDPOINTS: string[];
|
|
6
|
+
export declare function modelUrl(raw: string): boolean;
|
|
7
|
+
export declare function mcpUrl(raw: string): boolean;
|
|
8
|
+
export declare function pattern(base: string): RegExp;
|
|
9
|
+
export interface ModelBases {
|
|
10
|
+
provider: string;
|
|
11
|
+
urls: readonly string[];
|
|
12
|
+
}
|
|
13
|
+
export declare function modelRoute(bases: () => readonly ModelBases[], records: () => readonly AgentRecord[]): ModelRoute;
|
|
14
|
+
export declare function modelEndpoints(bases: readonly ModelBases[]): ModelEndpoint[];
|
|
15
|
+
export interface McpServerSource {
|
|
16
|
+
server: string;
|
|
17
|
+
url: string;
|
|
18
|
+
names: readonly string[];
|
|
19
|
+
}
|
|
20
|
+
export declare function mcpEndpoints(servers: readonly McpServerSource[], tokens: ReadonlyMap<string, string>): McpServerEntry[];
|
|
21
|
+
export interface Endpoints {
|
|
22
|
+
models(bases: readonly ModelBases[]): Promise<void>;
|
|
23
|
+
servers(servers: readonly McpServerSource[]): Promise<void>;
|
|
24
|
+
token(server: string, url: string): Promise<void>;
|
|
25
|
+
close(): void;
|
|
26
|
+
}
|
|
27
|
+
export declare function vaultEndpoints(vault: Pick<Vault, 'state' | 'connected' | 'endpoints'>): Endpoints;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { OutgoingRequest } from '@ai-ecoverse/slicc-vault';
|
|
2
|
+
import { type Vault } from './vault.ts';
|
|
3
|
+
type Fetch = typeof fetch;
|
|
4
|
+
type Port = Pick<Vault, 'connected' | 'needed' | 'model' | 'mcp' | 'refresh' | 'grant'>;
|
|
5
|
+
export type ModelRoute = (request: Request) => string | null | undefined;
|
|
6
|
+
export declare function absent(vault: Pick<Vault, 'connected' | 'needed'>): boolean;
|
|
7
|
+
export declare function refusal(error: unknown): Response;
|
|
8
|
+
export declare function safeError(error: unknown, original: OutgoingRequest, ready: OutgoingRequest): DOMException | TypeError;
|
|
9
|
+
export declare function vaultFetch(vault: Port, inner: Fetch, route: ModelRoute): Fetch;
|
|
10
|
+
export declare function mcpFetch(vault: Port, inner: Fetch, server: string): Fetch;
|
|
11
|
+
export declare const NO_VAULT_SIGN_IN = "MCP sign-in needs seven's vault: update seven";
|
|
12
|
+
export declare function grantFetch(vault: Port, server: string, base: Fetch): Fetch;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AgentRecord } from '@ai-ecoverse/slicc-vault';
|
|
2
|
+
import { type Context, type MutableReplicatedState } from '@earendil-works/chord';
|
|
3
|
+
import type { Vault } from './vault.ts';
|
|
4
|
+
export type { AgentRecord } from '@ai-ecoverse/slicc-vault';
|
|
5
|
+
export interface VaultRecords {
|
|
6
|
+
readonly state: MutableReplicatedState<AgentRecord[]>;
|
|
7
|
+
refresh(context: Context): Promise<void>;
|
|
8
|
+
model(provider: string): AgentRecord | undefined;
|
|
9
|
+
mcp(server: string, name?: string): AgentRecord | undefined;
|
|
10
|
+
close(): void;
|
|
11
|
+
}
|
|
12
|
+
type Source = Pick<Vault, 'state' | 'records' | 'connected' | 'needed'>;
|
|
13
|
+
export declare function vaultRecords(vault: Source): VaultRecords;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ExecutionEnv } from '@earendil-works/pi-durable/env';
|
|
2
|
+
export interface PlainStore {
|
|
3
|
+
get(key: string): Promise<unknown>;
|
|
4
|
+
set(key: string, value: unknown): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export declare function memoryStore(): PlainStore;
|
|
7
|
+
export declare function fileStore(env: ExecutionEnv, path: string): PlainStore;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AgentRecord, ErrorCode, McpServerEntry, ModelEndpoint, OAuthConfig, OutgoingRequest } from '@ai-ecoverse/slicc-vault';
|
|
1
2
|
import { type MutableReplicatedState } from '@earendil-works/chord';
|
|
2
3
|
import type { Scrub, Scrubbable, ScrubStream } from './scrub.ts';
|
|
3
4
|
export type ScrubPair = {
|
|
@@ -14,14 +15,43 @@ export interface VaultState {
|
|
|
14
15
|
}
|
|
15
16
|
export declare const WAITING_MS = 2000;
|
|
16
17
|
export declare const WAITING = "waiting for the vault";
|
|
18
|
+
export declare class VaultRefusal extends Error {
|
|
19
|
+
readonly code: ErrorCode | undefined;
|
|
20
|
+
constructor(code: ErrorCode | undefined, message: string);
|
|
21
|
+
}
|
|
22
|
+
export type RefreshTarget = {
|
|
23
|
+
server: string;
|
|
24
|
+
} | {
|
|
25
|
+
provider: string;
|
|
26
|
+
};
|
|
27
|
+
export interface Granted {
|
|
28
|
+
response: string | Uint8Array;
|
|
29
|
+
records: {
|
|
30
|
+
kind: string;
|
|
31
|
+
name: string;
|
|
32
|
+
placeholder: string;
|
|
33
|
+
}[];
|
|
34
|
+
expiresAt?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface EndpointSet {
|
|
37
|
+
model: ModelEndpoint[];
|
|
38
|
+
mcp: McpServerEntry[];
|
|
39
|
+
}
|
|
17
40
|
export declare class Vault implements Scrub {
|
|
18
41
|
#private;
|
|
19
42
|
readonly state: MutableReplicatedState<VaultState>;
|
|
20
43
|
constructor(now?: () => number);
|
|
21
44
|
get needed(): boolean;
|
|
22
|
-
|
|
45
|
+
get connected(): boolean;
|
|
46
|
+
connect(port: MessagePort | undefined, scrub: unknown, locked?: unknown): void;
|
|
23
47
|
ready(): Promise<void>;
|
|
24
48
|
texts<T extends Scrubbable>(texts: readonly T[]): Promise<T[]>;
|
|
49
|
+
model(provider: string | undefined, request: OutgoingRequest): Promise<OutgoingRequest>;
|
|
50
|
+
mcp(server: string, request: OutgoingRequest): Promise<OutgoingRequest>;
|
|
51
|
+
records(): Promise<AgentRecord[]>;
|
|
52
|
+
grant(server: string, response: string | Uint8Array, oauth: OAuthConfig, name?: string): Promise<Granted>;
|
|
53
|
+
refresh(target: RefreshTarget, name?: string): Promise<string>;
|
|
54
|
+
endpoints(set: EndpointSet): Promise<void>;
|
|
25
55
|
stream(): ScrubStream;
|
|
26
56
|
}
|
|
27
57
|
export declare function holdText(state: VaultState): string | undefined;
|
package/dist/types/services.d.ts
CHANGED
|
@@ -86,6 +86,7 @@ export interface AgentControl {
|
|
|
86
86
|
monitorOpen(lease: string | null, resync: boolean, context: Context): Promise<MonitorLease>;
|
|
87
87
|
monitorClose(lease: string, context: Context): Promise<void>;
|
|
88
88
|
image(ref: ImageRef, context: Context): Promise<StoredImage>;
|
|
89
|
+
agentCommands(agentId: string, context: Context): Promise<Command[]>;
|
|
89
90
|
}
|
|
90
91
|
export interface ImageRef {
|
|
91
92
|
entry: number;
|
|
@@ -238,6 +239,7 @@ export interface AgentTranscript {
|
|
|
238
239
|
readonly agents: ReplicatedState<AgentsSummary>;
|
|
239
240
|
readonly views: ReplicatedState<Record<string, ConversationView>>;
|
|
240
241
|
readonly commands: ReplicatedState<Command[]>;
|
|
242
|
+
readonly privateRevision: ReplicatedState<PrivateRevision>;
|
|
241
243
|
readonly sprinkles: ReplicatedState<Sprinkle[]>;
|
|
242
244
|
readonly memories: ReplicatedState<MemoryEntry[]>;
|
|
243
245
|
readonly memoryScopes: ReplicatedState<MemoryScope[]>;
|
|
@@ -246,6 +248,9 @@ export interface AgentTranscript {
|
|
|
246
248
|
readonly monitor: ReplicatedState<MonitorFeed>;
|
|
247
249
|
readonly vault: ReplicatedState<VaultState>;
|
|
248
250
|
}
|
|
251
|
+
export interface PrivateRevision {
|
|
252
|
+
revision: number;
|
|
253
|
+
}
|
|
249
254
|
export interface Command {
|
|
250
255
|
name: string;
|
|
251
256
|
description: string;
|
|
@@ -278,6 +283,13 @@ export interface AccountState {
|
|
|
278
283
|
needs: 'cors-free-transport' | null;
|
|
279
284
|
group?: 'providers' | 'mcp';
|
|
280
285
|
secret?: 'api-key' | 'token';
|
|
286
|
+
store?: 'vault';
|
|
287
|
+
fields?: AccountField[];
|
|
288
|
+
}
|
|
289
|
+
export interface AccountField {
|
|
290
|
+
name: string;
|
|
291
|
+
label: string;
|
|
292
|
+
required?: boolean;
|
|
281
293
|
}
|
|
282
294
|
export interface BudgetState {
|
|
283
295
|
provider: string;
|
|
@@ -301,7 +313,7 @@ export interface SettingsState {
|
|
|
301
313
|
}
|
|
302
314
|
export interface AgentSettings {
|
|
303
315
|
readonly state: ReplicatedState<SettingsState>;
|
|
304
|
-
connect(providerId: string, secret: string,
|
|
316
|
+
connect(providerId: string, secret: string | null, fields: Record<string, string> | null, context: Context): Promise<void>;
|
|
305
317
|
disconnect(providerId: string, context: Context): Promise<void>;
|
|
306
318
|
signIn(providerId: string, context: Context): Promise<SignIn | McpSignIn | null>;
|
|
307
319
|
}
|
package/dist/types/settings.d.ts
CHANGED
|
@@ -2,19 +2,34 @@ import type { CredentialStore, Provider } from '@earendil-works/pi-ai';
|
|
|
2
2
|
import { type MutableModels } from '@earendil-works/pi-ai/models';
|
|
3
3
|
import { type Budget } from './adobe.ts';
|
|
4
4
|
import type { McpAccounts } from './mcp/index.ts';
|
|
5
|
-
import type {
|
|
5
|
+
import type { VaultRecords } from './secrets/records.ts';
|
|
6
|
+
import type { PlainStore } from './secrets/store.ts';
|
|
7
|
+
import type { AccountField, AgentSettings } from './services.ts';
|
|
6
8
|
export declare const BEDROCK = "amazon-bedrock";
|
|
7
9
|
export declare const DEFAULT_MODEL: {
|
|
8
10
|
provider: string;
|
|
9
11
|
modelId: string;
|
|
10
12
|
};
|
|
11
13
|
export declare const DEFAULT_REGIONS: Readonly<Record<string, string>>;
|
|
14
|
+
export declare const ACCOUNT_FIELDS: Readonly<Record<string, readonly AccountField[]>>;
|
|
15
|
+
export declare const SIGN_IN_NEEDS_VAULT = "Adobe sign-in needs seven's vault: update seven";
|
|
16
|
+
export declare const KEY_NEEDS_VAULT = "API keys are kept in seven's vault: update seven";
|
|
12
17
|
export declare function sliccProviders(version?: string): Provider[];
|
|
13
18
|
export declare function withDefaultRegions(credentials: CredentialStore): CredentialStore;
|
|
14
19
|
export declare function createSliccModels(credentials: CredentialStore, providers?: Provider<import("@earendil-works/pi-ai").Api>[]): MutableModels;
|
|
20
|
+
export interface ProviderFields {
|
|
21
|
+
get(providerId: string): Readonly<Record<string, string>> | undefined;
|
|
22
|
+
env(providerId: string): Readonly<Record<string, string>> | undefined;
|
|
23
|
+
set(providerId: string, fields: Record<string, string> | undefined): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export declare function providerFields(store: PlainStore, providers: readonly Provider[]): Promise<ProviderFields>;
|
|
15
26
|
export declare function shown<T>(run: () => Promise<T>): Promise<T>;
|
|
16
27
|
export type UsageReader = (token: string) => Promise<Budget | null>;
|
|
17
|
-
export
|
|
28
|
+
export interface SettingsSources {
|
|
29
|
+
records: VaultRecords;
|
|
30
|
+
fields: ProviderFields;
|
|
31
|
+
}
|
|
32
|
+
export declare function createAgentSettings(models: MutableModels, sources: SettingsSources, providers?: Provider<import("@earendil-works/pi-ai").Api>[], options?: {
|
|
18
33
|
usage?: UsageReader;
|
|
19
34
|
every?: number;
|
|
20
35
|
mcp?: McpAccounts;
|
|
@@ -2,7 +2,7 @@ import { type Context, type ReplicatedState } from '@earendil-works/chord';
|
|
|
2
2
|
import { type Extension, type Registry } from '@earendil-works/pi-durable';
|
|
3
3
|
import type { ExecutionEnv } from '@earendil-works/pi-durable/env';
|
|
4
4
|
import type { Licks } from '../licks/licks.ts';
|
|
5
|
-
import type { Command } from '../services.ts';
|
|
5
|
+
import type { Command, PrivateRevision } from '../services.ts';
|
|
6
6
|
import { type Diagnostic, type Skill, type SkillRoot } from './skills.ts';
|
|
7
7
|
import { type PromptTemplate } from './templates.ts';
|
|
8
8
|
export declare const BUILTIN_SKILLS: string[];
|
|
@@ -16,6 +16,8 @@ export interface SkillsRuntime {
|
|
|
16
16
|
skills(): readonly Skill[];
|
|
17
17
|
dirs(): string[];
|
|
18
18
|
templates(): readonly PromptTemplate[];
|
|
19
|
+
readonly privateRevision: ReplicatedState<PrivateRevision>;
|
|
20
|
+
commandsFor(agentId: string): Command[];
|
|
19
21
|
expand(text: string, context: Context, conversationId?: number): Promise<string>;
|
|
20
22
|
reload(context: Context): Promise<void>;
|
|
21
23
|
close(context: Context): Promise<void>;
|
|
@@ -32,6 +34,7 @@ export interface SkillPeople {
|
|
|
32
34
|
homes(): readonly string[];
|
|
33
35
|
homeOf(conversationId: number | undefined): string | undefined;
|
|
34
36
|
envOf(home: string): Promise<ExecutionEnv | undefined>;
|
|
37
|
+
homeOfAgent(agentId: string): string | undefined;
|
|
35
38
|
}
|
|
36
39
|
export declare function userRoots(homes: readonly string[]): SkillRoot[];
|
|
37
40
|
export interface SkillsSetup {
|
|
@@ -34,7 +34,7 @@ export declare class AgentAdapter extends Emitter<AgentAdapterEvents> implements
|
|
|
34
34
|
setModel(agentId: string, model: string): void;
|
|
35
35
|
setThinking(agentId: string, level: Thinking): void;
|
|
36
36
|
older(): Promise<readonly Message[]>;
|
|
37
|
-
commands(): readonly SlashCommand[];
|
|
37
|
+
commands(agentId?: string): readonly SlashCommand[];
|
|
38
38
|
createScoop(parentId: string, name: string): Agent;
|
|
39
39
|
drop(agentId: string): Promise<void>;
|
|
40
40
|
createCone(name: string): Promise<Agent>;
|
|
@@ -3,9 +3,13 @@ import type { AgentSettings, SignIn } from '../services.ts';
|
|
|
3
3
|
import type { AgentAdapter } from './agent-port.ts';
|
|
4
4
|
import { Emitter } from './emitter.ts';
|
|
5
5
|
export declare const SETTINGS_KEY = "slicc-agent.settings";
|
|
6
|
+
export type Sealed = {
|
|
7
|
+
sealed: true;
|
|
8
|
+
};
|
|
6
9
|
export type Login = (providerId: string, signIn: () => Promise<SignIn | null>, options: {
|
|
7
10
|
signal: AbortSignal;
|
|
8
|
-
}) => Promise<string>;
|
|
11
|
+
}) => Promise<string | Sealed>;
|
|
12
|
+
export declare const SIGN_IN_NEEDS_VAULT = "Adobe sign-in needs seven's vault: update seven";
|
|
9
13
|
export declare class SettingsAdapter extends Emitter<SettingsEvents> implements SettingsPort {
|
|
10
14
|
#private;
|
|
11
15
|
constructor(settings: AgentSettings, agent: AgentAdapter, storage: Pick<Storage, 'getItem' | 'setItem'> | null, login?: Login | null, mcp?: Login);
|
|
@@ -13,9 +17,7 @@ export declare class SettingsAdapter extends Emitter<SettingsEvents> implements
|
|
|
13
17
|
update(patch: Partial<Settings>): void;
|
|
14
18
|
models(): readonly ModelOption[];
|
|
15
19
|
accounts(): readonly Account[];
|
|
16
|
-
connect(id: string, secret?: string,
|
|
17
|
-
region?: string;
|
|
18
|
-
}): Promise<void>;
|
|
20
|
+
connect(id: string, secret?: string, fields?: Record<string, string>): Promise<void>;
|
|
19
21
|
cancel(id: string): void;
|
|
20
22
|
disconnect(id: string): void;
|
|
21
23
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Context } from '@earendil-works/chord';
|
|
2
|
+
import type { EntryRecord, Extension, Harness } from '@earendil-works/pi-durable';
|
|
3
|
+
import type { Agents, ConeRecord } from '../agents.ts';
|
|
4
|
+
export declare const TITLES = "slicc-titles";
|
|
5
|
+
export declare const TITLE_TURNS: number[];
|
|
6
|
+
export declare function trivial(text: string): boolean;
|
|
7
|
+
export declare function titleDue(record: Pick<ConeRecord, 'titled'>, entries: readonly EntryRecord[], final?: boolean): number | undefined;
|
|
8
|
+
export declare function cleanTitle(title: string | undefined): string | undefined;
|
|
9
|
+
export type TitleFn = (transcript: string, model: string, context: Context) => Promise<string | undefined>;
|
|
10
|
+
export interface TitlesAttach {
|
|
11
|
+
agents: () => Agents | undefined;
|
|
12
|
+
harness: () => Harness | undefined;
|
|
13
|
+
title: () => TitleFn | undefined;
|
|
14
|
+
}
|
|
15
|
+
export interface TitlesRuntime {
|
|
16
|
+
extension: Extension;
|
|
17
|
+
cancel(agentId: string): void;
|
|
18
|
+
}
|
|
19
|
+
export declare function titlesExtension(deps: TitlesAttach): TitlesRuntime;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { Context } from '@earendil-works/chord';
|
|
2
2
|
import type { Models } from '@earendil-works/pi-ai/models';
|
|
3
|
+
import type { EntryRecord } from '@earendil-works/pi-durable';
|
|
3
4
|
import type { ExecutionEnv } from '@earendil-works/pi-durable/env';
|
|
4
5
|
export declare const TITLE_PROMPT = "Give this chat a title of three to six words that says what it is about, in the language the user writes in. Answer with the title only, without quotes.";
|
|
6
|
+
export declare const TRANSCRIPT_LENGTH = 4000;
|
|
5
7
|
export declare function titlesOn(text: string | undefined): boolean;
|
|
6
8
|
export declare function settingsText(env: Pick<ExecutionEnv, 'readTextFile'>, home: string, dir?: string): (context: Context) => Promise<string | undefined>;
|
|
9
|
+
export declare function transcriptOf(entries: readonly EntryRecord[]): string;
|
|
10
|
+
export declare function scrubTranscript(entries: readonly EntryRecord[]): Promise<string>;
|
|
7
11
|
export declare function titler(models: Models, settings: (context: Context) => Promise<string | undefined>): (transcript: string, model: string, context: Context) => Promise<string | undefined>;
|