@getbourdon/participants 0.3.1 → 0.4.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.
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { L5ManifestModel, SessionModel, VisibilityPolicyModel } from '@getbourdon/l5';
1
+ import { L5ManifestModel, SessionModel, VisibilityPolicyModel, EntityModel, Visibility } from '@getbourdon/l5';
2
2
  export { EntityModel, L5ManifestModel, SessionModel, Visibility, VisibilityPolicyModel, applyVisibility, filterForFederation, toDict, validateManifest } from '@getbourdon/l5';
3
3
  import DatabaseT from 'better-sqlite3';
4
4
 
@@ -1081,4 +1081,172 @@ declare function discoverParticipants(ctors?: ParticipantCtor[]): BourdonPartici
1081
1081
  */
1082
1082
  declare function resolvePluginParticipants(): ParticipantCtor[];
1083
1083
 
1084
- export { type AgentStore, type AuthProvider, type BourdonParticipant, CONTRACT_VERSION, CacheEntry, CascadeParticipant, ClaudeCodeAutomationsParticipant, ClaudeCodeParticipant, ClaudeDesktopCodeParticipant, ClaudeDesktopCoworkParticipant, CodexAutomationsParticipant, CopilotAutomationsParticipant, CopilotCliParticipant, CopilotParticipant, CopilotVscodeParticipant, CursorAutomationsParticipant, CursorParticipant, DEFAULT_CACHE_TTL_SECONDS, DEFAULT_RECENT_THREAD_LIMIT, DEFAULT_TITLE_LIMIT, FIRST_PARTY, GitHubCopilotParticipant, type HealthStatus, HermesParticipant, MIN_PATCHED_VERSION, NETWORK_CONTRACT_VERSION, NetworkParticipant, type NetworkParticipantOptions, NetworkUnavailable, OpenClawApiClient, OpenClawParticipant, type OpenReadonlyOptions, PROJECT_HINTS_ENV, ParticipantAuthError, type ParticipantCtor, ParticipantDiscoveryError, ParticipantError, ParticipantExportError, ParticipantVersionMismatchError, PayloadCache, type RecentThread, SPEC_VERSION, type SqliteDatabase, defaultCacheRoot, discoverParticipants, envAuthProvider, epochToIsoDate, epochToIsoDatetime, friendlyLabel, ghTokenProvider, isParticipant, loadProjectHints, openReadonly, parseSessionIndex, projectKeyFromCwd, recentSessionThreads, resolveCodexHome, resolvePluginParticipants, sessionThreadTitles, sqliteAvailable, tableColumns, tableExists, tryOpenReadonly, verifyInstance };
1084
+ /**
1085
+ * Shared mechanics for the "JSON export store" participant family.
1086
+ *
1087
+ * Bolt.new, Lovable and v0 are cloud builders that persist nothing useful on
1088
+ * the user's machine, so each federates through a directory the user exports
1089
+ * into:
1090
+ *
1091
+ * $<AGENT>_STATE_DIR/ (default: ~/.<agent>/)
1092
+ * projects.json array of project records, or {projects: [...]}
1093
+ * sessions/<id>.json one JSON document per session
1094
+ *
1095
+ * The oracle implements this three times (`participants/{bolt,lovable,v0}.py`,
1096
+ * ~1,130 lines). The store layout, the date parser, the visibility parser, the
1097
+ * loader's error semantics and the health-check ladder are identical across
1098
+ * all three, so they live here once.
1099
+ *
1100
+ * ⚠ What is NOT shared: each reader's `projectToEntity` / `sessionToRecord`.
1101
+ * They look similar and are not the same — Lovable caps a project name at 120
1102
+ * characters where Bolt caps at 80, emits a NULL summary where Bolt emits a
1103
+ * `"Bolt.new project <name>"` fallback, and appends its own tag
1104
+ * unconditionally where Bolt inserts only if absent (so Lovable really can
1105
+ * emit a duplicate tag). Those differences are the oracle's behaviour and the
1106
+ * mirror reproduces them rather than tidying them into agreement; each reader
1107
+ * supplies its own mapper.
1108
+ */
1109
+
1110
+ type Dict = Record<string, unknown>;
1111
+ /**
1112
+ * `_parse_visibility`: a recognized visibility string, else null (meaning
1113
+ * "inherit the policy default"), never a throw.
1114
+ */
1115
+ declare function parseVisibility(raw: unknown): Visibility | null;
1116
+ /**
1117
+ * `_iso_date`: normalize to a bare `YYYY-MM-DD`, or null if unparseable.
1118
+ *
1119
+ * Accepts a full ISO timestamp (trailing `Z` included) and reduces it to its
1120
+ * date, which is what every L5 date field carries.
1121
+ */
1122
+ declare function isoDate(raw: unknown): string | null;
1123
+ /** `_safe_str`: trim, then route through the redaction SSOT. "" stays "". */
1124
+ declare function safeStr(raw: unknown, limit?: number): string;
1125
+ /** `_str_list` in the Bolt/v0 spelling: redact every item, drop the empties. */
1126
+ declare function safeStrList(raw: unknown, limit?: number): string[];
1127
+ interface ExportStoreConfig {
1128
+ agentId: string;
1129
+ agentType: string;
1130
+ displayName: string;
1131
+ /** Directory name under $HOME, e.g. `.bolt`. */
1132
+ directoryName: string;
1133
+ /** Environment variable that overrides the state directory. */
1134
+ stateEnvVar: string;
1135
+ roleNarrative: string;
1136
+ capabilities: string[];
1137
+ policy: VisibilityPolicyModel;
1138
+ /** Human label used in error and health text, e.g. "Bolt.new". */
1139
+ label: string;
1140
+ /** The `bourdon <x> init` verb named in remediation text. */
1141
+ initCommand: string;
1142
+ projectToEntity: (record: Dict) => EntityModel | null;
1143
+ sessionToRecord: (record: Dict, fallbackDate: string | null) => SessionModel | null;
1144
+ }
1145
+ declare class ExportStoreParticipant {
1146
+ readonly agentId: string;
1147
+ readonly agentType: string;
1148
+ readonly displayName: string;
1149
+ private readonly config;
1150
+ private readonly stateDir;
1151
+ private readonly env;
1152
+ constructor(config: ExportStoreConfig, options?: {
1153
+ stateDir?: string;
1154
+ env?: NodeJS.ProcessEnv;
1155
+ });
1156
+ static defaultNativePath(directoryName: string, home?: string): string;
1157
+ get nativePath(): string;
1158
+ private resolveStateDir;
1159
+ private requireStateDir;
1160
+ /**
1161
+ * `projects.json`, accepting either a bare array or `{projects: [...]}`.
1162
+ *
1163
+ * A MISSING file is empty (the store may legitimately hold only sessions);
1164
+ * a PRESENT but unreadable or wrongly-shaped file throws. The distinction is
1165
+ * the point: absence is a state, corruption is an error.
1166
+ */
1167
+ private loadProjects;
1168
+ private sessionFiles;
1169
+ /** Newest first. An unreadable session is skipped, never fatal. */
1170
+ private loadSessions;
1171
+ discover(): AgentStore;
1172
+ exportSessions(since: Date, limit?: number): SessionModel[];
1173
+ exportL5(since?: Date | null): L5ManifestModel;
1174
+ /** MUST NOT throw: the L6 server calls this in a polling loop. */
1175
+ healthCheck(): HealthStatus;
1176
+ private resolveStateDirSafe;
1177
+ }
1178
+
1179
+ /**
1180
+ * StackBlitz Bolt.new participant — port of `participants/bolt.py`.
1181
+ *
1182
+ * Bolt.new builds and runs full-stack apps in WebContainers, in the browser,
1183
+ * so nothing useful lands on the user's machine. It federates through an
1184
+ * export directory; see {@link ExportStoreParticipant} for the store layout
1185
+ * and the mechanics this shares with Lovable and v0.
1186
+ */
1187
+
1188
+ declare const BOLT_CONFIG: ExportStoreConfig;
1189
+ declare class BoltParticipant extends ExportStoreParticipant {
1190
+ constructor(options?: {
1191
+ stateDir?: string;
1192
+ env?: NodeJS.ProcessEnv;
1193
+ });
1194
+ static defaultNativePath(home?: string): string;
1195
+ }
1196
+
1197
+ /**
1198
+ * Lovable participant — port of `participants/lovable.py`.
1199
+ *
1200
+ * Lovable builds full-stack web apps from chat in the cloud, so nothing useful
1201
+ * lands on the user's machine. It federates through an export directory; see
1202
+ * {@link ExportStoreParticipant} for the store layout and the mechanics this
1203
+ * shares with Bolt.new and v0.
1204
+ *
1205
+ * ⚠ The mapper below is NOT Bolt's with the names swapped, and must not be
1206
+ * refactored into it. Lovable's oracle differs in four ways, each reproduced
1207
+ * exactly here:
1208
+ *
1209
+ * 1. the project name is capped at 120 characters, not 80;
1210
+ * 2. a record with no description yields a NULL summary, where Bolt
1211
+ * synthesizes `"Bolt.new project <name>"`;
1212
+ * 3. the `"lovable"` tag is APPENDED unconditionally, so a record that
1213
+ * already carries it ends up with it twice — Bolt inserts only if absent;
1214
+ * 4. `updated_at` falls back to `created_at`, where Bolt leaves
1215
+ * `last_touched` null.
1216
+ *
1217
+ * (3) also means the tag lands LAST rather than first. None of this is
1218
+ * defensible design; all of it is what the oracle does, and the mirror's job
1219
+ * is to agree with the oracle, not to improve on it. Fixing any of it is an
1220
+ * oracle-side change the conformance fixtures would have to absorb first.
1221
+ */
1222
+
1223
+ declare const LOVABLE_CONFIG: ExportStoreConfig;
1224
+ declare class LovableParticipant extends ExportStoreParticipant {
1225
+ constructor(options?: {
1226
+ stateDir?: string;
1227
+ env?: NodeJS.ProcessEnv;
1228
+ });
1229
+ static defaultNativePath(home?: string): string;
1230
+ }
1231
+
1232
+ /**
1233
+ * Vercel v0 participant — port of `participants/v0.py`.
1234
+ *
1235
+ * v0 generates React / Next.js / Tailwind UI and full-stack web apps from
1236
+ * chat, entirely server-side, so nothing useful lands on the user's machine.
1237
+ * It federates through an export directory; see {@link ExportStoreParticipant}
1238
+ * for the store layout and the mechanics this shares with Bolt.new and
1239
+ * Lovable. The mapper below is byte-for-byte Bolt's rule with v0's own name
1240
+ * and tag — that is the oracle's shape, not a shortcut taken here.
1241
+ */
1242
+
1243
+ declare const V0_CONFIG: ExportStoreConfig;
1244
+ declare class V0Participant extends ExportStoreParticipant {
1245
+ constructor(options?: {
1246
+ stateDir?: string;
1247
+ env?: NodeJS.ProcessEnv;
1248
+ });
1249
+ static defaultNativePath(home?: string): string;
1250
+ }
1251
+
1252
+ export { type AgentStore, type AuthProvider, BOLT_CONFIG, BoltParticipant, type BourdonParticipant, CONTRACT_VERSION, CacheEntry, CascadeParticipant, ClaudeCodeAutomationsParticipant, ClaudeCodeParticipant, ClaudeDesktopCodeParticipant, ClaudeDesktopCoworkParticipant, CodexAutomationsParticipant, CopilotAutomationsParticipant, CopilotCliParticipant, CopilotParticipant, CopilotVscodeParticipant, CursorAutomationsParticipant, CursorParticipant, DEFAULT_CACHE_TTL_SECONDS, DEFAULT_RECENT_THREAD_LIMIT, DEFAULT_TITLE_LIMIT, type ExportStoreConfig, ExportStoreParticipant, FIRST_PARTY, GitHubCopilotParticipant, type HealthStatus, HermesParticipant, LOVABLE_CONFIG, LovableParticipant, MIN_PATCHED_VERSION, NETWORK_CONTRACT_VERSION, NetworkParticipant, type NetworkParticipantOptions, NetworkUnavailable, OpenClawApiClient, OpenClawParticipant, type OpenReadonlyOptions, PROJECT_HINTS_ENV, ParticipantAuthError, type ParticipantCtor, ParticipantDiscoveryError, ParticipantError, ParticipantExportError, ParticipantVersionMismatchError, PayloadCache, type RecentThread, SPEC_VERSION, type SqliteDatabase, V0Participant, V0_CONFIG, defaultCacheRoot, discoverParticipants, envAuthProvider, epochToIsoDate, epochToIsoDatetime, friendlyLabel, ghTokenProvider, isParticipant, isoDate, loadProjectHints, openReadonly, parseSessionIndex, parseVisibility, projectKeyFromCwd, recentSessionThreads, resolveCodexHome, resolvePluginParticipants, safeStr, safeStrList, sessionThreadTitles, sqliteAvailable, tableColumns, tableExists, tryOpenReadonly, verifyInstance };
package/dist/index.d.ts CHANGED
@@ -41,3 +41,7 @@ export { DEFAULT_RECENT_THREAD_LIMIT, DEFAULT_TITLE_LIMIT, parseSessionIndex, re
41
41
  export type { RecentThread } from "./readers/codex-sessions.js";
42
42
  export { FIRST_PARTY, discoverParticipants, resolvePluginParticipants, type ParticipantCtor, } from "./registry.js";
43
43
  export { Visibility, applyVisibility, filterForFederation, toDict, validateManifest, type EntityModel, type L5ManifestModel, type SessionModel, type VisibilityPolicyModel, } from "@getbourdon/l5";
44
+ export { ExportStoreParticipant, isoDate, parseVisibility, safeStr, safeStrList, type ExportStoreConfig, } from "./export-store-base.js";
45
+ export { BOLT_CONFIG, BoltParticipant } from "./readers/bolt.js";
46
+ export { LOVABLE_CONFIG, LovableParticipant } from "./readers/lovable.js";
47
+ export { V0_CONFIG, V0Participant } from "./readers/v0.js";
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ // SPDX-License-Identifier: BUSL-1.1
1
2
  /**
2
3
  * @getbourdon/participants — the external-agent → L5 reader layer (BUSL-1.1).
3
4
  *
@@ -51,3 +52,11 @@ export { FIRST_PARTY, discoverParticipants, resolvePluginParticipants, } from ".
51
52
  // Re-exported from @getbourdon/l5 for convenience (the L5 model + serialization
52
53
  // the readers build on; only this output shape is the parity contract).
53
54
  export { Visibility, applyVisibility, filterForFederation, toDict, validateManifest, } from "@getbourdon/l5";
55
+ // The JSON export-store family — cloud builders that persist nothing locally
56
+ // and federate through an exported directory. The shared mechanics live in
57
+ // export-store-base.ts; each reader keeps its OWN entity/session mapper,
58
+ // because the oracle's three differ in ways that are not cosmetic.
59
+ export { ExportStoreParticipant, isoDate, parseVisibility, safeStr, safeStrList, } from "./export-store-base.js";
60
+ export { BOLT_CONFIG, BoltParticipant } from "./readers/bolt.js";
61
+ export { LOVABLE_CONFIG, LovableParticipant } from "./readers/lovable.js";
62
+ export { V0_CONFIG, V0Participant } from "./readers/v0.js";