@snapback/cli 1.1.15 → 3.0.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/README.md +50 -12
- package/dist/{auth-HFJRXXG2.js → auth-TDIHGKKL.js} +8 -8
- package/dist/{auto-provision-organization-SF6XM7X4.js → auto-provision-organization-CXHL46P3.js} +4 -4
- package/dist/{chunk-23G5VYA3.js → chunk-CPZWXRP2.js} +196 -23
- package/dist/{chunk-OI2HNNT6.js → chunk-E6V6QKS7.js} +34 -2
- package/dist/{chunk-XYU5FFE3.js → chunk-FMWCFAY7.js} +1 -1
- package/dist/{chunk-HR34NJP7.js → chunk-LIBBDBW5.js} +4 -1
- package/dist/{chunk-DNEADD2G.js → chunk-O7HMAZ7L.js} +10 -12
- package/dist/{chunk-ICKSHS3A.js → chunk-Q4VC7GND.js} +39 -3
- package/dist/{client-WIO6W447.js → client-62E3L6DW.js} +1 -1
- package/dist/{dist-TEWNOZYS.js → dist-5LR7APG5.js} +1 -1
- package/dist/{dist-E7E2T3DQ.js → dist-NFU5UJEW.js} +1 -1
- package/dist/dist-OO5LJHL6.js +12 -0
- package/dist/index.js +492 -321
- package/dist/{local-service-adapter-3JHN6G4O.js → local-service-adapter-AB3UYRUK.js} +1 -1
- package/package.json +3 -3
- package/dist/dist-YZBJAYEJ.js +0 -12
|
@@ -769,12 +769,12 @@ WorkspaceBase.extend({
|
|
|
769
769
|
keywords: z.array(z.string()).optional()
|
|
770
770
|
});
|
|
771
771
|
WorkspaceBase.extend({
|
|
772
|
-
/**
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
772
|
+
/**
|
|
773
|
+
* Free-text outcome description — what was accomplished, what remains, decisions made.
|
|
774
|
+
* Becomes the opening context for the next session briefing.
|
|
775
|
+
* Do NOT constrain to an enum: the MCP tool description promises free-text paragraphs.
|
|
776
|
+
*/
|
|
777
|
+
outcome: z.string().min(1).max(2e3).optional(),
|
|
778
778
|
/** Additional notes */
|
|
779
779
|
notes: z.string().optional(),
|
|
780
780
|
/** Create a snapshot on end */
|
|
@@ -1760,12 +1760,10 @@ WorkspaceBase.extend({
|
|
|
1760
1760
|
completionPercent: z.number().min(0).max(100).optional()
|
|
1761
1761
|
});
|
|
1762
1762
|
WorkspaceBase.extend({
|
|
1763
|
-
/**
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
"blocked"
|
|
1768
|
-
]),
|
|
1763
|
+
/**
|
|
1764
|
+
* Free-text outcome. Do NOT constrain to enum — snap_end promises free-text paragraphs.
|
|
1765
|
+
*/
|
|
1766
|
+
outcome: z.string().min(1).max(2e3),
|
|
1769
1767
|
/** Outcome notes */
|
|
1770
1768
|
notes: z.string().optional(),
|
|
1771
1769
|
/** Learnings captured during task */
|
|
@@ -8,7 +8,7 @@ import { dirname, join } from 'path';
|
|
|
8
8
|
import { fileURLToPath } from 'url';
|
|
9
9
|
import { PostHog } from 'posthog-node';
|
|
10
10
|
import client from 'prom-client';
|
|
11
|
-
import { trace, context, SpanStatusCode, propagation, ROOT_CONTEXT } from '@opentelemetry/api';
|
|
11
|
+
import { trace, metrics, context, SpanStatusCode, propagation, ROOT_CONTEXT } from '@opentelemetry/api';
|
|
12
12
|
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
13
13
|
import { PgInstrumentation } from '@opentelemetry/instrumentation-pg';
|
|
14
14
|
import { PinoInstrumentation } from '@opentelemetry/instrumentation-pino';
|
|
@@ -901,6 +901,32 @@ async function deleteAlert(alertId) {
|
|
|
901
901
|
}
|
|
902
902
|
}
|
|
903
903
|
__name(deleteAlert, "deleteAlert");
|
|
904
|
+
async function registerKeyMetricAlerts() {
|
|
905
|
+
const posthogKey = process.env.POSTHOG_PERSONAL_API_KEY;
|
|
906
|
+
const environmentId = process.env.POSTHOG_ENVIRONMENT_ID;
|
|
907
|
+
if (!posthogKey) {
|
|
908
|
+
logger.warn("POSTHOG_PERSONAL_API_KEY not set - skipping PostHog alerts registration");
|
|
909
|
+
return;
|
|
910
|
+
}
|
|
911
|
+
if (!environmentId) {
|
|
912
|
+
logger.warn("POSTHOG_ENVIRONMENT_ID not set - skipping PostHog alerts registration");
|
|
913
|
+
return;
|
|
914
|
+
}
|
|
915
|
+
try {
|
|
916
|
+
logger.info({
|
|
917
|
+
count: KEY_METRIC_ALERTS.length
|
|
918
|
+
}, "Registering PostHog key metric alerts");
|
|
919
|
+
for (const alertConfig of KEY_METRIC_ALERTS) {
|
|
920
|
+
await createAlert(alertConfig);
|
|
921
|
+
}
|
|
922
|
+
logger.info("Successfully registered all PostHog key metric alerts");
|
|
923
|
+
} catch (error) {
|
|
924
|
+
logger.error({
|
|
925
|
+
error
|
|
926
|
+
}, "Failed to register PostHog alerts");
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
__name(registerKeyMetricAlerts, "registerKeyMetricAlerts");
|
|
904
930
|
var KEY_METRIC_ALERTS = [
|
|
905
931
|
{
|
|
906
932
|
name: "TTFV p75 Alert",
|
|
@@ -1950,6 +1976,7 @@ var OTelInstrumentationProvider = class {
|
|
|
1950
1976
|
}
|
|
1951
1977
|
tracer;
|
|
1952
1978
|
provider;
|
|
1979
|
+
meter;
|
|
1953
1980
|
constructor(config) {
|
|
1954
1981
|
const resource = resourceFromAttributes({
|
|
1955
1982
|
[ATTR_SERVICE_NAME]: config.serviceName,
|
|
@@ -1995,6 +2022,7 @@ var OTelInstrumentationProvider = class {
|
|
|
1995
2022
|
} catch {
|
|
1996
2023
|
}
|
|
1997
2024
|
this.tracer = trace.getTracer(config.serviceName, config.serviceVersion);
|
|
2025
|
+
this.meter = metrics.getMeter(config.serviceName, config.serviceVersion || "unknown");
|
|
1998
2026
|
}
|
|
1999
2027
|
startSpan(name, options) {
|
|
2000
2028
|
const otelSpan = this.tracer.startSpan(name, {
|
|
@@ -2065,10 +2093,11 @@ var TelemetryClient = class {
|
|
|
2065
2093
|
lastRateLimitReset = Date.now();
|
|
2066
2094
|
proxyUrl;
|
|
2067
2095
|
offlineMode = false;
|
|
2096
|
+
anonymousId;
|
|
2068
2097
|
constructor(_apiKey, proxyHost, environment) {
|
|
2069
2098
|
this.environment = environment;
|
|
2070
2099
|
this.proxyUrl = `${proxyHost}/api/telemetry/events`;
|
|
2071
|
-
this.generateAnonymousId();
|
|
2100
|
+
this.anonymousId = this.generateAnonymousId();
|
|
2072
2101
|
setInterval(() => this.flush(), this.flushInterval);
|
|
2073
2102
|
}
|
|
2074
2103
|
async initialize() {
|
|
@@ -2192,6 +2221,13 @@ var TelemetryClient = class {
|
|
|
2192
2221
|
}
|
|
2193
2222
|
return sanitized;
|
|
2194
2223
|
}
|
|
2224
|
+
/**
|
|
2225
|
+
* Get the anonymous ID for this client instance
|
|
2226
|
+
* @returns The stored anonymous ID
|
|
2227
|
+
*/
|
|
2228
|
+
getAnonymousId() {
|
|
2229
|
+
return this.anonymousId;
|
|
2230
|
+
}
|
|
2195
2231
|
generateAnonymousId() {
|
|
2196
2232
|
return `${this.environment}_${Math.random().toString(36).substr(2, 9)}`;
|
|
2197
2233
|
}
|
|
@@ -2261,4 +2297,4 @@ var TelemetryClient = class {
|
|
|
2261
2297
|
}
|
|
2262
2298
|
};
|
|
2263
2299
|
|
|
2264
|
-
export { AnalyticsEvents, CORRELATION_ANALYSES, CORRELATION_COHORTS, KEY_METRIC_ALERTS, OTelInstrumentationProvider, RETENTION_COHORTS, TelemetryClient, addSentryBreadcrumb, captureError, captureMessage, checkDatabaseConnection, checkErrorBudget, checkHttpService, checkRedisConnection, clearSentryUser, createAlert, createCohort, createGracefulShutdown, createHealthCheck, createSentryMiddleware, deleteAlert, deleteCohort, detectSurface, drainAndCloseServer, flushSentry, getAlerts, getAnalyticsEnv, getAnalyticsSuperProperties, getCohort, getCohortMembers, getCohorts, getCorrelationAnalysis, getDeploymentEnv, getEnvironmentInfo, getErrorRate, getMetrics2 as getMetrics, initSentry, isDevelopment, isProduction, neon_exports, performCorrelationAnalysis, preStopDelay, prometheus_exports, recordError, recordSuccess, resetMetrics, setSentryUser, startSentryTransaction, toggleAlert, updateCohort };
|
|
2300
|
+
export { AnalyticsEvents, CORRELATION_ANALYSES, CORRELATION_COHORTS, KEY_METRIC_ALERTS, OTelInstrumentationProvider, RETENTION_COHORTS, TelemetryClient, addSentryBreadcrumb, captureError, captureMessage, checkDatabaseConnection, checkErrorBudget, checkHttpService, checkRedisConnection, clearSentryUser, createAlert, createCohort, createGracefulShutdown, createHealthCheck, createSentryMiddleware, deleteAlert, deleteCohort, detectSurface, drainAndCloseServer, flushSentry, getAlerts, getAnalyticsEnv, getAnalyticsSuperProperties, getCohort, getCohortMembers, getCohorts, getCorrelationAnalysis, getDeploymentEnv, getEnvironmentInfo, getErrorRate, getMetrics2 as getMetrics, initSentry, isDevelopment, isProduction, neon_exports, performCorrelationAnalysis, preStopDelay, prometheus_exports, recordError, recordSuccess, registerKeyMetricAlerts, resetMetrics, setSentryUser, startSentryTransaction, toggleAlert, updateCohort };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node --no-warnings=ExperimentalWarning
|
|
2
|
-
export { checkDatabaseConnection, closeDatabaseConnection, combinedSchema, db, pool } from './chunk-
|
|
2
|
+
export { checkDatabaseConnection, closeDatabaseConnection, combinedSchema, db, pool } from './chunk-LIBBDBW5.js';
|
|
3
3
|
import './chunk-WS36HDEU.js';
|
|
4
4
|
import './chunk-5EOPYJ4Y.js';
|
|
5
5
|
import './chunk-CBGOC6RV.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node --no-warnings=ExperimentalWarning
|
|
2
|
-
export { createManagedMetadata, detectAIClients, detectMCPProcesses, detectWorkspaceConfig, evictCachedPath, getAllCachedPaths, getCachedPath, getClient, getClientConfigPath, getConfiguredClients, getOrCreateIdentity, getServerKey, getSnapbackConfigDir, getSnapbackMCPConfig, injectWorkspacePath, isCommandExecutable2 as isCommandExecutable, isOwnedByThisInstall, isSnapbackMCPRunning, patchApiKeyInClientConfig, readClientConfig, removeSnapbackConfig, repairClientConfig, resetIdentityCache, resolveNodePath, setCachedPath, validateClientConfig, validateConfig, validateWorkspacePath, writeClientConfig } from './chunk-
|
|
2
|
+
export { createManagedMetadata, detectAIClients, detectMCPProcesses, detectWorkspaceConfig, evictCachedPath, getAllCachedPaths, getCachedPath, getClient, getClientConfigPath, getConfiguredClients, getOrCreateIdentity, getServerKey, getSnapbackConfigDir, getSnapbackMCPConfig, injectWorkspacePath, isCommandExecutable2 as isCommandExecutable, isOwnedByThisInstall, isSnapbackMCPRunning, patchApiKeyInClientConfig, readClientConfig, removeSnapbackConfig, repairClientConfig, resetIdentityCache, resolveNodePath, setCachedPath, validateClientConfig, validateConfig, validateWorkspacePath, writeClientConfig } from './chunk-E6V6QKS7.js';
|
|
3
3
|
import './chunk-7ADPL4Q3.js';
|
|
4
4
|
|
|
5
5
|
process.env.SNAPBACK_CLI='true';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node --no-warnings=ExperimentalWarning
|
|
2
|
-
export { AnalyticsEvents, CORRELATION_ANALYSES, CORRELATION_COHORTS, KEY_METRIC_ALERTS, OTelInstrumentationProvider, RETENTION_COHORTS, TelemetryClient, addSentryBreadcrumb, captureError, captureMessage, checkDatabaseConnection, checkErrorBudget, checkHttpService, checkRedisConnection, clearSentryUser, createAlert, createCohort, createGracefulShutdown, createHealthCheck, createSentryMiddleware, deleteAlert, deleteCohort, detectSurface, drainAndCloseServer, flushSentry, getAlerts, getAnalyticsEnv, getAnalyticsSuperProperties, getCohort, getCohortMembers, getCohorts, getCorrelationAnalysis, getDeploymentEnv, getEnvironmentInfo, getErrorRate, getMetrics, initSentry, isDevelopment, isProduction, neon_exports as neon, performCorrelationAnalysis, preStopDelay, prometheus_exports as prometheus, recordError, recordSuccess, resetMetrics, setSentryUser, startSentryTransaction, toggleAlert, updateCohort } from './chunk-
|
|
2
|
+
export { AnalyticsEvents, CORRELATION_ANALYSES, CORRELATION_COHORTS, KEY_METRIC_ALERTS, OTelInstrumentationProvider, RETENTION_COHORTS, TelemetryClient, addSentryBreadcrumb, captureError, captureMessage, checkDatabaseConnection, checkErrorBudget, checkHttpService, checkRedisConnection, clearSentryUser, createAlert, createCohort, createGracefulShutdown, createHealthCheck, createSentryMiddleware, deleteAlert, deleteCohort, detectSurface, drainAndCloseServer, flushSentry, getAlerts, getAnalyticsEnv, getAnalyticsSuperProperties, getCohort, getCohortMembers, getCohorts, getCorrelationAnalysis, getDeploymentEnv, getEnvironmentInfo, getErrorRate, getMetrics, initSentry, isDevelopment, isProduction, neon_exports as neon, performCorrelationAnalysis, preStopDelay, prometheus_exports as prometheus, recordError, recordSuccess, registerKeyMetricAlerts, resetMetrics, setSentryUser, startSentryTransaction, toggleAlert, updateCohort } from './chunk-Q4VC7GND.js';
|
|
3
3
|
export { cache_exports as cache, logger, makeWatcher, resiliency_exports as resiliency } from './chunk-PL4HF4M2.js';
|
|
4
4
|
export { LogLevel, NoOpInstrumentationProvider } from './chunk-WS36HDEU.js';
|
|
5
5
|
import './chunk-5EOPYJ4Y.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node --no-warnings=ExperimentalWarning
|
|
2
|
+
export { AccountSchema, AiChatSchema, AttributionServiceImpl, EntitlementsServiceImpl, InvitationSchema, MCPService, MemberSchema, OrganizationSchema, OrganizationUpdateSchema, PasskeySchema, PioneerServiceImpl, PurchaseInsertSchema, PurchaseSchema, PurchaseUpdateSchema, SagaOrchestratorImpl, SessionSchema, SnapshotStoreDb, TelemetrySinkDb, TelemetrySinkDbAdapter, UserSchema, UserUpdateSchema, VerificationSchema, anonymizeEmail, anonymizeUserData, anonymizeUserId, appendFalsePositivePatterns, calculateDecayedWeight, cleanupExpiredData, clearCapabilityCache, closeTestDb, countAllOrganizations, countAllUsers, createPurchase, createTestUser, createTierUpgradeSagaWithDeps, createUser, createUserAccount, databaseService, deletePurchaseBySubscriptionId, deleteUserApiKeys, deleteUserData, exportUserData, extensionLinkTokens, extensionSessions as extensionSessionsAuth, findSimilarPatterns, generateOrganizationSlug, getAccountById, getCacheMetrics, getCapabilities, getCapabilityAuditHistory, getInvitationById, getMCPService, getOrganizationById, getOrganizationBySlug, getOrganizationMembership, getOrganizationWithPurchasesAndMembersCount, getOrganizations, getOrganizationsWithMembers, getPendingInvitationByEmail, getPurchaseById, getPurchaseBySubscriptionId, getPurchasesByOrganizationId, getPurchasesByUserId, getTestDb, getUserByEmail, getUserById, getUserPrivacyPreferences, getUsers, getVectorStats, getWorkspaceLinkById, getWorkspaceLinksByUserId, handleTierDowngrade, handleTierUpgrade, healthCheck, incrementDetectionsAnalyzed, insertPatternWithEmbedding, invalidateCapabilityCache, isPgvectorEnabled, linkWorkspace, logAnonymizedEvent, logCapabilityAudit, mergeSignalIntoPattern, recordFalsePositiveSignal, resetCacheMetrics, resetCapabilities, resolveTierByWorkspaceId, sagaPersistence, sanitizeForLogging, searchSimilarPatterns, shouldRetainData, signalToPattern, testInTransaction, truncateAllTables, unlinkAllWorkspacesForUser, unlinkWorkspace, updateCapabilities, updateOrganization, updatePatternEmbedding, updatePurchase, updateUser, updateWorkspaceTier } from './chunk-CPZWXRP2.js';
|
|
3
|
+
export { closeRedis, getRedisClient, initializeRedis, isRedisAvailable } from './chunk-GQ73B37K.js';
|
|
4
|
+
export { TOPUP_PACKS, account, activationCodeRedemptions, activationCodes, adminAuditLog, agentSuggestions, analysisEvents, apiKeyMetadata, apiKeyUsage, apiKeys, apiUsage, apiUsageLogs, checkDatabaseConnection, clientTokens, combinedSchema, creditJobTypeEnum, creditTopups, creditTransactionStatusEnum, creditTransactionTypeEnum, creditsLedger, db, deviceTrials, emailDeliveries, emailPreferences, extensionSessions, featureUsage, feedback, fileSnapshotSessions, fingerprints, getTopupPackDetails, isValidPackSize, loops, mcpActivityEvents, mcpAggregatedLearnings, mcpSessions, member, newsletterSubscribers, orgDailyMetrics, organization, pioneerActions, pioneerCodes, pioneerRedemptions, pioneerTierHistory, pioneers, policyEvaluations, pool, postAcceptOutcomes, purchase, rateLimitViolations, responseCache, retentionConfig, rollbackEvents, ruleViolations, postgres_exports as schema, securityEvents, snapbackSchema, snapshotFiles, snapshots, subscriptions, superAdmins, telemetryDailyStats, telemetryEvents, telemetryIdempotencyKeys, telemetryOutbox, topupStatusEnum, usageLimits, user, userProductMetrics, userSafetyProfiles, waitlist, waitlistAuditLogs, waitlistReferrals, waitlistTasks } from './chunk-LIBBDBW5.js';
|
|
5
|
+
import './chunk-Q4VC7GND.js';
|
|
6
|
+
import './chunk-PL4HF4M2.js';
|
|
7
|
+
import './chunk-WS36HDEU.js';
|
|
8
|
+
import './chunk-5EOPYJ4Y.js';
|
|
9
|
+
import './chunk-CBGOC6RV.js';
|
|
10
|
+
import './chunk-7ADPL4Q3.js';
|
|
11
|
+
|
|
12
|
+
process.env.SNAPBACK_CLI='true';
|