@cartanova/qgrid-ai-sdk 2.0.2 → 2.0.3
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/index.d.ts +7 -1
- package/dist/index.js +5 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -30,9 +30,15 @@ type QgridProviderOptions = {
|
|
|
30
30
|
};
|
|
31
31
|
type QgridSupportedModel = "openai/gpt-5.5" | "openai/gpt-5.4" | "openai/gpt-5.2" | "openai/gpt-5.4-mini" | "openai/gpt-5.3-codex" | "openai/gpt-5.3-codex-spark" | "anthropic/claude-haiku-4-5" | "anthropic/claude-sonnet-4" | "anthropic/claude-sonnet-4-5" | "anthropic/claude-sonnet-4-6" | "anthropic/claude-sonnet-4-7" | "anthropic/claude-opus-4" | "anthropic/claude-opus-4-1" | "anthropic/claude-opus-4-5" | "anthropic/claude-opus-4-6" | "anthropic/claude-opus-4-7";
|
|
32
32
|
type QgridLoggerConfig = {
|
|
33
|
-
/** qgrid 서버 주소.
|
|
33
|
+
/** qgrid 서버 주소. default: process.env.QGRID_URL, 없으면 기본값은 "http://localhost:44900" */
|
|
34
34
|
serverUrl?: string;
|
|
35
|
+
/**
|
|
36
|
+
* 프로젝트 이름. default: process.env.QGRID_PROJECT_NAME, 없으면 기본값은 ""
|
|
37
|
+
*/
|
|
35
38
|
projectName?: string;
|
|
39
|
+
/**
|
|
40
|
+
* 토큰 이름. 외부에서 호출할경우 기본값은 "external"
|
|
41
|
+
*/
|
|
36
42
|
tokenName?: string;
|
|
37
43
|
/**
|
|
38
44
|
* Fallback timeout for runs that receive onStart but never receive onFinish.
|
package/dist/index.js
CHANGED
|
@@ -239,6 +239,8 @@ function timedKeySet() {
|
|
|
239
239
|
}
|
|
240
240
|
function createQgridLogger(config = {}) {
|
|
241
241
|
const serverUrl = config.serverUrl ?? process.env.QGRID_URL ?? "http://localhost:44900";
|
|
242
|
+
const projectName = config.projectName ?? process.env.QGRID_PROJECT_NAME;
|
|
243
|
+
config.tokenName ?? process.env.QGRID_TOKEN_NAME;
|
|
242
244
|
const onLogError = config.onLogError ?? ((e) => console.warn(`[qgrid-logger] ${e.message}`));
|
|
243
245
|
const runs = /* @__PURE__ */ new Map();
|
|
244
246
|
const keyTtl = typeof config.staleRunTimeoutMs === "number" && config.staleRunTimeoutMs > 0 ? config.staleRunTimeoutMs : DEFAULT_STALE_RUN_TIMEOUT_MS;
|
|
@@ -273,7 +275,6 @@ function createQgridLogger(config = {}) {
|
|
|
273
275
|
totalCacheReadTokens: result.totalUsage?.inputTokenDetails?.cacheReadTokens ?? 0,
|
|
274
276
|
totalCacheCreationTokens: result.totalUsage?.inputTokenDetails?.cacheWriteTokens ?? 0,
|
|
275
277
|
totalDurationMs: Date.now() - run.startTime,
|
|
276
|
-
history: run.history,
|
|
277
278
|
...result.errorMessage ? { errorMessage: result.errorMessage } : {}
|
|
278
279
|
}).catch((e) => onLogError(e instanceof Error ? e : new Error(String(e))));
|
|
279
280
|
};
|
|
@@ -310,11 +311,13 @@ function createQgridLogger(config = {}) {
|
|
|
310
311
|
}
|
|
311
312
|
try {
|
|
312
313
|
const messages = event.messages ?? (Array.isArray(event.prompt) ? event.prompt : void 0);
|
|
314
|
+
const history = serializeHistory(messages);
|
|
313
315
|
const result = await createRun(serverUrl, {
|
|
314
316
|
userPrompt: extractUserPrompt(event.prompt, messages),
|
|
315
317
|
systemPrompt: extractSystemPrompt(event.system),
|
|
316
318
|
modelName: event.model.modelId,
|
|
317
|
-
projectName
|
|
319
|
+
projectName,
|
|
320
|
+
history
|
|
318
321
|
});
|
|
319
322
|
let watchdogTimeout = DEFAULT_STALE_RUN_TIMEOUT_MS;
|
|
320
323
|
if (typeof config.staleRunTimeoutMs === "number") watchdogTimeout = config.staleRunTimeoutMs;
|
|
@@ -354,7 +357,6 @@ function createQgridLogger(config = {}) {
|
|
|
354
357
|
pendingToolCalls: [],
|
|
355
358
|
startTime: Date.now(),
|
|
356
359
|
toolDurations: /* @__PURE__ */ new Map(),
|
|
357
|
-
history: serializeHistory(messages),
|
|
358
360
|
watchdog,
|
|
359
361
|
cleanupAbortListener,
|
|
360
362
|
finishing: false
|