casualos 3.7.2-alpha.18014719607 → 3.8.0-alpha.18508342733

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.
Files changed (2) hide show
  1. package/dist/cli.js +87 -65
  2. package/package.json +4 -4
package/dist/cli.js CHANGED
@@ -93467,7 +93467,7 @@ var trace = TraceAPI.getInstance();
93467
93467
  function hashLowEntropyPasswordWithSalt2(password, salt) {
93468
93468
  const tracer = trace.getTracer(
93469
93469
  "InstrumentedHashHelpers",
93470
- false ? void 0 : "v3.7.2-alpha.18014719607"
93470
+ false ? void 0 : "v3.8.0-alpha.18508342733"
93471
93471
  );
93472
93472
  return tracer.startActiveSpan(
93473
93473
  "hashLowEntropyPasswordWithSalt",
@@ -93485,7 +93485,7 @@ function hashLowEntropyPasswordWithSalt2(password, salt) {
93485
93485
  function hashHighEntropyPasswordWithSalt2(password, salt) {
93486
93486
  const tracer = trace.getTracer(
93487
93487
  "InstrumentedHashHelpers",
93488
- false ? void 0 : "v3.7.2-alpha.18014719607"
93488
+ false ? void 0 : "v3.8.0-alpha.18508342733"
93489
93489
  );
93490
93490
  return tracer.startActiveSpan(
93491
93491
  "hashHighEntropyPasswordWithSalt",
@@ -93503,7 +93503,7 @@ function hashHighEntropyPasswordWithSalt2(password, salt) {
93503
93503
  function verifyPasswordAgainstHashes2(password, salt, hashes) {
93504
93504
  const tracer = trace.getTracer(
93505
93505
  "InstrumentedHashHelpers",
93506
- false ? void 0 : "v3.7.2-alpha.18014719607"
93506
+ false ? void 0 : "v3.8.0-alpha.18508342733"
93507
93507
  );
93508
93508
  return tracer.startActiveSpan(
93509
93509
  "verifyPasswordAgainstHashes",
@@ -100895,7 +100895,7 @@ var import_semantic_conventions = __toESM(require_src3());
100895
100895
  function traced(tracerName, options = {}, metricOptions = {}) {
100896
100896
  const tracer = trace.getTracer(
100897
100897
  tracerName,
100898
- false ? void 0 : "v3.7.2-alpha.18014719607"
100898
+ false ? void 0 : "v3.8.0-alpha.18508342733"
100899
100899
  );
100900
100900
  return function(target, propertyKey, descriptor) {
100901
100901
  const originalMethod = descriptor.value;
@@ -100977,7 +100977,7 @@ function getHistogram(meter) {
100977
100977
  }
100978
100978
  return metrics.getMeter(
100979
100979
  meter.meter,
100980
- false ? void 0 : "v3.7.2-alpha.18014719607"
100980
+ false ? void 0 : "v3.8.0-alpha.18508342733"
100981
100981
  ).createHistogram(meter.name, meter.options);
100982
100982
  }
100983
100983
  function getCounter(meter) {
@@ -100986,7 +100986,7 @@ function getCounter(meter) {
100986
100986
  }
100987
100987
  return metrics.getMeter(
100988
100988
  meter.meter,
100989
- false ? void 0 : "v3.7.2-alpha.18014719607"
100989
+ false ? void 0 : "v3.8.0-alpha.18508342733"
100990
100990
  ).createCounter(meter.name, meter.options);
100991
100991
  }
100992
100992
  function traceHttpResponse(options = {}) {
@@ -111472,7 +111472,7 @@ var RecordsServer = class {
111472
111472
  this._databaseRecordsController = databaseRecordsController;
111473
111473
  this._tracer = trace.getTracer(
111474
111474
  "RecordsServer",
111475
- false ? void 0 : "v3.7.2-alpha.18014719607"
111475
+ false ? void 0 : "v3.8.0-alpha.18508342733"
111476
111476
  );
111477
111477
  this._procedures = this._createProcedures();
111478
111478
  this._setupRoutes();
@@ -113728,6 +113728,26 @@ var RecordsServer = class {
113728
113728
  });
113729
113729
  return result;
113730
113730
  }),
113731
+ aiListChatModels: procedure().origins("api").http("GET", "/api/v2/ai/chat/models").inputs(z.object({})).handler(async (_2, context) => {
113732
+ if (!this._aiController) {
113733
+ return AI_NOT_SUPPORTED_RESULT;
113734
+ }
113735
+ const sessionKeyValidation = await this._validateSessionKey(
113736
+ context.sessionKey
113737
+ );
113738
+ if (sessionKeyValidation.success === false) {
113739
+ if (sessionKeyValidation.errorCode === "no_session_key") {
113740
+ return NOT_LOGGED_IN_RESULT;
113741
+ }
113742
+ return sessionKeyValidation;
113743
+ }
113744
+ const result = await this._aiController.listChatModels({
113745
+ userId: sessionKeyValidation.userId,
113746
+ userSubscriptionTier: sessionKeyValidation.subscriptionTier,
113747
+ userRole: sessionKeyValidation.role
113748
+ });
113749
+ return genericResult(result);
113750
+ }),
113731
113751
  createAiSkybox: procedure().origins("api").http("POST", "/api/v2/ai/skybox").inputs(
113732
113752
  z.object({
113733
113753
  prompt: z.string().nonempty().max(600),
@@ -114584,8 +114604,8 @@ var RecordsServer = class {
114584
114604
  return {
114585
114605
  success: true,
114586
114606
  ...metadata,
114587
- version: true ? "v3.7.2-alpha.18014719607" : void 0,
114588
- versionHash: true ? "5de8c62ae0b479666b2031b51ebb1af069a13389" : void 0
114607
+ version: true ? "v3.8.0-alpha.18508342733" : void 0,
114608
+ versionHash: true ? "a57e937e30f2d33b2aa6419fa1749636c6d19768" : void 0
114589
114609
  };
114590
114610
  })
114591
114611
  };
@@ -131392,28 +131412,28 @@ var WebhookRecordsController = class extends CrudRecordsController {
131392
131412
  errorMessage: "Invalid webhook target. The targeted record does not contain a valid name."
131393
131413
  };
131394
131414
  }
131395
- const data = await this._data.getData(
131415
+ const data2 = await this._data.getData(
131396
131416
  webhook.targetRecordName,
131397
131417
  webhook.targetAddress,
131398
131418
  webhook.userId,
131399
131419
  request2.instances
131400
131420
  );
131401
- if (data.success === false) {
131421
+ if (data2.success === false) {
131402
131422
  return {
131403
131423
  success: false,
131404
131424
  errorCode: "invalid_webhook_target",
131405
131425
  errorMessage: "Invalid webhook target. The targeted record was not able to be retrieved.",
131406
- internalError: data
131426
+ internalError: data2
131407
131427
  };
131408
131428
  }
131409
131429
  let auxData;
131410
- if (typeof data.data === "string") {
131411
- const stored = tryParseJson(data.data);
131430
+ if (typeof data2.data === "string") {
131431
+ const stored = tryParseJson(data2.data);
131412
131432
  if (stored.success === true) {
131413
131433
  auxData = stored.value;
131414
131434
  }
131415
- } else if (typeof data.data === "object") {
131416
- auxData = data.data;
131435
+ } else if (typeof data2.data === "object") {
131436
+ auxData = data2.data;
131417
131437
  }
131418
131438
  const parseResult = STORED_AUX_SCHEMA.safeParse(auxData);
131419
131439
  if (parseResult.success === false) {
@@ -131529,6 +131549,10 @@ var WebhookRecordsController = class extends CrudRecordsController {
131529
131549
  fetchTimeoutMs: checkMetrics.features.fetchTimeoutMs ?? 5e3,
131530
131550
  addStateTimeoutMs: checkMetrics.features.addStateTimeoutMs ?? 1e3
131531
131551
  };
131552
+ console.log(
131553
+ `[WebhookRecordsController] [recordName: ${recordName} address: ${webhook.address}] Running webhook with options`,
131554
+ options
131555
+ );
131532
131556
  const result = await this._environment.handleHttpRequest({
131533
131557
  state,
131534
131558
  recordName: stateRecordName,
@@ -131545,54 +131569,52 @@ var WebhookRecordsController = class extends CrudRecordsController {
131545
131569
  const runId = v7_default();
131546
131570
  let infoFileName = null;
131547
131571
  let infoRecordName = null;
131548
- if (webhook.userId) {
131549
- const recordName2 = webhook.userId;
131550
- const dataFile = {
131551
- runId,
131552
- version: 1,
131553
- request: request2.request,
131554
- requestUserId: request2.userId,
131555
- response: result.success === true ? result.response : null,
131556
- logs: result.success === true ? result.logs : [],
131557
- state,
131558
- stateSha256: stateHash,
131559
- authorization: webhookAuthorization
131560
- };
131561
- const json = fast_json_stable_stringify_default(dataFile);
131562
- const data = new TextEncoder().encode(json);
131563
- const recordResult = await this._files.recordFile(
131564
- recordName2,
131565
- recordName2,
131566
- {
131567
- fileSha256Hex: (0, import_hash5.sha256)().update(data).digest("hex"),
131568
- fileByteLength: data.byteLength,
131569
- fileDescription: `Webhook data for run ${runId}`,
131570
- fileMimeType: "application/json",
131571
- headers: {},
131572
- markers: [`private:logs`]
131573
- }
131572
+ const dataFile = {
131573
+ runId,
131574
+ version: 1,
131575
+ request: request2.request,
131576
+ requestUserId: request2.userId,
131577
+ response: result.success === true ? result.response : null,
131578
+ logs: result.success === true ? result.logs : [],
131579
+ state,
131580
+ stateSha256: stateHash,
131581
+ authorization: webhookAuthorization
131582
+ };
131583
+ const json = fast_json_stable_stringify_default(dataFile);
131584
+ const data = new TextEncoder().encode(json);
131585
+ const recordResult = await this._files.recordFile(
131586
+ recordName,
131587
+ null,
131588
+ {
131589
+ fileSha256Hex: (0, import_hash5.sha256)().update(data).digest("hex"),
131590
+ fileByteLength: data.byteLength,
131591
+ fileDescription: `Webhook data for run ${runId}`,
131592
+ fileMimeType: "application/json",
131593
+ headers: {},
131594
+ markers: [`private:logs`],
131595
+ userRole: "system"
131596
+ }
131597
+ );
131598
+ if (recordResult.success === false) {
131599
+ console.error(
131600
+ "[WebhookRecordsController] Error recording webhook info file:",
131601
+ recordResult
131574
131602
  );
131575
- if (recordResult.success === false) {
131603
+ } else {
131604
+ infoRecordName = recordName;
131605
+ infoFileName = recordResult.fileName;
131606
+ const requestResult = await axios_default.request({
131607
+ method: recordResult.uploadMethod,
131608
+ headers: recordResult.uploadHeaders,
131609
+ url: recordResult.uploadUrl,
131610
+ data,
131611
+ validateStatus: () => true
131612
+ });
131613
+ if (requestResult.status <= 199 || requestResult.status >= 300) {
131576
131614
  console.error(
131577
- "[WebhookRecordsController] Error recording webhook info file:",
131578
- recordResult
131615
+ "[WebhookRecordsController] Error uploading webhook info file:",
131616
+ requestResult
131579
131617
  );
131580
- } else {
131581
- infoRecordName = recordName2;
131582
- infoFileName = recordResult.fileName;
131583
- const requestResult = await axios_default.request({
131584
- method: recordResult.uploadMethod,
131585
- headers: recordResult.uploadHeaders,
131586
- url: recordResult.uploadUrl,
131587
- data,
131588
- validateStatus: () => true
131589
- });
131590
- if (requestResult.status <= 199 || requestResult.status >= 300) {
131591
- console.error(
131592
- "[WebhookRecordsController] Error uploading webhook info file:",
131593
- requestResult
131594
- );
131595
- }
131596
131618
  }
131597
131619
  }
131598
131620
  const run = {
@@ -134050,7 +134072,7 @@ var WebsocketController = class {
134050
134072
  inst = savedInst;
134051
134073
  }
134052
134074
  } else {
134053
- const userInfo = await this._authStore.findUser(userId);
134075
+ const userInfo = userId ? await this._authStore.findUser(userId) : null;
134054
134076
  if (userInfo) {
134055
134077
  const userPrivacyFeatures = userInfo.privacyFeatures;
134056
134078
  if (userPrivacyFeatures) {
@@ -134067,8 +134089,8 @@ var WebsocketController = class {
134067
134089
  if (privoConfig) {
134068
134090
  return {
134069
134091
  success: false,
134070
- errorCode: "not_authorized",
134071
- errorMessage: "Public insts are not allowed."
134092
+ errorCode: "not_logged_in",
134093
+ errorMessage: "Please log in to access public insts."
134072
134094
  };
134073
134095
  }
134074
134096
  }
@@ -146328,7 +146350,7 @@ var config = new Conf({
146328
146350
  projectName: "casualos-cli"
146329
146351
  });
146330
146352
  var program2 = new Command();
146331
- program2.name("casualos").description("A CLI for CasualOS").version("v3.7.2-alpha.18014719607").option(
146353
+ program2.name("casualos").description("A CLI for CasualOS").version("v3.8.0-alpha.18508342733").option(
146332
146354
  "-e, --endpoint <url>",
146333
146355
  "The endpoint to use for queries. Can be used to override the current endpoint."
146334
146356
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "casualos",
3
- "version": "3.7.2-alpha.18014719607",
3
+ "version": "3.8.0-alpha.18508342733",
4
4
  "description": "Command line interface for CasualOS.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "index.d.ts",
@@ -35,8 +35,8 @@
35
35
  "access": "public"
36
36
  },
37
37
  "dependencies": {
38
- "@casual-simulation/aux-common": "^3.7.2-alpha.18014719607",
39
- "@casual-simulation/aux-records": "^3.7.2-alpha.18014719607",
38
+ "@casual-simulation/aux-common": "^3.8.0-alpha.18508342733",
39
+ "@casual-simulation/aux-records": "^3.8.0-alpha.18508342733",
40
40
  "@octokit/app": "^15.1.0",
41
41
  "@octokit/auth-oauth-device": "^7.1.1",
42
42
  "@octokit/core": "^6.1.2",
@@ -63,5 +63,5 @@
63
63
  "**/*.def",
64
64
  "templates/**"
65
65
  ],
66
- "gitHead": "5de8c62ae0b479666b2031b51ebb1af069a13389"
66
+ "gitHead": "a57e937e30f2d33b2aa6419fa1749636c6d19768"
67
67
  }