playcademy 0.14.33 → 0.15.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/dist/cli.js +4 -2
- package/dist/constants/src/domains.ts +7 -0
- package/dist/constants/src/timeback.ts +10 -0
- package/dist/index.d.ts +179 -124
- package/dist/index.js +315 -270
- package/dist/utils.js +4 -2
- package/dist/version.js +4 -2
- package/package.json +5 -3
package/dist/cli.js
CHANGED
|
@@ -2958,7 +2958,7 @@ import { join as join13 } from "path";
|
|
|
2958
2958
|
// package.json with { type: 'json' }
|
|
2959
2959
|
var package_default2 = {
|
|
2960
2960
|
name: "playcademy",
|
|
2961
|
-
version: "0.14.
|
|
2961
|
+
version: "0.14.34",
|
|
2962
2962
|
type: "module",
|
|
2963
2963
|
exports: {
|
|
2964
2964
|
".": {
|
|
@@ -3021,7 +3021,8 @@ var package_default2 = {
|
|
|
3021
3021
|
"json-colorizer": "^3.0.1",
|
|
3022
3022
|
jszip: "^3.10.1",
|
|
3023
3023
|
miniflare: "^4.20251008.0",
|
|
3024
|
-
open: "^10.2.0"
|
|
3024
|
+
open: "^10.2.0",
|
|
3025
|
+
ws: "^8.18.3"
|
|
3025
3026
|
},
|
|
3026
3027
|
devDependencies: {
|
|
3027
3028
|
"@cloudflare/workers-types": "^4.20251011.0",
|
|
@@ -3031,6 +3032,7 @@ var package_default2 = {
|
|
|
3031
3032
|
"@playcademy/timeback": "workspace:*",
|
|
3032
3033
|
"@playcademy/utils": "workspace:*",
|
|
3033
3034
|
"@types/bun": "latest",
|
|
3035
|
+
"@types/ws": "^8.18.1",
|
|
3034
3036
|
bumpp: "^10.2.3",
|
|
3035
3037
|
rollup: "^4.50.2",
|
|
3036
3038
|
"rollup-plugin-dts": "^6.2.3"
|
|
@@ -37,6 +37,13 @@ export const GAME_WORKER_DOMAINS = {
|
|
|
37
37
|
staging: 'staging.playcademy.gg',
|
|
38
38
|
} as const
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Log collector worker URL
|
|
42
|
+
* Used by CLI to stream real-time logs from deployed games
|
|
43
|
+
* Works for both production and staging (game slugs include environment suffix)
|
|
44
|
+
*/
|
|
45
|
+
export const LOG_COLLECTOR_URL = 'https://logs.playcademy.gg'
|
|
46
|
+
|
|
40
47
|
/**
|
|
41
48
|
* Type exports
|
|
42
49
|
*/
|
|
@@ -105,3 +105,13 @@ export const TIMEBACK_COMPONENT_RESOURCE_DEFAULTS = {
|
|
|
105
105
|
sortOrder: 1,
|
|
106
106
|
lessonType: 'quiz',
|
|
107
107
|
} as const
|
|
108
|
+
|
|
109
|
+
// ============================================================================
|
|
110
|
+
// 2HL (Two-Hour Learning) Model
|
|
111
|
+
// ============================================================================
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Daily XP threshold for the 2HL model.
|
|
115
|
+
* Students must earn this much XP daily to unlock non-enrolled games.
|
|
116
|
+
*/
|
|
117
|
+
export const DAILY_XP_THRESHOLD = 120
|
package/dist/index.d.ts
CHANGED
|
@@ -964,7 +964,6 @@ interface DeployedGameInfo {
|
|
|
964
964
|
schemaSnapshot?: unknown;
|
|
965
965
|
integrationKeys?: string[];
|
|
966
966
|
integrationsHash?: string;
|
|
967
|
-
deployedSecrets?: string[];
|
|
968
967
|
}
|
|
969
968
|
interface GameStore {
|
|
970
969
|
/** Staging environment game deployments, keyed by absolute project path */
|
|
@@ -1004,7 +1003,6 @@ interface DeploymentContext {
|
|
|
1004
1003
|
previousResources?: string[];
|
|
1005
1004
|
previousIntegrationKeys?: string[];
|
|
1006
1005
|
previousIntegrationsHash?: string;
|
|
1007
|
-
currentSecretKeys?: string[];
|
|
1008
1006
|
isDryRun: boolean;
|
|
1009
1007
|
deployBackend: boolean;
|
|
1010
1008
|
forceBackend: boolean;
|
|
@@ -1024,7 +1022,6 @@ interface DeploymentChanges {
|
|
|
1024
1022
|
changes: IntegrationConfigChange[];
|
|
1025
1023
|
}>;
|
|
1026
1024
|
schema?: boolean;
|
|
1027
|
-
secrets?: boolean;
|
|
1028
1025
|
}
|
|
1029
1026
|
/**
|
|
1030
1027
|
* Plan for what needs to be deployed
|
|
@@ -1063,8 +1060,6 @@ interface BackendDeploymentMetadata {
|
|
|
1063
1060
|
integrationKeys: string[];
|
|
1064
1061
|
/** Hash of integrations config (for detecting metadata changes) */
|
|
1065
1062
|
integrationsHash: string | null;
|
|
1066
|
-
/** Secret keys that have been deployed */
|
|
1067
|
-
deployedSecrets?: string[];
|
|
1068
1063
|
/** When this backend was deployed */
|
|
1069
1064
|
deployedAt: string;
|
|
1070
1065
|
}
|
|
@@ -1186,6 +1181,84 @@ interface DevServerOptions {
|
|
|
1186
1181
|
customLogger?: PluginLogger;
|
|
1187
1182
|
}
|
|
1188
1183
|
|
|
1184
|
+
/**
|
|
1185
|
+
* Configuration differences between existing and new game state
|
|
1186
|
+
*/
|
|
1187
|
+
interface ConfigDiff {
|
|
1188
|
+
displayName?: {
|
|
1189
|
+
old: string;
|
|
1190
|
+
new: string;
|
|
1191
|
+
};
|
|
1192
|
+
emoji?: {
|
|
1193
|
+
old: string | undefined;
|
|
1194
|
+
new: string | undefined;
|
|
1195
|
+
};
|
|
1196
|
+
description?: {
|
|
1197
|
+
old: string | undefined;
|
|
1198
|
+
new: string | undefined;
|
|
1199
|
+
};
|
|
1200
|
+
gameType?: {
|
|
1201
|
+
old: string;
|
|
1202
|
+
new: string;
|
|
1203
|
+
};
|
|
1204
|
+
}
|
|
1205
|
+
/**
|
|
1206
|
+
* Build deployment changes
|
|
1207
|
+
*/
|
|
1208
|
+
interface BuildDiff {
|
|
1209
|
+
changed?: boolean;
|
|
1210
|
+
previousSize?: number;
|
|
1211
|
+
currentSize?: number;
|
|
1212
|
+
}
|
|
1213
|
+
/**
|
|
1214
|
+
* Backend deployment changes
|
|
1215
|
+
*/
|
|
1216
|
+
interface BackendDiff {
|
|
1217
|
+
changed?: boolean;
|
|
1218
|
+
/** Routes that were added (e.g., ['/api/bucket']) */
|
|
1219
|
+
addedRoutes?: string[];
|
|
1220
|
+
/** Routes that were removed (e.g., ['/api/kv']) */
|
|
1221
|
+
removedRoutes?: string[];
|
|
1222
|
+
/** Resources that were added (e.g., ['database']) */
|
|
1223
|
+
addedResources?: string[];
|
|
1224
|
+
/** Resources that were removed (e.g., ['keyValue']) */
|
|
1225
|
+
removedResources?: string[];
|
|
1226
|
+
previousServerSize?: number;
|
|
1227
|
+
currentServerSize?: number;
|
|
1228
|
+
previousDbSize?: number;
|
|
1229
|
+
currentDbSize?: number;
|
|
1230
|
+
previousBundleSize?: number;
|
|
1231
|
+
currentBundleSize?: number;
|
|
1232
|
+
forced?: boolean;
|
|
1233
|
+
schemaStatementCount?: number;
|
|
1234
|
+
}
|
|
1235
|
+
/**
|
|
1236
|
+
* Integration changes
|
|
1237
|
+
*/
|
|
1238
|
+
interface IntegrationsDiff {
|
|
1239
|
+
previousKeys?: string[];
|
|
1240
|
+
currentKeys?: string[];
|
|
1241
|
+
metadata?: Array<{
|
|
1242
|
+
name: string;
|
|
1243
|
+
changes: Array<{
|
|
1244
|
+
label: string;
|
|
1245
|
+
current: string;
|
|
1246
|
+
next: string;
|
|
1247
|
+
field: string;
|
|
1248
|
+
}>;
|
|
1249
|
+
}>;
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
1252
|
+
* Options for displaying deployment diff
|
|
1253
|
+
*/
|
|
1254
|
+
interface DeploymentDiffOptions {
|
|
1255
|
+
diff: ConfigDiff;
|
|
1256
|
+
noChanges?: boolean;
|
|
1257
|
+
build?: BuildDiff;
|
|
1258
|
+
backend?: BackendDiff;
|
|
1259
|
+
integrations?: IntegrationsDiff;
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1189
1262
|
/**
|
|
1190
1263
|
* Engine Template System Types
|
|
1191
1264
|
*/
|
|
@@ -1278,6 +1351,41 @@ interface CallbackServerResult {
|
|
|
1278
1351
|
error?: string;
|
|
1279
1352
|
}
|
|
1280
1353
|
|
|
1354
|
+
/**
|
|
1355
|
+
* KV command types
|
|
1356
|
+
*/
|
|
1357
|
+
/**
|
|
1358
|
+
* Statistics about KV storage
|
|
1359
|
+
*/
|
|
1360
|
+
interface KeyStats {
|
|
1361
|
+
/** Total number of keys */
|
|
1362
|
+
totalKeys: number;
|
|
1363
|
+
/** Total size in bytes */
|
|
1364
|
+
totalSize: number;
|
|
1365
|
+
/** Information about the largest key */
|
|
1366
|
+
largestKey?: {
|
|
1367
|
+
name: string;
|
|
1368
|
+
size: number;
|
|
1369
|
+
};
|
|
1370
|
+
/** Keys grouped by prefix pattern */
|
|
1371
|
+
prefixes: Record<string, number>;
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* Metadata about a specific key
|
|
1375
|
+
*/
|
|
1376
|
+
interface KeyMetadata {
|
|
1377
|
+
/** The key name */
|
|
1378
|
+
key: string;
|
|
1379
|
+
/** Whether the key exists */
|
|
1380
|
+
exists: boolean;
|
|
1381
|
+
/** Size in bytes (if key exists) */
|
|
1382
|
+
size?: number;
|
|
1383
|
+
/** Parsed value */
|
|
1384
|
+
value?: unknown;
|
|
1385
|
+
/** Type of value stored */
|
|
1386
|
+
valueType?: 'json' | 'string';
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1281
1389
|
/**
|
|
1282
1390
|
* @fileoverview Config Loader Types
|
|
1283
1391
|
*
|
|
@@ -1293,6 +1401,46 @@ interface LoadConfigResult {
|
|
|
1293
1401
|
configDir: string;
|
|
1294
1402
|
}
|
|
1295
1403
|
|
|
1404
|
+
/**
|
|
1405
|
+
* Log Streaming Types
|
|
1406
|
+
*/
|
|
1407
|
+
interface LogEntry {
|
|
1408
|
+
timestamp: number;
|
|
1409
|
+
scriptName: string;
|
|
1410
|
+
outcome: string;
|
|
1411
|
+
logs: Array<{
|
|
1412
|
+
level: string;
|
|
1413
|
+
message: unknown[];
|
|
1414
|
+
}>;
|
|
1415
|
+
exceptions: Array<{
|
|
1416
|
+
name: string;
|
|
1417
|
+
message: string;
|
|
1418
|
+
}>;
|
|
1419
|
+
request?: {
|
|
1420
|
+
url: string;
|
|
1421
|
+
method: string;
|
|
1422
|
+
};
|
|
1423
|
+
response?: {
|
|
1424
|
+
status: number;
|
|
1425
|
+
};
|
|
1426
|
+
}
|
|
1427
|
+
interface LogStreamUrlOptions {
|
|
1428
|
+
/** Worker ID to stream logs from */
|
|
1429
|
+
workerId: string;
|
|
1430
|
+
/** Authentication token */
|
|
1431
|
+
token: string;
|
|
1432
|
+
/** Include recent log history */
|
|
1433
|
+
history?: boolean;
|
|
1434
|
+
}
|
|
1435
|
+
interface LogStreamConfig {
|
|
1436
|
+
/** WebSocket URL to connect to */
|
|
1437
|
+
url: string;
|
|
1438
|
+
/** Game slug (for display purposes) */
|
|
1439
|
+
slug: string;
|
|
1440
|
+
/** Environment (for display purposes) */
|
|
1441
|
+
environment: 'staging' | 'production';
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1296
1444
|
/**
|
|
1297
1445
|
* Preview options
|
|
1298
1446
|
*/
|
|
@@ -1321,137 +1469,44 @@ interface PreviewResponse {
|
|
|
1321
1469
|
}
|
|
1322
1470
|
|
|
1323
1471
|
/**
|
|
1324
|
-
*
|
|
1325
|
-
|
|
1326
|
-
interface ConfigDiff {
|
|
1327
|
-
displayName?: {
|
|
1328
|
-
old: string;
|
|
1329
|
-
new: string;
|
|
1330
|
-
};
|
|
1331
|
-
emoji?: {
|
|
1332
|
-
old: string | undefined;
|
|
1333
|
-
new: string | undefined;
|
|
1334
|
-
};
|
|
1335
|
-
description?: {
|
|
1336
|
-
old: string | undefined;
|
|
1337
|
-
new: string | undefined;
|
|
1338
|
-
};
|
|
1339
|
-
gameType?: {
|
|
1340
|
-
old: string;
|
|
1341
|
-
new: string;
|
|
1342
|
-
};
|
|
1343
|
-
}
|
|
1344
|
-
/**
|
|
1345
|
-
* Build deployment changes
|
|
1346
|
-
*/
|
|
1347
|
-
interface BuildDiff {
|
|
1348
|
-
changed?: boolean;
|
|
1349
|
-
previousSize?: number;
|
|
1350
|
-
currentSize?: number;
|
|
1351
|
-
}
|
|
1352
|
-
/**
|
|
1353
|
-
* Backend deployment changes
|
|
1354
|
-
*/
|
|
1355
|
-
interface BackendDiff {
|
|
1356
|
-
changed?: boolean;
|
|
1357
|
-
/** Routes that were added (e.g., ['/api/bucket']) */
|
|
1358
|
-
addedRoutes?: string[];
|
|
1359
|
-
/** Routes that were removed (e.g., ['/api/kv']) */
|
|
1360
|
-
removedRoutes?: string[];
|
|
1361
|
-
/** Resources that were added (e.g., ['database']) */
|
|
1362
|
-
addedResources?: string[];
|
|
1363
|
-
/** Resources that were removed (e.g., ['keyValue']) */
|
|
1364
|
-
removedResources?: string[];
|
|
1365
|
-
previousServerSize?: number;
|
|
1366
|
-
currentServerSize?: number;
|
|
1367
|
-
previousDbSize?: number;
|
|
1368
|
-
currentDbSize?: number;
|
|
1369
|
-
previousBundleSize?: number;
|
|
1370
|
-
currentBundleSize?: number;
|
|
1371
|
-
forced?: boolean;
|
|
1372
|
-
schemaStatementCount?: number;
|
|
1373
|
-
}
|
|
1374
|
-
/**
|
|
1375
|
-
* Integration changes
|
|
1472
|
+
* Project directory info collected during init prompts.
|
|
1473
|
+
* Directory is NOT created until scaffolding step.
|
|
1376
1474
|
*/
|
|
1377
|
-
interface
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
current: string;
|
|
1385
|
-
next: string;
|
|
1386
|
-
field: string;
|
|
1387
|
-
}>;
|
|
1388
|
-
}>;
|
|
1475
|
+
interface ProjectDirectoryInfo {
|
|
1476
|
+
/** The resolved absolute path to the project directory */
|
|
1477
|
+
targetDir: string;
|
|
1478
|
+
/** Whether this directory needs to be created (doesn't exist yet) */
|
|
1479
|
+
needsCreation: boolean;
|
|
1480
|
+
/** Whether setup was cancelled by user */
|
|
1481
|
+
cancelled: boolean;
|
|
1389
1482
|
}
|
|
1483
|
+
|
|
1390
1484
|
/**
|
|
1391
|
-
* Secret
|
|
1485
|
+
* Secret Command Types
|
|
1486
|
+
*
|
|
1487
|
+
* Options for secret management CLI commands.
|
|
1392
1488
|
*/
|
|
1393
|
-
interface SecretsDiff {
|
|
1394
|
-
previousKeys?: string[];
|
|
1395
|
-
currentKeys?: string[];
|
|
1396
|
-
}
|
|
1397
1489
|
/**
|
|
1398
|
-
*
|
|
1490
|
+
* Base options shared by all secret commands.
|
|
1399
1491
|
*/
|
|
1400
|
-
interface
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
build?: BuildDiff;
|
|
1404
|
-
backend?: BackendDiff;
|
|
1405
|
-
integrations?: IntegrationsDiff;
|
|
1406
|
-
secrets?: SecretsDiff;
|
|
1492
|
+
interface SecretCommandOptions {
|
|
1493
|
+
/** Environment (staging or production) */
|
|
1494
|
+
env?: string;
|
|
1407
1495
|
}
|
|
1408
|
-
|
|
1409
1496
|
/**
|
|
1410
|
-
*
|
|
1497
|
+
* Options for the `secret set` command.
|
|
1411
1498
|
*/
|
|
1499
|
+
type SecretSetOptions = SecretCommandOptions;
|
|
1412
1500
|
/**
|
|
1413
|
-
*
|
|
1501
|
+
* Options for the `secret list` command.
|
|
1414
1502
|
*/
|
|
1415
|
-
|
|
1416
|
-
/** Total number of keys */
|
|
1417
|
-
totalKeys: number;
|
|
1418
|
-
/** Total size in bytes */
|
|
1419
|
-
totalSize: number;
|
|
1420
|
-
/** Information about the largest key */
|
|
1421
|
-
largestKey?: {
|
|
1422
|
-
name: string;
|
|
1423
|
-
size: number;
|
|
1424
|
-
};
|
|
1425
|
-
/** Keys grouped by prefix pattern */
|
|
1426
|
-
prefixes: Record<string, number>;
|
|
1427
|
-
}
|
|
1503
|
+
type SecretListOptions = SecretCommandOptions;
|
|
1428
1504
|
/**
|
|
1429
|
-
*
|
|
1505
|
+
* Options for the `secret delete` command.
|
|
1430
1506
|
*/
|
|
1431
|
-
interface
|
|
1432
|
-
/**
|
|
1433
|
-
|
|
1434
|
-
/** Whether the key exists */
|
|
1435
|
-
exists: boolean;
|
|
1436
|
-
/** Size in bytes (if key exists) */
|
|
1437
|
-
size?: number;
|
|
1438
|
-
/** Parsed value */
|
|
1439
|
-
value?: unknown;
|
|
1440
|
-
/** Type of value stored */
|
|
1441
|
-
valueType?: 'json' | 'string';
|
|
1442
|
-
}
|
|
1443
|
-
|
|
1444
|
-
/**
|
|
1445
|
-
* Project directory info collected during init prompts.
|
|
1446
|
-
* Directory is NOT created until scaffolding step.
|
|
1447
|
-
*/
|
|
1448
|
-
interface ProjectDirectoryInfo {
|
|
1449
|
-
/** The resolved absolute path to the project directory */
|
|
1450
|
-
targetDir: string;
|
|
1451
|
-
/** Whether this directory needs to be created (doesn't exist yet) */
|
|
1452
|
-
needsCreation: boolean;
|
|
1453
|
-
/** Whether setup was cancelled by user */
|
|
1454
|
-
cancelled: boolean;
|
|
1507
|
+
interface SecretDeleteOptions extends SecretCommandOptions {
|
|
1508
|
+
/** Skip confirmation prompt */
|
|
1509
|
+
force?: boolean;
|
|
1455
1510
|
}
|
|
1456
1511
|
|
|
1457
|
-
export type { ApiConfig, ApiErrorResponse, ApiKeyListItem, ApiKeyWithSecret, ApiRequestOptions, AuthProfile, AuthStore, AuthStrategy, BackendBundle, BackendDeploymentMetadata, BackendDiff, BackendFeatures, BucketBulkOptions, BucketDeleteOptions, BucketGetOptions, BucketListOptions, BucketPutOptions, BuildDiff, BulkCollectionResult, BundleOptions, CallbackServerResult, CollectedFile, ComponentConfig, ComponentResourceConfig, ConfigDiff, CreateApiKeyResponse, CustomRoutesIntegrationOptions, DatabaseIntegrationOptions, DeployConfig, DeployNewGameOptions, DeployedGameInfo, DeploymentChanges, DeploymentContext, DeploymentDiffOptions, DeploymentPlan, DeploymentResult, DevServerOptions, EmbeddedSourcePaths, EngineConfig, EngineType, EnvironmentAuthProfiles, GameStore, IntegrationChangeDetector, IntegrationChangeDetectors, IntegrationConfigChange, IntegrationsConfig, IntegrationsDiff, KeyMetadata, KeyStats, LoadConfigResult, LoginCredentials, LoginResponse, OrganizationConfig, PlaycademyConfig, PluginLogger, PreviewOptions, PreviewResponse, ProjectDirectoryInfo, ResourceConfig, ScaffoldResult,
|
|
1512
|
+
export type { ApiConfig, ApiErrorResponse, ApiKeyListItem, ApiKeyWithSecret, ApiRequestOptions, AuthProfile, AuthStore, AuthStrategy, BackendBundle, BackendDeploymentMetadata, BackendDiff, BackendFeatures, BucketBulkOptions, BucketDeleteOptions, BucketGetOptions, BucketListOptions, BucketPutOptions, BuildDiff, BulkCollectionResult, BundleOptions, CallbackServerResult, CollectedFile, ComponentConfig, ComponentResourceConfig, ConfigDiff, CreateApiKeyResponse, CustomRoutesIntegrationOptions, DatabaseIntegrationOptions, DeployConfig, DeployNewGameOptions, DeployedGameInfo, DeploymentChanges, DeploymentContext, DeploymentDiffOptions, DeploymentPlan, DeploymentResult, DevServerOptions, EmbeddedSourcePaths, EngineConfig, EngineType, EnvironmentAuthProfiles, GameStore, IntegrationChangeDetector, IntegrationChangeDetectors, IntegrationConfigChange, IntegrationsConfig, IntegrationsDiff, KeyMetadata, KeyStats, LoadConfigResult, LogEntry, LogStreamConfig, LogStreamUrlOptions, LoginCredentials, LoginResponse, OrganizationConfig, PlaycademyConfig, PluginLogger, PreviewOptions, PreviewResponse, ProjectDirectoryInfo, ResourceConfig, ScaffoldResult, SecretCommandOptions, SecretDeleteOptions, SecretListOptions, SecretSetOptions, SignInResponse, SsoCallbackData, Template, TemplateFramework, TemplateHook, TemplateHookOptions, TemplateSource, TimebackBaseConfig, TimebackCourseConfig, TimebackCourseConfigWithOverrides, TimebackGrade, TimebackIntegrationConfig, TimebackSourcedIds, TimebackSubject, TokenType, UpdateExistingGameOptions };
|