@larkup/tool-video-intelligence 0.2.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.
Files changed (54) hide show
  1. package/.env.example +150 -0
  2. package/LICENSE +176 -0
  3. package/README.md +281 -0
  4. package/compose.gpu.yaml +14 -0
  5. package/compose.yaml +71 -0
  6. package/dist/agent.d.ts +131 -0
  7. package/dist/agent.js +2087 -0
  8. package/dist/brief.d.ts +2 -0
  9. package/dist/brief.js +37 -0
  10. package/dist/client.d.ts +46 -0
  11. package/dist/client.js +139 -0
  12. package/dist/contracts.d.ts +331 -0
  13. package/dist/contracts.js +1 -0
  14. package/dist/index.d.ts +87 -0
  15. package/dist/index.js +391 -0
  16. package/dist/runtime.d.ts +96 -0
  17. package/dist/runtime.js +592 -0
  18. package/dist/ui.d.ts +82 -0
  19. package/dist/ui.js +87 -0
  20. package/package.json +84 -0
  21. package/runtime/Dockerfile +119 -0
  22. package/runtime/app/__init__.py +3 -0
  23. package/runtime/app/__main__.py +19 -0
  24. package/runtime/app/api/__init__.py +0 -0
  25. package/runtime/app/api/deps.py +69 -0
  26. package/runtime/app/api/v1.py +166 -0
  27. package/runtime/app/config.py +78 -0
  28. package/runtime/app/db/__init__.py +0 -0
  29. package/runtime/app/db/schemas.py +162 -0
  30. package/runtime/app/db/store.py +466 -0
  31. package/runtime/app/main.py +27 -0
  32. package/runtime/app/model_configuration.py +157 -0
  33. package/runtime/app/services/__init__.py +0 -0
  34. package/runtime/app/services/brain.py +2221 -0
  35. package/runtime/app/services/embedding.py +473 -0
  36. package/runtime/app/services/jobs.py +237 -0
  37. package/runtime/app/services/motion.py +66 -0
  38. package/runtime/app/services/pipeline.py +1911 -0
  39. package/runtime/app/services/scene.py +161 -0
  40. package/runtime/app/services/storage.py +44 -0
  41. package/runtime/app/services/transcription.py +667 -0
  42. package/runtime/app/services/vision.py +1441 -0
  43. package/runtime/app/utils/__init__.py +0 -0
  44. package/runtime/app/utils/timing.py +99 -0
  45. package/runtime/app/worker.py +20 -0
  46. package/runtime/pyproject.toml +56 -0
  47. package/runtime/requirements-cpu.txt +15 -0
  48. package/runtime/requirements-smoke.txt +7 -0
  49. package/runtime/requirements.txt +14 -0
  50. package/runtime/uv.lock +3637 -0
  51. package/scripts/grant-cloud-credits.sh +43 -0
  52. package/scripts/runtime.mjs +156 -0
  53. package/scripts/validate-indexing.mjs +168 -0
  54. package/tool.manifest.json +617 -0
package/compose.yaml ADDED
@@ -0,0 +1,71 @@
1
+ services:
2
+ video-intelligence:
3
+ build:
4
+ context: .
5
+ dockerfile: runtime/Dockerfile
6
+ target: cpu
7
+ image: ${LARKUP_VIDEO_IMAGE:-ghcr.io/larkup-ai/video-intelligence:0.1.0}
8
+ ports:
9
+ - '${LARKUP_VIDEO_PORT:-8787}:8787'
10
+ # Values are injected by the selected tool configuration at launch. This
11
+ # keeps a local runtime isolated from developer machine secrets.
12
+ environment:
13
+ LARKUP_VIDEO_DATA_DIR: /data
14
+ LARKUP_VIDEO_MODEL_DIR: /models
15
+ LARKUP_VIDEO_RUNTIME_KIND: local-docker
16
+ LARKUP_VIDEO_REQUIRE_AUTH: ${LARKUP_VIDEO_REQUIRE_AUTH:-false}
17
+ LARKUP_VIDEO_SHARED_API_KEY: ${LARKUP_VIDEO_SHARED_API_KEY:-}
18
+ LARKUP_VIDEO_ADMIN_TOKEN: ${LARKUP_VIDEO_ADMIN_TOKEN:-}
19
+ LARKUP_VIDEO_WORKERS: ${LARKUP_VIDEO_WORKERS:-1}
20
+ LARKUP_VIDEO_DEVICE: ${LARKUP_VIDEO_DEVICE:-auto}
21
+ # Local compute remains on the user's machine. The optional provider
22
+ # calls below use only the user's own selected API key.
23
+ LARKUP_VIDEO_SEMANTIC_VISION: ${LARKUP_VIDEO_SEMANTIC_VISION:-false}
24
+ LARKUP_VIDEO_VISION_PROVIDER: ${LARKUP_VIDEO_VISION_PROVIDER:-vercel_ai_gateway}
25
+ LARKUP_VIDEO_VISION_API_KEY: ${LARKUP_VIDEO_VISION_API_KEY:-}
26
+ AI_GATEWAY_API_KEY: ${AI_GATEWAY_API_KEY:-}
27
+ LARKUP_VIDEO_SEMANTIC_VISION_MODEL: ${LARKUP_VIDEO_SEMANTIC_VISION_MODEL:-alibaba/qwen3.8-27b}
28
+ LARKUP_VIDEO_REASONING_VISION_MODEL: ${LARKUP_VIDEO_REASONING_VISION_MODEL:-alibaba/qwen3-vl-235b-a22b-instruct}
29
+ LARKUP_VIDEO_AGENT_ENABLED: ${LARKUP_VIDEO_AGENT_ENABLED:-false}
30
+ LARKUP_VIDEO_AGENT_PROVIDER: ${LARKUP_VIDEO_AGENT_PROVIDER:-vercel_ai_gateway}
31
+ LARKUP_VIDEO_AGENT_API_KEY: ${LARKUP_VIDEO_AGENT_API_KEY:-}
32
+ LARKUP_VIDEO_AGENT_MODEL: ${LARKUP_VIDEO_AGENT_MODEL:-openai/gpt-5-mini}
33
+ LARKUP_VIDEO_PLANNER_MODEL: ${LARKUP_VIDEO_PLANNER_MODEL:-openai/gpt-5-mini}
34
+ LARKUP_VIDEO_TRANSCRIPTION_PROVIDER: ${LARKUP_VIDEO_TRANSCRIPTION_PROVIDER:-}
35
+ LARKUP_VIDEO_TRANSCRIPTION_FALLBACK: ${LARKUP_VIDEO_TRANSCRIPTION_FALLBACK:-}
36
+ DEEPGRAM_API_KEY: ${DEEPGRAM_API_KEY:-}
37
+ LARKUP_VIDEO_DEEPGRAM_MODEL: ${LARKUP_VIDEO_DEEPGRAM_MODEL:-}
38
+ LARKUP_VIDEO_DEEPGRAM_AUTO_MODEL: ${LARKUP_VIDEO_DEEPGRAM_AUTO_MODEL:-}
39
+ OPENAI_API_KEY: ${OPENAI_API_KEY:-}
40
+ LARKUP_VIDEO_OPENAI_TRANSCRIPTION_MODEL: ${LARKUP_VIDEO_OPENAI_TRANSCRIPTION_MODEL:-}
41
+ GROQ_API_KEY: ${GROQ_API_KEY:-}
42
+ LARKUP_VIDEO_GROQ_TRANSCRIPTION_MODEL: ${LARKUP_VIDEO_GROQ_TRANSCRIPTION_MODEL:-}
43
+ ELEVENLABS_API_KEY: ${ELEVENLABS_API_KEY:-}
44
+ LARKUP_VIDEO_ELEVENLABS_TRANSCRIPTION_MODEL: ${LARKUP_VIDEO_ELEVENLABS_TRANSCRIPTION_MODEL:-}
45
+ LARKUP_VIDEO_EMBEDDING_PROVIDER: ${LARKUP_VIDEO_EMBEDDING_PROVIDER:-disabled}
46
+ DASHSCOPE_API_KEY: ${DASHSCOPE_API_KEY:-}
47
+ DASHSCOPE_WORKSPACE_ID: ${DASHSCOPE_WORKSPACE_ID:-}
48
+ DASHSCOPE_REGION: ${DASHSCOPE_REGION:-}
49
+ RUNPOD_API_KEY: ${RUNPOD_API_KEY:-}
50
+ LARKUP_VIDEO_RUNPOD_EMBEDDING_ENDPOINT_ID: ${LARKUP_VIDEO_RUNPOD_EMBEDDING_ENDPOINT_ID:-}
51
+ LARKUP_VIDEO_HF_EMBEDDING_URL: ${LARKUP_VIDEO_HF_EMBEDDING_URL:-}
52
+ HF_TOKEN: ${HF_TOKEN:-}
53
+ volumes:
54
+ - video-intelligence-data:/data
55
+ - video-intelligence-models:/models
56
+ healthcheck:
57
+ test:
58
+ [
59
+ 'CMD',
60
+ 'python3',
61
+ '-c',
62
+ "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8787/v1/health', timeout=4)",
63
+ ]
64
+ interval: 15s
65
+ timeout: 5s
66
+ retries: 10
67
+ restart: unless-stopped
68
+
69
+ volumes:
70
+ video-intelligence-data:
71
+ video-intelligence-models:
@@ -0,0 +1,131 @@
1
+ import type { AgentToolExecutionContext } from '@larkup/marketplace/extension';
2
+ import type { VideoIntelligenceClient } from './client.js';
3
+ type InspectionPurpose = 'verify-visual' | 'high-res-ocr' | 'compare' | 'count' | 'track' | 'code';
4
+ type AnalysisMode = 'fast' | 'balanced' | 'thorough';
5
+ interface InspectVideoKnowledgeInput {
6
+ mediaAssetId: string;
7
+ startSecs: number;
8
+ endSecs: number;
9
+ purpose: InspectionPurpose;
10
+ queryId: string;
11
+ question?: string;
12
+ maxFrames?: number;
13
+ analysisMode?: AnalysisMode;
14
+ knownEntities?: string[];
15
+ continuousSequence?: boolean;
16
+ includeSpeech?: boolean;
17
+ maxWaitMs?: number;
18
+ }
19
+ interface QueryVideoEvidenceInput {
20
+ mediaAssetId: string;
21
+ query: string;
22
+ limit?: number;
23
+ exhaustive?: boolean;
24
+ cursor?: number;
25
+ }
26
+ export interface VideoIntelligenceAgentClient extends VideoIntelligenceClient {
27
+ queryVideoEvidence(input: QueryVideoEvidenceInput, context: AgentToolExecutionContext): Promise<unknown>;
28
+ inspectVideoKnowledge(input: InspectVideoKnowledgeInput, context: AgentToolExecutionContext): Promise<unknown>;
29
+ }
30
+ /** Chat actions stay inside the installed tool; the host only sees workflow roles. */
31
+ export declare const AGENT_TOOLS: ({
32
+ name: string;
33
+ description: string;
34
+ parameters: {
35
+ type: string;
36
+ additionalProperties: boolean;
37
+ required: string[];
38
+ properties: {
39
+ mediaAssetId: {
40
+ type: string;
41
+ minLength: number;
42
+ };
43
+ query: {
44
+ type: string;
45
+ minLength: number;
46
+ maxLength: number;
47
+ };
48
+ limit: {
49
+ type: string;
50
+ minimum: number;
51
+ maximum: number;
52
+ };
53
+ exhaustive: {
54
+ type: string;
55
+ };
56
+ cursor: {
57
+ type: string;
58
+ minimum: number;
59
+ };
60
+ startSecs?: undefined;
61
+ endSecs?: undefined;
62
+ purpose?: undefined;
63
+ queryId?: undefined;
64
+ question?: undefined;
65
+ maxFrames?: undefined;
66
+ continuousSequence?: undefined;
67
+ includeSpeech?: undefined;
68
+ };
69
+ };
70
+ method: string;
71
+ workflow: "evidence-query";
72
+ evidenceInput: "media-asset";
73
+ systemPromptFragment: string;
74
+ } | {
75
+ name: string;
76
+ description: string;
77
+ parameters: {
78
+ type: string;
79
+ additionalProperties: boolean;
80
+ required: string[];
81
+ properties: {
82
+ mediaAssetId: {
83
+ type: string;
84
+ minLength?: undefined;
85
+ };
86
+ startSecs: {
87
+ type: string;
88
+ minimum: number;
89
+ };
90
+ endSecs: {
91
+ type: string;
92
+ minimum: number;
93
+ };
94
+ purpose: {
95
+ type: string;
96
+ enum: string[];
97
+ };
98
+ queryId: {
99
+ type: string;
100
+ minLength: number;
101
+ maxLength: number;
102
+ };
103
+ question: {
104
+ type: string;
105
+ minLength: number;
106
+ maxLength: number;
107
+ };
108
+ maxFrames: {
109
+ type: string;
110
+ minimum: number;
111
+ maximum: number;
112
+ };
113
+ continuousSequence: {
114
+ type: string;
115
+ };
116
+ includeSpeech: {
117
+ type: string;
118
+ };
119
+ query?: undefined;
120
+ limit?: undefined;
121
+ exhaustive?: undefined;
122
+ cursor?: undefined;
123
+ };
124
+ };
125
+ method: string;
126
+ workflow: "evidence-refinement";
127
+ systemPromptFragment: string;
128
+ evidenceInput?: undefined;
129
+ })[];
130
+ export declare function attachVideoIntelligenceAgentClient(client: VideoIntelligenceClient, fetcher?: typeof globalThis.fetch): VideoIntelligenceAgentClient;
131
+ export {};