@getbourdon/participants 0.2.3 → 0.2.4
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/base.d.ts +109 -0
- package/dist/base.js +88 -0
- package/dist/index.d.ts +42 -1083
- package/dist/index.js +53 -6590
- package/dist/network-base.d.ts +108 -0
- package/dist/network-base.js +248 -0
- package/dist/readers/cascade.d.ts +49 -0
- package/dist/readers/cascade.js +428 -0
- package/dist/readers/claude-code-automations.d.ts +62 -0
- package/dist/readers/claude-code-automations.js +693 -0
- package/dist/readers/claude-code.d.ts +50 -0
- package/dist/readers/claude-code.js +583 -0
- package/dist/readers/claude-desktop-code.d.ts +54 -0
- package/dist/readers/claude-desktop-code.js +526 -0
- package/dist/readers/claude-desktop-cowork.d.ts +47 -0
- package/dist/readers/claude-desktop-cowork.js +659 -0
- package/dist/readers/codex-automations.d.ts +55 -0
- package/dist/readers/codex-automations.js +519 -0
- package/dist/readers/codex-sessions.d.ts +88 -0
- package/dist/readers/codex-sessions.js +194 -0
- package/dist/readers/copilot-automations.d.ts +64 -0
- package/dist/readers/copilot-automations.js +530 -0
- package/dist/readers/copilot-cli.d.ts +45 -0
- package/dist/readers/copilot-cli.js +416 -0
- package/dist/readers/copilot-vscode.d.ts +54 -0
- package/dist/readers/copilot-vscode.js +553 -0
- package/dist/readers/copilot.d.ts +59 -0
- package/dist/readers/copilot.js +413 -0
- package/dist/readers/cursor-automations.d.ts +57 -0
- package/dist/readers/cursor-automations.js +685 -0
- package/dist/readers/cursor.d.ts +50 -0
- package/dist/readers/cursor.js +670 -0
- package/dist/readers/github-copilot.d.ts +34 -0
- package/dist/readers/github-copilot.js +242 -0
- package/dist/readers/hermes.d.ts +37 -0
- package/dist/readers/hermes.js +426 -0
- package/dist/readers/openclaw.d.ts +78 -0
- package/dist/readers/openclaw.js +386 -0
- package/dist/registry.d.ts +39 -0
- package/dist/registry.js +98 -0
- package/dist/sqlite-base.d.ts +65 -0
- package/dist/sqlite-base.js +163 -0
- package/package.json +6 -6
package/dist/base.d.ts
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bourdon participant base — the Protocol → TS interface, errors, and the
|
|
3
|
+
* AgentStore / HealthStatus types. Faithful port of `participants/base.py`.
|
|
4
|
+
*
|
|
5
|
+
* The L5 dataclass model (AgentInfo/Entity/Session/VisibilityPolicy/L5Manifest),
|
|
6
|
+
* the `toDict` omission rules, and the visibility helpers all live in
|
|
7
|
+
* `@getbourdon/l5` and are reused verbatim — only THAT output shape is the parity
|
|
8
|
+
* contract. This module owns the participant CONTRACT surface around them.
|
|
9
|
+
*
|
|
10
|
+
* Contract semantics (enforced by every reader, asserted by the conformance
|
|
11
|
+
* fixtures, never by trust):
|
|
12
|
+
* 1. visibility filter BEFORE emission (`filterForFederation`) — private wins.
|
|
13
|
+
* 2. deterministic / idempotent `exportL5` — same store → identical `toDict`.
|
|
14
|
+
* 3. `healthCheck` NEVER throws — catch-all → degraded/blocked.
|
|
15
|
+
* 4. every native string through `@getbourdon/redaction` before it enters L5.
|
|
16
|
+
*/
|
|
17
|
+
import type { L5ManifestModel, SessionModel } from "@getbourdon/l5";
|
|
18
|
+
/** Tied to Bourdon spec v0.1 — same literals as the Python oracle. */
|
|
19
|
+
export declare const CONTRACT_VERSION = "0.1";
|
|
20
|
+
export declare const SPEC_VERSION = "0.1";
|
|
21
|
+
/** Base class for participant errors. */
|
|
22
|
+
export declare class ParticipantError extends Error {
|
|
23
|
+
constructor(message?: string);
|
|
24
|
+
}
|
|
25
|
+
/** Raised by `discover()` when the native store cannot be found or read.
|
|
26
|
+
* Non-fatal: L6 skips this agent rather than aborting the whole export. */
|
|
27
|
+
export declare class ParticipantDiscoveryError extends ParticipantError {
|
|
28
|
+
}
|
|
29
|
+
/** Raised by `exportL5()` / `exportSessions()` when an export fails mid-op
|
|
30
|
+
* (the store WAS present — distinct from a discovery miss). */
|
|
31
|
+
export declare class ParticipantExportError extends ParticipantError {
|
|
32
|
+
}
|
|
33
|
+
/** Raised when the native store's version is outside the supported range.
|
|
34
|
+
* Subtype of discovery error (a version mismatch is a discovery-time miss). */
|
|
35
|
+
export declare class ParticipantVersionMismatchError extends ParticipantDiscoveryError {
|
|
36
|
+
}
|
|
37
|
+
/** Metadata describing the native agent store. Returned by `discover()`. */
|
|
38
|
+
export interface AgentStore {
|
|
39
|
+
path: string;
|
|
40
|
+
version: string;
|
|
41
|
+
metadata: Record<string, unknown>;
|
|
42
|
+
}
|
|
43
|
+
/** Returned by `healthCheck()`. Consumed by the `bourdon doctor` CLI. */
|
|
44
|
+
export interface HealthStatus {
|
|
45
|
+
status: "ok" | "degraded" | "blocked";
|
|
46
|
+
reason?: string;
|
|
47
|
+
details: Record<string, unknown>;
|
|
48
|
+
/** A human-runnable command to remedy a non-ok status. */
|
|
49
|
+
proposedFix?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Structural interface every participant must satisfy (the Python
|
|
53
|
+
* `@runtime_checkable Protocol`). Duck-typed at registration: a class is a
|
|
54
|
+
* participant iff it has `agentId` + `agentType` + `exportL5` + `healthCheck`.
|
|
55
|
+
*
|
|
56
|
+
* Optional members (`displayName`, a `defaultNativePath` static) are documented
|
|
57
|
+
* here as in the Python Protocol; discovery + the setup wizard fall back to
|
|
58
|
+
* sensible defaults when absent.
|
|
59
|
+
*/
|
|
60
|
+
export interface BourdonParticipant {
|
|
61
|
+
agentId: string;
|
|
62
|
+
agentType: string;
|
|
63
|
+
nativePath: string;
|
|
64
|
+
/** Human-friendly label (e.g. "GitHub Copilot"). Optional. */
|
|
65
|
+
displayName?: string;
|
|
66
|
+
/** Quarantined-class marker (Python `QUARANTINED_CLASS`). When true, the CLI
|
|
67
|
+
* requires `--i-understand-the-risk` to register the agent trusted, and its
|
|
68
|
+
* exports are staged for operator review rather than written to the live
|
|
69
|
+
* store (spec D6: quarantine follows the content, not the invoker). Absent =
|
|
70
|
+
* a normal, non-quarantined participant. Read by `bourdon agent add/set-tier`
|
|
71
|
+
* (cli/src/commands/federation.ts). */
|
|
72
|
+
quarantinedClass?: boolean;
|
|
73
|
+
/** Confirm the native store exists; return metadata. Throws
|
|
74
|
+
* {@link ParticipantDiscoveryError} when missing/unreadable. */
|
|
75
|
+
discover(): AgentStore;
|
|
76
|
+
/** Build the L5 manifest from native memory, applying the visibility filter
|
|
77
|
+
* BEFORE return. Deterministic — same store yields the same manifest. */
|
|
78
|
+
exportL5(since?: Date): L5ManifestModel;
|
|
79
|
+
/** Export recent sessions in normalized schema. */
|
|
80
|
+
exportSessions(since?: Date, limit?: number): SessionModel[];
|
|
81
|
+
/** Return ok / degraded / blocked with a reason. MUST NOT throw. */
|
|
82
|
+
healthCheck(): HealthStatus;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Tiny structural guard mirroring Python's `_PARTICIPANT_MARKER_ATTRS`
|
|
86
|
+
* duck-type: a value is a participant iff it carries the four marker members.
|
|
87
|
+
*/
|
|
88
|
+
export declare function isParticipant(obj: unknown): obj is BourdonParticipant;
|
|
89
|
+
/**
|
|
90
|
+
* Environment variable holding the deployment's own project-name recognition
|
|
91
|
+
* vocabulary, as a comma-separated list (e.g.
|
|
92
|
+
* `BOURDON_PROJECT_HINTS="Acme Portal,Widget API,internal-tools"`).
|
|
93
|
+
*/
|
|
94
|
+
export declare const PROJECT_HINTS_ENV = "BOURDON_PROJECT_HINTS";
|
|
95
|
+
/**
|
|
96
|
+
* Project-name hints used to tag sessions with a project focus.
|
|
97
|
+
*
|
|
98
|
+
* Bourdon ships **no** project roster of its own — the `defaults` a reader
|
|
99
|
+
* passes are limited to product-neutral names (this product, plus the agent
|
|
100
|
+
* surfaces it federates). A deployment that wants its own projects recognized
|
|
101
|
+
* sets {@link PROJECT_HINTS_ENV}; those entries are appended to `defaults`.
|
|
102
|
+
*
|
|
103
|
+
* Matching downstream is case-insensitive substring matching, so entries are
|
|
104
|
+
* de-duplicated case-insensitively here while preserving first-seen order and
|
|
105
|
+
* the original casing (which is what gets emitted as the project name).
|
|
106
|
+
*
|
|
107
|
+
* Mirrors Python `participants.base.load_project_hints`.
|
|
108
|
+
*/
|
|
109
|
+
export declare function loadProjectHints(defaults?: readonly string[]): readonly string[];
|
package/dist/base.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bourdon participant base — the Protocol → TS interface, errors, and the
|
|
3
|
+
* AgentStore / HealthStatus types. Faithful port of `participants/base.py`.
|
|
4
|
+
*
|
|
5
|
+
* The L5 dataclass model (AgentInfo/Entity/Session/VisibilityPolicy/L5Manifest),
|
|
6
|
+
* the `toDict` omission rules, and the visibility helpers all live in
|
|
7
|
+
* `@getbourdon/l5` and are reused verbatim — only THAT output shape is the parity
|
|
8
|
+
* contract. This module owns the participant CONTRACT surface around them.
|
|
9
|
+
*
|
|
10
|
+
* Contract semantics (enforced by every reader, asserted by the conformance
|
|
11
|
+
* fixtures, never by trust):
|
|
12
|
+
* 1. visibility filter BEFORE emission (`filterForFederation`) — private wins.
|
|
13
|
+
* 2. deterministic / idempotent `exportL5` — same store → identical `toDict`.
|
|
14
|
+
* 3. `healthCheck` NEVER throws — catch-all → degraded/blocked.
|
|
15
|
+
* 4. every native string through `@getbourdon/redaction` before it enters L5.
|
|
16
|
+
*/
|
|
17
|
+
/** Tied to Bourdon spec v0.1 — same literals as the Python oracle. */
|
|
18
|
+
export const CONTRACT_VERSION = "0.1";
|
|
19
|
+
export const SPEC_VERSION = "0.1";
|
|
20
|
+
// -- Errors -------------------------------------------------------------------
|
|
21
|
+
/** Base class for participant errors. */
|
|
22
|
+
export class ParticipantError extends Error {
|
|
23
|
+
constructor(message) {
|
|
24
|
+
super(message);
|
|
25
|
+
this.name = new.target.name;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** Raised by `discover()` when the native store cannot be found or read.
|
|
29
|
+
* Non-fatal: L6 skips this agent rather than aborting the whole export. */
|
|
30
|
+
export class ParticipantDiscoveryError extends ParticipantError {
|
|
31
|
+
}
|
|
32
|
+
/** Raised by `exportL5()` / `exportSessions()` when an export fails mid-op
|
|
33
|
+
* (the store WAS present — distinct from a discovery miss). */
|
|
34
|
+
export class ParticipantExportError extends ParticipantError {
|
|
35
|
+
}
|
|
36
|
+
/** Raised when the native store's version is outside the supported range.
|
|
37
|
+
* Subtype of discovery error (a version mismatch is a discovery-time miss). */
|
|
38
|
+
export class ParticipantVersionMismatchError extends ParticipantDiscoveryError {
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Tiny structural guard mirroring Python's `_PARTICIPANT_MARKER_ATTRS`
|
|
42
|
+
* duck-type: a value is a participant iff it carries the four marker members.
|
|
43
|
+
*/
|
|
44
|
+
export function isParticipant(obj) {
|
|
45
|
+
if (obj === null || typeof obj !== "object")
|
|
46
|
+
return false;
|
|
47
|
+
const o = obj;
|
|
48
|
+
return (typeof o["agentId"] === "string" &&
|
|
49
|
+
typeof o["agentType"] === "string" &&
|
|
50
|
+
typeof o["exportL5"] === "function" &&
|
|
51
|
+
typeof o["healthCheck"] === "function");
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Environment variable holding the deployment's own project-name recognition
|
|
55
|
+
* vocabulary, as a comma-separated list (e.g.
|
|
56
|
+
* `BOURDON_PROJECT_HINTS="Acme Portal,Widget API,internal-tools"`).
|
|
57
|
+
*/
|
|
58
|
+
export const PROJECT_HINTS_ENV = "BOURDON_PROJECT_HINTS";
|
|
59
|
+
/**
|
|
60
|
+
* Project-name hints used to tag sessions with a project focus.
|
|
61
|
+
*
|
|
62
|
+
* Bourdon ships **no** project roster of its own — the `defaults` a reader
|
|
63
|
+
* passes are limited to product-neutral names (this product, plus the agent
|
|
64
|
+
* surfaces it federates). A deployment that wants its own projects recognized
|
|
65
|
+
* sets {@link PROJECT_HINTS_ENV}; those entries are appended to `defaults`.
|
|
66
|
+
*
|
|
67
|
+
* Matching downstream is case-insensitive substring matching, so entries are
|
|
68
|
+
* de-duplicated case-insensitively here while preserving first-seen order and
|
|
69
|
+
* the original casing (which is what gets emitted as the project name).
|
|
70
|
+
*
|
|
71
|
+
* Mirrors Python `participants.base.load_project_hints`.
|
|
72
|
+
*/
|
|
73
|
+
export function loadProjectHints(defaults = []) {
|
|
74
|
+
const hints = [];
|
|
75
|
+
const seen = new Set();
|
|
76
|
+
const raw = process.env[PROJECT_HINTS_ENV] ?? "";
|
|
77
|
+
for (const candidate of [...defaults, ...raw.split(",")]) {
|
|
78
|
+
const name = candidate.trim();
|
|
79
|
+
if (!name)
|
|
80
|
+
continue;
|
|
81
|
+
const key = name.toLowerCase();
|
|
82
|
+
if (seen.has(key))
|
|
83
|
+
continue;
|
|
84
|
+
seen.add(key);
|
|
85
|
+
hints.push(name);
|
|
86
|
+
}
|
|
87
|
+
return hints;
|
|
88
|
+
}
|