Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"devDependencies": {
"@commy/testing": "workspace:*",
"@biomejs/biome": "2.6.3",
"@effect/tsgo": "0.52.0",
"@effect/tsgo": "0.53.0",
"bun-types": "1.4.4",
"turbo": "2.11.10",
"typescript": "7.0.2"
Expand Down
10 changes: 8 additions & 2 deletions packages/core/ports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,20 @@ import {
UnknownIdentity,
} from './ports.ts'

test('UnknownIdentity names both the name and the substrate in its message', () => {
const err = new UnknownIdentity({ name: 'polecat-7', substrate: 'discord' })
test('UnknownIdentity names both the bot name and the substrate in its message', () => {
const err = new UnknownIdentity({ botName: 'polecat-7', substrate: 'discord' })
expect(err).toBeInstanceOf(Error)
expect(err.message).toContain('polecat-7')
expect(err.message).toContain('discord')
expect(err._tag).toBe('UnknownIdentity')
})

test('UnknownIdentity keeps its error type as its name', () => {
const err = new UnknownIdentity({ botName: 'polecat-7', substrate: 'discord' })
expect(err.name).not.toBe('polecat-7')
expect(String(err)).not.toStartWith('polecat-7')
})

const runEither = <A, E>(effect: Effect.Effect<A, E>): Either.Either<A, E> =>
Effect.runSync(Effect.either(effect))

Expand Down
4 changes: 2 additions & 2 deletions packages/core/ports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -889,11 +889,11 @@ export interface AgentComms {
* from a generic `IdentityError`.
*/
export class UnknownIdentity extends Data.TaggedError('UnknownIdentity')<{
readonly name: string
readonly botName: string
readonly substrate: string
}> {
override get message(): string {
return `acquire(${this.name}) failed — ${this.substrate} substrate has no entry for that name and cannot mint one`
return `acquire(${this.botName}) failed — ${this.substrate} substrate has no entry for that name and cannot mint one`
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/memory/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ const memorySeat = (realm: MemoryRealm, config: MemorySeatConfig): Effect.Effect
),
onNone: (): Effect.Effect<AcquiredIdentity, UnknownIdentity | IdentityError> =>
allowlist !== undefined && !allowlist.has(name)
? Effect.fail(new UnknownIdentity({ name, substrate: 'memory' }))
? Effect.fail(new UnknownIdentity({ botName: name, substrate: 'memory' }))
: isCaseVariantOfExisting(name) || isNameOfHuman(name)
? Effect.fail(
new IdentityError({
Expand Down
6 changes: 3 additions & 3 deletions packages/zulip/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,11 @@ const identityError = (operation: IdentityError['operation'], cause: unknown): I
* an operator provisioning gap, not something to paper over by self-minting.
*/
class AttachIdentityNotFound extends Data.TaggedError('AttachIdentityNotFound')<{
readonly name: BotName
readonly botName: BotName
}> {
override get message(): string {
return (
`attach mode: no provisioned bot named '${this.name}' on the realm. ` +
`attach mode: no provisioned bot named '${this.botName}' on the realm. ` +
`Provision the persona once and supply its stable api key before attaching.`
)
}
Expand Down Expand Up @@ -1182,7 +1182,7 @@ export const zulipAdapter = (
Effect.flatMap(
Option.match({
onNone: (): Effect.Effect<BoundBot, AttachIdentityNotFound | ParseResult.ParseError> =>
Effect.fail(new AttachIdentityNotFound({ name })),
Effect.fail(new AttachIdentityNotFound({ botName: name })),
onSome: (
existing,
): Effect.Effect<BoundBot, AttachIdentityNotFound | ParseResult.ParseError> =>
Expand Down