@larkup/tool-video-intelligence 0.2.10 → 0.3.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/.env.example +3 -0
- package/README.md +11 -6
- package/dist/agent.d.ts +50 -0
- package/dist/agent.js +505 -241
- package/dist/contracts.d.ts +57 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -4
- package/package.json +3 -3
- package/runtime/app/config.py +1 -1
- package/runtime/app/main.py +0 -4
- package/runtime/app/services/brain.py +694 -71
- package/runtime/app/services/embedding.py +1 -1
- package/runtime/app/services/pipeline.py +256 -11
- package/runtime/app/services/vision.py +191 -34
- package/runtime/app/utils/timing.py +82 -2
- package/tool.manifest.json +1 -1
package/.env.example
CHANGED
|
@@ -38,6 +38,9 @@ LARKUP_VIDEO_AGENT_API_KEY=
|
|
|
38
38
|
LARKUP_VIDEO_AGENT_BASE_URL=https://ai-gateway.vercel.sh/v1
|
|
39
39
|
LARKUP_VIDEO_GATEWAY_BATCH_SIZE=4
|
|
40
40
|
LARKUP_VIDEO_GATEWAY_CONCURRENCY=24
|
|
41
|
+
# Parallel caption batches per chronological continuity wave. Only
|
|
42
|
+
# source-grounded continuity candidates cross to the following wave.
|
|
43
|
+
LARKUP_VIDEO_CONTINUITY_WAVE_BATCHES=4
|
|
41
44
|
LARKUP_VIDEO_GATEWAY_REQUESTS_PER_MINUTE=60
|
|
42
45
|
LARKUP_VIDEO_GOOGLE_CONCURRENCY=4
|
|
43
46
|
LARKUP_VIDEO_GOOGLE_MAX_IMAGES_PER_REQUEST=8
|
package/README.md
CHANGED
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
An installable Marketplace v3 tool with a cloud-first Larkup Cloud connection. On first use, the app creates an opaque, device-scoped key automatically; administrators may also provide a replacement key in Installed Tools. The AWS GPU endpoint and raw key are never shown in the connection status. PyAV/FFmpeg, faster-whisper, RapidOCR/PaddleOCR, YOLOX, ONNX Runtime, and anonymous tracking are isolated in runtime images.
|
|
4
4
|
|
|
5
|
-
The evidence pipeline is genre-neutral.
|
|
6
|
-
question
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
The evidence pipeline is genre-neutral. The chat model turns the meaning of a
|
|
6
|
+
question into a typed investigation directive: local, temporal, or whole-source
|
|
7
|
+
scope plus an answer, comparison, trace, enumeration, or synthesis operation.
|
|
8
|
+
The executor validates and performs that operation without selecting a workflow
|
|
9
|
+
from question words, language, or video genre. Direct visual claims preserve
|
|
10
|
+
generic `subject`, `relation`, and `value` bindings so the same corroboration
|
|
11
|
+
logic works across every source. Captioning progresses in chronological waves:
|
|
12
|
+
only identities grounded by source evidence become continuity candidates for a
|
|
13
|
+
later wave, and visual resemblance alone never establishes identity.
|
|
10
14
|
|
|
11
15
|
## Where things live
|
|
12
16
|
|
|
@@ -151,7 +155,7 @@ evidence so a caller can audit both speed and extraction quality.
|
|
|
151
155
|
|
|
152
156
|
For managed cloud jobs, the Data-library asset is the canonical copy. A short-lived, KMS-encrypted processing copy is created only so the GPU worker can decode it; it is deleted when the job settles, including failed and cancelled jobs. Once the app has downloaded the evidence, it acknowledges the result and the cloud result object is deleted too. S3 lifecycle rules remove any abandoned processing source or result within one day as a safety bound.
|
|
153
157
|
|
|
154
|
-
For a complex chat question, the agent
|
|
158
|
+
For a complex chat question, the agent routes the question before answering: focused facts use ranked timestamped evidence, a request for every source-authored question or written item uses an unranked chronological scan, and people/timeline requests can use a revision-scoped aggregate retained outside the chat context. The source mapper separates content-bearing prompts from interactional speech and declarative clues, stores directly established grids, sequences, and collections independently from their readable prompt text, and records separately resolved instances of a reusable prompt when the source proves their boundaries. That lets chat distinguish a complete source scan from a partially legible layout instead of treating banter or hints as questions. A full-source result is marked complete only when every source-inventory window finished; otherwise the response stays explicitly partial. Answers and respondents attached to an inventoried question are retained only when nearby source evidence contains them. If the selected evidence is incomplete, the agent may request one authorized, bounded cloud re-analysis (maximum 30 seconds per request) and then reads the resulting evidence again. The worker seeks directly to the approved range for model inference; source transfer and scale-to-zero GPU startup can still add latency for large videos.
|
|
155
159
|
|
|
156
160
|
### Answer memory and corrections
|
|
157
161
|
|
|
@@ -249,6 +253,7 @@ These are self-hosted worker/service variables. Managed Cloud receives the corre
|
|
|
249
253
|
| `LARKUP_VIDEO_AGENT_PROVIDER` | `vercel_ai_gateway` | Defaults from the AI Models chat provider and can be overridden per tool; supports Gateway, Google, OpenAI, DeepSeek, Mistral, Cohere, and Anthropic. |
|
|
250
254
|
| `LARKUP_VIDEO_AGENT_API_KEY` | unset | User-owned agent provider credential. |
|
|
251
255
|
| `LARKUP_VIDEO_AGENT_MODEL` | `openai/gpt-5-mini` | Tool-brain model that chooses modalities, sampling density, priority ranges, and extraction focus. |
|
|
256
|
+
| `LARKUP_VIDEO_CONTINUITY_WAVE_BATCHES` | `4` | Parallel vision batches per chronological wave. Only source-grounded continuity candidates cross from one wave to the next. |
|
|
252
257
|
| `LARKUP_VIDEO_GOOGLE_CONCURRENCY` | `4` | Maximum simultaneous native Gemini vision batches. Kept below Gateway concurrency to avoid direct-project burst limits. |
|
|
253
258
|
| `LARKUP_VIDEO_GOOGLE_MAX_IMAGES_PER_REQUEST` | `8` | Bounds native Gemini request size so multi-clip structured responses remain within interactive provider timeouts. |
|
|
254
259
|
| `LARKUP_VIDEO_GOOGLE_REQUESTS_PER_MINUTE` | `12` | Sliding-window request limit for native Gemini vision calls, leaving quota headroom for the agent model. |
|
package/dist/agent.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AgentToolExecutionContext } from '@larkup/marketplace/extension';
|
|
2
|
+
import type { VideoInvestigationDirective } from '@larkup/core/video-knowledge/query-planner';
|
|
2
3
|
import type { VideoIntelligenceClient } from './client.js';
|
|
3
4
|
type InspectionPurpose = 'verify-visual' | 'high-res-ocr' | 'compare' | 'count' | 'track' | 'code';
|
|
4
5
|
type AnalysisMode = 'fast' | 'balanced' | 'thorough';
|
|
@@ -19,6 +20,12 @@ interface InspectVideoKnowledgeInput {
|
|
|
19
20
|
interface QueryVideoEvidenceInput {
|
|
20
21
|
mediaAssetId: string;
|
|
21
22
|
query: string;
|
|
23
|
+
/**
|
|
24
|
+
* Optional semantic instruction produced by the chat model. The evidence
|
|
25
|
+
* action still has a safe focused retrieval path when a weak model cannot
|
|
26
|
+
* construct the richer directive.
|
|
27
|
+
*/
|
|
28
|
+
investigation?: VideoInvestigationDirective;
|
|
22
29
|
limit?: number;
|
|
23
30
|
exhaustive?: boolean;
|
|
24
31
|
cursor?: number;
|
|
@@ -45,6 +52,48 @@ export declare const AGENT_TOOLS: ({
|
|
|
45
52
|
minLength: number;
|
|
46
53
|
maxLength: number;
|
|
47
54
|
};
|
|
55
|
+
investigation: {
|
|
56
|
+
type: string;
|
|
57
|
+
additionalProperties: boolean;
|
|
58
|
+
required: string[];
|
|
59
|
+
properties: {
|
|
60
|
+
scope: {
|
|
61
|
+
type: string;
|
|
62
|
+
enum: string[];
|
|
63
|
+
};
|
|
64
|
+
goal: {
|
|
65
|
+
type: string;
|
|
66
|
+
enum: string[];
|
|
67
|
+
};
|
|
68
|
+
evidence: {
|
|
69
|
+
type: string;
|
|
70
|
+
maxItems: number;
|
|
71
|
+
items: {
|
|
72
|
+
type: string;
|
|
73
|
+
enum: string[];
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
recordSet: {
|
|
77
|
+
type: string;
|
|
78
|
+
enum: string[];
|
|
79
|
+
};
|
|
80
|
+
timeRange: {
|
|
81
|
+
type: string;
|
|
82
|
+
additionalProperties: boolean;
|
|
83
|
+
required: string[];
|
|
84
|
+
properties: {
|
|
85
|
+
startSecs: {
|
|
86
|
+
type: string;
|
|
87
|
+
minimum: number;
|
|
88
|
+
};
|
|
89
|
+
endSecs: {
|
|
90
|
+
type: string;
|
|
91
|
+
minimum: number;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
};
|
|
48
97
|
limit: {
|
|
49
98
|
type: string;
|
|
50
99
|
minimum: number;
|
|
@@ -117,6 +166,7 @@ export declare const AGENT_TOOLS: ({
|
|
|
117
166
|
type: string;
|
|
118
167
|
};
|
|
119
168
|
query?: undefined;
|
|
169
|
+
investigation?: undefined;
|
|
120
170
|
limit?: undefined;
|
|
121
171
|
exhaustive?: undefined;
|
|
122
172
|
cursor?: undefined;
|