@ai-ecoverse/slicc-agent 4.0.0 → 4.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 (46) hide show
  1. package/dist/client.js +2 -0
  2. package/dist/client.js.map +2 -2
  3. package/dist/control.js +4 -1
  4. package/dist/control.js.map +2 -2
  5. package/dist/freezer/index.js +27 -68
  6. package/dist/freezer/index.js.map +2 -2
  7. package/dist/host.js +2 -0
  8. package/dist/host.js.map +2 -2
  9. package/dist/index.js +6 -0
  10. package/dist/index.js.map +2 -2
  11. package/dist/kernel/agent-users.js +3 -0
  12. package/dist/kernel/agent-users.js.map +2 -2
  13. package/dist/main.js +27 -10
  14. package/dist/main.js.map +2 -2
  15. package/dist/memory/runtime.js +1 -1
  16. package/dist/memory/runtime.js.map +2 -2
  17. package/dist/preferred.js +14 -0
  18. package/dist/preferred.js.map +7 -0
  19. package/dist/secrets/extension.js +6 -3
  20. package/dist/secrets/extension.js.map +2 -2
  21. package/dist/services.js.map +2 -2
  22. package/dist/settings.js +18 -2
  23. package/dist/settings.js.map +3 -3
  24. package/dist/skills/index.js +20 -3
  25. package/dist/skills/index.js.map +3 -3
  26. package/dist/spectrum/agent-port.js +29 -1
  27. package/dist/spectrum/agent-port.js.map +2 -2
  28. package/dist/spectrum/settings-port.js +23 -8
  29. package/dist/spectrum/settings-port.js.map +2 -2
  30. package/dist/titles/extension.js +110 -0
  31. package/dist/titles/extension.js.map +7 -0
  32. package/dist/{freezer/title.js → titles/generate.js} +21 -2
  33. package/dist/titles/generate.js.map +7 -0
  34. package/dist/types/client.d.ts +2 -1
  35. package/dist/types/control.d.ts +1 -1
  36. package/dist/types/freezer/index.d.ts +2 -5
  37. package/dist/types/index.d.ts +1 -1
  38. package/dist/types/preferred.d.ts +5 -0
  39. package/dist/types/services.d.ts +5 -0
  40. package/dist/types/settings.d.ts +5 -1
  41. package/dist/types/skills/index.d.ts +4 -1
  42. package/dist/types/spectrum/agent-port.d.ts +1 -1
  43. package/dist/types/titles/extension.d.ts +19 -0
  44. package/dist/types/{freezer/title.d.ts → titles/generate.d.ts} +4 -0
  45. package/package.json +3 -3
  46. package/dist/freezer/title.js.map +0 -7
@@ -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,YA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Remote } 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[]>;
@@ -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 ConeRecord, type FrozenRecord } from '../agents.ts';
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;
@@ -15,7 +15,7 @@ export { applyPatches, patchServerAccept } from './patches.ts';
15
15
  export { SliccPrompt, sliccPrompt } from './prompt.ts';
16
16
  export { type AgentPages, createPages, type PageBatch, type PageCaller, type PageRequest, type PageResult, type Pages, type PagesOpened, type PageTab, } from './remote/pages.ts';
17
17
  export { type AccountState, AGENT_SESSION, AgentControl, AgentPagesService, AgentSessions, AgentSettings, type AgentSettingsChange, AgentTranscript, type BudgetState, type ModelChoice, type OperationError, type PromptResult, type SendMode, type SendRequest, type SendResponse, type SettingsState, type SignIn, } from './services.ts';
18
- export { BEDROCK, createAgentSettings, createSliccModels, DEFAULT_MODEL, DEFAULT_REGIONS, sliccProviders, withDefaultRegions, } from './settings.ts';
18
+ export { BEDROCK, createAgentSettings, createSliccModels, DEFAULT_MODEL, DEFAULT_REGIONS, PREFERRED_MODELS, preferredModel, resolveDefaultModel, sliccProviders, withDefaultRegions, } from './settings.ts';
19
19
  export { AGENT_DIRECTORY, type OpfsSqliteOptions, openMemorySqliteStorage, openOpfsSqliteStorage, WasmSqliteDatabase, } from './sqlite.ts';
20
20
  export { type SystemFacts, systemSection } from './system.ts';
21
21
  export { UPLOADS, type Uploads, upload } from './uploads.ts';
@@ -0,0 +1,5 @@
1
+ export declare const BEDROCK = "amazon-bedrock";
2
+ export declare const PREFERRED_MODELS: Readonly<Record<string, string>>;
3
+ export declare function preferredModel<T extends {
4
+ id: string;
5
+ }>(providerId: string, available: readonly T[]): T | undefined;
@@ -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;
@@ -5,7 +5,7 @@ import type { McpAccounts } from './mcp/index.ts';
5
5
  import type { VaultRecords } from './secrets/records.ts';
6
6
  import type { PlainStore } from './secrets/store.ts';
7
7
  import type { AccountField, AgentSettings } from './services.ts';
8
- export declare const BEDROCK = "amazon-bedrock";
8
+ export { BEDROCK, PREFERRED_MODELS, preferredModel } from './preferred.ts';
9
9
  export declare const DEFAULT_MODEL: {
10
10
  provider: string;
11
11
  modelId: string;
@@ -14,6 +14,10 @@ export declare const DEFAULT_REGIONS: Readonly<Record<string, string>>;
14
14
  export declare const ACCOUNT_FIELDS: Readonly<Record<string, readonly AccountField[]>>;
15
15
  export declare const SIGN_IN_NEEDS_VAULT = "Adobe sign-in needs seven's vault: update seven";
16
16
  export declare const KEY_NEEDS_VAULT = "API keys are kept in seven's vault: update seven";
17
+ export declare function resolveDefaultModel(credentials: CredentialStore, providers: Provider[], models: MutableModels): Promise<{
18
+ provider: string;
19
+ modelId: string;
20
+ }>;
17
21
  export declare function sliccProviders(version?: string): Provider[];
18
22
  export declare function withDefaultRegions(credentials: CredentialStore): CredentialStore;
19
23
  export declare function createSliccModels(credentials: CredentialStore, providers?: Provider<import("@earendil-works/pi-ai").Api>[]): MutableModels;
@@ -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>;
@@ -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>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-agent",
3
- "version": "4.0.0",
3
+ "version": "4.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",
@@ -63,7 +63,7 @@
63
63
  "devDependencies": {
64
64
  "@ai-ecoverse/slicc-kernel": "1.47.1",
65
65
  "@ai-ecoverse/slicc-scrub": "1.0.0",
66
- "@ai-ecoverse/slicc-shared-web": "1.13.1",
66
+ "@ai-ecoverse/slicc-shared-web": "1.13.2",
67
67
  "@ai-ecoverse/slicc-spectrum": "1.69.2",
68
68
  "@ai-ecoverse/wasm-bash": "5.3.0-18",
69
69
  "@ai-ecoverse/wasm-coreutils": "9.12.0-5",
@@ -80,7 +80,7 @@
80
80
  },
81
81
  "dependencies": {
82
82
  "@ai-ecoverse/slicc-browsers": "1.5.0",
83
- "@ai-ecoverse/slicc-vault": "1.9.0",
83
+ "@ai-ecoverse/slicc-vault": "1.9.1",
84
84
  "@earendil-works/chord": "1.0.4",
85
85
  "@earendil-works/pi-ai": "1.0.4",
86
86
  "@earendil-works/pi-client": "1.0.4",
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/freezer/title.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 { ExecutionEnv } from '@earendil-works/pi-durable/env';\nimport { extractSettings } from '../memory/extract.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 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\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": "AAIA,SAAS,uBAAuB;AAEzB,MAAM,eACX;AAEK,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;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,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