botinabox 2.5.2 → 2.5.3
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/LICENSE +21 -21
- package/README.md +190 -190
- package/bin/botinabox.mjs +2 -2
- package/dist/{chunk-UACT2WXX.js → chunk-7AGWGYZC.js} +43 -5
- package/dist/cli.js +1 -1
- package/dist/connectors/google/index.d.ts +10 -1
- package/dist/connectors/google/index.js +1 -1
- package/dist/{gmail-connector-2FVYTQJH.js → gmail-connector-VP5FF56J.js} +2 -1
- package/package.json +100 -100
- package/dist/channels/discord/adapter.d.ts +0 -32
- package/dist/channels/discord/adapter.js +0 -70
- package/dist/channels/discord/inbound.d.ts +0 -25
- package/dist/channels/discord/inbound.js +0 -24
- package/dist/channels/discord/models.d.ts +0 -8
- package/dist/channels/discord/models.js +0 -5
- package/dist/channels/discord/outbound.d.ts +0 -14
- package/dist/channels/discord/outbound.js +0 -38
- package/dist/channels/slack/adapter.d.ts +0 -33
- package/dist/channels/slack/adapter.js +0 -74
- package/dist/channels/slack/inbound.d.ts +0 -59
- package/dist/channels/slack/inbound.js +0 -96
- package/dist/channels/slack/models.d.ts +0 -9
- package/dist/channels/slack/models.js +0 -5
- package/dist/channels/slack/outbound.d.ts +0 -12
- package/dist/channels/slack/outbound.js +0 -18
- package/dist/channels/slack/transcribe.d.ts +0 -41
- package/dist/channels/slack/transcribe.js +0 -106
- package/dist/channels/webhook/adapter.d.ts +0 -23
- package/dist/channels/webhook/adapter.js +0 -86
- package/dist/channels/webhook/hmac.d.ts +0 -13
- package/dist/channels/webhook/hmac.js +0 -26
- package/dist/channels/webhook/models.d.ts +0 -9
- package/dist/channels/webhook/models.js +0 -5
- package/dist/channels/webhook/server.d.ts +0 -20
- package/dist/channels/webhook/server.js +0 -91
- package/dist/chat-pipeline-BWrtVqEP.d.ts +0 -652
- package/dist/chat-pipeline-C-XlLGNl.d.ts +0 -648
- package/dist/chat-pipeline-CR1KF6eX.d.ts +0 -652
- package/dist/chat-pipeline-DisuC8SB.d.ts +0 -643
- package/dist/chunk-2LGXQPEA.js +0 -41
- package/dist/chunk-3X3YKI4T.js +0 -357
- package/dist/chunk-D47AIFOD.js +0 -351
- package/dist/chunk-DSNJKNEW.js +0 -328
- package/dist/chunk-GS2JFL6I.js +0 -144
- package/dist/chunk-J6S6QMUY.js +0 -144
- package/dist/chunk-QLA6YOFN.js +0 -22
- package/dist/cli/templates/config.yml.d.ts +0 -7
- package/dist/cli/templates/config.yml.js +0 -61
- package/dist/cli/templates/env.d.ts +0 -1
- package/dist/cli/templates/env.js +0 -30
- package/dist/cli/templates/index.ts.d.ts +0 -2
- package/dist/cli/templates/index.ts.js +0 -30
- package/dist/cli/templates/package.json.d.ts +0 -5
- package/dist/cli/templates/package.json.js +0 -28
- package/dist/connector-DDahQw-2.d.ts +0 -63
- package/dist/connectors/google/calendar-connector.d.ts +0 -40
- package/dist/connectors/google/calendar-connector.js +0 -243
- package/dist/connectors/google/gmail-connector.d.ts +0 -42
- package/dist/connectors/google/gmail-connector.js +0 -345
- package/dist/connectors/google/oauth.d.ts +0 -48
- package/dist/connectors/google/oauth.js +0 -112
- package/dist/connectors/google/types.d.ts +0 -78
- package/dist/connectors/google/types.js +0 -2
- package/dist/core/chat/auto-discovery.d.ts +0 -16
- package/dist/core/chat/auto-discovery.js +0 -54
- package/dist/core/chat/channel-registry.d.ts +0 -45
- package/dist/core/chat/channel-registry.js +0 -96
- package/dist/core/chat/chat-pipeline.d.ts +0 -113
- package/dist/core/chat/chat-pipeline.js +0 -395
- package/dist/core/chat/chat-responder.d.ts +0 -90
- package/dist/core/chat/chat-responder.js +0 -185
- package/dist/core/chat/formatter.d.ts +0 -11
- package/dist/core/chat/formatter.js +0 -60
- package/dist/core/chat/index.d.ts +0 -24
- package/dist/core/chat/index.js +0 -18
- package/dist/core/chat/message-interpreter.d.ts +0 -91
- package/dist/core/chat/message-interpreter.js +0 -166
- package/dist/core/chat/message-store.d.ts +0 -66
- package/dist/core/chat/message-store.js +0 -131
- package/dist/core/chat/notification-queue.d.ts +0 -34
- package/dist/core/chat/notification-queue.js +0 -111
- package/dist/core/chat/pipeline.d.ts +0 -38
- package/dist/core/chat/pipeline.js +0 -89
- package/dist/core/chat/policies.d.ts +0 -16
- package/dist/core/chat/policies.js +0 -25
- package/dist/core/chat/routing.d.ts +0 -17
- package/dist/core/chat/routing.js +0 -36
- package/dist/core/chat/session-key.d.ts +0 -30
- package/dist/core/chat/session-key.js +0 -65
- package/dist/core/chat/session-manager.d.ts +0 -17
- package/dist/core/chat/session-manager.js +0 -23
- package/dist/core/chat/text-chunker.d.ts +0 -9
- package/dist/core/chat/text-chunker.js +0 -48
- package/dist/core/chat/triage-router.d.ts +0 -75
- package/dist/core/chat/triage-router.js +0 -142
- package/dist/core/chat/types.d.ts +0 -5
- package/dist/core/chat/types.js +0 -5
- package/dist/core/config/defaults.d.ts +0 -2
- package/dist/core/config/defaults.js +0 -38
- package/dist/core/config/index.d.ts +0 -6
- package/dist/core/config/index.js +0 -4
- package/dist/core/config/interpolate.d.ts +0 -5
- package/dist/core/config/interpolate.js +0 -27
- package/dist/core/config/loader.d.ts +0 -24
- package/dist/core/config/loader.js +0 -59
- package/dist/core/config/schema.d.ts +0 -5
- package/dist/core/config/schema.js +0 -119
- package/dist/core/data/core-entity-contexts.d.ts +0 -14
- package/dist/core/data/core-entity-contexts.js +0 -197
- package/dist/core/data/core-migrations.d.ts +0 -5
- package/dist/core/data/core-migrations.js +0 -45
- package/dist/core/data/core-schema.d.ts +0 -6
- package/dist/core/data/core-schema.js +0 -454
- package/dist/core/data/data-store.d.ts +0 -67
- package/dist/core/data/data-store.js +0 -218
- package/dist/core/data/domain-entity-contexts.d.ts +0 -29
- package/dist/core/data/domain-entity-contexts.js +0 -321
- package/dist/core/data/domain-schema.d.ts +0 -36
- package/dist/core/data/domain-schema.js +0 -323
- package/dist/core/data/index.d.ts +0 -7
- package/dist/core/data/index.js +0 -7
- package/dist/core/data/types.d.ts +0 -111
- package/dist/core/data/types.js +0 -1
- package/dist/core/hooks/hook-bus.d.ts +0 -18
- package/dist/core/hooks/hook-bus.js +0 -120
- package/dist/core/hooks/index.d.ts +0 -2
- package/dist/core/hooks/index.js +0 -1
- package/dist/core/hooks/types.d.ts +0 -19
- package/dist/core/hooks/types.js +0 -1
- package/dist/core/index.d.ts +0 -4
- package/dist/core/index.js +0 -4
- package/dist/core/llm/auto-discovery.d.ts +0 -11
- package/dist/core/llm/auto-discovery.js +0 -49
- package/dist/core/llm/cost-tracker.d.ts +0 -6
- package/dist/core/llm/cost-tracker.js +0 -38
- package/dist/core/llm/index.d.ts +0 -4
- package/dist/core/llm/index.js +0 -3
- package/dist/core/llm/model-router.d.ts +0 -25
- package/dist/core/llm/model-router.js +0 -49
- package/dist/core/llm/provider-registry.d.ts +0 -9
- package/dist/core/llm/provider-registry.js +0 -25
- package/dist/core/llm/types.d.ts +0 -2
- package/dist/core/llm/types.js +0 -2
- package/dist/core/orchestrator/adapters/api-adapter.d.ts +0 -34
- package/dist/core/orchestrator/adapters/api-adapter.js +0 -88
- package/dist/core/orchestrator/adapters/cli-adapter.d.ts +0 -22
- package/dist/core/orchestrator/adapters/cli-adapter.js +0 -69
- package/dist/core/orchestrator/adapters/deterministic-adapter.d.ts +0 -35
- package/dist/core/orchestrator/adapters/deterministic-adapter.js +0 -75
- package/dist/core/orchestrator/adapters/env-whitelist.d.ts +0 -4
- package/dist/core/orchestrator/adapters/env-whitelist.js +0 -27
- package/dist/core/orchestrator/adapters/output-extractor.d.ts +0 -11
- package/dist/core/orchestrator/adapters/output-extractor.js +0 -59
- package/dist/core/orchestrator/adapters/process-manager.d.ts +0 -15
- package/dist/core/orchestrator/adapters/process-manager.js +0 -26
- package/dist/core/orchestrator/adapters/tool-loop.d.ts +0 -22
- package/dist/core/orchestrator/adapters/tool-loop.js +0 -66
- package/dist/core/orchestrator/agent-registry.d.ts +0 -31
- package/dist/core/orchestrator/agent-registry.js +0 -135
- package/dist/core/orchestrator/budget-controller.d.ts +0 -19
- package/dist/core/orchestrator/budget-controller.js +0 -73
- package/dist/core/orchestrator/chain-guard.d.ts +0 -14
- package/dist/core/orchestrator/chain-guard.js +0 -23
- package/dist/core/orchestrator/circuit-breaker.d.ts +0 -65
- package/dist/core/orchestrator/circuit-breaker.js +0 -159
- package/dist/core/orchestrator/claude-stream-parser.d.ts +0 -31
- package/dist/core/orchestrator/claude-stream-parser.js +0 -99
- package/dist/core/orchestrator/config-revisions.d.ts +0 -6
- package/dist/core/orchestrator/config-revisions.js +0 -17
- package/dist/core/orchestrator/dependency-resolver.d.ts +0 -20
- package/dist/core/orchestrator/dependency-resolver.js +0 -78
- package/dist/core/orchestrator/governance-gate.d.ts +0 -110
- package/dist/core/orchestrator/governance-gate.js +0 -170
- package/dist/core/orchestrator/learning-pipeline.d.ts +0 -109
- package/dist/core/orchestrator/learning-pipeline.js +0 -249
- package/dist/core/orchestrator/loop-detector.d.ts +0 -51
- package/dist/core/orchestrator/loop-detector.js +0 -133
- package/dist/core/orchestrator/ndjson-logger.d.ts +0 -6
- package/dist/core/orchestrator/ndjson-logger.js +0 -18
- package/dist/core/orchestrator/permission-relay.d.ts +0 -72
- package/dist/core/orchestrator/permission-relay.js +0 -164
- package/dist/core/orchestrator/run-manager.d.ts +0 -31
- package/dist/core/orchestrator/run-manager.js +0 -178
- package/dist/core/orchestrator/scheduler.d.ts +0 -70
- package/dist/core/orchestrator/scheduler.js +0 -198
- package/dist/core/orchestrator/secret-store.d.ts +0 -57
- package/dist/core/orchestrator/secret-store.js +0 -171
- package/dist/core/orchestrator/session-manager.d.ts +0 -13
- package/dist/core/orchestrator/session-manager.js +0 -66
- package/dist/core/orchestrator/task-queue.d.ts +0 -34
- package/dist/core/orchestrator/task-queue.js +0 -83
- package/dist/core/orchestrator/template-interpolate.d.ts +0 -5
- package/dist/core/orchestrator/template-interpolate.js +0 -18
- package/dist/core/orchestrator/user-registry.d.ts +0 -47
- package/dist/core/orchestrator/user-registry.js +0 -76
- package/dist/core/orchestrator/wakeup-queue.d.ts +0 -9
- package/dist/core/orchestrator/wakeup-queue.js +0 -45
- package/dist/core/orchestrator/workflow-engine.d.ts +0 -47
- package/dist/core/orchestrator/workflow-engine.js +0 -204
- package/dist/core/security/audit.d.ts +0 -20
- package/dist/core/security/audit.js +0 -33
- package/dist/core/security/column-validator.d.ts +0 -20
- package/dist/core/security/column-validator.js +0 -37
- package/dist/core/security/index.d.ts +0 -5
- package/dist/core/security/index.js +0 -5
- package/dist/core/security/process-env.d.ts +0 -13
- package/dist/core/security/process-env.js +0 -49
- package/dist/core/security/sanitizer.d.ts +0 -11
- package/dist/core/security/sanitizer.js +0 -39
- package/dist/core/security/types.d.ts +0 -11
- package/dist/core/security/types.js +0 -1
- package/dist/core/update/auto-update.d.ts +0 -21
- package/dist/core/update/auto-update.js +0 -102
- package/dist/core/update/backup-manager.d.ts +0 -7
- package/dist/core/update/backup-manager.js +0 -24
- package/dist/core/update/index.d.ts +0 -8
- package/dist/core/update/index.js +0 -6
- package/dist/core/update/migration-hooks.d.ts +0 -11
- package/dist/core/update/migration-hooks.js +0 -10
- package/dist/core/update/types.d.ts +0 -11
- package/dist/core/update/types.js +0 -1
- package/dist/core/update/update-checker.d.ts +0 -11
- package/dist/core/update/update-checker.js +0 -63
- package/dist/core/update/update-manager.d.ts +0 -25
- package/dist/core/update/update-manager.js +0 -101
- package/dist/core/update/version-utils.d.ts +0 -6
- package/dist/core/update/version-utils.js +0 -34
- package/dist/gmail-connector-MNUBRNFM.js +0 -6
- package/dist/gmail-connector-PS2VLGNE.js +0 -6
- package/dist/gmail-connector-ULSMN6X2.js +0 -6
- package/dist/gmail-connector-URRFX6A3.js +0 -6
- package/dist/inbound-AFBUPSPG.js +0 -10
- package/dist/inbound-AFOHYNUY.js +0 -6
- package/dist/inbound-CGIXRXGC.js +0 -8
- package/dist/inbound-MCOLRH6U.js +0 -10
- package/dist/inbound-SNEMBLGA.js +0 -6
- package/dist/inbound-ZJHAYVMF.js +0 -10
- package/dist/provider-qqJYv9nv.d.ts +0 -75
- package/dist/providers/anthropic/models.d.ts +0 -2
- package/dist/providers/anthropic/models.js +0 -29
- package/dist/providers/anthropic/provider.d.ts +0 -13
- package/dist/providers/anthropic/provider.js +0 -119
- package/dist/providers/anthropic/tool-converter.d.ts +0 -10
- package/dist/providers/anthropic/tool-converter.js +0 -7
- package/dist/providers/ollama/provider.d.ts +0 -17
- package/dist/providers/ollama/provider.js +0 -185
- package/dist/providers/openai/models.d.ts +0 -2
- package/dist/providers/openai/models.js +0 -29
- package/dist/providers/openai/provider.d.ts +0 -13
- package/dist/providers/openai/provider.js +0 -163
- package/dist/providers/openai/tool-converter.d.ts +0 -10
- package/dist/providers/openai/tool-converter.js +0 -10
- package/dist/shared/constants.d.ts +0 -50
- package/dist/shared/constants.js +0 -64
- package/dist/shared/index.d.ts +0 -14
- package/dist/shared/index.js +0 -14
- package/dist/shared/types/agent.d.ts +0 -36
- package/dist/shared/types/agent.js +0 -2
- package/dist/shared/types/channel.d.ts +0 -70
- package/dist/shared/types/channel.js +0 -2
- package/dist/shared/types/config.d.ts +0 -111
- package/dist/shared/types/config.js +0 -2
- package/dist/shared/types/connector.d.ts +0 -77
- package/dist/shared/types/connector.js +0 -2
- package/dist/shared/types/execution.d.ts +0 -29
- package/dist/shared/types/execution.js +0 -2
- package/dist/shared/types/provider.d.ts +0 -73
- package/dist/shared/types/provider.js +0 -2
- package/dist/shared/types/task.d.ts +0 -47
- package/dist/shared/types/task.js +0 -2
- package/dist/shared/types/workflow.d.ts +0 -39
- package/dist/shared/types/workflow.js +0 -2
- package/dist/shared/utils.d.ts +0 -6
- package/dist/shared/utils.js +0 -13
- package/dist/update-check.d.ts +0 -5
- package/dist/update-check.js +0 -56
|
@@ -1,323 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Define standard domain tables that most multi-agent apps need.
|
|
3
|
-
* Call after defineCoreTables() and before db.init().
|
|
4
|
-
*
|
|
5
|
-
* Provides: org, project, + optional client, invoice, repository,
|
|
6
|
-
* file, channel, rule, event tables with appropriate junction tables.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* defineCoreTables(db);
|
|
11
|
-
* defineDomainTables(db); // all tables
|
|
12
|
-
* defineDomainTables(db, { clients: false }); // skip client/invoice
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
export function defineDomainTables(db, options = {}) {
|
|
16
|
-
const opts = {
|
|
17
|
-
clients: true,
|
|
18
|
-
repositories: true,
|
|
19
|
-
files: true,
|
|
20
|
-
channels: true,
|
|
21
|
-
rules: true,
|
|
22
|
-
events: true,
|
|
23
|
-
junctions: true,
|
|
24
|
-
...options,
|
|
25
|
-
};
|
|
26
|
-
// --- Core domain entities ---
|
|
27
|
-
db.define("org", {
|
|
28
|
-
columns: {
|
|
29
|
-
id: "TEXT PRIMARY KEY",
|
|
30
|
-
name: "TEXT NOT NULL",
|
|
31
|
-
type: "TEXT NOT NULL DEFAULT 'company'",
|
|
32
|
-
description: "TEXT",
|
|
33
|
-
mission: "TEXT",
|
|
34
|
-
website: "TEXT",
|
|
35
|
-
created_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
36
|
-
updated_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
37
|
-
deleted_at: "TEXT",
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
db.define("project", {
|
|
41
|
-
columns: {
|
|
42
|
-
id: "TEXT PRIMARY KEY",
|
|
43
|
-
org_id: "TEXT NOT NULL",
|
|
44
|
-
name: "TEXT NOT NULL",
|
|
45
|
-
status: "TEXT",
|
|
46
|
-
description: "TEXT",
|
|
47
|
-
tech_stack: "TEXT",
|
|
48
|
-
github_repo: "TEXT",
|
|
49
|
-
deploy_target: "TEXT",
|
|
50
|
-
production_url: "TEXT",
|
|
51
|
-
branch_strategy: "TEXT",
|
|
52
|
-
repo_path: "TEXT",
|
|
53
|
-
codename: "TEXT",
|
|
54
|
-
notes: "TEXT",
|
|
55
|
-
created_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
56
|
-
updated_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
57
|
-
deleted_at: "TEXT",
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
|
-
// Agent ↔ project junction
|
|
61
|
-
db.define("agent_project", {
|
|
62
|
-
columns: {
|
|
63
|
-
agent_id: "TEXT NOT NULL",
|
|
64
|
-
project_id: "TEXT NOT NULL",
|
|
65
|
-
role: "TEXT",
|
|
66
|
-
created_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
67
|
-
},
|
|
68
|
-
primaryKey: ["agent_id", "project_id"],
|
|
69
|
-
});
|
|
70
|
-
// Secret ↔ project junction
|
|
71
|
-
db.define("secret_project", {
|
|
72
|
-
columns: {
|
|
73
|
-
secret_id: "TEXT NOT NULL",
|
|
74
|
-
project_id: "TEXT NOT NULL",
|
|
75
|
-
created_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
76
|
-
},
|
|
77
|
-
primaryKey: ["secret_id", "project_id"],
|
|
78
|
-
});
|
|
79
|
-
// Secret ↔ org junction
|
|
80
|
-
db.define("secret_org", {
|
|
81
|
-
columns: {
|
|
82
|
-
secret_id: "TEXT NOT NULL",
|
|
83
|
-
org_id: "TEXT NOT NULL",
|
|
84
|
-
created_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
85
|
-
},
|
|
86
|
-
primaryKey: ["secret_id", "org_id"],
|
|
87
|
-
});
|
|
88
|
-
// --- Optional: clients + invoicing ---
|
|
89
|
-
if (opts.clients) {
|
|
90
|
-
db.define("client", {
|
|
91
|
-
columns: {
|
|
92
|
-
id: "TEXT PRIMARY KEY",
|
|
93
|
-
org_id: "TEXT NOT NULL",
|
|
94
|
-
name: "TEXT NOT NULL",
|
|
95
|
-
contact_name: "TEXT",
|
|
96
|
-
contact_email: "TEXT",
|
|
97
|
-
phone: "TEXT",
|
|
98
|
-
address: "TEXT",
|
|
99
|
-
status: "TEXT NOT NULL DEFAULT 'active'",
|
|
100
|
-
notes: "TEXT",
|
|
101
|
-
created_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
102
|
-
updated_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
103
|
-
deleted_at: "TEXT",
|
|
104
|
-
},
|
|
105
|
-
});
|
|
106
|
-
db.define("invoice", {
|
|
107
|
-
columns: {
|
|
108
|
-
id: "TEXT PRIMARY KEY",
|
|
109
|
-
org_id: "TEXT NOT NULL",
|
|
110
|
-
client_id: "TEXT NOT NULL",
|
|
111
|
-
number: "TEXT",
|
|
112
|
-
amount_cents: "INTEGER",
|
|
113
|
-
currency: "TEXT DEFAULT 'USD'",
|
|
114
|
-
status: "TEXT NOT NULL DEFAULT 'draft'",
|
|
115
|
-
description: "TEXT",
|
|
116
|
-
hours: "REAL",
|
|
117
|
-
rate_cents: "INTEGER",
|
|
118
|
-
items_json: "TEXT",
|
|
119
|
-
issued_at: "TEXT",
|
|
120
|
-
due_at: "TEXT",
|
|
121
|
-
paid_at: "TEXT",
|
|
122
|
-
notes: "TEXT",
|
|
123
|
-
created_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
124
|
-
updated_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
125
|
-
deleted_at: "TEXT",
|
|
126
|
-
},
|
|
127
|
-
tableConstraints: [
|
|
128
|
-
"CREATE INDEX IF NOT EXISTS idx_invoice_client ON invoice(client_id)",
|
|
129
|
-
],
|
|
130
|
-
});
|
|
131
|
-
db.define("agent_client", {
|
|
132
|
-
columns: {
|
|
133
|
-
agent_id: "TEXT NOT NULL",
|
|
134
|
-
client_id: "TEXT NOT NULL",
|
|
135
|
-
created_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
136
|
-
},
|
|
137
|
-
primaryKey: ["agent_id", "client_id"],
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
// --- Optional: repositories ---
|
|
141
|
-
if (opts.repositories) {
|
|
142
|
-
db.define("repository", {
|
|
143
|
-
columns: {
|
|
144
|
-
id: "TEXT PRIMARY KEY",
|
|
145
|
-
org_id: "TEXT NOT NULL",
|
|
146
|
-
project_id: "TEXT",
|
|
147
|
-
client_id: "TEXT",
|
|
148
|
-
name: "TEXT NOT NULL",
|
|
149
|
-
url: "TEXT",
|
|
150
|
-
local_path: "TEXT",
|
|
151
|
-
default_branch: "TEXT DEFAULT 'main'",
|
|
152
|
-
platform: "TEXT DEFAULT 'github'",
|
|
153
|
-
status: "TEXT NOT NULL DEFAULT 'active'",
|
|
154
|
-
notes: "TEXT",
|
|
155
|
-
created_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
156
|
-
updated_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
157
|
-
deleted_at: "TEXT",
|
|
158
|
-
},
|
|
159
|
-
tableConstraints: [
|
|
160
|
-
"CREATE INDEX IF NOT EXISTS idx_repository_project ON repository(project_id)",
|
|
161
|
-
"CREATE INDEX IF NOT EXISTS idx_repository_client ON repository(client_id)",
|
|
162
|
-
],
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
// --- Optional: files ---
|
|
166
|
-
if (opts.files) {
|
|
167
|
-
db.define("file", {
|
|
168
|
-
columns: {
|
|
169
|
-
id: "TEXT PRIMARY KEY",
|
|
170
|
-
org_id: "TEXT",
|
|
171
|
-
name: "TEXT NOT NULL",
|
|
172
|
-
file_path: "TEXT",
|
|
173
|
-
mime_type: "TEXT",
|
|
174
|
-
size_bytes: "INTEGER",
|
|
175
|
-
project_id: "TEXT",
|
|
176
|
-
access_level: "TEXT NOT NULL DEFAULT 'org'",
|
|
177
|
-
description: "TEXT",
|
|
178
|
-
tags: "TEXT",
|
|
179
|
-
notes: "TEXT",
|
|
180
|
-
created_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
181
|
-
updated_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
182
|
-
deleted_at: "TEXT",
|
|
183
|
-
},
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
// --- Optional: channels ---
|
|
187
|
-
if (opts.channels) {
|
|
188
|
-
db.define("channel", {
|
|
189
|
-
columns: {
|
|
190
|
-
id: "TEXT PRIMARY KEY",
|
|
191
|
-
org_id: "TEXT",
|
|
192
|
-
platform: "TEXT NOT NULL",
|
|
193
|
-
external_id: "TEXT",
|
|
194
|
-
name: "TEXT NOT NULL",
|
|
195
|
-
type: "TEXT NOT NULL DEFAULT 'channel'",
|
|
196
|
-
instructions: "TEXT",
|
|
197
|
-
created_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
198
|
-
updated_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
199
|
-
deleted_at: "TEXT",
|
|
200
|
-
},
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
// --- Optional: rules ---
|
|
204
|
-
if (opts.rules) {
|
|
205
|
-
db.define("rule", {
|
|
206
|
-
columns: {
|
|
207
|
-
id: "TEXT PRIMARY KEY",
|
|
208
|
-
org_id: "TEXT",
|
|
209
|
-
title: "TEXT NOT NULL",
|
|
210
|
-
rule_text: "TEXT NOT NULL",
|
|
211
|
-
scope: "TEXT NOT NULL DEFAULT 'org'",
|
|
212
|
-
category: "TEXT NOT NULL DEFAULT 'process'",
|
|
213
|
-
priority: "INTEGER NOT NULL DEFAULT 50",
|
|
214
|
-
rationale: "TEXT",
|
|
215
|
-
enforcement: "TEXT DEFAULT 'advisory'",
|
|
216
|
-
created_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
217
|
-
updated_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
218
|
-
deleted_at: "TEXT",
|
|
219
|
-
},
|
|
220
|
-
});
|
|
221
|
-
db.define("rule_agent", {
|
|
222
|
-
columns: {
|
|
223
|
-
rule_id: "TEXT NOT NULL",
|
|
224
|
-
agent_id: "TEXT NOT NULL",
|
|
225
|
-
created_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
226
|
-
},
|
|
227
|
-
primaryKey: ["rule_id", "agent_id"],
|
|
228
|
-
});
|
|
229
|
-
db.define("rule_project", {
|
|
230
|
-
columns: {
|
|
231
|
-
rule_id: "TEXT NOT NULL",
|
|
232
|
-
project_id: "TEXT NOT NULL",
|
|
233
|
-
created_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
234
|
-
},
|
|
235
|
-
primaryKey: ["rule_id", "project_id"],
|
|
236
|
-
});
|
|
237
|
-
db.define("rule_org", {
|
|
238
|
-
columns: {
|
|
239
|
-
rule_id: "TEXT NOT NULL",
|
|
240
|
-
org_id: "TEXT NOT NULL",
|
|
241
|
-
created_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
242
|
-
},
|
|
243
|
-
primaryKey: ["rule_id", "org_id"],
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
// --- Optional: event audit log ---
|
|
247
|
-
if (opts.events) {
|
|
248
|
-
db.define("event", {
|
|
249
|
-
columns: {
|
|
250
|
-
id: "TEXT PRIMARY KEY",
|
|
251
|
-
org_id: "TEXT",
|
|
252
|
-
type: "TEXT NOT NULL",
|
|
253
|
-
summary: "TEXT NOT NULL",
|
|
254
|
-
details: "TEXT",
|
|
255
|
-
severity: "TEXT NOT NULL DEFAULT 'info'",
|
|
256
|
-
actor_agent_id: "TEXT",
|
|
257
|
-
actor_user_id: "TEXT",
|
|
258
|
-
project_id: "TEXT",
|
|
259
|
-
channel_id: "TEXT",
|
|
260
|
-
source: "TEXT",
|
|
261
|
-
created_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
262
|
-
deleted_at: "TEXT",
|
|
263
|
-
},
|
|
264
|
-
tableConstraints: [
|
|
265
|
-
"CREATE INDEX IF NOT EXISTS idx_event_type ON event(type, created_at)",
|
|
266
|
-
"CREATE INDEX IF NOT EXISTS idx_event_project ON event(project_id)",
|
|
267
|
-
],
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
// --- Optional: cross-domain junction tables ---
|
|
271
|
-
if (opts.junctions) {
|
|
272
|
-
db.define("secret_client", {
|
|
273
|
-
columns: {
|
|
274
|
-
secret_id: "TEXT NOT NULL",
|
|
275
|
-
client_id: "TEXT NOT NULL",
|
|
276
|
-
created_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
277
|
-
},
|
|
278
|
-
primaryKey: ["secret_id", "client_id"],
|
|
279
|
-
});
|
|
280
|
-
db.define("secret_user", {
|
|
281
|
-
columns: {
|
|
282
|
-
secret_id: "TEXT NOT NULL",
|
|
283
|
-
user_id: "TEXT NOT NULL",
|
|
284
|
-
created_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
285
|
-
},
|
|
286
|
-
primaryKey: ["secret_id", "user_id"],
|
|
287
|
-
});
|
|
288
|
-
db.define("secret_repository", {
|
|
289
|
-
columns: {
|
|
290
|
-
secret_id: "TEXT NOT NULL",
|
|
291
|
-
repository_id: "TEXT NOT NULL",
|
|
292
|
-
created_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
293
|
-
},
|
|
294
|
-
primaryKey: ["secret_id", "repository_id"],
|
|
295
|
-
});
|
|
296
|
-
db.define("file_agent", {
|
|
297
|
-
columns: {
|
|
298
|
-
file_id: "TEXT NOT NULL",
|
|
299
|
-
agent_id: "TEXT NOT NULL",
|
|
300
|
-
created_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
301
|
-
},
|
|
302
|
-
primaryKey: ["file_id", "agent_id"],
|
|
303
|
-
});
|
|
304
|
-
db.define("user_channel", {
|
|
305
|
-
columns: {
|
|
306
|
-
user_id: "TEXT NOT NULL",
|
|
307
|
-
channel_id: "TEXT NOT NULL",
|
|
308
|
-
role: "TEXT",
|
|
309
|
-
created_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
310
|
-
},
|
|
311
|
-
primaryKey: ["user_id", "channel_id"],
|
|
312
|
-
});
|
|
313
|
-
db.define("user_project", {
|
|
314
|
-
columns: {
|
|
315
|
-
user_id: "TEXT NOT NULL",
|
|
316
|
-
project_id: "TEXT NOT NULL",
|
|
317
|
-
role: "TEXT",
|
|
318
|
-
created_at: "TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP",
|
|
319
|
-
},
|
|
320
|
-
primaryKey: ["user_id", "project_id"],
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from './types.js';
|
|
2
|
-
export * from './data-store.js';
|
|
3
|
-
export * from './core-schema.js';
|
|
4
|
-
export * from './core-migrations.js';
|
|
5
|
-
export * from './core-entity-contexts.js';
|
|
6
|
-
export * from './domain-schema.js';
|
|
7
|
-
export * from './domain-entity-contexts.js';
|
package/dist/core/data/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from './types.js';
|
|
2
|
-
export * from './data-store.js';
|
|
3
|
-
export * from './core-schema.js';
|
|
4
|
-
export * from './core-migrations.js';
|
|
5
|
-
export * from './core-entity-contexts.js';
|
|
6
|
-
export * from './domain-schema.js';
|
|
7
|
-
export * from './domain-entity-contexts.js';
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
export interface TableDefinition {
|
|
2
|
-
columns: Record<string, string>;
|
|
3
|
-
primaryKey?: string | string[];
|
|
4
|
-
tableConstraints?: string[];
|
|
5
|
-
relations?: Record<string, RelationDef>;
|
|
6
|
-
render?: string | ((rows: Row[]) => string);
|
|
7
|
-
outputFile?: string;
|
|
8
|
-
filter?: (rows: Row[]) => Row[];
|
|
9
|
-
}
|
|
10
|
-
export interface RelationDef {
|
|
11
|
-
type: 'belongsTo' | 'hasMany';
|
|
12
|
-
table: string;
|
|
13
|
-
foreignKey: string;
|
|
14
|
-
references?: string;
|
|
15
|
-
}
|
|
16
|
-
export interface EntityContextDef {
|
|
17
|
-
table: string;
|
|
18
|
-
directory: string;
|
|
19
|
-
slugColumn: string;
|
|
20
|
-
files: Record<string, EntityFileSpec>;
|
|
21
|
-
indexFile?: string;
|
|
22
|
-
/** Custom index render function. If omitted, a default listing is generated. */
|
|
23
|
-
indexRender?: (rows: Row[]) => string;
|
|
24
|
-
protectedFiles?: string[];
|
|
25
|
-
/** When true, this entity's data is never rendered into other entities' context files. */
|
|
26
|
-
protected?: boolean;
|
|
27
|
-
/** Enable at-rest encryption. Requires encryptionKey in Lattice options. */
|
|
28
|
-
encrypted?: boolean | {
|
|
29
|
-
columns: string[];
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
export interface EntityFileSpec {
|
|
33
|
-
source: EntitySource;
|
|
34
|
-
render: string | ((rows: Row[]) => string);
|
|
35
|
-
junctionColumns?: string[];
|
|
36
|
-
omitIfEmpty?: boolean;
|
|
37
|
-
}
|
|
38
|
-
export type EntitySource = {
|
|
39
|
-
type: 'self';
|
|
40
|
-
} | {
|
|
41
|
-
type: 'hasMany';
|
|
42
|
-
table: string;
|
|
43
|
-
foreignKey: string;
|
|
44
|
-
filters?: Filter[];
|
|
45
|
-
softDelete?: boolean;
|
|
46
|
-
orderBy?: string;
|
|
47
|
-
limit?: number;
|
|
48
|
-
} | {
|
|
49
|
-
type: 'manyToMany';
|
|
50
|
-
junctionTable: string;
|
|
51
|
-
localKey: string;
|
|
52
|
-
remoteKey: string;
|
|
53
|
-
remoteTable: string;
|
|
54
|
-
filters?: Filter[];
|
|
55
|
-
softDelete?: boolean;
|
|
56
|
-
orderBy?: string;
|
|
57
|
-
limit?: number;
|
|
58
|
-
} | {
|
|
59
|
-
type: 'belongsTo';
|
|
60
|
-
table: string;
|
|
61
|
-
foreignKey: string;
|
|
62
|
-
} | {
|
|
63
|
-
type: 'enriched';
|
|
64
|
-
include: Record<string, EntitySource>;
|
|
65
|
-
} | {
|
|
66
|
-
type: 'custom';
|
|
67
|
-
resolve: (row: Row, adapter: SqliteAdapter) => Row[];
|
|
68
|
-
};
|
|
69
|
-
export interface Filter {
|
|
70
|
-
col: string;
|
|
71
|
-
op: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte' | 'like' | 'in' | 'isNull' | 'isNotNull';
|
|
72
|
-
val?: unknown;
|
|
73
|
-
}
|
|
74
|
-
export interface QueryOptions {
|
|
75
|
-
where?: Record<string, unknown>;
|
|
76
|
-
filters?: Filter[];
|
|
77
|
-
orderBy?: string | Array<{
|
|
78
|
-
col: string;
|
|
79
|
-
dir: 'asc' | 'desc';
|
|
80
|
-
}>;
|
|
81
|
-
orderDir?: 'asc' | 'desc';
|
|
82
|
-
limit?: number;
|
|
83
|
-
offset?: number;
|
|
84
|
-
}
|
|
85
|
-
export type Row = Record<string, unknown>;
|
|
86
|
-
export type PkLookup = string | Record<string, unknown>;
|
|
87
|
-
export interface SqliteAdapter {
|
|
88
|
-
run(sql: string, params?: unknown[]): import('better-sqlite3').RunResult;
|
|
89
|
-
get<T = Row>(sql: string, params?: unknown[]): T | undefined;
|
|
90
|
-
all<T = Row>(sql: string, params?: unknown[]): T[];
|
|
91
|
-
tableInfo(table: string): TableInfoRow[];
|
|
92
|
-
invalidateTableCache(table: string): void;
|
|
93
|
-
}
|
|
94
|
-
export interface TableInfoRow {
|
|
95
|
-
cid: number;
|
|
96
|
-
name: string;
|
|
97
|
-
type: string;
|
|
98
|
-
notnull: number;
|
|
99
|
-
dflt_value: unknown;
|
|
100
|
-
pk: number;
|
|
101
|
-
}
|
|
102
|
-
export interface SeedItem {
|
|
103
|
-
table: string;
|
|
104
|
-
rows: Row[];
|
|
105
|
-
naturalKey?: string | string[];
|
|
106
|
-
junctions?: Array<{
|
|
107
|
-
table: string;
|
|
108
|
-
items: Array<Row>;
|
|
109
|
-
}>;
|
|
110
|
-
softDeleteMissing?: boolean;
|
|
111
|
-
}
|
package/dist/core/data/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { HookHandler, HookOptions, Unsubscribe } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Priority-ordered event bus for decoupled inter-layer communication.
|
|
4
|
-
* Story 1.1 — handlers run in priority order, errors are isolated,
|
|
5
|
-
* and registrations are unsubscribable.
|
|
6
|
-
*/
|
|
7
|
-
export declare class HookBus {
|
|
8
|
-
private readonly registrations;
|
|
9
|
-
private nextId;
|
|
10
|
-
register(event: string, handler: HookHandler, opts?: HookOptions): Unsubscribe;
|
|
11
|
-
emit(event: string, context: Record<string, unknown>): Promise<void>;
|
|
12
|
-
/** Emit synchronously (use only when async is not needed) */
|
|
13
|
-
emitSync(event: string, context: Record<string, unknown>): void;
|
|
14
|
-
hasListeners(event: string): boolean;
|
|
15
|
-
listRegistered(): string[];
|
|
16
|
-
/** Remove all handlers for an event, or all handlers if no event given */
|
|
17
|
-
clear(event?: string): void;
|
|
18
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Priority-ordered event bus for decoupled inter-layer communication.
|
|
3
|
-
* Story 1.1 — handlers run in priority order, errors are isolated,
|
|
4
|
-
* and registrations are unsubscribable.
|
|
5
|
-
*/
|
|
6
|
-
export class HookBus {
|
|
7
|
-
registrations = new Map();
|
|
8
|
-
nextId = 0;
|
|
9
|
-
register(event, handler, opts) {
|
|
10
|
-
const reg = {
|
|
11
|
-
event,
|
|
12
|
-
handler,
|
|
13
|
-
priority: opts?.priority ?? 50,
|
|
14
|
-
once: opts?.once ?? false,
|
|
15
|
-
filter: opts?.filter,
|
|
16
|
-
id: this.nextId++,
|
|
17
|
-
};
|
|
18
|
-
const list = this.registrations.get(event) ?? [];
|
|
19
|
-
list.push(reg);
|
|
20
|
-
// Sort by priority ASC, then id ASC (insertion order tiebreaker)
|
|
21
|
-
list.sort((a, b) => a.priority - b.priority || a.id - b.id);
|
|
22
|
-
this.registrations.set(event, list);
|
|
23
|
-
return () => {
|
|
24
|
-
const arr = this.registrations.get(event);
|
|
25
|
-
if (!arr)
|
|
26
|
-
return;
|
|
27
|
-
const idx = arr.indexOf(reg);
|
|
28
|
-
if (idx !== -1)
|
|
29
|
-
arr.splice(idx, 1);
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
async emit(event, context) {
|
|
33
|
-
const list = this.registrations.get(event);
|
|
34
|
-
if (!list || list.length === 0)
|
|
35
|
-
return;
|
|
36
|
-
// Copy to avoid mutation issues during iteration
|
|
37
|
-
const snapshot = [...list];
|
|
38
|
-
const toRemove = [];
|
|
39
|
-
for (const reg of snapshot) {
|
|
40
|
-
// Filter check: every key/value in filter must match context
|
|
41
|
-
if (reg.filter) {
|
|
42
|
-
const matches = Object.entries(reg.filter).every(([k, v]) => context[k] === v);
|
|
43
|
-
if (!matches)
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
try {
|
|
47
|
-
await reg.handler(context);
|
|
48
|
-
}
|
|
49
|
-
catch (err) {
|
|
50
|
-
// Errors are caught and logged — never block other handlers
|
|
51
|
-
console.error(`[HookBus] Handler error on event "${event}":`, err);
|
|
52
|
-
}
|
|
53
|
-
if (reg.once)
|
|
54
|
-
toRemove.push(reg);
|
|
55
|
-
}
|
|
56
|
-
// Remove once-handlers after iteration (avoid splice-during-iteration bugs)
|
|
57
|
-
for (const r of toRemove) {
|
|
58
|
-
const arr = this.registrations.get(event);
|
|
59
|
-
if (!arr)
|
|
60
|
-
continue;
|
|
61
|
-
const idx = arr.indexOf(r);
|
|
62
|
-
if (idx !== -1)
|
|
63
|
-
arr.splice(idx, 1);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
/** Emit synchronously (use only when async is not needed) */
|
|
67
|
-
emitSync(event, context) {
|
|
68
|
-
const list = this.registrations.get(event);
|
|
69
|
-
if (!list || list.length === 0)
|
|
70
|
-
return;
|
|
71
|
-
const snapshot = [...list];
|
|
72
|
-
const toRemove = [];
|
|
73
|
-
for (const reg of snapshot) {
|
|
74
|
-
if (reg.filter) {
|
|
75
|
-
const matches = Object.entries(reg.filter).every(([k, v]) => context[k] === v);
|
|
76
|
-
if (!matches)
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
try {
|
|
80
|
-
const result = reg.handler(context);
|
|
81
|
-
if (result instanceof Promise) {
|
|
82
|
-
result.catch(err => console.error(`[HookBus] Async handler error on event "${event}":`, err));
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
catch (err) {
|
|
86
|
-
console.error(`[HookBus] Handler error on event "${event}":`, err);
|
|
87
|
-
}
|
|
88
|
-
if (reg.once)
|
|
89
|
-
toRemove.push(reg);
|
|
90
|
-
}
|
|
91
|
-
for (const r of toRemove) {
|
|
92
|
-
const arr = this.registrations.get(event);
|
|
93
|
-
if (!arr)
|
|
94
|
-
continue;
|
|
95
|
-
const idx = arr.indexOf(r);
|
|
96
|
-
if (idx !== -1)
|
|
97
|
-
arr.splice(idx, 1);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
hasListeners(event) {
|
|
101
|
-
return (this.registrations.get(event)?.length ?? 0) > 0;
|
|
102
|
-
}
|
|
103
|
-
listRegistered() {
|
|
104
|
-
const result = [];
|
|
105
|
-
for (const [k, v] of this.registrations) {
|
|
106
|
-
if (v.length > 0)
|
|
107
|
-
result.push(k);
|
|
108
|
-
}
|
|
109
|
-
return result;
|
|
110
|
-
}
|
|
111
|
-
/** Remove all handlers for an event, or all handlers if no event given */
|
|
112
|
-
clear(event) {
|
|
113
|
-
if (event) {
|
|
114
|
-
this.registrations.delete(event);
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
this.registrations.clear();
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
package/dist/core/hooks/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { HookBus } from "./hook-bus.js";
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export type HookHandler = (context: Record<string, unknown>) => Promise<void> | void;
|
|
2
|
-
export type Unsubscribe = () => void;
|
|
3
|
-
export interface HookOptions {
|
|
4
|
-
/** 0–100, default 50. Lower = runs first. */
|
|
5
|
-
priority?: number;
|
|
6
|
-
/** Auto-unsubscribe after first invocation. */
|
|
7
|
-
once?: boolean;
|
|
8
|
-
/** Only fire if context matches all filter key/value pairs. */
|
|
9
|
-
filter?: Record<string, unknown>;
|
|
10
|
-
}
|
|
11
|
-
export interface HookRegistration {
|
|
12
|
-
event: string;
|
|
13
|
-
handler: HookHandler;
|
|
14
|
-
priority: number;
|
|
15
|
-
once: boolean;
|
|
16
|
-
filter?: Record<string, unknown>;
|
|
17
|
-
/** Internal auto-increment for stable sort within same priority */
|
|
18
|
-
id: number;
|
|
19
|
-
}
|
package/dist/core/hooks/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/core/index.d.ts
DELETED
package/dist/core/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { LLMProvider } from "./types.js";
|
|
2
|
-
type Importer = (packageName: string) => Promise<unknown>;
|
|
3
|
-
/**
|
|
4
|
-
* Scans nodeModulesPath/@botinabox/{pkg}/package.json for each package in the scope.
|
|
5
|
-
* If pkg.botinabox?.type === 'provider', dynamically imports the package
|
|
6
|
-
* and returns the discovered LLMProvider instances.
|
|
7
|
-
*
|
|
8
|
-
* The optional importer parameter allows injection for testing.
|
|
9
|
-
*/
|
|
10
|
-
export declare function discoverProviders(nodeModulesPath: string, importer?: Importer): Promise<LLMProvider[]>;
|
|
11
|
-
export {};
|