botinabox 2.4.2 → 2.5.0
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/channels/slack/index.d.ts +1 -1
- package/dist/{chat-pipeline-BWrtVqEP.d.ts → chat-pipeline-DuNX5WoL.d.ts} +3 -0
- package/dist/cli.js +0 -0
- package/dist/index.d.ts +11 -2
- package/dist/index.js +64 -27
- package/package.json +100 -99
- 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-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/chunk-UACT2WXX.js +0 -381
- 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-2FVYTQJH.js +0 -6
- 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,11 +0,0 @@
|
|
|
1
|
-
export interface PackageUpdate {
|
|
2
|
-
name: string;
|
|
3
|
-
installedVersion: string;
|
|
4
|
-
latestVersion: string;
|
|
5
|
-
updateType: 'patch' | 'minor' | 'major';
|
|
6
|
-
}
|
|
7
|
-
export interface UpdateManifest {
|
|
8
|
-
checkedAt: string;
|
|
9
|
-
packages: PackageUpdate[];
|
|
10
|
-
hasUpdates: boolean;
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { UpdateManifest } from './types.js';
|
|
2
|
-
export declare class UpdateChecker {
|
|
3
|
-
private nodeModulesPath;
|
|
4
|
-
private opts?;
|
|
5
|
-
private readonly fetchFn;
|
|
6
|
-
constructor(nodeModulesPath: string, opts?: {
|
|
7
|
-
fetch?: typeof globalThis.fetch;
|
|
8
|
-
} | undefined);
|
|
9
|
-
getInstalledPackages(): string[];
|
|
10
|
-
check(packageNames?: string[]): Promise<UpdateManifest>;
|
|
11
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { readFileSync, readdirSync } from 'fs';
|
|
2
|
-
import { join } from 'path';
|
|
3
|
-
import { classifyUpdate, compareVersions } from './version-utils.js';
|
|
4
|
-
export class UpdateChecker {
|
|
5
|
-
nodeModulesPath;
|
|
6
|
-
opts;
|
|
7
|
-
fetchFn;
|
|
8
|
-
constructor(nodeModulesPath, opts) {
|
|
9
|
-
this.nodeModulesPath = nodeModulesPath;
|
|
10
|
-
this.opts = opts;
|
|
11
|
-
this.fetchFn = opts?.fetch ?? globalThis.fetch;
|
|
12
|
-
}
|
|
13
|
-
getInstalledPackages() {
|
|
14
|
-
try {
|
|
15
|
-
const botinaboxPath = join(this.nodeModulesPath, '@botinabox');
|
|
16
|
-
const entries = readdirSync(botinaboxPath, { withFileTypes: true });
|
|
17
|
-
return entries
|
|
18
|
-
.filter((e) => e.isDirectory())
|
|
19
|
-
.map((e) => e.name);
|
|
20
|
-
}
|
|
21
|
-
catch {
|
|
22
|
-
return [];
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
async check(packageNames) {
|
|
26
|
-
const installed = packageNames ?? this.getInstalledPackages();
|
|
27
|
-
const updates = [];
|
|
28
|
-
for (const pkg of installed) {
|
|
29
|
-
try {
|
|
30
|
-
const pkgJsonPath = join(this.nodeModulesPath, '@botinabox', pkg, 'package.json');
|
|
31
|
-
const pkgJson = JSON.parse(readFileSync(pkgJsonPath, 'utf-8'));
|
|
32
|
-
const installedVersion = pkgJson.version ?? '0.0.0';
|
|
33
|
-
const response = await this.fetchFn(`https://registry.npmjs.org/@botinabox/${pkg}`);
|
|
34
|
-
if (!response.ok)
|
|
35
|
-
continue;
|
|
36
|
-
const data = await response.json();
|
|
37
|
-
const latestVersion = data['dist-tags']?.['latest'];
|
|
38
|
-
if (!latestVersion)
|
|
39
|
-
continue;
|
|
40
|
-
if (compareVersions(latestVersion, installedVersion) > 0) {
|
|
41
|
-
const updateType = classifyUpdate(installedVersion, latestVersion);
|
|
42
|
-
if (updateType !== 'none') {
|
|
43
|
-
updates.push({
|
|
44
|
-
name: `@botinabox/${pkg}`,
|
|
45
|
-
installedVersion,
|
|
46
|
-
latestVersion,
|
|
47
|
-
updateType,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
catch {
|
|
53
|
-
// Gracefully skip on error
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return {
|
|
58
|
-
checkedAt: new Date().toISOString(),
|
|
59
|
-
packages: updates,
|
|
60
|
-
hasUpdates: updates.length > 0,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { DataStore } from '../data/data-store.js';
|
|
2
|
-
import type { HookBus } from '../hooks/hook-bus.js';
|
|
3
|
-
import type { PackageUpdate, UpdateManifest } from './types.js';
|
|
4
|
-
import { UpdateChecker } from './update-checker.js';
|
|
5
|
-
type UpdatePolicy = 'auto-all' | 'auto-compatible' | 'auto-patch' | 'notify' | 'manual';
|
|
6
|
-
export declare class UpdateManager {
|
|
7
|
-
private checker;
|
|
8
|
-
private db;
|
|
9
|
-
private hooks;
|
|
10
|
-
private opts?;
|
|
11
|
-
private backupManager;
|
|
12
|
-
constructor(checker: UpdateChecker, db: DataStore, hooks: HookBus, opts?: {
|
|
13
|
-
projectRoot?: string;
|
|
14
|
-
policy?: UpdatePolicy;
|
|
15
|
-
maintenanceWindow?: {
|
|
16
|
-
utcHourStart: number;
|
|
17
|
-
utcHourEnd: number;
|
|
18
|
-
};
|
|
19
|
-
} | undefined);
|
|
20
|
-
checkAndNotify(): Promise<UpdateManifest>;
|
|
21
|
-
applyUpdates(updates: PackageUpdate[]): Promise<void>;
|
|
22
|
-
isInMaintenanceWindow(): boolean;
|
|
23
|
-
filterByPolicy(updates: PackageUpdate[]): PackageUpdate[];
|
|
24
|
-
}
|
|
25
|
-
export {};
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { execSync } from 'child_process';
|
|
2
|
-
import { BackupManager } from './backup-manager.js';
|
|
3
|
-
export class UpdateManager {
|
|
4
|
-
checker;
|
|
5
|
-
db;
|
|
6
|
-
hooks;
|
|
7
|
-
opts;
|
|
8
|
-
backupManager;
|
|
9
|
-
constructor(checker, db, hooks, opts) {
|
|
10
|
-
this.checker = checker;
|
|
11
|
-
this.db = db;
|
|
12
|
-
this.hooks = hooks;
|
|
13
|
-
this.opts = opts;
|
|
14
|
-
this.backupManager = new BackupManager(opts?.projectRoot ?? process.cwd());
|
|
15
|
-
}
|
|
16
|
-
async checkAndNotify() {
|
|
17
|
-
const manifest = await this.checker.check();
|
|
18
|
-
if (manifest.hasUpdates) {
|
|
19
|
-
await this.hooks.emit('update.available', { manifest });
|
|
20
|
-
}
|
|
21
|
-
return manifest;
|
|
22
|
-
}
|
|
23
|
-
async applyUpdates(updates) {
|
|
24
|
-
const filtered = this.filterByPolicy(updates);
|
|
25
|
-
if (filtered.length === 0)
|
|
26
|
-
return;
|
|
27
|
-
if (!this.isInMaintenanceWindow()) {
|
|
28
|
-
await this.hooks.emit('update.deferred', { reason: 'outside maintenance window' });
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
let backupPath;
|
|
32
|
-
const historyIds = [];
|
|
33
|
-
try {
|
|
34
|
-
backupPath = await this.backupManager.backup();
|
|
35
|
-
for (const update of filtered) {
|
|
36
|
-
const row = await this.db.insert('update_history', {
|
|
37
|
-
from_version: update.installedVersion,
|
|
38
|
-
to_version: update.latestVersion,
|
|
39
|
-
status: 'pending',
|
|
40
|
-
});
|
|
41
|
-
historyIds.push(row['id']);
|
|
42
|
-
}
|
|
43
|
-
execSync('pnpm install', {
|
|
44
|
-
cwd: this.opts?.projectRoot ?? process.cwd(),
|
|
45
|
-
stdio: 'ignore',
|
|
46
|
-
});
|
|
47
|
-
for (const id of historyIds) {
|
|
48
|
-
await this.db.update('update_history', { id }, { status: 'succeeded' });
|
|
49
|
-
}
|
|
50
|
-
await this.backupManager.cleanup(backupPath);
|
|
51
|
-
await this.hooks.emit('update.completed', { updates: filtered });
|
|
52
|
-
}
|
|
53
|
-
catch (err) {
|
|
54
|
-
for (const id of historyIds) {
|
|
55
|
-
await this.db.update('update_history', { id }, {
|
|
56
|
-
status: 'failed',
|
|
57
|
-
migration_log: String(err),
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
if (backupPath) {
|
|
61
|
-
try {
|
|
62
|
-
await this.backupManager.restore(backupPath);
|
|
63
|
-
await this.backupManager.cleanup(backupPath);
|
|
64
|
-
}
|
|
65
|
-
catch {
|
|
66
|
-
// best effort restore
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
await this.hooks.emit('update.failed', { updates: filtered, error: String(err) });
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
isInMaintenanceWindow() {
|
|
73
|
-
const window = this.opts?.maintenanceWindow;
|
|
74
|
-
if (!window)
|
|
75
|
-
return true; // No window configured = always allowed
|
|
76
|
-
const nowHour = new Date().getUTCHours();
|
|
77
|
-
const { utcHourStart, utcHourEnd } = window;
|
|
78
|
-
if (utcHourStart <= utcHourEnd) {
|
|
79
|
-
return nowHour >= utcHourStart && nowHour < utcHourEnd;
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
// Wraps midnight
|
|
83
|
-
return nowHour >= utcHourStart || nowHour < utcHourEnd;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
filterByPolicy(updates) {
|
|
87
|
-
const policy = this.opts?.policy ?? 'notify';
|
|
88
|
-
switch (policy) {
|
|
89
|
-
case 'auto-all':
|
|
90
|
-
return updates;
|
|
91
|
-
case 'auto-compatible':
|
|
92
|
-
return updates.filter((u) => u.updateType !== 'major');
|
|
93
|
-
case 'auto-patch':
|
|
94
|
-
return updates.filter((u) => u.updateType === 'patch');
|
|
95
|
-
case 'notify':
|
|
96
|
-
case 'manual':
|
|
97
|
-
default:
|
|
98
|
-
return [];
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Simple semver utilities — no external deps.
|
|
3
|
-
*/
|
|
4
|
-
export declare function parseVersion(v: string): [number, number, number];
|
|
5
|
-
export declare function compareVersions(a: string, b: string): -1 | 0 | 1;
|
|
6
|
-
export declare function classifyUpdate(from: string, to: string): 'patch' | 'minor' | 'major' | 'none';
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Simple semver utilities — no external deps.
|
|
3
|
-
*/
|
|
4
|
-
export function parseVersion(v) {
|
|
5
|
-
// Strip leading 'v' and any pre-release suffix
|
|
6
|
-
const cleaned = v.replace(/^v/, '').split('-')[0] ?? v;
|
|
7
|
-
const parts = cleaned.split('.');
|
|
8
|
-
const major = parseInt(parts[0] ?? '0', 10) || 0;
|
|
9
|
-
const minor = parseInt(parts[1] ?? '0', 10) || 0;
|
|
10
|
-
const patch = parseInt(parts[2] ?? '0', 10) || 0;
|
|
11
|
-
return [major, minor, patch];
|
|
12
|
-
}
|
|
13
|
-
export function compareVersions(a, b) {
|
|
14
|
-
const [aMaj, aMin, aPat] = parseVersion(a);
|
|
15
|
-
const [bMaj, bMin, bPat] = parseVersion(b);
|
|
16
|
-
if (aMaj !== bMaj)
|
|
17
|
-
return aMaj < bMaj ? -1 : 1;
|
|
18
|
-
if (aMin !== bMin)
|
|
19
|
-
return aMin < bMin ? -1 : 1;
|
|
20
|
-
if (aPat !== bPat)
|
|
21
|
-
return aPat < bPat ? -1 : 1;
|
|
22
|
-
return 0;
|
|
23
|
-
}
|
|
24
|
-
export function classifyUpdate(from, to) {
|
|
25
|
-
const [fMaj, fMin] = parseVersion(from);
|
|
26
|
-
const [tMaj, tMin] = parseVersion(to);
|
|
27
|
-
if (compareVersions(from, to) === 0)
|
|
28
|
-
return 'none';
|
|
29
|
-
if (tMaj !== fMaj)
|
|
30
|
-
return 'major';
|
|
31
|
-
if (tMin !== fMin)
|
|
32
|
-
return 'minor';
|
|
33
|
-
return 'patch';
|
|
34
|
-
}
|
package/dist/inbound-AFBUPSPG.js
DELETED
package/dist/inbound-AFOHYNUY.js
DELETED
package/dist/inbound-CGIXRXGC.js
DELETED
package/dist/inbound-MCOLRH6U.js
DELETED
package/dist/inbound-SNEMBLGA.js
DELETED
package/dist/inbound-ZJHAYVMF.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/** LLM provider types — Story 1.5 / 2.1 */
|
|
2
|
-
interface ToolDefinition {
|
|
3
|
-
name: string;
|
|
4
|
-
description: string;
|
|
5
|
-
parameters: Record<string, unknown>;
|
|
6
|
-
}
|
|
7
|
-
interface ChatMessage {
|
|
8
|
-
role: "user" | "assistant" | "system";
|
|
9
|
-
content: string | ContentBlock[];
|
|
10
|
-
}
|
|
11
|
-
type ContentBlock = {
|
|
12
|
-
type: "text";
|
|
13
|
-
text: string;
|
|
14
|
-
} | {
|
|
15
|
-
type: "tool_use";
|
|
16
|
-
id: string;
|
|
17
|
-
name: string;
|
|
18
|
-
input: unknown;
|
|
19
|
-
} | {
|
|
20
|
-
type: "tool_result";
|
|
21
|
-
tool_use_id: string;
|
|
22
|
-
content: string;
|
|
23
|
-
};
|
|
24
|
-
interface ChatParams {
|
|
25
|
-
messages: ChatMessage[];
|
|
26
|
-
system?: string;
|
|
27
|
-
tools?: ToolDefinition[];
|
|
28
|
-
maxTokens?: number;
|
|
29
|
-
temperature?: number;
|
|
30
|
-
model: string;
|
|
31
|
-
abortSignal?: AbortSignal;
|
|
32
|
-
}
|
|
33
|
-
interface TokenUsage {
|
|
34
|
-
inputTokens: number;
|
|
35
|
-
outputTokens: number;
|
|
36
|
-
cacheReadTokens?: number;
|
|
37
|
-
cacheWriteTokens?: number;
|
|
38
|
-
}
|
|
39
|
-
interface ChatResult {
|
|
40
|
-
content: string;
|
|
41
|
-
toolUses?: ToolUse[];
|
|
42
|
-
usage: TokenUsage;
|
|
43
|
-
model: string;
|
|
44
|
-
stopReason: "end_turn" | "tool_use" | "max_tokens" | "stop_sequence";
|
|
45
|
-
}
|
|
46
|
-
interface ToolUse {
|
|
47
|
-
id: string;
|
|
48
|
-
name: string;
|
|
49
|
-
input: unknown;
|
|
50
|
-
}
|
|
51
|
-
interface ModelInfo {
|
|
52
|
-
id: string;
|
|
53
|
-
displayName: string;
|
|
54
|
-
contextWindow: number;
|
|
55
|
-
maxOutputTokens: number;
|
|
56
|
-
capabilities: Array<"chat" | "tools" | "vision" | "streaming">;
|
|
57
|
-
/** Cost in micro-cents per 1M tokens */
|
|
58
|
-
inputCostPerMToken?: number;
|
|
59
|
-
outputCostPerMToken?: number;
|
|
60
|
-
}
|
|
61
|
-
interface ResolvedModel {
|
|
62
|
-
provider: string;
|
|
63
|
-
model: string;
|
|
64
|
-
}
|
|
65
|
-
interface LLMProvider {
|
|
66
|
-
id: string;
|
|
67
|
-
displayName: string;
|
|
68
|
-
models: ModelInfo[];
|
|
69
|
-
chat(params: ChatParams): Promise<ChatResult>;
|
|
70
|
-
chatStream(params: ChatParams): AsyncGenerator<string, ChatResult, unknown>;
|
|
71
|
-
/** Convert ToolDefinition[] to provider-native format */
|
|
72
|
-
serializeTools(tools: ToolDefinition[]): unknown;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export type { ChatMessage as C, LLMProvider as L, ModelInfo as M, ResolvedModel as R, TokenUsage as T, ChatParams as a, ChatResult as b, ContentBlock as c, ToolDefinition as d, ToolUse as e };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export const MODELS = [
|
|
2
|
-
{
|
|
3
|
-
id: 'claude-opus-4-6',
|
|
4
|
-
displayName: 'Claude Opus 4.6',
|
|
5
|
-
contextWindow: 200000,
|
|
6
|
-
maxOutputTokens: 32000,
|
|
7
|
-
inputCostPerMToken: 15,
|
|
8
|
-
outputCostPerMToken: 75,
|
|
9
|
-
capabilities: ['chat', 'tools', 'vision', 'streaming'],
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
id: 'claude-sonnet-4-6',
|
|
13
|
-
displayName: 'Claude Sonnet 4.6',
|
|
14
|
-
contextWindow: 200000,
|
|
15
|
-
maxOutputTokens: 16000,
|
|
16
|
-
inputCostPerMToken: 3,
|
|
17
|
-
outputCostPerMToken: 15,
|
|
18
|
-
capabilities: ['chat', 'tools', 'vision', 'streaming'],
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
id: 'claude-haiku-4-5',
|
|
22
|
-
displayName: 'Claude Haiku 4.5',
|
|
23
|
-
contextWindow: 200000,
|
|
24
|
-
maxOutputTokens: 8192,
|
|
25
|
-
inputCostPerMToken: 0.8,
|
|
26
|
-
outputCostPerMToken: 4,
|
|
27
|
-
capabilities: ['chat', 'tools', 'vision', 'streaming'],
|
|
28
|
-
},
|
|
29
|
-
];
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { LLMProvider, ChatParams, ChatResult, ModelInfo, ToolDefinition } from "../../shared/index.js";
|
|
2
|
-
export declare class AnthropicProvider implements LLMProvider {
|
|
3
|
-
readonly id = "anthropic";
|
|
4
|
-
readonly displayName = "Anthropic";
|
|
5
|
-
readonly models: ModelInfo[];
|
|
6
|
-
private client;
|
|
7
|
-
constructor({ apiKey }: {
|
|
8
|
-
apiKey: string;
|
|
9
|
-
});
|
|
10
|
-
serializeTools(tools: ToolDefinition[]): unknown;
|
|
11
|
-
chat(params: ChatParams): Promise<ChatResult>;
|
|
12
|
-
chatStream(params: ChatParams): AsyncGenerator<string, ChatResult, unknown>;
|
|
13
|
-
}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import Anthropic from '@anthropic-ai/sdk';
|
|
2
|
-
import { MODELS } from './models.js';
|
|
3
|
-
import { convertTools } from './tool-converter.js';
|
|
4
|
-
export class AnthropicProvider {
|
|
5
|
-
id = 'anthropic';
|
|
6
|
-
displayName = 'Anthropic';
|
|
7
|
-
models = MODELS;
|
|
8
|
-
client;
|
|
9
|
-
constructor({ apiKey }) {
|
|
10
|
-
this.client = new Anthropic({ apiKey });
|
|
11
|
-
}
|
|
12
|
-
serializeTools(tools) {
|
|
13
|
-
return convertTools(tools);
|
|
14
|
-
}
|
|
15
|
-
async chat(params) {
|
|
16
|
-
const { messages, system, tools, maxTokens, temperature, model, abortSignal } = params;
|
|
17
|
-
const anthropicMessages = messages
|
|
18
|
-
.filter((m) => m.role !== 'system')
|
|
19
|
-
.map((m) => ({
|
|
20
|
-
role: m.role,
|
|
21
|
-
content: typeof m.content === 'string' ? m.content : m.content,
|
|
22
|
-
}));
|
|
23
|
-
const response = await this.client.messages.create({
|
|
24
|
-
model,
|
|
25
|
-
max_tokens: maxTokens ?? 4096,
|
|
26
|
-
messages: anthropicMessages,
|
|
27
|
-
...(system ? { system } : {}),
|
|
28
|
-
...(tools && tools.length > 0 ? { tools: convertTools(tools) } : {}),
|
|
29
|
-
...(temperature !== undefined ? { temperature } : {}),
|
|
30
|
-
}, { signal: abortSignal });
|
|
31
|
-
let content = '';
|
|
32
|
-
const toolUses = [];
|
|
33
|
-
for (const block of response.content) {
|
|
34
|
-
if (block.type === 'text') {
|
|
35
|
-
content += block.text;
|
|
36
|
-
}
|
|
37
|
-
else if (block.type === 'tool_use') {
|
|
38
|
-
toolUses.push({
|
|
39
|
-
id: block.id,
|
|
40
|
-
name: block.name,
|
|
41
|
-
input: block.input,
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
const stopReason = mapStopReason(response.stop_reason);
|
|
46
|
-
return {
|
|
47
|
-
content,
|
|
48
|
-
toolUses: toolUses.length > 0 ? toolUses : undefined,
|
|
49
|
-
usage: {
|
|
50
|
-
inputTokens: response.usage.input_tokens,
|
|
51
|
-
outputTokens: response.usage.output_tokens,
|
|
52
|
-
},
|
|
53
|
-
model: response.model,
|
|
54
|
-
stopReason,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
async *chatStream(params) {
|
|
58
|
-
const { messages, system, tools, maxTokens, temperature, model, abortSignal } = params;
|
|
59
|
-
const anthropicMessages = messages
|
|
60
|
-
.filter((m) => m.role !== 'system')
|
|
61
|
-
.map((m) => ({
|
|
62
|
-
role: m.role,
|
|
63
|
-
content: typeof m.content === 'string' ? m.content : m.content,
|
|
64
|
-
}));
|
|
65
|
-
const stream = this.client.messages.stream({
|
|
66
|
-
model,
|
|
67
|
-
max_tokens: maxTokens ?? 4096,
|
|
68
|
-
messages: anthropicMessages,
|
|
69
|
-
...(system ? { system } : {}),
|
|
70
|
-
...(tools && tools.length > 0 ? { tools: convertTools(tools) } : {}),
|
|
71
|
-
...(temperature !== undefined ? { temperature } : {}),
|
|
72
|
-
}, { signal: abortSignal });
|
|
73
|
-
for await (const event of stream) {
|
|
74
|
-
if (event.type === 'content_block_delta' &&
|
|
75
|
-
event.delta.type === 'text_delta') {
|
|
76
|
-
yield event.delta.text;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
const finalMessage = await stream.finalMessage();
|
|
80
|
-
let content = '';
|
|
81
|
-
const toolUses = [];
|
|
82
|
-
for (const block of finalMessage.content) {
|
|
83
|
-
if (block.type === 'text') {
|
|
84
|
-
content += block.text;
|
|
85
|
-
}
|
|
86
|
-
else if (block.type === 'tool_use') {
|
|
87
|
-
toolUses.push({
|
|
88
|
-
id: block.id,
|
|
89
|
-
name: block.name,
|
|
90
|
-
input: block.input,
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return {
|
|
95
|
-
content,
|
|
96
|
-
toolUses: toolUses.length > 0 ? toolUses : undefined,
|
|
97
|
-
usage: {
|
|
98
|
-
inputTokens: finalMessage.usage.input_tokens,
|
|
99
|
-
outputTokens: finalMessage.usage.output_tokens,
|
|
100
|
-
},
|
|
101
|
-
model: finalMessage.model,
|
|
102
|
-
stopReason: mapStopReason(finalMessage.stop_reason),
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
function mapStopReason(reason) {
|
|
107
|
-
switch (reason) {
|
|
108
|
-
case 'end_turn':
|
|
109
|
-
return 'end_turn';
|
|
110
|
-
case 'tool_use':
|
|
111
|
-
return 'tool_use';
|
|
112
|
-
case 'max_tokens':
|
|
113
|
-
return 'max_tokens';
|
|
114
|
-
case 'stop_sequence':
|
|
115
|
-
return 'stop_sequence';
|
|
116
|
-
default:
|
|
117
|
-
return 'end_turn';
|
|
118
|
-
}
|
|
119
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ToolDefinition } from "../../shared/index.js";
|
|
2
|
-
export interface AnthropicTool {
|
|
3
|
-
name: string;
|
|
4
|
-
description: string;
|
|
5
|
-
input_schema: {
|
|
6
|
-
type: 'object';
|
|
7
|
-
[key: string]: unknown;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
export declare function convertTools(tools: ToolDefinition[]): AnthropicTool[];
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { LLMProvider, ChatParams, ChatResult, ModelInfo, ToolDefinition } from "../../shared/index.js";
|
|
2
|
-
export declare class OllamaProvider implements LLMProvider {
|
|
3
|
-
readonly id = "ollama";
|
|
4
|
-
readonly displayName = "Ollama";
|
|
5
|
-
private baseUrl;
|
|
6
|
-
private cachedModels;
|
|
7
|
-
private cacheTimestamp;
|
|
8
|
-
private readonly cacheTtlMs;
|
|
9
|
-
constructor({ baseUrl }?: {
|
|
10
|
-
baseUrl?: string;
|
|
11
|
-
});
|
|
12
|
-
get models(): ModelInfo[];
|
|
13
|
-
serializeTools(_tools: ToolDefinition[]): unknown;
|
|
14
|
-
getModels(): Promise<ModelInfo[]>;
|
|
15
|
-
chat(params: ChatParams): Promise<ChatResult>;
|
|
16
|
-
chatStream(params: ChatParams): AsyncGenerator<string, ChatResult, unknown>;
|
|
17
|
-
}
|