@botharness/core 0.1.0-alpha.1 → 1.0.1

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 (3) hide show
  1. package/dist/index.d.mts +128 -16
  2. package/dist/index.mjs +1168 -196
  3. package/package.json +1 -1
package/dist/index.d.mts CHANGED
@@ -8009,7 +8009,7 @@ interface MessagingTarget {
8009
8009
  name: string;
8010
8010
  digest: string;
8011
8011
  receiveScope?: {
8012
- kind: 'group';
8012
+ kind: 'group' | 'dm';
8013
8013
  conversationId: string;
8014
8014
  };
8015
8015
  }
@@ -8023,7 +8023,7 @@ interface MessagingAttachment {
8023
8023
  }
8024
8024
  interface MessagingInboundEvent {
8025
8025
  version: 1;
8026
- channel: 'feishu' | 'slack' | 'discord';
8026
+ channel: 'feishu' | 'slack' | 'discord' | 'weixin';
8027
8027
  botId: string;
8028
8028
  fingerprint: string;
8029
8029
  eventId: string;
@@ -8084,6 +8084,7 @@ interface MessagingHistoryPage {
8084
8084
  }
8085
8085
  interface MessagingReceipt {
8086
8086
  version: 1;
8087
+ identityKind?: 'client-acknowledgement';
8087
8088
  messageId: string;
8088
8089
  conversationId: string;
8089
8090
  }
@@ -8158,6 +8159,7 @@ interface MessagingProvider {
8158
8159
  bytes: Uint8Array;
8159
8160
  };
8160
8161
  signal: AbortSignal;
8162
+ beforeSend?: () => boolean;
8161
8163
  }): Promise<{
8162
8164
  accepted: true;
8163
8165
  }>;
@@ -8312,7 +8314,7 @@ interface MessagingGrant {
8312
8314
  createdAt: string;
8313
8315
  receiveAfter?: string;
8314
8316
  receiveScope?: {
8315
- kind: 'group';
8317
+ kind: 'group' | 'dm';
8316
8318
  conversationId: string;
8317
8319
  };
8318
8320
  receiveTargetChannelId?: string;
@@ -8422,6 +8424,7 @@ export declare function createOutboundMessaging(options: {
8422
8424
  isBotActive(slug: string): boolean;
8423
8425
  sourcePolicy?: BotSourcePolicyStore;
8424
8426
  onDefaultsChanged?: () => void;
8427
+ onReceptionChanged?: () => void;
8425
8428
  onAdmitted?(botSlug: string, sourceEventId: string): void;
8426
8429
  onPlaced?(commit: ChannelMessageCommit): void;
8427
8430
  onShared?(botSlugs: string[]): void;
@@ -8872,6 +8875,12 @@ interface MemoryRepositoryInitialization {
8872
8875
  }
8873
8876
  interface PersonaBotRegistryOptions {
8874
8877
  rootDir: string;
8878
+ database: OperationalDatabaseOwner;
8879
+ onImport?: (event: {
8880
+ phase: 'complete' | 'failed';
8881
+ count?: number;
8882
+ durationMs: number;
8883
+ }) => void;
8875
8884
  now?: () => Date;
8876
8885
  onDisplayNameChanged?: () => void;
8877
8886
  initializeMemory?: (memoryDir: string) => MemoryRepositoryInitialization;
@@ -10370,21 +10379,24 @@ export declare class RosterUnknownSectionError extends Error {
10370
10379
  readonly sectionId: string;
10371
10380
  constructor(sectionId: string);
10372
10381
  }
10382
+ interface RosterStoreOptions {
10383
+ database: OperationalDatabaseOwner;
10384
+ warn?: ((message: string) => void) | undefined;
10385
+ onCommitted?: (() => void) | undefined;
10386
+ }
10373
10387
  export declare class RosterStore {
10374
10388
  private readonly options;
10375
- private domain;
10376
- private table;
10377
- private global;
10389
+ private readonly database;
10390
+ private imported;
10391
+ private draft;
10378
10392
  private opening;
10379
10393
  private closing;
10380
10394
  private warned;
10381
10395
  private tail;
10382
- constructor(options?: {
10383
- warn?: ((message: string) => void) | undefined;
10384
- onCommitted?: (() => void) | undefined;
10385
- });
10396
+ constructor(options: RosterStoreOptions);
10386
10397
  get available(): boolean;
10387
10398
  attach(facility: RosterDomainFacility): Promise<void>;
10399
+ private importLegacy;
10388
10400
  detach(): Promise<void>;
10389
10401
  snapshot(): RosterSnapshot;
10390
10402
  sectionCreate(name: string): Promise<RosterSection>;
@@ -10398,14 +10410,15 @@ export declare class RosterStore {
10398
10410
  hiddenSet(hidden: readonly string[]): Promise<string[]>;
10399
10411
  private orderedSections;
10400
10412
  private enqueue;
10413
+ private notifyCommitted;
10414
+ private warn;
10401
10415
  private reportUnavailable;
10416
+ private readData;
10417
+ private requireDraft;
10402
10418
  private requireTable;
10403
10419
  private requireGlobal;
10404
10420
  }
10405
- export declare function createRosterStore(options?: {
10406
- warn?: ((message: string) => void) | undefined;
10407
- onCommitted?: (() => void) | undefined;
10408
- }): RosterStore;
10421
+ export declare function createRosterStore(options: RosterStoreOptions): RosterStore;
10409
10422
  //#endregion
10410
10423
  //#region packages/core/src/runtime/attention.d.ts
10411
10424
  type BotAttentionState = 'pending' | 'processing' | 'observed' | 'deferred' | 'needs-repair' | 'handled' | 'ignored';
@@ -10676,16 +10689,19 @@ interface BotHarnessConfig {
10676
10689
  enabled: boolean;
10677
10690
  agentPreset?: string;
10678
10691
  activityDetailConsumers?: string[];
10692
+ marketplaceUrl?: string;
10679
10693
  }
10680
10694
  export declare const DEFAULT_CONFIG: BotHarnessConfig;
10681
10695
  declare const Config$1: Schema<Schemastery.ObjectS<NoInfer<{
10682
10696
  enabled: Schema<boolean, boolean, "defined">;
10683
10697
  activityDetailConsumers: Schema<string[], string[], "defined">;
10684
10698
  agentPreset: Schema<string, string, "defined">;
10699
+ marketplaceUrl: Schema<string, string, "defined">;
10685
10700
  }>>, Schemastery.ObjectT<NoInfer<{
10686
10701
  enabled: Schema<boolean, boolean, "defined">;
10687
10702
  activityDetailConsumers: Schema<string[], string[], "defined">;
10688
10703
  agentPreset: Schema<string, string, "defined">;
10704
+ marketplaceUrl: Schema<string, string, "defined">;
10689
10705
  }>>, "plain">;
10690
10706
  interface BotHarnessCore {
10691
10707
  rootDir: string;
@@ -10743,6 +10759,79 @@ declare module '@deepseek-ai/cordis' {
10743
10759
  }
10744
10760
  }
10745
10761
  //#endregion
10762
+ //#region packages/core/src/marketplace/altcha.d.ts
10763
+ declare const ALTCHA_ALGORITHM = "SHA-256";
10764
+ interface AltchaChallenge {
10765
+ algorithm: typeof ALTCHA_ALGORITHM;
10766
+ challenge: string;
10767
+ maxnumber: number;
10768
+ salt: string;
10769
+ signature: string;
10770
+ }
10771
+ //#endregion
10772
+ //#region packages/core/src/marketplace/client.d.ts
10773
+ interface MarketplaceEntry {
10774
+ id: string;
10775
+ owner: string;
10776
+ name: string;
10777
+ fullName: string;
10778
+ displayName: string | null;
10779
+ roles: string[];
10780
+ description: string | null;
10781
+ topics: string[];
10782
+ stars: number;
10783
+ pushedAt: string;
10784
+ htmlUrl: string;
10785
+ cloneUrl: string;
10786
+ defaultBranch: string;
10787
+ headCommit: {
10788
+ sha: string;
10789
+ committedAt: string;
10790
+ } | null;
10791
+ }
10792
+ interface MarketplacePage {
10793
+ bots: MarketplaceEntry[];
10794
+ nextCursor?: string;
10795
+ }
10796
+ type MarketplaceSort = 'updated' | 'stars';
10797
+ interface MarketplaceQuery {
10798
+ cursor?: string;
10799
+ sort?: MarketplaceSort;
10800
+ q?: string;
10801
+ topic?: string;
10802
+ }
10803
+ interface MarketplaceTopic {
10804
+ topic: string;
10805
+ count: number;
10806
+ }
10807
+ interface MarketplaceDetail {
10808
+ bot: MarketplaceEntry;
10809
+ readme: string | null;
10810
+ commitSha: string | null;
10811
+ }
10812
+ type MarketplaceResult<T> = {
10813
+ ok: true;
10814
+ value: T;
10815
+ } | {
10816
+ ok: false;
10817
+ code: string;
10818
+ };
10819
+ interface MarketplaceClient {
10820
+ list(query: MarketplaceQuery): Promise<MarketplaceResult<MarketplacePage>>;
10821
+ topics(): Promise<MarketplaceResult<MarketplaceTopic[]>>;
10822
+ detail(id: string): Promise<MarketplaceResult<MarketplaceDetail>>;
10823
+ challenge(): Promise<MarketplaceResult<AltchaChallenge>>;
10824
+ submit(url: string, altcha: string): Promise<MarketplaceResult<{
10825
+ bot: MarketplaceEntry;
10826
+ }>>;
10827
+ report(id: string, options: {
10828
+ altcha: string;
10829
+ reason?: string;
10830
+ }): Promise<MarketplaceResult<{
10831
+ received: true;
10832
+ }>>;
10833
+ }
10834
+ //#endregion
10746
10835
  //#region packages/core/src/channels/profile-activity.d.ts
10747
10836
  interface GroupProfileActivityDay {
10748
10837
  day: string;
@@ -11264,6 +11353,16 @@ interface BridgeMethods {
11264
11353
  botAppearanceSet(payload: unknown): BridgeResult<{
11265
11354
  bot: PersonaBotDetail;
11266
11355
  }>;
11356
+ marketplaceList(payload: unknown): Promise<BridgeResult<MarketplacePage>>;
11357
+ marketplaceSubmit(payload: unknown): Promise<BridgeResult<{
11358
+ bot: MarketplaceEntry;
11359
+ }>>;
11360
+ marketplaceTopics(): Promise<BridgeResult<MarketplaceTopic[]>>;
11361
+ marketplaceDetail(payload: unknown): Promise<BridgeResult<MarketplaceDetail>>;
11362
+ marketplaceChallenge(): Promise<BridgeResult<AltchaChallenge>>;
11363
+ marketplaceReport(payload: unknown): Promise<BridgeResult<{
11364
+ received: true;
11365
+ }>>;
11267
11366
  }
11268
11367
  interface BridgeMethodsDeps {
11269
11368
  warn?: (message: string) => void;
@@ -11303,6 +11402,7 @@ interface BridgeMethodsDeps {
11303
11402
  changed(slug: string): void;
11304
11403
  };
11305
11404
  createBotId?: () => string;
11405
+ marketplace?: MarketplaceClient;
11306
11406
  }
11307
11407
  export declare function createBridgeMethods(deps: BridgeMethodsDeps): BridgeMethods;
11308
11408
  //#endregion
@@ -11325,6 +11425,7 @@ declare module '@deepseek-ai/dsh-typert-protocol/types' {
11325
11425
  'invalid-git-url': Record<string, never>;
11326
11426
  'git-clone-failed': Record<string, never>;
11327
11427
  'git-clone-timeout': Record<string, never>;
11428
+ 'marketplace-unavailable': Record<string, never>;
11328
11429
  }
11329
11430
  }
11330
11431
  export declare class BotharnessBridgeService extends TypertRemoteService {
@@ -11657,6 +11758,16 @@ export declare class BotharnessBridgeService extends TypertRemoteService {
11657
11758
  developerModeSet(enabled: boolean): {
11658
11759
  accepted: boolean;
11659
11760
  };
11761
+ marketplaceList(query?: MarketplaceQuery): Promise<MarketplacePage>;
11762
+ marketplaceSubmit(url: string, altcha: string): Promise<{
11763
+ bot: MarketplaceEntry;
11764
+ }>;
11765
+ marketplaceChallenge(): Promise<AltchaChallenge>;
11766
+ marketplaceReport(id: string, altcha: string, reason?: string): Promise<{
11767
+ received: true;
11768
+ }>;
11769
+ marketplaceTopics(): Promise<MarketplaceTopic[]>;
11770
+ marketplaceDetail(id: string): Promise<MarketplaceDetail>;
11660
11771
  }
11661
11772
  export declare function registerBridge(ctx: Context, methods: BridgeMethods): BotharnessBridgeService;
11662
11773
  //#endregion
@@ -11835,6 +11946,7 @@ interface DshImOutboundService {
11835
11946
  }, options: {
11836
11947
  expectedFingerprint: string;
11837
11948
  signal: AbortSignal;
11949
+ beforeSend?: () => boolean;
11838
11950
  }): Promise<{
11839
11951
  sent: true;
11840
11952
  }>;
@@ -11898,6 +12010,6 @@ interface DshImOutboundService {
11898
12010
  receipt?: MessagingReceipt;
11899
12011
  }>;
11900
12012
  }
11901
- export declare function createDshImProvider(value: unknown, platform?: 'feishu' | 'slack' | 'discord'): MessagingProvider | undefined;
12013
+ export declare function createDshImProvider(value: unknown, platform?: 'feishu' | 'slack' | 'discord' | 'weixin'): MessagingProvider | undefined;
11902
12014
  //#endregion
11903
- export { type ActivityEffect, type ActivitySourceCount, type ActivitySourceRole, type AggregatedState, type AssignmentActivity, type AssignmentAgentRun, type AssignmentDetail, type AssignmentReport, type AssignmentReportInput, type AssignmentReportState, type AssignmentSummary, type BotAgentAdapter, type BotDomain, type BotHarnessConfig, type BotHarnessCore, type BotIdentity, type BotResolveResult, type BotRuntime, type BotRuntimeOptions, type BotStateEvent, type BotStateSnapshot, type BotStateTracker, type BridgeError, type BridgeMethods, type BridgeMethodsDeps, type BridgeResult, type ChannelMessage, type ChannelMessageAuthor, type ChannelMessageExternal, type ChannelMessageOrigin, type ChannelMessageQueryOptions, type ChannelMessageQueryPage, type ChannelMessageView, type ChannelReadOptions, type ChannelRecord, type ChannelStore, type ChannelStoreOptions, type ChannelType, Config$1 as Config, type CreateChannelGroupInput, type CreatePersonaBotInput, type CreatePersonaBotResult, type DshActivityProjection, type DshActivityRebuildReport, type DshActivitySession, type DshAgentHost, type DshBotAgentAdapterOptions, type DshImOutboundService, type DshSession, type DshSessionEvent, type DshSessionHeader, type DshSessionStore, type ExternalSource, type HandleDmMessageInput, type ImBotRecord, type ImStoreReaderOptions, type ImStoresSnapshot, type InboundMessaging, type LegacyForwardMigrationPlanEntry, type MemoryAgentRef, type MemoryCommit, type MemoryEntry, type MemoryRepositoryFailureCode, type MemoryRepositoryInspection, type MemoryRepositoryResult, type MemorySearchHit, type MemoryService, type MemoryServiceOptions, type MemoryStore, type MemoryStoreOptions, type MemoryWriteInput, type MemoryWriteResult, type MessagingAccount, type MessagingGrant, type MessagingInboundEvent, type MessagingProvider, type MessagingReplyRoute, type MessagingSnapshot, type MessagingTarget, type OperationalDatabaseDiagnostics, type OperationalDatabaseErrorCode, type OperationalDatabaseErrorDetails, type OperationalDatabaseMetrics, type OperationalDatabaseMode, type OperationalDatabaseOwner, type OperationalDatabaseOwnerOptions, type OrchestratorAgentRun, type OrchestratorChannelAccess, type OutboundMessaging, type OutboxIntent, type PersonaBotActivityEvent, type PersonaBotActivitySnapshot, type PersonaBotDetail, type PersonaBotOutputCommitted, type PersonaBotPatch, type PersonaBotRecord, type PersonaBotRegistry, type PersonaBotRegistryOptions, type PersonaBotSessionActivity, type PersonaBotSummary, type PersonaBotToolActivity, type PostCommitNotification, type ProfileWriterLeaseMetadata, type PublicToolActivityDeclaration, type RemovePersonaBotOptions, type ResolveBotIdentityInput, type RosterDomainFacility, type RosterDomainState, type RosterSection, type RosterSectionRecord, type RosterSnapshot, type SchemaMigration, type SchemaPlan, type SessionOwnership, type SessionOwnershipClaim, type SessionOwnershipProvenance, type SessionOwnershipRecord, type SessionOwnershipRepair, type SessionPersonaSnapshot, type SessionRootRole, type SessionState, type ToolDetail, type ToolDetailRead, type ToolDetailRefusal, type UpdatePersonaBotResult, type WorkspacesDocument };
12015
+ export { type ActivityEffect, type ActivitySourceCount, type ActivitySourceRole, type AggregatedState, type AssignmentActivity, type AssignmentAgentRun, type AssignmentDetail, type AssignmentReport, type AssignmentReportInput, type AssignmentReportState, type AssignmentSummary, type BotAgentAdapter, type BotDomain, type BotHarnessConfig, type BotHarnessCore, type BotIdentity, type BotResolveResult, type BotRuntime, type BotRuntimeOptions, type BotStateEvent, type BotStateSnapshot, type BotStateTracker, type BridgeError, type BridgeMethods, type BridgeMethodsDeps, type BridgeResult, type ChannelMessage, type ChannelMessageAuthor, type ChannelMessageExternal, type ChannelMessageOrigin, type ChannelMessageQueryOptions, type ChannelMessageQueryPage, type ChannelMessageView, type ChannelReadOptions, type ChannelRecord, type ChannelStore, type ChannelStoreOptions, type ChannelType, Config$1 as Config, type CreateChannelGroupInput, type CreatePersonaBotInput, type CreatePersonaBotResult, type DshActivityProjection, type DshActivityRebuildReport, type DshActivitySession, type DshAgentHost, type DshBotAgentAdapterOptions, type DshImOutboundService, type DshSession, type DshSessionEvent, type DshSessionHeader, type DshSessionStore, type ExternalSource, type HandleDmMessageInput, type ImBotRecord, type ImStoreReaderOptions, type ImStoresSnapshot, type InboundMessaging, type LegacyForwardMigrationPlanEntry, type MemoryAgentRef, type MemoryCommit, type MemoryEntry, type MemoryRepositoryFailureCode, type MemoryRepositoryInspection, type MemoryRepositoryResult, type MemorySearchHit, type MemoryService, type MemoryServiceOptions, type MemoryStore, type MemoryStoreOptions, type MemoryWriteInput, type MemoryWriteResult, type MessagingAccount, type MessagingGrant, type MessagingInboundEvent, type MessagingProvider, type MessagingReplyRoute, type MessagingSnapshot, type MessagingTarget, type OperationalDatabaseDiagnostics, type OperationalDatabaseErrorCode, type OperationalDatabaseErrorDetails, type OperationalDatabaseMetrics, type OperationalDatabaseMode, type OperationalDatabaseOwner, type OperationalDatabaseOwnerOptions, type OrchestratorAgentRun, type OrchestratorChannelAccess, type OutboundMessaging, type OutboxIntent, type PersonaBotActivityEvent, type PersonaBotActivitySnapshot, type PersonaBotDetail, type PersonaBotOutputCommitted, type PersonaBotPatch, type PersonaBotRecord, type PersonaBotRegistry, type PersonaBotRegistryOptions, type PersonaBotSessionActivity, type PersonaBotSummary, type PersonaBotToolActivity, type PostCommitNotification, type ProfileWriterLeaseMetadata, type PublicToolActivityDeclaration, type RemovePersonaBotOptions, type ResolveBotIdentityInput, type RosterDomainFacility, type RosterDomainState, type RosterSection, type RosterSectionRecord, type RosterSnapshot, type RosterStoreOptions, type SchemaMigration, type SchemaPlan, type SessionOwnership, type SessionOwnershipClaim, type SessionOwnershipProvenance, type SessionOwnershipRecord, type SessionOwnershipRepair, type SessionPersonaSnapshot, type SessionRootRole, type SessionState, type ToolDetail, type ToolDetailRead, type ToolDetailRefusal, type UpdatePersonaBotResult, type WorkspacesDocument };