@blotout/qinto-cli 0.1.10 → 0.1.11

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.
@@ -14706,7 +14706,7 @@ var scheduleSchema = external_exports.object({
14706
14706
  id: external_exports.string().min(1).max(64),
14707
14707
  ord: external_exports.number().int().min(1),
14708
14708
  label: external_exports.string().max(100),
14709
- catalogQueryTicket: external_exports.string().min(1).max(2048)
14709
+ queryTicket: external_exports.string().min(1).max(2048)
14710
14710
  }).strict()
14711
14711
  ).min(1).max(MAX_INSTALLS_PER_APP)
14712
14712
  }).strict();
@@ -14722,7 +14722,10 @@ var toolSchema = external_exports.object({
14722
14722
  // call that names no arguments normalizes to `{}` rather than reaching the handler as undefined.
14723
14723
  arguments: external_exports.record(external_exports.string(), external_exports.unknown()).default({}),
14724
14724
  // Stable across a collapsed retry, so an app can deduplicate its external effects on it.
14725
- callId: external_exports.string().min(1).max(64)
14725
+ callId: external_exports.string().min(1).max(64),
14726
+ // The short-lived install/version-scoped credential used only by the app runtime's query
14727
+ // broker. It never enters handler arguments or app-authored result data.
14728
+ queryTicket: external_exports.string().min(1).max(2048)
14726
14729
  }).strict().refine((tool) => {
14727
14730
  return new TextEncoder().encode(JSON.stringify(tool.arguments)).length <= MAX_TOOL_ARGUMENTS_BYTES;
14728
14731
  }, "Tool arguments exceed the size cap");
@@ -14932,6 +14935,9 @@ var appUiWritePath = (domainId, appSlug2) => {
14932
14935
  var appUiCatalogQueryPath = (domainId, appSlug2, resourceIdentifier) => {
14933
14936
  return `/app-ui/sites/${domainId}/apps/${appSlug2}/catalogs/${resourceIdentifier}/query`;
14934
14937
  };
14938
+ var appUiAnalyticsQueryPath = (domainId, appSlug2, resourceIdentifier) => {
14939
+ return `/app-ui/sites/${domainId}/apps/${appSlug2}/analytics/${resourceIdentifier}/query`;
14940
+ };
14935
14941
  var uiInstallSchema = external_exports.object({ id: external_exports.string().min(1).max(64), ord: external_exports.number().int().min(1), label: external_exports.string().max(100), enabled: external_exports.boolean() }).strict();
14936
14942
  var uiContextSchema = external_exports.object({
14937
14943
  version: external_exports.string().min(1).max(32),
@@ -16195,43 +16201,58 @@ var failureMessage = (error51) => {
16195
16201
  return message.slice(0, MAX_ERROR_MESSAGE_LENGTH);
16196
16202
  };
16197
16203
 
16198
- // src/catalog-query.ts
16199
- var MAX_CATALOG_RESPONSE_BYTES = 5 * 1024 * 1024;
16200
- var parseCatalogResponse = async (response) => {
16201
- const raw = await readBody(response, MAX_CATALOG_RESPONSE_BYTES);
16204
+ // src/query.ts
16205
+ var MAX_QUERY_RESPONSE_BYTES = 5 * 1024 * 1024;
16206
+ var parseQueryResponse = async (kind, response) => {
16207
+ const raw = await readBody(response, MAX_QUERY_RESPONSE_BYTES);
16202
16208
  if (raw === null) {
16203
- throw new Error("The catalog query response exceeded the app runtime limit.");
16209
+ throw new Error(`The ${kind} query response exceeded the app runtime limit.`);
16204
16210
  }
16205
16211
  let body;
16206
16212
  try {
16207
16213
  body = JSON.parse(raw);
16208
16214
  } catch {
16209
- throw new Error(`The catalog query returned an invalid response (${response.status}).`);
16215
+ throw new Error(`The ${kind} query returned an invalid response (${response.status}).`);
16210
16216
  }
16211
16217
  if (!response.ok) {
16212
16218
  const error51 = body;
16213
16219
  const reason = typeof error51.message === "string" ? error51.message : typeof error51.error === "string" ? error51.error : `request failed with status ${response.status}`;
16214
- throw new Error(`Catalog query failed: ${reason}`);
16220
+ throw new Error(`${kind === "catalog" ? "Catalog" : "Analytics"} query failed: ${reason}`);
16215
16221
  }
16216
16222
  return body;
16217
16223
  };
16218
- var buildCatalogQuery = ({ env, ticket, installId }) => {
16224
+ var buildQuery = ({ env, ticket, installId }) => {
16225
+ const platform = env;
16226
+ const context = JSON.parse(platform.APP_CONTEXT);
16227
+ const post = async (kind, path, resourceIdentifier, sql) => {
16228
+ return traced(
16229
+ `qinto.${kind}.query`,
16230
+ { attrs: { "app.install_id": installId, [`app.${kind}.resource`]: resourceIdentifier } },
16231
+ async () => {
16232
+ const response = await fetch(new URL(path, platform.QINTO_PLATFORM_API), {
16233
+ method: "POST",
16234
+ headers: { authorization: `Bearer ${ticket}`, "content-type": "application/json" },
16235
+ body: JSON.stringify({ sql })
16236
+ });
16237
+ return parseQueryResponse(kind, response);
16238
+ }
16239
+ );
16240
+ };
16219
16241
  return {
16220
16242
  catalog: async (resourceIdentifier, sql) => {
16221
- const platform = env;
16222
- const context = JSON.parse(platform.APP_CONTEXT);
16223
- const path = appUiCatalogQueryPath(context.domainId, context.slug, resourceIdentifier);
16224
- return traced(
16225
- "qinto.catalog.query",
16226
- { attrs: { "app.install_id": installId, "app.catalog.resource": resourceIdentifier } },
16227
- async () => {
16228
- const response = await fetch(new URL(path, platform.QINTO_PLATFORM_API), {
16229
- method: "POST",
16230
- headers: { authorization: `Bearer ${ticket}`, "content-type": "application/json" },
16231
- body: JSON.stringify({ sql })
16232
- });
16233
- return parseCatalogResponse(response);
16234
- }
16243
+ return post(
16244
+ "catalog",
16245
+ appUiCatalogQueryPath(context.domainId, context.slug, resourceIdentifier),
16246
+ resourceIdentifier,
16247
+ sql
16248
+ );
16249
+ },
16250
+ analytics: async (resourceIdentifier, sql) => {
16251
+ return post(
16252
+ "analytics",
16253
+ appUiAnalyticsQueryPath(context.domainId, context.slug, resourceIdentifier),
16254
+ resourceIdentifier,
16255
+ sql
16235
16256
  );
16236
16257
  }
16237
16258
  };
@@ -16273,7 +16294,7 @@ var dispatchSchedule = async (envelope, bundle, env) => {
16273
16294
  appSecrets: appScope.appSecrets,
16274
16295
  observability: buildObservability(install.ord),
16275
16296
  apps: buildAppsClient(env, { depth: 0 }),
16276
- query: buildCatalogQuery({ env, ticket: install.catalogQueryTicket, installId: install.id }),
16297
+ query: buildQuery({ env, ticket: install.queryTicket, installId: install.id }),
16277
16298
  push: async (userId, message) => {
16278
16299
  await brokerPush(env, {
16279
16300
  userId,
@@ -16393,6 +16414,7 @@ var buildContext2 = (envelope, env) => {
16393
16414
  appSecrets: appScope.appSecrets,
16394
16415
  observability: buildObservability(install.ord),
16395
16416
  apps: buildAppsClient(env, { depth: 0 }),
16417
+ query: buildQuery({ env, ticket: envelope.tool.queryTicket, installId: install.id }),
16396
16418
  fail: (message) => {
16397
16419
  return { kind: "tool_error", message: truncate(message) };
16398
16420
  }
@@ -15932,7 +15932,7 @@ var scheduleSchema = external_exports.object({
15932
15932
  id: external_exports.string().min(1).max(64),
15933
15933
  ord: external_exports.number().int().min(1),
15934
15934
  label: external_exports.string().max(100),
15935
- catalogQueryTicket: external_exports.string().min(1).max(2048)
15935
+ queryTicket: external_exports.string().min(1).max(2048)
15936
15936
  }).strict()
15937
15937
  ).min(1).max(MAX_INSTALLS_PER_APP)
15938
15938
  }).strict();
@@ -15948,7 +15948,10 @@ var toolSchema = external_exports.object({
15948
15948
  // call that names no arguments normalizes to `{}` rather than reaching the handler as undefined.
15949
15949
  arguments: external_exports.record(external_exports.string(), external_exports.unknown()).default({}),
15950
15950
  // Stable across a collapsed retry, so an app can deduplicate its external effects on it.
15951
- callId: external_exports.string().min(1).max(64)
15951
+ callId: external_exports.string().min(1).max(64),
15952
+ // The short-lived install/version-scoped credential used only by the app runtime's query
15953
+ // broker. It never enters handler arguments or app-authored result data.
15954
+ queryTicket: external_exports.string().min(1).max(2048)
15952
15955
  }).strict().refine((tool) => {
15953
15956
  return new TextEncoder().encode(JSON.stringify(tool.arguments)).length <= MAX_TOOL_ARGUMENTS_BYTES;
15954
15957
  }, "Tool arguments exceed the size cap");
@@ -20993,10 +20996,10 @@ var verifyAppUiToken = /* @__PURE__ */ __name(async (input) => {
20993
20996
  return { ok: true, claims: claims.data, kid: signature.kid, key: signature.key };
20994
20997
  }, "verifyAppUiToken");
20995
20998
 
20996
- // ../../libs/app-ui-token/src/schedule-catalog-ticket.ts
20997
- var APP_SCHEDULE_CATALOG_TICKET_ISSUER = "qinto-portal";
20999
+ // ../../libs/app-ui-token/src/runtime-query-ticket.ts
21000
+ var APP_RUNTIME_QUERY_TICKET_ISSUER = "qinto-portal";
20998
21001
  var claimsSchema2 = external_exports.object({
20999
- iss: external_exports.literal(APP_SCHEDULE_CATALOG_TICKET_ISSUER),
21002
+ iss: external_exports.literal(APP_RUNTIME_QUERY_TICKET_ISSUER),
21000
21003
  aud: external_exports.string().min(1),
21001
21004
  sub: external_exports.string().min(1),
21002
21005
  iat: external_exports.number().int(),
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "main": {
3
3
  "version": "0.1.0",
4
- "gitSha": "eccf5ef7a3b8ef9131bc38d28b66cc5a3add163b",
5
- "builtAt": "2026-08-29T05:28:12.232Z",
4
+ "gitSha": "83bcac7072f2feb866505c4a7b99f7281b08d972",
5
+ "builtAt": "2026-08-29T21:13:15.188Z",
6
6
  "compatibilityDate": "2026-06-23",
7
7
  "compatibilityFlags": [
8
8
  "nodejs_compat"
@@ -40,8 +40,8 @@
40
40
  },
41
41
  "app-runtime": {
42
42
  "version": "0.1.0",
43
- "gitSha": "eccf5ef7a3b8ef9131bc38d28b66cc5a3add163b",
44
- "builtAt": "2026-08-29T05:28:14.997Z",
43
+ "gitSha": "83bcac7072f2feb866505c4a7b99f7281b08d972",
44
+ "builtAt": "2026-08-29T21:13:19.154Z",
45
45
  "compatibilityDate": "2026-06-23",
46
46
  "compatibilityFlags": [
47
47
  "nodejs_compat"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotout/qinto-cli",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "type": "module",
5
5
  "description": "Qinto CLI: authenticate against the Qinto platform and operate it from the terminal or from an agent.",
6
6
  "repository": {