@ottocode/server 0.1.262 → 0.1.264
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ottocode/server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.264",
|
|
4
4
|
"description": "HTTP API server for ottocode",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"typecheck": "tsc --noEmit"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@ottocode/database": "0.1.
|
|
65
|
-
"@ottocode/sdk": "0.1.
|
|
64
|
+
"@ottocode/database": "0.1.264",
|
|
65
|
+
"@ottocode/sdk": "0.1.264",
|
|
66
66
|
"@hono/zod-openapi": "^1.1.5",
|
|
67
67
|
"ai-sdk-ollama": "^3.8.3",
|
|
68
68
|
"drizzle-orm": "^0.44.5",
|
|
@@ -26,7 +26,6 @@ import {
|
|
|
26
26
|
} from '../stream/handlers.ts';
|
|
27
27
|
import {
|
|
28
28
|
pruneSession,
|
|
29
|
-
getModelLimits,
|
|
30
29
|
shouldAutoCompactBeforeOverflow,
|
|
31
30
|
} from '../message/compaction.ts';
|
|
32
31
|
import { triggerDeferredTitleGeneration } from '../message/service.ts';
|
|
@@ -131,7 +130,6 @@ async function shouldPreemptivelyAutoCompact(
|
|
|
131
130
|
opts: RunOpts,
|
|
132
131
|
threshold: number | null | undefined,
|
|
133
132
|
): Promise<boolean> {
|
|
134
|
-
const limits = getModelLimits(opts.provider, opts.model);
|
|
135
133
|
const sessionRows = await db
|
|
136
134
|
.select({ currentContextTokens: sessions.currentContextTokens })
|
|
137
135
|
.from(sessions)
|
|
@@ -140,7 +138,6 @@ async function shouldPreemptivelyAutoCompact(
|
|
|
140
138
|
|
|
141
139
|
return shouldAutoCompactBeforeOverflow({
|
|
142
140
|
autoCompactThresholdTokens: threshold,
|
|
143
|
-
modelContextWindow: limits?.context ?? null,
|
|
144
141
|
currentContextTokens: sessionRows[0]?.currentContextTokens ?? 0,
|
|
145
142
|
estimatedInputTokens: opts.estimatedInputTokens ?? 0,
|
|
146
143
|
isCompactCommand: opts.isCompactCommand,
|
|
@@ -14,7 +14,6 @@ export interface ModelLimits {
|
|
|
14
14
|
|
|
15
15
|
export function shouldAutoCompactBeforeOverflow(args: {
|
|
16
16
|
autoCompactThresholdTokens?: number | null;
|
|
17
|
-
modelContextWindow?: number | null;
|
|
18
17
|
currentContextTokens?: number | null;
|
|
19
18
|
estimatedInputTokens?: number | null;
|
|
20
19
|
isCompactCommand?: boolean;
|
|
@@ -31,11 +30,6 @@ export function shouldAutoCompactBeforeOverflow(args: {
|
|
|
31
30
|
return false;
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
const modelContextWindow = Number(args.modelContextWindow ?? 0);
|
|
35
|
-
if (!Number.isFinite(modelContextWindow) || modelContextWindow <= threshold) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
33
|
const currentContextTokens = Math.max(
|
|
40
34
|
0,
|
|
41
35
|
Math.floor(Number(args.currentContextTokens ?? 0)),
|
|
@@ -131,6 +131,23 @@ export async function listSessions({
|
|
|
131
131
|
.limit(limit);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
type UpdateSessionAgentInput = {
|
|
135
|
+
db: DB;
|
|
136
|
+
sessionId: string;
|
|
137
|
+
agent: string;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export async function updateSessionAgent({
|
|
141
|
+
db,
|
|
142
|
+
sessionId,
|
|
143
|
+
agent,
|
|
144
|
+
}: UpdateSessionAgentInput): Promise<void> {
|
|
145
|
+
await db
|
|
146
|
+
.update(sessions)
|
|
147
|
+
.set({ agent, lastActiveAt: Date.now() })
|
|
148
|
+
.where(eq(sessions.id, sessionId));
|
|
149
|
+
}
|
|
150
|
+
|
|
134
151
|
export type SessionHistoryMessage = MessageRow & {
|
|
135
152
|
parts: MessagePartRow[];
|
|
136
153
|
};
|